From 098ab294deed98371ee362fadafcf2e510e0cc50 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 16 Sep 2011 22:21:21 -0700 Subject: Strip trailing whitespace Performed with: find * -type f | xargs perl -i -p -e 's{[ \t]+$}{}' git diff -w & git diff -b show no diffs from this change Signed-off-by: Alan Coopersmith --- Makefile.am | 6 +- configure.ac | 12 +- include/X11/fonts/bdfint.h | 10 +- include/X11/fonts/bitmap.h | 18 +-- include/X11/fonts/fntfil.h | 92 +++++++------- include/X11/fonts/fntfilst.h | 38 +++--- include/X11/fonts/fontmisc.h | 6 +- include/X11/fonts/fontutil.h | 10 +- include/X11/fonts/pcf.h | 2 +- src/FreeType/ftenc.c | 24 ++-- src/FreeType/ftfuncs.c | 274 +++++++++++++++++++-------------------- 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 | 18 +-- src/bitmap/bdfutils.c | 2 +- src/bitmap/bitmap.c | 8 +- src/bitmap/bitmapfunc.c | 12 +- src/bitmap/bitscale.c | 104 +++++++-------- src/bitmap/fontink.c | 2 +- src/bitmap/pcfread.c | 26 ++-- src/bitmap/pcfwrite.c | 4 +- src/bitmap/snfread.c | 10 +- src/bitmap/snfstr.h | 2 +- src/builtins/buildfont | 2 +- src/builtins/builtin.h | 2 +- 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 | 20 +-- src/fc/fsio.h | 4 +- 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 | 18 +-- src/fontfile/dirfile.c | 8 +- src/fontfile/fontdir.c | 12 +- 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 | 4 +- src/util/fontaccel.c | 4 +- src/util/fontutil.c | 28 ++-- src/util/format.c | 22 ++-- src/util/patcache.c | 14 +- src/util/private.c | 4 +- src/util/utilbitmap.c | 22 ++-- 63 files changed, 753 insertions(+), 753 deletions(-) diff --git a/Makefile.am b/Makefile.am index 9153e98..7ec3188 100644 --- a/Makefile.am +++ b/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/configure.ac b/configure.ac index 1905a53..8cff1d8 100644 --- a/configure.ac +++ b/configure.ac @@ -69,13 +69,13 @@ AM_CONDITIONAL(XFONT_FREETYPE, [test x$XFONT_FREETYPE = xyes]) if test x$XFONT_FREETYPE = xyes; then AC_DEFINE(XFONT_FREETYPE,1,[Support FreeType rasterizer for nearly all font file formats]) AC_ARG_WITH(freetype-config, [ --with-freetype-config=PROG Use FreeType configuration program PROG], freetype_config=$withval, freetype_config=auto) - + if test "$freetype_config" = "auto" ; then - PKG_CHECK_MODULES(FREETYPE, freetype2, + PKG_CHECK_MODULES(FREETYPE, freetype2, freetype_config=no, freetype_config=yes) fi - if test "$freetype_config" = "yes"; then + if test "$freetype_config" = "yes"; then AC_PATH_PROG(ft_config,freetype-config,no) if test "$ft_config" = "no"; then AC_MSG_ERROR([You must have freetype installed; see http://www.freetype.org/]) @@ -84,7 +84,7 @@ if test x$XFONT_FREETYPE = xyes; then ft_config="$freetype_config" fi - if test "$freetype_config" != "no"; then + if test "$freetype_config" != "no"; then FREETYPE_CFLAGS="`$ft_config --cflags`" FREETYPE_LIBS="`$ft_config --libs`" fi @@ -112,8 +112,8 @@ X_GZIP_FONT_COMPRESSION=1 AC_SUBST(X_GZIP_FONT_COMPRESSION) AC_CHECK_LIB(z, gzopen, [Z_LIBS=-lz], AC_MSG_ERROR([*** zlib is required])) -AC_ARG_WITH(bzip2, - AS_HELP_STRING([--with-bzip2], +AC_ARG_WITH(bzip2, + AS_HELP_STRING([--with-bzip2], [Support bzip2 compressed bitmap fonts]), [], [with_bzip2=no]) if test "x$with_bzip2" = xyes; then diff --git a/include/X11/fonts/bdfint.h b/include/X11/fonts/bdfint.h index 913f660..a8d8459 100644 --- a/include/X11/fonts/bdfint.h +++ b/include/X11/fonts/bdfint.h @@ -67,21 +67,21 @@ typedef struct BDFSTAT { extern void bdfError ( char * message, ... ); extern void bdfWarning ( char *message, ... ); -extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf, +extern unsigned char * bdfGetLine ( FontFilePtr file, unsigned char *buf, int len ); extern Atom bdfForceMakeAtom ( char *str, int *size ); extern Atom bdfGetPropertyValue ( char *s ); extern int bdfIsInteger ( char *str ); extern unsigned char bdfHexByte ( unsigned char *s ); -extern Bool bdfSpecialProperty ( FontPtr pFont, FontPropPtr prop, +extern Bool bdfSpecialProperty ( FontPtr pFont, FontPropPtr prop, char isString, bdfFileState *bdfState ); -extern int bdfReadFont( FontPtr pFont, FontFilePtr file, +extern int bdfReadFont( FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan ); extern int bdfReadFontInfo( FontInfoPtr pFontInfo, FontFilePtr file ); -extern void FontCharInkMetrics ( FontPtr pFont, CharInfoPtr pCI, +extern void FontCharInkMetrics ( FontPtr pFont, CharInfoPtr pCI, xCharInfo *pInk ); -extern void FontCharReshape ( FontPtr pFont, CharInfoPtr pSrc, +extern void FontCharReshape ( FontPtr pFont, CharInfoPtr pSrc, CharInfoPtr pDst ); #endif /* BDFINT_H */ diff --git a/include/X11/fonts/bitmap.h b/include/X11/fonts/bitmap.h index c023427..7309ac6 100644 --- a/include/X11/fonts/bitmap.h +++ b/include/X11/fonts/bitmap.h @@ -74,10 +74,10 @@ typedef struct _BitmapFont { #define NUM_SEGMENTS(n) \ (((n)+BITMAP_FONT_SEGMENT_SIZE-1)/BITMAP_FONT_SEGMENT_SIZE) -extern int bitmapGetGlyphs ( FontPtr pFont, unsigned long count, - unsigned char *chars, FontEncoding charEncoding, +extern int bitmapGetGlyphs ( FontPtr pFont, unsigned long count, + unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, CharInfoPtr *glyphs ); -extern int bitmapGetMetrics ( FontPtr pFont, unsigned long count, +extern int bitmapGetMetrics ( FontPtr pFont, unsigned long count, unsigned char *chars, FontEncoding charEncoding, unsigned long *glyphCount, xCharInfo **glyphs ); @@ -88,14 +88,14 @@ extern int bitmapComputeWeight ( FontPtr pFont ); extern void BitmapRegisterFontFileFunctions ( void ); -extern int BitmapOpenScalable ( FontPathElementPtr fpe, FontPtr *pFont, +extern int BitmapOpenScalable ( FontPathElementPtr fpe, FontPtr *pFont, int flags, FontEntryPtr entry, char *fileName, - FontScalablePtr vals, fsBitmapFormat format, - fsBitmapFormatMask fmask, + FontScalablePtr vals, fsBitmapFormat format, + fsBitmapFormatMask fmask, FontPtr non_cachable_font ); -extern int BitmapGetInfoScalable ( FontPathElementPtr fpe, - FontInfoPtr pFontInfo, FontEntryPtr entry, - FontNamePtr fontName, char *fileName, +extern int BitmapGetInfoScalable ( FontPathElementPtr fpe, + FontInfoPtr pFontInfo, FontEntryPtr entry, + FontNamePtr fontName, char *fileName, FontScalablePtr vals ); #endif /* _BITMAP_H_ */ diff --git a/include/X11/fonts/fntfil.h b/include/X11/fonts/fntfil.h index 25d1f30..feefdb3 100644 --- a/include/X11/fonts/fntfil.h +++ b/include/X11/fonts/fntfil.h @@ -76,62 +76,62 @@ extern int FontFileNameCheck ( char *name ); extern int FontFileInitFPE ( FontPathElementPtr fpe ); extern int FontFileResetFPE ( FontPathElementPtr fpe ); extern int FontFileFreeFPE ( FontPathElementPtr fpe ); -extern int FontFileOpenFont ( pointer client, FontPathElementPtr fpe, - Mask flags, char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, - XID id, FontPtr *pFont, char **aliasName, +extern int FontFileOpenFont ( pointer client, FontPathElementPtr fpe, + Mask flags, char *name, int namelen, + fsBitmapFormat format, fsBitmapFormatMask fmask, + XID id, FontPtr *pFont, char **aliasName, FontPtr non_cachable_font ); extern void FontFileCloseFont ( FontPathElementPtr fpe, FontPtr pFont ); -extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, - fsBitmapFormat format, +extern int FontFileOpenBitmap ( FontPathElementPtr fpe, FontPtr *pFont, + int flags, FontEntryPtr entry, + fsBitmapFormat format, fsBitmapFormatMask fmask ); -extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +extern int FontFileListFonts ( pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, FontNamesPtr names ); -extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +extern int FontFileStartListFonts ( pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep, int mark_aliases ); -extern int FontFileStartListFontsWithInfo ( pointer client, - FontPathElementPtr fpe, - char *pat, int len, int max, +extern int FontFileStartListFontsWithInfo ( pointer client, + FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep ); -extern int FontFileListNextFontWithInfo ( pointer client, - FontPathElementPtr fpe, - char **namep, int *namelenp, - FontInfoPtr *pFontInfo, +extern int FontFileListNextFontWithInfo ( pointer client, + FontPathElementPtr fpe, + char **namep, int *namelenp, + FontInfoPtr *pFontInfo, int *numFonts, pointer private ); -extern int FontFileStartListFontsAndAliases ( pointer client, - FontPathElementPtr fpe, - char *pat, int len, int max, +extern int FontFileStartListFontsAndAliases ( pointer client, + FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep ); -extern int FontFileListNextFontOrAlias ( pointer client, - FontPathElementPtr fpe, - char **namep, int *namelenp, - char **resolvedp, int *resolvedlenp, +extern int FontFileListNextFontOrAlias ( pointer client, + FontPathElementPtr fpe, + char **namep, int *namelenp, + char **resolvedp, int *resolvedlenp, pointer private ); extern void FontFileRegisterLocalFpeFunctions ( void ); extern void CatalogueRegisterLocalFpeFunctions ( void ); -extern FontEntryPtr FontFileAddEntry ( FontTablePtr table, +extern FontEntryPtr FontFileAddEntry ( FontTablePtr table, FontEntryPtr prototype ); -extern Bool FontFileAddFontAlias ( FontDirectoryPtr dir, char *aliasName, +extern Bool FontFileAddFontAlias ( FontDirectoryPtr dir, char *aliasName, char *fontName ); -extern Bool FontFileAddFontFile ( FontDirectoryPtr dir, char *fontName, +extern Bool FontFileAddFontFile ( FontDirectoryPtr dir, char *fontName, char *fileName ); extern int FontFileCountDashes ( char *name, int namelen ); -extern FontEntryPtr FontFileFindNameInDir ( FontTablePtr table, +extern FontEntryPtr FontFileFindNameInDir ( FontTablePtr table, FontNamePtr pat ); extern FontEntryPtr FontFileFindNameInScalableDir ( FontTablePtr table, - FontNamePtr pat, + FontNamePtr pat, FontScalablePtr vals ); -extern int FontFileFindNamesInDir ( FontTablePtr table, FontNamePtr pat, +extern int FontFileFindNamesInDir ( FontTablePtr table, FontNamePtr pat, int max, FontNamesPtr names ); -extern int FontFileFindNamesInScalableDir ( FontTablePtr table, - FontNamePtr pat, int max, - FontNamesPtr names, - FontScalablePtr vals, +extern int FontFileFindNamesInScalableDir ( FontTablePtr table, + FontNamePtr pat, int max, + FontNamesPtr names, + FontScalablePtr vals, int alias_behavior, int *newmax ); extern void FontFileFreeDir ( FontDirectoryPtr dir ); @@ -151,26 +151,26 @@ extern Bool FontFilePriorityRegisterRenderer ( FontRendererPtr renderer, int priority ); extern FontRendererPtr FontFileMatchRenderer ( char *fileName ); -extern Bool FontFileAddScaledInstance ( FontEntryPtr entry, - FontScalablePtr vals, FontPtr pFont, +extern Bool FontFileAddScaledInstance ( FontEntryPtr entry, + FontScalablePtr vals, FontPtr pFont, char *bitmapName ); extern void FontFileSwitchStringsToBitmapPointers ( FontDirectoryPtr dir ); extern void FontFileRemoveScaledInstance ( FontEntryPtr entry, FontPtr pFont ); extern Bool FontFileCompleteXLFD ( FontScalablePtr vals, FontScalablePtr def ); -extern FontScaledPtr FontFileFindScaledInstance ( FontEntryPtr entry, - FontScalablePtr vals, +extern FontScaledPtr FontFileFindScaledInstance ( FontEntryPtr entry, + FontScalablePtr vals, int noSpecificSize ); extern Bool FontFileRegisterBitmapSource ( FontPathElementPtr fpe ); extern void FontFileUnregisterBitmapSource ( FontPathElementPtr fpe ); extern void FontFileEmptyBitmapSource ( void ); -extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe, - FontPtr *pFont, int flags, - FontEntryPtr entry, - FontNamePtr zeroPat, - FontScalablePtr vals, - fsBitmapFormat format, - fsBitmapFormatMask fmask, +extern int FontFileMatchBitmapSource ( FontPathElementPtr fpe, + FontPtr *pFont, int flags, + FontEntryPtr entry, + FontNamePtr zeroPat, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, Bool noSpecificSize ); extern int FontFileReadDirectory ( char *directory, FontDirectoryPtr *pdir ); diff --git a/include/X11/fonts/fntfilst.h b/include/X11/fonts/fntfilst.h index 29e0a56..8926f95 100644 --- a/include/X11/fonts/fntfilst.h +++ b/include/X11/fonts/fntfilst.h @@ -126,32 +126,32 @@ typedef struct _FontDirectory { typedef struct _FontRenderer { char *fileSuffix; int fileSuffixLen; - int (*OpenBitmap)(FontPathElementPtr /* fpe */, + int (*OpenBitmap)(FontPathElementPtr /* fpe */, FontPtr * /* pFont */, - int /* flags */, - FontEntryPtr /* entry */, - char * /* fileName */, - fsBitmapFormat /* format */, + int /* flags */, + FontEntryPtr /* entry */, + char * /* fileName */, + fsBitmapFormat /* format */, fsBitmapFormatMask /* mask */, FontPtr /* non_cachable_font */); - int (*OpenScalable)(FontPathElementPtr /* fpe */, - FontPtr * /* pFont */, - int /* flags */, - FontEntryPtr /* entry */, - char * /* fileName */, - FontScalablePtr /* vals */, - fsBitmapFormat /* format */, + int (*OpenScalable)(FontPathElementPtr /* fpe */, + FontPtr * /* pFont */, + int /* flags */, + FontEntryPtr /* entry */, + char * /* fileName */, + FontScalablePtr /* vals */, + fsBitmapFormat /* format */, fsBitmapFormatMask /* fmask */, FontPtr /* non_cachable_font */); - int (*GetInfoBitmap)(FontPathElementPtr /* fpe */, - FontInfoPtr /* pFontInfo */, - FontEntryPtr /* entry */, + int (*GetInfoBitmap)(FontPathElementPtr /* fpe */, + FontInfoPtr /* pFontInfo */, + FontEntryPtr /* entry */, char * /*fileName */); - int (*GetInfoScalable)(FontPathElementPtr /* fpe */, - FontInfoPtr /* pFontInfo */, - FontEntryPtr /* entry */, + int (*GetInfoScalable)(FontPathElementPtr /* fpe */, + FontInfoPtr /* pFontInfo */, + FontEntryPtr /* entry */, FontNamePtr /* fontName */, - char * /* fileName */, + char * /* fileName */, FontScalablePtr /* vals */); int number; int capabilities; /* Bitmap components defined above */ diff --git a/include/X11/fonts/fontmisc.h b/include/X11/fonts/fontmisc.h index cd9d52a..3da1e63 100644 --- a/include/X11/fonts/fontmisc.h +++ b/include/X11/fonts/fontmisc.h @@ -81,11 +81,11 @@ FourByteSwap( extern int RepadBitmap ( - char*, char*, - unsigned, + char*, + unsigned, unsigned, - int, + int, int ); diff --git a/include/X11/fonts/fontutil.h b/include/X11/fonts/fontutil.h index 71d507b..ed55b89 100644 --- a/include/X11/fonts/fontutil.h +++ b/include/X11/fonts/fontutil.h @@ -8,17 +8,17 @@ extern int CheckFSFormat(fsBitmapFormat, fsBitmapFormatMask, int *, int *, int *, int *, int *); extern void FontComputeInfoAccelerators(FontInfoPtr); -extern void GetGlyphs ( FontPtr font, unsigned long count, - unsigned char *chars, FontEncoding fontEncoding, +extern void GetGlyphs ( FontPtr font, unsigned long count, + unsigned char *chars, FontEncoding fontEncoding, unsigned long *glyphcount, CharInfoPtr *glyphs ); -extern void QueryGlyphExtents ( FontPtr pFont, CharInfoPtr *charinfo, +extern void QueryGlyphExtents ( FontPtr pFont, CharInfoPtr *charinfo, unsigned long count, ExtentInfoRec *info ); -extern Bool QueryTextExtents ( FontPtr pFont, unsigned long count, +extern Bool QueryTextExtents ( FontPtr pFont, unsigned long count, unsigned char *chars, ExtentInfoRec *info ); extern Bool ParseGlyphCachingMode ( char *str ); extern void InitGlyphCaching ( void ); extern void SetGlyphCachingMode ( int newmode ); -extern int add_range ( fsRange *newrange, int *nranges, fsRange **range, +extern int add_range ( fsRange *newrange, int *nranges, fsRange **range, Bool charset_subset ); #endif /* _FONTUTIL_H_ */ diff --git a/include/X11/fonts/pcf.h b/include/X11/fonts/pcf.h index a5fdbcd..3d47c66 100644 --- a/include/X11/fonts/pcf.h +++ b/include/X11/fonts/pcf.h @@ -88,7 +88,7 @@ typedef struct _PCFTable { #define PCF_GLYPH_NAMES (1<<7) #define PCF_BDF_ACCELERATORS (1<<8) -extern int pcfReadFont ( FontPtr pFont, FontFilePtr file, +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 ); diff --git a/src/FreeType/ftenc.c b/src/FreeType/ftenc.c index 99defbe..3c1d43b 100644 --- a/src/FreeType/ftenc.c +++ b/src/FreeType/ftenc.c @@ -1,15 +1,15 @@ -/* +/* Copyright (c) 1998-2003 by Juliusz Chroboczek - + Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - +furnished to do so, subject to the following conditions: + The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. +all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, @@ -49,7 +49,7 @@ FTEncFontSpecific(char *encoding) if(strcasecmp(encoding, "microsoft-symbol") == 0) return 1; - + while(*p != '-') { if(*p == '\0') return 0; @@ -123,9 +123,9 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face, } } } - + for(mapping = encoding->mappings; mapping; mapping = mapping->next) { - if(find_cmap(mapping->type, mapping->pid, mapping->eid, face, + if(find_cmap(mapping->type, mapping->pid, mapping->eid, face, &cmap)) { tm->named = 0; tm->cmap = cmap; @@ -144,7 +144,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face, return Successful; } } - + return BadFontFormat; native: @@ -155,7 +155,7 @@ FTPickMapping(char *xlfd, int length, char *filename, FT_Face face, return Successful; } -static int +static int find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return) { int i, n; @@ -177,7 +177,7 @@ find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return) /* prefer Microsoft Unicode */ for(i=0; icharmaps[i]; - if(cmap->platform_id == TT_PLATFORM_MICROSOFT && + if(cmap->platform_id == TT_PLATFORM_MICROSOFT && cmap->encoding_id == TT_MS_ID_UNICODE_CS) { *cmap_return = cmap; return 1; @@ -207,7 +207,7 @@ find_cmap(int type, int pid, int eid, FT_Face face, FT_CharMap *cmap_return) return 0; } -unsigned +unsigned FTRemap(FT_Face face, FTMappingPtr tm, unsigned code) { unsigned index; diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c index fd8e53e..d768807 100644 --- a/src/FreeType/ftfuncs.c +++ b/src/FreeType/ftfuncs.c @@ -48,7 +48,7 @@ THE SOFTWARE. #include FT_BBOX_H #include FT_TRUETYPE_TAGS_H /* - * If you want to use FT_Outline_Get_CBox instead of + * If you want to use FT_Outline_Get_CBox instead of * FT_Outline_Get_BBox, define here. */ /* #define USE_GET_CBOX */ @@ -160,7 +160,7 @@ iceil(int x, int y) { return ifloor(x + y - 1, y); } - + static int FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int faceNumber) { @@ -267,7 +267,7 @@ TransEqual(FTNormalisedTransformationPtr t1, FTNormalisedTransformationPtr t2) else if(t1->nonIdentity != t2->nonIdentity) return 0; else if(t1->nonIdentity && t2->nonIdentity) { - return + return t1->matrix.xx == t2->matrix.xx && t1->matrix.yx == t2->matrix.yx && t1->matrix.yy == t2->matrix.yy && @@ -300,7 +300,7 @@ TTCapEqual(struct TTCapInfo *t1, struct TTCapInfo *t2) t1->flags == t2->flags && t1->scaleBitmap == t2->scaleBitmap && /* - If we use forceConstantSpacing, + If we use forceConstantSpacing, we *MUST* allocate new instance. */ t1->forceConstantSpacingEnd < 0 && @@ -311,7 +311,7 @@ static int FTInstanceMatch(FTInstancePtr instance, char *FTFileName, FTNormalisedTransformationPtr trans, int spacing, FontBitmapFormatPtr bmfmt, - struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags) + struct TTCapInfo *tmp_ttcap, FT_Int32 load_flags) { if(strcmp(instance->face->filename, FTFileName) != 0) { return 0; @@ -347,7 +347,7 @@ FreeTypeActivateInstance(FTInstancePtr instance) instance->transformation.nonIdentity ? &instance->transformation.matrix : 0, 0); - + instance->face->active_instance = instance; return Successful; } @@ -377,7 +377,7 @@ FTFindSize(FT_Face face, FTNormalisedTransformationPtr trans, j = i; d = dd; } - } + } } if(j < 0) return BadFontName; @@ -530,7 +530,7 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face, /* maintain a linked list of instances */ instance->next = instance->face->instances; instance->face->instances = instance; - + *instance_return = instance; return Successful; } @@ -547,7 +547,7 @@ FreeTypeFreeInstance(FTInstancePtr instance) instance->refcount--; if(instance->refcount <= 0) { int i,j; - + if(instance->face->instances == instance) instance->face->instances = instance->next; else { @@ -573,7 +573,7 @@ FreeTypeFreeInstance(FTInstancePtr instance) for(i = 0; i < iceil(instance->nglyphs, FONTSEGMENTSIZE); i++) { if(instance->glyphs[i]) { for(j = 0; j < FONTSEGMENTSIZE; j++) { - if(instance->available[i][j] == + if(instance->available[i][j] == FT_AVAILABLE_RASTERISED) free(instance->glyphs[i][j].bits); } @@ -610,7 +610,7 @@ FreeTypeInstanceFindGlyph(unsigned idx_in, int flags, FTInstancePtr instance, *found = 0; return Successful; } - + if(*available == NULL) { *available = calloc(iceil(instance->nglyphs, FONTSEGMENTSIZE), sizeof(int *)); @@ -653,7 +653,7 @@ FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr int xrc; int ***available; CharInfoPtr **glyphs; - + available = &instance->available; glyphs = &instance->glyphs; @@ -665,17 +665,17 @@ FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr if(!found || (*available)[segment][offset] == FT_AVAILABLE_NO) { *g = NULL; return Successful; - } + } if((*available)[segment][offset] == FT_AVAILABLE_RASTERISED) { *g = &(*glyphs)[segment][offset]; return Successful; } - + flags |= FT_GET_GLYPH_BOTH; - xrc = FreeTypeRasteriseGlyph(idx, flags, - &(*glyphs)[segment][offset], instance, + xrc = FreeTypeRasteriseGlyph(idx, flags, + &(*glyphs)[segment][offset], instance, (*available)[segment][offset] >= FT_AVAILABLE_METRICS); if(xrc != Successful && (*available)[segment][offset] >= FT_AVAILABLE_METRICS) { ErrorF("Warning: FreeTypeRasteriseGlyph() returns an error,\n"); @@ -698,7 +698,7 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, { int xrc; int found, segment, offset; - + /* Char cell */ if(instance->spacing == FT_CHARCELL) { *metrics = instance->charcellMetrics; @@ -712,8 +712,8 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, /* Not char cell */ - xrc = FreeTypeInstanceFindGlyph(idx, flags, instance, - &instance->glyphs, &instance->available, + xrc = FreeTypeInstanceFindGlyph(idx, flags, instance, + &instance->glyphs, &instance->available, &found, &segment, &offset); if(xrc != Successful) return xrc; @@ -724,16 +724,16 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, if( instance->available[segment][offset] == FT_AVAILABLE_NO ) { *metrics = NULL; return Successful; - } + } if( instance->available[segment][offset] >= FT_AVAILABLE_METRICS ) { *metrics = &instance->glyphs[segment][offset].metrics; return Successful; } - + flags |= FT_GET_GLYPH_METRICS_ONLY; - xrc = FreeTypeRasteriseGlyph(idx, flags, + xrc = FreeTypeRasteriseGlyph(idx, flags, &instance->glyphs[segment][offset], instance, 0); if(xrc == Successful) { @@ -742,7 +742,7 @@ FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, } return xrc; } - + /* * Pseudo enbolding similar as Microsoft Windows. * It is useful but poor. @@ -796,7 +796,7 @@ ft_make_up_italic_bitmap( char *raster, int bpr, int ht, int shift, tmp_shift %= 8; if ( tmp_shift ) { for (x=bpr-1;0<=x;x--) { - if ( x != bpr-1 ) + if ( x != bpr-1 ) tmp_p[x+1] |= tmp_p[x]<<(8-tmp_shift); tmp_p[x]>>=tmp_shift; } @@ -814,7 +814,7 @@ ft_make_up_italic_bitmap( char *raster, int bpr, int ht, int shift, tmp_shift %= 8; if ( tmp_shift ) { for (x=0;x>(8-tmp_shift); tmp_p[x]<<=tmp_shift; } @@ -892,7 +892,7 @@ tt_get_metrics( FT_Face face, } } -static int +static int ft_get_very_lazy_bbox( FT_UInt index, FT_Face face, FT_Size size, @@ -1049,7 +1049,7 @@ FT_Do_SBit_Metrics( FT_Face ft_face, FT_Size ft_size, FT_ULong strike_index, metrics_return->horiBearingX = (FT_Pos)elem_metrics.horiBearingX << 6; metrics_return->horiBearingY = (FT_Pos)elem_metrics.horiBearingY << 6; metrics_return->horiAdvance = (FT_Pos)elem_metrics.horiAdvance << 6; - + metrics_return->vertBearingX = (FT_Pos)elem_metrics.vertBearingX << 6; metrics_return->vertBearingY = (FT_Pos)elem_metrics.vertBearingY << 6; metrics_return->vertAdvance = (FT_Pos)elem_metrics.vertAdvance << 6; @@ -1100,12 +1100,12 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, if(!hasMetrics) { if( instance->spacing == FT_CHARCELL || flags & FT_GET_DUMMY ){ - memcpy((char*)&tgp->metrics, + memcpy((char*)&tgp->metrics, (char*)instance->charcellMetrics, sizeof(xCharInfo)); } else if( flags & FT_FORCE_CONSTANT_SPACING ) { - memcpy((char*)&tgp->metrics, + memcpy((char*)&tgp->metrics, (char*)instance->forceConstantMetrics, sizeof(xCharInfo)); } @@ -1123,16 +1123,16 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, } if( bitmap_metrics == NULL ) { if ( sbitchk_incomplete_but_exist==0 && (instance->ttcap.flags & TTCAP_IS_VERY_LAZY) ) { - if( ft_get_very_lazy_bbox( idx, face->face, instance->size, + if( ft_get_very_lazy_bbox( idx, face->face, instance->size, face->num_hmetrics, instance->ttcap.vl_slant, &instance->transformation.matrix, - &bbox, &outline_hori_advance, + &bbox, &outline_hori_advance, &outline_vert_advance ) == 0 ) { goto bbox_ok; /* skip exact calculation */ } } - ftrc = FT_Load_Glyph(instance->face->face, idx, + ftrc = FT_Load_Glyph(instance->face->face, idx, instance->load_flags); if(ftrc != 0) return FTtoXReturnCode(ftrc); metrics = &face->face->glyph->metrics; @@ -1143,11 +1143,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, if( bitmap_metrics ) { FT_Pos factor; - + leftSideBearing = bitmap_metrics->horiBearingX / 64; rightSideBearing = (bitmap_metrics->width + bitmap_metrics->horiBearingX) / 64; bbox_center_raw = (2.0 * bitmap_metrics->horiBearingX + bitmap_metrics->width)/2.0/64.0; - characterWidth = (int)floor(bitmap_metrics->horiAdvance + characterWidth = (int)floor(bitmap_metrics->horiAdvance * instance->ttcap.scaleBBoxWidth / 64.0 + .5); ascent = bitmap_metrics->horiBearingY / 64; descent = (bitmap_metrics->height - bitmap_metrics->horiBearingY) / 64 ; @@ -1192,11 +1192,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, bbox_center_raw = (double)(bbox.xMax + bbox.xMin)/2.0/64.; if ( instance->pixel_width_unit_x != 0 ) characterWidth = - (int)floor( outline_hori_advance + (int)floor( outline_hori_advance * instance->ttcap.scaleBBoxWidth * instance->pixel_width_unit_x / 64. + .5); else { - characterWidth = + characterWidth = (int)floor( outline_vert_advance * instance->ttcap.scaleBBoxHeight * instance->pixel_width_unit_y / 64. + .5); @@ -1212,12 +1212,12 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, characterWidth = new_width; if ( instance->pixel_width_unit_x != 0 ) rawCharacterWidth = - (unsigned short)(short)(floor(1000 * outline_hori_advance + (unsigned short)(short)(floor(1000 * outline_hori_advance * instance->ttcap.scaleBBoxWidth * ratio * instance->pixel_width_unit_x / 64.)); else { rawCharacterWidth = - (unsigned short)(short)(floor(1000 * outline_vert_advance + (unsigned short)(short)(floor(1000 * outline_vert_advance * instance->ttcap.scaleBBoxHeight * ratio * instance->pixel_width_unit_y / 64.)); if(rawCharacterWidth <= 0) @@ -1281,7 +1281,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, if( flags & FT_GET_DUMMY ) is_outline = -1; else { if( !metrics ) { - ftrc = FT_Load_Glyph(instance->face->face, idx, + ftrc = FT_Load_Glyph(instance->face->face, idx, instance->load_flags); metrics = &face->face->glyph->metrics; @@ -1299,7 +1299,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, bbox.yMin = FLOOR64( bbox.yMin ); bbox.yMax = CEIL64 ( bbox.yMax ); ht_actual = ( bbox.yMax - bbox.yMin ) >> 6; - /* FreeType think a glyph with 0 height control box is invalid. + /* FreeType think a glyph with 0 height control box is invalid. * So just let X to create a empty bitmap instead. */ if ( ht_actual == 0 ) is_outline = -1; @@ -1319,11 +1319,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, if( (instance->ttcap.flags & TTCAP_MONO_CENTER) && hasMetrics ) { if( is_outline == 1 ){ if( correct ){ - if( ft_get_very_lazy_bbox( idx, face->face, instance->size, + if( ft_get_very_lazy_bbox( idx, face->face, instance->size, face->num_hmetrics, instance->ttcap.vl_slant, &instance->transformation.matrix, - &bbox, &outline_hori_advance, + &bbox, &outline_hori_advance, &outline_vert_advance ) != 0 ){ is_outline = -1; /* <- error */ } @@ -1357,10 +1357,10 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, if(ht_actual <= 0) ht = 1; else ht=ht_actual; - bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) & + bpr = (((wd + (instance->bmfmt.glyph<<3) - 1) >> 3) & -instance->bmfmt.glyph); raster = calloc(1, ht * bpr); - if(raster == NULL) + if(raster == NULL) return AllocError; tgp->bits = raster; @@ -1483,7 +1483,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, if ( is_outline == 0 && ( instance->ttcap.lsbShiftOfBitmapAutoItalic != 0 || instance->ttcap.rsbShiftOfBitmapAutoItalic != 0 ) ) { - ft_make_up_italic_bitmap( raster, bpr, ht, + ft_make_up_italic_bitmap( raster, bpr, ht, - instance->ttcap.lsbShiftOfBitmapAutoItalic + instance->ttcap.rsbShiftOfBitmapAutoItalic, instance->charcellMetrics->ascent @@ -1492,11 +1492,11 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, - tgp->metrics.ascent, instance->ttcap.autoItalic); } - + if(instance->bmfmt.bit == LSBFirst) { BitOrderInvert((unsigned char*)(tgp->bits), ht*bpr); } - + if(instance->bmfmt.byte != instance->bmfmt.bit) { switch(instance->bmfmt.scan) { case 1: @@ -1532,7 +1532,7 @@ static void FreeTypeFreeXFont(FontPtr pFont, int freeProps) { FTFontPtr tf; - + if(pFont) { if((tf = (FTFontPtr)pFont->fontPrivate)) { FreeTypeFreeFont(tf); @@ -1562,7 +1562,7 @@ FreeTypeUnloadXFont(FontPtr pFont) used by Xaw. */ static int -FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, +FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, char *fontname, int rawAverageWidth, Bool font_properties) { int i, j, maxprops; @@ -1600,7 +1600,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, } info->nprops = 0; /* in case we abort */ - + strcpy(val, fontname); if(FontParseXLFDName(val, vals, FONT_XLFD_REPLACE_VALUE)) { xlfdProps = 1; @@ -1618,11 +1618,11 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, ( (font_properties && os2) ? 6 : 0 ) + ( (font_properties && (post || t1info)) ? 3 : 0 ) + 2; /* type */ - + info->props = malloc(maxprops * sizeof(FontPropRec)); if(info->props == NULL) return AllocError; - + info->isStringProp = malloc(maxprops); if(info->isStringProp == NULL) { free(info->props); @@ -1646,18 +1646,18 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, for (ep = sp; *ep && *ep != '['; ep++); else for (ep = sp; *ep && *ep != '-'; ep++); - + info->props[i].name = MakeAtom(xlfd_props[j], strlen(xlfd_props[j]), TRUE); - + switch(j) { case 6: /* pixel size */ - info->props[i].value = + info->props[i].value = (int)(fabs(vals->pixel_matrix[3]) + 0.5); i++; break; case 7: /* point size */ - info->props[i].value = + info->props[i].value = (int)(fabs(vals->point_matrix[3])*10.0 + 0.5); i++; break; @@ -1704,7 +1704,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, if(!face->bitmap) { info->props[i].name = MakeAtom("RAW_ASCENT", 10, TRUE); - info->props[i].value = + info->props[i].value = ((double)face->face->ascender/(double)upm*1000.0); i++; } @@ -1717,7 +1717,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, if(!face->bitmap) { info->props[i].name = MakeAtom("RAW_DESCENT", 11, TRUE); - info->props[i].value = + info->props[i].value = -((double)face->face->descender/(double)upm*1000.0); i++; } @@ -1737,7 +1737,7 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, info->isStringProp[i] = 1; i++; } - + j = FTGetEnglishName(face->face, TT_NAME_ID_FULL_NAME, val, MAXFONTNAMELEN); vp = val; @@ -1790,30 +1790,30 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, /* In what follows, we assume the matrix is diagonal. In the rare case when it is not, the values will be somewhat wrong. */ - + if( font_properties && os2 ) { info->props[i].name = MakeAtom("SUBSCRIPT_SIZE",14,TRUE); - info->props[i].value = + info->props[i].value = TRANSFORM_FUNITS_Y(os2->ySubscriptYSize); i++; info->props[i].name = MakeAtom("SUBSCRIPT_X",11,TRUE); - info->props[i].value = + info->props[i].value = TRANSFORM_FUNITS_X(os2->ySubscriptXOffset); i++; info->props[i].name = MakeAtom("SUBSCRIPT_Y",11,TRUE); - info->props[i].value = + info->props[i].value = TRANSFORM_FUNITS_Y(os2->ySubscriptYOffset); i++; info->props[i].name = MakeAtom("SUPERSCRIPT_SIZE",16,TRUE); - info->props[i].value = + info->props[i].value = TRANSFORM_FUNITS_Y(os2->ySuperscriptYSize); i++; info->props[i].name = MakeAtom("SUPERSCRIPT_X",13,TRUE); - info->props[i].value = + info->props[i].value = TRANSFORM_FUNITS_X(os2->ySuperscriptXOffset); i++; info->props[i].name = MakeAtom("SUPERSCRIPT_Y",13,TRUE); - info->props[i].value = + info->props[i].value = TRANSFORM_FUNITS_Y(os2->ySuperscriptYOffset); i++; } @@ -1821,15 +1821,15 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, if( font_properties && (post || t1info) ) { int underlinePosition, underlineThickness; - /* Raw underlineposition counts upwards, + /* Raw underlineposition counts upwards, but UNDERLINE_POSITION counts downwards. */ if(post) { underlinePosition = TRANSFORM_FUNITS_Y(-post->underlinePosition); underlineThickness = TRANSFORM_FUNITS_Y(post->underlineThickness); } else { - underlinePosition = + underlinePosition = TRANSFORM_FUNITS_Y(-t1info->underline_position); - underlineThickness = + underlineThickness = TRANSFORM_FUNITS_Y(t1info->underline_thickness); } if(underlineThickness <= 0) @@ -1848,8 +1848,8 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, /* The italic angle is often unreliable for Type 1 fonts */ if(post && trans->matrix.xx == trans->matrix.yy) { info->props[i].name = MakeAtom("ITALIC_ANGLE",12,TRUE); - info->props[i].value = - /* Convert from TT_Fixed to + info->props[i].value = + /* Convert from TT_Fixed to 64th of a degree counterclockwise from 3 o'clock */ 90*64+(post->italicAngle >> 10); i++; @@ -1863,12 +1863,12 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, info->props[i].value = MakeAtom(vp, strlen(vp), TRUE); info->isStringProp[i] = 1; i++; - + info->props[i].name = MakeAtom("RASTERIZER_NAME", 15, TRUE); info->props[i].value = MakeAtom("FreeType", 10, TRUE); info->isStringProp[i] = 1; i++; - + info->nprops = i; return Successful; } @@ -1876,20 +1876,20 @@ FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, static int ft_get_index(unsigned code, FTFontPtr font, unsigned *idx) { - + /* As a special case, we pass 0 even when it is not in the ranges; this will allow for the default glyph, which should exist in any TrueType font. */ - + /* This is not required... if(code > 0 && font->nranges) { int i; for(i = 0; i < font->nranges; i++) - if((code >= + if((code >= font->ranges[i].min_char_low+ (font->ranges[i].min_char_high<<8)) && (code <= - font->ranges[i].max_char_low + + font->ranges[i].max_char_low + (font->ranges[i].max_char_high<<8))) break; if(i == font->nranges) { @@ -1911,7 +1911,7 @@ ft_get_index(unsigned code, FTFontPtr font, unsigned *idx) } *idx = FTRemap(font->instance->face->face, &font->mapping, code); - + return 0; } @@ -1920,7 +1920,7 @@ FreeTypeFontGetGlyph(unsigned code, int flags, CharInfoPtr *g, FTFontPtr font) { unsigned idx = 0; int xrc; - + #ifdef X_ACCEPTS_NO_SUCH_CHAR if( ft_get_index(code,font,&idx) || idx == 0 || idx == font->zero_idx ) { *g = NULL; @@ -1972,7 +1972,7 @@ FreeTypeFontGetGlyphMetrics(unsigned code, int flags, xCharInfo **metrics, FTFon if( xrc == Successful && *metrics != NULL ) return Successful; if( font->zero_idx != idx ) { - xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags, + xrc = FreeTypeInstanceGetGlyphMetrics(font->zero_idx, flags, metrics, font->instance); if( xrc == Successful && *metrics != NULL ) return Successful; @@ -2156,7 +2156,7 @@ restrict_code_range_by_str(int count,unsigned short *refFirstCol, } /* *face_number and *spacing are initialized but *load_flags is NOT. */ -static int +static int FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, char **dynStrRealFileName, char **dynStrFTFileName, struct TTCapInfo *ret, int *face_number, FT_Int32 *load_flags, @@ -2185,7 +2185,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, { /* font cap */ char *p1=NULL, *p2=NULL; - + p1=strrchr(fileName, '/'); if ( p1 == NULL ) p1 = fileName; else p1++; @@ -2193,7 +2193,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, /* colon exist in the right side of slash. */ int dirLen = p1-fileName; int baseLen = fileName+len - p2 -1; - + *dynStrRealFileName = malloc(dirLen+baseLen+1); if( *dynStrRealFileName == NULL ) { result = AllocError; @@ -2302,7 +2302,7 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, fprintf(stderr,"[Filename:%s]\n",fileName); fprintf(stderr,"[RealFilename:%s]\n",*dynStrRealFileName); fprintf(stderr,"[FTFilename:%s]\n",*dynStrFTFileName); - */ + */ /* slant control */ if (SPropRecValList_search_record(&listPropRecVal, &contRecValue, @@ -2587,15 +2587,15 @@ FreeTypeSetUpTTCap( char *fileName, FontScalablePtr vals, semic_ptr=strchr(strMetrics,';'); comma_ptr=strchr(strMetrics,','); period_ptr=strchr(strMetrics,'.'); - if ( semic_ptr && comma_ptr ) + if ( semic_ptr && comma_ptr ) if ( semic_ptr < comma_ptr ) comma_ptr=NULL; - if ( semic_ptr && period_ptr ) + if ( semic_ptr && period_ptr ) if ( semic_ptr < period_ptr ) period_ptr=NULL; if ( !comma_ptr && !period_ptr && strMetrics != semic_ptr ) { if ( restrict_code_range_by_str(1,&first_col, &first_row, &last_col, &last_row, SPropContainer_value_str(contRecValue)) == 1 ) { - ret->force_c_representative_metrics_char_code = + ret->force_c_representative_metrics_char_code = (int)( first_row<<8 | first_col ); } } @@ -2688,14 +2688,14 @@ ft_get_trans_from_vals( FontScalablePtr vals, FTNormalisedTransformationPtr tran { /* Compute the transformation matrix. We use floating-point arithmetic for simplicity */ - + trans->xres = vals->x; trans->yres = vals->y; - + /* This value cannot be 0. */ trans->scale = hypot(vals->point_matrix[2], vals->point_matrix[3]); trans->nonIdentity = 0; - + /* Try to round stuff. We want approximate zeros to be exact zeros, and if the elements on the diagonal are approximately equal, we want them equal. We do this to avoid breaking hinting. */ @@ -2710,14 +2710,14 @@ ft_get_trans_from_vals( FontScalablePtr vals, FTNormalisedTransformationPtr tran ((vals->point_matrix[0] + vals->point_matrix[3])/2* (double)TWO_SIXTEENTH)/trans->scale; } - + if(DIFFER0(vals->point_matrix[1], trans->scale)) { trans->matrix.yx = (int)((vals->point_matrix[1]*(double)TWO_SIXTEENTH)/trans->scale); trans->nonIdentity = 1; } else trans->matrix.yx = 0; - + if(DIFFER0(vals->point_matrix[2], trans->scale)) { trans->matrix.xy = (int)((vals->point_matrix[2]*(double)TWO_SIXTEENTH)/trans->scale); @@ -2749,7 +2749,7 @@ is_fixed_width(FT_Face face) static int FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, char *FTFileName, FontScalablePtr vals, FontEntryPtr entry, - FontBitmapFormatPtr bmfmt, FT_Int32 load_flags, + FontBitmapFormatPtr bmfmt, FT_Int32 load_flags, struct TTCapInfo *tmp_ttcap, char *dynStrTTCapCodeRange, int ttcap_spacing ) { @@ -2766,7 +2766,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, if(entry->name.ndashes == 14) { char *p; int dashes = 0; - for(p = entry->name.name; + for(p = entry->name.name; p <= entry->name.name + entry->name.length - 2; p++) { if(*p == '-') { @@ -2800,17 +2800,17 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, if (xrc != Successful) return xrc; } else { - xrc = FTPickMapping(0, 0, FTFileName, + xrc = FTPickMapping(0, 0, FTFileName, face->face, &font->mapping); if (xrc != Successful) return xrc; } - + font->nranges = vals->nranges; font->ranges = 0; if(font->nranges) { font->ranges = malloc(vals->nranges*sizeof(fsRange)); - if(font->ranges == NULL) + if(font->ranges == NULL) return AllocError; memcpy((char*)font->ranges, (char*)vals->ranges, vals->nranges*sizeof(fsRange)); @@ -2820,7 +2820,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, if(info) { firstCode = 0; lastCode = 0xFFFFL; - if(!font->mapping.mapping || + if(!font->mapping.mapping || font->mapping.mapping->encoding->row_size == 0) { /* linear indexing */ lastCode=MIN(lastCode, @@ -2841,7 +2841,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, info->lastRow = MIN(font->mapping.mapping->encoding->size-1, lastCode/0x100); info->firstCol = font->mapping.mapping->encoding->first_col; - info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1, + info->lastCol = MIN(font->mapping.mapping->encoding->row_size-1, lastCode<0x100?lastCode:0xFF); if( info->firstRow == 0 && info->firstCol == 0 ) zero_code=0; } @@ -2868,7 +2868,7 @@ FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, font->zero_idx = 0; } else - font->zero_idx = FTRemap(face->face, + font->zero_idx = FTRemap(face->face, &font->mapping, zero_code); post = FT_Get_Sfnt_Table(face->face, ft_sfnt_post); @@ -2954,7 +2954,7 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals ) for (row = pinfo->firstRow; row <= pinfo->lastRow; row++) { if ( skip_ok && tmpchar ) { if ( !force_c_outside ) { - if ( instance->ttcap.forceConstantSpacingBegin < row<<8 + if ( instance->ttcap.forceConstantSpacingBegin < row<<8 && row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) { if (tmpchar->characterWidth) { num_chars += num_cols; @@ -2966,7 +2966,7 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals ) else skip_ok=0; } else { /* for GB18030 proportional */ - if ( instance->ttcap.forceConstantSpacingBegin < row<<8 + if ( instance->ttcap.forceConstantSpacingBegin < row<<8 || row<<8 < (instance->ttcap.forceConstantSpacingEnd & 0x0ff00) ) { if (tmpchar->characterWidth) { num_chars += num_cols; @@ -2982,12 +2982,12 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals ) c = row<<8|col; flags=0; if ( !force_c_outside ) { - if ( c <= instance->ttcap.forceConstantSpacingEnd + if ( c <= instance->ttcap.forceConstantSpacingEnd && instance->ttcap.forceConstantSpacingBegin <= c ) flags|=FT_FORCE_CONSTANT_SPACING; } else { /* for GB18030 proportional */ - if ( c <= instance->ttcap.forceConstantSpacingEnd + if ( c <= instance->ttcap.forceConstantSpacingEnd || instance->ttcap.forceConstantSpacingBegin <= c ) flags|=FT_FORCE_CONSTANT_SPACING; } @@ -3007,13 +3007,13 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals ) overlap = tmpchar->rightSideBearing - tmpchar->characterWidth; if (maxOverlap < overlap) maxOverlap = overlap; - + if (!tmpchar->characterWidth) continue; num_chars++; swidth += ABS(tmpchar->characterWidth); total_width += tmpchar->characterWidth; - + if ( flags & FT_FORCE_CONSTANT_SPACING ) skip_ok=1; } } @@ -3107,7 +3107,7 @@ is_matrix_unit(FontScalablePtr vals) m.yx = vals->point_matrix[1] / base_size * 65536; m.yy = vals->point_matrix[3] / base_size * 65536; - return (m.xx == 65536) && (m.yx == 0) && + return (m.xx == 65536) && (m.yx == 0) && (m.xy == 0) && (m.yy == 65536); } @@ -3115,7 +3115,7 @@ is_matrix_unit(FontScalablePtr vals) /* xf->info is only accessed through info, and xf might be null */ static int -FreeTypeLoadXFont(char *fileName, +FreeTypeLoadXFont(char *fileName, FontScalablePtr vals, FontPtr xf, FontInfoPtr info, FontBitmapFormatPtr bmfmt, FontEntryPtr entry) { @@ -3143,9 +3143,9 @@ FreeTypeLoadXFont(char *fileName, goto quit; } - xrc = FreeTypeSetUpTTCap(fileName, vals, + xrc = FreeTypeSetUpTTCap(fileName, vals, &dynStrRealFileName, &dynStrFTFileName, - &tmp_ttcap, &face_number, + &tmp_ttcap, &face_number, &load_flags, &ttcap_spacing, &font_properties, &dynStrTTCapCodeRange); if ( xrc != Successful ) { @@ -3187,7 +3187,7 @@ FreeTypeLoadXFont(char *fileName, } xrc = FreeTypeLoadFont(font, info, face, dynStrFTFileName, vals, entry, bmfmt, - load_flags, &tmp_ttcap, dynStrTTCapCodeRange, + load_flags, &tmp_ttcap, dynStrTTCapCodeRange, ttcap_spacing ); if(xrc != Successful) { goto quit; @@ -3258,9 +3258,9 @@ FreeTypeLoadXFont(char *fileName, width_x = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y; } else{ - unit_x = fabs(vals->pixel_matrix[0] - + unit_x = fabs(vals->pixel_matrix[0] - vals->pixel_matrix[1]*vals->pixel_matrix[2]/vals->pixel_matrix[3]); - unit_y = fabs(vals->pixel_matrix[2] - + unit_y = fabs(vals->pixel_matrix[2] - vals->pixel_matrix[3]*vals->pixel_matrix[0]/vals->pixel_matrix[1]); width_x = face->face->max_advance_width * ins_ttcap->scaleBBoxWidth * unit_x; width_y = max_advance_height * ins_ttcap->scaleBBoxHeight * unit_y; @@ -3346,7 +3346,7 @@ FreeTypeLoadXFont(char *fileName, force_c_rsb += ins_ttcap->force_c_adjust_rsb_by_pixel; force_c_lsb += ins_ttcap->force_c_adjust_lsb_by_pixel; /* apply to rawWidth */ - averageWidth = (int)floor(10 * width_x * scale + averageWidth = (int)floor(10 * width_x * scale * ratio + 0.5); rawWidth = floor(width_x * scale * ratio * 1000. / base_height + 0.5); @@ -3505,7 +3505,7 @@ FreeTypeLoadXFont(char *fileName, instance->forceConstantMetrics->attributes = force_c_rawWidth; } /* Check code 0 */ - if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING, + if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING, &tmpglyph, font->instance) != Successful || tmpglyph == NULL) if( FreeTypeInstanceGetGlyph(font->zero_idx, FT_FORCE_CONSTANT_SPACING | FT_GET_DUMMY, @@ -3541,10 +3541,10 @@ FreeTypeLoadXFont(char *fileName, if( !charcell ) { /* NOT CHARCELL */ if( info ){ - /* + /* Calculate all glyphs' metrics. maxbounds.ascent and maxbounds.descent are quite important values - for XAA. If ascent/descent of each glyph exceeds + for XAA. If ascent/descent of each glyph exceeds maxbounds.ascent/maxbounds.descent, XAA causes SERVER CRASH. Therefore, THIS MUST BE DONE. */ @@ -3558,7 +3558,7 @@ FreeTypeLoadXFont(char *fileName, */ vals->width = averageWidth; - + if( info ){ info->maxbounds.leftSideBearing = minLsb; @@ -3568,7 +3568,7 @@ FreeTypeLoadXFont(char *fileName, info->maxbounds.descent = descent; info->maxbounds.attributes = (unsigned short)(short)rawWidth; - + info->minbounds = info->maxbounds; } } @@ -3584,12 +3584,12 @@ FreeTypeLoadXFont(char *fileName, info->fontDescent = info->maxbounds.descent; /* Glyph metrics are accurate */ info->inkMetrics=1; - + memcpy((char *)&info->ink_maxbounds, (char *)&info->maxbounds, sizeof(xCharInfo)); memcpy((char *)&info->ink_minbounds, (char *)&info->minbounds, sizeof(xCharInfo)); - + /* XXX - hack */ info->defaultCh=0; @@ -3607,9 +3607,9 @@ FreeTypeLoadXFont(char *fileName, if(xf) xf->fontPrivate = (void*)font; - + if(info) { - xrc = FreeTypeAddProperties(font, vals, info, entry->name.name, + xrc = FreeTypeAddProperties(font, vals, info, entry->name.name, rawAverageWidth, font_properties); if (xrc != Successful) { goto quit; @@ -3650,23 +3650,23 @@ FreeTypeGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars, while (count-- > 0) { switch (charEncoding) { - case Linear8Bit: + case Linear8Bit: case TwoD8Bit: code = *chars++; break; - case Linear16Bit: + case Linear16Bit: case TwoD16Bit: code = (*chars++ << 8); code |= *chars++; /* */ if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) { - if ( (int)code <= ttcap->forceConstantSpacingEnd + if ( (int)code <= ttcap->forceConstantSpacingEnd && ttcap->forceConstantSpacingBegin <= (int)code ) flags|=FT_FORCE_CONSTANT_SPACING; else flags=0; } else { /* for GB18030 proportional */ - if ( (int)code <= ttcap->forceConstantSpacingEnd + if ( (int)code <= ttcap->forceConstantSpacingEnd || ttcap->forceConstantSpacingBegin <= (int)code ) flags|=FT_FORCE_CONSTANT_SPACING; else flags=0; @@ -3681,7 +3681,7 @@ FreeTypeGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars, else *mp++ = &noSuchChar.metrics; #endif } - + *metricCount = mp - metrics; return Successful; } @@ -3708,24 +3708,24 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, code = *chars++; break; case Linear16Bit: case TwoD16Bit: - code = *chars++ << 8; + code = *chars++ << 8; code |= *chars++; /* */ if ( !(ttcap->flags & TTCAP_FORCE_C_OUTSIDE) ) { - if ( (int)code <= ttcap->forceConstantSpacingEnd + if ( (int)code <= ttcap->forceConstantSpacingEnd && ttcap->forceConstantSpacingBegin <= (int)code ) flags|=FT_FORCE_CONSTANT_SPACING; else flags=0; } else { /* for GB18030 proportional */ - if ( (int)code <= ttcap->forceConstantSpacingEnd + if ( (int)code <= ttcap->forceConstantSpacingEnd || ttcap->forceConstantSpacingBegin <= (int)code ) flags|=FT_FORCE_CONSTANT_SPACING; else flags=0; } break; } - + if(FreeTypeFontGetGlyph(code, flags, &g, tf) == Successful && g!=NULL) { *gp++ = g; } @@ -3746,7 +3746,7 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, else wd=wd_actual; if(ht_actual <= 0) ht = 1; else ht=ht_actual; - bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) & + bpr = (((wd + (tf->instance->bmfmt.glyph<<3) - 1) >> 3) & -tf->instance->bmfmt.glyph); raster = calloc(1, ht * bpr); if(raster) { @@ -3758,13 +3758,13 @@ FreeTypeGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, } #endif } - + *glyphCount = gp - glyphs; return Successful; } static int -FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info, +FreeTypeSetUpFont(FontPathElementPtr fpe, FontPtr xf, FontInfoPtr info, fsBitmapFormat format, fsBitmapFormatMask fmask, FontBitmapFormatPtr bmfmt) { @@ -3907,9 +3907,9 @@ static FontRendererRec alt_renderers[] = { FreeTypeGetInfoScalable, 0, CAPABILITIES}, }; -static int num_alt_renderers = +static int num_alt_renderers = sizeof(alt_renderers) / sizeof(alt_renderers[0]); - + void FreeTypeRegisterFontFileFunctions(void) diff --git a/src/FreeType/ftfuncs.h b/src/FreeType/ftfuncs.h index 068a595..6545dfa 100644 --- a/src/FreeType/ftfuncs.h +++ b/src/FreeType/ftfuncs.h @@ -158,7 +158,7 @@ typedef struct _FTFont{ static int FreeTypeOpenFace(FTFacePtr *facep, char *FTFileName, char *realFileName, int faceNumber); static void FreeTypeFreeFace(FTFacePtr face); -static int +static int FreeTypeOpenInstance(FTInstancePtr *instancep, FTFacePtr face, char *FTFileName, FTNormalisedTransformationPtr trans, int spacing, FontBitmapFormatPtr bmfmt, @@ -169,20 +169,20 @@ FreeTypeInstanceGetGlyph(unsigned idx, int flags, CharInfoPtr *g, FTInstancePtr static int FreeTypeInstanceGetGlyphMetrics(unsigned idx, int flags, xCharInfo **metrics, FTInstancePtr instance ); -static int -FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, +static int +FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, FTInstancePtr instance, int hasMetrics ); static void FreeTypeFreeFont(FTFontPtr font); static void FreeTypeFreeXFont(FontPtr pFont, int freeProps); static void FreeTypeUnloadXFont(FontPtr pFont); static int -FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, +FreeTypeAddProperties(FTFontPtr font, FontScalablePtr vals, FontInfoPtr info, char *fontname, int rawAverageWidth, Bool font_properties); static int FreeTypeFontGetGlyph(unsigned code, int flags, CharInfoPtr *g, FTFontPtr font); static int FreeTypeLoadFont(FTFontPtr font, FontInfoPtr info, FTFacePtr face, char *FTFileName, FontScalablePtr vals, FontEntryPtr entry, - FontBitmapFormatPtr bmfmt, FT_Int32 load_flags, + FontBitmapFormatPtr bmfmt, FT_Int32 load_flags, struct TTCapInfo *tmp_ttcap, char *dynStrTTCapCodeRange, int ttcap_spacing ); diff --git a/src/FreeType/fttools.c b/src/FreeType/fttools.c index bc75b7e..8c5d08e 100644 --- a/src/FreeType/fttools.c +++ b/src/FreeType/fttools.c @@ -112,17 +112,17 @@ FTGetName(FT_Face face, int nid, int pid, int eid, FT_SfntName *name_return) return 0; } -int +int FTGetEnglishName(FT_Face face, int nid, char *name_return, int name_len) { FT_SfntName name; int len; - if(FTGetName(face, nid, + if(FTGetName(face, nid, TT_PLATFORM_MICROSOFT, TT_MS_ID_UNICODE_CS, &name) || - FTGetName(face, nid, + FTGetName(face, nid, TT_PLATFORM_APPLE_UNICODE, -1, &name)) - return FTu2a(name.string_len, name.string, name_return, + return FTu2a(name.string_len, name.string, name_return, MSBFirst, name_len); /* Pretend that Apple Roman is ISO 8859-1. */ diff --git a/src/FreeType/xttcap.c b/src/FreeType/xttcap.c index c2a4120..bf25cc5 100644 --- a/src/FreeType/xttcap.c +++ b/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 +582,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 +605,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 +646,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 +654,7 @@ SPropRecValList_add_by_font_cap(SDynPropRecValList *pThisList, value++; } else value = &duplicated[nextColon-strCapHead]; - + for (i=0; i 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; @@ -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++; @@ -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; @@ -816,7 +816,7 @@ bdfReadFont(FontPtr pFont, FontFilePtr file, bdfError("Couldn't allocate bitmapExtra (%d)\n", sizeof(BitmapExtraRec)); goto BAILOUT; } - + bitmapFont->bitmapExtra->glyphNames = 0; bitmapFont->bitmapExtra->sWidths = 0; @@ -836,7 +836,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 +859,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 +924,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/src/bitmap/bdfutils.c b/src/bitmap/bdfutils.c index 1d6cc72..a0106b7 100644 --- a/src/bitmap/bdfutils.c +++ b/src/bitmap/bdfutils.c @@ -276,7 +276,7 @@ static char *SpecialAtoms[] = { }; Bool -bdfSpecialProperty(FontPtr pFont, FontPropPtr prop, +bdfSpecialProperty(FontPtr pFont, FontPropPtr prop, char isString, bdfFileState *bdfState) { char **special; diff --git a/src/bitmap/bitmap.c b/src/bitmap/bitmap.c index 1ceb4bb..9b20faf 100644 --- a/src/bitmap/bitmap.c +++ b/src/bitmap/bitmap.c @@ -36,8 +36,8 @@ in this Software without prior written authorization from The Open Group. #include int -bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, - FontEncoding charEncoding, +bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, + FontEncoding charEncoding, unsigned long *glyphCount, /* RETURN */ CharInfoPtr *glyphs) /* RETURN */ { @@ -126,8 +126,8 @@ bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, static CharInfoRec nonExistantChar; int -bitmapGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars, - FontEncoding charEncoding, +bitmapGetMetrics(FontPtr pFont, unsigned long count, unsigned char *chars, + FontEncoding charEncoding, unsigned long *glyphCount, /* RETURN */ xCharInfo **glyphs) /* RETURN */ { diff --git a/src/bitmap/bitmapfunc.c b/src/bitmap/bitmapfunc.c index 47ce488..603d5d9 100644 --- a/src/bitmap/bitmapfunc.c +++ b/src/bitmap/bitmapfunc.c @@ -56,10 +56,10 @@ in this Software without prior written authorization from The Open Group. #include "snfstr.h" typedef struct _BitmapFileFunctions { - int (*ReadFont) (FontPtr /* pFont */, FontFilePtr /* file */, - int /* bit */, int /* byte */, + int (*ReadFont) (FontPtr /* pFont */, FontFilePtr /* file */, + int /* bit */, int /* byte */, int /* glyph */, int /* scan */); - int (*ReadInfo) ( FontInfoPtr /* pFontInfo */, + int (*ReadInfo) ( FontInfoPtr /* pFontInfo */, FontFilePtr /* file */ ); } BitmapFileFunctionsRec, *BitmapFileFunctionsPtr; @@ -107,8 +107,8 @@ static BitmapFileFunctionsRec readers[] = { #define CAPABILITIES (CAP_MATRIX | CAP_CHARSUBSETTING) static int -BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags, - FontEntryPtr entry, char *fileName, +BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags, + FontEntryPtr entry, char *fileName, fsBitmapFormat format, fsBitmapFormatMask fmask, FontPtr non_cachable_font) /* We don't do licensing */ { @@ -152,7 +152,7 @@ BitmapOpenBitmap (FontPathElementPtr fpe, FontPtr *ppFont, int flags, } static int -BitmapGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, +BitmapGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, FontEntryPtr entry, char *fileName) { FontFilePtr file; diff --git a/src/bitmap/bitscale.c b/src/bitmap/bitscale.c index 50818c6..b857237 100644 --- a/src/bitmap/bitscale.c +++ b/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 { @@ -83,12 +83,12 @@ typedef struct _fontProp { 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/src/bitmap/fontink.c b/src/bitmap/fontink.c index ad7091f..f4898da 100644 --- a/src/bitmap/fontink.c +++ b/src/bitmap/fontink.c @@ -98,7 +98,7 @@ FontCharInkMetrics(FontPtr pFont, CharInfoPtr pCI, xCharInfo *pInk) found_ascent: pInk->ascent = vpos - descent + 1; - p = ((unsigned char *) pCI->bits) + bitmapByteWidthPadded * + p = ((unsigned char *) pCI->bits) + bitmapByteWidthPadded * (descent + ascent - 1) + bitmapByteWidth; for (vpos = descent + ascent; --vpos >= 0;) { diff --git a/src/bitmap/pcfread.c b/src/bitmap/pcfread.c index 32f9856..92b6348 100644 --- a/src/bitmap/pcfread.c +++ b/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 ); @@ -197,7 +197,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 +228,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; @@ -274,7 +274,7 @@ pcfGetProperties(FontInfoPtr pFontInfo, FontFilePtr file, 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", @@ -334,7 +334,7 @@ Bail: */ static Bool -pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file, +pcfGetAccel(FontInfoPtr pFontInfo, FontFilePtr file, PCFTablePtr tables, int ntables, CARD32 type) { CARD32 format; @@ -345,7 +345,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 +382,7 @@ Bail: } int -pcfReadFont(FontPtr pFont, FontFilePtr file, +pcfReadFont(FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan) { CARD32 format; @@ -454,7 +454,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)) @@ -482,7 +482,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); @@ -559,7 +559,7 @@ pcfReadFont(FontPtr pFont, FontFilePtr file, /* 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)); + pcfError("pcfReadFont(): Couldn't allocate ink_metrics (%d*%d)\n", nink_metrics, sizeof(xCharInfo)); goto Bail; } for (i = 0; i < nink_metrics; i++) @@ -595,10 +595,10 @@ 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, sizeof(CharInfoPtr)); goto Bail; } - + pFont->info.allExist = TRUE; for (i = 0; i < nencoding; i++) { encodingOffset = pcfGetINT16(file, format); diff --git a/src/bitmap/pcfwrite.c b/src/bitmap/pcfwrite.c index 3ac07b3..b4abff4 100644 --- a/src/bitmap/pcfwrite.c +++ b/src/bitmap/pcfwrite.c @@ -430,8 +430,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/src/bitmap/snfread.c b/src/bitmap/snfread.c index d003cc5..2f51c48 100644 --- a/src/bitmap/snfread.c +++ b/src/bitmap/snfread.c @@ -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); diff --git a/src/bitmap/snfstr.h b/src/bitmap/snfstr.h index 148bb1f..8f39ded 100644 --- a/src/bitmap/snfstr.h +++ b/src/bitmap/snfstr.h @@ -175,7 +175,7 @@ typedef struct _snfFontInfo { } snfFontInfoRec; extern void SnfSetFormat ( int bit, int byte, int glyph, int scan ); -extern int snfReadFont ( FontPtr pFont, FontFilePtr file, +extern int snfReadFont ( FontPtr pFont, FontFilePtr file, int bit, int byte, int glyph, int scan ); extern int snfReadFontInfo ( FontInfoPtr pFontInfo, FontFilePtr file ); diff --git a/src/builtins/buildfont b/src/builtins/buildfont index aa4602f..84c68c4 100644 --- a/src/builtins/buildfont +++ b/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/src/builtins/builtin.h b/src/builtins/builtin.h index 418bfe9..d97d9a5 100644 --- a/src/builtins/builtin.h +++ b/src/builtins/builtin.h @@ -16,7 +16,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. diff --git a/src/builtins/dir.c b/src/builtins/dir.c index bf351b1..490e7e3 100644 --- a/src/builtins/dir.c +++ b/src/builtins/dir.c @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. @@ -194,7 +194,7 @@ BuiltinReadDirectory (char *directory, FontDirectoryPtr *pdir) } for (i = 0; i < builtin_alias_count; i++) { - if (!FontFileAddFontAlias (dir, + if (!FontFileAddFontAlias (dir, (char *) builtin_alias[i].alias_name, (char *) builtin_alias[i].font_name)) { diff --git a/src/builtins/file.c b/src/builtins/file.c index 5492539..3f657d9 100644 --- a/src/builtins/file.c +++ b/src/builtins/file.c @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. @@ -83,7 +83,7 @@ static int BuiltinClose (BufFilePtr f, int unused) { BuiltinIOPtr io = ((BuiltinIOPtr) f->private); - + free (io); return 1; } diff --git a/src/builtins/fonts.c b/src/builtins/fonts.c index 9a9d7d2..3892178 100644 --- a/src/builtins/fonts.c +++ b/src/builtins/fonts.c @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. diff --git a/src/builtins/fpe.c b/src/builtins/fpe.c index 403dbb7..83905da 100644 --- a/src/builtins/fpe.c +++ b/src/builtins/fpe.c @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. diff --git a/src/builtins/render.c b/src/builtins/render.c index 4d10483..2be0053 100644 --- a/src/builtins/render.c +++ b/src/builtins/render.c @@ -15,7 +15,7 @@ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Keith Packard, SuSE, Inc. diff --git a/src/fc/fsconvert.c b/src/fc/fsconvert.c index 15c5e42..faf2e5d 100644 --- a/src/fc/fsconvert.c +++ b/src/fc/fsconvert.c @@ -86,7 +86,7 @@ _fs_init_fontinfo(FSFpePtr conn, FontInfoPtr pfi) } int -_fs_convert_props(fsPropInfo *pi, fsPropOffset *po, pointer pd, +_fs_convert_props(fsPropInfo *pi, fsPropOffset *po, pointer pd, FontInfoPtr pfi) { FontPropPtr dprop; @@ -102,20 +102,20 @@ _fs_convert_props(fsPropInfo *pi, fsPropOffset *po, pointer pd, nprops = pfi->nprops = pi->num_offsets; - if (nprops < 0 - || nprops > SIZE_MAX/(sizeof(FontPropRec) + sizeof(char))) + if (nprops < 0 + || nprops > SIZE_MAX/(sizeof(FontPropRec) + sizeof(char))) return -1; - + dprop = malloc(sizeof(FontPropRec) * nprops + sizeof (char) * nprops); if (!dprop) return -1; - + is_str = (char *) (dprop + nprops); pfi->props = dprop; pfi->isStringProp = is_str; off_adr = (char *)po; - for (i = 0; i < nprops; i++, dprop++, is_str++) + for (i = 0; i < nprops; i++, dprop++, is_str++) { memcpy(&local_off, off_adr, SIZEOF(fsPropOffset)); dprop->name = MakeAtom(&pdc[local_off.name.position], @@ -154,8 +154,8 @@ _fs_free_props (FontInfoPtr pfi) } int -_fs_convert_lfwi_reply(FSFpePtr conn, FontInfoPtr pfi, - fsListFontsWithXInfoReply *fsrep, +_fs_convert_lfwi_reply(FSFpePtr conn, FontInfoPtr pfi, + fsListFontsWithXInfoReply *fsrep, fsPropInfo *pi, fsPropOffset *po, pointer pd) { fsUnpack_XFontInfoHeader(fsrep, pfi); @@ -188,8 +188,8 @@ _fs_convert_lfwi_reply(FSFpePtr conn, FontInfoPtr pfi, */ /* ARGSUSED */ int -fs_build_range(FontPtr pfont, Bool range_flag, unsigned int count, - int item_size, unsigned char *data, int *nranges, +fs_build_range(FontPtr pfont, Bool range_flag, unsigned int count, + int item_size, unsigned char *data, int *nranges, fsRange **ranges) { FSFontDataPtr fsd = (FSFontDataPtr) (pfont->fpePrivate); @@ -350,7 +350,7 @@ fs_build_range(FontPtr pfont, Bool range_flag, unsigned int count, requests needs to be cancelled. */ void -_fs_clean_aborted_loadglyphs(FontPtr pfont, int num_expected_ranges, +_fs_clean_aborted_loadglyphs(FontPtr pfont, int num_expected_ranges, fsRange *expected_ranges) { register FSFontPtr fsfont; @@ -396,8 +396,8 @@ _fs_clean_aborted_loadglyphs(FontPtr pfont, int num_expected_ranges, } static int -_fs_get_glyphs(FontPtr pFont, unsigned long count, unsigned char *chars, - FontEncoding charEncoding, +_fs_get_glyphs(FontPtr pFont, unsigned long count, unsigned char *chars, + FontEncoding charEncoding, unsigned long *glyphCount, /* RETURN */ CharInfoPtr *glyphs) /* RETURN */ { @@ -508,8 +508,8 @@ _fs_get_glyphs(FontPtr pFont, unsigned long count, unsigned char *chars, static int -_fs_get_metrics(FontPtr pFont, unsigned long count, unsigned char *chars, - FontEncoding charEncoding, +_fs_get_metrics(FontPtr pFont, unsigned long count, unsigned char *chars, + FontEncoding charEncoding, unsigned long *glyphCount, /* RETURN */ xCharInfo **glyphs) /* RETURN */ { @@ -620,15 +620,15 @@ _fs_unload_font(FontPtr pfont) fsdata->glyphs = glyphs->next; free (glyphs); } - + /* XXX we may get called after the resource DB has been cleaned out */ if (find_old_font(fsd->fontid)) DeleteFontClientID (fsd->fontid); - + _fs_free_props (&pfont->info); - + free(fsdata); - + DestroyFontRec(pfont); } @@ -656,11 +656,11 @@ fs_create_font (FontPathElementPtr fpe, fsd = (FSFontDataPtr) (fsfont + 1); bzero((char *) fsfont, sizeof(FSFontRec)); bzero((char *) fsd, sizeof(FSFontDataRec)); - + pfont->fpe = fpe; pfont->fontPrivate = (pointer) fsfont; pfont->fpePrivate = (pointer) fsd; - + /* These font components will be needed in packGlyphs */ CheckFSFormat(format, BitmapFormatMaskBit | BitmapFormatMaskByte | @@ -676,17 +676,17 @@ fs_create_font (FontPathElementPtr fpe, pfont->byte = byte; pfont->scan = scan; pfont->glyph = glyph; - + pfont->info.nprops = 0; pfont->info.props = 0; pfont->info.isStringProp = 0; - + /* set font function pointers */ pfont->get_glyphs = _fs_get_glyphs; pfont->get_metrics = _fs_get_metrics; pfont->unload_font = _fs_unload_font; pfont->unload_glyphs = NULL; - + /* set the FPE private information */ fsd->format = format; fsd->fmask = fmask; @@ -694,9 +694,9 @@ fs_create_font (FontPathElementPtr fpe, memcpy (fsd->name, name, namelen); fsd->name[namelen] = '\0'; fsd->fontid = GetNewFontClientID (); - + /* save the ID */ - if (!StoreFontClientFont(pfont, fsd->fontid)) + if (!StoreFontClientFont(pfont, fsd->fontid)) { free (fsfont); DestroyFontRec (pfont); diff --git a/src/fc/fserve.c b/src/fc/fserve.c index b02b0b7..a445144 100644 --- a/src/fc/fserve.c +++ b/src/fc/fserve.c @@ -84,7 +84,7 @@ in this Software without prior written authorization from The Open Group. #define MIN(a,b) ((a)<(b)?(a):(b)) #endif #define TimeCmp(a,c,b) ((int) ((a) - (b)) c 0) - + #define NONZEROMETRICS(pci) ((pci)->leftSideBearing || \ (pci)->rightSideBearing || \ (pci)->ascent || \ @@ -95,17 +95,17 @@ extern void ErrorF(const char *f, ...); static int fs_read_glyphs ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); static int fs_read_list ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); -static int fs_read_list_info ( FontPathElementPtr fpe, +static int fs_read_list_info ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); extern fd_set _fs_fd_mask; -static void fs_block_handler ( pointer data, OSTimePtr wt, +static void fs_block_handler ( pointer data, OSTimePtr wt, pointer LastSelectMask ); static int fs_wakeup ( FontPathElementPtr fpe, unsigned long *mask ); /* - * List of all FPEs + * List of all FPEs */ static FSFpePtr fs_fpes; /* @@ -114,7 +114,7 @@ static FSFpePtr fs_fpes; static CARD32 fs_blockState; static int _fs_restart_connection ( FSFpePtr conn ); -static void fs_send_query_bitmaps ( FontPathElementPtr fpe, +static void fs_send_query_bitmaps ( FontPathElementPtr fpe, FSBlockDataPtr blockrec ); static int fs_send_close_font ( FontPathElementPtr fpe, Font id ); static void fs_client_died ( pointer client, FontPathElementPtr fpe ); @@ -240,7 +240,7 @@ _fs_client_resolution(FSFpePtr conn) } } -/* +/* * close font server and remove any state associated with * this connection - this includes any client records. */ @@ -251,8 +251,8 @@ fs_close_conn(FSFpePtr conn) FSClientPtr client, nclient; _fs_close_server (conn); - - for (client = conn->clients; client; client = nclient) + + for (client = conn->clients; client; client = nclient) { nclient = client->next; free (client); @@ -308,7 +308,7 @@ fs_init_fpe(FontPathElementPtr fpe) err = Successful; } } - + if (err == Successful) { #ifdef NCD @@ -348,7 +348,7 @@ static int fs_free_fpe(FontPathElementPtr fpe) { FSFpePtr conn = (FSFpePtr) fpe->private, *prev; - + /* unhook from chain of all font servers */ for (prev = &fs_fpes; *prev; prev = &(*prev)->next) { @@ -410,7 +410,7 @@ fs_new_block_rec(FontPathElementPtr fpe, pointer client, int type) blockrec->type = type; blockrec->depending = 0; blockrec->next = (FSBlockDataPtr) 0; - + /* stick it on the end of the list (since its expected last) */ for (prev = &conn->blockedRequests; *prev; prev = &(*prev)->next) ; @@ -423,7 +423,7 @@ static void _fs_set_pending_reply (FSFpePtr conn) { FSBlockDataPtr blockrec; - + for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) if (blockrec->errcode == StillWorking) break; @@ -442,7 +442,7 @@ _fs_remove_block_rec(FSFpePtr conn, FSBlockDataPtr blockrec) FSBlockDataPtr *prev; for (prev = &conn->blockedRequests; *prev; prev = &(*prev)->next) - if (*prev == blockrec) + if (*prev == blockrec) { *prev = blockrec->next; break; @@ -461,7 +461,7 @@ static void _fs_signal_clients_depending(FSClientsDependingPtr *clients_depending) { FSClientsDependingPtr p; - + while ((p = *clients_depending)) { *clients_depending = p->next; @@ -474,14 +474,14 @@ static int _fs_add_clients_depending(FSClientsDependingPtr *clients_depending, pointer client) { FSClientsDependingPtr new, cd; - - for (; (cd = *clients_depending); + + for (; (cd = *clients_depending); clients_depending = &(*clients_depending)->next) { - if (cd->client == client) + if (cd->client == client) return Suspended; } - + new = malloc (sizeof (FSClientsDependingRec)); if (!new) return BadAlloc; @@ -503,17 +503,17 @@ _fs_clean_aborted_blockrec(FSFpePtr conn, FSBlockDataPtr blockrec) switch(blockrec->type) { case FS_OPEN_FONT: { FSBlockedFontPtr bfont = (FSBlockedFontPtr)blockrec->data; - + fs_cleanup_bfont (bfont); _fs_signal_clients_depending(&bfont->clients_depending); break; } case FS_LOAD_GLYPHS: { FSBlockedGlyphPtr bglyph = (FSBlockedGlyphPtr)blockrec->data; - + _fs_clean_aborted_loadglyphs(bglyph->pfont, bglyph->num_expected_ranges, - bglyph->expected_ranges); + bglyph->expected_ranges); _fs_signal_clients_depending(&bglyph->clients_depending); break; } @@ -550,12 +550,12 @@ fs_cleanup_bfont (FSBlockedFontPtr bfont) if (bfont->pfont) { fsd = (FSFontDataRec *) bfont->pfont->fpePrivate; - + /* make sure the FS knows we choked on it */ fs_send_close_font(bfont->pfont->fpe, bfont->fontid); - + /* - * Either unload the font if it's being opened for + * Either unload the font if it's being opened for * the first time, or smash the generation field to * mark this font as an orphan */ @@ -590,14 +590,14 @@ fs_get_reply (FSFpePtr conn, int *error) *error = FSIO_BLOCK; return 0; } - + ret = _fs_start_read (conn, sizeof (fsGenericReply), &buf); if (ret != FSIO_READY) { *error = FSIO_BLOCK; return 0; } - + rep = (fsGenericReply *) buf; ret = _fs_start_read (conn, rep->length << 2, &buf); @@ -608,7 +608,7 @@ fs_get_reply (FSFpePtr conn, int *error) } *error = FSIO_READY; - + return (fsGenericReply *) buf; } @@ -616,7 +616,7 @@ static Bool fs_reply_ready (FSFpePtr conn) { fsGenericReply *rep; - + if (conn->fs_fd == -1 || !FD_ISSET (conn->fs_fd, &_fs_fd_mask)) return FALSE; if (fs_data_read (conn) < sizeof (fsGenericReply)) @@ -651,10 +651,10 @@ static int fs_await_reply (FSFpePtr conn) { int ret; - + if (conn->blockState & FS_COMPLETE_REPLY) return FSIO_READY; - + while (!fs_get_reply (conn, &ret)) { if (ret != FSIO_BLOCK) @@ -691,7 +691,7 @@ fs_read_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) fs_cleanup_bfont (bfont); return BadFontName; } - + /* If we're not reopening a font and FS detected a duplicate font open request, replace our reference to the new font with a reference to an existing font (possibly one not finished @@ -701,10 +701,10 @@ fs_read_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) if we we decide (in fs_read_query_info()) that we don't like what we got. */ - if (rep->otherid && !(bfont->flags & FontReopen)) + if (rep->otherid && !(bfont->flags & FontReopen)) { fs_cleanup_bfont (bfont); - + /* Find old font if we're completely done getting it from server. */ bfont->pfont = find_old_font(rep->otherid); bfont->freeFont = FALSE; @@ -715,12 +715,12 @@ fs_read_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) */ for (blockOrig = conn->blockedRequests; blockOrig; - blockOrig = blockOrig->next) + blockOrig = blockOrig->next) { - if (blockOrig != blockrec && blockOrig->type == FS_OPEN_FONT) + if (blockOrig != blockrec && blockOrig->type == FS_OPEN_FONT) { origBfont = (FSBlockedFontPtr) blockOrig->data; - if (origBfont->fontid == rep->otherid) + if (origBfont->fontid == rep->otherid) { blockrec->depending = blockOrig->depending; blockOrig->depending = blockrec; @@ -757,7 +757,7 @@ static Bool fs_fonts_match (FontInfoPtr pInfo1, FontInfoPtr pInfo2) { int i; - + if (pInfo1->firstCol != pInfo2->firstCol || pInfo1->lastCol != pInfo2->lastCol || pInfo1->firstRow != pInfo2->firstRow || @@ -833,7 +833,7 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) fs_cleanup_bfont (bfont); return BadFontName; } - + /* If this is a reopen, accumulate the query info into a dummy font and compare to our original data. */ if (bfont->flags & FontReopen) @@ -843,27 +843,27 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) buf = (char *) rep; buf += SIZEOF(fsQueryXInfoReply); - + /* move the data over */ fsUnpack_XFontInfoHeader(rep, pInfo); - + /* compute accelerators */ _fs_init_fontinfo(conn, pInfo); /* Compute offsets into the reply */ pi = (fsPropInfo *) buf; buf += SIZEOF (fsPropInfo); - + po = (fsPropOffset *) buf; buf += pi->num_offsets * SIZEOF(fsPropOffset); pd = (pointer) buf; buf += pi->data_len; - + /* convert the properties and step over the reply */ ret = _fs_convert_props(pi, po, pd, pInfo); _fs_done_read (conn, rep->length << 2); - + if (ret == -1) { fs_cleanup_bfont (bfont); @@ -889,7 +889,7 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) err = BadFontName; } _fs_free_props (pInfo); - + return err; } @@ -904,14 +904,14 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) * Figure out if the whole font should get loaded right now. */ if (glyphCachingMode == CACHING_OFF || - (glyphCachingMode == CACHE_16_BIT_GLYPHS + (glyphCachingMode == CACHE_16_BIT_GLYPHS && !bfont->pfont->info.lastRow)) { bfont->flags |= FontLoadAll; } - + /* - * Ready to send the query bitmaps; the terminal font bit has + * Ready to send the query bitmaps; the terminal font bit has * been computed and glyphCaching has been considered */ if (bfont->flags & FontLoadBitmaps) @@ -927,7 +927,7 @@ fs_read_query_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) */ blockrec->sequenceNumber = bfont->queryExtentsSequence; conn->blockedReplyTime = GetTimeInMillis () + FontServerRequestTimeout; - + return StillWorking; } @@ -960,7 +960,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) fs_cleanup_bfont (bfont); return BadFontName; } - + /* move the data over */ /* need separate inkMetrics for fixed font server protocol version */ numExtents = rep->num_extents; @@ -972,7 +972,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } ci = pCI = malloc(sizeof(CharInfoRec) * numInfos); - if (!pCI) + if (!pCI) { _fs_done_read (conn, rep->length << 2); fs_cleanup_bfont(bfont); @@ -987,10 +987,10 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) buf = (char *) rep; buf += SIZEOF (fsQueryXExtents16Reply); fsci = buf; - + fsd->glyphs_to_get = 0; ci = fsfont->inkMetrics; - for (i = 0; i < numExtents; i++) + for (i = 0; i < numExtents; i++) { memcpy(&fscilocal, fsci, SIZEOF(fsXCharInfo)); /* align it */ _fs_convert_char_info(&fscilocal, &ci->metrics); @@ -1030,7 +1030,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) /* Done with reply */ _fs_done_read (conn, rep->length << 2); - + /* build bitmap metrics, ImageRectMax style */ if (haveInk) { @@ -1098,7 +1098,7 @@ fs_read_extent_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } bfont->state = FS_GLYPHS_REPLY; - if (bfont->flags & FontLoadBitmaps) + if (bfont->flags & FontLoadBitmaps) { /* * Reset the blockrec for the next reply @@ -1129,7 +1129,7 @@ fs_do_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) #ifdef DEBUG fprintf (stderr, "fs_do_open_font state %s %s\n", - fs_open_states[bfont->state], + fs_open_states[bfont->state], ((FSFontDataPtr) (bfont->pfont->fpePrivate))->name); #endif err = BadFontName; @@ -1165,10 +1165,10 @@ fs_do_open_font(FontPathElementPtr fpe, FSBlockDataPtr blockrec) #ifdef DEBUG fprintf (stderr, "fs_do_open_font err %d\n", err); #endif - if (err != StillWorking) + if (err != StillWorking) { bfont->state = FS_DONE_REPLY; /* for _fs_load_glyphs() */ - while ((blockrec = blockrec->depending)) + while ((blockrec = blockrec->depending)) { bfont = (FSBlockedFontPtr) blockrec->data; bfont->state = FS_DONE_REPLY; /* for _fs_load_glyphs() */ @@ -1188,7 +1188,7 @@ void _fs_unmark_block (FSFpePtr conn, CARD32 mask) { FSFpePtr c; - + if (conn->blockState & mask) { conn->blockState &= ~mask; @@ -1207,7 +1207,7 @@ fs_block_handler(pointer data, OSTimePtr wt, pointer LastSelectMask) int soonest; FSFpePtr conn; - XFD_ORSET((fd_set *)LastSelectMask, (fd_set *)LastSelectMask, + XFD_ORSET((fd_set *)LastSelectMask, (fd_set *)LastSelectMask, &_fs_fd_mask); /* * Flush all pending output @@ -1280,7 +1280,7 @@ fs_block_handler(pointer data, OSTimePtr wt, pointer LastSelectMask) static void fs_handle_unexpected(FSFpePtr conn, fsGenericReply *rep) { - if (rep->type == FS_Event && rep->data1 == KeepAlive) + if (rep->type == FS_Event && rep->data1 == KeepAlive) { fsNoopReq req; @@ -1302,27 +1302,27 @@ fs_read_reply (FontPathElementPtr fpe, pointer client) int ret; int err; fsGenericReply *rep; - + if ((rep = fs_get_reply (conn, &ret))) { _fs_add_rep_log (conn, rep); - for (blockrec = conn->blockedRequests; - blockrec; - blockrec = blockrec->next) + for (blockrec = conn->blockedRequests; + blockrec; + blockrec = blockrec->next) { if (blockrec->sequenceNumber == rep->sequenceNumber) break; } err = Successful; - if (!blockrec) + if (!blockrec) { fs_handle_unexpected(conn, rep); } else { - /* - * go read it, and if we're done, - * wake up the appropriate client + /* + * go read it, and if we're done, + * wake up the appropriate client */ switch (blockrec->type) { case FS_OPEN_FONT: @@ -1343,7 +1343,7 @@ fs_read_reply (FontPathElementPtr fpe, pointer client) err = blockrec->errcode; if (err != StillWorking) { - while (blockrec) + while (blockrec) { blockrec->errcode = err; if (client != blockrec->client) @@ -1366,7 +1366,7 @@ fs_wakeup(FontPathElementPtr fpe, unsigned long *mask) fd_set *LastSelectMask = (fd_set *) mask; FSFpePtr conn = (FSFpePtr) fpe->private; - /* + /* * Don't continue if the fd is -1 (which will be true when the * font server terminates */ @@ -1400,7 +1400,7 @@ fs_wakeup(FontPathElementPtr fpe, unsigned long *mask) blockrec->errcode, blockrec->sequenceNumber, fs_open_states[bfont->state], - bfont->pfont ? + bfont->pfont ? ((FSFontDataPtr) (bfont->pfont->fpePrivate))->name : ""); break; @@ -1418,7 +1418,7 @@ fs_wakeup(FontPathElementPtr fpe, unsigned long *mask) } } } -#endif +#endif return FALSE; } @@ -1446,7 +1446,7 @@ _fs_restart_connection(FSFpePtr conn) FSBlockDataPtr block; _fs_unmark_block (conn, FS_GIVE_UP); - while ((block = (FSBlockDataPtr) conn->blockedRequests)) + while ((block = (FSBlockDataPtr) conn->blockedRequests)) { if (block->errcode == StillWorking) { @@ -1471,7 +1471,7 @@ _fs_giveup (FSFpePtr conn) fprintf (stderr, "give up on FS \"%s\"\n", conn->servername); #endif _fs_mark_block (conn, FS_GIVE_UP); - while ((block = (FSBlockDataPtr) conn->blockedRequests)) + while ((block = (FSBlockDataPtr) conn->blockedRequests)) { if (block->errcode == StillWorking) { @@ -1494,7 +1494,7 @@ _fs_do_blocked (FSFpePtr conn) { _fs_giveup (conn); } - else + else { if (conn->blockState & FS_BROKEN_CONNECTION) { @@ -1516,9 +1516,9 @@ _fs_do_blocked (FSFpePtr conn) */ /* ARGSUSED */ static int -fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, +fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, + fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *ppfont) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -1534,10 +1534,10 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, if (conn->blockState & FS_GIVE_UP) return BadFontName; - + if (namelen <= 0 || namelen > sizeof (buf) - 1) return BadFontName; - + /* * Get the font structure put together, either by reusing * the existing one or creating a new one @@ -1574,10 +1574,10 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, font = fs_create_font (fpe, name, namelen, format, fmask); if (!font) return AllocError; - + fsd = (FSFontDataPtr)font->fpePrivate; } - + /* make a new block record, and add it to the end of the list */ blockrec = fs_new_block_rec(font->fpe, client, FS_OPEN_FONT); if (!blockrec) @@ -1586,7 +1586,7 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, (*font->unload_font) (font); return AllocError; } - + /* * Must check this before generating any protocol, otherwise we'll * mess up a reconnect in progress @@ -1596,7 +1596,7 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, _fs_pending_reply (conn); return Suspended; } - + fsd->generation = conn->generation; bfont = (FSBlockedFontPtr) blockrec->data; @@ -1626,17 +1626,17 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, _fs_write_pad(conn, (char *) buf, namelen + 1); blockrec->sequenceNumber = conn->current_seq; - + inforeq.reqType = FS_QueryXInfo; inforeq.pad = 0; inforeq.id = fsd->fontid; inforeq.length = SIZEOF(fsQueryXInfoReq) >> 2; bfont->queryInfoSequence = conn->current_seq + 1; - + _fs_add_req_log(conn, FS_QueryXInfo); _fs_write(conn, (char *) &inforeq, SIZEOF(fsQueryXInfoReq)); - + if (!(bfont->flags & FontReopen)) { extreq.reqType = FS_QueryXExtents16; @@ -1644,15 +1644,15 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, extreq.fid = fsd->fontid; extreq.num_ranges = 0; extreq.length = SIZEOF(fsQueryXExtents16Req) >> 2; - + bfont->queryExtentsSequence = conn->current_seq + 1; - + _fs_add_req_log(conn, FS_QueryXExtents16); _fs_write(conn, (char *) &extreq, SIZEOF(fsQueryXExtents16Req)); } - + #ifdef NCD - if (configData.ExtendedFontDiags) + if (configData.ExtendedFontDiags) { memcpy(buf, name, MIN(256, namelen)); buf[MIN(256, namelen)] = '\0'; @@ -1661,7 +1661,7 @@ fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, } #endif _fs_prepare_for_reply (conn); - + err = blockrec->errcode; if (bfont->flags & FontOpenSync) { @@ -1701,16 +1701,16 @@ fs_send_query_bitmaps(FontPathElementPtr fpe, FSBlockDataPtr blockrec) bitreq.num_ranges = 0; bfont->queryBitmapsSequence = conn->current_seq + 1; - + _fs_add_req_log(conn, FS_QueryXBitmaps16); _fs_write(conn, (char *) &bitreq, SIZEOF(fsQueryXBitmaps16Req)); } /* ARGSUSED */ static int -fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, - fsBitmapFormat format, fsBitmapFormatMask fmask, +fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, + fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *ppfont, char **alias, FontPtr non_cachable_font) { @@ -1725,12 +1725,12 @@ fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, *alias = (char *) 0; for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) { - if (blockrec->type == FS_OPEN_FONT && blockrec->client == client) + if (blockrec->type == FS_OPEN_FONT && blockrec->client == client) { err = blockrec->errcode; if (err == StillWorking) return Suspended; - + bfont = (FSBlockedFontPtr) blockrec->data; if (err == Successful) *ppfont = bfont->pfont; @@ -1871,21 +1871,21 @@ fs_read_glyphs(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } off_adr = (char *)ppbits; - + allbits = fs_alloc_glyphs (pfont, rep->nbytes); - + if (!allbits) { err = AllocError; goto bail; } - + #ifdef DEBUG origallbits = allbits; fprintf (stderr, "Reading %d glyphs in %d bytes for %s\n", (int) rep->num_chars, (int) rep->nbytes, fsd->name); #endif - + for (i = 0; i < rep->num_chars; i++) { memcpy(&local_off, off_adr, SIZEOF(fsOffset32)); /* align it */ @@ -1945,7 +1945,7 @@ bail: } static int -fs_send_load_glyphs(pointer client, FontPtr pfont, +fs_send_load_glyphs(pointer client, FontPtr pfont, int nranges, fsRange *ranges) { FontPathElementPtr fpe = pfont->fpe; @@ -1956,7 +1956,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, if (conn->blockState & FS_GIVE_UP) return BadCharRange; - + /* make a new block record, and add it to the end of the list */ blockrec = fs_new_block_rec(fpe, client, FS_LOAD_GLYPHS); if (!blockrec) @@ -1973,7 +1973,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, _fs_pending_reply (conn); return Suspended; } - + /* send the request */ req.reqType = FS_QueryXBitmaps16; req.fid = ((FSFontDataPtr) pfont->fpePrivate)->fontid; @@ -1989,7 +1989,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, _fs_write(conn, (char *) &req, SIZEOF(fsQueryXBitmaps16Req)); blockrec->sequenceNumber = conn->current_seq; - + /* Send ranges to the server... pack into a char array by hand to avoid structure-packing portability problems and to handle swapping for version1 protocol */ @@ -2039,7 +2039,7 @@ extern pointer serverClient; /* This could be any number that client values. */ static int -_fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, +_fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, unsigned int nchars, int item_size, unsigned char *data) { FSFpePtr conn = (FSFpePtr) pfont->fpe->private; @@ -2095,7 +2095,7 @@ _fs_load_glyphs(pointer client, FontPtr pfont, Bool range_flag, err = blockrec->errcode; if (err == StillWorking) return Suspended; - + _fs_signal_clients_depending(&bfont->clients_depending); _fs_remove_block_rec(conn, blockrec); if (err != Successful) @@ -2246,7 +2246,7 @@ fs_read_list(FontPathElementPtr fpe, FSBlockDataPtr blockrec) err = Successful; /* copy data into FontPathRecord */ - for (i = 0; i < rep->nFonts; i++) + for (i = 0; i < rep->nFonts; i++) { length = *(unsigned char *)data++; err = AddFontNamesName(blist->names, data, length); @@ -2259,7 +2259,7 @@ fs_read_list(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } static int -fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, +fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, int patlen, int maxnames, FontNamesPtr newnames) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2269,7 +2269,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, if (conn->blockState & FS_GIVE_UP) return BadFontName; - + /* make a new block record, and add it to the end of the list */ blockrec = fs_new_block_rec(fpe, client, FS_LIST_FONTS); if (!blockrec) @@ -2282,7 +2282,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, _fs_pending_reply (conn); return Suspended; } - + _fs_client_access (conn, client, FALSE); _fs_client_resolution(conn); @@ -2297,7 +2297,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, _fs_write_pad(conn, (char *) pattern, patlen); blockrec->sequenceNumber = conn->current_seq; - + #ifdef NCD if (configData.ExtendedFontDiags) { char buf[256]; @@ -2314,7 +2314,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, } static int -fs_list_fonts(pointer client, FontPathElementPtr fpe, +fs_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, int patlen, int maxnames, FontNamesPtr newnames) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2324,7 +2324,7 @@ fs_list_fonts(pointer client, FontPathElementPtr fpe, /* see if the result is already there */ for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) { - if (blockrec->type == FS_LIST_FONTS && blockrec->client == client) + if (blockrec->type == FS_LIST_FONTS && blockrec->client == client) { err = blockrec->errcode; if (err == StillWorking) @@ -2380,7 +2380,7 @@ fs_read_list_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) } buf = (char *) rep + SIZEOF (fsListFontsWithXInfoReply); - + /* * The original FS implementation didn't match * the spec, version 1 was respecified to match the FS. @@ -2417,18 +2417,18 @@ fs_read_list_info(FontPathElementPtr fpe, FSBlockDataPtr blockrec) binfo->remaining = rep->nReplies; binfo->status = FS_LFWI_REPLY; - + /* disable this font server until we've processed this response */ _fs_unmark_block (conn, FS_COMPLETE_REPLY); FD_CLR(conn->fs_fd, &_fs_fd_mask); -done: +done: _fs_done_read (conn, rep->length << 2); return err; } /* ARGSUSED */ static int -fs_start_list_with_info(pointer client, FontPathElementPtr fpe, +fs_start_list_with_info(pointer client, FontPathElementPtr fpe, char *pattern, int len, int maxnames, pointer *pdata) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2443,7 +2443,7 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, blockrec = fs_new_block_rec(fpe, client, FS_LIST_WITH_INFO); if (!blockrec) return AllocError; - + binfo = (FSBlockedListInfoPtr) blockrec->data; bzero((char *) binfo, sizeof(FSBlockedListInfoRec)); binfo->status = FS_LFWI_WAITING; @@ -2453,7 +2453,7 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, _fs_pending_reply (conn); return Suspended; } - + _fs_client_access (conn, client, FALSE); _fs_client_resolution(conn); @@ -2468,7 +2468,7 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, (void) _fs_write_pad(conn, pattern, len); blockrec->sequenceNumber = conn->current_seq; - + #ifdef NCD if (configData.ExtendedFontDiags) { char buf[256]; @@ -2486,8 +2486,8 @@ fs_start_list_with_info(pointer client, FontPathElementPtr fpe, /* ARGSUSED */ static int -fs_next_list_with_info(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, +fs_next_list_with_info(pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, FontInfoPtr *pFontInfo, int *numFonts, pointer private) { @@ -2498,7 +2498,7 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, /* see if the result is already there */ for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) - if (blockrec->type == FS_LIST_WITH_INFO && blockrec->client == client) + if (blockrec->type == FS_LIST_WITH_INFO && blockrec->client == client) break; if (!blockrec) @@ -2513,7 +2513,7 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, } binfo = (FSBlockedListInfoPtr) blockrec->data; - + if (binfo->status == FS_LFWI_WAITING) return Suspended; @@ -2521,12 +2521,12 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, *namelenp = binfo->namelen; *pFontInfo = &binfo->info; *numFonts = binfo->remaining; - + /* Restart reply processing from this font server */ FD_SET(conn->fs_fd, &_fs_fd_mask); if (fs_reply_ready (conn)) _fs_mark_block (conn, FS_COMPLETE_REPLY); - + err = blockrec->errcode; switch (binfo->status) { case FS_LFWI_FINISHED: @@ -2539,7 +2539,7 @@ fs_next_list_with_info(pointer client, FontPathElementPtr fpe, _fs_mark_block (conn, FS_PENDING_REPLY); break; } - + return err; } @@ -2574,12 +2574,12 @@ fs_client_died(pointer client, FontPathElementPtr fpe) for (blockrec = conn->blockedRequests; blockrec; blockrec = blockrec->next) if (blockrec->client == client) break; - + if (!blockrec) return; - + /* replace the client pointers in this block rec with the chained one */ - if ((depending = blockrec->depending)) + if ((depending = blockrec->depending)) { blockrec->client = depending->client; blockrec->depending = depending->depending; @@ -2681,7 +2681,7 @@ static int _fs_check_connect (FSFpePtr conn) { int ret; - + ret = _fs_poll_connect (conn->trans_conn, 0); switch (ret) { case FSIO_READY: @@ -2715,7 +2715,7 @@ _fs_get_conn_setup (FSFpePtr conn, int *error, int *setup_len) *error = ret; return 0; } - + setup = (fsConnSetup *) data; if (setup->major_version > FS_PROTOCOL) { @@ -2789,7 +2789,7 @@ _fs_recv_conn_setup (FSFpePtr conn) int i, alt_len; int setup_len; char *alt_save, *alt_names; - + setup = _fs_get_conn_setup (conn, &ret, &setup_len); if (!setup) return ret; @@ -2845,7 +2845,7 @@ _fs_open_server (FSFpePtr conn) { int ret; char *servername; - + if (conn->alternate == 0) servername = conn->servername; else @@ -2877,13 +2877,13 @@ _fs_send_init_packets (FSFpePtr conn) char *cat; char len; char *end; - int num_res; + int num_res; FontResolutionPtr res; #define CATALOGUE_SEP '+' res = GetClientResolutions(&num_res); - if (num_res) + if (num_res) { srreq.reqType = FS_SetResolution; srreq.num_resolutions = num_res; @@ -2902,14 +2902,14 @@ _fs_send_init_packets (FSFpePtr conn) catalogues = _fs_catalog_name (conn->alts[conn->alternate-1].name); if (!catalogues) catalogues = _fs_catalog_name (conn->servername); - + if (!catalogues) { conn->has_catalogues = FALSE; return FSIO_READY; } conn->has_catalogues = TRUE; - + /* turn cats into counted list */ catalogues++; @@ -2929,11 +2929,11 @@ _fs_send_init_packets (FSFpePtr conn) screq.reqType = FS_SetCatalogues; screq.num_catalogues = num_cats; screq.length = (SIZEOF(fsSetCataloguesReq) + clen + 3) >> 2; - + _fs_add_req_log(conn, FS_SetCatalogues); if (_fs_write(conn, (char *) &screq, SIZEOF(fsSetCataloguesReq)) != FSIO_READY) return FSIO_ERROR; - + while (*cat) { num_cats++; @@ -2947,10 +2947,10 @@ _fs_send_init_packets (FSFpePtr conn) return FSIO_ERROR; cat = end; } - + if (_fs_write (conn, "....", _fs_pad_length (clen) - clen) != FSIO_READY) return FSIO_ERROR; - + return FSIO_READY; } @@ -2958,7 +2958,7 @@ static int _fs_send_cat_sync (FSFpePtr conn) { fsListCataloguesReq lcreq; - + /* * now sync up with the font server, to see if an error was generated * by a bogus catalogue @@ -2986,7 +2986,7 @@ _fs_recv_cat_sync (FSFpePtr conn) reply = fs_get_reply (conn, &err); if (!reply) return err; - + ret = FSIO_READY; if (reply->type == FS_Error) { @@ -3020,7 +3020,7 @@ static int _fs_do_setup_connection (FSFpePtr conn) { int ret; - + do { #ifdef DEBUG @@ -3113,7 +3113,7 @@ static void _fs_check_reconnect (FSFpePtr conn) { int ret; - + ret = _fs_do_setup_connection (conn); switch (ret) { case FSIO_READY: diff --git a/src/fc/fservestr.h b/src/fc/fservestr.h index a6d0d1d..6435cf4 100644 --- a/src/fc/fservestr.h +++ b/src/fc/fservestr.h @@ -182,18 +182,18 @@ typedef struct _fs_reconnect { fsUnpack_XCharInfo((packet)->font_header_max_bounds, &(structure)->ink_maxbounds) extern void _fs_init_fontinfo ( FSFpePtr conn, FontInfoPtr pfi ); -extern int _fs_convert_props ( fsPropInfo *pi, fsPropOffset *po, pointer pd, +extern int _fs_convert_props ( fsPropInfo *pi, fsPropOffset *po, pointer pd, FontInfoPtr pfi ); -extern int _fs_convert_lfwi_reply ( FSFpePtr conn, FontInfoPtr pfi, - fsListFontsWithXInfoReply *fsrep, - fsPropInfo *pi, fsPropOffset *po, +extern int _fs_convert_lfwi_reply ( FSFpePtr conn, FontInfoPtr pfi, + fsListFontsWithXInfoReply *fsrep, + fsPropInfo *pi, fsPropOffset *po, pointer pd ); -extern int fs_build_range ( FontPtr pfont, Bool range_flag, - unsigned int count, int item_size, - unsigned char *data, int *nranges, +extern int fs_build_range ( FontPtr pfont, Bool range_flag, + unsigned int count, int item_size, + unsigned char *data, int *nranges, fsRange **ranges ); -extern void _fs_clean_aborted_loadglyphs ( FontPtr pfont, - int num_expected_ranges, +extern void _fs_clean_aborted_loadglyphs ( FontPtr pfont, + int num_expected_ranges, fsRange *expected_ranges ); extern void _fs_init_font ( FontPtr pfont ); extern pointer fs_alloc_glyphs (FontPtr pFont, int size); diff --git a/src/fc/fsio.c b/src/fc/fsio.c index 63d3b4f..569b3aa 100644 --- a/src/fc/fsio.c +++ b/src/fc/fsio.c @@ -72,7 +72,7 @@ _fs_resize (FSBufPtr buf, long size); static void _fs_downsize (FSBufPtr buf, long size); - + int _fs_poll_connect (XtransConnInfo trans_conn, int timeout) { @@ -149,7 +149,7 @@ _fs_fill (FSFpePtr conn) long avail; long bytes_read; Bool waited = FALSE; - + if (_fs_flush (conn) < 0) return FSIO_ERROR; /* @@ -199,7 +199,7 @@ int _fs_start_read (FSFpePtr conn, long size, char **buf) { int ret; - + conn->inNeed = size; if (fs_inqueued(conn) < size) { @@ -245,7 +245,7 @@ _fs_flush (FSFpePtr conn) { long bytes_written; long remain; - + /* XXX - hack. The right fix is to remember that the font server has gone away when we first discovered it. */ if (conn->fs_fd < 0) @@ -295,7 +295,7 @@ _fs_resize (FSBufPtr buf, long size) { if (buf->remove != buf->insert) { - memmove (buf->buf, + memmove (buf->buf, buf->buf + buf->remove, buf->insert - buf->remove); } @@ -345,7 +345,7 @@ _fs_io_init (FSFpePtr conn) if (!conn->outBuf.buf) return FALSE; conn->outBuf.size = FS_BUF_INC; - + conn->inBuf.insert = conn->inBuf.remove = 0; conn->inBuf.buf = malloc (FS_BUF_INC); if (!conn->inBuf.buf) @@ -355,7 +355,7 @@ _fs_io_init (FSFpePtr conn) return FALSE; } conn->inBuf.size = FS_BUF_INC; - + return TRUE; } @@ -380,8 +380,8 @@ _fs_do_write(FSFpePtr conn, char *data, long len, long size) if (conn->fs_fd == -1) return FSIO_ERROR; - - while (conn->outBuf.insert + size > conn->outBuf.size) + + while (conn->outBuf.insert + size > conn->outBuf.size) { if (_fs_flush (conn) < 0) return FSIO_ERROR; @@ -407,7 +407,7 @@ _fs_write (FSFpePtr conn, char *data, long len) { return _fs_do_write (conn, data, len, len); } - + /* * Write the indicated bytes adding any appropriate pad */ diff --git a/src/fc/fsio.h b/src/fc/fsio.h index bd0c621..1d1b3dd 100644 --- a/src/fc/fsio.h +++ b/src/fc/fsio.h @@ -110,9 +110,9 @@ typedef struct _fs_fpe_data { CARD32 brokenWriteTime; /* time to retry broken write */ CARD32 blockedConnectTime; /* time to abort blocked connect */ CARD32 brokenConnectionTime; /* time to retry broken connection */ - + FSBlockDataPtr blockedRequests; - + struct _XtransConnInfo *trans_conn; /* transport connection object */ } FSFpeRec; diff --git a/src/fc/fslibos.h b/src/fc/fslibos.h index c49f52e..c1f0ede 100644 --- a/src/fc/fslibos.h +++ b/src/fc/fslibos.h @@ -62,7 +62,7 @@ from The Open Group. # endif #endif #ifndef OPEN_MAX -#if defined(SVR4) +#if defined(SVR4) #define OPEN_MAX 256 #else #include diff --git a/src/fc/fstrans.c b/src/fc/fstrans.c index c334c25..24fceee 100644 --- a/src/fc/fstrans.c +++ b/src/fc/fstrans.c @@ -19,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ - + #ifdef HAVE_CONFIG_H #include #endif diff --git a/src/fontfile/bitsource.c b/src/fontfile/bitsource.c index 1b79c2b..c73f41f 100644 --- a/src/fontfile/bitsource.c +++ b/src/fontfile/bitsource.c @@ -101,14 +101,14 @@ FontFileEmptyBitmapSource(void) } int -FontFileMatchBitmapSource (FontPathElementPtr fpe, - FontPtr *pFont, - int flags, - FontEntryPtr entry, - FontNamePtr zeroPat, - FontScalablePtr vals, - fsBitmapFormat format, - fsBitmapFormatMask fmask, +FontFileMatchBitmapSource (FontPathElementPtr fpe, + FontPtr *pFont, + int flags, + FontEntryPtr entry, + FontNamePtr zeroPat, + FontScalablePtr vals, + fsBitmapFormat format, + fsBitmapFormatMask fmask, Bool noSpecificSize) { int source; diff --git a/src/fontfile/bunzip2.c b/src/fontfile/bunzip2.c index 007fc7c..44d19f0 100644 --- a/src/fontfile/bunzip2.c +++ b/src/fontfile/bunzip2.c @@ -76,7 +76,7 @@ BufFilePushBZIP2 (BufFilePtr f) BufBzip2FileClose); } -static int +static int BufBzip2FileClose(BufFilePtr f, int flag) { xzip_buf *x = (xzip_buf *)f->private; @@ -86,15 +86,15 @@ BufBzip2FileClose(BufFilePtr f, int flag) return 1; } -/* here's the real work. +/* here's the real work. -- we need to put stuff in f.buffer, update f.left and f.bufp, then return the first byte (or BUFFILEEOF). - -- to do this, we need to get stuff into avail_in, and next_in, + -- to do this, we need to get stuff into avail_in, and next_in, and call BZ2_bzDecompress appropriately. -- we may also need to add CRC maintenance - if BZ2_bzDecompress tells us BZ_STREAM_END, we then have 4bytes CRC and 4bytes length... */ -static int +static int BufBzip2FileFill (BufFilePtr f) { xzip_buf *x = (xzip_buf *)f->private; @@ -148,7 +148,7 @@ BufBzip2FileFill (BufFilePtr f) } } f->bufp = x->b; - f->left = BUFFILESIZE - x->z.avail_out; + f->left = BUFFILESIZE - x->z.avail_out; if (f->left >= 0) { f->left--; @@ -159,7 +159,7 @@ BufBzip2FileFill (BufFilePtr f) } /* there should be a BufCommonSkip... */ -static int +static int BufBzip2FileSkip (BufFilePtr f, int c) { /* BufFileRawSkip returns the count unchanged. diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c index 3a04a75..8029b28 100644 --- a/src/fontfile/catalogue.c +++ b/src/fontfile/catalogue.c @@ -60,7 +60,7 @@ CatalogueAddFPE (CataloguePtr cat, FontPathElementPtr fpe) cat->fpeAlloc = 16; else cat->fpeAlloc *= 2; - + new = realloc(cat->fpeList, cat->fpeAlloc * sizeof(FontPathElementPtr)); if (new == NULL) return AllocError; @@ -251,7 +251,7 @@ static int CatalogueResetFPE (FontPathElementPtr fpe) { /* Always just tell the caller to close and re-open */ - return FPEResetFailed; + return FPEResetFailed; } static int @@ -277,10 +277,10 @@ CatalogueFreeFPE (FontPathElementPtr fpe) } static int -CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, +CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, - XID id, FontPtr *pFont, char **aliasName, + XID id, FontPtr *pFont, char **aliasName, FontPtr non_cachable_font) { CataloguePtr cat = fpe->private; @@ -300,7 +300,7 @@ CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, if (status == Successful || status == FontNameAlias) return status; } - + return BadFontName; } @@ -314,7 +314,7 @@ CatalogueCloseFont (FontPathElementPtr fpe, FontPtr pFont) } static int -CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat, +CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat, int len, int max, FontNamesPtr names) { CataloguePtr cat = fpe->private; @@ -335,8 +335,8 @@ CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat, } int -FontFileStartListFonts(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +FontFileStartListFonts(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep, int mark_aliases); typedef struct _LFWIData { @@ -345,7 +345,7 @@ typedef struct _LFWIData { } LFWIDataRec, *LFWIDataPtr; static int -CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, +CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, char *pat, int len, int max, pointer *privatep, int mark_aliases) { @@ -381,16 +381,16 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, } static int -CatalogueStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +CatalogueStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep) { return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 0); } static int -CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, +CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, FontInfoPtr *pFontInfo, int *numFonts, pointer private) { @@ -419,15 +419,15 @@ CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe, } static int -CatalogueStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +CatalogueStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep) { return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 1); } static int -CatalogueListNextFontOrAlias(pointer client, FontPathElementPtr fpe, +CatalogueListNextFontOrAlias(pointer client, FontPathElementPtr fpe, char **namep, int *namelenp, char **resolvedp, int *resolvedlenp, pointer private) { diff --git a/src/fontfile/decompress.c b/src/fontfile/decompress.c index c8171dd..0f28c3f 100644 --- a/src/fontfile/decompress.c +++ b/src/fontfile/decompress.c @@ -44,7 +44,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* +/* * decompress - cat a compressed file */ @@ -93,7 +93,7 @@ static char_type magic_header[] = { "\037\235" }; /* 1F 9D */ /* * the next two codes should not be changed lightly, as they must not * lie within the contiguous general code space. - */ + */ #define FIRST 257 /* first free entry */ #define CLEAR 256 /* table clear output code */ @@ -153,7 +153,7 @@ BufFilePushCompressed (BufFilePtr f) } code = BufFileGet (f); if (code == BUFFILEEOF) return 0; - + maxbits = code & BIT_MASK; if (maxbits > BITS || maxbits < 12) return 0; @@ -236,7 +236,7 @@ BufCompressedFill (BufFilePtr f) code = getcode (file); if (code == -1) break; - + if ( (code == CLEAR) && file->block_compress ) { for ( code = 255; code >= 0; code-- ) file->tab_prefix[code] = 0; @@ -253,7 +253,7 @@ BufCompressedFill (BufFilePtr f) *stackp++ = finchar; code = oldcode; } - + /* * Generate output characters in reverse order */ @@ -266,7 +266,7 @@ BufCompressedFill (BufFilePtr f) } finchar = file->tab_suffix[code]; *stackp++ = finchar; - + /* * Generate the new entry. */ @@ -274,7 +274,7 @@ BufCompressedFill (BufFilePtr f) file->tab_prefix[code] = (unsigned short)oldcode; file->tab_suffix[code] = finchar; file->free_ent = code+1; - } + } /* * Remember previous code. */ @@ -382,7 +382,7 @@ static int BufCompressedSkip (BufFilePtr f, int bytes) { int c; - while (bytes--) + while (bytes--) { c = BufFileGet(f); if (c == BUFFILEEOF) @@ -397,7 +397,7 @@ main (int argc, char *argv[]) { BufFilePtr inputraw, input, output; int c; - + inputraw = BufFileOpenRead (0); input = BufFilePushCompressed (inputraw); output = BufFileOpenWrite (1); diff --git a/src/fontfile/dirfile.c b/src/fontfile/dirfile.c index c8aff6f..0d34db9 100644 --- a/src/fontfile/dirfile.c +++ b/src/fontfile/dirfile.c @@ -90,7 +90,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) strcat(dir_file, FontDirFile); file = fopen(dir_file, "rt"); if (file) { -#ifndef WIN32 +#ifndef WIN32 if (fstat (fileno(file), &statb) == -1) #else if (stat (dir_file, &statb) == -1) @@ -135,7 +135,7 @@ FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) FontFileAddFontFile (dir, font_name, file_name); } fclose(file); - + } else if (errno != ENOENT) { return BadFontPath; } @@ -188,7 +188,7 @@ FontFileDirectoryChanged(FontDirectoryPtr dir) return TRUE; return FALSE; } - + /* * Make each of the file names an automatic alias for each of the files. */ @@ -212,7 +212,7 @@ AddFileNameAliases(FontDirectoryPtr dir) renderer = FontFileMatchRenderer (fileName); if (!renderer) continue; - + len = strlen (fileName) - renderer->fileSuffixLen; if (len >= sizeof(copy)) continue; diff --git a/src/fontfile/fontdir.c b/src/fontfile/fontdir.c index e052bb3..e524696 100644 --- a/src/fontfile/fontdir.c +++ b/src/fontfile/fontdir.c @@ -43,7 +43,7 @@ in this Software without prior written authorization from The Open Group. Bool FontFileInitTable (FontTablePtr table, int size) { - if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec))) + if (size < 0 || (size > INT32_MAX/sizeof(FontEntryRec))) return FALSE; if (size) { @@ -279,7 +279,7 @@ FontFileSortDir(FontDirectoryPtr dir) #define isDigit(c) (XK_0 <= (c) && (c) <= XK_9) static int -SetupWildMatch(FontTablePtr table, FontNamePtr pat, +SetupWildMatch(FontTablePtr table, FontNamePtr pat, int *leftp, int *rightp, int *privatep) { int nDashes; @@ -438,7 +438,7 @@ FontFileSaveString (char *s) } FontEntryPtr -FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat, +FontFileFindNameInScalableDir(FontTablePtr table, FontNamePtr pat, FontScalablePtr vals) { int i, @@ -491,7 +491,7 @@ FontFileFindNameInDir(FontTablePtr table, FontNamePtr pat) } int -FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max, +FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max, FontNamesPtr names, FontScalablePtr vals, int alias_behavior, int *newmax) { @@ -578,7 +578,7 @@ FontFileFindNamesInScalableDir(FontTablePtr table, FontNamePtr pat, int max, } int -FontFileFindNamesInDir(FontTablePtr table, FontNamePtr pat, +FontFileFindNamesInDir(FontTablePtr table, FontNamePtr pat, int max, FontNamesPtr names) { return FontFileFindNamesInScalableDir(table, pat, max, names, @@ -767,7 +767,7 @@ FontFileAddFontFile (FontDirectoryPtr dir, char *fontName, char *fileName) extra->defaults.y = 75; } } - else + else { extra->defaults.x = vals.x; extra->defaults.y = vals.y; diff --git a/src/fontfile/fontencc.c b/src/fontfile/fontencc.c index 7997785..4bdb495 100644 --- a/src/fontfile/fontencc.c +++ b/src/fontfile/fontencc.c @@ -48,7 +48,7 @@ font_encoding_find(const char *encoding_name, const char *filename) } unsigned -font_encoding_recode(unsigned code, +font_encoding_recode(unsigned code, FontEncPtr encoding, FontMapPtr mapping) { if(encoding != mapping->encoding) { diff --git a/src/fontfile/fontfile.c b/src/fontfile/fontfile.c index eb37a87..c55282b 100644 --- a/src/fontfile/fontfile.c +++ b/src/fontfile/fontfile.c @@ -62,9 +62,9 @@ CopyISOLatin1Lowered(char *dest, char *source, int length) * Map FPE functions to renderer functions */ -static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, - fsBitmapFormat format, +static int FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, + int flags, FontEntryPtr entry, + fsBitmapFormat format, fsBitmapFormatMask fmask, FontPtr non_cachable_font); @@ -119,14 +119,14 @@ FontFileResetFPE (FontPathElementPtr fpe) if (FontFileDirectoryChanged (dir)) { /* can't do it, so tell the caller to close and re-open */ - return FPEResetFailed; + return FPEResetFailed; } - else + else { if (dir->nonScalable.used > 0) if (!FontFileRegisterBitmapSource (fpe)) { - return FPEResetFailed; + return FPEResetFailed; } return Successful; } @@ -141,7 +141,7 @@ FontFileFreeFPE (FontPathElementPtr fpe) } static int -transfer_values_to_alias(char *entryname, int entrynamelength, +transfer_values_to_alias(char *entryname, int entrynamelength, char *resolvedname, char **aliasName, FontScalablePtr vals) { @@ -253,10 +253,10 @@ transfer_values_to_alias(char *entryname, int entrynamelength, /* ARGSUSED */ int -FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, +FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, + char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, - XID id, FontPtr *pFont, char **aliasName, + XID id, FontPtr *pFont, char **aliasName, FontPtr non_cachable_font) { FontDirectoryPtr dir; @@ -272,7 +272,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, Bool noSpecificSize; int nranges; fsRange *ranges; - + if (namelen >= MAXFONTNAMELEN) return AllocError; dir = (FontDirectoryPtr) fpe->private; @@ -510,8 +510,8 @@ FontFileCloseFont (FontPathElementPtr fpe, FontPtr pFont) } static int -FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, +FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, + int flags, FontEntryPtr entry, fsBitmapFormat format, fsBitmapFormatMask fmask, FontPtr non_cachable_font) { @@ -528,7 +528,7 @@ FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, return BadFontName; strcpy (fileName, dir->directory); strcat (fileName, bitmap->fileName); - ret = (*bitmap->renderer->OpenBitmap) + ret = (*bitmap->renderer->OpenBitmap) (fpe, pFont, flags, entry, fileName, format, fmask, non_cachable_font); if (ret == Successful) @@ -540,8 +540,8 @@ FontFileOpenBitmapNCF (FontPathElementPtr fpe, FontPtr *pFont, } int -FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont, - int flags, FontEntryPtr entry, +FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont, + int flags, FontEntryPtr entry, fsBitmapFormat format, fsBitmapFormatMask fmask) { return FontFileOpenBitmapNCF (fpe, pFont, flags, entry, format, fmask, @@ -549,7 +549,7 @@ FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont, } static int -FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, +FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, FontEntryPtr entry) { FontBitmapEntryPtr bitmap; @@ -570,8 +570,8 @@ FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, } static void -_FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames, - FontNamePtr nameptr, char *zeroChars, +_FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames, + FontNamePtr nameptr, char *zeroChars, FontScalablePtr vals, fsRange *ranges, int nranges, int *max) { @@ -687,8 +687,8 @@ _FontFileAddScalableNames(FontNamesPtr names, FontNamesPtr scaleNames, /* ARGSUSED */ static int -_FontFileListFonts (pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, FontNamesPtr names, +_FontFileListFonts (pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, FontNamesPtr names, int mark_aliases) { FontDirectoryPtr dir; @@ -794,15 +794,15 @@ typedef struct _LFWIData { } LFWIDataRec, *LFWIDataPtr; int -FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat, +FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat, int len, int max, FontNamesPtr names) { return _FontFileListFonts (client, fpe, pat, len, max, names, 0); } int -FontFileStartListFonts(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +FontFileStartListFonts(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep, int mark_aliases) { LFWIDataPtr data; @@ -832,8 +832,8 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe, int -FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep) { return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 0); @@ -841,8 +841,8 @@ FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, /* ARGSUSED */ static int -FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, +FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, FontInfoPtr *pFontInfo) { FontDirectoryPtr dir; @@ -858,14 +858,14 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, Bool noSpecificSize; int nranges; fsRange *ranges; - + char *name = *namep; int namelen = *namelenp; - + if (namelen >= MAXFONTNAMELEN) return AllocError; dir = (FontDirectoryPtr) fpe->private; - + /* Match non-scalable pattern */ CopyISOLatin1Lowered (lowerName, name, namelen); lowerName[namelen] = '\0'; @@ -882,7 +882,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, tmpName.length = strlen(lowerName); entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName); } - + if (entry) { switch (entry->type) { @@ -914,7 +914,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, { ret = BadFontName; } - + if (ret != BadFontName) { if (ranges) free(ranges); @@ -945,7 +945,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, tmpName.ndashes = entry->name.ndashes; } } - + if (entry) { noSpecificSize = FALSE; /* TRUE breaks XLFD enhancements */ @@ -1001,7 +1001,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, vals.xlfdName = origName; vals.ranges = ranges; vals.nranges = nranges; - + /* Make a new scaled instance */ if (strlen(dir->directory) + strlen(scalable->fileName) >= sizeof(fileName)) { @@ -1037,8 +1037,8 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, } int -FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe, - char **namep, int *namelenp, +FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe, + char **namep, int *namelenp, FontInfoPtr *pFontInfo, int *numFonts, pointer private) { @@ -1066,15 +1066,15 @@ FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe, } int -FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, + char *pat, int len, int max, pointer *privatep) { return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 1); } int -FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe, +FontFileListNextFontOrAlias(pointer client, FontPathElementPtr fpe, char **namep, int *namelenp, char **resolvedp, int *resolvedlenp, pointer private) { diff --git a/src/fontfile/fontscale.c b/src/fontfile/fontscale.c index 55aca29..a21802f 100644 --- a/src/fontfile/fontscale.c +++ b/src/fontfile/fontscale.c @@ -35,7 +35,7 @@ in this Software without prior written authorization from The Open Group. #include Bool -FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, +FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, FontPtr pFont, char *bitmapName) { FontScalableEntryPtr scalable; @@ -75,7 +75,7 @@ FontFileSwitchStringsToBitmapPointers (FontDirectoryPtr dir) FontEntryPtr nonScalable; FontScaledPtr scaled; FontScalableExtraPtr extra; - + scalable = dir->scalable.entries; nonScalable = dir->nonScalable.entries; for (s = 0; s < dir->scalable.used; s++) @@ -373,12 +373,12 @@ MatchScalable (FontScalablePtr a, FontScalablePtr b) a->ranges[i].max_char_low != b->ranges[i].max_char_low || a->ranges[i].max_char_high != b->ranges[i].max_char_high) return FALSE; - + return TRUE; } FontScaledPtr -FontFileFindScaledInstance (FontEntryPtr entry, FontScalablePtr vals, +FontFileFindScaledInstance (FontEntryPtr entry, FontScalablePtr vals, int noSpecificSize) { FontScalableEntryPtr scalable; diff --git a/src/fontfile/gunzip.c b/src/fontfile/gunzip.c index 9fa3eed..84a4eaf 100644 --- a/src/fontfile/gunzip.c +++ b/src/fontfile/gunzip.c @@ -66,7 +66,7 @@ BufFilePushZIP (BufFilePtr f) BufZipFileClose); } -static int +static int BufZipFileClose(BufFilePtr f, int flag) { xzip_buf *x = (xzip_buf *)f->private; @@ -76,16 +76,16 @@ BufZipFileClose(BufFilePtr f, int flag) return 1; } -/* here's the real work. +/* here's the real work. -- we need to put stuff in f.buffer, update f.left and f.bufp, then return the first byte (or BUFFILEEOF). - -- to do this, we need to get stuff into avail_in, and next_in, + -- to do this, we need to get stuff into avail_in, and next_in, and call inflate appropriately. -- we may also need to add CRC maintenance - if inflate tells us Z_STREAM_END, we then have 4bytes CRC and 4bytes length... gzio.c:gzread shows most of the mechanism. */ -static int +static int BufZipFileFill (BufFilePtr f) { xzip_buf *x = (xzip_buf *)f->private; @@ -139,7 +139,7 @@ BufZipFileFill (BufFilePtr f) } } f->bufp = x->b; - f->left = BUFFILESIZE - x->z.avail_out; + f->left = BUFFILESIZE - x->z.avail_out; if (f->left >= 0) { f->left--; @@ -150,7 +150,7 @@ BufZipFileFill (BufFilePtr f) } /* there should be a BufCommonSkip... */ -static int +static int BufZipFileSkip (BufFilePtr f, int c) { /* BufFileRawSkip returns the count unchanged. @@ -192,7 +192,7 @@ BufZipFileSkip (BufFilePtr f, int c) #define RESERVED 0xE0 /* bits 5..7: reserved */ #define GET(f) do {c = BufFileGet(f); if (c == BUFFILEEOF) return c;} while(0) -static int +static int BufCheckZipHeader(BufFilePtr f) { int c, flags; diff --git a/src/fontfile/register.c b/src/fontfile/register.c index 1a63cb3..8d7229e 100644 --- a/src/fontfile/register.c +++ b/src/fontfile/register.c @@ -55,7 +55,7 @@ FontFileRegisterFpeFunctions(void) #ifdef XFONT_FREETYPE FreeTypeRegisterFontFileFunctions(); #endif - + FontFileRegisterLocalFpeFunctions (); CatalogueRegisterLocalFpeFunctions (); } diff --git a/src/fontfile/renderers.c b/src/fontfile/renderers.c index a9e4bef..5091922 100644 --- a/src/fontfile/renderers.c +++ b/src/fontfile/renderers.c @@ -64,7 +64,7 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority) } for (i = 0; i < renderers.number; i++) { - if (!strcasecmp (renderers.renderers[i].renderer->fileSuffix, + if (!strcasecmp (renderers.renderers[i].renderer->fileSuffix, renderer->fileSuffix)) { if(renderers.renderers[i].priority >= priority) { if(renderers.renderers[i].priority == priority) { @@ -99,7 +99,7 @@ FontFileMatchRenderer (char *fileName) int i; int fileLen; FontRendererPtr r; - + fileLen = strlen (fileName); for (i = 0; i < renderers.number; i++) { diff --git a/src/stubs/Makefile.am b/src/stubs/Makefile.am index 4d60c2a..86dd8fc 100644 --- a/src/stubs/Makefile.am +++ b/src/stubs/Makefile.am @@ -22,4 +22,4 @@ libstubs_la_SOURCES = \ servclient.c \ setfntauth.c \ stfntcfnt.c \ - stubs.h + stubs.h diff --git a/src/stubs/regfpefunc.c b/src/stubs/regfpefunc.c index a79b4bf..fdf22cd 100644 --- a/src/stubs/regfpefunc.c +++ b/src/stubs/regfpefunc.c @@ -7,21 +7,21 @@ #pragma weak RegisterFPEFunctions #endif -weak int -RegisterFPEFunctions(NameCheckFunc name_func, - InitFpeFunc init_func, - FreeFpeFunc free_func, - ResetFpeFunc reset_func, - OpenFontFunc open_func, - CloseFontFunc close_func, - ListFontsFunc list_func, - StartLfwiFunc start_lfwi_func, - NextLfwiFunc next_lfwi_func, - WakeupFpeFunc wakeup_func, - ClientDiedFunc client_died, - LoadGlyphsFunc load_glyphs, - StartLaFunc start_list_alias_func, - NextLaFunc next_list_alias_func, +weak int +RegisterFPEFunctions(NameCheckFunc name_func, + InitFpeFunc init_func, + FreeFpeFunc free_func, + ResetFpeFunc reset_func, + OpenFontFunc open_func, + CloseFontFunc close_func, + ListFontsFunc list_func, + StartLfwiFunc start_lfwi_func, + NextLfwiFunc next_lfwi_func, + WakeupFpeFunc wakeup_func, + ClientDiedFunc client_died, + LoadGlyphsFunc load_glyphs, + StartLaFunc start_list_alias_func, + NextLaFunc next_list_alias_func, SetPathFunc set_path_func) { return 0; diff --git a/src/stubs/rmfshdl.c b/src/stubs/rmfshdl.c index d0bdd3d..b495661 100644 --- a/src/stubs/rmfshdl.c +++ b/src/stubs/rmfshdl.c @@ -7,7 +7,7 @@ #pragma weak remove_fs_handlers #endif -weak void +weak void remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr blockHandler, Bool all) diff --git a/src/stubs/stubs.h b/src/stubs/stubs.h index 7f0eef2..fa634e9 100644 --- a/src/stubs/stubs.h +++ b/src/stubs/stubs.h @@ -29,8 +29,8 @@ #endif extern FontPtr find_old_font ( FSID id ); -extern int set_font_authorizations ( char **authorizations, - int *authlen, +extern int set_font_authorizations ( char **authorizations, + int *authlen, ClientPtr client ); extern unsigned long GetTimeInMillis (void); diff --git a/src/util/atom.c b/src/util/atom.c index f15e3d8..4f69363 100644 --- a/src/util/atom.c +++ b/src/util/atom.c @@ -146,7 +146,7 @@ NameEqual (const char *a, const char *b, int l) #pragma weak MakeAtom #endif -weak Atom +weak Atom MakeAtom(char *string, unsigned len, int makeit) { AtomListPtr a; @@ -223,7 +223,7 @@ MakeAtom(char *string, unsigned len, int makeit) #pragma weak ValidAtom #endif -weak int +weak int ValidAtom(Atom atom) { return (atom != None) && (atom <= lastAtom); diff --git a/src/util/fontaccel.c b/src/util/fontaccel.c index c5915db..db03e73 100644 --- a/src/util/fontaccel.c +++ b/src/util/fontaccel.c @@ -82,7 +82,7 @@ FontComputeInfoAccelerators(FontInfoPtr pFontInfo) pFontInfo->inkInside = FALSE; } -int +int FontCouldBeTerminal(FontInfoPtr pFontInfo) { if ((pFontInfo->minbounds.leftSideBearing >= 0) && @@ -95,7 +95,7 @@ FontCouldBeTerminal(FontInfoPtr pFontInfo) pFontInfo->minbounds.ascent != pFontInfo->fontAscent || pFontInfo->minbounds.descent != pFontInfo->fontDescent)) { /* blow off font with nothing but a SPACE */ - if (pFontInfo->maxbounds.ascent == 0 && + if (pFontInfo->maxbounds.ascent == 0 && pFontInfo->maxbounds.descent == 0) return FALSE; return TRUE; diff --git a/src/util/fontutil.c b/src/util/fontutil.c index 22f6119..2c5ea6f 100644 --- a/src/util/fontutil.c +++ b/src/util/fontutil.c @@ -45,10 +45,10 @@ static int defaultGlyphCachingMode = DEFAULT_GLYPH_CACHING_MODE; int glyphCachingMode = DEFAULT_GLYPH_CACHING_MODE; void -GetGlyphs(FontPtr font, - unsigned long count, - unsigned char *chars, - FontEncoding fontEncoding, +GetGlyphs(FontPtr font, + unsigned long count, + unsigned char *chars, + FontEncoding fontEncoding, unsigned long *glyphcount, /* RETURN */ CharInfoPtr *glyphs) /* RETURN */ { @@ -59,9 +59,9 @@ GetGlyphs(FontPtr font, #define MAX(a,b) ((a)>(b)?(a):(b)) void -QueryGlyphExtents(FontPtr pFont, - CharInfoPtr *charinfo, - unsigned long count, +QueryGlyphExtents(FontPtr pFont, + CharInfoPtr *charinfo, + unsigned long count, ExtentInfoRec *info) { register unsigned long i; @@ -131,9 +131,9 @@ QueryGlyphExtents(FontPtr pFont, } Bool -QueryTextExtents(FontPtr pFont, - unsigned long count, - unsigned char *chars, +QueryTextExtents(FontPtr pFont, + unsigned long count, + unsigned char *chars, ExtentInfoRec *info) { xCharInfo **charinfo; @@ -182,7 +182,7 @@ QueryTextExtents(FontPtr pFont, } cm = pFont->info.constantMetrics; pFont->info.constantMetrics = FALSE; - QueryGlyphExtents(pFont, (CharInfoPtr*) charinfo + firstReal, + QueryGlyphExtents(pFont, (CharInfoPtr*) charinfo + firstReal, n - firstReal, info); pFont->info.constantMetrics = cm; free(charinfo); @@ -227,9 +227,9 @@ SetGlyphCachingMode(int newmode) /* add_range(): Add range to a list of ranges, with coalescence */ int -add_range(fsRange *newrange, - int *nranges, - fsRange **range, +add_range(fsRange *newrange, + int *nranges, + fsRange **range, Bool charset_subset) { int first, last, middle; diff --git a/src/util/format.c b/src/util/format.c index f5424fe..c1f9762 100644 --- a/src/util/format.c +++ b/src/util/format.c @@ -6,11 +6,11 @@ * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Network Computing Devices or Digital - * not be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Network Computing - * Devices and Digital make no representations about the suitability of - * this software for any purpose. It is provided "as is" without express + * documentation, and that the names of Network Computing Devices or Digital + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Network Computing + * Devices and Digital make no representations about the suitability of + * this software for any purpose. It is provided "as is" without express * or implied warranty. * * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH @@ -59,12 +59,12 @@ from The Open Group. #include int -CheckFSFormat(fsBitmapFormat format, - fsBitmapFormatMask fmask, - int *bit_order, - int *byte_order, - int *scan, - int *glyph, +CheckFSFormat(fsBitmapFormat format, + fsBitmapFormatMask fmask, + int *bit_order, + int *byte_order, + int *scan, + int *glyph, int *image) { /* convert format to what the low levels want */ diff --git a/src/util/patcache.c b/src/util/patcache.c index 548105a..9c05fa1 100644 --- a/src/util/patcache.c +++ b/src/util/patcache.c @@ -66,7 +66,7 @@ void EmptyFontPatternCache (FontPatternCachePtr cache) { int i; - + for (i = 0; i < NBUCKETS; i++) cache->buckets[i] = 0; for (i = 0; i < NENTRIES; i++) @@ -127,9 +127,9 @@ Hash (const char *string, int len) /* add entry */ void -CacheFontPattern (FontPatternCachePtr cache, - char *pattern, - int patlen, +CacheFontPattern (FontPatternCachePtr cache, + char *pattern, + int patlen, FontPtr pFont) { FontPatternCacheEntryPtr e; @@ -173,8 +173,8 @@ CacheFontPattern (FontPatternCachePtr cache, /* find matching entry */ FontPtr -FindCachedFontPattern (FontPatternCachePtr cache, - char *pattern, +FindCachedFontPattern (FontPatternCachePtr cache, + char *pattern, int patlen) { int hash; @@ -195,7 +195,7 @@ FindCachedFontPattern (FontPatternCachePtr cache, } void -RemoveCachedFontPattern (FontPatternCachePtr cache, +RemoveCachedFontPattern (FontPatternCachePtr cache, FontPtr pFont) { FontPatternCacheEntryPtr e; diff --git a/src/util/private.c b/src/util/private.c index 36715b1..e55e193 100644 --- a/src/util/private.c +++ b/src/util/private.c @@ -42,7 +42,7 @@ AllocateFontPrivateIndex (void) return _FontPrivateAllocateIndex++; } -FontPtr +FontPtr CreateFontRec (void) { FontPtr pFont; @@ -51,7 +51,7 @@ CreateFontRec (void) size = sizeof(FontRec) + (sizeof(pointer) * _FontPrivateAllocateIndex); pFont = malloc(size); - + if(pFont) { bzero((char*)pFont, size); pFont->maxPrivate = _FontPrivateAllocateIndex - 1; diff --git a/src/util/utilbitmap.c b/src/util/utilbitmap.c index 5feb2d1..ec726b8 100644 --- a/src/util/utilbitmap.c +++ b/src/util/utilbitmap.c @@ -106,7 +106,7 @@ FourByteSwap(unsigned char *buf, int nbytes) { unsigned char c; - for (; nbytes > 0; nbytes -= 4, buf += 4) + for (; nbytes > 0; nbytes -= 4, buf += 4) { c = buf[0]; buf[0] = buf[3]; @@ -122,8 +122,8 @@ FourByteSwap(unsigned char *buf, int nbytes) */ int -RepadBitmap (char *pSrc, char *pDst, - unsigned int srcPad, unsigned int dstPad, +RepadBitmap (char *pSrc, char *pDst, + unsigned int srcPad, unsigned int dstPad, int width, int height) { int srcWidthBytes,dstWidthBytes; @@ -131,33 +131,33 @@ RepadBitmap (char *pSrc, char *pDst, char *pTmpSrc,*pTmpDst; switch (srcPad) { - case 1: + case 1: srcWidthBytes = (width+7)>>3; break; case 2: srcWidthBytes = ((width+15)>>4)<<1; break; - case 4: + case 4: srcWidthBytes = ((width+31)>>5)<<2; break; - case 8: - srcWidthBytes = ((width+63)>>6)<<3; + case 8: + srcWidthBytes = ((width+63)>>6)<<3; break; default: return 0; } switch (dstPad) { - case 1: + case 1: dstWidthBytes = (width+7)>>3; break; case 2: dstWidthBytes = ((width+15)>>4)<<1; break; - case 4: + case 4: dstWidthBytes = ((width+31)>>5)<<2; break; - case 8: - dstWidthBytes = ((width+63)>>6)<<3; + case 8: + dstWidthBytes = ((width+63)>>6)<<3; break; default: return 0; -- cgit v1.2.3