aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/bitmap/bdfread.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 14:29:10 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 14:29:10 +0000
commitddfb922180a6a847d52609592a2bdb37179ca439 (patch)
tree7cc662bfb9ffb45c4c4452ea373e3c1a843b395a /libXfont/src/bitmap/bdfread.c
parent02934f83dd4f5848083e2e5cdbc6ef7f60361f06 (diff)
parent2fb179f86b0f9ecb7876759b87f9c64634a3f114 (diff)
downloadvcxsrv-ddfb922180a6a847d52609592a2bdb37179ca439.tar.gz
vcxsrv-ddfb922180a6a847d52609592a2bdb37179ca439.tar.bz2
vcxsrv-ddfb922180a6a847d52609592a2bdb37179ca439.zip
svn merge file:///D:/svnrepos/vcxsrv/branches/released .
Gives currently link errors. xorg-server needs to be upgraded to.
Diffstat (limited to 'libXfont/src/bitmap/bdfread.c')
-rw-r--r--libXfont/src/bitmap/bdfread.c71
1 files changed, 31 insertions, 40 deletions
diff --git a/libXfont/src/bitmap/bdfread.c b/libXfont/src/bitmap/bdfread.c
index a6f0c1e7e..083565358 100644
--- a/libXfont/src/bitmap/bdfread.c
+++ b/libXfont/src/bitmap/bdfread.c
@@ -56,9 +56,7 @@ from The Open Group.
#include <config.h>
#endif
-#ifndef FONTMODULE
#include <ctype.h>
-#endif
#include <X11/fonts/fntfilst.h>
#include <X11/fonts/fontutil.h>
/* use bitmap structure */
@@ -102,7 +100,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
widthBytes = BYTES_PER_ROW(widthBits, glyph);
if (widthBytes * height > 0) {
- picture = (unsigned char *) xalloc(widthBytes * height);
+ picture = malloc(widthBytes * height);
if (!picture) {
bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height);
goto BAILOUT;
@@ -192,7 +190,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
return (TRUE);
BAILOUT:
if (picture)
- xfree(picture);
+ free(picture);
pCI->bits = NULL;
return (FALSE);
}
@@ -229,25 +227,25 @@ bdfFreeFontBits(FontPtr pFont)
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
bitmapExtra = (BitmapExtraPtr) bitmapFont->bitmapExtra;
- xfree(bitmapFont->ink_metrics);
+ free(bitmapFont->ink_metrics);
if(bitmapFont->encoding) {
nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
(pFont->info.lastRow - pFont->info.firstRow + 1);
for(i=0; i<NUM_SEGMENTS(nencoding); i++)
- xfree(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding[i]);
}
- xfree(bitmapFont->encoding);
+ free(bitmapFont->encoding);
for (i = 0; i < bitmapFont->num_chars; i++)
- xfree(bitmapFont->metrics[i].bits);
- xfree(bitmapFont->metrics);
+ free(bitmapFont->metrics[i].bits);
+ free(bitmapFont->metrics);
if (bitmapExtra)
{
- xfree (bitmapExtra->glyphNames);
- xfree (bitmapExtra->sWidths);
- xfree (bitmapExtra);
+ free (bitmapExtra->glyphNames);
+ free (bitmapExtra->sWidths);
+ free (bitmapExtra);
}
- xfree(pFont->info.props);
- xfree(bitmapFont);
+ free(pFont->info.props);
+ free(bitmapFont);
}
@@ -299,17 +297,16 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
sizeof(CharInfoRec));
goto BAILOUT;
}
- ci = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
+ ci = calloc(nchars, sizeof(CharInfoRec));
if (!ci) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
sizeof(CharInfoRec));
goto BAILOUT;
}
- bzero((char *)ci, nchars * sizeof(CharInfoRec));
bitmapFont->metrics = ci;
if (bitmapExtra) {
- bitmapExtra->glyphNames = (Atom *) xalloc(nchars * sizeof(Atom));
+ bitmapExtra->glyphNames = malloc(nchars * sizeof(Atom));
if (!bitmapExtra->glyphNames) {
bdfError("Couldn't allocate glyphNames (%d*%d)\n",
nchars, sizeof(Atom));
@@ -317,7 +314,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
}
if (bitmapExtra) {
- bitmapExtra->sWidths = (int *) xalloc(nchars * sizeof(int));
+ bitmapExtra->sWidths = malloc(nchars * sizeof(int));
if (!bitmapExtra->sWidths) {
bdfError("Couldn't allocate sWidth (%d *%d)\n",
nchars, sizeof(int));
@@ -383,8 +380,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (char_col > pFont->info.lastCol)
pFont->info.lastCol = char_col;
if (bdfEncoding[char_row] == (CharInfoPtr *) NULL) {
- bdfEncoding[char_row] =
- (CharInfoPtr *) xalloc(256 * sizeof(CharInfoPtr));
+ bdfEncoding[char_row] = malloc(256 * sizeof(CharInfoPtr));
if (!bdfEncoding[char_row]) {
bdfError("Couldn't allocate row %d of encoding (%d*%d)\n",
char_row, INDICES, sizeof(CharInfoPtr));
@@ -493,9 +489,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
nencoding = (pFont->info.lastRow - pFont->info.firstRow + 1) *
(pFont->info.lastCol - pFont->info.firstCol + 1);
- bitmapFont->encoding =
- (CharInfoPtr **) xcalloc(NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ bitmapFont->encoding = calloc(NUM_SEGMENTS(nencoding),sizeof(CharInfoPtr*));
if (!bitmapFont->encoding) {
bdfError("Couldn't allocate ppCI (%d,%d)\n",
NUM_SEGMENTS(nencoding),
@@ -519,8 +513,8 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
else {
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)]) {
bitmapFont->encoding[SEGMENT_MAJOR(i)]=
- (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE,
- sizeof(CharInfoPtr));
+ calloc(BITMAP_FONT_SEGMENT_SIZE,
+ sizeof(CharInfoPtr));
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)])
goto BAILOUT;
}
@@ -533,12 +527,12 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
for (i = 0; i < 256; i++)
if (bdfEncoding[i])
- xfree(bdfEncoding[i]);
+ free(bdfEncoding[i]);
return (TRUE);
BAILOUT:
for (i = 0; i < 256; i++)
if (bdfEncoding[i])
- xfree(bdfEncoding[i]);
+ free(bdfEncoding[i]);
/* bdfFreeFontBits will clean up the rest */
return (FALSE);
}
@@ -615,21 +609,20 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
pFont->info.props = NULL;
pFont->info.nprops = 0;
- stringProps = (char *) xalloc((nProps + BDF_GENPROPS) * sizeof(char));
+ stringProps = malloc((nProps + BDF_GENPROPS) * sizeof(char));
pFont->info.isStringProp = stringProps;
if (stringProps == NULL) {
bdfError("Couldn't allocate stringProps (%d*%d)\n",
(nProps + BDF_GENPROPS), sizeof(Bool));
goto BAILOUT;
}
- pFont->info.props = props = (FontPropPtr) xalloc((nProps + BDF_GENPROPS) *
- sizeof(FontPropRec));
+ pFont->info.props = props = calloc(nProps + BDF_GENPROPS,
+ sizeof(FontPropRec));
if (props == NULL) {
bdfError("Couldn't allocate props (%d*%d)\n", nProps + BDF_GENPROPS,
sizeof(FontPropRec));
goto BAILOUT;
}
- bzero((char *)props, (nProps + BDF_GENPROPS) * sizeof(FontPropRec));
nextProp = 0;
props_left = nProps;
@@ -770,11 +763,11 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
return (TRUE);
BAILOUT:
if (pFont->info.isStringProp) {
- xfree(pFont->info.isStringProp);
+ free(pFont->info.isStringProp);
pFont->info.isStringProp = NULL;
}
if (pFont->info.props) {
- xfree(pFont->info.props);
+ free(pFont->info.props);
pFont->info.props = NULL;
}
while (line && bdfIsPrefix(line, "ENDPROPERTIES"))
@@ -808,12 +801,11 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
if (!bdfReadHeader(file, &state))
goto BAILOUT;
- bitmapFont = (BitmapFontPtr) xalloc(sizeof(BitmapFontRec));
+ bitmapFont = calloc(1, sizeof(BitmapFontRec));
if (!bitmapFont) {
bdfError("Couldn't allocate bitmapFontRec (%d)\n", sizeof(BitmapFontRec));
goto BAILOUT;
}
- bzero((char *)bitmapFont, sizeof(BitmapFontRec));
pFont->fontPrivate = (pointer) bitmapFont;
bitmapFont->metrics = 0;
@@ -822,12 +814,11 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont->encoding = 0;
bitmapFont->pDefault = NULL;
- bitmapFont->bitmapExtra = (BitmapExtraPtr) xalloc(sizeof(BitmapExtraRec));
+ bitmapFont->bitmapExtra = calloc(1, sizeof(BitmapExtraRec));
if (!bitmapFont->bitmapExtra) {
bdfError("Couldn't allocate bitmapExtra (%d)\n", sizeof(BitmapExtraRec));
goto BAILOUT;
}
- bzero((char *)bitmapFont->bitmapExtra, sizeof(BitmapExtraRec));
bitmapFont->bitmapExtra->glyphNames = 0;
bitmapFont->bitmapExtra->sWidths = 0;
@@ -945,14 +936,14 @@ bdfPadToTerminal(FontPtr pFont)
new_size = BYTES_FOR_GLYPH(&new, pFont->glyph);
for (i = 0; i < bitmapFont->num_chars; i++) {
- new.bits = (char *) xalloc(new_size);
+ new.bits = malloc(new_size);
if (!new.bits) {
bdfError("Couldn't allocate bits (%d)\n", new_size);
return FALSE;
- }
+ }
FontCharReshape(pFont, &bitmapFont->metrics[i], &new);
new.metrics.attributes = bitmapFont->metrics[i].metrics.attributes;
- xfree(bitmapFont->metrics[i].bits);
+ free(bitmapFont->metrics[i].bits);
bitmapFont->metrics[i] = new;
}
bitmapExtra = bitmapFont->bitmapExtra;