diff options
author | marha <marha@users.sourceforge.net> | 2014-09-21 18:14:18 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-09-21 18:14:18 +0200 |
commit | 4e080e0165d18887e2a0fccd7f30cf20fd04b178 (patch) | |
tree | dbefa5addb60abe7a5c52dbc1daea7d6e0c9d4d0 /libXfont/src | |
parent | e16399e57caac9e859a7d28921c73ef9839b571e (diff) | |
parent | d0f70707dde032e662dbd5bc70df6ac915403abe (diff) | |
download | vcxsrv-4e080e0165d18887e2a0fccd7f30cf20fd04b178.tar.gz vcxsrv-4e080e0165d18887e2a0fccd7f30cf20fd04b178.tar.bz2 vcxsrv-4e080e0165d18887e2a0fccd7f30cf20fd04b178.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
libXfont/src/fontfile/fontfile.c
libXfont/src/util/utilbitmap.c
Diffstat (limited to 'libXfont/src')
64 files changed, 451 insertions, 293 deletions
diff --git a/libXfont/src/FreeType/Makefile.in b/libXfont/src/FreeType/Makefile.in index f185aca7f..9c0e25006 100644 --- a/libXfont/src/FreeType/Makefile.in +++ b/libXfont/src/FreeType/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/libXfont/src/FreeType/ftfuncs.c b/libXfont/src/FreeType/ftfuncs.c index f8b01835c..3dd8eb946 100644 --- a/libXfont/src/FreeType/ftfuncs.c +++ b/libXfont/src/FreeType/ftfuncs.c @@ -1073,6 +1073,8 @@ FT_Do_SBit_Metrics( FT_Face ft_face, FT_Size ft_size, FT_ULong strike_index, #endif } +#pragma GCC diagnostic ignored "-Wbad-function-cast" + int FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp, FTInstancePtr instance, int hasMetrics) diff --git a/libXfont/src/FreeType/ftfuncs.h b/libXfont/src/FreeType/ftfuncs.h index 068a59523..6545dfabd 100644 --- a/libXfont/src/FreeType/ftfuncs.h +++ b/libXfont/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/libXfont/src/FreeType/fttools.c b/libXfont/src/FreeType/fttools.c index a0e34d021..a85d3ee72 100644 --- a/libXfont/src/FreeType/fttools.c +++ b/libXfont/src/FreeType/fttools.c @@ -119,17 +119,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/libXfont/src/Makefile.am b/libXfont/src/Makefile.am index cd09ab99f..33fd135c1 100644 --- a/libXfont/src/Makefile.am +++ b/libXfont/src/Makefile.am @@ -65,4 +65,4 @@ libXfont_la_LIBADD = \ libXfont_la_SOURCES = dummy.c -libXfont_la_LDFLAGS = -version-number 1:4:1 +libXfont_la_LDFLAGS = -version-number 1:4:1 -no-undefined diff --git a/libXfont/src/Makefile.in b/libXfont/src/Makefile.in index 6d92fd150..7396a7d46 100644 --- a/libXfont/src/Makefile.in +++ b/libXfont/src/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -432,7 +432,7 @@ libXfont_la_LIBADD = \ $(FREETYPE_LIBS) $(Z_LIBS) $(MATH_LIBS) $(XFONT_LIBS) libXfont_la_SOURCES = dummy.c -libXfont_la_LDFLAGS = -version-number 1:4:1 +libXfont_la_LDFLAGS = -version-number 1:4:1 -no-undefined all: all-recursive .SUFFIXES: diff --git a/libXfont/src/bitmap/Makefile.am b/libXfont/src/bitmap/Makefile.am index 99682d9db..0f2d10a02 100644 --- a/libXfont/src/bitmap/Makefile.am +++ b/libXfont/src/bitmap/Makefile.am @@ -6,14 +6,24 @@ AM_CFLAGS = $(XFONT_CFLAGS) $(OS_CFLAGS) $(CWARNFLAGS) noinst_LTLIBRARIES = libbitmap.la libbitmap_la_SOURCES = \ - bdfread.c \ - bdfutils.c \ bitmap.c \ bitmapfunc.c \ bitmaputil.c \ bitscale.c \ - fontink.c \ - pcfread.c \ - pcfwrite.c \ - snfread.c \ - snfstr.h + fontink.c + +if XFONT_BDFFORMAT +libbitmap_la_SOURCES += bdfread.c bdfutils.c +endif + +if XFONT_PCF_OR_BUILTIN +libbitmap_la_SOURCES += pcfread.c +endif + +if XFONT_PCFFORMAT +libbitmap_la_SOURCES += pcfwrite.c +endif + +if XFONT_SNFFORMAT +libbitmap_la_SOURCES += snfread.c snfstr.h +endif diff --git a/libXfont/src/bitmap/Makefile.in b/libXfont/src/bitmap/Makefile.in index 5aa1a4a7b..4f654aa67 100644 --- a/libXfont/src/bitmap/Makefile.in +++ b/libXfont/src/bitmap/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -78,6 +78,10 @@ PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ +@XFONT_BDFFORMAT_TRUE@am__append_1 = bdfread.c bdfutils.c +@XFONT_PCF_OR_BUILTIN_TRUE@am__append_2 = pcfread.c +@XFONT_PCFFORMAT_TRUE@am__append_3 = pcfwrite.c +@XFONT_SNFFORMAT_TRUE@am__append_4 = snfread.c snfstr.h subdir = src/bitmap DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp @@ -92,9 +96,16 @@ CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbitmap_la_LIBADD = -am_libbitmap_la_OBJECTS = bdfread.lo bdfutils.lo bitmap.lo \ - bitmapfunc.lo bitmaputil.lo bitscale.lo fontink.lo pcfread.lo \ - pcfwrite.lo snfread.lo +am__libbitmap_la_SOURCES_DIST = bitmap.c bitmapfunc.c bitmaputil.c \ + bitscale.c fontink.c bdfread.c bdfutils.c pcfread.c pcfwrite.c \ + snfread.c snfstr.h +@XFONT_BDFFORMAT_TRUE@am__objects_1 = bdfread.lo bdfutils.lo +@XFONT_PCF_OR_BUILTIN_TRUE@am__objects_2 = pcfread.lo +@XFONT_PCFFORMAT_TRUE@am__objects_3 = pcfwrite.lo +@XFONT_SNFFORMAT_TRUE@am__objects_4 = snfread.lo +am_libbitmap_la_OBJECTS = bitmap.lo bitmapfunc.lo bitmaputil.lo \ + bitscale.lo fontink.lo $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) libbitmap_la_OBJECTS = $(am_libbitmap_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -135,7 +146,7 @@ am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libbitmap_la_SOURCES) -DIST_SOURCES = $(libbitmap_la_SOURCES) +DIST_SOURCES = $(am__libbitmap_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ @@ -315,19 +326,9 @@ AM_CPPFLAGS = \ AM_CFLAGS = $(XFONT_CFLAGS) $(OS_CFLAGS) $(CWARNFLAGS) noinst_LTLIBRARIES = libbitmap.la -libbitmap_la_SOURCES = \ - bdfread.c \ - bdfutils.c \ - bitmap.c \ - bitmapfunc.c \ - bitmaputil.c \ - bitscale.c \ - fontink.c \ - pcfread.c \ - pcfwrite.c \ - snfread.c \ - snfstr.h - +libbitmap_la_SOURCES = bitmap.c bitmapfunc.c bitmaputil.c bitscale.c \ + fontink.c $(am__append_1) $(am__append_2) $(am__append_3) \ + $(am__append_4) all: all-am .SUFFIXES: diff --git a/libXfont/src/bitmap/bitmap.c b/libXfont/src/bitmap/bitmap.c index 1ceb4bb17..0a379eb08 100644 --- a/libXfont/src/bitmap/bitmap.c +++ b/libXfont/src/bitmap/bitmap.c @@ -36,8 +36,8 @@ in this Software without prior written authorization from The Open Group. #include <X11/fonts/bitmap.h> 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 */ { @@ -63,8 +63,12 @@ bitmapGetGlyphs(FontPtr pFont, unsigned long count, unsigned char *chars, case Linear8Bit: case TwoD8Bit: - if (pFont->info.firstRow > 0) + if (pFont->info.firstRow > 0) { + if (pDefault) + while (count--) + *glyphs++ = pDefault; break; + } if (pFont->info.allExist && pDefault) { while (count--) { c = (*chars++) - firstCol; @@ -126,8 +130,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/libXfont/src/bitmap/bitmapfunc.c b/libXfont/src/bitmap/bitmapfunc.c index 653ff5d55..049c39967 100644 --- a/libXfont/src/bitmap/bitmapfunc.c +++ b/libXfont/src/bitmap/bitmapfunc.c @@ -32,34 +32,25 @@ in this Software without prior written authorization from The Open Group. #include <config.h> #endif -/* - * Translate monolithic #defines to modular definitions - */ - -#ifdef PCFFORMAT -#define XFONT_PCFFORMAT 1 -#endif - -#ifdef SNFFORMAT -#define XFONT_SNFFORMAT 1 -#endif - -#ifdef BDFFORMAT -#define XFONT_BDFFORMAT 1 -#endif - #include <X11/fonts/fntfilst.h> #include <X11/fonts/bitmap.h> #include <X11/fonts/fontutil.h> +#if XFONT_BDFFORMAT #include <X11/fonts/bdfint.h> +#endif +#if XFONT_PCFFORMAT #include <X11/fonts/pcf.h> +#endif +#if XFONT_SNFFORMAT #include "snfstr.h" +#endif +#if XFONT_PCFFORMAT || XFONT_SNFFORMAT || XFONT_BDFFORMAT 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; @@ -108,8 +99,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 */ { @@ -153,7 +144,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; @@ -254,3 +245,11 @@ BitmapGetRenderIndex(FontRendererPtr renderer) { return renderer - renderers; } + +#else +void +BitmapRegisterFontFileFunctions (void) +{ + /* nothing to do */ +} +#endif /* XFONT_PCFFORMAT || XFONT_SNFFORMAT || XFONT_BDFFORMAT */ diff --git a/libXfont/src/bitmap/bitscale.c b/libXfont/src/bitmap/bitscale.c index 130dffd86..caeb96384 100644 --- a/libXfont/src/bitmap/bitscale.c +++ b/libXfont/src/bitmap/bitscale.c @@ -34,22 +34,6 @@ from The Open Group. #include <config.h> #endif -/* - * Translate monolithic #defines to modular definitions - */ - -#ifdef PCFFORMAT -#define XFONT_PCFFORMAT 1 -#endif - -#ifdef SNFFORMAT -#define XFONT_SNFFORMAT 1 -#endif - -#ifdef BDFFORMAT -#define XFONT_BDFFORMAT 1 -#endif - #include <X11/fonts/fntfilst.h> #include <X11/fonts/bitmap.h> #include <X11/fonts/fontutil.h> @@ -64,7 +48,7 @@ from The Open Group. #endif /* Should get this from elsewhere */ -extern unsigned long serverGeneration; +extern unsigned long __GetServerGeneration(void); static void bitmapUnloadScalable (FontPtr pFont); static void ScaleBitmap ( FontPtr pFont, CharInfoPtr opci, @@ -601,9 +585,9 @@ ComputeScaledProperties(FontInfoPtr sourceFontInfo, /* the font to be scaled */ char *isStringProp; int nProps; - if (bitscaleGeneration != serverGeneration) { + if (bitscaleGeneration != __GetServerGeneration()) { initFontPropTable(); - bitscaleGeneration = serverGeneration; + bitscaleGeneration = __GetServerGeneration(); } nProps = NPROPS + 1 + sizeof(fontPropTable) / sizeof(fontProp) + sizeof(rawFontPropTable) / sizeof(fontProp); @@ -755,6 +739,8 @@ compute_xform_matrix(FontScalablePtr vals, double dx, double dy, * ScaleFont * returns a pointer to the new scaled font, or NULL (due to AllocError). */ +#pragma GCC diagnostic ignored "-Wbad-function-cast" + static FontPtr ScaleFont(FontPtr opf, /* originating font */ double widthMult, /* glyphs width scale factor */ @@ -815,8 +801,6 @@ ScaleFont(FontPtr opf, /* originating font */ needs to be for the output font */ if (vals->nranges) { - int i; - pfi->allExist = 0; firstCol = 255; lastCol = 0; diff --git a/libXfont/src/bitmap/fontink.c b/libXfont/src/bitmap/fontink.c index ad7091fa6..f4898da10 100644 --- a/libXfont/src/bitmap/fontink.c +++ b/libXfont/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/libXfont/src/bitmap/snfstr.h b/libXfont/src/bitmap/snfstr.h index 148bb1fcc..8f39ded01 100644 --- a/libXfont/src/bitmap/snfstr.h +++ b/libXfont/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/libXfont/src/builtins/Makefile.in b/libXfont/src/builtins/Makefile.in index 03a53346a..0f03cc924 100644 --- a/libXfont/src/builtins/Makefile.in +++ b/libXfont/src/builtins/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/libXfont/src/builtins/builtin.h b/libXfont/src/builtins/builtin.h index 75dff8d85..f9a4cea27 100644 --- a/libXfont/src/builtins/builtin.h +++ b/libXfont/src/builtins/builtin.h @@ -54,9 +54,9 @@ extern const int builtin_dir_count; extern const BuiltinAliasRec builtin_alias[]; extern const int builtin_alias_count; -extern FontFilePtr BuiltinFileOpen (char *); +extern FontFilePtr BuiltinFileOpen (const char *); extern int BuiltinFileClose (BufFilePtr, int); -extern int BuiltinReadDirectory (char *, FontDirectoryPtr *); +extern int BuiltinReadDirectory (const char *, FontDirectoryPtr *); extern void BuiltinRegisterFontFileFunctions (void); extern void BuiltinRegisterFpeFunctions (void); diff --git a/libXfont/src/builtins/dir.c b/libXfont/src/builtins/dir.c index cd50cef56..2eb197d2b 100644 --- a/libXfont/src/builtins/dir.c +++ b/libXfont/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. @@ -149,7 +149,7 @@ BuiltinAliasesRestore (BuiltinAliasPtr a_cur_tab, } int -BuiltinReadDirectory (char *directory, FontDirectoryPtr *pdir) +BuiltinReadDirectory (const char *directory, FontDirectoryPtr *pdir) { FontDirectoryPtr dir; int i; @@ -195,7 +195,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/libXfont/src/builtins/file.c b/libXfont/src/builtins/file.c index 549253926..93527c127 100644 --- a/libXfont/src/builtins/file.c +++ b/libXfont/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,14 +83,14 @@ static int BuiltinClose (BufFilePtr f, int unused) { BuiltinIOPtr io = ((BuiltinIOPtr) f->private); - + free (io); return 1; } FontFilePtr -BuiltinFileOpen (char *name) +BuiltinFileOpen (const char *name) { int i; BuiltinIOPtr io; diff --git a/libXfont/src/builtins/fonts.c b/libXfont/src/builtins/fonts.c index 9a9d7d273..38921783d 100644 --- a/libXfont/src/builtins/fonts.c +++ b/libXfont/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/libXfont/src/builtins/fpe.c b/libXfont/src/builtins/fpe.c index 689f22a52..4f5d4cf7e 100644 --- a/libXfont/src/builtins/fpe.c +++ b/libXfont/src/builtins/fpe.c @@ -32,7 +32,7 @@ static int font_file_type; static const char builtin_fonts[] = "built-ins"; static int -BuiltinNameCheck (char *name) +BuiltinNameCheck (const char *name) { return (strcmp (name, builtin_fonts) == 0); } diff --git a/libXfont/src/builtins/render.c b/libXfont/src/builtins/render.c index 4d1048394..2be0053b9 100644 --- a/libXfont/src/builtins/render.c +++ b/libXfont/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/libXfont/src/fc/Makefile.in b/libXfont/src/fc/Makefile.in index 6663a417b..5200ab7e6 100644 --- a/libXfont/src/fc/Makefile.in +++ b/libXfont/src/fc/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/libXfont/src/fc/fsconvert.c b/libXfont/src/fc/fsconvert.c index 7a6033119..18b0c0d1c 100644 --- a/libXfont/src/fc/fsconvert.c +++ b/libXfont/src/fc/fsconvert.c @@ -643,7 +643,7 @@ _fs_unload_font(FontPtr pfont) FontPtr fs_create_font (FontPathElementPtr fpe, - char *name, + const char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask) diff --git a/libXfont/src/fc/fserve.c b/libXfont/src/fc/fserve.c index 1e1093cd5..92b0d53da 100644 --- a/libXfont/src/fc/fserve.c +++ b/libXfont/src/fc/fserve.c @@ -147,7 +147,7 @@ static void _fs_close_server (FSFpePtr conn); static FSFpePtr -_fs_init_conn (char *servername); +_fs_init_conn (const char *servername); static int _fs_wait_connect (FSFpePtr conn); @@ -235,7 +235,7 @@ _fs_add_rep_log (FSFpePtr conn, fsGenericReply *rep) #endif static Bool -fs_name_check(char *name) +fs_name_check(const char *name) { /* Just make sure there is a protocol/ prefix */ return (name && *name != '/' && strchr(name, '/')); @@ -293,7 +293,7 @@ static int fs_init_fpe(FontPathElementPtr fpe) { FSFpePtr conn; - char *name; + const char *name; int err; int ret; @@ -1615,7 +1615,7 @@ _fs_do_blocked (FSFpePtr conn) /* ARGSUSED */ static int fs_send_open_font(pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, + const char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *ppfont) { @@ -1633,7 +1633,7 @@ 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) + if (namelen < 0 || namelen > sizeof (buf) - 1) return BadFontName; /* @@ -1807,7 +1807,7 @@ fs_send_query_bitmaps(FontPathElementPtr fpe, FSBlockDataPtr blockrec) /* ARGSUSED */ static int fs_open_font(pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, + const char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *ppfont, char **alias, FontPtr non_cachable_font) @@ -2161,7 +2161,7 @@ fs_send_load_glyphs(pointer client, FontPtr pfont, } -extern pointer serverClient; /* This could be any number that +extern pointer __GetServerClient(void); /* This could be any number that doesn't conflict with existing client values. */ @@ -2333,17 +2333,17 @@ fs_load_all_glyphs(FontPtr pfont) * perform an unpleasant job that, we hope, will never be required. */ - while ((err = _fs_load_glyphs(serverClient, pfont, TRUE, 0, 0, NULL)) == + while ((err = _fs_load_glyphs(__GetServerClient(), pfont, TRUE, 0, 0, NULL)) == Suspended) { if (fs_await_reply (conn) != FSIO_READY) { /* Get rid of blockrec */ - fs_client_died(serverClient, pfont->fpe); + fs_client_died(__GetServerClient(), pfont->fpe); err = BadCharRange; break; } - fs_read_reply (pfont->fpe, serverClient); + fs_read_reply (pfont->fpe, __GetServerClient()); } return err; } @@ -2403,7 +2403,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, const char *pattern, int patlen, int maxnames, FontNamesPtr newnames) { FSFpePtr conn = (FSFpePtr) fpe->private; @@ -2459,7 +2459,7 @@ fs_send_list_fonts(pointer client, FontPathElementPtr fpe, char *pattern, static int fs_list_fonts(pointer client, FontPathElementPtr fpe, - char *pattern, int patlen, int maxnames, FontNamesPtr newnames) + const char *pattern, int patlen, int maxnames, FontNamesPtr newnames) { FSFpePtr conn = (FSFpePtr) fpe->private; FSBlockDataPtr blockrec; @@ -2630,7 +2630,7 @@ done: /* ARGSUSED */ static int fs_start_list_with_info(pointer client, FontPathElementPtr fpe, - char *pattern, int len, int maxnames, pointer *pdata) + const char *pattern, int len, int maxnames, pointer *pdata) { FSFpePtr conn = (FSFpePtr) fpe->private; FSBlockDataPtr blockrec; @@ -3362,7 +3362,7 @@ _fs_start_reconnect (FSFpePtr conn) static FSFpePtr -_fs_init_conn (char *servername) +_fs_init_conn (const char *servername) { FSFpePtr conn; diff --git a/libXfont/src/fc/fserve.h b/libXfont/src/fc/fserve.h index 5999861b6..502e201d5 100644 --- a/libXfont/src/fc/fserve.h +++ b/libXfont/src/fc/fserve.h @@ -72,7 +72,7 @@ typedef struct _fs_blocked_extents *FSBlockedExtentPtr; extern void _fs_convert_char_info ( fsXCharInfo *src, xCharInfo *dst ); extern void _fs_free_props (FontInfoPtr pfi); extern FontPtr fs_create_font (FontPathElementPtr fpe, - char *name, + const char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask); diff --git a/libXfont/src/fc/fslibos.h b/libXfont/src/fc/fslibos.h index c49f52e5b..c1f0eded2 100644 --- a/libXfont/src/fc/fslibos.h +++ b/libXfont/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 <sys/param.h> diff --git a/libXfont/src/fc/fstrans.c b/libXfont/src/fc/fstrans.c index 74a884e63..a96c0414b 100644 --- a/libXfont/src/fc/fstrans.c +++ b/libXfont/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 <config.h> #include <dix-config.h> diff --git a/libXfont/src/fontfile/Makefile.in b/libXfont/src/fontfile/Makefile.in index 91da64e99..527859c98 100644 --- a/libXfont/src/fontfile/Makefile.in +++ b/libXfont/src/fontfile/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/libXfont/src/fontfile/bitsource.c b/libXfont/src/fontfile/bitsource.c index 1b79c2bcb..c73f41f9c 100644 --- a/libXfont/src/fontfile/bitsource.c +++ b/libXfont/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/libXfont/src/fontfile/catalogue.c b/libXfont/src/fontfile/catalogue.c index d5721ab68..dbfb1cc25 100644 --- a/libXfont/src/fontfile/catalogue.c +++ b/libXfont/src/fontfile/catalogue.c @@ -41,7 +41,7 @@ static const char CataloguePrefix[] = "catalogue:"; static int CatalogueFreeFPE (FontPathElementPtr fpe); static int -CatalogueNameCheck (char *name) +CatalogueNameCheck (const char *name) { return strncmp(name, CataloguePrefix, sizeof(CataloguePrefix) - 1) == 0; } @@ -117,7 +117,7 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe) if (subfpe->refcount == 0) { FontFileFreeFPE (subfpe); - free(subfpe->name); + free((void *) subfpe->name); free(subfpe); } } @@ -160,6 +160,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) #ifndef _MSC_VER while (entry = readdir(dir), entry != NULL) { + char *name; snprintf(link, sizeof link, "%s/%s", path, entry->d_name); len = readlink(link, dest, sizeof dest - 1); if (len < 0) @@ -193,15 +194,16 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) * (which uses font->fpe->type) goes to CatalogueCloseFont. */ subfpe->type = fpe->type; subfpe->name_length = len; - subfpe->name = malloc (len + 1); - if (subfpe->name == NULL) + name = malloc (len + 1); + if (name == NULL) { free(subfpe); continue; } - memcpy(subfpe->name, dest, len); - subfpe->name[len] = '\0'; + memcpy(name, dest, len); + name[len] = '\0'; + subfpe->name = name; /* The X server will manipulate the subfpe ref counts * associated with the font in OpenFont and CloseFont, so we @@ -210,7 +212,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan) if (FontFileInitFPE (subfpe) != Successful) { - free(subfpe->name); + free((void *) subfpe->name); free(subfpe); continue; } @@ -283,7 +285,7 @@ CatalogueFreeFPE (FontPathElementPtr fpe) static int CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, - char *name, int namelen, + const char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *pFont, char **aliasName, FontPtr non_cachable_font) @@ -317,7 +319,7 @@ CatalogueCloseFont (FontPathElementPtr fpe, FontPtr pFont) } static int -CatalogueListFonts (pointer client, FontPathElementPtr fpe, char *pat, +CatalogueListFonts (pointer client, FontPathElementPtr fpe, const char *pat, int len, int max, FontNamesPtr names) { CataloguePtr cat = fpe->private; @@ -342,7 +344,7 @@ typedef struct _LFWIData { static int CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, pointer *privatep, + const char *pat, int len, int max, pointer *privatep, int mark_aliases) { CataloguePtr cat = fpe->private; @@ -378,7 +380,7 @@ CatalogueStartListFonts(pointer client, FontPathElementPtr fpe, static int CatalogueStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, + const char *pat, int len, int max, pointer *privatep) { return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 0); @@ -416,7 +418,7 @@ CatalogueListNextFontWithInfo(pointer client, FontPathElementPtr fpe, static int CatalogueStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, + const char *pat, int len, int max, pointer *privatep) { return CatalogueStartListFonts(client, fpe, pat, len, max, privatep, 1); diff --git a/libXfont/src/fontfile/dirfile.c b/libXfont/src/fontfile/dirfile.c index 639310c31..38ced7573 100644 --- a/libXfont/src/fontfile/dirfile.c +++ b/libXfont/src/fontfile/dirfile.c @@ -50,8 +50,10 @@ static int ReadFontAlias ( char *directory, Bool isFile, static int lexAlias ( FILE *file, char **lexToken ); static int lexc ( FILE *file ); +#pragma GCC diagnostic ignored "-Wformat-nonliteral" + int -FontFileReadDirectory (char *directory, FontDirectoryPtr *pdir) +FontFileReadDirectory (const char *directory, FontDirectoryPtr *pdir) { char file_name[MAXFONTFILENAMELEN]; char font_name[MAXFONTNAMELEN]; diff --git a/libXfont/src/fontfile/fontencc.c b/libXfont/src/fontfile/fontencc.c index 79977851d..4bdb495e1 100644 --- a/libXfont/src/fontfile/fontencc.c +++ b/libXfont/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/libXfont/src/fontfile/fontfile.c b/libXfont/src/fontfile/fontfile.c index 7372d3ece..55aa98d4d 100644..100755 --- a/libXfont/src/fontfile/fontfile.c +++ b/libXfont/src/fontfile/fontfile.c @@ -56,7 +56,7 @@ ISOLatin1ToLower(unsigned char source) } void -CopyISOLatin1Lowered(char *dest, char *source, int length) +CopyISOLatin1Lowered(char *dest, const char *source, int length) { int i; for (i = 0; i < length; i++, source++, dest++) @@ -68,9 +68,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); @@ -152,14 +152,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; } @@ -174,7 +174,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) { @@ -286,10 +286,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, + const 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; @@ -305,7 +305,7 @@ FontFileOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, Bool noSpecificSize; int nranges; fsRange *ranges; - + if (namelen >= MAXFONTNAMELEN) return AllocError; dir = (FontDirectoryPtr) fpe->private; @@ -543,8 +543,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) { @@ -561,7 +561,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) @@ -573,8 +573,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, @@ -582,7 +582,7 @@ FontFileOpenBitmap (FontPathElementPtr fpe, FontPtr *pFont, } static int -FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, +FontFileGetInfoBitmap (FontPathElementPtr fpe, FontInfoPtr pFontInfo, FontEntryPtr entry) { FontBitmapEntryPtr bitmap; @@ -603,8 +603,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) { @@ -720,8 +720,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, + const char *pat, int len, int max, FontNamesPtr names, int mark_aliases) { FontDirectoryPtr dir; @@ -827,15 +827,15 @@ typedef struct _LFWIData { } LFWIDataRec, *LFWIDataPtr; int -FontFileListFonts (pointer client, FontPathElementPtr fpe, char *pat, +FontFileListFonts (pointer client, FontPathElementPtr fpe, const 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, + const char *pat, int len, int max, pointer *privatep, int mark_aliases) { LFWIDataPtr data; @@ -865,8 +865,8 @@ FontFileStartListFonts(pointer client, FontPathElementPtr fpe, int -FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +FontFileStartListFontsWithInfo(pointer client, FontPathElementPtr fpe, + const char *pat, int len, int max, pointer *privatep) { return FontFileStartListFonts(client, fpe, pat, len, max, privatep, 0); @@ -874,8 +874,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; @@ -891,14 +891,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'; @@ -915,7 +915,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, tmpName.length = strlen(lowerName); entry = FontFileFindNameInDir (&dir->nonScalable, &tmpName); } - + if (entry) { switch (entry->type) { @@ -947,7 +947,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, { ret = BadFontName; } - + if (ret != BadFontName) { if (ranges) free(ranges); @@ -978,7 +978,7 @@ FontFileListOneFontWithInfo (pointer client, FontPathElementPtr fpe, tmpName.ndashes = entry->name.ndashes; } } - + if (entry) { noSpecificSize = FALSE; /* TRUE breaks XLFD enhancements */ @@ -1034,7 +1034,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)) { @@ -1070,8 +1070,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) { @@ -1099,15 +1099,15 @@ FontFileListNextFontWithInfo(pointer client, FontPathElementPtr fpe, } int -FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, - char *pat, int len, int max, +FontFileStartListFontsAndAliases(pointer client, FontPathElementPtr fpe, + const 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/libXfont/src/fontfile/fontscale.c b/libXfont/src/fontfile/fontscale.c index eb8d0bb58..bfaa7ec00 100644 --- a/libXfont/src/fontfile/fontscale.c +++ b/libXfont/src/fontfile/fontscale.c @@ -39,7 +39,7 @@ in this Software without prior written authorization from The Open Group. #endif Bool -FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, +FontFileAddScaledInstance (FontEntryPtr entry, FontScalablePtr vals, FontPtr pFont, char *bitmapName) { FontScalableEntryPtr scalable; @@ -79,7 +79,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++) @@ -377,12 +377,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/libXfont/src/fontfile/gunzip.c b/libXfont/src/fontfile/gunzip.c index 9fa3eed00..84a4eaf45 100644 --- a/libXfont/src/fontfile/gunzip.c +++ b/libXfont/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/libXfont/src/fontfile/renderers.c b/libXfont/src/fontfile/renderers.c index e17d6a77e..7c341f6d8 100644 --- a/libXfont/src/fontfile/renderers.c +++ b/libXfont/src/fontfile/renderers.c @@ -41,7 +41,7 @@ static FontRenderersRec renderers; * XXX Maybe should allow unregistering renders. For now, just clear the * list at each new generation. */ -extern unsigned long serverGeneration; +extern unsigned long __GetServerGeneration(void); static unsigned long rendererGeneration = 0; Bool @@ -56,8 +56,8 @@ FontFilePriorityRegisterRenderer (FontRendererPtr renderer, int priority) int i; struct _FontRenderersElement *new; - if (rendererGeneration != serverGeneration) { - rendererGeneration = serverGeneration; + if (rendererGeneration != __GetServerGeneration()) { + rendererGeneration = __GetServerGeneration(); renderers.number = 0; if (renderers.renderers) free(renderers.renderers); @@ -65,7 +65,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) { @@ -100,7 +100,7 @@ FontFileMatchRenderer (char *fileName) int i; int fileLen; FontRendererPtr r; - + fileLen = strlen (fileName); for (i = 0; i < renderers.number; i++) { diff --git a/libXfont/src/stubs/Makefile.am b/libXfont/src/stubs/Makefile.am index 23e3bd1c6..7eb16d41a 100644 --- a/libXfont/src/stubs/Makefile.am +++ b/libXfont/src/stubs/Makefile.am @@ -10,7 +10,6 @@ libstubs_la_SOURCES = \ csignal.c \ delfntcid.c \ errorf.c \ - fatalerror.c \ findoldfnt.c \ getcres.c \ getdefptsize.c \ @@ -22,4 +21,5 @@ libstubs_la_SOURCES = \ servclient.c \ setfntauth.c \ stfntcfnt.c \ + stubsinit.c \ stubs.h diff --git a/libXfont/src/stubs/Makefile.in b/libXfont/src/stubs/Makefile.in index 833bbe7ee..83336e1ac 100644 --- a/libXfont/src/stubs/Makefile.in +++ b/libXfont/src/stubs/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. @@ -93,9 +93,9 @@ CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libstubs_la_LIBADD = am_libstubs_la_OBJECTS = cauthgen.lo csignal.lo delfntcid.lo errorf.lo \ - fatalerror.lo findoldfnt.lo getcres.lo getdefptsize.lo \ - getnewfntcid.lo gettime.lo initfshdl.lo regfpefunc.lo \ - rmfshdl.lo servclient.lo setfntauth.lo stfntcfnt.lo + findoldfnt.lo getcres.lo getdefptsize.lo getnewfntcid.lo \ + gettime.lo initfshdl.lo regfpefunc.lo rmfshdl.lo servclient.lo \ + setfntauth.lo stfntcfnt.lo stubsinit.lo libstubs_la_OBJECTS = $(am_libstubs_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) @@ -321,7 +321,6 @@ libstubs_la_SOURCES = \ csignal.c \ delfntcid.c \ errorf.c \ - fatalerror.c \ findoldfnt.c \ getcres.c \ getdefptsize.c \ @@ -333,6 +332,7 @@ libstubs_la_SOURCES = \ servclient.c \ setfntauth.c \ stfntcfnt.c \ + stubsinit.c \ stubs.h all: all-am @@ -394,7 +394,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/csignal.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delfntcid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/errorf.Plo@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fatalerror.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/findoldfnt.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getcres.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getdefptsize.Plo@am__quote@ @@ -406,6 +405,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/servclient.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/setfntauth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stfntcfnt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stubsinit.Plo@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< diff --git a/libXfont/src/stubs/cauthgen.c b/libXfont/src/stubs/cauthgen.c index 026c52d17..10086e434 100644 --- a/libXfont/src/stubs/cauthgen.c +++ b/libXfont/src/stubs/cauthgen.c @@ -10,5 +10,6 @@ weak int client_auth_generation(ClientPtr client) { + OVERRIDE_SYMBOL(client_auth_generation, client); return 0; } diff --git a/libXfont/src/stubs/csignal.c b/libXfont/src/stubs/csignal.c index e6fdeae1b..dd88b3d36 100644 --- a/libXfont/src/stubs/csignal.c +++ b/libXfont/src/stubs/csignal.c @@ -10,5 +10,6 @@ weak Bool ClientSignal(ClientPtr client) { + OVERRIDE_SYMBOL(ClientSignal,client); return True; } diff --git a/libXfont/src/stubs/delfntcid.c b/libXfont/src/stubs/delfntcid.c index ca713286c..8113b9f29 100644 --- a/libXfont/src/stubs/delfntcid.c +++ b/libXfont/src/stubs/delfntcid.c @@ -10,4 +10,5 @@ weak void DeleteFontClientID(Font id) { + OVERRIDE_SYMBOL(DeleteFontClientID, id); } diff --git a/libXfont/src/stubs/errorf.c b/libXfont/src/stubs/errorf.c index fd32965a4..d2de6c64b 100644 --- a/libXfont/src/stubs/errorf.c +++ b/libXfont/src/stubs/errorf.c @@ -10,4 +10,5 @@ weak void ErrorF(const char *f, ...) { + OVERRIDE_VA_SYMBOL(VErrorF, f); } diff --git a/libXfont/src/stubs/fatalerror.c b/libXfont/src/stubs/fatalerror.c deleted file mode 100644 index 1549ad3ea..000000000 --- a/libXfont/src/stubs/fatalerror.c +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include "stubs.h" - -#ifdef __SUNPRO_C -#pragma weak FatalError -#endif - -weak void -FatalError(const char *f, ...) -{ -} diff --git a/libXfont/src/stubs/findoldfnt.c b/libXfont/src/stubs/findoldfnt.c index 7a0008409..c73279eb4 100644 --- a/libXfont/src/stubs/findoldfnt.c +++ b/libXfont/src/stubs/findoldfnt.c @@ -10,5 +10,6 @@ weak FontPtr find_old_font(FSID id) { + OVERRIDE_SYMBOL(find_old_font, id); return (FontPtr)NULL; } diff --git a/libXfont/src/stubs/getcres.c b/libXfont/src/stubs/getcres.c index 0b98f46e3..27a918080 100644 --- a/libXfont/src/stubs/getcres.c +++ b/libXfont/src/stubs/getcres.c @@ -10,5 +10,6 @@ weak FontResolutionPtr GetClientResolutions(int *num) { + OVERRIDE_SYMBOL(GetClientResolutions, num); return (FontResolutionPtr) 0; } diff --git a/libXfont/src/stubs/getdefptsize.c b/libXfont/src/stubs/getdefptsize.c index 0b9e40999..50c1b182c 100644 --- a/libXfont/src/stubs/getdefptsize.c +++ b/libXfont/src/stubs/getdefptsize.c @@ -10,5 +10,6 @@ weak int GetDefaultPointSize(void) { + OVERRIDE_SYMBOL(GetDefaultPointSize); return 0; } diff --git a/libXfont/src/stubs/getnewfntcid.c b/libXfont/src/stubs/getnewfntcid.c index e2fe8bb15..d31ccf111 100644 --- a/libXfont/src/stubs/getnewfntcid.c +++ b/libXfont/src/stubs/getnewfntcid.c @@ -10,5 +10,6 @@ weak Font GetNewFontClientID(void) { + OVERRIDE_SYMBOL(GetNewFontClientID); return (Font)0; } diff --git a/libXfont/src/stubs/gettime.c b/libXfont/src/stubs/gettime.c index 7b2d3b34c..1b20f62a4 100644 --- a/libXfont/src/stubs/gettime.c +++ b/libXfont/src/stubs/gettime.c @@ -10,5 +10,6 @@ weak unsigned long GetTimeInMillis (void) { + OVERRIDE_SYMBOL(GetTimeInMillis); return 0; } diff --git a/libXfont/src/stubs/initfshdl.c b/libXfont/src/stubs/initfshdl.c index a14dafffc..e1c0b2454 100644 --- a/libXfont/src/stubs/initfshdl.c +++ b/libXfont/src/stubs/initfshdl.c @@ -11,5 +11,6 @@ weak int init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) { + OVERRIDE_SYMBOL(init_fs_handlers, fpe, block_handler); return Successful; } diff --git a/libXfont/src/stubs/regfpefunc.c b/libXfont/src/stubs/regfpefunc.c index a79b4bf92..ae12a011d 100644 --- a/libXfont/src/stubs/regfpefunc.c +++ b/libXfont/src/stubs/regfpefunc.c @@ -7,22 +7,26 @@ #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) { + OVERRIDE_SYMBOL(RegisterFPEFunctions, name_func, init_func, free_func, + reset_func, open_func, close_func, list_func, start_lfwi_func, + next_lfwi_func, wakeup_func, client_died, load_glyphs, + start_list_alias_func, next_list_alias_func, set_path_func); return 0; } diff --git a/libXfont/src/stubs/rmfshdl.c b/libXfont/src/stubs/rmfshdl.c index d0bdd3d98..22a30916c 100644 --- a/libXfont/src/stubs/rmfshdl.c +++ b/libXfont/src/stubs/rmfshdl.c @@ -7,9 +7,10 @@ #pragma weak remove_fs_handlers #endif -weak void +weak void remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr blockHandler, Bool all) { + OVERRIDE_SYMBOL(remove_fs_handlers, fpe, blockHandler, all); } diff --git a/libXfont/src/stubs/servclient.c b/libXfont/src/stubs/servclient.c index 9b6cebb3f..f85e08eb1 100644 --- a/libXfont/src/stubs/servclient.c +++ b/libXfont/src/stubs/servclient.c @@ -8,3 +8,12 @@ #endif weak void *serverClient = 0; + +void *__GetServerClient(void); + +void * +__GetServerClient(void) +{ + OVERRIDE_DATA(serverClient); + return serverClient; +} diff --git a/libXfont/src/stubs/setfntauth.c b/libXfont/src/stubs/setfntauth.c index 0c7ecccde..371807e7a 100644 --- a/libXfont/src/stubs/setfntauth.c +++ b/libXfont/src/stubs/setfntauth.c @@ -10,5 +10,6 @@ weak int set_font_authorizations(char **authorizations, int *authlen, ClientPtr client) { + OVERRIDE_SYMBOL(set_font_authorizations, authorizations, authlen, client); return 0; } diff --git a/libXfont/src/stubs/stfntcfnt.c b/libXfont/src/stubs/stfntcfnt.c index 5fc17452f..d490988c5 100644 --- a/libXfont/src/stubs/stfntcfnt.c +++ b/libXfont/src/stubs/stfntcfnt.c @@ -10,5 +10,6 @@ weak int StoreFontClientFont(FontPtr pfont, Font id) { + OVERRIDE_SYMBOL(StoreFontClientFont, pfont, id); return 0; } diff --git a/libXfont/src/stubs/stubs.h b/libXfont/src/stubs/stubs.h index 7f0eef298..7d499d5b6 100644 --- a/libXfont/src/stubs/stubs.h +++ b/libXfont/src/stubs/stubs.h @@ -19,6 +19,54 @@ #endif #endif +#if defined(NO_WEAK_SYMBOLS) && defined(PIC) +#include <stdarg.h> +extern int _font_init_stubs(void); +#define OVERRIDE_DATA(sym) \ + _font_init_stubs(); \ + if (__ptr_##sym && __ptr_##sym != &sym) \ + sym = *__ptr_##sym +#define OVERRIDE_SYMBOL(sym,...) \ + _font_init_stubs(); \ + if (__##sym && __##sym != sym) \ + return (*__##sym)(__VA_ARGS__) +#define OVERRIDE_VA_SYMBOL(sym,f) \ + va_list _args; \ + _font_init_stubs(); \ + va_start(_args, f); \ + if (__##sym) \ + (*__##sym)(f, _args); \ + va_end(_args) + +int (*__client_auth_generation)(ClientPtr); +Bool (*__ClientSignal)(ClientPtr); +void (*__DeleteFontClientID)(Font); +void (*__VErrorF)(const char *, va_list); +FontPtr (*__find_old_font)(FSID); +FontResolutionPtr (*__GetClientResolutions)(int *); +int (*__GetDefaultPointSize)(void); +Font (*__GetNewFontClientID)(void); +unsigned long (*__GetTimeInMillis)(void); +int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr); +int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc, + ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc, + StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc, + LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc); +void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool); +void **__ptr_serverClient; +int (*__set_font_authorizations)(char **, int *, ClientPtr); +int (*__StoreFontClientFont)(FontPtr, Font); +Atom (*__MakeAtom)(const char *, unsigned, int); +int (*__ValidAtom)(Atom); +char *(*__NameForAtom)(Atom); +unsigned long *__ptr_serverGeneration; +void (*__register_fpe_functions)(void); +#else /* NO_WEAK_SYMBOLS && PIC */ +#define OVERRIDE_DATA(sym) +#define OVERRIDE_SYMBOL(sym,...) +#define OVERRIDE_VA_SYMBOL(sym,f) +#endif + /* This is really just a hack for now... __APPLE__ really should be using * the weak symbols route above, but it's causing an as-yet unresolved issue, * so we're instead building with flat_namespace. @@ -29,13 +77,12 @@ #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); extern void ErrorF(const char *format, ...); -extern void FatalError(const char *format, ...); /* end of file */ diff --git a/libXfont/src/stubs/stubsinit.c b/libXfont/src/stubs/stubsinit.c new file mode 100644 index 000000000..fc52332b1 --- /dev/null +++ b/libXfont/src/stubs/stubsinit.c @@ -0,0 +1,82 @@ +#include "stubs.h" + +#if defined(NO_WEAK_SYMBOLS) && defined(PIC) + +#ifdef WIN32 +#include <X11/Xwindows.h> +#define DLOPEN_SELF() GetModuleHandle(NULL) +#define DLSYM(h,f) GetProcAddress(h,f) +#else +#include <dlfcn.h> +#define DLOPEN_SELF() dlopen(NULL, RTLD_LOCAL) +#define DLSYM(h,f) dlsym(h, f) +#endif + +int (*__client_auth_generation)(ClientPtr) = NULL; +Bool (*__ClientSignal)(ClientPtr) = NULL; +void (*__DeleteFontClientID)(Font) = NULL; +void (*__VErrorF)(const char *, va_list) = NULL; +FontPtr (*__find_old_font)(FSID) = NULL; +FontResolutionPtr (*__GetClientResolutions)(int *) = NULL; +int (*__GetDefaultPointSize)(void) = NULL; +Font (*__GetNewFontClientID)(void) = NULL; +unsigned long (*__GetTimeInMillis)(void) = NULL; +int (*__init_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr) = NULL; +int (*__RegisterFPEFunctions)(NameCheckFunc, InitFpeFunc, FreeFpeFunc, + ResetFpeFunc, OpenFontFunc, CloseFontFunc, ListFontsFunc, + StartLfwiFunc, NextLfwiFunc, WakeupFpeFunc, ClientDiedFunc, + LoadGlyphsFunc, StartLaFunc, NextLaFunc, SetPathFunc) = NULL; +void (*__remove_fs_handlers)(FontPathElementPtr, BlockHandlerProcPtr, Bool) = NULL; +void **__ptr_serverClient = NULL; +int (*__set_font_authorizations)(char **, int *, ClientPtr) = NULL; +int (*__StoreFontClientFont)(FontPtr, Font) = NULL; +Atom (*__MakeAtom)(const char *, unsigned, int) = NULL; +int (*__ValidAtom)(Atom) = NULL; +char *(*__NameForAtom)(Atom) = NULL; +unsigned long *__ptr_serverGeneration = NULL; +void (*__register_fpe_functions)(void) = NULL; + +#define INIT_SYMBOL(sym) \ + if (!__##sym) \ + __##sym = (typeof(__##sym)) DLSYM(handle, #sym) +#define INIT_DATA(sym) \ + if (!__ptr_##sym) \ + __ptr_##sym = (typeof(__ptr_##sym)) DLSYM(handle, #sym) + +int +_font_init_stubs (void) +{ + static int inited = FALSE; + static void *handle = NULL; + + if (inited) + return inited; + if (!handle) + handle = DLOPEN_SELF(); + + INIT_SYMBOL(client_auth_generation); + INIT_SYMBOL(ClientSignal); + INIT_SYMBOL(DeleteFontClientID); + INIT_SYMBOL(VErrorF); + INIT_SYMBOL(find_old_font); + INIT_SYMBOL(GetClientResolutions); + INIT_SYMBOL(GetDefaultPointSize); + INIT_SYMBOL(GetNewFontClientID); + INIT_SYMBOL(GetTimeInMillis); + INIT_SYMBOL(init_fs_handlers); + INIT_SYMBOL(RegisterFPEFunctions); + INIT_SYMBOL(remove_fs_handlers); + INIT_SYMBOL(set_font_authorizations); + INIT_SYMBOL(StoreFontClientFont); + INIT_SYMBOL(MakeAtom); + INIT_SYMBOL(ValidAtom); + INIT_SYMBOL(NameForAtom); + INIT_SYMBOL(register_fpe_functions); + INIT_DATA(serverClient); + INIT_DATA(serverGeneration); + + inited = TRUE; + return inited; +} + +#endif /* NO_WEAK_SYMBOLS && PIC */ diff --git a/libXfont/src/util/Makefile.in b/libXfont/src/util/Makefile.in index a1675f9d9..2b2c721d8 100644 --- a/libXfont/src/util/Makefile.in +++ b/libXfont/src/util/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.14 from Makefile.am. +# Makefile.in generated by automake 1.14.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 Free Software Foundation, Inc. diff --git a/libXfont/src/util/atom.c b/libXfont/src/util/atom.c index 37811f91e..5f7f1c66d 100644 --- a/libXfont/src/util/atom.c +++ b/libXfont/src/util/atom.c @@ -158,6 +158,8 @@ MakeAtom(const char *string, unsigned len, int makeit) int h = 0; int r; + OVERRIDE_SYMBOL(MakeAtom, string, len, makeit); + hash = Hash (string, len); if (hashTable) { @@ -230,6 +232,7 @@ MakeAtom(const char *string, unsigned len, int makeit) weak int ValidAtom(Atom atom) { + OVERRIDE_SYMBOL(ValidAtom, atom); return (atom != None) && (atom <= lastAtom); } @@ -240,6 +243,7 @@ ValidAtom(Atom atom) weak char * NameForAtom(Atom atom) { + OVERRIDE_SYMBOL(NameForAtom, atom); if (atom != None && atom <= lastAtom) return reverseMap[atom]->name; return NULL; diff --git a/libXfont/src/util/fontaccel.c b/libXfont/src/util/fontaccel.c index c5915dba9..db03e73b5 100644 --- a/libXfont/src/util/fontaccel.c +++ b/libXfont/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/libXfont/src/util/fontutil.c b/libXfont/src/util/fontutil.c index 22f6119ae..2c5ea6f3b 100644 --- a/libXfont/src/util/fontutil.c +++ b/libXfont/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/libXfont/src/util/format.c b/libXfont/src/util/format.c index f5424fe41..c1f9762fa 100644 --- a/libXfont/src/util/format.c +++ b/libXfont/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 <X11/fonts/fontutil.h> 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/libXfont/src/util/miscutil.c b/libXfont/src/util/miscutil.c index 3d802d2f5..631748f67 100644 --- a/libXfont/src/util/miscutil.c +++ b/libXfont/src/util/miscutil.c @@ -45,14 +45,22 @@ from The Open Group. extern void BuiltinRegisterFpeFunctions(void); -#ifndef NO_WEAK_SYMBOLS /* make sure everything initializes themselves at least once */ -weak unsigned long serverGeneration = 1; -#endif +extern unsigned long serverGeneration; + +unsigned long __GetServerGeneration (void); + +unsigned long +__GetServerGeneration (void) +{ + OVERRIDE_DATA(serverGeneration); + return serverGeneration; +} weak void register_fpe_functions (void) { + OVERRIDE_SYMBOL(register_fpe_functions); BuiltinRegisterFpeFunctions(); FontFileRegisterFpeFunctions(); #ifdef XFONT_FC diff --git a/libXfont/src/util/patcache.c b/libXfont/src/util/patcache.c index 548105a00..210101584 100644 --- a/libXfont/src/util/patcache.c +++ b/libXfont/src/util/patcache.c @@ -50,7 +50,7 @@ typedef unsigned char EntryPtr; typedef struct _FontPatternCacheEntry { struct _FontPatternCacheEntry *next, **prev; short patlen; - char *pattern; + const char *pattern; int hash; FontPtr pFont; /* associated font */ } FontPatternCacheEntryRec, *FontPatternCacheEntryPtr; @@ -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++) @@ -74,7 +74,7 @@ EmptyFontPatternCache (FontPatternCachePtr cache) cache->entries[i].next = &cache->entries[i+1]; cache->entries[i].prev = 0; cache->entries[i].pFont = 0; - free (cache->entries[i].pattern); + free ((void *) cache->entries[i].pattern); cache->entries[i].pattern = 0; cache->entries[i].patlen = 0; } @@ -107,7 +107,7 @@ FreeFontPatternCache (FontPatternCachePtr cache) int i; for (i = 0; i < NENTRIES; i++) - free (cache->entries[i].pattern); + free ((void *) cache->entries[i].pattern); free (cache); } @@ -127,9 +127,9 @@ Hash (const char *string, int len) /* add entry */ void -CacheFontPattern (FontPatternCachePtr cache, - char *pattern, - int patlen, +CacheFontPattern (FontPatternCachePtr cache, + const char *pattern, + int patlen, FontPtr pFont) { FontPatternCacheEntryPtr e; @@ -154,7 +154,7 @@ CacheFontPattern (FontPatternCachePtr cache, if (e->next) e->next->prev = e->prev; *e->prev = e->next; - free (e->pattern); + free ((void *) e->pattern); } /* set pattern */ memcpy (newpat, pattern, patlen); @@ -173,8 +173,8 @@ CacheFontPattern (FontPatternCachePtr cache, /* find matching entry */ FontPtr -FindCachedFontPattern (FontPatternCachePtr cache, - char *pattern, +FindCachedFontPattern (FontPatternCachePtr cache, + const char *pattern, int patlen) { int hash; @@ -195,7 +195,7 @@ FindCachedFontPattern (FontPatternCachePtr cache, } void -RemoveCachedFontPattern (FontPatternCachePtr cache, +RemoveCachedFontPattern (FontPatternCachePtr cache, FontPtr pFont) { FontPatternCacheEntryPtr e; @@ -211,7 +211,7 @@ RemoveCachedFontPattern (FontPatternCachePtr cache, *e->prev = e->next; e->next = cache->free; cache->free = e; - free (e->pattern); + free ((void *) e->pattern); e->pattern = 0; } } diff --git a/libXfont/src/util/private.c b/libXfont/src/util/private.c index 36715b1fa..e55e19368 100644 --- a/libXfont/src/util/private.c +++ b/libXfont/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/libXfont/src/util/utilbitmap.c b/libXfont/src/util/utilbitmap.c index 619f72eaa..3790365ee 100644..100755 --- a/libXfont/src/util/utilbitmap.c +++ b/libXfont/src/util/utilbitmap.c @@ -38,8 +38,8 @@ in this Software without prior written authorization from The Open Group. */ 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; @@ -47,33 +47,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; |