summaryrefslogtreecommitdiff
path: root/lib/libXfont/src
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2016-09-02 11:00:06 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2016-09-02 11:00:06 +0000
commit1cffb4d19c3090518bd153c6f8982cb467dd6af8 (patch)
tree5f3f7d57bb3088b61fc3e0b2756e77ce67ce437e /lib/libXfont/src
parent86e7d9e53c4bd0e523cb2e5e1e1280ce45e179df (diff)
Update to libXfont 1.5.2
Diffstat (limited to 'lib/libXfont/src')
-rw-r--r--lib/libXfont/src/FreeType/ftfuncs.c20
-rw-r--r--lib/libXfont/src/FreeType/xttcap.c2
-rw-r--r--lib/libXfont/src/bitmap/bdfread.c6
-rw-r--r--lib/libXfont/src/bitmap/bdfutils.c4
-rw-r--r--lib/libXfont/src/bitmap/bitscale.c4
-rw-r--r--lib/libXfont/src/bitmap/pcfread.c1
-rw-r--r--lib/libXfont/src/fc/fserve.c8
-rw-r--r--lib/libXfont/src/stubs/stubs.h57
-rw-r--r--lib/libXfont/src/util/fontxlfd.c10
9 files changed, 52 insertions, 60 deletions
diff --git a/lib/libXfont/src/FreeType/ftfuncs.c b/lib/libXfont/src/FreeType/ftfuncs.c
index a4969d12e..703353d4d 100644
--- a/lib/libXfont/src/FreeType/ftfuncs.c
+++ b/lib/libXfont/src/FreeType/ftfuncs.c
@@ -474,7 +474,7 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face,
if( FT_IS_SFNT( face->face ) ) {
#if 1
FT_F26Dot6 tt_char_width, tt_char_height, tt_dim_x, tt_dim_y;
- FT_UInt nn;
+ FT_Int nn;
instance->strike_index=0xFFFFU;
@@ -622,7 +622,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance,
offset = idx - segment * FONTSEGMENTSIZE;
if((*available)[segment] == NULL) {
- (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int *));
+ (*available)[segment] = calloc(FONTSEGMENTSIZE, sizeof(int));
if((*available)[segment] == NULL)
return AllocError;
}
@@ -1454,7 +1454,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
}
for( i = MAX(0, dy) ; i<ht ; i++ ){
int prev_jj,jj;
- if( bitmap->rows <= i-dy ) break;
+ if( bitmap->rows <= (unsigned) (i-dy) ) break;
current_buffer=(unsigned char *)(bitmap->buffer+bitmap->pitch*(i-dy));
current_raster=(unsigned char *)(raster+i*bpr);
j = MAX(0,div_dx);
@@ -2061,7 +2061,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
long val;
/* skip comma and/or space */
- while (',' == *p || isspace(*p))
+ while (',' == *p || isspace((unsigned char)*p))
p++;
/* begin point */
@@ -2079,7 +2079,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
}
/* skip space */
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
if (',' != *p && '\0' != *p) {
@@ -2092,7 +2092,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol,
break;
/* skip space */
- while (isspace(*p))
+ while (isspace((unsigned char)*p))
p++;
val = strtol(p, (char **)&q, 0);
@@ -2985,13 +2985,13 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals )
c = row<<8|col;
flags=0;
if ( !force_c_outside ) {
- if ( c <= instance->ttcap.forceConstantSpacingEnd
- && instance->ttcap.forceConstantSpacingBegin <= c )
+ if ( (signed) c <= instance->ttcap.forceConstantSpacingEnd
+ && instance->ttcap.forceConstantSpacingBegin <= (signed) c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
else { /* for GB18030 proportional */
- if ( c <= instance->ttcap.forceConstantSpacingEnd
- || instance->ttcap.forceConstantSpacingBegin <= c )
+ if ( (signed) c <= instance->ttcap.forceConstantSpacingEnd
+ || instance->ttcap.forceConstantSpacingBegin <= (signed) c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
#if 0
diff --git a/lib/libXfont/src/FreeType/xttcap.c b/lib/libXfont/src/FreeType/xttcap.c
index cee752ebf..e30e0f98c 100644
--- a/lib/libXfont/src/FreeType/xttcap.c
+++ b/lib/libXfont/src/FreeType/xttcap.c
@@ -632,7 +632,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList,
}
break;
}
- if ( !isdigit(*p) )
+ if ( !isdigit((unsigned char)*p) )
break;
}
}
diff --git a/lib/libXfont/src/bitmap/bdfread.c b/lib/libXfont/src/bitmap/bdfread.c
index a0ace8f85..f343eed54 100644
--- a/lib/libXfont/src/bitmap/bdfread.c
+++ b/lib/libXfont/src/bitmap/bdfread.c
@@ -298,7 +298,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bdfError("invalid number of CHARS in BDF file\n");
return (FALSE);
}
- if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
+ if (nchars > (signed) (INT32_MAX / sizeof(CharInfoRec))) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
(int) sizeof(CharInfoRec));
goto BAILOUT;
@@ -426,7 +426,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
goto BAILOUT;
}
/* xCharInfo metrics are stored as INT16 */
- if ((wx < 0) || (wx > INT16_MAX)) {
+ if ((wx < INT16_MIN) || (wx > INT16_MAX)) {
bdfError("character '%s' has out of range width, %d\n",
charName, wx);
goto BAILOUT;
@@ -631,7 +631,7 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
}
if ((sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) ||
(nProps <= 0) ||
- (nProps > ((INT32_MAX / sizeof(FontPropRec)) - BDF_GENPROPS))) {
+ (nProps > (signed) ((INT32_MAX / sizeof(FontPropRec)) - BDF_GENPROPS))) {
bdfError("bad 'STARTPROPERTIES'\n");
return (FALSE);
}
diff --git a/lib/libXfont/src/bitmap/bdfutils.c b/lib/libXfont/src/bitmap/bdfutils.c
index 288148b36..438d1970e 100644
--- a/lib/libXfont/src/bitmap/bdfutils.c
+++ b/lib/libXfont/src/bitmap/bdfutils.c
@@ -207,11 +207,11 @@ bdfIsInteger(char *str)
char c;
c = *str++;
- if (!(isdigit(c) || c == '-' || c == '+'))
+ if (!(isdigit((unsigned char)c) || c == '-' || c == '+'))
return (FALSE);
while ((c = *str++))
- if (!isdigit(c))
+ if (!isdigit((unsigned char)c))
return (FALSE);
return (TRUE);
diff --git a/lib/libXfont/src/bitmap/bitscale.c b/lib/libXfont/src/bitmap/bitscale.c
index c9af4c031..13ed924c4 100644
--- a/lib/libXfont/src/bitmap/bitscale.c
+++ b/lib/libXfont/src/bitmap/bitscale.c
@@ -1479,6 +1479,10 @@ BitmapScaleBitmaps(FontPtr pf, /* scaled font */
lastRow = pfi->lastRow;
nchars = (lastRow - firstRow + 1) * (lastCol - firstCol + 1);
+ if (nchars <= 0) {
+ goto bail;
+ }
+
glyph = pf->glyph;
for (i = 0; i < nchars; i++)
{
diff --git a/lib/libXfont/src/bitmap/pcfread.c b/lib/libXfont/src/bitmap/pcfread.c
index 34eeeb734..33871aec6 100644
--- a/lib/libXfont/src/bitmap/pcfread.c
+++ b/lib/libXfont/src/bitmap/pcfread.c
@@ -487,7 +487,6 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
for (i = 0; i < GLYPHPADOPTIONS; i++) {
bitmapSizes[i] = pcfGetINT32(file, format);
if (IS_EOF(file)) goto Bail;
- if (bitmapSizes[i] < 0) goto Bail;
}
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX(format)];
diff --git a/lib/libXfont/src/fc/fserve.c b/lib/libXfont/src/fc/fserve.c
index c6d07725d..424ad7f6b 100644
--- a/lib/libXfont/src/fc/fserve.c
+++ b/lib/libXfont/src/fc/fserve.c
@@ -631,8 +631,8 @@ fs_get_reply (FSFpePtr conn, int *error)
*/
if (rep->length > MAX_REPLY_LENGTH)
{
- ErrorF("fserve: reply length %d > MAX_REPLY_LENGTH, disconnecting"
- " from font server\n", rep->length);
+ ErrorF("fserve: reply length %ld > MAX_REPLY_LENGTH, disconnecting"
+ " from font server\n", (long)rep->length);
_fs_connection_died (conn);
*error = FSIO_ERROR;
return 0;
@@ -2852,14 +2852,12 @@ _fs_client_access (FSFpePtr conn, pointer client, Bool sync)
if (crac.num_auths == 0) {
authorizations = padding;
authlen = 4;
- } else {
- authlen = (authlen + 3) & ~0x3;
}
crac.length = (sizeof (fsCreateACReq) + authlen) >> 2;
crac.acid = cur->acid;
_fs_add_req_log(conn, FS_CreateAC);
_fs_write(conn, (char *) &crac, sizeof (fsCreateACReq));
- _fs_write(conn, authorizations, authlen);
+ _fs_write_pad(conn, authorizations, authlen);
/* ignore reply; we don't even care about it */
conn->curacid = 0;
cur->auth_generation = client_auth_generation(client);
diff --git a/lib/libXfont/src/stubs/stubs.h b/lib/libXfont/src/stubs/stubs.h
index 7d499d5b6..9e71806a9 100644
--- a/lib/libXfont/src/stubs/stubs.h
+++ b/lib/libXfont/src/stubs/stubs.h
@@ -10,7 +10,7 @@
#endif
/* this probably works for Mach-O too, but probably not for PE */
-#if (defined(__APPLE__) || defined(__ELF__)) && defined(__GNUC__) && (__GNUC__ >= 3)
+#if defined(__ELF__) && defined(__GNUC__) && (__GNUC__ >= 3)
#define weak __attribute__((weak))
#else
#define weak
@@ -38,44 +38,35 @@ extern int _font_init_stubs(void);
(*__##sym)(f, _args); \
va_end(_args)
-int (*__client_auth_generation)(ClientPtr);
-Bool (*__ClientSignal)(ClientPtr);
-void (*__DeleteFontClientID)(Font);
-void (*__VErrorF)(const char *, va_list);
-FontPtr (*__find_old_font)(FSID);
-FontResolutionPtr (*__GetClientResolutions)(int *);
-int (*__GetDefaultPointSize)(void);
-Font (*__GetNewFontClientID)(void);
-unsigned long (*__GetTimeInMillis)(void);
-int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr);
-int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
- ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
- StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
- LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc);
-void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool);
-void **__ptr_serverClient;
-int (*__set_font_authorizations)(char **, int *, ClientPtr);
-int (*__StoreFontClientFont)(FontPtr, Font);
-Atom (*__MakeAtom)(const char *, unsigned, int);
-int (*__ValidAtom)(Atom);
-char *(*__NameForAtom)(Atom);
-unsigned long *__ptr_serverGeneration;
-void (*__register_fpe_functions)(void);
+extern int (*__client_auth_generation)(ClientPtr);
+extern Bool (*__ClientSignal)(ClientPtr);
+extern void (*__DeleteFontClientID)(Font);
+extern void (*__VErrorF)(const char *, va_list);
+extern FontPtr (*__find_old_font)(FSID);
+extern FontResolutionPtr (*__GetClientResolutions)(int *);
+extern int (*__GetDefaultPointSize)(void);
+extern Font (*__GetNewFontClientID)(void);
+extern unsigned long (*__GetTimeInMillis)(void);
+extern int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr);
+extern int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc,
+ ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc,
+ StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc,
+ LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc);
+extern void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool);
+extern void **__ptr_serverClient;
+extern int (*__set_font_authorizations)(char **, int *, ClientPtr);
+extern int (*__StoreFontClientFont)(FontPtr, Font);
+extern Atom (*__MakeAtom)(const char *, unsigned, int);
+extern int (*__ValidAtom)(Atom);
+extern char *(*__NameForAtom)(Atom);
+extern unsigned long *__ptr_serverGeneration;
+extern void (*__register_fpe_functions)(void);
#else /* NO_WEAK_SYMBOLS && PIC */
#define OVERRIDE_DATA(sym)
#define OVERRIDE_SYMBOL(sym,...)
#define OVERRIDE_VA_SYMBOL(sym,f)
#endif
-/* This is really just a hack for now... __APPLE__ really should be using
- * the weak symbols route above, but it's causing an as-yet unresolved issue,
- * so we're instead building with flat_namespace.
- */
-#ifdef __APPLE__
-#undef weak
-#define weak
-#endif
-
extern FontPtr find_old_font ( FSID id );
extern int set_font_authorizations ( char **authorizations,
int *authlen,
diff --git a/lib/libXfont/src/util/fontxlfd.c b/lib/libXfont/src/util/fontxlfd.c
index 974128ee3..99a3679e5 100644
--- a/lib/libXfont/src/util/fontxlfd.c
+++ b/lib/libXfont/src/util/fontxlfd.c
@@ -145,9 +145,9 @@ xlfd_double_to_text(double value, char *buffer, int space_required)
if (value == 0.0) exponent = 0;
/* Figure out how many digits are significant */
- while (p1 >= buffer && (!isdigit(*p1) || *p1 == '0')) p1--;
+ while (p1 >= buffer && (!isdigit((unsigned char)*p1) || *p1 == '0')) p1--;
ndigits = 0;
- while (p1 >= buffer) if (isdigit(*p1--)) ndigits++;
+ while (p1 >= buffer) if (isdigit((unsigned char)*p1--)) ndigits++;
/* Figure out notation to use */
if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1)
@@ -278,7 +278,7 @@ GetMatrix(char *ptr, FontScalablePtr vals, int which)
matrix = vals->point_matrix;
else return (char *)0;
- while (isspace(*ptr)) ptr++;
+ while (isspace((unsigned char)*ptr)) ptr++;
if (*ptr == '[')
{
/* This is a matrix containing real numbers. It would be nice
@@ -292,13 +292,13 @@ GetMatrix(char *ptr, FontScalablePtr vals, int which)
(ptr = readreal(ptr, matrix + 2)) &&
(ptr = readreal(ptr, matrix + 3)))
{
- while (isspace(*ptr)) ptr++;
+ while (isspace((unsigned char)*ptr)) ptr++;
if (*ptr != ']')
ptr = (char *)0;
else
{
ptr++;
- while (isspace(*ptr)) ptr++;
+ while (isspace((unsigned char)*ptr)) ptr++;
if (*ptr == '-')
{
if (which == POINTSIZE_MASK)