Makefile.am | 6 configure.ac | 20 +- devbook.am | 46 ++---- doc/fontlib.xml | 114 +++++----------- include/X11/fonts/bdfint.h | 16 +- include/X11/fonts/bitmap.h | 18 +- include/X11/fonts/fntfil.h | 94 ++++++------- include/X11/fonts/fntfilst.h | 40 ++--- include/X11/fonts/fontmisc.h | 8 - include/X11/fonts/fontutil.h | 10 - include/X11/fonts/pcf.h | 4 src/FreeType/ftenc.c | 30 ++-- src/FreeType/ftfuncs.c | 278 ++++++++++++++++++++-------------------- src/FreeType/ftfuncs.h | 10 - src/FreeType/fttools.c | 8 - src/FreeType/xttcap.c | 40 ++--- src/FreeType/xttcap.h | 4 src/Makefile.am | 6 src/bitmap/bdfread.c | 40 +++-- src/bitmap/bdfutils.c | 21 +-- src/bitmap/bitmap.c | 8 - src/bitmap/bitmapfunc.c | 12 - src/bitmap/bitscale.c | 106 +++++++-------- src/bitmap/fontink.c | 2 src/bitmap/pcfread.c | 54 ++++--- src/bitmap/pcfwrite.c | 7 - src/bitmap/snfread.c | 18 +- src/bitmap/snfstr.h | 2 src/builtins/buildfont | 2 src/builtins/builtin.h | 4 src/builtins/dir.c | 4 src/builtins/file.c | 4 src/builtins/fonts.c | 2 src/builtins/fpe.c | 2 src/builtins/render.c | 2 src/fc/fsconvert.c | 52 +++---- src/fc/fserve.c | 296 +++++++++++++++++++++---------------------- src/fc/fservestr.h | 18 +- src/fc/fsio.c | 26 +-- src/fc/fsio.h | 8 - src/fc/fslibos.h | 2 src/fc/fstrans.c | 2 src/fontfile/bitsource.c | 16 +- src/fontfile/bunzip2.c | 12 - src/fontfile/catalogue.c | 34 ++-- src/fontfile/decompress.c | 61 +++----- src/fontfile/dirfile.c | 8 - src/fontfile/fontdir.c | 16 +- src/fontfile/fontencc.c | 2 src/fontfile/fontfile.c | 80 +++++------ src/fontfile/fontscale.c | 8 - src/fontfile/gunzip.c | 14 +- src/fontfile/register.c | 2 src/fontfile/renderers.c | 4 src/stubs/Makefile.am | 2 src/stubs/regfpefunc.c | 30 ++-- src/stubs/rmfshdl.c | 2 src/stubs/stubs.h | 4 src/util/atom.c | 8 - src/util/fontaccel.c | 4 src/util/fontutil.c | 28 ++-- src/util/fontxlfd.c | 18 -- src/util/format.c | 22 +-- src/util/patcache.c | 14 +- src/util/private.c | 4 src/util/utilbitmap.c | 22 +-- 66 files changed, 907 insertions(+), 954 deletions(-)
New commits: commit 4b67ad5486c322c01a2ca86b0b4af0a74228f813 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Fri Mar 2 10:05:21 2012 -0800 libXfont 1.4.5 Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> diff --git a/configure.ac b/configure.ac index 8cff1d8..b274a8f 100644 --- a/configure.ac +++ b/configure.ac @@ -21,7 +21,7 @@ # Initialize Autoconf AC_PREREQ([2.60]) -AC_INIT([libXfont], [1.4.4], +AC_INIT([libXfont], [1.4.5], [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont]) AC_CONFIG_SRCDIR([Makefile.am]) AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h]) commit 3f87a8b0b86de83ea8944a53de82caf254a9988a Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Fri Oct 21 20:49:50 2011 -0700 Use * precision notation instead of computing sprintf format strings Allows gcc to check format strings instead of just warning about them Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> Reviewed-by: Jeremy Huddleston <jerem...@apple.com> diff --git a/src/util/fontxlfd.c b/src/util/fontxlfd.c index 18046e9..974128e 100644 --- a/src/util/fontxlfd.c +++ b/src/util/fontxlfd.c @@ -116,7 +116,6 @@ readreal(char *ptr, double *result) static char * xlfd_double_to_text(double value, char *buffer, int space_required) { - char formatbuf[40]; register char *p1; int ndigits, exponent; @@ -132,14 +131,12 @@ xlfd_double_to_text(double value, char *buffer, int space_required) minus = locale->negative_sign; } #endif - /* Compute a format to use to render the number */ - sprintf(formatbuf, "%%.%dle", XLFD_NDIGITS); if (space_required) *buffer++ = ' '; /* Render the number using printf's idea of formatting */ - sprintf(buffer, formatbuf, value); + sprintf(buffer, "%.*le", XLFD_NDIGITS, value); /* Find and read the exponent value */ for (p1 = buffer + strlen(buffer); @@ -156,16 +153,14 @@ xlfd_double_to_text(double value, char *buffer, int space_required) if (exponent >= XLFD_NDIGITS || ndigits - exponent > XLFD_NDIGITS + 1) { /* Scientific */ - sprintf(formatbuf, "%%.%dle", ndigits - 1); - sprintf(buffer, formatbuf, value); + sprintf(buffer, "%.*le", ndigits - 1, value); } else { /* Fixed */ ndigits -= exponent + 1; if (ndigits < 0) ndigits = 0; - sprintf(formatbuf, "%%.%dlf", ndigits); - sprintf(buffer, formatbuf, value); + sprintf(buffer, "%.*lf", ndigits, value); if (exponent < 0) { p1 = buffer; @@ -265,10 +260,9 @@ xlfd_round_double(double x) * If not IEEE 754: Let printf() do it for you. */ - char formatbuf[40], buffer[40]; + char buffer[40]; - sprintf(formatbuf, "%%.%dlg", XLFD_NDIGITS); - sprintf(buffer, formatbuf, x); + sprintf(buffer, "%.*lg", XLFD_NDIGITS, x); return atof(buffer); } } commit 613faa245437bb948b4c86ea6c7fbb716e38f0bf Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sun Oct 2 09:30:09 2011 -0700 Fix printf warnings about incorrect argument types Mostly due to difference between sizeof & int on 64-bit platforms Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> Reviewed-by: Jeremy Huddleston <jerem...@apple.com> diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c index 0fed688..e2770dc 100644 --- a/src/bitmap/bdfread.c +++ b/src/bitmap/bdfread.c @@ -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; @@ -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; } @@ -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,7 +814,8 @@ 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; } diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c index 3a3ee26..288148b 100644 --- a/src/bitmap/bdfutils.c +++ b/src/bitmap/bdfutils.c @@ -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; } diff --git a/src/bitmap/pcfread.c b/src/bitmap/pcfread.c index cf2f696..34eeeb7 100644 --- a/src/bitmap/pcfread.c +++ b/src/bitmap/pcfread.c @@ -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++) { @@ -262,12 +263,14 @@ 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++) { @@ -277,7 +280,7 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file, 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; } @@ -445,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++) @@ -471,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++) { @@ -560,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)) @@ -597,7 +603,8 @@ 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; } @@ -626,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/src/bitmap/pcfwrite.c b/src/bitmap/pcfwrite.c index b4abff4..0874c4b 100644 --- a/src/bitmap/pcfwrite.c +++ b/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; diff --git a/src/bitmap/snfread.c b/src/bitmap/snfread.c index b2b0c67..da362c8 100644 --- a/src/bitmap/snfread.c +++ b/src/bitmap/snfread.c @@ -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; } commit f24c559bcb42e3ea9321c3e6a9ecf0720a581e33 Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sun Oct 2 09:19:47 2011 -0700 Add _X_ATTRIBUTE_PRINTF to *Error/*Warning functions taking printf formats Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> Reviewed-by: Jeremy Huddleston <jerem...@apple.com> diff --git a/include/X11/fonts/bdfint.h b/include/X11/fonts/bdfint.h index c037b99..cc464cb 100644 --- a/include/X11/fonts/bdfint.h +++ b/include/X11/fonts/bdfint.h @@ -65,8 +65,8 @@ typedef struct BDFSTAT { BOOL haveDefaultCh; } bdfFileState; -extern void bdfError ( const char * message, ... ); -extern void bdfWarning ( const char *message, ... ); +extern void bdfError ( const char * message, ... ) _X_ATTRIBUTE_PRINTF(1, 2); +extern void bdfWarning ( const char *message, ... ) _X_ATTRIBUTE_PRINTF(1, 2); extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf, int len ); extern Atom bdfForceMakeAtom ( const char *str, int *size ); diff --git a/include/X11/fonts/pcf.h b/include/X11/fonts/pcf.h index 3d47c66..ddce0a9 100644 --- a/include/X11/fonts/pcf.h +++ b/include/X11/fonts/pcf.h @@ -92,6 +92,6 @@ extern int pcfReadFont ( FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan ); extern int pcfReadFontInfo ( FontInfoPtr pFontInfo, FontFilePtr file ); extern int pcfWriteFont ( FontPtr pFont, FontFilePtr file ); -extern void pcfError ( const char *, ... ); +extern void pcfError ( const char *, ... ) _X_ATTRIBUTE_PRINTF(1, 2); #endif /* _PCF_H_ */ diff --git a/src/bitmap/snfread.c b/src/bitmap/snfread.c index 2f51c48..b2b0c67 100644 --- a/src/bitmap/snfread.c +++ b/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; commit 3715cd752bac912a56aa1cbb9dd874624a709aab Author: Alan Coopersmith <alan.coopersm...@oracle.com> Date: Sun Oct 2 09:16:05 2011 -0700 Add const attributes to fix gcc -Wwrite-strings warnings Signed-off-by: Alan Coopersmith <alan.coopersm...@oracle.com> Reviewed-by: Jeremy Huddleston <jerem...@apple.com> diff --git a/include/X11/fonts/bdfint.h b/include/X11/fonts/bdfint.h index a8d8459..c037b99 100644 --- a/include/X11/fonts/bdfint.h +++ b/include/X11/fonts/bdfint.h @@ -65,11 +65,11 @@ typedef struct BDFSTAT { BOOL haveDefaultCh; } bdfFileState; -extern void bdfError ( char * message, ... ); -extern void bdfWarning ( char *message, ... ); +extern void bdfError ( const char * message, ... ); +extern void bdfWarning ( const char *message, ... ); extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf, int len ); -extern Atom bdfForceMakeAtom ( char *str, int *size ); +extern Atom bdfForceMakeAtom ( const char *str, int *size ); extern Atom bdfGetPropertyValue ( char *s ); extern int bdfIsInteger ( char *str ); extern unsigned char bdfHexByte ( unsigned char *s ); diff --git a/include/X11/fonts/fntfil.h b/include/X11/fonts/fntfil.h index feefdb3..a32df63 100644 --- a/include/X11/fonts/fntfil.h +++ b/include/X11/fonts/fntfil.h @@ -138,7 +138,7 @@ extern void FontFileFreeDir ( FontDirectoryPtr dir ); extern void FontFileFreeEntry ( FontEntryPtr entry ); extern void FontFileFreeTable ( FontTablePtr table ); extern Bool FontFileInitTable ( FontTablePtr table, int size ); -extern FontDirectoryPtr FontFileMakeDir ( char *dirName, int size ); +extern FontDirectoryPtr FontFileMakeDir ( const char *dirName, int size ); extern Bool FontFileMatchName ( char *name, int length, FontNamePtr pat ); extern char * FontFileSaveString ( char *s ); extern void FontFileSortDir ( FontDirectoryPtr dir ); diff --git a/include/X11/fonts/fntfilst.h b/include/X11/fonts/fntfilst.h index 8926f95..6e8645e 100644 --- a/include/X11/fonts/fntfilst.h +++ b/include/X11/fonts/fntfilst.h @@ -124,7 +124,7 @@ typedef struct _FontDirectory { #define CAP_CHARSUBSETTING 0x2 typedef struct _FontRenderer { - char *fileSuffix; + const char *fileSuffix; int fileSuffixLen; int (*OpenBitmap)(FontPathElementPtr /* fpe */, FontPtr * /* pFont */, diff --git a/include/X11/fonts/fontmisc.h b/include/X11/fonts/fontmisc.h index 3da1e63..73a8247 100644 --- a/include/X11/fonts/fontmisc.h +++ b/include/X11/fonts/fontmisc.h @@ -52,7 +52,7 @@ in this Software without prior written authorization from The Open Group. #define FALSE 0 #endif -extern Atom MakeAtom ( char *string, unsigned len, int makeit ); +extern Atom MakeAtom ( const char *string, unsigned len, int makeit ); extern int ValidAtom ( Atom atom ); extern char *NameForAtom (Atom atom); diff --git a/src/FreeType/ftenc.c b/src/FreeType/ftenc.c index 3c1d43b..9e31d75 100644 --- a/src/FreeType/ftenc.c +++ b/src/FreeType/ftenc.c @@ -43,9 +43,9 @@ THE SOFTWARE. static int find_cmap(int, int, int, FT_Face, FT_CharMap *); static int -FTEncFontSpecific(char *encoding) +FTEncFontSpecific(const char *encoding) { - char *p = encoding; + const char *p = encoding; if(strcasecmp(encoding, "microsoft-symbol") == 0) return 1; @@ -69,7 +69,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face, int ftrc; int symbol = 0; const char *enc, *reg; - char *encoding_name = 0; + const char *encoding_name = 0; char buf[20]; if(xlfd) diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c index b8cf49a..918e3f3 100644 --- a/src/FreeType/ftfuncs.c +++ b/src/FreeType/ftfuncs.c @@ -94,7 +94,7 @@ static CharInfoRec noSuchChar = { /* metrics */{0,0,0,0,0,0}, /* The propery names for all the XLFD properties. */ -static char *xlfd_props[] = { +static const char *xlfd_props[] = { "FOUNDRY", "FAMILY_NAME", "WEIGHT_NAME", diff --git a/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c index a0106b7..3a3ee26 100644 --- a/src/bitmap/bdfutils.c +++ b/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; @@ -249,7 +249,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", @@ -279,8 +279,8 @@ Bool 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/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index b857237..e89ba7c 100644 --- a/src/bitmap/bitscale.c +++ b/src/bitmap/bitscale.c @@ -78,7 +78,7 @@ enum scaleType { }; typedef struct _fontProp { - char *name; + const char *name; Atom atom; enum scaleType type; } fontProp; diff --git a/src/builtins/builtin.h b/src/builtins/builtin.h index d97d9a5..75dff8d 100644 --- a/src/builtins/builtin.h +++ b/src/builtins/builtin.h @@ -36,7 +36,7 @@ typedef struct _BuiltinFile { } BuiltinFileRec, *BuiltinFilePtr; typedef struct _BuiltinDir { - char *file_name; + const char *file_name; char *font_name; } BuiltinDirRec, *BuiltinDirPtr; diff --git a/src/fc/fsio.c b/src/fc/fsio.c index 569b3aa..03a689f 100644 --- a/src/fc/fsio.c +++ b/src/fc/fsio.c @@ -369,7 +369,7 @@ _fs_io_fini (FSFpePtr conn) } static int -_fs_do_write(FSFpePtr conn, char *data, long len, long size) +_fs_do_write(FSFpePtr conn, const char *data, long len, long size) { if (size == 0) { #ifdef DEBUG @@ -403,7 +403,7 @@ _fs_do_write(FSFpePtr conn, char *data, long len, long size) * Write the indicated bytes */ int -_fs_write (FSFpePtr conn, char *data, long len) +_fs_write (FSFpePtr conn, const char *data, long len) { return _fs_do_write (conn, data, len, len); } @@ -412,7 +412,7 @@ _fs_write (FSFpePtr conn, char *data, long len) * Write the indicated bytes adding any appropriate pad */ int -_fs_write_pad(FSFpePtr conn, char *data, long len) +_fs_write_pad(FSFpePtr conn, const char *data, long len) { return _fs_do_write (conn, data, len, len + padlength[len & 3]); } diff --git a/src/fc/fsio.h b/src/fc/fsio.h index 1d1b3dd..2bb8e0b 100644 --- a/src/fc/fsio.h +++ b/src/fc/fsio.h @@ -129,8 +129,8 @@ typedef struct _fs_fpe_data { #define FSIO_ERROR -1 extern Bool _fs_reopen_server ( FSFpePtr conn ); -extern int _fs_write ( FSFpePtr conn, char *data, long size ); -extern int _fs_write_pad ( FSFpePtr conn, char *data, long len ); +extern int _fs_write ( FSFpePtr conn, const char *data, long size ); +extern int _fs_write_pad ( FSFpePtr conn, const char *data, long len ); extern int _fs_wait_for_readable ( FSFpePtr conn, int ms ); extern long _fs_pad_length (long len); diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c index e524696..97b2ba3 100644 --- a/src/fontfile/fontdir.c +++ b/src/fontfile/fontdir.c @@ -102,12 +102,12 @@ FontFileFreeTable (FontTablePtr table) } FontDirectoryPtr -FontFileMakeDir(char *dirName, int size) +FontFileMakeDir(const char *dirName, int size) { FontDirectoryPtr dir; int dirlen; int needslash = 0; - char *attrib; + const char *attrib; int attriblen; #if !defined(WIN32) diff --git a/src/util/atom.c b/src/util/atom.c index 4f69363..c47cb5c 100644 --- a/src/util/atom.c +++ b/src/util/atom.c @@ -54,7 +54,7 @@ static int reverseMapSize; static Atom lastAtom; static int -Hash(char *string, int len) +Hash(const char *string, int len) { int h; @@ -147,7 +147,7 @@ NameEqual (const char *a, const char *b, int l) #endif weak Atom -MakeAtom(char *string, unsigned len, int makeit) +MakeAtom(const char *string, unsigned len, int makeit) { AtomListPtr a; int hash; diff --git a/src/util/fontxlfd.c b/src/util/fontxlfd.c index 8124037..18046e9 100644 --- a/src/util/fontxlfd.c +++ b/src/util/fontxlfd.c @@ -70,7 +70,7 @@ GetInt(char *ptr, int *val) #ifndef NO_LOCALE static struct lconv *locale = 0; #endif -static char *radix = ".", *plus = "+", *minus = "-"; +static const char *radix = ".", *plus = "+", *minus = "-"; static char * readreal(char *ptr, double *result) commit 8d130ac0fcf19e0e0dd0a404d9317fd8860baad4 Author: Tomas Hoger <tho...@redhat.com> Date: Mon Oct 10 14:38:06 2011 -0700 Support compress files with maxbits < 12 The compress decompression code used by libXfont rejects valid archives with maxbits less than 12 (compress allows values 9 - 16, 16 is the default). This is because maxbits-12 is used as index to hsize_table[]. That looks like an incorrect port of the original compress code, where: - hsize depended on BITS, the maximum maxbits value supported by particular build, rather than on maxbits value from the particular input file - the same hsize was used for all BITS <= 12 The quick way to verify the problem is: compress -b 11 fontfile.bdf bdftopcf -o /dev/null fontfile.bdf.Z which fails, while 12-16 works correctly. This fix removes hsize_table and uses 1 << maxbits (aka maxmaxcode) as tab_prefix size. As decompression code does not use hashing as compression code, there does not seem to be a reason to allocate any extra space. Note: In this fix, maxbits == 9 is still rejected early. AFAICS compress is able to generate such files (unknown how correct such output is), but is unable to uncompress them correctly. Reviewed-by: Jeremy Huddleston <jerem...@apple.com> diff --git a/src/fontfile/decompress.c b/src/fontfile/decompress.c index 6405d76..20971df 100644 --- a/src/fontfile/decompress.c +++ b/src/fontfile/decompress.c @@ -124,14 +124,6 @@ typedef struct _compressedFILE { } CompressedFile; -static int hsize_table[] = { - 5003, /* 12 bits - 80% occupancy */ - 9001, /* 13 bits - 91% occupancy */ - 18013, /* 14 bits - 91% occupancy */ - 35023, /* 15 bits - 94% occupancy */ - 69001 /* 16 bits - 95% occupancy */ -}; - static int BufCompressedClose ( BufFilePtr f, int doClose ); static int BufCompressedFill ( BufFilePtr f ); static code_int getcode ( CompressedFile *file ); @@ -142,7 +134,6 @@ BufFilePushCompressed (BufFilePtr f) { int code; int maxbits; - int hsize; CompressedFile *file; int extra; @@ -155,11 +146,10 @@ BufFilePushCompressed (BufFilePtr f) if (code == BUFFILEEOF) return 0; maxbits = code & BIT_MASK; - if (maxbits > BITS || maxbits < 12) + if (maxbits > BITS || maxbits <= INIT_BITS) return 0; - hsize = hsize_table[maxbits - 12]; extra = (1 << maxbits) * sizeof (char_type) + - hsize * sizeof (unsigned short); + (1 << maxbits) * sizeof (unsigned short); file = malloc (sizeof (CompressedFile) + extra); if (!file) return 0; commit bb97dbf56dff50bef936c0631587ed08dd6c8fa9 Author: Matt Dew <mar...@osource.org> Date: Mon Oct 3 20:23:47 2011 -0600 1 - fix the capitalization of the ID attriutes to match either the <title> or <funcdef> string it goes with. 2 - fix any <linkend>'s that were affected by 1. 3 - any <function> in the docs that has an actual funcdef, will become an olink. Signed-off-by: Matt Dew <mar...@osource.org> diff --git a/doc/fontlib.xml b/doc/fontlib.xml index 0338af0..c5079c8 100644 --- a/doc/fontlib.xml +++ b/doc/fontlib.xml @@ -140,10 +140,8 @@ source code, so have a listing handy. </para> - <sect1 id='requirements_for_the_font_library'> - <title> - Requirements for the Font library - </title> + <sect1 id='Requirements_for_the_Font_library'> +<title>Requirements for the Font library</title> <para> To avoid miles of duplicate code in the X server, the font server @@ -181,10 +179,8 @@ </sect1> - <sect1 id='general_font_library_interface_details'> - <title> - General Font Library Interface details. - </title> + <sect1 id='General_Font_Library_Interface_details'> +<title>General Font Library Interface details.</title> <para> To avoid collision between the #define name space for errors, the Font @@ -213,10 +209,8 @@ </sect1> - <sect1 id='font_path_elements'> - <title> - Font Path Elements - </title> + <sect1 id='Font_Path_Elements'> +<title>Font Path Elements</title> <para> At the center of the general font access methods used by X and @@ -273,9 +267,7 @@ typedef struct _FPEFunctions { </para> <sect2 id='name_check'> - <title> - (*name_check) - </title> + <title>(*name_check)</title> <para> Each new font path member is passed to this function; if @@ -290,9 +282,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='init_fpe'> - <title> - (*init_fpe) - </title> + <title>(*init_fpe)</title> <para> Initialize a new font path element. This function prepares @@ -309,9 +299,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='reset_fpe'> - <title> - (*reset_fpe) - </title> + <title>(*reset_fpe)</title> <para> When the X font path is reset, and some of the new members @@ -328,9 +316,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='free_fpe'> - <title> - (*free_fpe) - </title> + <title>(*free_fpe)</title> <para> When the server is finished with an FPE, this function is @@ -341,9 +327,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='open_font'> - <title> - (*open_font) - </title> + <title>(*open_font)</title> <para> This routine requests that a font be opened. The <parameter @@ -379,9 +363,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='close_font'> - <title> - (*close_font) - </title> + <title>(*close_font)</title> <para> When the server is finished with a font, this routine @@ -391,9 +373,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='list_fonts'> - <title> - (*list_fonts) - </title> + <title>(*list_fonts)</title> <para> The <parameter class='function'>paths</parameter> argument is @@ -406,9 +386,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='start_list_fonts_with_info'> - <title> - (*start_list_fonts_with_info) - </title> + <title>(*start_list_fonts_with_info)</title> <para> This routine sets any internal state for a verbose listing of @@ -418,9 +396,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='list_next_font_with_info'> - <title> - (*list_next_font_with_info) - </title> + <title>(*list_next_font_with_info)</title> <para> To avoid storing huge amounts of data, the interface for @@ -446,9 +422,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='wakeup_fpe'> - <title> - (*wakeup_fpe) - </title> + <title>(*wakeup_fpe)</title> <para> Whenever an FPE function has returned @@ -462,9 +436,7 @@ typedef struct _FPEFunctions { </sect2> <sect2 id='client_died'> - <title> - (*client_died) - </title> -- To UNSUBSCRIBE, email to debian-x-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org Archive: http://lists.debian.org/e1s47tj-0000ph...@vasks.debian.org