From 60b32e16e75cd3387160487693a24b61b08684b6 Mon Sep 17 00:00:00 2001 From: David Turner Date: Wed, 6 Nov 2002 22:32:54 +0000 Subject: [PATCH] 2002-11-05 David Turner * include/freetype/config/ftoption.h, src/gzip/ftgzip.c: added support for the FT_CONFIG_OPTION_SYSTEM_ZLIB option, used to specify the use of system-wide zlib. Note that this macro, as well as FT_CONFIG_OPTION_BYTECODE_INTERPRETER, is not #undef-ed anymore. This allows the build system to define them depending on the configuration (typically by adding -D flags at compile time). * src/sfnt/ttcmap0.c (tt_face_build_cmaps): removed compiler warnings in optimized mode relative to the "volatile" local variables. This was not a compiler bug after all, but the fact that a pointer to a volatile variable is not the same than a volatile pointer to a variable :-) the fix was to change "volatile FT_Byte* p" into "FT_Byte* volatile p" * src/pfr/pfrload.c, src/pfr/pfrdrivr.c, src/gzip/inftrees.c: removed compiler warnings in optimized modes * src/gzip/*.[hc]: modified our ZLib copy in order to prevent exporting any zlib function names outside of the component. This prevents linking problems on some platforms, when applications want to link FreeType _and_ ZLib together. 2002-11-05 Juliusz * src/psaux/psobjs.c (ps_table_add): modified increment loop in order to implement exponential behaviour --- ChangeLog | 35 ++++++++++- Jamfile | 90 ++++++++++++++++++++++++--- Jamfile.in | 2 +- include/freetype/config/ftoption.h | 41 ++++++++++--- include/freetype/freetype.h | 15 ++++- src/Jamfile | 32 ++-------- src/autohint/Jamfile | 4 +- src/autohint/ahhint.c | 92 ++++++++++------------------ src/base/Jamfile | 4 +- src/bdf/Jamfile | 4 +- src/cache/Jamfile | 4 +- src/cff/Jamfile | 4 +- src/cid/Jamfile | 4 +- src/gzip/Jamfile | 4 +- src/gzip/adler32.c | 4 +- src/gzip/ftgzip.c | 42 +++++++++++-- src/gzip/infblock.c | 27 ++------ src/gzip/infblock.h | 16 ++--- src/gzip/infcodes.c | 6 +- src/gzip/infcodes.h | 6 +- src/gzip/inflate.c | 98 ------------------------------ src/gzip/inftrees.c | 10 +-- src/gzip/inftrees.h | 6 +- src/gzip/infutil.c | 4 +- src/gzip/infutil.h | 4 +- src/gzip/zconf.h | 14 ++--- src/gzip/zlib.h | 59 ------------------ src/gzip/zutil.c | 42 ------------- src/gzip/zutil.h | 10 +-- src/pcf/Jamfile | 4 +- src/pfr/Jamfile | 4 +- src/pfr/pfrdrivr.c | 3 +- src/pfr/pfrload.c | 2 +- src/psaux/Jamfile | 4 +- src/psaux/psobjs.c | 6 +- src/pshinter/Jamfile | 4 +- src/psnames/Jamfile | 8 +-- src/raster/Jamfile | 4 +- src/sfnt/Jamfile | 4 +- src/sfnt/ttcmap0.c | 6 +- src/smooth/Jamfile | 4 +- src/truetype/Jamfile | 4 +- src/type1/Jamfile | 4 +- src/type42/Jamfile | 4 +- src/winfonts/Jamfile | 4 +- 45 files changed, 305 insertions(+), 447 deletions(-) diff --git a/ChangeLog b/ChangeLog index 43a512177..2994a3e1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2002-11-05 David Turner + + * include/freetype/config/ftoption.h, src/gzip/ftgzip.c: added + support for the FT_CONFIG_OPTION_SYSTEM_ZLIB option, used to specify + the use of system-wide zlib. + + Note that this macro, as well as FT_CONFIG_OPTION_BYTECODE_INTERPRETER, + is not #undef-ed anymore. This allows the build system to define them + depending on the configuration (typically by adding -D flags at + compile time). + + * src/sfnt/ttcmap0.c (tt_face_build_cmaps): removed compiler warnings + in optimized mode relative to the "volatile" local variables. This was + not a compiler bug after all, but the fact that a pointer to a volatile + variable is not the same than a volatile pointer to a variable :-) + + the fix was to change "volatile FT_Byte* p" + into "FT_Byte* volatile p" + + * src/pfr/pfrload.c, src/pfr/pfrdrivr.c, src/gzip/inftrees.c: removed + compiler warnings in optimized modes + + * src/gzip/*.[hc]: modified our ZLib copy in order to prevent exporting + any zlib function names outside of the component. This prevents linking + problems on some platforms, when applications want to link FreeType + _and_ ZLib together. + + +2002-11-05 Juliusz + + * src/psaux/psobjs.c (ps_table_add): modified increment loop in + order to implement exponential behaviour + 2002-10-31 David Turner * include/freetype/ftgzip.h, src/gzip/ftgzip.c: @@ -132,7 +165,7 @@ ft_smooth_render_lcd_v): Ditto. (ft_smooth_render_generic): Change third and fifth parameter to `FT_Render_Mode'. - + * include/freetype/freetype.h, include/freetype/internal/ftobjs.h, include/freetype/ftglyph.h: Updated. diff --git a/Jamfile b/Jamfile index 724b71265..b6d4af021 100644 --- a/Jamfile +++ b/Jamfile @@ -1,6 +1,21 @@ -# FreeType 2 top Jamfile (c) 2001 David Turner +# FreeType 2 top Jamfile (c) 2001-2002 David Turner # +# The HDRMACRO is already defined in FTJam and is used to add +# the content of certain macros to the list of included header +# files. +# +# we can compile FreeType 2 with classic Jam however thanks to +# the following code +# +if ! $(JAM_TOOLSET) +{ + rule HDRMACRO + { + # nothing !! + } +} + # We need to invoke a SubDir rule if the FT2 source directory top is not the # current directory. This allows us to build FreeType 2 as part of a larger # project easily. @@ -10,11 +25,72 @@ if $(FT2_TOP) != $(DOT) SubDir FT2_TOP ; } -FT2_INCLUDE = [ FT2_SubDir include ] ; -FT2_SRC = [ FT2_SubDir src ] ; +# +# The following macros define the include directory, the source directory +# and the final library name (without library extensions). They can be +# replaced by other definitions when the library is compiled as part of +# a larger project. +# -FT2_LIB = $(LIBPREFIX)freetype ; +# name of FreeType include directory during compilation. +# relative to FT2_TOP +# +FT2_INCLUDE_DIR ?= include ; +# name of FreeType source directory during compilation. +# relative to FT2_TOP +# +FT2_SRC_DIR ?= src ; + +# name of final library, without extension +# +FT2_LIB ?= $(LIBPREFIX)freetype ; + + +# define FT2_BUILD_INCLUDE to point to your build-specific directory +# this is prepended to FT2_INCLUDE_DIR. This can be used to specify +# the location of a custom which will point to custom +# versions of "ftmodule.h" and "ftoption.h", for example +# +FT2_BUILD_INCLUDE ?= ; + +# the list of modules to compile on any given build of the library +# by default, this will contain _all_ modules defined in FT2_SRC_DIR +# +# IMPORTANT: You'll need to change the content of "ftmodule.h" as well +# if you modify this list or provide your own. +# +FT2_COMPONENTS ?= gzip # support for gzip-compressed files. + autohint # auto-hinter + base # base component (public APIs) + bdf # BDF font driver + cache # cache sub-system + cff # CFF/CEF font driver + cid # Postscript CID-keyed font driver + pcf # PCF font driver + pfr # PFR/TrueDoc font driver + psaux # Common Postscript routines module + pshinter # Postscript hinter module + psnames # Postscript names handling + raster # Monochrome rasterizer + smooth # Anti-aliased rasterizer + sfnt # SFNT-based format support routines + truetype # TrueType font driver + type1 # Postscript Type 1 font driver + type42 # Postscript Type 42 (embedded TrueType) driver + winfonts # Windows FON/FNT font driver + ; + + +# don't touch +# +FT2_INCLUDE = $(FT2_BUILD_INCLUDE) + [ FT2_SubDir $(FT2_INCLUDE_DIR) ] ; + +FT2_SRC = [ FT2_SubDir $(FT2_SRC_DIR) ] ; + +# only used by FreeType developers +# if $(DEBUG_HINTER) { CCFLAGS += -DDEBUG_HINTER ; @@ -24,7 +100,7 @@ if $(DEBUG_HINTER) # We need "freetype2/include" in the current include path in order to # compile any part of FreeType 2. # -SubDirHdr += $(FT2_INCLUDE) ; +SubDirHdr += $(FT2_INCLUDE) ; # Uncomment the following line if you want to build individual source files # for each FreeType 2 module. @@ -41,10 +117,10 @@ HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ; # Now include the Jamfile in "freetype2/src", used to drive the compilation # of each FreeType 2 component and/or module. # -SubInclude FT2_TOP src ; +SubInclude FT2_TOP $(FT2_SRC_DIR) ; -# tests files (hinter debugging) +# tests files (hinter debugging). only used by FreeType developers # if $(DEBUG_HINTER) { diff --git a/Jamfile.in b/Jamfile.in index f12c13f78..65dd0640a 100644 --- a/Jamfile.in +++ b/Jamfile.in @@ -48,7 +48,7 @@ HDRMACRO [ FT2_SubDir include freetype internal internal.h ] ; # Now include the Jamfile in "freetype2/src", used to drive the compilation # of each FreeType 2 component and/or module. # -SubInclude FT2_TOP src ; +SubInclude FT2_TOP $(FT2_SRC_DIR) ; # tests files (hinter debugging) diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h index c00a40268..85c9e45be 100644 --- a/include/freetype/config/ftoption.h +++ b/include/freetype/config/ftoption.h @@ -92,7 +92,7 @@ FT_BEGIN_HEADER /* file "ftconfig.h" either statically, or through Autoconf */ /* on platforms that support it. */ /* */ -#undef FT_CONFIG_OPTION_FORCE_INT64 +#undef FT_CONFIG_OPTION_FORCE_INT64 /*************************************************************************/ @@ -110,6 +110,28 @@ FT_BEGIN_HEADER /* */ #define FT_CONFIG_OPTION_USE_ZLIB + + /*************************************************************************/ + /* */ + /* ZLib library selection */ + /* */ + /* This macro is only used when FT_CONFIG_OPTION_USE_ZLIB is defined. */ + /* It allows FreeType's "ftgzip" component to link to the system's */ + /* installation of the ZLib library. This is useful on systems like */ + /* Unix or VMS where it generally is already available. */ + /* */ + /* If you let it undefined, the component will use its own copy */ + /* of the zlib sources instead. These have been modified to be */ + /* included directly within the component and *not* export external */ + /* function names. This allows you to link any program with FreeType */ + /* _and_ ZLib without linking conflicts. */ + /* */ + /* do not #undef this macro here, since the build system might */ + /* define for certain configurations */ + /* */ +/* #define FT_CONFIG_OPTION_SYSTEM_ZLIB */ + + /*************************************************************************/ /* */ /* DLL export compilation */ @@ -145,8 +167,8 @@ FT_BEGIN_HEADER /* will be later automatically defined as `extern return_type' to */ /* allow normal compilation. */ /* */ -#undef FT_EXPORT -#undef FT_EXPORT_DEF +/* #define FT_EXPORT(x) extern x */ +/* #define FT_EXPORT_DEF(x) x */ /*************************************************************************/ @@ -199,7 +221,7 @@ FT_BEGIN_HEADER /* This allows FreeType to be used with the PostScript language, using */ /* the GhostScript interpreter. */ /* */ -#undef FT_CONFIG_OPTION_INCREMENTAL +/* #define FT_CONFIG_OPTION_INCREMENTAL */ /*************************************************************************/ @@ -236,8 +258,8 @@ FT_BEGIN_HEADER /* */ /* Don't define any of these macros to compile in `release' mode! */ /* */ -#undef FT_DEBUG_LEVEL_ERROR -#undef FT_DEBUG_LEVEL_TRACE +/* #define FT_DEBUG_LEVEL_ERROR */ +/* #define FT_DEBUG_LEVEL_TRACE */ /*************************************************************************/ @@ -252,7 +274,7 @@ FT_BEGIN_HEADER /* Note that the memory debugger is only activated at runtime when */ /* when the _environment_ variable "FT_DEBUG_MEMORY" is also defined! */ /* */ -#undef FT_DEBUG_MEMORY +/* #define FT_DEBUG_MEMORY */ @@ -353,7 +375,10 @@ FT_BEGIN_HEADER /* By undefining this, you will only compile the code necessary to load */ /* TrueType glyphs without hinting. */ /* */ -#undef TT_CONFIG_OPTION_BYTECODE_INTERPRETER + /* do not #undef this macro here, since the build system might */ + /* define for certain configurations */ + /* */ +/* #define TT_CONFIG_OPTION_BYTECODE_INTERPRETER */ /*************************************************************************/ diff --git a/include/freetype/freetype.h b/include/freetype/freetype.h index 82a5de42e..4e7b03bd7 100644 --- a/include/freetype/freetype.h +++ b/include/freetype/freetype.h @@ -2037,7 +2037,7 @@ FT_BEGIN_HEADER * when you want to retrieve the original glyph outlines in font units. * * FT_LOAD_NO_HINTING :: - * Don't hint glyph outlines after their scaling to device pixels. + * Don't hint glyph outlines after their scaling to device pixels. * This generally generates "blurrier" glyphs in anti-aliased modes. * * This flag is ignored if @FT_LOAD_NO_SCALE is set. @@ -2143,10 +2143,11 @@ FT_BEGIN_HEADER /* */ -#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 7 ) << 16 ) -#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 7 ) ) +#define FT_LOAD_TARGET_( x ) ( (FT_Int32)( (x) & 15 ) << 16 ) +#define FT_LOAD_TARGET_MODE( x ) ( (FT_Render_Mode)( ( (x) >> 16 ) & 15 ) ) #define FT_LOAD_TARGET_NORMAL FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL ) +#define FT_LOAD_TARGET_LIGHT FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT ) #define FT_LOAD_TARGET_MONO FT_LOAD_TARGET_( FT_RENDER_MODE_MONO ) #define FT_LOAD_TARGET_LCD FT_LOAD_TARGET_( FT_RENDER_MODE_LCD ) #define FT_LOAD_TARGET_LCD_V FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V ) @@ -2201,6 +2202,13 @@ FT_BEGIN_HEADER /* This is the default render mode; it corresponds to 8-bit */ /* anti-aliased bitmaps, using 256 levels of opacity. */ /* */ + /* FT_RENDER_MODE_LIGHT :: */ + /* This is similar to @FT_RENDER_MODE_NORMAL, except that this */ + /* changes the hinting to prevent stem width quantization. This */ + /* results in glyph shapes that are more similar to the original, */ + /* while being a bit more fuzzy ("better shapes", instead of */ + /* "better contrast" if you want :-) */ + /* */ /* FT_RENDER_MODE_MONO :: */ /* This mode corresponds to 1-bit bitmaps. */ /* */ @@ -2224,6 +2232,7 @@ FT_BEGIN_HEADER typedef enum FT_Render_Mode_ { FT_RENDER_MODE_NORMAL = 0, + FT_RENDER_MODE_LIGHT, FT_RENDER_MODE_MONO, FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V, diff --git a/src/Jamfile b/src/Jamfile index bbaa4b7ca..e4d357569 100644 --- a/src/Jamfile +++ b/src/Jamfile @@ -1,37 +1,17 @@ # FreeType 2 src Jamfile (c) 2001, 2002 David Turner # -SubDir FT2_TOP src ; - -# We need to add "freetype/src" to the current include path in order to -# compile any part of FreeType 2. -# -SubDirHdrs [ FT2_SubDir src ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) ; # The file is used to define macros that are # later used in #include statements. It needs to be parsed in order to # record these definitions. # -HDRMACRO [ FT2_SubDir include internal internal.h ] ; +HDRMACRO [ FT2_SubDir $(FT2_INCLUDE_DIR) internal internal.h ] ; -SubInclude FT2_TOP src gzip ; -SubInclude FT2_TOP src autohint ; -SubInclude FT2_TOP src base ; -SubInclude FT2_TOP src bdf ; -SubInclude FT2_TOP src cache ; -SubInclude FT2_TOP src cff ; -SubInclude FT2_TOP src cid ; -SubInclude FT2_TOP src pcf ; -SubInclude FT2_TOP src pfr ; -SubInclude FT2_TOP src psaux ; -SubInclude FT2_TOP src pshinter ; -SubInclude FT2_TOP src psnames ; -SubInclude FT2_TOP src raster ; -SubInclude FT2_TOP src sfnt ; -SubInclude FT2_TOP src smooth ; -SubInclude FT2_TOP src truetype ; -SubInclude FT2_TOP src type1 ; -SubInclude FT2_TOP src type42 ; -SubInclude FT2_TOP src winfonts ; +for xx in $(FT2_COMPONENTS) +{ + SubInclude FT2_TOP $(FT2_SRC_DIR) $(xx) ; +} # end of src Jamfile diff --git a/src/autohint/Jamfile b/src/autohint/Jamfile index ed2da3acc..a129e5eea 100644 --- a/src/autohint/Jamfile +++ b/src/autohint/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/autohint Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src autohint ; - -SubDirHdrs [ FT2_SubDir src autohint ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) autohint ; { local _sources ; diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 14981122d..dacde6eea 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -233,11 +233,8 @@ sign = -1; } + /* do not touch serifs widths !! */ #if 0 - if ( dist < 32 ) - dist = 32; -#else - /* do not strengthen serifs */ if ( base->flags & AH_EDGE_DONE ) { if ( dist >= 64 ) @@ -360,77 +357,50 @@ if ( edge2->blue_edge || edge2 < edge ) { -#if 0 - printf( "strange blue alignment, edge %d to %d\n", - edge - edges, edge2 - edges ); -#endif - ah_align_linked_edge( hinter, edge2, edge, dimension ); edge->flags |= AH_EDGE_DONE; continue; } + if ( !anchor ) { -#if 0 - FT_Bool min = 0; -#endif + edge->pos = ( edge->opos + 32 ) & -64; + anchor = edge; + + edge->flags |= AH_EDGE_DONE; + + ah_align_linked_edge( hinter, edge, edge2, dimension ); + } + else + { + FT_Pos org_pos, org_len, org_center, cur_len; + FT_Pos cur_pos1, cur_pos2, delta1, delta2; - if ( !anchor ) - { - edge->pos = ( edge->opos + 32 ) & -64; - anchor = edge; + org_pos = anchor->pos + (edge->opos - anchor->opos); + org_len = edge2->opos - edge->opos; + org_center = org_pos + ( org_len >> 1 ); - edge->flags |= AH_EDGE_DONE; + cur_len = ah_compute_stem_width( hinter, dimension, org_len ); - ah_align_linked_edge( hinter, edge, edge2, dimension ); - } - else - { - FT_Pos org_pos, org_len, org_center, cur_len; - FT_Pos cur_pos1, cur_pos2, delta1, delta2; + cur_pos1 = ( org_pos + 32 ) & -64; + delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center ); + if ( delta1 < 0 ) + delta1 = -delta1; + cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len; + delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center ); + if ( delta2 < 0 ) + delta2 = -delta2; - org_pos = anchor->pos + (edge->opos - anchor->opos); - org_len = edge2->opos - edge->opos; - org_center = org_pos + ( org_len >> 1 ); + edge->pos = ( delta1 <= delta2 ) ? cur_pos1 : cur_pos2; + edge2->pos = edge->pos + cur_len; - cur_len = ah_compute_stem_width( hinter, dimension, org_len ); + edge->flags |= AH_EDGE_DONE; + edge2->flags |= AH_EDGE_DONE; - cur_pos1 = ( org_pos + 32 ) & -64; - delta1 = ( cur_pos1 + ( cur_len >> 1 ) - org_center ); - if ( delta1 < 0 ) - delta1 = -delta1; - - cur_pos2 = ( ( org_pos + org_len + 32 ) & -64 ) - cur_len; - delta2 = ( cur_pos2 + ( cur_len >> 1 ) - org_center ); - if ( delta2 < 0 ) - delta2 = -delta2; - - edge->pos = ( delta1 <= delta2 ) ? cur_pos1 : cur_pos2; - edge2->pos = edge->pos + cur_len; - - edge->flags |= AH_EDGE_DONE; - edge2->flags |= AH_EDGE_DONE; - - if ( edge > edges && edge->pos < edge[-1].pos ) - edge->pos = edge[-1].pos; - -#if 0 - delta = 0; - if ( edge2 + 1 < edge_limit && - edge2[1].flags & AH_EDGE_DONE ) - delta = edge2[1].pos - edge2->pos; - - if ( delta < 0 ) - { - edge2->pos += delta; - if ( !min ) - edge->pos += delta; - } - edge2->flags |= AH_EDGE_DONE; -#endif - } + if ( edge > edges && edge->pos < edge[-1].pos ) + edge->pos = edge[-1].pos; } } diff --git a/src/base/Jamfile b/src/base/Jamfile index 956fb0973..8e52df632 100644 --- a/src/base/Jamfile +++ b/src/base/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/base Jamfile (c) 2001, 2002 David Turner # -SubDir FT2_TOP src base ; - -SubDirHdrs [ FT2_SubDir src base ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) base ; { local _sources ; diff --git a/src/bdf/Jamfile b/src/bdf/Jamfile index 6fe3a7e1f..8b1714d98 100644 --- a/src/bdf/Jamfile +++ b/src/bdf/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/bdf Jamfile (c) 2002 David Turner # -SubDir FT2_TOP src bdf ; - -SubDirHdrs [ FT2_SubDir src bdf ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) bdf ; { local _sources ; diff --git a/src/cache/Jamfile b/src/cache/Jamfile index 3148f558e..099fd5e36 100644 --- a/src/cache/Jamfile +++ b/src/cache/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/cache Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src cache ; - -SubDirHdrs [ FT2_SubDir src cache ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) cache ; # The file contains some macro definitions that are # later used in #include statements related to the cache sub-system. It diff --git a/src/cff/Jamfile b/src/cff/Jamfile index 0c46ec78e..cf7cf6313 100644 --- a/src/cff/Jamfile +++ b/src/cff/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/cff Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src cff ; - -SubDirHdrs [ FT2_SubDir src cff ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) cff ; { local _sources ; diff --git a/src/cid/Jamfile b/src/cid/Jamfile index 87c580dc0..a505e3ca4 100644 --- a/src/cid/Jamfile +++ b/src/cid/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/cid Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src cid ; - -SubDirHdrs [ FT2_SubDir src cid ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) cid ; { local _sources ; diff --git a/src/gzip/Jamfile b/src/gzip/Jamfile index 0824ee887..e461cf174 100644 --- a/src/gzip/Jamfile +++ b/src/gzip/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/gzip Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src gzip ; - -SubDirHdrs [ FT2_SubDir src gzip ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) gzip ; Library $(FT2_LIB) : ftgzip.c ; diff --git a/src/gzip/adler32.c b/src/gzip/adler32.c index fae88b655..f6bf3244e 100644 --- a/src/gzip/adler32.c +++ b/src/gzip/adler32.c @@ -1,6 +1,6 @@ /* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2002 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -18,7 +18,7 @@ #define DO16(buf) DO8(buf,0); DO8(buf,8); /* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) +ZEXTERNDEF uLong ZEXPORT adler32(adler, buf, len) uLong adler; const Bytef *buf; uInt len; diff --git a/src/gzip/ftgzip.c b/src/gzip/ftgzip.c index 22896b340..91c0cd4f9 100644 --- a/src/gzip/ftgzip.c +++ b/src/gzip/ftgzip.c @@ -27,13 +27,24 @@ #ifdef FT_CONFIG_OPTION_USE_ZLIB -# define NO_DUMMY_DECL -# define BUILDFIXED /* save code size */ +#ifdef FT_CONFIG_OPTION_SYSTEM_ZLIB # include "zlib.h" -# if 1 /* we choose to include directly the zlib sources in this component */ - /* this is done to avoid ugly library dependencies */ +#else /* !SYSTEM_ZLIB */ + + /* in this case, we include our own modified sources of the ZLib */ + /* within the "ftgzip" component. The modifications were necessary */ + /* to #include all files without conflicts, as well as preventing */ + /* the definition of "extern" functions that may cause linking */ + /* conflicts when a program is linked with both FreeType and the */ + /* original ZLib */ + +# define NO_DUMMY_DECL +# define BUILDFIXED /* save code size */ +# define MY_ZCALLOC + +# include "zlib.h" # undef SLOW # define SLOW 1 /* we can't use asm-optimized sources here !! */ @@ -46,7 +57,7 @@ # include "inflate.c" # include "adler32.c" -# endif /* 1 */ +#endif /* !SYSTEM_ZLIB */ /***************************************************************************/ @@ -82,6 +93,27 @@ } +#ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB + + local voidpf + zcalloc (opaque, items, size) + voidpf opaque; + unsigned items; + unsigned size; + { + return ft_gzip_alloc( opaque, items, size ); + } + + local void + zcfree( voidpf opaque, + voidpf ptr ) + { + ft_gzip_free( opaque, ptr ); + } + +#endif /* !SYSTEM_ZLIB */ + + /***************************************************************************/ /***************************************************************************/ /***** *****/ diff --git a/src/gzip/infblock.c b/src/gzip/infblock.c index e28671299..423af8178 100644 --- a/src/gzip/infblock.c +++ b/src/gzip/infblock.c @@ -64,7 +64,7 @@ local const uInt border[] = { /* Order of the bit length code lengths */ */ -void inflate_blocks_reset(s, z, c) +local void inflate_blocks_reset(s, z, c) inflate_blocks_statef *s; z_streamp z; uLongf *c; @@ -85,7 +85,7 @@ uLongf *c; } -inflate_blocks_statef *inflate_blocks_new(z, c, w) +local inflate_blocks_statef *inflate_blocks_new(z, c, w) z_streamp z; check_func c; uInt w; @@ -116,7 +116,7 @@ uInt w; } -int inflate_blocks(s, z, r) +local int inflate_blocks(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; @@ -368,7 +368,7 @@ int r; } -int inflate_blocks_free(s, z) +local int inflate_blocks_free(s, z) inflate_blocks_statef *s; z_streamp z; { @@ -381,22 +381,3 @@ z_streamp z; } -void inflate_set_dictionary(s, d, n) -inflate_blocks_statef *s; -const Bytef *d; -uInt n; -{ - zmemcpy(s->window, d, n); - s->read = s->write = s->window + n; -} - - -/* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. - * IN assertion: s != Z_NULL - */ -int inflate_blocks_sync_point(s) -inflate_blocks_statef *s; -{ - return s->mode == LENS; -} diff --git a/src/gzip/infblock.h b/src/gzip/infblock.h index ddd7a03c4..c2535a1e4 100644 --- a/src/gzip/infblock.h +++ b/src/gzip/infblock.h @@ -14,31 +14,23 @@ struct inflate_blocks_state; typedef struct inflate_blocks_state FAR inflate_blocks_statef; -extern inflate_blocks_statef * inflate_blocks_new OF(( +local inflate_blocks_statef * inflate_blocks_new OF(( z_streamp z, check_func c, /* check function */ uInt w)); /* window size */ -extern int inflate_blocks OF(( +local int inflate_blocks OF(( inflate_blocks_statef *, z_streamp , int)); /* initial return code */ -extern void inflate_blocks_reset OF(( +local void inflate_blocks_reset OF(( inflate_blocks_statef *, z_streamp , uLongf *)); /* check value on output */ -extern int inflate_blocks_free OF(( +local int inflate_blocks_free OF(( inflate_blocks_statef *, z_streamp)); -extern void inflate_set_dictionary OF(( - inflate_blocks_statef *s, - const Bytef *d, /* dictionary */ - uInt n)); /* dictionary length */ - -extern int inflate_blocks_sync_point OF(( - inflate_blocks_statef *s)); - #endif /* _INFBLOCK_H */ diff --git a/src/gzip/infcodes.c b/src/gzip/infcodes.c index 9f87f5230..0347fc2a4 100644 --- a/src/gzip/infcodes.c +++ b/src/gzip/infcodes.c @@ -55,7 +55,7 @@ struct inflate_codes_state { }; -inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) +local inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) uInt bl, bd; inflate_huft *tl; inflate_huft *td; /* need separate declaration for Borland C++ */ @@ -77,7 +77,7 @@ z_streamp z; } -int inflate_codes(s, z, r) +local int inflate_codes(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; @@ -241,7 +241,7 @@ int r; } -void inflate_codes_free(c, z) +local void inflate_codes_free(c, z) inflate_codes_statef *c; z_streamp z; { diff --git a/src/gzip/infcodes.h b/src/gzip/infcodes.h index 9b4fa324d..154d7f896 100644 --- a/src/gzip/infcodes.h +++ b/src/gzip/infcodes.h @@ -14,17 +14,17 @@ struct inflate_codes_state; typedef struct inflate_codes_state FAR inflate_codes_statef; -extern inflate_codes_statef *inflate_codes_new OF(( +local inflate_codes_statef *inflate_codes_new OF(( uInt, uInt, inflate_huft *, inflate_huft *, z_streamp )); -extern int inflate_codes OF(( +local int inflate_codes OF(( inflate_blocks_statef *, z_streamp , int)); -extern void inflate_codes_free OF(( +local void inflate_codes_free OF(( inflate_codes_statef *, z_streamp )); diff --git a/src/gzip/inflate.c b/src/gzip/inflate.c index cc625542a..72b01a925 100644 --- a/src/gzip/inflate.c +++ b/src/gzip/inflate.c @@ -136,14 +136,6 @@ int stream_size; } -int ZEXPORT inflateInit_(z, version, stream_size) -z_streamp z; -const char *version; -int stream_size; -{ - return inflateInit2_(z, DEF_WBITS, version, stream_size); -} - #undef NEEDBYTE #define NEEDBYTE {if(z->avail_in==0)return r;r=f;} @@ -279,93 +271,3 @@ int f; #endif } - -int ZEXPORT inflateSetDictionary(z, dictionary, dictLength) -z_streamp z; -const Bytef *dictionary; -uInt dictLength; -{ - uInt length = dictLength; - - if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0) - return Z_STREAM_ERROR; - - if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR; - z->adler = 1L; - - if (length >= ((uInt)1<state->wbits)) - { - length = (1<state->wbits)-1; - dictionary += dictLength - length; - } - inflate_set_dictionary(z->state->blocks, dictionary, length); - z->state->mode = BLOCKS; - return Z_OK; -} - - -int ZEXPORT inflateSync(z) -z_streamp z; -{ - uInt n; /* number of bytes to look at */ - Bytef *p; /* pointer to bytes */ - uInt m; /* number of marker bytes found in a row */ - uLong r, w; /* temporaries to save total_in and total_out */ - - /* set up */ - if (z == Z_NULL || z->state == Z_NULL) - return Z_STREAM_ERROR; - if (z->state->mode != BAD) - { - z->state->mode = BAD; - z->state->sub.marker = 0; - } - if ((n = z->avail_in) == 0) - return Z_BUF_ERROR; - p = z->next_in; - m = z->state->sub.marker; - - /* search */ - while (n && m < 4) - { - static const Byte mark[4] = {0, 0, 0xff, 0xff}; - if (*p == mark[m]) - m++; - else if (*p) - m = 0; - else - m = 4 - m; - p++, n--; - } - - /* restore */ - z->total_in += p - z->next_in; - z->next_in = p; - z->avail_in = n; - z->state->sub.marker = m; - - /* return no joy or set up to restart on a new block */ - if (m != 4) - return Z_DATA_ERROR; - r = z->total_in; w = z->total_out; - inflateReset(z); - z->total_in = r; z->total_out = w; - z->state->mode = BLOCKS; - return Z_OK; -} - - -/* Returns true if inflate is currently at the end of a block generated - * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH - * but removes the length bytes of the resulting empty stored block. When - * decompressing, PPP checks that at the end of input packet, inflate is - * waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(z) -z_streamp z; -{ - if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) - return Z_STREAM_ERROR; - return inflate_blocks_sync_point(z->state->blocks); -} diff --git a/src/gzip/inftrees.c b/src/gzip/inftrees.c index d7946a896..ec57d39ed 100644 --- a/src/gzip/inftrees.c +++ b/src/gzip/inftrees.c @@ -10,7 +10,7 @@ # define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */ #endif -const char inflate_copyright[] = +local const char inflate_copyright[] = " inflate 1.1.4 Copyright 1995-2002 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome @@ -212,7 +212,7 @@ uIntf *v; /* working area: values in order of bit length */ /* compute minimum size table less than or equal to l bits */ z = g - w; - z = z > (uInt)l ? l : z; /* table size upper limit */ + z = z > (uInt)l ? (uInt)l : z; /* table size upper limit */ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ { /* too few codes for k-w bit table */ f -= a + 1; /* deduct codes from patterns left */ @@ -289,7 +289,7 @@ uIntf *v; /* working area: values in order of bit length */ } -int inflate_trees_bits(c, bb, tb, hp, z) +local int inflate_trees_bits(c, bb, tb, hp, z) uIntf *c; /* 19 code lengths */ uIntf *bb; /* bits tree desired/actual depth */ inflate_huft * FAR *tb; /* bits tree result */ @@ -316,7 +316,7 @@ z_streamp z; /* for messages */ } -int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) +local int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) uInt nl; /* number of literal/length codes */ uInt nd; /* number of distance codes */ uIntf *c; /* that many (total) code lengths */ @@ -394,7 +394,7 @@ local inflate_huft *fixed_td; #endif -int inflate_trees_fixed(bl, bd, tl, td, z) +local int inflate_trees_fixed(bl, bd, tl, td, z) uIntf *bl; /* literal desired/actual bit depth */ uIntf *bd; /* distance desired/actual bit depth */ inflate_huft * FAR *tl; /* literal/length tree result */ diff --git a/src/gzip/inftrees.h b/src/gzip/inftrees.h index 17cbd833b..92d2f284e 100644 --- a/src/gzip/inftrees.h +++ b/src/gzip/inftrees.h @@ -35,14 +35,14 @@ struct inflate_huft_s { value below is more than safe. */ #define MANY 1440 -extern int inflate_trees_bits OF(( +local int inflate_trees_bits OF(( uIntf *, /* 19 code lengths */ uIntf *, /* bits tree desired/actual depth */ inflate_huft * FAR *, /* bits tree result */ inflate_huft *, /* space for trees */ z_streamp)); /* for messages */ -extern int inflate_trees_dynamic OF(( +local int inflate_trees_dynamic OF(( uInt, /* number of literal/length codes */ uInt, /* number of distance codes */ uIntf *, /* that many (total) code lengths */ @@ -53,7 +53,7 @@ extern int inflate_trees_dynamic OF(( inflate_huft *, /* space for trees */ z_streamp)); /* for messages */ -extern int inflate_trees_fixed OF(( +local int inflate_trees_fixed OF(( uIntf *, /* literal desired/actual bit depth */ uIntf *, /* distance desired/actual bit depth */ inflate_huft * FAR *, /* literal/length tree result */ diff --git a/src/gzip/infutil.c b/src/gzip/infutil.c index 52f7c82c1..9a6b92fca 100644 --- a/src/gzip/infutil.c +++ b/src/gzip/infutil.c @@ -11,7 +11,7 @@ /* And'ing with mask[n] masks the lower n bits */ -uInt inflate_mask[17] = { +local uInt inflate_mask[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff @@ -19,7 +19,7 @@ uInt inflate_mask[17] = { /* copy as much as possible from the sliding window to the output area */ -int inflate_flush(s, z, r) +local int inflate_flush(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; diff --git a/src/gzip/infutil.h b/src/gzip/infutil.h index de4e7732f..820dcd327 100644 --- a/src/gzip/infutil.h +++ b/src/gzip/infutil.h @@ -85,10 +85,10 @@ struct inflate_blocks_state { #define LOAD {LOADIN LOADOUT} /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ -extern uInt inflate_mask[17]; +local uInt inflate_mask[17]; /* copy as much as possible from the sliding window to the output area */ -extern int inflate_flush OF(( +local int inflate_flush OF(( inflate_blocks_statef *, z_streamp , int)); diff --git a/src/gzip/zconf.h b/src/gzip/zconf.h index eb0ae2e1a..2e66fb3e2 100644 --- a/src/gzip/zconf.h +++ b/src/gzip/zconf.h @@ -1,6 +1,6 @@ /* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2002 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h + * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id$ */ @@ -188,13 +188,6 @@ # endif #endif -#if defined (__BEOS__) -# if defined (ZLIB_DLL) -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -#endif #ifndef ZEXPORT # define ZEXPORT @@ -203,7 +196,10 @@ # define ZEXPORTVA #endif #ifndef ZEXTERN -# define ZEXTERN extern +# define ZEXTERN static +#endif +#ifndef ZEXTERNDEF +# define ZEXTERNDEF static #endif #ifndef FAR diff --git a/src/gzip/zlib.h b/src/gzip/zlib.h index a2814cf7e..e0c899b89 100644 --- a/src/gzip/zlib.h +++ b/src/gzip/zlib.h @@ -163,12 +163,9 @@ typedef z_stream FAR *z_streamp; #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ /* basic functions */ -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. @@ -198,7 +195,6 @@ ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); */ -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some @@ -276,7 +272,6 @@ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); */ -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any @@ -441,9 +436,6 @@ ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, not perform any compression: this will be done by deflate(). */ -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called @@ -477,8 +469,6 @@ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, perform any compression: this will be done by deflate(). */ -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. @@ -495,7 +485,6 @@ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, destination. */ -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. @@ -506,9 +495,6 @@ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); stream state was inconsistent (such as zalloc or state being NULL). */ -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be @@ -550,9 +536,6 @@ ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, modified, but next_out and avail_out are unchanged.) */ -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate @@ -569,7 +552,6 @@ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, inflate(). */ -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all @@ -605,8 +587,6 @@ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); utility functions can easily be modified if you need special options. */ -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total @@ -620,9 +600,6 @@ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, buffer. */ -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte @@ -635,8 +612,6 @@ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, Z_STREAM_ERROR if the level parameter is invalid. */ -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total @@ -654,9 +629,6 @@ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, */ -typedef voidp gzFile; - -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); /* Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level @@ -672,7 +644,6 @@ ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen() associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or @@ -685,7 +656,6 @@ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); the (de)compression state. */ -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. @@ -693,7 +663,6 @@ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); opened for writing. */ -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number @@ -701,29 +670,24 @@ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). */ -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - const voidp buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written (0 in case of error). */ -ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); /* Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). */ -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file @@ -732,19 +696,16 @@ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); gzgets returns buf, or Z_NULL in case of error. */ -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib @@ -754,8 +715,6 @@ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); degrade compression. */ -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); /* Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the @@ -772,14 +731,12 @@ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, would be before the current position. */ -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); /* Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the @@ -788,20 +745,17 @@ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see function gzerror below). */ -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an @@ -835,7 +789,6 @@ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); if (adler != original_adler) error(); */ -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running crc with the bytes buf[0..len-1] and return the updated crc. If buf is NULL, this function returns the required initial value @@ -857,14 +810,6 @@ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); #define deflateInit(strm, level) \ @@ -878,10 +823,6 @@ ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) -ZEXTERN const char * ZEXPORT zError OF((int err)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); -ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); - #ifdef __cplusplus } #endif diff --git a/src/gzip/zutil.c b/src/gzip/zutil.c index 6e0eb2325..5da9f9813 100644 --- a/src/gzip/zutil.c +++ b/src/gzip/zutil.c @@ -11,48 +11,6 @@ extern void exit OF((int)); #endif -const char *z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int z_verbose = verbose; - -void z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - #ifndef HAVE_MEMCPY diff --git a/src/gzip/zutil.h b/src/gzip/zutil.h index 718ebc15b..2210515d9 100644 --- a/src/gzip/zutil.h +++ b/src/gzip/zutil.h @@ -37,10 +37,6 @@ typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; -extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ return (strm->msg = (char*)ERR_MSG(err), (err)) @@ -176,7 +172,7 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ # define zmemcmp _fmemcmp # define zmemzero(dest, len) _fmemset(dest, 0, len) # else -# define zmemcpy memcpy +# define zmemcpy ft_memcpy # define zmemcmp memcmp # define zmemzero(dest, len) memset(dest, 0, len) # endif @@ -209,8 +205,8 @@ extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, uInt len)); -voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); -void zcfree OF((voidpf opaque, voidpf ptr)); +local voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); +local void zcfree OF((voidpf opaque, voidpf ptr)); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) diff --git a/src/pcf/Jamfile b/src/pcf/Jamfile index 8625fa146..fd7762585 100644 --- a/src/pcf/Jamfile +++ b/src/pcf/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/pcf Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src pcf ; - -SubDirHdrs [ FT2_SubDir src pcf ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) pcf ; { local _sources ; diff --git a/src/pfr/Jamfile b/src/pfr/Jamfile index 73ffe4bc7..3ba0ee9af 100644 --- a/src/pfr/Jamfile +++ b/src/pfr/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/pfr Jamfile (c) 2002 David Turner # -SubDir FT2_TOP src pfr ; - -SubDirHdrs [ FT2_SubDir src pfr ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) pfr ; { local _sources ; diff --git a/src/pfr/pfrdrivr.c b/src/pfr/pfrdrivr.c index c0697f5fe..07ba9b4cd 100644 --- a/src/pfr/pfrdrivr.c +++ b/src/pfr/pfrdrivr.c @@ -83,7 +83,6 @@ FT_Fixed *ametrics_x_scale, FT_Fixed *ametrics_y_scale ) { - FT_Error error = 0; PFR_PhyFont phys = &face->phy_font; FT_Fixed x_scale, y_scale; FT_Size size = face->root.size; @@ -111,6 +110,8 @@ if ( ametrics_y_scale ) *ametrics_y_scale = y_scale; + + return 0; } diff --git a/src/pfr/pfrload.c b/src/pfr/pfrload.c index bd4d2a981..0cb32f4cf 100644 --- a/src/pfr/pfrload.c +++ b/src/pfr/pfrload.c @@ -860,7 +860,7 @@ cur->advance = ( flags & PFR_PHY_PROPORTIONAL ) ? PFR_NEXT_SHORT( p ) - : phy_font->standard_advance; + : (FT_Int) phy_font->standard_advance; #if 0 cur->ascii = ( flags & PFR_PHY_ASCII_CODE ) diff --git a/src/psaux/Jamfile b/src/psaux/Jamfile index e3160696d..fc834b32c 100644 --- a/src/psaux/Jamfile +++ b/src/psaux/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/psaux Jamfile (c) 2001, 2002 David Turner # -SubDir FT2_TOP src psaux ; - -SubDirHdrs [ FT2_SubDir src psaux ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) psaux ; { local _sources ; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index f1cea1ed8..603595062 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -174,7 +174,11 @@ in_offset = -1; while ( new_size < table->cursor + length ) - new_size += 1024; + { + /* increase size by 25% and round up to the nearest multiple of 1024 */ + new_size += (new_size >> 2) + 1; + new_size = ( new_size + 1023 ) & -1024; + } error = reallocate_t1_table( table, new_size ); if ( error ) diff --git a/src/pshinter/Jamfile b/src/pshinter/Jamfile index 9e4003865..8eb3dea8b 100644 --- a/src/pshinter/Jamfile +++ b/src/pshinter/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/pshinter Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src pshinter ; - -SubDirHdrs [ FT2_SubDir src pshinter ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) pshinter ; { local _sources ; diff --git a/src/psnames/Jamfile b/src/psnames/Jamfile index e9e22ea3f..e75ae1e7a 100644 --- a/src/psnames/Jamfile +++ b/src/psnames/Jamfile @@ -1,13 +1,11 @@ # FreeType 2 src/psnames Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src psnames ; - -SubDirHdrs [ FT2_SubDir src psnames ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) psnames ; { local _sources ; - + if $(FT2_MULTI) { _sources = psmodule ; @@ -16,7 +14,7 @@ SubDirHdrs [ FT2_SubDir src psnames ] ; { _sources = psnames ; } - + Library $(FT2_LIB) : $(_sources).c ; } diff --git a/src/raster/Jamfile b/src/raster/Jamfile index 6c75e0de5..01b5c0db0 100644 --- a/src/raster/Jamfile +++ b/src/raster/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/raster Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src raster ; - -SubDirHdrs [ FT2_SubDir src raster ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) raster ; { local _sources ; diff --git a/src/sfnt/Jamfile b/src/sfnt/Jamfile index d7722e396..adddfb6fd 100644 --- a/src/sfnt/Jamfile +++ b/src/sfnt/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/sfnt Jamfile (c) 2001, 2002 David Turner # -SubDir FT2_TOP src sfnt ; - -SubDirHdrs [ FT2_SubDir src sfnt ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) sfnt ; { local _sources ; diff --git a/src/sfnt/ttcmap0.c b/src/sfnt/ttcmap0.c index 93a7ddf29..405334577 100644 --- a/src/sfnt/ttcmap0.c +++ b/src/sfnt/ttcmap0.c @@ -1708,8 +1708,8 @@ { FT_Byte* table = face->cmap_table; FT_Byte* limit = table + face->cmap_size; - volatile FT_UInt num_cmaps; - volatile FT_Byte* p = table; + FT_UInt volatile num_cmaps; + FT_Byte* volatile p = table; if ( p + 4 > limit ) @@ -1742,7 +1742,7 @@ { FT_Byte* cmap = table + offset; FT_UInt format = TT_PEEK_USHORT( cmap ); - volatile const TT_CMap_Class* pclazz = tt_cmap_classes; + const TT_CMap_Class* volatile pclazz = tt_cmap_classes; TT_CMap_Class clazz; diff --git a/src/smooth/Jamfile b/src/smooth/Jamfile index 709c85613..5ab9b60c7 100644 --- a/src/smooth/Jamfile +++ b/src/smooth/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/smooth Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src smooth ; - -SubDirHdrs [ FT2_SubDir src smooth ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) smooth ; { local _sources ; diff --git a/src/truetype/Jamfile b/src/truetype/Jamfile index 4d7a31245..f847f6f0f 100644 --- a/src/truetype/Jamfile +++ b/src/truetype/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/truetype Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src truetype ; - -SubDirHdrs [ FT2_SubDir src truetype ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) truetype ; { local _sources ; diff --git a/src/type1/Jamfile b/src/type1/Jamfile index 1cbb78d4d..4d966f3d6 100644 --- a/src/type1/Jamfile +++ b/src/type1/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/type1 Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src type1 ; - -SubDirHdrs [ FT2_SubDir src type1 ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) type1 ; { local _sources ; diff --git a/src/type42/Jamfile b/src/type42/Jamfile index e133e6d86..032ac7179 100644 --- a/src/type42/Jamfile +++ b/src/type42/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/type42 Jamfile (c) 2002 David Turner # -SubDir FT2_TOP src type42 ; - -SubDirHdrs [ FT2_SubDir src type42 ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) type42 ; { local _sources ; diff --git a/src/winfonts/Jamfile b/src/winfonts/Jamfile index c45e10782..a903f8938 100644 --- a/src/winfonts/Jamfile +++ b/src/winfonts/Jamfile @@ -1,9 +1,7 @@ # FreeType 2 src/winfonts Jamfile (c) 2001 David Turner # -SubDir FT2_TOP src winfonts ; - -SubDirHdrs [ FT2_SubDir src winfonts ] ; +SubDir FT2_TOP $(FT2_SRC_DIR) winfonts ; Library $(FT2_LIB) : winfnt.c ;