summaryrefslogtreecommitdiff
path: root/src/bitmap
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2009-01-20 23:16:35 -0500
committerAdam Jackson <ajax@redhat.com>2009-01-20 23:16:35 -0500
commit0cdc9b8f850342d50b72a57507db3413eacc6fb8 (patch)
treeb86480167977d28f8e7574c91aedf982db52bf32 /src/bitmap
parent632a2e90a4b209facc84d7a18873f19a720ea7df (diff)
xalloc -> malloc, etc.
Diffstat (limited to 'src/bitmap')
-rw-r--r--src/bitmap/bdfread.c69
-rw-r--r--src/bitmap/bdfutils.c6
-rw-r--r--src/bitmap/bitmapfunc.c2
-rw-r--r--src/bitmap/bitmaputil.c2
-rw-r--r--src/bitmap/bitscale.c74
-rw-r--r--src/bitmap/pcfread.c86
-rw-r--r--src/bitmap/pcfwrite.c6
-rw-r--r--src/bitmap/snfread.c59
8 files changed, 143 insertions, 161 deletions
diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c
index f9a3a5f..0835653 100644
--- a/src/bitmap/bdfread.c
+++ b/src/bitmap/bdfread.c
@@ -100,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;
@@ -190,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);
}
@@ -227,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);
}
@@ -297,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));
@@ -315,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));
@@ -381,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));
@@ -491,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),
@@ -517,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;
}
@@ -531,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);
}
@@ -613,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;
@@ -768,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"))
@@ -806,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;
@@ -820,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;
@@ -943,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;
diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c
index 61406b8..17596c3 100644
--- a/src/bitmap/bdfutils.c
+++ b/src/bitmap/bdfutils.c
@@ -174,7 +174,7 @@ bdfGetPropertyValue(char *s)
}
/* quoted string: strip outer quotes and undouble inner quotes */
s++;
- pp = p = (char *) xalloc((unsigned) strlen(s) + 1);
+ pp = p = malloc((unsigned) strlen(s) + 1);
if (pp == NULL) {
bdfError("Couldn't allocate property value string (%d)\n", strlen(s) + 1);
return None;
@@ -184,7 +184,7 @@ bdfGetPropertyValue(char *s)
if (*(s + 1) != '"') {
*p++ = 0;
atom = bdfForceMakeAtom(pp, NULL);
- xfree(pp);
+ free(pp);
return atom;
} else {
s++;
@@ -192,7 +192,7 @@ bdfGetPropertyValue(char *s)
}
*p++ = *s++;
}
- xfree (pp);
+ free (pp);
bdfError("unterminated quoted string property: %s\n", (pointer) orig_s);
return None;
}
diff --git a/src/bitmap/bitmapfunc.c b/src/bitmap/bitmapfunc.c
index 27f0cd1..80d7da1 100644
--- a/src/bitmap/bitmapfunc.c
+++ b/src/bitmap/bitmapfunc.c
@@ -148,7 +148,7 @@ BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags,
FontFileClose (file);
if (ret != Successful) {
- xfree(pFont);
+ free(pFont);
} else {
*ppFont = pFont;
}
diff --git a/src/bitmap/bitmaputil.c b/src/bitmap/bitmaputil.c
index 3487f7f..3a7bbc7 100644
--- a/src/bitmap/bitmaputil.c
+++ b/src/bitmap/bitmaputil.c
@@ -212,7 +212,7 @@ bitmapAddInkMetrics(FontPtr pFont)
int i;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- bitmapFont->ink_metrics = (xCharInfo *) xalloc(bitmapFont->num_chars * sizeof(xCharInfo));
+ bitmapFont->ink_metrics = malloc(bitmapFont->num_chars * sizeof(xCharInfo));
if (!bitmapFont->ink_metrics) {
fprintf(stderr, "Error: Couldn't allocate ink_metrics (%d*%ld)\n",
bitmapFont->num_chars, (unsigned long)sizeof(xCharInfo));
diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c
index 4b90f5d..824023f 100644
--- a/src/bitmap/bitscale.c
+++ b/src/bitmap/bitscale.c
@@ -614,19 +614,19 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */
}
nProps = NPROPS + 1 + sizeof(fontPropTable) / sizeof(fontProp) +
sizeof(rawFontPropTable) / sizeof(fontProp);
- fp = (FontPropPtr) xalloc(sizeof(FontPropRec) * nProps);
+ fp = malloc(sizeof(FontPropRec) * nProps);
*pProps = fp;
if (!fp) {
fprintf(stderr, "Error: Couldn't allocate font properties (%ld*%d)\n",
(unsigned long)sizeof(FontPropRec), nProps);
return 1;
}
- isStringProp = (char *) xalloc (nProps);
+ isStringProp = malloc (nProps);
*pIsStringProp = isStringProp;
if (!isStringProp)
{
fprintf(stderr, "Error: Couldn't allocate isStringProp (%d)\n", nProps);
- xfree (fp);
+ free (fp);
return 1;
}
ptr2 = name;
@@ -867,7 +867,7 @@ ScaleFont(FontPtr opf, /* originating font */
lastRow = opfi->lastRow;
}
- bitmapFont = (BitmapFontPtr) xalloc(sizeof(BitmapFontRec));
+ bitmapFont = malloc(sizeof(BitmapFontRec));
if (!bitmapFont) {
fprintf(stderr, "Error: Couldn't allocate bitmapFont (%ld)\n",
(unsigned long)sizeof(BitmapFontRec));
@@ -888,15 +888,13 @@ ScaleFont(FontPtr opf, /* originating font */
bitmapFont->encoding = 0;
bitmapFont->bitmapExtra = 0;
bitmapFont->pDefault = 0;
- bitmapFont->metrics = (CharInfoPtr) xalloc(nchars * sizeof(CharInfoRec));
+ bitmapFont->metrics = malloc(nchars * sizeof(CharInfoRec));
if (!bitmapFont->metrics) {
fprintf(stderr, "Error: Couldn't allocate metrics (%d*%ld)\n",
nchars, (unsigned long)sizeof(CharInfoRec));
goto bail;
}
- bitmapFont->encoding =
- (CharInfoPtr **) xcalloc(NUM_SEGMENTS(nchars),
- sizeof(CharInfoPtr*));
+ bitmapFont->encoding = calloc(NUM_SEGMENTS(nchars), sizeof(CharInfoPtr*));
if (!bitmapFont->encoding) {
fprintf(stderr, "Error: Couldn't allocate encoding (%d*%ld)\n",
nchars, (unsigned long)sizeof(CharInfoPtr));
@@ -974,8 +972,7 @@ ScaleFont(FontPtr opf, /* originating font */
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 bail;
}
@@ -1117,15 +1114,15 @@ ScaleFont(FontPtr opf, /* originating font */
return pf;
bail:
if (pf)
- xfree(pf);
+ free(pf);
if (bitmapFont) {
- xfree(bitmapFont->metrics);
- xfree(bitmapFont->ink_metrics);
- xfree(bitmapFont->bitmaps);
+ free(bitmapFont->metrics);
+ free(bitmapFont->ink_metrics);
+ free(bitmapFont->bitmaps);
if(bitmapFont->encoding)
for(i=0; i<NUM_SEGMENTS(nchars); i++)
- xfree(bitmapFont->encoding[i]);
- xfree(bitmapFont->encoding);
+ free(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding);
}
return NULL;
}
@@ -1206,23 +1203,19 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
/* Looks like we need to anti-alias. Create a workspace to
contain the grayscale character plus an additional row and
column for scratch */
- char_grayscale =
- (unsigned char *)xalloc((width + 1) * (height + 1));
+ char_grayscale = malloc((width + 1) * (height + 1));
if (char_grayscale)
{
- diffusion_workspace =
- (INT32 *)xalloc((newWidth + 2) * 2 * sizeof(int));
+ diffusion_workspace = calloc((newWidth + 2) * 2, sizeof(int));
if (!diffusion_workspace)
{
fprintf(stderr, "Warning: Couldn't allocate diffusion"
" workspace (%ld)\n",
(newWidth + 2) * 2 * (unsigned long)sizeof(int));
- xfree(char_grayscale);
+ free(char_grayscale);
char_grayscale = (unsigned char *)0;
}
/* Initialize our error diffusion workspace for later use */
- bzero((char *)diffusion_workspace + sizeof(INT32),
- (newWidth + 3) * sizeof(int));
thisrow = diffusion_workspace + 1;
nextrow = diffusion_workspace + newWidth + 3;
} else {
@@ -1472,8 +1465,8 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
if (char_grayscale)
{
- xfree(char_grayscale);
- xfree(diffusion_workspace);
+ free(char_grayscale);
+ free(diffusion_workspace);
}
}
@@ -1524,12 +1517,11 @@ BitmapScaleBitmaps(FontPtr pf, /* scaled font */
/* Will need to remember to free in the Unload routine */
- bitmapFont->bitmaps = (char *) xalloc(bytestoalloc);
+ bitmapFont->bitmaps = calloc(1, bytestoalloc);
if (!bitmapFont->bitmaps) {
fprintf(stderr, "Error: Couldn't allocate bitmaps (%d)\n", bytestoalloc);
goto bail;
}
- bzero(bitmapFont->bitmaps, bytestoalloc);
glyphBytes = bitmapFont->bitmaps;
for (i = 0; i < nchars; i++)
@@ -1547,15 +1539,15 @@ BitmapScaleBitmaps(FontPtr pf, /* scaled font */
bail:
if (pf)
- xfree(pf);
+ free(pf);
if (bitmapFont) {
- xfree(bitmapFont->metrics);
- xfree(bitmapFont->ink_metrics);
- xfree(bitmapFont->bitmaps);
+ free(bitmapFont->metrics);
+ free(bitmapFont->ink_metrics);
+ free(bitmapFont->bitmaps);
if(bitmapFont->encoding)
for(i=0; i<NUM_SEGMENTS(nchars); i++)
- xfree(bitmapFont->encoding[i]);
- xfree(bitmapFont->encoding);
+ free(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding);
}
return NULL;
}
@@ -1698,18 +1690,18 @@ bitmapUnloadScalable (FontPtr pFont)
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
pfi = &pFont->info;
- xfree (pfi->props);
- xfree (pfi->isStringProp);
+ free (pfi->props);
+ free (pfi->isStringProp);
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);
- xfree (bitmapFont->bitmaps);
- xfree (bitmapFont->ink_metrics);
- xfree (bitmapFont->metrics);
- xfree (pFont->fontPrivate);
+ free (bitmapFont->encoding);
+ free (bitmapFont->bitmaps);
+ free (bitmapFont->ink_metrics);
+ free (bitmapFont->metrics);
+ free (pFont->fontPrivate);
DestroyFontRec (pFont);
}
diff --git a/src/bitmap/pcfread.c b/src/bitmap/pcfread.c
index 2d4d19e..182144a 100644
--- a/src/bitmap/pcfread.c
+++ b/src/bitmap/pcfread.c
@@ -137,7 +137,7 @@ pcfReadTOC(FontFilePtr file, int *countp)
pcfError("pcfReadTOC(): invalid file format\n");
return NULL;
}
- tables = (PCFTablePtr) xalloc(count * sizeof(PCFTableRec));
+ tables = malloc(count * sizeof(PCFTableRec));
if (!tables) {
pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec));
return (PCFTablePtr) NULL;
@@ -154,7 +154,7 @@ pcfReadTOC(FontFilePtr file, int *countp)
return tables;
Bail:
- xfree(tables);
+ free(tables);
return (PCFTablePtr) NULL;
}
@@ -261,12 +261,12 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
goto Bail;
}
if (IS_EOF(file)) goto Bail;
- props = (FontPropPtr) xalloc(nprops * sizeof(FontPropRec));
+ props = malloc(nprops * sizeof(FontPropRec));
if (!props) {
pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n", nprops, sizeof(FontPropRec));
goto Bail;
}
- isStringProp = (char *) xalloc(nprops * sizeof(char));
+ isStringProp = malloc(nprops * sizeof(char));
if (!isStringProp) {
pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n", nprops, sizeof(char));
goto Bail;
@@ -299,7 +299,7 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
string_size = pcfGetINT32(file, format);
if (string_size < 0) goto Bail;
if (IS_EOF(file)) goto Bail;
- strings = (char *) xalloc(string_size);
+ strings = malloc(string_size);
if (!strings) {
pcfError("pcfGetProperties(): Couldn't allocate strings (%d)\n", string_size);
goto Bail;
@@ -315,14 +315,14 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
strlen(strings + props[i].value), TRUE);
}
}
- xfree(strings);
+ free(strings);
pFontInfo->isStringProp = isStringProp;
pFontInfo->props = props;
pFontInfo->nprops = nprops;
return TRUE;
Bail:
- xfree(isStringProp);
- xfree(props);
+ free(isStringProp);
+ free(props);
return FALSE;
}
@@ -442,7 +442,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
pcfError("pcfReadFont(): invalid file format\n");
goto Bail;
}
- metrics = (CharInfoPtr) xalloc(nmetrics * sizeof(CharInfoRec));
+ metrics = malloc(nmetrics * sizeof(CharInfoRec));
if (!metrics) {
pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n", nmetrics, sizeof(CharInfoRec));
goto Bail;
@@ -468,7 +468,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (nbitmaps != nmetrics || IS_EOF(file))
goto Bail;
/* nmetrics is already ok, so nbitmap also is */
- offsets = (CARD32 *) xalloc(nbitmaps * sizeof(CARD32));
+ offsets = malloc(nbitmaps * sizeof(CARD32));
if (!offsets) {
pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n", nbitmaps, sizeof(CARD32));
goto Bail;
@@ -486,7 +486,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX(format)];
/* guard against completely empty font */
- bitmaps = xalloc(sizebitmaps ? sizebitmaps : 1);
+ bitmaps = malloc(sizebitmaps ? sizebitmaps : 1);
if (!bitmaps) {
pcfError("pcfReadFont(): Couldn't allocate bitmaps (%d)\n", sizebitmaps ? sizebitmaps : 1);
goto Bail;
@@ -517,7 +517,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
xCharInfo *metric;
sizepadbitmaps = bitmapSizes[PCF_SIZE_TO_INDEX(glyph)];
- padbitmaps = (char *) xalloc(sizepadbitmaps);
+ padbitmaps = malloc(sizepadbitmaps);
if (!padbitmaps) {
pcfError("pcfReadFont(): Couldn't allocate padbitmaps (%d)\n", sizepadbitmaps);
goto Bail;
@@ -532,13 +532,13 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
metric->rightSideBearing - metric->leftSideBearing,
metric->ascent + metric->descent);
}
- xfree(bitmaps);
+ free(bitmaps);
bitmaps = padbitmaps;
}
for (i = 0; i < nbitmaps; i++)
metrics[i].bits = bitmaps + offsets[i];
- xfree(offsets);
+ free(offsets);
offsets = NULL;
/* ink metrics ? */
@@ -558,7 +558,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (nink_metrics != nmetrics)
goto Bail;
/* nmetrics already checked */
- ink_metrics = (xCharInfo *) xalloc(nink_metrics * sizeof(xCharInfo));
+ ink_metrics = malloc(nink_metrics * sizeof(xCharInfo));
if (!ink_metrics) {
pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo));
goto Bail;
@@ -594,8 +594,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
nencoding = (pFont->info.lastCol - pFont->info.firstCol + 1) *
(pFont->info.lastRow - pFont->info.firstRow + 1);
- encoding = (CharInfoPtr **) xcalloc(NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ encoding = calloc(NUM_SEGMENTS(nencoding), sizeof(CharInfoPtr*));
if (!encoding) {
pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n", nencoding, sizeof(CharInfoPtr));
goto Bail;
@@ -610,8 +609,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
} else {
if(!encoding[SEGMENT_MAJOR(i)]) {
encoding[SEGMENT_MAJOR(i)]=
- (CharInfoPtr*)xcalloc(BITMAP_FONT_SEGMENT_SIZE,
- sizeof(CharInfoPtr));
+ calloc(BITMAP_FONT_SEGMENT_SIZE, sizeof(CharInfoPtr));
if(!encoding[SEGMENT_MAJOR(i)])
goto Bail;
}
@@ -625,7 +623,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (!pcfGetAccel (&pFont->info, file, tables, ntables, PCF_BDF_ACCELERATORS))
goto Bail;
- bitmapFont = (BitmapFontPtr) xalloc(sizeof *bitmapFont);
+ bitmapFont = malloc(sizeof *bitmapFont);
if (!bitmapFont) {
pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n", sizeof *bitmapFont);
goto Bail;
@@ -664,24 +662,24 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
pFont->byte = byte;
pFont->glyph = glyph;
pFont->scan = scan;
- xfree(tables);
+ free(tables);
return Successful;
Bail:
- xfree(ink_metrics);
+ free(ink_metrics);
if(encoding) {
for(i=0; i<NUM_SEGMENTS(nencoding); i++)
- xfree(encoding[i]);
+ free(encoding[i]);
}
- xfree(encoding);
- xfree(bitmaps);
- xfree(metrics);
- xfree(pFont->info.props);
+ free(encoding);
+ free(bitmaps);
+ free(metrics);
+ free(pFont->info.props);
pFont->info.nprops = 0;
pFont->info.props = 0;
- xfree (pFont->info.isStringProp);
- xfree(bitmapFont);
- xfree(tables);
- xfree(offsets);
+ free (pFont->info.isStringProp);
+ free(bitmapFont);
+ free(tables);
+ free(offsets);
return AllocError;
}
@@ -749,13 +747,13 @@ pcfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
if (!pcfGetAccel (pFontInfo, file, tables, ntables, PCF_BDF_ACCELERATORS))
goto Bail;
- xfree(tables);
+ free(tables);
return Successful;
Bail:
pFontInfo->nprops = 0;
- xfree (pFontInfo->props);
- xfree (pFontInfo->isStringProp);
- xfree(tables);
+ free (pFontInfo->props);
+ free (pFontInfo->isStringProp);
+ free(tables);
return AllocError;
}
@@ -766,18 +764,18 @@ pcfUnloadFont(FontPtr pFont)
int i,nencoding;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- 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]);
- }
- xfree(bitmapFont->encoding);
- xfree(bitmapFont->bitmaps);
- xfree(bitmapFont->metrics);
- xfree(pFont->info.isStringProp);
- xfree(pFont->info.props);
- xfree(bitmapFont);
+ free(bitmapFont->encoding[i]);
+ }
+ free(bitmapFont->encoding);
+ free(bitmapFont->bitmaps);
+ free(bitmapFont->metrics);
+ free(pFont->info.isStringProp);
+ free(pFont->info.props);
+ free(bitmapFont);
DestroyFontRec(pFont);
}
diff --git a/src/bitmap/pcfwrite.c b/src/bitmap/pcfwrite.c
index 8d5e942..5d1aab1 100644
--- a/src/bitmap/pcfwrite.c
+++ b/src/bitmap/pcfwrite.c
@@ -236,7 +236,7 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
ink_minbounds = &pFont->info.ink_minbounds;
ink_maxbounds = &pFont->info.ink_maxbounds;
}
- offsetProps = (FontPropPtr) xalloc(pFont->info.nprops * sizeof(FontPropRec));
+ offsetProps = malloc(pFont->info.nprops * sizeof(FontPropRec));
if (!offsetProps) {
pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)", pFont->info.nprops, sizeof(FontPropRec));
return AllocError;
@@ -358,7 +358,7 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
if (current_position > table->offset) {
printf("can't go backwards... %d > %d\n",
(int)current_position, (int)table->offset);
- xfree(offsetProps);
+ free(offsetProps);
return BadFontName;
}
while (current_position < table->offset)
@@ -463,6 +463,6 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
}
}
- xfree(offsetProps);
+ free(offsetProps);
return Successful;
}
diff --git a/src/bitmap/snfread.c b/src/bitmap/snfread.c
index b35073b..53a72da 100644
--- a/src/bitmap/snfread.c
+++ b/src/bitmap/snfread.c
@@ -147,14 +147,14 @@ snfReadProps(snfFontInfoPtr snfInfo, FontInfoPtr pFontInfo, FontFilePtr file)
bytestoalloc = snfInfo->nProps * sizeof(snfFontPropRec) +
BYTESOFSTRINGINFO(snfInfo);
- propspace = (char *) xalloc(bytestoalloc);
+ propspace = malloc(bytestoalloc);
if (!propspace) {
snfError("snfReadProps(): Couldn't allocate propspace (%d)\n", bytestoalloc);
return AllocError;
}
if (FontFileRead(file, propspace, bytestoalloc) != bytestoalloc) {
- xfree(propspace);
+ free(propspace);
return BadFontName;
}
psnfp = (snfFontPropPtr) propspace;
@@ -172,7 +172,7 @@ snfReadProps(snfFontInfoPtr snfInfo, FontInfoPtr pFontInfo, FontFilePtr file)
pfp->value = psnfp->value;
}
- xfree(propspace);
+ free(propspace);
return Successful;
}
@@ -266,16 +266,16 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
if (fi.inkMetrics)
bytestoalloc += num_chars * sizeof(xCharInfo); /* ink_metrics */
- fontspace = (char *) xalloc(bytestoalloc);
+ fontspace = malloc(bytestoalloc);
if (!fontspace) {
snfError("snfReadFont(): Couldn't allocate fontspace (%d)\n", bytestoalloc);
return AllocError;
}
- bitmaps = (char *) xalloc (bitmapsSize);
+ bitmaps = malloc (bitmapsSize);
if (!bitmaps)
{
snfError("snfReadFont(): Couldn't allocate bitmaps (%d)\n", bitmapsSize);
- xfree (fontspace);
+ free (fontspace);
return AllocError;
}
/*
@@ -308,8 +308,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
if (bitmapFont->metrics[i].bits) {
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)]) {
ret = AllocError;
break;
@@ -320,12 +319,12 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
}
if (ret != Successful) {
- xfree(bitmaps);
+ free(bitmaps);
if(bitmapFont->encoding) {
for(j=0; j<SEGMENT_MAJOR(i); j++)
- xfree(bitmapFont->encoding[i]);
+ free(bitmapFont->encoding[i]);
}
- xfree(fontspace);
+ free(fontspace);
return ret;
}
/*
@@ -333,8 +332,8 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
*/
if (FontFileRead(file, bitmaps, bitmapsSize) != bitmapsSize) {
- xfree(bitmaps);
- xfree(fontspace);
+ free(bitmaps);
+ free(fontspace);
return BadFontName;
}
@@ -366,11 +365,11 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
sizepadbitmaps += BYTES_FOR_GLYPH(metric,glyph);
metric++;
}
- padbitmaps = (char *) xalloc(sizepadbitmaps);
+ padbitmaps = malloc(sizepadbitmaps);
if (!padbitmaps) {
snfError("snfReadFont(): Couldn't allocate padbitmaps (%d)\n", sizepadbitmaps);
- xfree (bitmaps);
- xfree (fontspace);
+ free (bitmaps);
+ free (fontspace);
return AllocError;
}
metric = bitmapFont->metrics;
@@ -385,14 +384,14 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
padbitmaps += sizechar;
metric++;
}
- xfree(bitmaps);
+ free(bitmaps);
}
/* now read and atom'ize properties */
ret = snfReadProps(&fi, &pFont->info, file);
if (ret != Successful) {
- xfree(fontspace);
+ free(fontspace);
return ret;
}
snfCopyInfo(&fi, &pFont->info);
@@ -406,7 +405,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
for (i = 0; ret == Successful && i < num_chars; i++)
ret = snfReadxCharInfo(file, &bitmapFont->ink_metrics[i]);
if (ret != Successful) {
- xfree(fontspace);
+ free(fontspace);
return ret;
}
} else {
@@ -455,15 +454,15 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
return ret;
snfCopyInfo(&fi, pFontInfo);
- pFontInfo->props = (FontPropPtr) xalloc(fi.nProps * sizeof(FontPropRec));
+ pFontInfo->props = malloc(fi.nProps * sizeof(FontPropRec));
if (!pFontInfo->props) {
snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n", fi.nProps, sizeof(FontPropRec));
return AllocError;
}
- pFontInfo->isStringProp = (char *) xalloc(fi.nProps * sizeof(char));
+ pFontInfo->isStringProp = malloc(fi.nProps * sizeof(char));
if (!pFontInfo->isStringProp) {
snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n", fi.nProps, sizeof(char));
- xfree(pFontInfo->props);
+ free(pFontInfo->props);
return AllocError;
}
num_chars = n2dChars(&fi);
@@ -473,21 +472,21 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
ret = snfReadProps(&fi, pFontInfo, file);
if (ret != Successful) {
- xfree(pFontInfo->props);
- xfree(pFontInfo->isStringProp);
+ free(pFontInfo->props);
+ free(pFontInfo->isStringProp);
return ret;
}
if (fi.inkMetrics) {
ret = snfReadxCharInfo(file, &pFontInfo->ink_minbounds);
if (ret != Successful) {
- xfree(pFontInfo->props);
- xfree(pFontInfo->isStringProp);
+ free(pFontInfo->props);
+ free(pFontInfo->isStringProp);
return ret;
}
ret = snfReadxCharInfo(file, &pFontInfo->ink_maxbounds);
if (ret != Successful) {
- xfree(pFontInfo->props);
- xfree(pFontInfo->isStringProp);
+ free(pFontInfo->props);
+ free(pFontInfo->isStringProp);
return ret;
}
} else {
@@ -504,8 +503,8 @@ snfUnloadFont(FontPtr pFont)
BitmapFontPtr bitmapFont;
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- xfree (bitmapFont->bitmaps);
- xfree (bitmapFont);
+ free (bitmapFont->bitmaps);
+ free (bitmapFont);
DestroyFontRec (pFont);
}