diff --git a/BUILD b/BUILD index f0761bdff..ccaa15b36 100644 --- a/BUILD +++ b/BUILD @@ -151,7 +151,7 @@ II. COMMAND-LINE COMPILATION: if you encounter this problem. Note that the release version will use Autoconf to detect everything - on UNix, so this will not be necessary !! + on Unix, so this will not be necessary !! II. DETAILED COMPILATION PROCEDURE: @@ -160,46 +160,31 @@ II. DETAILED COMPILATION PROCEDURE: If you don't want to compile FreeType 2 from the command-line (for example from a graphical IDE on a Mac or Windows), you'll need to understand how the FreeType files are organized. - - First of all, all configuration files are located in "freetype2/config", - with system-specific overrides in "freetype2/config/". You should - always place "config/" and "config" in your compilation include - path, **in this order** - - Also, place the directory "include" in the compilation include path, as - well as "src/base" and "src/shared" - - Now, FreeType 2 is a very modular design, made of several distinct components. - Each component can be compiler either as a stand-alone object file, or as a - list of independent objects. - - For example, the "base layer" is made of the following independent source - files: - - freetype2/ - src/ - base/ - ftcalc.c - ftdebug.c - ftextend.c - ftlist.c - ftobjs.c - ftstream.c - ftraster.c - ftoutln.c - ftsystem.c - You can compile each of these files separately. + FreeType 2 has a very module design, and it is made of several components. + Each component must be compiled as a stand-alone object file, even when it + is really made of several C source files. For example, the "base layer" + component is made of the following C files: - Another method is to compile the file "src/base/ftbase.c" which performs - a simple include on all these individual files. This will compile the whole - base layer as a single object file. + src/ + base/ + ftcalc.c - computations + ftobjs.c - object management + ftstream.c - stream input + ftlist.c - simple list management + ftoutln.c - simple outline processing + ftextend.c - extensions support - Note that through careful macro definitions, compiling a module as a single - component avoids the generation of many externals (that really correspond - to intra-module dependencies) and provides greater optimisations - opportunities. + However, you can create a single object file by compiling the file + "src/base/ftbase.c", whose content is: + #include + #include + #include + #include + #include + #include + Similarly, each component has a single "englobing" C file to compile it as a stand-alone object, i.e. : @@ -209,9 +194,39 @@ II. DETAILED COMPILATION PROCEDURE: src/truetype/truetype.c - the TrueType font driver src/type1/type1.c - the Type 1 font driver - Now, you can decide how to compile each module, and add the corresponding - object files to your library.. - - The directory "freetype2/include" contains all public header files that - may be included by client applications.. + + To compile one component, do the following: + + - add the top-level "include" directory to your compilation include path + + - add the component's path to your compilation include path too. Being + in the component's directory isn't enough !! + + - compile the component "source" file (see list below). + + For example, the following line can be used to compile the truetype driver + on Unix: + + cd freetype2/ + cc -c -Iinclude -Isrc/truetype src/truetype/truetype.c + + Alternatively: + + cd freetype2/src/truetype + cc -c -I../../include -I. src/truetype/truetype.c + + The complete list of files to compile for a feature-complete build of + FreeType 2 is: + + src/base/ftsystem.c - system-specific memory and i/o support + src/base/ftinit.c - initialisation layer + src/base/ftdebug.c - debugging component (empty in release build) + src/base/ftbase.c - the "base layer" component + src/base/ftraster.c - the standard raster (scan-converter) + src/base/ftgrays.c - the smooth raster (anti-aliased only) + src/base/ftglyph.c - optional convenience functions + src/sfnt/sfnt.c - the "sfnt" module + src/psnames/psnames.c - the "psnames" module + src/truetype/truetype.c - the TrueType font driver + src/type1/type1.c - the Type 1 font driver diff --git a/CHANGES b/CHANGES index 7a471a2fe..4a568bd22 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,29 @@ LATEST CHANGES - + - light update/cleaning of the build system + changes to the sources in + order to get rid of _all_ compiler warnings with three compilers, i.e: + + gcc with "-ansi -pedantic -Wall -W", Visual C++ with "/W3 /WX" + and LCC + + IMPORTANT NOTE FOR WIN32-LCC USERS: + | + | It seems the C pre-processor that comes with LCC is broken, it + | doesn't recognize the ANSI standard directives # and ## correctly + | when one of the argument is a macro. Also, something like: + | + | #define F(x) print##x + | + | F(("hello")) + | + | will get incorrectly translated to: + | + | print "hello") + | + | by its pre-processor. For this reason, you simply cannot build + | FreeType 2 in debug mode with this compiler.. + + - yet another massive grunt work. I've changed the definition of the EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take an argument, which is the function's return value type. @@ -27,6 +51,7 @@ LATEST CHANGES - a different signature). - updated the tutorial (not finished though). + - updated the top-level BUILD document - added the declaration of FT_New_Memory_Face in , as it was missing from the public header (the implementation was already diff --git a/config/detect.mk b/config/detect.mk index 6303ee236..74914e4eb 100644 --- a/config/detect.mk +++ b/config/detect.mk @@ -17,16 +17,16 @@ # the following variables: # # BUILD The configuration and system-specific directory. Usually -# `freetype/config/$(PLATFORM)' but can be different if a -# specific compiler has been requested on the command line. +# `freetype/config/$(PLATFORM)' but can be different for +# custom builds of the library. # # The following variables must be defined in system specific `detect.mk' # files: # # PLATFORM The detected platform. This will default to `ansi' if # auto-detection fails. -# CONFIG_FILE The Makefile to use. This usually depends on the compiler -# defined in the `CC' environment variable. +# CONFIG_FILE The configuration sub-makefile to use. This usually depends +# on the compiler defined in the `CC' environment variable. # DELETE The shell command used to remove a given file. # COPY The shell command used to copy one file. # SEP The platform-specific directory separator. @@ -44,7 +44,7 @@ TOP := . endif # Set auto-detection default to `ansi'. -# Note that we delay the evaluation of $(CONFIG_), $(BUILD), and +# Note that we delay the evaluation of $(BUILD_CONFIG_), $(BUILD), and # $(CONFIG_RULES). # PLATFORM := ansi @@ -52,9 +52,9 @@ DELETE := $(RM) COPY := cp SEP := / -CONFIG_ = $(TOP)$(SEP)config$(SEP) -BUILD = $(CONFIG_)$(PLATFORM) -CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE) +BUILD_CONFIG_ = $(TOP)$(SEP)config$(SEP) +BUILD = $(BUILD_CONFIG_)$(PLATFORM) +CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE) # We define the BACKSLASH variable to hold a single back-slash character. # This is needed because a line like @@ -74,7 +74,7 @@ BACKSLASH := $(strip \ ) # directories. Note that the calling order of the various `detect.mk' files # isn't predictable. # -include $(wildcard $(CONFIG_)*/detect.mk) +include $(wildcard $(BUILD_CONFIG_)*/detect.mk) # In case no detection rule file was successful, use the default. # @@ -86,7 +86,7 @@ endif # The following targets are equivalent, with the exception that they use # slightly different syntaxes for the `echo' command. # -# std_setup: defined for most platforms +# std_setup: defined for most (i.e. Unix-like) platforms # dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2 # .PHONY: std_setup dos_setup diff --git a/config/dos/detect.mk b/config/dos/detect.mk index 32694387a..e491e9e68 100644 --- a/config/dos/detect.mk +++ b/config/dos/detect.mk @@ -13,11 +13,6 @@ # fully. -# This configuration file to be used depends on the value of the CC -# environment variable which is set below according to the compiler name -# given as a parameter to make. - - # We test for the COMSPEC environment variable, then run the `ver' # command-line program to see if its output contains the word `Dos'. # diff --git a/config/os2/detect.mk b/config/os2/detect.mk index f16c8011b..24d8ec880 100644 --- a/config/os2/detect.mk +++ b/config/os2/detect.mk @@ -13,11 +13,6 @@ # fully. -# This configuration file to be used depends on the value of the CC -# environment variable which is set below according to the compiler name -# given as a parameter to make. - - ifeq ($(PLATFORM),ansi) ifdef OS2_SHELL diff --git a/config/unix/detect.mk b/config/unix/detect.mk index 2ce47e5e5..28a5f346a 100644 --- a/config/unix/detect.mk +++ b/config/unix/detect.mk @@ -13,7 +13,7 @@ # fully. -# This will probably change a lost in the future if we are going to use +# This will probably change a lot in the future if we are going to use # Automake/Autoconf... diff --git a/config/win32/detect.mk b/config/win32/detect.mk index ea9583c56..cd777fbdc 100644 --- a/config/win32/detect.mk +++ b/config/win32/detect.mk @@ -13,11 +13,6 @@ # fully. -# This configuration file to be used depends on the value of the CC -# environment variable which is set below according to the compiler name -# given as a parameter to make. - - ifeq ($(PLATFORM),ansi) # Detecting Windows NT is easy, as the OS variable must be defined and diff --git a/config/win32/w32-lcc.mk b/config/win32/w32-lcc.mk index 69c395fa1..828d457c4 100644 --- a/config/win32/w32-lcc.mk +++ b/config/win32/w32-lcc.mk @@ -128,7 +128,7 @@ distclean_freetype: distclean_freetype_dos DIR_OBJ := $(subst /,\\,$(OBJ_DIR)) $(FT_LIBRARY): $(OBJECTS_LIST) - lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<) + lcclnk -o $(subst /,\\,$@) $(subst /,\\,$(OBJECTS_LIST)) endif diff --git a/demos/Makefile b/demos/Makefile index 9c090acb9..d6ca82718 100644 --- a/demos/Makefile +++ b/demos/Makefile @@ -84,6 +84,7 @@ else LINK = $(CC) $T$@ $< $(FTLIB) $(EFENCE) $(LDFLAGS) COMMON_LINK = $(LINK) $(COMMON_OBJ) GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB) + GRAPH_LINK2 = $(GRAPH_LINK) $(EXTRA_GRAPH_OBJS) .PHONY: exes clean distclean @@ -187,6 +188,8 @@ else $(OBJ_)ftgrays2.$O: $(SRC_DIR_)ftgrays2.c $(COMPILE) $T$@ $< + EXTRA_GRAPH_OBJS := $(OBJ_)ftrast.$O $(OBJ_)ftrast2.$O + $(OBJ_)ftrast.$O: $(SRC_DIR_)ftrast.c $(COMPILE) $T$@ $< @@ -268,7 +271,7 @@ else $(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O - $(GRAPH_LINK) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O + $(GRAPH_LINK2) $(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(GRAPH_LINK) diff --git a/demos/graph/win32/rules.mk b/demos/graph/win32/rules.mk index 0bccf839c..d02ceebeb 100644 --- a/demos/graph/win32/rules.mk +++ b/demos/graph/win32/rules.mk @@ -46,6 +46,7 @@ LINK_ROOT = lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<) LINK = $(LINK_ROOT) $(subst /,\\,$(FTLIB)) COMMON_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(FTLIB)) GRAPH_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(GRAPH_LIB)) $(subst /,\\,$(FTLIB)) +GRAPH_LINK2 = $(GRAPH_LINK) $(subst /,\\,$(EXTRA_GRAPH_OBJS)) endif endif diff --git a/demos/src/ftrast.c b/demos/src/ftrast.c index 267261de6..99ce1d737 100644 --- a/demos/src/ftrast.c +++ b/demos/src/ftrast.c @@ -257,14 +257,6 @@ (( sizeof(TProfile)+sizeof(long)-1 ) / sizeof(long)) - /* Left fill bitmask */ - static const Byte LMask[8] = - { 0xFF, 0x7F, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x01 }; - - /* Right fill bitmask */ - static const Byte RMask[8] = - { 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE, 0xFF }; - #ifdef TT_STATIC_RASTER @@ -1815,7 +1807,7 @@ { Long pitch = ras.target.pitch; - (void)max; + UNUSED(max); ras.traceIncr = (Short)- pitch; ras.traceOfs = - *min * pitch; @@ -1838,9 +1830,9 @@ Byte f1, f2; Byte* target; - (void)y; - (void)left; - (void)right; + UNUSED(y); + UNUSED(left); + UNUSED(right); /* Drop-out control */ @@ -2015,9 +2007,9 @@ static void Horizontal_Sweep_Init( RAS_ARGS Short* min, Short* max ) { /* nothing, really */ - (void)raster; - (void)min; - (void)max; + UNUSED(raster); + UNUSED(min); + UNUSED(max); } @@ -2031,8 +2023,8 @@ PByte bits; Byte f1; - (void)left; - (void)right; + UNUSED(left); + UNUSED(right); if ( x2-x1 < ras.precision ) { @@ -2173,7 +2165,7 @@ static void Horizontal_Sweep_Step( RAS_ARG ) { /* Nothing, really */ - (void)raster; + UNUSED(raster); } @@ -2285,12 +2277,12 @@ PProfile right ) { /* nothing, really */ - (void)raster; - (void)y; - (void)x1; - (void)x2; - (void)left; - (void)right; + UNUSED(raster); + UNUSED(y); + UNUSED(x1); + UNUSED(x2); + UNUSED(left); + UNUSED(right); } static void Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y, diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index 55c2e9082..600337e83 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -95,6 +95,13 @@ #define FT_ALIGNMENT 8 +/* UNUSED is a macro used to indicate that a given parameter is not used */ +/* this is only used to get rid of unpleasant compiler warnings.. */ +#ifndef UNUSED +#define UNUSED( arg ) ( (arg)=(arg) ) +#endif + + /*************************************************************************/ /* */ diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index ef715ff44..3a7533023 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -170,7 +170,7 @@ /* Don't define any of these macros to compile in `release' mode. */ /* */ #undef FT_DEBUG_LEVEL_ERROR -#define FT_DEBUG_LEVEL_TRACE +#undef FT_DEBUG_LEVEL_TRACE /*************************************************************************/ diff --git a/include/freetype/internal/ftdebug.h b/include/freetype/internal/ftdebug.h index 97bdfd671..6e0927357 100644 --- a/include/freetype/internal/ftdebug.h +++ b/include/freetype/internal/ftdebug.h @@ -51,6 +51,11 @@ #endif +/* A very stupid pre-processor trick. See K&R version 2 */ +/* section A12.3 for details.. */ +#define FT_CAT(x,y) x ## y +#define FT_XCAT(x,y) FT_CAT(x,y) + #ifdef FT_DEBUG_LEVEL_TRACE @@ -78,15 +83,6 @@ trace_ttextend, trace_ttdriver, -#if 0 - /* define an enum for each TrueDoc driver component */ - trace_tdobjs, - trace_tdload, - trace_tdgload, - trace_tdhint, - trace_tddriver, -#endif - /* define an enum for each Type1 driver component */ trace_t1objs, trace_t1load, @@ -120,7 +116,7 @@ do \ { \ if ( ft_trace_levels[FT_COMPONENT] >= level ) \ - FT_Message##varformat; \ + FT_XCAT( FT_Message, varformat ); \ } while ( 0 ) @@ -174,7 +170,7 @@ /* print a message and exit */ EXPORT_DEF(void) FT_Panic ( const char* fmt, ... ); -#define FT_ERROR( varformat ) FT_Message##varformat +#define FT_ERROR(varformat) do { FT_XCAT( FT_Message, varformat ) } while(0) #endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index b0fb802d1..f3f78ed09 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -46,7 +46,7 @@ #endif #ifndef UNUSED -#define UNUSED( arg ) ( (void)(arg) ) +#define UNUSED( arg ) ( (void)(arg)=(arg) ) #endif diff --git a/src/base/ftgrays.c b/src/base/ftgrays.c index 9228fde6e..261b72bdb 100644 --- a/src/base/ftgrays.c +++ b/src/base/ftgrays.c @@ -1151,7 +1151,7 @@ int check_sort( PCell cells, int count ) TScan x, y, cover, area; PCell start, cur, limit; - (void)target; + target=target; cur = ras.cells; limit = cur + ras.num_cells; diff --git a/src/base/ftinit.c b/src/base/ftinit.c index 04c173c4e..226a03dad 100644 --- a/src/base/ftinit.c +++ b/src/base/ftinit.c @@ -88,8 +88,10 @@ const FT_DriverInterface* ft_default_drivers[] = error = FT_Add_Driver( library, *cur ); /* notify errors, but don't stop */ if ( error ) + { FT_ERROR(( "FT.Default_Drivers: Cannot install `%s', error = %x\n", (*cur)->driver_name, error )); + } cur++; } } diff --git a/src/base/ftraster.c b/src/base/ftraster.c index c0c444aaf..d68edfc25 100644 --- a/src/base/ftraster.c +++ b/src/base/ftraster.c @@ -66,8 +66,8 @@ #include #endif -#ifndef EXPORT_FUNC -#define EXPORT_FUNC /* nothing */ +#ifndef UNUSED +#define UNUSED( arg ) ( (arg)=(arg) ) #endif #undef FT_COMPONENT @@ -279,7 +279,7 @@ /* `->' */ #define ras (*raster) -#define UNUSED_RASTER (void)raster; +#define UNUSED_RASTER (raster=raster); /*************************************************************************/ /* */ diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index faf13609c..e9dae85ea 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -66,7 +66,7 @@ void* ft_alloc( FT_Memory memory, long size ) { - (void)memory; + UNUSED(memory); return malloc(size); } @@ -110,8 +110,8 @@ long new_size, void* block ) { - (void)memory; - (void)cur_size; + UNUSED(memory); + UNUSED(cur_size); return realloc( block, new_size ); } @@ -140,7 +140,7 @@ void ft_free( FT_Memory memory, void* block ) { - (void)memory; + UNUSED(memory); free( block ); } diff --git a/src/psnames/psdriver.c b/src/psnames/psdriver.c index d2dc154d8..78283b7a8 100644 --- a/src/psnames/psdriver.c +++ b/src/psnames/psdriver.c @@ -233,7 +233,11 @@ 100, /* driver version */ 200, /* driver requires FreeType 2 or above */ - (void*)&psnames_interface + (void*)&psnames_interface, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, }; #else diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 74d5fd240..8fe6609e9 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -66,6 +66,10 @@ 1, /* driver version */ 2, /* driver requires FreeType 2 or above */ - (void*)&sfnt_interface + (void*)&sfnt_interface, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, 0, 0, + 0, 0, }; diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index a40486bff..b2a678c91 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -267,6 +267,7 @@ TT_Table *entry, *limit; + UNUSED(faceIndex); FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n", (TT_Long)face, faceIndex )); diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c index 1e63db20d..f94716d48 100644 --- a/src/sfnt/ttsbit.c +++ b/src/sfnt/ttsbit.c @@ -467,6 +467,7 @@ /* this table is optional */ error = face->goto_table( face, TTAG_EBLC, stream, 0 ); + if (error) { error = 0; goto Exit; diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c index 5e216385f..091a3700d 100644 --- a/src/truetype/ttdriver.c +++ b/src/truetype/ttdriver.c @@ -475,8 +475,8 @@ TT_UInt pixel_width, TT_UInt pixel_height ) { - (void) pixel_width; - (void) pixel_height; + UNUSED(pixel_width); + UNUSED(pixel_height); /* many things were pre-computed by the base layer */ @@ -640,7 +640,7 @@ static FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface ) { - (void)driver; + UNUSED(driver); if (strcmp(interface,"get_sfnt")==0) return (FTDriver_Interface)tt_get_sfnt_table; diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c index af3982ed9..1ef9dc463 100644 --- a/src/truetype/ttinterp.c +++ b/src/truetype/ttinterp.c @@ -117,7 +117,7 @@ /* This macro is used whenever `exec' is unused in a function, to avoid */ /* stupid warnings from pedantic compilers. */ /* */ -#define UNUSED_EXEC (void)CUR +#define UNUSED_EXEC UNUSED(CUR) /*************************************************************************/ @@ -125,7 +125,7 @@ /* This macro is used whenever `args' is unused in a function, to avoid */ /* stupid warnings from pedantic compilers. */ /* */ -#define UNUSED_ARG UNUSED_EXEC; (void)args; +#define UNUSED_ARG UNUSED_EXEC; UNUSED(args); /*************************************************************************/ @@ -719,7 +719,7 @@ exec->callTop = 0; #if 1 - (void)debug; + UNUSED(debug); return exec->face->interpreter( exec ); #else if ( !debug ) diff --git a/src/truetype/ttobjs.c b/src/truetype/ttobjs.c index fa23c7f3c..e32cae174 100644 --- a/src/truetype/ttobjs.c +++ b/src/truetype/ttobjs.c @@ -165,8 +165,8 @@ PSNames_Interface* psnames; /* for now, parameters are unused */ - (void)num_params; - (void)params; + UNUSED(num_params); + UNUSED(params); sfnt = (SFNT_Interface*)face->sfnt; if (!sfnt) diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index f50505703..19df387ba 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -399,9 +399,9 @@ } - (void)threshold; - (void)end_x; - (void)end_y; + UNUSED(threshold); + UNUSED(end_x); + UNUSED(end_y); flex = decoder->flex_vectors; @@ -1052,9 +1052,9 @@ if (wx > decoder->builder.advance.x) decoder->builder.advance.x = wx; - (void)sbx; - (void)sby; - (void)wy; + UNUSED(sbx); + UNUSED(sby); + UNUSED(wy); return -1; /* return an error code to exit the Type 1 parser */ /* immediately. */ } @@ -1127,7 +1127,6 @@ type1->subrs, type1->subrs_len ); /* ignore the error if one occured - skip to next glyph */ - (void)error; } *max_advance = decoder.builder.advance.x; diff --git a/src/type1/t1load.c b/src/type1/t1load.c index e4802da9c..f59f22607 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -554,7 +554,7 @@ static T1_Error Do_Def_Ignore( T1_Parser* parser ) { - (void)parser; + UNUSED(parser); return T1_Err_Ok; } diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index 07b218099..254689632 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -230,10 +230,10 @@ T1_Error error; PSNames_Interface* psnames; - (void)num_params; - (void)params; - (void)face_index; - (void)face; + UNUSED(num_params); + UNUSED(params); + UNUSED(face_index); + UNUSED(face); face->root.num_faces = 1; @@ -506,7 +506,7 @@ LOCAL_FUNC T1_Error T1_Init_Driver( T1_Driver driver ) { - (void)driver; + UNUSED(driver); return T1_Err_Ok; } @@ -527,7 +527,7 @@ LOCAL_DEF void T1_Done_Driver( T1_Driver driver ) { - (void)driver; + UNUSED(driver); } diff --git a/src/type1/t1tokens.c b/src/type1/t1tokens.c index 15654cbc9..6f2f58e0c 100644 --- a/src/type1/t1tokens.c +++ b/src/type1/t1tokens.c @@ -170,8 +170,6 @@ FT_TRACE2(( "Growing tokenizer buffer by %d bytes\n", left_bytes )); - (void)stream; /* unused in non reentrant mode */ - if ( !REALLOC( tokzer->base, tokzer->limit, tokzer->limit + left_bytes ) && !FILE_Read( tokzer->base + tokzer->limit, left_bytes ) ) diff --git a/src/type1z/t1gload.c b/src/type1z/t1gload.c index 5dd2ac1c5..51d3f44cc 100644 --- a/src/type1z/t1gload.c +++ b/src/type1z/t1gload.c @@ -1217,7 +1217,6 @@ type1->subrs, type1->subrs_len ); /* ignore the error if one occured - skip to next glyph */ - (void)error; } *max_advance = decoder.builder.advance.x; @@ -1271,7 +1270,7 @@ T1_Init_Decoder( &decoder ); T1_Init_Builder( &decoder.builder, face, size, glyph ); - decoder.builder.no_recurse = !!(load_flags & FT_LOAD_NO_RECURSE); + decoder.builder.no_recurse = (FT_Bool)!!(load_flags & FT_LOAD_NO_RECURSE); /* now load the unscaled outline */ error = T1_Parse_CharStrings( &decoder, diff --git a/src/type1z/t1load.c b/src/type1z/t1load.c index 2566419f8..b2589c238 100644 --- a/src/type1z/t1load.c +++ b/src/type1z/t1load.c @@ -83,62 +83,64 @@ /* each callback is in charge of loading a value and storing it in a */ /* given field of the Type 1 face.. */ -#define PARSE_(x) static void parse_##x ( T1_Face face, T1_Loader* loader ) +#define PARSE_(x) static void FT_XCAT(parse_,x) ( T1_Face face, T1_Loader* loader ) + +#define FIELD FACE.x #define PARSE_STRING(s,x) PARSE_(x) \ { \ - FACE.##x = T1_ToString(&loader->parser); \ - FT_TRACE2(( "type1.parse_##x##: \"%s\"\n", FACE.##x )); \ + FACE.x = T1_ToString(&loader->parser); \ + FT_TRACE2(( "type1.parse_%s: \"%s\"\n", #x, FACE.x )); \ } #define PARSE_NUM(s,x,t) PARSE_(x) \ { \ - FACE.##x = (t)T1_ToInt(&loader->parser); \ - FT_TRACE2(( "type1.parse_##x##: \"%d\"\n", FACE.##x )); \ + FACE.x = (t)T1_ToInt(&loader->parser); \ + FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \ } #define PARSE_INT(s,x) PARSE_(x) \ { \ - FACE.##x = T1_ToInt(&loader->parser); \ - FT_TRACE2(( "type1.parse_##x##: \"%d\"\n", FACE.##x )); \ + FACE.x = T1_ToInt(&loader->parser); \ + FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \ } #define PARSE_BOOL(s,x) PARSE_(x) \ { \ - FACE.##x = T1_ToBool(&loader->parser); \ - FT_TRACE2(( "type1.parse_##x##: \"%s\"\n", \ - FACE.##x ? "true" : "false" )); \ + FACE.x = T1_ToBool(&loader->parser); \ + FT_TRACE2(( "type1.parse_%s : \"%s\"\n", \ + #x, FACE.x ? "true" : "false" )); \ } #define PARSE_FIXED(s,x) PARSE_(x) \ { \ - FACE.##x = T1_ToFixed(&loader->parser,3); \ - FT_TRACE2(( "type1.parse_##x##: \"%f\"\n", FACE.##x/65536.0 )); \ + FACE.x = T1_ToFixed(&loader->parser,3); \ + FT_TRACE2(( "type1.parse_%s: \"%f\"\n", #x, FACE.x/65536.0 )); \ } #define PARSE_COORDS(s,c,m,x) PARSE_(x) \ { \ - FACE.##c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.##x ); \ - FT_TRACE2(( "type1.parse_##x##\n" )); \ + FACE.c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.x ); \ + FT_TRACE2(( "type1.parse_%s\n", #x )); \ } #define PARSE_FIXEDS(s,c,m,x) PARSE_(x) \ { \ - FACE.##c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.##x, 3 ); \ - FT_TRACE2(( "type1.parse_##x##\n" )); \ + FACE.c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.x, 3 ); \ + FT_TRACE2(( "type1.parse_%s\n", #x )); \ } #define PARSE_COORDS2(s,m,x) PARSE_(x) \ { \ - (void)T1_ToCoordArray( &loader->parser, m, (T1_Short*)&FACE.##x ); \ - FT_TRACE2(( "type1.parse_##x##\n" )); \ + (void)T1_ToCoordArray( &loader->parser, m, (T1_Short*)&FACE.x ); \ + FT_TRACE2(( "type1.parse_%s\n", #x )); \ } #define PARSE_FIXEDS2(s,m,x) PARSE_(x) \ { \ - (void)T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)&FACE.##x, 3 ); \ - FT_TRACE2(( "type1.parse_##x##\n" )); \ + (void)T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)&FACE.x, 3 ); \ + FT_TRACE2(( "type1.parse_%s\n", #x )); \ } diff --git a/src/type1z/t1objs.c b/src/type1z/t1objs.c index 38928c718..2d25408c0 100644 --- a/src/type1z/t1objs.c +++ b/src/type1z/t1objs.c @@ -53,7 +53,7 @@ LOCAL_FUNC void T1_Done_Size( T1_Size size ) { - (void)size; + UNUSED(size); } @@ -76,11 +76,7 @@ LOCAL_DEF T1_Error T1_Init_Size( T1_Size size ) { - T1_Error error; - size->valid = 0; - - (void)error; return T1_Err_Ok; } @@ -105,7 +101,7 @@ LOCAL_FUNC T1_Error T1_Reset_Size( T1_Size size ) { - (void)size; + UNUSED(size); return 0; } @@ -461,7 +457,7 @@ LOCAL_FUNC T1_Error T1_Init_Driver( T1_Driver driver ) { - (void)driver; + UNUSED(driver); return T1_Err_Ok; } @@ -482,7 +478,7 @@ LOCAL_DEF void T1_Done_Driver( T1_Driver driver ) { - (void)driver; + UNUSED(driver); }