aboutsummaryrefslogtreecommitdiff
path: root/libXfont/src/bitmap
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-05 09:59:38 +0100
committermarha <marha@users.sourceforge.net>2012-03-05 09:59:38 +0100
commitffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a (patch)
tree233b818e67de2073647e46e91ac688c6b43d5917 /libXfont/src/bitmap
parent15a500d3edb03668b43cc6898fafcda024d0f006 (diff)
downloadvcxsrv-ffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a.tar.gz
vcxsrv-ffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a.tar.bz2
vcxsrv-ffe218bbb0ffa6d2a7f7cbf6b1f81797e667183a.zip
libfontenc xserver pixman mesa git update 5 Mar 2012
font-util-1.3.0 xclock-1.0.6 libXfont-1.4.5 inputproto-2.2
Diffstat (limited to 'libXfont/src/bitmap')
-rw-r--r--libXfont/src/bitmap/Makefile.in1
-rw-r--r--libXfont/src/bitmap/bdfread.c40
-rw-r--r--libXfont/src/bitmap/bdfutils.c21
-rw-r--r--libXfont/src/bitmap/bitscale.c106
-rw-r--r--libXfont/src/bitmap/pcfread.c54
-rw-r--r--libXfont/src/bitmap/pcfwrite.c7
-rw-r--r--libXfont/src/bitmap/snfread.c18
7 files changed, 132 insertions, 115 deletions
diff --git a/libXfont/src/bitmap/Makefile.in b/libXfont/src/bitmap/Makefile.in
index 583e9b1e6..0b88ec1da 100644
--- a/libXfont/src/bitmap/Makefile.in
+++ b/libXfont/src/bitmap/Makefile.in
@@ -97,6 +97,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BASE_CFLAGS = @BASE_CFLAGS@
CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
diff --git a/libXfont/src/bitmap/bdfread.c b/libXfont/src/bitmap/bdfread.c
index 2464c03cc..e2770dc1c 100644
--- a/libXfont/src/bitmap/bdfread.c
+++ b/libXfont/src/bitmap/bdfread.c
@@ -76,7 +76,7 @@ extern int bdfFileLineNum;
/***====================================================================***/
static Bool
-bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
+bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
int glyph, int scan, CARD32 *sizes)
{
int widthBits,
@@ -99,7 +99,7 @@ bdfReadBitmap(CharInfoPtr pCI, FontFilePtr file, int bit, int byte,
if (widthBytes * height > 0) {
picture = malloc(widthBytes * height);
if (!picture) {
- bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height);
+ bdfError("Couldn't allocate picture (%d*%d)\n", widthBytes, height);
goto BAILOUT;
}
} else
@@ -247,7 +247,7 @@ bdfFreeFontBits(FontPtr pFont)
static Bool
-bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
+bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
int bit, int byte, int glyph, int scan)
{
unsigned char *line;
@@ -291,13 +291,13 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
}
if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
- sizeof(CharInfoRec));
+ (int) sizeof(CharInfoRec));
goto BAILOUT;
}
ci = calloc(nchars, sizeof(CharInfoRec));
if (!ci) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
- sizeof(CharInfoRec));
+ (int) sizeof(CharInfoRec));
goto BAILOUT;
}
bitmapFont->metrics = ci;
@@ -306,7 +306,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bitmapExtra->glyphNames = malloc(nchars * sizeof(Atom));
if (!bitmapExtra->glyphNames) {
bdfError("Couldn't allocate glyphNames (%d*%d)\n",
- nchars, sizeof(Atom));
+ nchars, (int) sizeof(Atom));
goto BAILOUT;
}
}
@@ -314,7 +314,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bitmapExtra->sWidths = malloc(nchars * sizeof(int));
if (!bitmapExtra->sWidths) {
bdfError("Couldn't allocate sWidth (%d *%d)\n",
- nchars, sizeof(int));
+ nchars, (int) sizeof(int));
return FALSE;
}
}
@@ -380,7 +380,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
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));
+ char_row, INDICES, (int) sizeof(CharInfoPtr));
goto BAILOUT;
}
for (i = 0; i < 256; i++)
@@ -490,7 +490,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (!bitmapFont->encoding) {
bdfError("Couldn't allocate ppCI (%d,%d)\n",
NUM_SEGMENTS(nencoding),
- sizeof(CharInfoPtr*));
+ (int) sizeof(CharInfoPtr*));
goto BAILOUT;
}
pFont->info.allExist = TRUE;
@@ -515,7 +515,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
if (!bitmapFont->encoding[SEGMENT_MAJOR(i)])
goto BAILOUT;
}
- ACCESSENCODINGL(bitmapFont->encoding,i) =
+ ACCESSENCODINGL(bitmapFont->encoding,i) =
bdfEncoding[char_row][char_col];
}
i++;
@@ -610,14 +610,14 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
pFont->info.isStringProp = stringProps;
if (stringProps == NULL) {
bdfError("Couldn't allocate stringProps (%d*%d)\n",
- (nProps + BDF_GENPROPS), sizeof(Bool));
+ (nProps + BDF_GENPROPS), (int) sizeof(Bool));
goto BAILOUT;
}
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));
+ (int) sizeof(FontPropRec));
goto BAILOUT;
}
@@ -782,7 +782,7 @@ bdfUnloadFont(FontPtr pFont)
}
int
-bdfReadFont(FontPtr pFont, FontFilePtr file,
+bdfReadFont(FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan)
{
bdfFileState state;
@@ -800,7 +800,8 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont = calloc(1, sizeof(BitmapFontRec));
if (!bitmapFont) {
- bdfError("Couldn't allocate bitmapFontRec (%d)\n", sizeof(BitmapFontRec));
+ bdfError("Couldn't allocate bitmapFontRec (%d)\n",
+ (int) sizeof(BitmapFontRec));
goto BAILOUT;
}
@@ -813,10 +814,11 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont->bitmapExtra = calloc(1, sizeof(BitmapExtraRec));
if (!bitmapFont->bitmapExtra) {
- bdfError("Couldn't allocate bitmapExtra (%d)\n", sizeof(BitmapExtraRec));
+ bdfError("Couldn't allocate bitmapExtra (%d)\n",
+ (int) sizeof(BitmapExtraRec));
goto BAILOUT;
}
-
+
bitmapFont->bitmapExtra->glyphNames = 0;
bitmapFont->bitmapExtra->sWidths = 0;
@@ -836,7 +838,7 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
cols = pFont->info.lastCol - pFont->info.firstCol + 1;
r = r - pFont->info.firstRow;
c = c - pFont->info.firstCol;
- bitmapFont->pDefault = ACCESSENCODING(bitmapFont->encoding,
+ bitmapFont->pDefault = ACCESSENCODING(bitmapFont->encoding,
r * cols + c);
}
}
@@ -859,7 +861,7 @@ bdfReadFont(FontPtr pFont, FontFilePtr file,
bdfError("Failed to add bitmap ink metrics\n");
goto BAILOUT;
}
- }
+ }
if (bitmapFont->bitmapExtra)
bitmapFont->bitmapExtra->info.inkMetrics = pFont->info.inkMetrics;
@@ -924,7 +926,7 @@ bdfPadToTerminal(FontPtr pFont)
bitmapFont = (BitmapFontPtr) pFont->fontPrivate;
- bzero(&new, sizeof(CharInfoRec));
+ bzero(&new, sizeof(CharInfoRec));
new.metrics.ascent = pFont->info.fontAscent;
new.metrics.descent = pFont->info.fontDescent;
new.metrics.leftSideBearing = 0;
diff --git a/libXfont/src/bitmap/bdfutils.c b/libXfont/src/bitmap/bdfutils.c
index 1d6cc7253..288148b36 100644
--- a/libXfont/src/bitmap/bdfutils.c
+++ b/libXfont/src/bitmap/bdfutils.c
@@ -68,7 +68,7 @@ int bdfFileLineNum;
/***====================================================================***/
void
-bdfError(char* message, ...)
+bdfError(const char* message, ...)
{
va_list args;
@@ -81,7 +81,7 @@ bdfError(char* message, ...)
/***====================================================================***/
void
-bdfWarning(char *message, ...)
+bdfWarning(const char *message, ...)
{
va_list args;
@@ -127,7 +127,7 @@ bdfGetLine(FontFilePtr file, unsigned char *buf, int len)
/***====================================================================***/
Atom
-bdfForceMakeAtom(char *str, int *size)
+bdfForceMakeAtom(const char *str, int *size)
{
register int len = strlen(str);
Atom the_atom;
@@ -174,8 +174,9 @@ bdfGetPropertyValue(char *s)
s++;
pp = p = malloc((unsigned) strlen(s) + 1);
if (pp == NULL) {
- bdfError("Couldn't allocate property value string (%d)\n", strlen(s) + 1);
- return None;
+ bdfError("Couldn't allocate property value string (%d)\n",
+ (int) strlen(s) + 1);
+ return None;
}
while (*s) {
if (*s == '"') {
@@ -191,7 +192,7 @@ bdfGetPropertyValue(char *s)
*p++ = *s++;
}
free (pp);
- bdfError("unterminated quoted string property: %s\n", (pointer) orig_s);
+ bdfError("unterminated quoted string property: %s\n", orig_s);
return None;
}
@@ -249,7 +250,7 @@ bdfHexByte(unsigned char *s)
* check for known special property values
*/
-static char *SpecialAtoms[] = {
+static const char *SpecialAtoms[] = {
"FONT_ASCENT",
#define BDF_FONT_ASCENT 0
"FONT_DESCENT",
@@ -276,11 +277,11 @@ static char *SpecialAtoms[] = {
};
Bool
-bdfSpecialProperty(FontPtr pFont, FontPropPtr prop,
+bdfSpecialProperty(FontPtr pFont, FontPropPtr prop,
char isString, bdfFileState *bdfState)
{
- char **special;
- char *name;
+ const char **special;
+ const char *name;
name = NameForAtom(prop->name);
for (special = SpecialAtoms; *special; special++)
diff --git a/libXfont/src/bitmap/bitscale.c b/libXfont/src/bitmap/bitscale.c
index 50818c66e..e89ba7ce0 100644
--- a/libXfont/src/bitmap/bitscale.c
+++ b/libXfont/src/bitmap/bitscale.c
@@ -63,11 +63,11 @@ from The Open Group.
extern unsigned long serverGeneration;
static void bitmapUnloadScalable (FontPtr pFont);
-static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci,
- CharInfoPtr pci, double *inv_xform,
+static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci,
+ CharInfoPtr pci, double *inv_xform,
double widthMult, double heightMult );
-static FontPtr BitmapScaleBitmaps(FontPtr pf, FontPtr opf,
- double widthMult, double heightMult,
+static FontPtr BitmapScaleBitmaps(FontPtr pf, FontPtr opf,
+ double widthMult, double heightMult,
FontScalablePtr vals);
enum scaleType {
@@ -78,17 +78,17 @@ enum scaleType {
};
typedef struct _fontProp {
- char *name;
+ const char *name;
Atom atom;
enum scaleType type;
} fontProp;
-static FontEntryPtr FindBestToScale ( FontPathElementPtr fpe,
- FontEntryPtr entry,
- FontScalablePtr vals,
- FontScalablePtr best,
- double *dxp, double *dyp,
- double *sdxp, double *sdyp,
+static FontEntryPtr FindBestToScale ( FontPathElementPtr fpe,
+ FontEntryPtr entry,
+ FontScalablePtr vals,
+ FontScalablePtr best,
+ double *dxp, double *dyp,
+ double *sdxp, double *sdyp,
FontPathElementPtr *fpep );
static unsigned long bitscaleGeneration = 0; /* initialization flag */
@@ -231,8 +231,8 @@ get_matrix_vertical_component(double *matrix)
static Bool
-ComputeScaleFactors(FontScalablePtr from, FontScalablePtr to,
- double *dx, double *dy, double *sdx, double *sdy,
+ComputeScaleFactors(FontScalablePtr from, FontScalablePtr to,
+ double *dx, double *dy, double *sdx, double *sdy,
double *rescale_x)
{
double srcpixelset, destpixelset, srcpixel, destpixel;
@@ -318,10 +318,10 @@ else \
score += (int)(((double)(8 * s)) * m);
static FontEntryPtr
-FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry,
- FontScalablePtr vals, FontScalablePtr best,
- double *dxp, double *dyp,
- double *sdxp, double *sdyp,
+FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry,
+ FontScalablePtr vals, FontScalablePtr best,
+ double *dxp, double *dyp,
+ double *sdxp, double *sdyp,
FontPathElementPtr *fpep)
{
FontScalableRec temp;
@@ -425,7 +425,7 @@ FindBestToScale(FontPathElementPtr fpe, FontEntryPtr entry,
((score == best_score) &&
((dy_amount < best_dy_amount) ||
((dy_amount == best_dy_amount) &&
- (dx_amount < best_dx_amount)))))
+ (dx_amount < best_dx_amount)))))
{
best_fpe = FontFileBitmapSources.fpe[source];
best_scaled = scaled;
@@ -525,8 +525,8 @@ doround(double x)
}
static int
-computeProps(FontPropPtr pf, char *wasStringProp,
- FontPropPtr npf, char *isStringProp,
+computeProps(FontPropPtr pf, char *wasStringProp,
+ FontPropPtr npf, char *isStringProp,
unsigned int nprops, double xfactor, double yfactor,
double sXfactor, double sYfactor)
{
@@ -580,13 +580,13 @@ computeProps(FontPropPtr pf, char *wasStringProp,
static int
ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */
char *name, /* name of resulting font */
- FontScalablePtr vals,
+ FontScalablePtr vals,
double dx, double dy, /* scale factors in x and y */
double sdx, double sdy, /* directions */
long sWidth, /* 1000-pixel average width */
- FontPropPtr *pProps, /* returns properties;
+ FontPropPtr *pProps, /* returns properties;
preallocated */
- char **pIsStringProp) /* return booleans;
+ char **pIsStringProp) /* return booleans;
preallocated */
{
int n;
@@ -692,8 +692,8 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */
static int
-compute_xform_matrix(FontScalablePtr vals, double dx, double dy,
- double *xform, double *inv_xform,
+compute_xform_matrix(FontScalablePtr vals, double dx, double dy,
+ double *xform, double *inv_xform,
double *xmult, double *ymult)
{
double det;
@@ -752,17 +752,17 @@ compute_xform_matrix(FontScalablePtr vals, double dx, double dy,
* returns a pointer to the new scaled font, or NULL (due to AllocError).
*/
static FontPtr
-ScaleFont(FontPtr opf, /* originating font */
- double widthMult, /* glyphs width scale factor */
- double heightMult, /* glyphs height scale factor */
- double sWidthMult, /* scalable glyphs width scale factor */
- double sHeightMult, /* scalable glyphs height scale factor */
- FontScalablePtr vals,
- double *newWidthMult, /* return: X component of glyphs width
- scale factor */
- double *newHeightMult, /* return: Y component of glyphs height
- scale factor */
- long *sWidth) /* return: average 1000-pixel width */
+ScaleFont(FontPtr opf, /* originating font */
+ double widthMult, /* glyphs width scale factor */
+ double heightMult, /* glyphs height scale factor */
+ double sWidthMult, /* scalable glyphs width scale factor */
+ double sHeightMult, /* scalable glyphs height scale factor */
+ FontScalablePtr vals,
+ double *newWidthMult, /* return: X component of glyphs width
+ scale factor */
+ double *newHeightMult, /* return: Y component of glyphs height
+ scale factor */
+ long *sWidth) /* return: average 1000-pixel width */
{
FontPtr pf;
FontInfoPtr pfi,
@@ -1015,7 +1015,7 @@ ScaleFont(FontPtr opf, /* originating font */
if (pci->metrics.ascent == -pci->metrics.descent)
pci->metrics.ascent++;
}
-
+
pci++;
}
}
@@ -1039,7 +1039,7 @@ ScaleFont(FontPtr opf, /* originating font */
pfi->minbounds.field = pci->metrics.field; \
if (pfi->maxbounds.field < pci->metrics.field) \
pfi->maxbounds.field = pci->metrics.field
-
+
MINMAX(leftSideBearing);
MINMAX(rightSideBearing);
MINMAX(ascent);
@@ -1093,7 +1093,7 @@ ScaleFont(FontPtr opf, /* originating font */
cols = pfi->lastCol - pfi->firstCol + 1;
r = r - pfi->firstRow;
c = c - pfi->firstCol;
- bitmapFont->pDefault =
+ bitmapFont->pDefault =
ACCESSENCODING(bitmapFont->encoding, r * cols + c);
}
}
@@ -1117,7 +1117,7 @@ bail:
}
static void
-ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
+ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
double *inv_xform, double widthMult, double heightMult)
{
register char *bitmap, /* The bits */
@@ -1394,7 +1394,7 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
{
register int x = xValue >> 16, y = yValue >> 16;
int pixvalue, error;
-
+
pixvalue = ((x >= 0 && x < width && y >= 0 && y < height) ?
char_grayscale[x + y * (width + 1)] : 0) +
thisrow[col] / 16;
@@ -1436,7 +1436,7 @@ ScaleBitmap(FontPtr pFont, CharInfoPtr opci, CharInfoPtr pci,
for (col = 0; col < newWidth; col++)
{
register int x = xValue >> 16, y = yValue >> 16;
-
+
if (x >= 0 && x < width && y >= 0 && y < height)
{
/* Use point-sampling for rescaling. */
@@ -1543,13 +1543,13 @@ bail:
/* ARGSUSED */
int
-BitmapOpenScalable (FontPathElementPtr fpe,
- FontPtr *pFont,
- int flags,
- FontEntryPtr entry,
+BitmapOpenScalable (FontPathElementPtr fpe,
+ FontPtr *pFont,
+ int flags,
+ FontEntryPtr entry,
char *fileName, /* unused */
- FontScalablePtr vals,
- fsBitmapFormat format,
+ FontScalablePtr vals,
+ fsBitmapFormat format,
fsBitmapFormatMask fmask,
FontPtr non_cachable_font) /* We don't do licensing */
{
@@ -1635,11 +1635,11 @@ BitmapOpenScalable (FontPathElementPtr fpe,
}
int
-BitmapGetInfoScalable (FontPathElementPtr fpe,
- FontInfoPtr pFontInfo,
- FontEntryPtr entry,
- FontNamePtr fontName,
- char *fileName,
+BitmapGetInfoScalable (FontPathElementPtr fpe,
+ FontInfoPtr pFontInfo,
+ FontEntryPtr entry,
+ FontNamePtr fontName,
+ char *fileName,
FontScalablePtr vals)
{
FontPtr pfont;
diff --git a/libXfont/src/bitmap/pcfread.c b/libXfont/src/bitmap/pcfread.c
index 32f9856fa..34eeeb734 100644
--- a/libXfont/src/bitmap/pcfread.c
+++ b/libXfont/src/bitmap/pcfread.c
@@ -56,7 +56,7 @@ pcfError(const char* message, ...)
vfprintf(stderr, message, args);
va_end(args);
}
-
+
/* Read PCF font files */
static void pcfUnloadFont ( FontPtr pFont );
@@ -138,7 +138,8 @@ pcfReadTOC(FontFilePtr file, int *countp)
}
tables = malloc(count * sizeof(PCFTableRec));
if (!tables) {
- pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n", count, sizeof(PCFTableRec));
+ pcfError("pcfReadTOC(): Couldn't allocate tables (%d*%d)\n",
+ count, (int) sizeof(PCFTableRec));
return (PCFTablePtr) NULL;
}
for (i = 0; i < count; i++) {
@@ -197,7 +198,7 @@ pcfGetCompressedMetric(FontFilePtr file, CARD32 format, xCharInfo *metric)
* in the font file
*/
static Bool
-pcfSeekToType(FontFilePtr file, PCFTablePtr tables, int ntables,
+pcfSeekToType(FontFilePtr file, PCFTablePtr tables, int ntables,
CARD32 type, CARD32 *formatp, CARD32 *sizep)
{
int i;
@@ -228,14 +229,14 @@ pcfHasType (PCFTablePtr tables, int ntables, CARD32 type)
}
/*
- * pcfGetProperties
+ * pcfGetProperties
*
* Reads the font properties from the font file, filling in the FontInfo rec
* supplied. Used by by both ReadFont and ReadFontInfo routines.
*/
static Bool
-pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
+pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
PCFTablePtr tables, int ntables)
{
FontPropPtr props = 0;
@@ -262,22 +263,24 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file,
if (IS_EOF(file)) goto Bail;
props = malloc(nprops * sizeof(FontPropRec));
if (!props) {
- pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n", nprops, sizeof(FontPropRec));
+ pcfError("pcfGetProperties(): Couldn't allocate props (%d*%d)\n",
+ nprops, (int) sizeof(FontPropRec));
goto Bail;
}
isStringProp = malloc(nprops * sizeof(char));
if (!isStringProp) {
- pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n", nprops, sizeof(char));
+ pcfError("pcfGetProperties(): Couldn't allocate isStringProp (%d*%d)\n",
+ nprops, (int) sizeof(char));
goto Bail;
}
for (i = 0; i < nprops; i++) {
props[i].name = pcfGetINT32(file, format);
isStringProp[i] = pcfGetINT8(file, format);
props[i].value = pcfGetINT32(file, format);
- if (props[i].name < 0
+ if (props[i].name < 0
|| (isStringProp[i] != 0 && isStringProp[i] != 1)
|| (isStringProp[i] && props[i].value < 0)) {
- pcfError("pcfGetProperties(): invalid file format %d %d %d\n",
+ pcfError("pcfGetProperties(): invalid file format %ld %d %ld\n",
props[i].name, isStringProp[i], props[i].value);
goto Bail;
}
@@ -334,7 +337,7 @@ Bail:
*/
static Bool
-pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
+pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
PCFTablePtr tables, int ntables, CARD32 type)
{
CARD32 format;
@@ -345,7 +348,7 @@ pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file,
goto Bail;
format = pcfGetLSB32(file);
if (!PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT) &&
- !PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS))
+ !PCF_FORMAT_MATCH(format, PCF_ACCEL_W_INKBOUNDS))
{
goto Bail;
}
@@ -382,7 +385,7 @@ Bail:
}
int
-pcfReadFont(FontPtr pFont, FontFilePtr file,
+pcfReadFont(FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan)
{
CARD32 format;
@@ -407,6 +410,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
pFont->info.nprops = 0;
pFont->info.props = 0;
+ pFont->info.isStringProp=0;
+
if (!(tables = pcfReadTOC(file, &ntables)))
goto Bail;
@@ -443,7 +448,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
}
metrics = malloc(nmetrics * sizeof(CharInfoRec));
if (!metrics) {
- pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n", nmetrics, sizeof(CharInfoRec));
+ pcfError("pcfReadFont(): Couldn't allocate metrics (%d*%d)\n",
+ nmetrics, (int) sizeof(CharInfoRec));
goto Bail;
}
for (i = 0; i < nmetrics; i++)
@@ -454,7 +460,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (!pcfGetCompressedMetric(file, format, &(metrics + i)->metrics))
goto Bail;
}
-
+
/* bitmaps */
if (!pcfSeekToType(file, tables, ntables, PCF_BITMAPS, &format, &size))
@@ -469,7 +475,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
/* nmetrics is already ok, so nbitmap also is */
offsets = malloc(nbitmaps * sizeof(CARD32));
if (!offsets) {
- pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n", nbitmaps, sizeof(CARD32));
+ pcfError("pcfReadFont(): Couldn't allocate offsets (%d*%d)\n",
+ nbitmaps, (int) sizeof(CARD32));
goto Bail;
}
for (i = 0; i < nbitmaps; i++) {
@@ -482,7 +489,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
if (IS_EOF(file)) goto Bail;
if (bitmapSizes[i] < 0) goto Bail;
}
-
+
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX(format)];
/* guard against completely empty font */
bitmaps = malloc(sizebitmaps ? sizebitmaps : 1);
@@ -558,10 +565,11 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
goto Bail;
/* nmetrics already checked */
ink_metrics = malloc(nink_metrics * sizeof(xCharInfo));
- if (!ink_metrics) {
- pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo));
+ if (!ink_metrics) {
+ pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n",
+ nink_metrics, (int) sizeof(xCharInfo));
goto Bail;
- }
+ }
for (i = 0; i < nink_metrics; i++)
if (PCF_FORMAT_MATCH(format, PCF_DEFAULT_FORMAT)) {
if (!pcfGetMetric(file, format, ink_metrics + i))
@@ -595,10 +603,11 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
encoding = calloc(NUM_SEGMENTS(nencoding), sizeof(CharInfoPtr*));
if (!encoding) {
- pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n", nencoding, sizeof(CharInfoPtr));
+ pcfError("pcfReadFont(): Couldn't allocate encoding (%d*%d)\n",
+ nencoding, (int) sizeof(CharInfoPtr));
goto Bail;
}
-
+
pFont->info.allExist = TRUE;
for (i = 0; i < nencoding; i++) {
encodingOffset = pcfGetINT16(file, format);
@@ -624,7 +633,8 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
bitmapFont = malloc(sizeof *bitmapFont);
if (!bitmapFont) {
- pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n", sizeof *bitmapFont);
+ pcfError("pcfReadFont(): Couldn't allocate bitmapFont (%d)\n",
+ (int) sizeof *bitmapFont);
goto Bail;
}
diff --git a/libXfont/src/bitmap/pcfwrite.c b/libXfont/src/bitmap/pcfwrite.c
index 3ac07b359..0874c4bd4 100644
--- a/libXfont/src/bitmap/pcfwrite.c
+++ b/libXfont/src/bitmap/pcfwrite.c
@@ -236,7 +236,8 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
}
offsetProps = malloc(pFont->info.nprops * sizeof(FontPropRec));
if (!offsetProps) {
- pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)", pFont->info.nprops, sizeof(FontPropRec));
+ pcfError("pcfWriteFont(): Couldn't allocate offsetProps (%d*%d)",
+ pFont->info.nprops, (int) sizeof(FontPropRec));
return AllocError;
}
prop_string_size = 0;
@@ -430,8 +431,8 @@ pcfWriteFont(FontPtr pFont, FontFilePtr file)
pcfPutINT16(file, format, pFont->info.defaultCh);
for (i = 0; i < nencodings; i++) {
if (ACCESSENCODING(bitmapFont->encoding,i))
- pcfPutINT16(file, format,
- ACCESSENCODING(bitmapFont->encoding, i) -
+ pcfPutINT16(file, format,
+ ACCESSENCODING(bitmapFont->encoding, i) -
bitmapFont->metrics);
else
pcfPutINT16(file, format, 0xFFFF);
diff --git a/libXfont/src/bitmap/snfread.c b/libXfont/src/bitmap/snfread.c
index d003cc5a5..da362c81a 100644
--- a/libXfont/src/bitmap/snfread.c
+++ b/libXfont/src/bitmap/snfread.c
@@ -60,7 +60,7 @@ from The Open Group.
#include <stdarg.h>
-static void
+static void _X_ATTRIBUTE_PRINTF(1, 2)
snfError(const char* message, ...)
{
va_list args;
@@ -71,7 +71,7 @@ snfError(const char* message, ...)
vfprintf(stderr, message, args);
va_end(args);
}
-
+
static void snfUnloadFont(FontPtr pFont);
static int
@@ -211,7 +211,7 @@ SnfGetFormat (int *bit, int *byte, int *glyph, int *scan)
}
int
-snfReadFont(FontPtr pFont, FontFilePtr file,
+snfReadFont(FontPtr pFont, FontFilePtr file,
int bit, int byte, int glyph, int scan)
{
snfFontInfoRec fi;
@@ -239,7 +239,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
/*
* we'll allocate one chunk of memory and split it among the various parts
* of the font:
- *
+ *
* BitmapFontRec CharInfoRec's Glyphs Encoding DIX Properties Ink CharInfoRec's
*
* If the glyphpad is not the same as the font file, then the glyphs
@@ -253,7 +253,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
metrics_off = bytestoalloc;
bytestoalloc += num_chars * sizeof(CharInfoRec); /* metrics */
encoding_off = bytestoalloc;
- bytestoalloc += NUM_SEGMENTS(num_chars) * sizeof(CharInfoPtr**);
+ bytestoalloc += NUM_SEGMENTS(num_chars) * sizeof(CharInfoPtr**);
/* encoding */
props_off = bytestoalloc;
bytestoalloc += fi.nProps * sizeof(FontPropRec); /* props */
@@ -299,7 +299,7 @@ snfReadFont(FontPtr pFont, FontFilePtr file,
*/
ret = Successful;
- memset(bitmapFont->encoding, 0,
+ memset(bitmapFont->encoding, 0,
NUM_SEGMENTS(num_chars)*sizeof(CharInfoPtr*));
for (i = 0; ret == Successful && i < num_chars; i++) {
ret = snfReadCharInfo(file, &bitmapFont->metrics[i], bitmaps);
@@ -454,12 +454,14 @@ snfReadFontInfo(FontInfoPtr pFontInfo, FontFilePtr file)
pFontInfo->props = malloc(fi.nProps * sizeof(FontPropRec));
if (!pFontInfo->props) {
- snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n", fi.nProps, sizeof(FontPropRec));
+ snfError("snfReadFontInfo(): Couldn't allocate props (%d*%d)\n",
+ fi.nProps, (int) sizeof(FontPropRec));
return AllocError;
}
pFontInfo->isStringProp = malloc(fi.nProps * sizeof(char));
if (!pFontInfo->isStringProp) {
- snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n", fi.nProps, sizeof(char));
+ snfError("snfReadFontInfo(): Couldn't allocate isStringProp (%d*%d)\n",
+ fi.nProps, (int) sizeof(char));
free(pFontInfo->props);
return AllocError;
}