another massive changes in order to completely avoid

compiler warnings with GCC + "-ansi -pedantic -Wall -W"
and LCC.

Also fixed the compilation of "type1z" with Win32-LCC
(its pre-processor is broken !!)

Updated the BUILD document too
This commit is contained in:
David Turner 2000-05-12 15:01:18 +00:00
parent bfe2f98f1f
commit c30aea9846
33 changed files with 201 additions and 171 deletions

99
BUILD
View File

@ -151,7 +151,7 @@ II. COMMAND-LINE COMPILATION:
if you encounter this problem. if you encounter this problem.
Note that the release version will use Autoconf to detect everything 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: 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 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 from a graphical IDE on a Mac or Windows), you'll need to understand how the
FreeType files are organized. FreeType files are organized.
First of all, all configuration files are located in "freetype2/config",
with system-specific overrides in "freetype2/config/<system>". You should
always place "config/<system>" 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 src/
a simple include on all these individual files. This will compile the whole base/
base layer as a single object file. 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 However, you can create a single object file by compiling the file
component avoids the generation of many externals (that really correspond "src/base/ftbase.c", whose content is:
to intra-module dependencies) and provides greater optimisations
opportunities.
#include <ftcalc.c>
#include <ftobjs.c>
#include <ftstream.c>
#include <ftlist.c>
#include <ftoutln.c>
#include <ftextend.c>
Similarly, each component has a single "englobing" C file to compile it Similarly, each component has a single "englobing" C file to compile it
as a stand-alone object, i.e. : as a stand-alone object, i.e. :
@ -209,9 +194,39 @@ II. DETAILED COMPILATION PROCEDURE:
src/truetype/truetype.c - the TrueType font driver src/truetype/truetype.c - the TrueType font driver
src/type1/type1.c - the Type 1 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.. To compile one component, do the following:
The directory "freetype2/include" contains all public header files that - add the top-level "include" directory to your compilation include path
may be included by client applications..
- 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

25
CHANGES
View File

@ -1,5 +1,29 @@
LATEST CHANGES - 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 - yet another massive grunt work. I've changed the definition of the
EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take EXPORT_DEF, EXPORT_FUNC, BASE_DEF & BASE_FUNC macros. These now take
an argument, which is the function's return value type. an argument, which is the function's return value type.
@ -27,6 +51,7 @@ LATEST CHANGES -
a different signature). a different signature).
- updated the tutorial (not finished though). - updated the tutorial (not finished though).
- updated the top-level BUILD document
- added the declaration of FT_New_Memory_Face in <freetype/freetype.h>, as - added the declaration of FT_New_Memory_Face in <freetype/freetype.h>, as
it was missing from the public header (the implementation was already it was missing from the public header (the implementation was already

View File

@ -17,16 +17,16 @@
# the following variables: # the following variables:
# #
# BUILD The configuration and system-specific directory. Usually # BUILD The configuration and system-specific directory. Usually
# `freetype/config/$(PLATFORM)' but can be different if a # `freetype/config/$(PLATFORM)' but can be different for
# specific compiler has been requested on the command line. # custom builds of the library.
# #
# The following variables must be defined in system specific `detect.mk' # The following variables must be defined in system specific `detect.mk'
# files: # files:
# #
# PLATFORM The detected platform. This will default to `ansi' if # PLATFORM The detected platform. This will default to `ansi' if
# auto-detection fails. # auto-detection fails.
# CONFIG_FILE The Makefile to use. This usually depends on the compiler # CONFIG_FILE The configuration sub-makefile to use. This usually depends
# defined in the `CC' environment variable. # on the compiler defined in the `CC' environment variable.
# DELETE The shell command used to remove a given file. # DELETE The shell command used to remove a given file.
# COPY The shell command used to copy one file. # COPY The shell command used to copy one file.
# SEP The platform-specific directory separator. # SEP The platform-specific directory separator.
@ -44,7 +44,7 @@ TOP := .
endif endif
# Set auto-detection default to `ansi'. # 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). # $(CONFIG_RULES).
# #
PLATFORM := ansi PLATFORM := ansi
@ -52,9 +52,9 @@ DELETE := $(RM)
COPY := cp COPY := cp
SEP := / SEP := /
CONFIG_ = $(TOP)$(SEP)config$(SEP) BUILD_CONFIG_ = $(TOP)$(SEP)config$(SEP)
BUILD = $(CONFIG_)$(PLATFORM) BUILD = $(BUILD_CONFIG_)$(PLATFORM)
CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE) CONFIG_RULES = $(BUILD)$(SEP)$(CONFIG_FILE)
# We define the BACKSLASH variable to hold a single back-slash character. # We define the BACKSLASH variable to hold a single back-slash character.
# This is needed because a line like # 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 # directories. Note that the calling order of the various `detect.mk' files
# isn't predictable. # 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. # 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 # The following targets are equivalent, with the exception that they use
# slightly different syntaxes for the `echo' command. # 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 # dos_setup: defined for Dos-ish platforms like Dos, Windows & OS/2
# #
.PHONY: std_setup dos_setup .PHONY: std_setup dos_setup

View File

@ -13,11 +13,6 @@
# fully. # 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' # We test for the COMSPEC environment variable, then run the `ver'
# command-line program to see if its output contains the word `Dos'. # command-line program to see if its output contains the word `Dos'.
# #

View File

@ -13,11 +13,6 @@
# fully. # 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) ifeq ($(PLATFORM),ansi)
ifdef OS2_SHELL ifdef OS2_SHELL

View File

@ -13,7 +13,7 @@
# fully. # 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... # Automake/Autoconf...

View File

@ -13,11 +13,6 @@
# fully. # 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) ifeq ($(PLATFORM),ansi)
# Detecting Windows NT is easy, as the OS variable must be defined and # Detecting Windows NT is easy, as the OS variable must be defined and

View File

@ -128,7 +128,7 @@ distclean_freetype: distclean_freetype_dos
DIR_OBJ := $(subst /,\\,$(OBJ_DIR)) DIR_OBJ := $(subst /,\\,$(OBJ_DIR))
$(FT_LIBRARY): $(OBJECTS_LIST) $(FT_LIBRARY): $(OBJECTS_LIST)
lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<) lcclnk -o $(subst /,\\,$@) $(subst /,\\,$(OBJECTS_LIST))
endif endif

View File

@ -84,6 +84,7 @@ else
LINK = $(CC) $T$@ $< $(FTLIB) $(EFENCE) $(LDFLAGS) LINK = $(CC) $T$@ $< $(FTLIB) $(EFENCE) $(LDFLAGS)
COMMON_LINK = $(LINK) $(COMMON_OBJ) COMMON_LINK = $(LINK) $(COMMON_OBJ)
GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB) GRAPH_LINK = $(COMMON_LINK) $(GRAPH_LIB)
GRAPH_LINK2 = $(GRAPH_LINK) $(EXTRA_GRAPH_OBJS)
.PHONY: exes clean distclean .PHONY: exes clean distclean
@ -187,6 +188,8 @@ else
$(OBJ_)ftgrays2.$O: $(SRC_DIR_)ftgrays2.c $(OBJ_)ftgrays2.$O: $(SRC_DIR_)ftgrays2.c
$(COMPILE) $T$@ $< $(COMPILE) $T$@ $<
EXTRA_GRAPH_OBJS := $(OBJ_)ftrast.$O $(OBJ_)ftrast2.$O
$(OBJ_)ftrast.$O: $(SRC_DIR_)ftrast.c $(OBJ_)ftrast.$O: $(SRC_DIR_)ftrast.c
$(COMPILE) $T$@ $< $(COMPILE) $T$@ $<
@ -268,7 +271,7 @@ else
$(BIN_)ftview$E: $(OBJ_)ftview.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ) $(OBJ_)ftrast2.$O $(OBJ_)ftrast.$O $(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) $(BIN_)ftstring$E: $(OBJ_)ftstring.$O $(FTLIB) $(GRAPH_LIB) $(COMMON_OBJ)
$(GRAPH_LINK) $(GRAPH_LINK)

View File

@ -46,6 +46,7 @@ LINK_ROOT = lcclnk -o $(subst /,\\,$@) $(subst /,\\,$<)
LINK = $(LINK_ROOT) $(subst /,\\,$(FTLIB)) LINK = $(LINK_ROOT) $(subst /,\\,$(FTLIB))
COMMON_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(FTLIB)) COMMON_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(FTLIB))
GRAPH_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(GRAPH_LIB)) $(subst /,\\,$(FTLIB)) GRAPH_LINK = $(LINK_ROOT) $(subst /,\\,$(COMMON_OBJ)) $(subst /,\\,$(GRAPH_LIB)) $(subst /,\\,$(FTLIB))
GRAPH_LINK2 = $(GRAPH_LINK) $(subst /,\\,$(EXTRA_GRAPH_OBJS))
endif endif
endif endif

View File

@ -257,14 +257,6 @@
(( sizeof(TProfile)+sizeof(long)-1 ) / sizeof(long)) (( 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 #ifdef TT_STATIC_RASTER
@ -1815,7 +1807,7 @@
{ {
Long pitch = ras.target.pitch; Long pitch = ras.target.pitch;
(void)max; UNUSED(max);
ras.traceIncr = (Short)- pitch; ras.traceIncr = (Short)- pitch;
ras.traceOfs = - *min * pitch; ras.traceOfs = - *min * pitch;
@ -1838,9 +1830,9 @@
Byte f1, f2; Byte f1, f2;
Byte* target; Byte* target;
(void)y; UNUSED(y);
(void)left; UNUSED(left);
(void)right; UNUSED(right);
/* Drop-out control */ /* Drop-out control */
@ -2015,9 +2007,9 @@
static void Horizontal_Sweep_Init( RAS_ARGS Short* min, Short* max ) static void Horizontal_Sweep_Init( RAS_ARGS Short* min, Short* max )
{ {
/* nothing, really */ /* nothing, really */
(void)raster; UNUSED(raster);
(void)min; UNUSED(min);
(void)max; UNUSED(max);
} }
@ -2031,8 +2023,8 @@
PByte bits; PByte bits;
Byte f1; Byte f1;
(void)left; UNUSED(left);
(void)right; UNUSED(right);
if ( x2-x1 < ras.precision ) if ( x2-x1 < ras.precision )
{ {
@ -2173,7 +2165,7 @@
static void Horizontal_Sweep_Step( RAS_ARG ) static void Horizontal_Sweep_Step( RAS_ARG )
{ {
/* Nothing, really */ /* Nothing, really */
(void)raster; UNUSED(raster);
} }
@ -2285,12 +2277,12 @@
PProfile right ) PProfile right )
{ {
/* nothing, really */ /* nothing, really */
(void)raster; UNUSED(raster);
(void)y; UNUSED(y);
(void)x1; UNUSED(x1);
(void)x2; UNUSED(x2);
(void)left; UNUSED(left);
(void)right; UNUSED(right);
} }
static void Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y, static void Horizontal_Gray_Sweep_Drop( RAS_ARGS Short y,

View File

@ -95,6 +95,13 @@
#define FT_ALIGNMENT 8 #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
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View File

@ -170,7 +170,7 @@
/* Don't define any of these macros to compile in `release' mode. */ /* Don't define any of these macros to compile in `release' mode. */
/* */ /* */
#undef FT_DEBUG_LEVEL_ERROR #undef FT_DEBUG_LEVEL_ERROR
#define FT_DEBUG_LEVEL_TRACE #undef FT_DEBUG_LEVEL_TRACE
/*************************************************************************/ /*************************************************************************/

View File

@ -51,6 +51,11 @@
#endif #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 #ifdef FT_DEBUG_LEVEL_TRACE
@ -78,15 +83,6 @@
trace_ttextend, trace_ttextend,
trace_ttdriver, 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 */ /* define an enum for each Type1 driver component */
trace_t1objs, trace_t1objs,
trace_t1load, trace_t1load,
@ -120,7 +116,7 @@
do \ do \
{ \ { \
if ( ft_trace_levels[FT_COMPONENT] >= level ) \ if ( ft_trace_levels[FT_COMPONENT] >= level ) \
FT_Message##varformat; \ FT_XCAT( FT_Message, varformat ); \
} while ( 0 ) } while ( 0 )
@ -174,7 +170,7 @@
/* print a message and exit */ /* print a message and exit */
EXPORT_DEF(void) FT_Panic ( const char* fmt, ... ); 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 */ #endif /* FT_DEBUG_LEVEL_TRACE || FT_DEBUG_LEVEL_ERROR */

View File

@ -46,7 +46,7 @@
#endif #endif
#ifndef UNUSED #ifndef UNUSED
#define UNUSED( arg ) ( (void)(arg) ) #define UNUSED( arg ) ( (void)(arg)=(arg) )
#endif #endif

View File

@ -1151,7 +1151,7 @@ int check_sort( PCell cells, int count )
TScan x, y, cover, area; TScan x, y, cover, area;
PCell start, cur, limit; PCell start, cur, limit;
(void)target; target=target;
cur = ras.cells; cur = ras.cells;
limit = cur + ras.num_cells; limit = cur + ras.num_cells;

View File

@ -88,8 +88,10 @@ const FT_DriverInterface* ft_default_drivers[] =
error = FT_Add_Driver( library, *cur ); error = FT_Add_Driver( library, *cur );
/* notify errors, but don't stop */ /* notify errors, but don't stop */
if ( error ) if ( error )
{
FT_ERROR(( "FT.Default_Drivers: Cannot install `%s', error = %x\n", FT_ERROR(( "FT.Default_Drivers: Cannot install `%s', error = %x\n",
(*cur)->driver_name, error )); (*cur)->driver_name, error ));
}
cur++; cur++;
} }
} }

View File

@ -66,8 +66,8 @@
#include <freetype/internal/ftdebug.h> #include <freetype/internal/ftdebug.h>
#endif #endif
#ifndef EXPORT_FUNC #ifndef UNUSED
#define EXPORT_FUNC /* nothing */ #define UNUSED( arg ) ( (arg)=(arg) )
#endif #endif
#undef FT_COMPONENT #undef FT_COMPONENT
@ -279,7 +279,7 @@
/* `->' */ /* `->' */
#define ras (*raster) #define ras (*raster)
#define UNUSED_RASTER (void)raster; #define UNUSED_RASTER (raster=raster);
/*************************************************************************/ /*************************************************************************/
/* */ /* */

View File

@ -66,7 +66,7 @@
void* ft_alloc( FT_Memory memory, void* ft_alloc( FT_Memory memory,
long size ) long size )
{ {
(void)memory; UNUSED(memory);
return malloc(size); return malloc(size);
} }
@ -110,8 +110,8 @@
long new_size, long new_size,
void* block ) void* block )
{ {
(void)memory; UNUSED(memory);
(void)cur_size; UNUSED(cur_size);
return realloc( block, new_size ); return realloc( block, new_size );
} }
@ -140,7 +140,7 @@
void ft_free( FT_Memory memory, void ft_free( FT_Memory memory,
void* block ) void* block )
{ {
(void)memory; UNUSED(memory);
free( block ); free( block );
} }

View File

@ -233,7 +233,11 @@
100, /* driver version */ 100, /* driver version */
200, /* driver requires FreeType 2 or above */ 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 #else

View File

@ -66,6 +66,10 @@
1, /* driver version */ 1, /* driver version */
2, /* driver requires FreeType 2 or above */ 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,
}; };

View File

@ -267,6 +267,7 @@
TT_Table *entry, *limit; TT_Table *entry, *limit;
UNUSED(faceIndex);
FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n", FT_TRACE2(( "TT_Load_Directory( %08lx, %ld )\n",
(TT_Long)face, faceIndex )); (TT_Long)face, faceIndex ));

View File

@ -467,6 +467,7 @@
/* this table is optional */ /* this table is optional */
error = face->goto_table( face, TTAG_EBLC, stream, 0 ); error = face->goto_table( face, TTAG_EBLC, stream, 0 );
if (error)
{ {
error = 0; error = 0;
goto Exit; goto Exit;

View File

@ -475,8 +475,8 @@
TT_UInt pixel_width, TT_UInt pixel_width,
TT_UInt pixel_height ) TT_UInt pixel_height )
{ {
(void) pixel_width; UNUSED(pixel_width);
(void) pixel_height; UNUSED(pixel_height);
/* many things were pre-computed by the base layer */ /* many things were pre-computed by the base layer */
@ -640,7 +640,7 @@
static static
FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface ) FTDriver_Interface tt_get_interface( TT_Driver driver, const char* interface )
{ {
(void)driver; UNUSED(driver);
if (strcmp(interface,"get_sfnt")==0) if (strcmp(interface,"get_sfnt")==0)
return (FTDriver_Interface)tt_get_sfnt_table; return (FTDriver_Interface)tt_get_sfnt_table;

View File

@ -117,7 +117,7 @@
/* This macro is used whenever `exec' is unused in a function, to avoid */ /* This macro is used whenever `exec' is unused in a function, to avoid */
/* stupid warnings from pedantic compilers. */ /* 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 */ /* This macro is used whenever `args' is unused in a function, to avoid */
/* stupid warnings from pedantic compilers. */ /* 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; exec->callTop = 0;
#if 1 #if 1
(void)debug; UNUSED(debug);
return exec->face->interpreter( exec ); return exec->face->interpreter( exec );
#else #else
if ( !debug ) if ( !debug )

View File

@ -165,8 +165,8 @@
PSNames_Interface* psnames; PSNames_Interface* psnames;
/* for now, parameters are unused */ /* for now, parameters are unused */
(void)num_params; UNUSED(num_params);
(void)params; UNUSED(params);
sfnt = (SFNT_Interface*)face->sfnt; sfnt = (SFNT_Interface*)face->sfnt;
if (!sfnt) if (!sfnt)

View File

@ -399,9 +399,9 @@
} }
(void)threshold; UNUSED(threshold);
(void)end_x; UNUSED(end_x);
(void)end_y; UNUSED(end_y);
flex = decoder->flex_vectors; flex = decoder->flex_vectors;
@ -1052,9 +1052,9 @@
if (wx > decoder->builder.advance.x) if (wx > decoder->builder.advance.x)
decoder->builder.advance.x = wx; decoder->builder.advance.x = wx;
(void)sbx; UNUSED(sbx);
(void)sby; UNUSED(sby);
(void)wy; UNUSED(wy);
return -1; /* return an error code to exit the Type 1 parser */ return -1; /* return an error code to exit the Type 1 parser */
/* immediately. */ /* immediately. */
} }
@ -1127,7 +1127,6 @@
type1->subrs, type1->subrs,
type1->subrs_len ); type1->subrs_len );
/* ignore the error if one occured - skip to next glyph */ /* ignore the error if one occured - skip to next glyph */
(void)error;
} }
*max_advance = decoder.builder.advance.x; *max_advance = decoder.builder.advance.x;

View File

@ -554,7 +554,7 @@
static static
T1_Error Do_Def_Ignore( T1_Parser* parser ) T1_Error Do_Def_Ignore( T1_Parser* parser )
{ {
(void)parser; UNUSED(parser);
return T1_Err_Ok; return T1_Err_Ok;
} }

View File

@ -230,10 +230,10 @@
T1_Error error; T1_Error error;
PSNames_Interface* psnames; PSNames_Interface* psnames;
(void)num_params; UNUSED(num_params);
(void)params; UNUSED(params);
(void)face_index; UNUSED(face_index);
(void)face; UNUSED(face);
face->root.num_faces = 1; face->root.num_faces = 1;
@ -506,7 +506,7 @@
LOCAL_FUNC LOCAL_FUNC
T1_Error T1_Init_Driver( T1_Driver driver ) T1_Error T1_Init_Driver( T1_Driver driver )
{ {
(void)driver; UNUSED(driver);
return T1_Err_Ok; return T1_Err_Ok;
} }
@ -527,7 +527,7 @@
LOCAL_DEF LOCAL_DEF
void T1_Done_Driver( T1_Driver driver ) void T1_Done_Driver( T1_Driver driver )
{ {
(void)driver; UNUSED(driver);
} }

View File

@ -170,8 +170,6 @@
FT_TRACE2(( "Growing tokenizer buffer by %d bytes\n", left_bytes )); FT_TRACE2(( "Growing tokenizer buffer by %d bytes\n", left_bytes ));
(void)stream; /* unused in non reentrant mode */
if ( !REALLOC( tokzer->base, tokzer->limit, if ( !REALLOC( tokzer->base, tokzer->limit,
tokzer->limit + left_bytes ) && tokzer->limit + left_bytes ) &&
!FILE_Read( tokzer->base + tokzer->limit, left_bytes ) ) !FILE_Read( tokzer->base + tokzer->limit, left_bytes ) )

View File

@ -1217,7 +1217,6 @@
type1->subrs, type1->subrs,
type1->subrs_len ); type1->subrs_len );
/* ignore the error if one occured - skip to next glyph */ /* ignore the error if one occured - skip to next glyph */
(void)error;
} }
*max_advance = decoder.builder.advance.x; *max_advance = decoder.builder.advance.x;
@ -1271,7 +1270,7 @@
T1_Init_Decoder( &decoder ); T1_Init_Decoder( &decoder );
T1_Init_Builder( &decoder.builder, face, size, glyph ); 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 */ /* now load the unscaled outline */
error = T1_Parse_CharStrings( &decoder, error = T1_Parse_CharStrings( &decoder,

View File

@ -83,62 +83,64 @@
/* each callback is in charge of loading a value and storing it in a */ /* each callback is in charge of loading a value and storing it in a */
/* given field of the Type 1 face.. */ /* 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) \ #define PARSE_STRING(s,x) PARSE_(x) \
{ \ { \
FACE.##x = T1_ToString(&loader->parser); \ FACE.x = T1_ToString(&loader->parser); \
FT_TRACE2(( "type1.parse_##x##: \"%s\"\n", FACE.##x )); \ FT_TRACE2(( "type1.parse_%s: \"%s\"\n", #x, FACE.x )); \
} }
#define PARSE_NUM(s,x,t) PARSE_(x) \ #define PARSE_NUM(s,x,t) PARSE_(x) \
{ \ { \
FACE.##x = (t)T1_ToInt(&loader->parser); \ FACE.x = (t)T1_ToInt(&loader->parser); \
FT_TRACE2(( "type1.parse_##x##: \"%d\"\n", FACE.##x )); \ FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \
} }
#define PARSE_INT(s,x) PARSE_(x) \ #define PARSE_INT(s,x) PARSE_(x) \
{ \ { \
FACE.##x = T1_ToInt(&loader->parser); \ FACE.x = T1_ToInt(&loader->parser); \
FT_TRACE2(( "type1.parse_##x##: \"%d\"\n", FACE.##x )); \ FT_TRACE2(( "type1.parse_%s: \"%d\"\n", #x, FACE.x )); \
} }
#define PARSE_BOOL(s,x) PARSE_(x) \ #define PARSE_BOOL(s,x) PARSE_(x) \
{ \ { \
FACE.##x = T1_ToBool(&loader->parser); \ FACE.x = T1_ToBool(&loader->parser); \
FT_TRACE2(( "type1.parse_##x##: \"%s\"\n", \ FT_TRACE2(( "type1.parse_%s : \"%s\"\n", \
FACE.##x ? "true" : "false" )); \ #x, FACE.x ? "true" : "false" )); \
} }
#define PARSE_FIXED(s,x) PARSE_(x) \ #define PARSE_FIXED(s,x) PARSE_(x) \
{ \ { \
FACE.##x = T1_ToFixed(&loader->parser,3); \ FACE.x = T1_ToFixed(&loader->parser,3); \
FT_TRACE2(( "type1.parse_##x##: \"%f\"\n", FACE.##x/65536.0 )); \ FT_TRACE2(( "type1.parse_%s: \"%f\"\n", #x, FACE.x/65536.0 )); \
} }
#define PARSE_COORDS(s,c,m,x) PARSE_(x) \ #define PARSE_COORDS(s,c,m,x) PARSE_(x) \
{ \ { \
FACE.##c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.##x ); \ FACE.c = T1_ToCoordArray(&loader->parser, m, (T1_Short*)FACE.x ); \
FT_TRACE2(( "type1.parse_##x##\n" )); \ FT_TRACE2(( "type1.parse_%s\n", #x )); \
} }
#define PARSE_FIXEDS(s,c,m,x) PARSE_(x) \ #define PARSE_FIXEDS(s,c,m,x) PARSE_(x) \
{ \ { \
FACE.##c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.##x, 3 ); \ FACE.c = T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)FACE.x, 3 ); \
FT_TRACE2(( "type1.parse_##x##\n" )); \ FT_TRACE2(( "type1.parse_%s\n", #x )); \
} }
#define PARSE_COORDS2(s,m,x) PARSE_(x) \ #define PARSE_COORDS2(s,m,x) PARSE_(x) \
{ \ { \
(void)T1_ToCoordArray( &loader->parser, m, (T1_Short*)&FACE.##x ); \ (void)T1_ToCoordArray( &loader->parser, m, (T1_Short*)&FACE.x ); \
FT_TRACE2(( "type1.parse_##x##\n" )); \ FT_TRACE2(( "type1.parse_%s\n", #x )); \
} }
#define PARSE_FIXEDS2(s,m,x) PARSE_(x) \ #define PARSE_FIXEDS2(s,m,x) PARSE_(x) \
{ \ { \
(void)T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)&FACE.##x, 3 ); \ (void)T1_ToFixedArray(&loader->parser, m, (T1_Fixed*)&FACE.x, 3 ); \
FT_TRACE2(( "type1.parse_##x##\n" )); \ FT_TRACE2(( "type1.parse_%s\n", #x )); \
} }

View File

@ -53,7 +53,7 @@
LOCAL_FUNC LOCAL_FUNC
void T1_Done_Size( T1_Size size ) void T1_Done_Size( T1_Size size )
{ {
(void)size; UNUSED(size);
} }
@ -76,11 +76,7 @@
LOCAL_DEF LOCAL_DEF
T1_Error T1_Init_Size( T1_Size size ) T1_Error T1_Init_Size( T1_Size size )
{ {
T1_Error error;
size->valid = 0; size->valid = 0;
(void)error;
return T1_Err_Ok; return T1_Err_Ok;
} }
@ -105,7 +101,7 @@
LOCAL_FUNC LOCAL_FUNC
T1_Error T1_Reset_Size( T1_Size size ) T1_Error T1_Reset_Size( T1_Size size )
{ {
(void)size; UNUSED(size);
return 0; return 0;
} }
@ -461,7 +457,7 @@
LOCAL_FUNC LOCAL_FUNC
T1_Error T1_Init_Driver( T1_Driver driver ) T1_Error T1_Init_Driver( T1_Driver driver )
{ {
(void)driver; UNUSED(driver);
return T1_Err_Ok; return T1_Err_Ok;
} }
@ -482,7 +478,7 @@
LOCAL_DEF LOCAL_DEF
void T1_Done_Driver( T1_Driver driver ) void T1_Done_Driver( T1_Driver driver )
{ {
(void)driver; UNUSED(driver);
} }