From d02e6760412c7a96abbc4d0add5dd8d5e83bbe27 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 28 Mar 2014 17:32:23 +0100 Subject: Update following packages: libXfont-1.4.7 xproto-7.0.25 --- libXfont/src/FreeType/ftfuncs.c | 17 ++++++------ libXfont/src/FreeType/xttcap.c | 61 ++++++++++++++--------------------------- libXfont/src/FreeType/xttcap.h | 13 ++------- libXfont/src/Makefile.am | 6 ++-- libXfont/src/bitmap/bdfread.c | 16 ++++++++--- libXfont/src/builtins/buildfont | 2 +- libXfont/src/fontfile/fontdir.c | 10 ++----- libXfont/src/util/atom.c | 20 ++++++++------ libXfont/src/util/miscutil.c | 2 +- 9 files changed, 63 insertions(+), 84 deletions(-) (limited to 'libXfont/src') diff --git a/libXfont/src/FreeType/ftfuncs.c b/libXfont/src/FreeType/ftfuncs.c index 918e3f37e..44e5e0288 100644 --- a/libXfont/src/FreeType/ftfuncs.c +++ b/libXfont/src/FreeType/ftfuncs.c @@ -2050,7 +2050,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol, { int nRanges = 0; int result = 0; - fsRange *ranges = NULL; + fsRange *ranges = NULL, *oldRanges; char const *p, *q; p = q = str; @@ -2119,10 +2119,13 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol, fflush(stderr); #endif nRanges++; + oldRanges = ranges; ranges = realloc(ranges, nRanges*sizeof(*ranges)); - if (NULL == ranges) + if (NULL == ranges) { + free(oldRanges); break; - { + } + else { fsRange *r = ranges+nRanges-1; r->min_char_low = minpoint & 0xff; @@ -2204,7 +2207,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, strcpy(*dynStrRealFileName+dirLen, p2+1); capHead = p1; } else { - *dynStrRealFileName = xstrdup(fileName); + *dynStrRealFileName = strdup(fileName); if( *dynStrRealFileName == NULL ) { result = AllocError; goto quit; @@ -2289,13 +2292,11 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, } } else{ - *dynStrFTFileName = malloc(strlen(*dynStrRealFileName)+1); + *dynStrFTFileName = strdup(*dynStrRealFileName); if( *dynStrFTFileName == NULL ){ result = AllocError; goto quit; } - **dynStrFTFileName = '\0'; - strcat(*dynStrFTFileName,*dynStrRealFileName); } } /* @@ -2549,7 +2550,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, if (SPropRecValList_search_record(&listPropRecVal, &contRecValue, "CodeRange")) { - *dynStrTTCapCodeRange = xstrdup(SPropContainer_value_str(contRecValue)); + *dynStrTTCapCodeRange = strdup(SPropContainer_value_str(contRecValue)); if( *dynStrTTCapCodeRange == NULL ) { result = AllocError; goto quit; diff --git a/libXfont/src/FreeType/xttcap.c b/libXfont/src/FreeType/xttcap.c index c2a412091..104dc89e4 100644 --- a/libXfont/src/FreeType/xttcap.c +++ b/libXfont/src/FreeType/xttcap.c @@ -1,7 +1,7 @@ /* ===EmacsMode: -*- Mode: C; tab-width:4; c-basic-offset: 4; -*- === */ /* ===FileName: === Copyright (c) 1998 Takuya SHIOZAKI, All Rights reserved. - Copyright (c) 1998 X-TrueType Server Project, All rights reserved. + Copyright (c) 1998 X-TrueType Server Project, All rights reserved. Copyright (c) 2003 After X-TT Project, All rights reserved. ===Notice @@ -133,7 +133,7 @@ get_record_type_by_name(SPropertyRecord const ** const refRefRecord, /*result*/ { Bool result = False; int i; - + *refRefRecord = NULL; for (i=0; iheadNode = NULL; return result; @@ -582,7 +581,7 @@ SPropRecValList_search_record(SRefPropRecValList *pThisList, { Bool result = False; SPropRecValListNodeP *p; - + *refRecValue = NULL; for (p=pThisList->headNode; NULL!=p; p=p->nextNode) { if (!strcasecmp(p->containerE.refRecordType->strRecordName, @@ -605,7 +604,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList, Bool result = False; /* SPropertyRecord const *refRecordType; */ char const *term; - + if (NULL == (term = strrchr(strCapHead, ':'))) goto abort; @@ -646,7 +645,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList, char *duplicated = malloc((nextColon-strCapHead)+1); { char *value; - + memcpy(duplicated, strCapHead, nextColon-strCapHead); duplicated[nextColon-strCapHead] = '\0'; if (NULL != (value=strchr(duplicated, '='))) { @@ -654,7 +653,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList, value++; } else value = &duplicated[nextColon-strCapHead]; - + for (i=0; iuValue.dynStringValue) -/****************************************************** - Prototypes (xttmisc) - */ - -/* strdup clone */ -char * XttXstrdup(char const *str); -#undef xstrdup -#define xstrdup(s) XttXstrdup((char const*)s) - #endif /* !def _XTTCAP_H_ */ /* end of file */ diff --git a/libXfont/src/Makefile.am b/libXfont/src/Makefile.am index 26551bc04..cd09ab99f 100644 --- a/libXfont/src/Makefile.am +++ b/libXfont/src/Makefile.am @@ -1,6 +1,6 @@ -# +# # Copyright © 2003 Keith Packard, Noah Levitt -# +# # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that @@ -10,7 +10,7 @@ # specific, written prior permission. Keith Packard makes no # representations about the suitability of this software for any purpose. It # is provided "as is" without express or implied warranty. -# +# # KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO # EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR diff --git a/libXfont/src/bitmap/bdfread.c b/libXfont/src/bitmap/bdfread.c index e2770dc1c..914a0244e 100644 --- a/libXfont/src/bitmap/bdfread.c +++ b/libXfont/src/bitmap/bdfread.c @@ -69,6 +69,7 @@ from The Open Group. #define INDICES 256 #define MAXENCODING 0xFFFF #define BDFLINELEN 1024 +#define BDFLINESTR "%1023s" /* scanf specifier to read a BDFLINELEN string */ static Bool bdfPadToTerminal(FontPtr pFont); extern int bdfFileLineNum; @@ -338,7 +339,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState, char charName[100]; int ignore; - if (sscanf((char *) line, "STARTCHAR %s", charName) != 1) { + if (sscanf((char *) line, "STARTCHAR %99s", charName) != 1) { bdfError("bad character name in BDF file\n"); goto BAILOUT; /* bottom of function, free and return error */ } @@ -544,13 +545,18 @@ bdfReadHeader(FontFilePtr file, bdfFileState *pState) unsigned char lineBuf[BDFLINELEN]; line = bdfGetLine(file, lineBuf, BDFLINELEN); - if (!line || sscanf((char *) line, "STARTFONT %s", namebuf) != 1 || + if (!line || + sscanf((char *) line, "STARTFONT " BDFLINESTR, namebuf) != 1 || !bdfStrEqual(namebuf, "2.1")) { bdfError("bad 'STARTFONT'\n"); return (FALSE); } line = bdfGetLine(file, lineBuf, BDFLINELEN); - if (!line || sscanf((char *) line, "FONT %[^\n]", pState->fontName) != 1) { +#if MAXFONTNAMELEN != 1024 +# error "need to adjust sscanf length limit to be MAXFONTNAMELEN - 1" +#endif + if (!line || + sscanf((char *) line, "FONT %1023[^\n]", pState->fontName) != 1) { bdfError("bad 'FONT'\n"); return (FALSE); } @@ -633,7 +639,9 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState) while (*line && isspace(*line)) line++; - switch (sscanf((char *) line, "%s%s%s", namebuf, secondbuf, thirdbuf)) { + switch (sscanf((char *) line, + BDFLINESTR BDFLINESTR BDFLINESTR, + namebuf, secondbuf, thirdbuf)) { default: bdfError("missing '%s' parameter value\n", namebuf); goto BAILOUT; diff --git a/libXfont/src/builtins/buildfont b/libXfont/src/builtins/buildfont index aa4602ff8..84c68c4f4 100644 --- a/libXfont/src/builtins/buildfont +++ b/libXfont/src/builtins/buildfont @@ -8,7 +8,7 @@ NAME=$2 echo 'static const char file_'$NAME'[] = {' bdftopcf -p1 -u1 $1 | compress -b 12 | - od -b -v -w8 | + od -b -v -w8 | sed 's/^[0-9]*\( *\)/\1\1\1\1/' | sed 's/\([0-9][0-9]*\)/'"'"'\\\1'"'"',/g' echo '};' diff --git a/libXfont/src/fontfile/fontdir.c b/libXfont/src/fontfile/fontdir.c index 97b2ba3b1..ef7ffa561 100644 --- a/libXfont/src/fontfile/fontdir.c +++ b/libXfont/src/fontfile/fontdir.c @@ -425,17 +425,13 @@ FontFileCountDashes (char *name, int namelen) return ndashes; } +/* exported in public API in */ char * FontFileSaveString (char *s) { - char *n; - - n = malloc (strlen (s) + 1); - if (!n) - return 0; - strcpy (n, s); - return n; + return strdup(s); } +#define FontFileSaveString(s) strdup(s) FontEntryPtr FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat, diff --git a/libXfont/src/util/atom.c b/libXfont/src/util/atom.c index c47cb5c80..37811f91e 100644 --- a/libXfont/src/util/atom.c +++ b/libXfont/src/util/atom.c @@ -118,19 +118,23 @@ ResizeHashTable (void) static int ResizeReverseMap (void) { - int ret = TRUE; + AtomListPtr *newMap; + int newMapSize; + if (reverseMapSize == 0) - reverseMapSize = 1000; + newMapSize = 1000; else - reverseMapSize *= 2; - reverseMap = realloc (reverseMap, reverseMapSize * sizeof (AtomListPtr)); - if (!reverseMap) { + newMapSize = reverseMapSize * 2; + newMap = realloc (reverseMap, newMapSize * sizeof (AtomListPtr)); + if (newMap == NULL) { fprintf(stderr, "ResizeReverseMap(): Error: Couldn't reallocate" " reverseMap (%ld)\n", - reverseMapSize * (unsigned long)sizeof(AtomListPtr)); - ret = FALSE; + newMapSize * (unsigned long)sizeof(AtomListPtr)); + return FALSE; } - return ret; + reverseMap = newMap; + reverseMapSize = newMapSize; + return TRUE; } static int diff --git a/libXfont/src/util/miscutil.c b/libXfont/src/util/miscutil.c index 7173d3640..3d802d2f5 100644 --- a/libXfont/src/util/miscutil.c +++ b/libXfont/src/util/miscutil.c @@ -47,7 +47,7 @@ extern void BuiltinRegisterFpeFunctions(void); #ifndef NO_WEAK_SYMBOLS /* make sure everything initializes themselves at least once */ -weak long serverGeneration = 1; +weak unsigned long serverGeneration = 1; #endif weak void -- cgit v1.2.3