From d15bc0d13a163995e1ca11925349bd64d1c33617 Mon Sep 17 00:00:00 2001 From: David Turner Date: Fri, 12 Apr 2002 09:31:48 +0000 Subject: [PATCH] * README.UNX: updated the Unix-specific quick-compilation guide to warn about the GNU Make requirement at compile time.. * include/freetype/config/ftstdlib.h, include/freetype/config/ftconfig.h, include/freetype/config/ftheader.h, include/freetype/internal/ftmemory.h, include/freetype/internal/ftobjs.h, src/autohint/ahoptim.c, src/base/ftdbgmem.c, src/base/ftdebug.c, src/base/ftmac.c, src/base/ftobjs.c, src/base/ftsystem.c, src/cache/ftcimage.c, src/cache/ftcsbits.c, src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c, src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c, src/pcf/pcfdriver.c, src/pcf/pcfread.c, src/psaux/t1cmap.c, src/psaux/t1decode.c, src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c, src/pshinter/pshrec.c, src/psnames/psmodule.c, src/raster/ftraster.c, src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c, src/smooth/ftgrays.c, src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c, src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c: added the new configuration file "ftstdlib.h" used to define aliases for all ISO C library functions used by the engine (e.g. strlen, qsort, setjmp, etc...) this eases the porting of FreeType 2 to exotic environments like XFree86 modules/extensions.. also removed many #include , #include , etc... from the engine's sources where they're not needed.. --- ChangeLog | 68 +++++++++++++++- README.UNX | 51 ++++++++++-- builds/amiga/src/base/ftdebug.c | 3 +- builds/detect.mk | 2 +- configure | 13 ++- include/freetype/config/ftconfig.h | 15 ++-- include/freetype/config/ftheader.h | 15 ++++ include/freetype/config/ftstdlib.h | 116 +++++++++++++++++++++++++++ include/freetype/internal/ftmemory.h | 10 +-- include/freetype/internal/ftobjs.h | 2 +- src/autohint/ahoptim.c | 1 - src/base/ftdbgmem.c | 7 +- src/base/ftdebug.c | 6 -- src/base/ftmac.c | 19 +++-- src/base/ftobjs.c | 7 +- src/base/ftsystem.c | 1 - src/cache/ftcimage.c | 3 - src/cache/ftcsbits.c | 2 - src/cff/cffdrivr.c | 8 +- src/cff/cffload.c | 2 +- src/cff/cffobjs.c | 4 +- src/cid/cidload.c | 9 +-- src/cid/cidparse.c | 6 +- src/cid/cidriver.c | 8 +- src/pcf/pcfdriver.c | 6 +- src/pcf/pcfread.c | 24 +++--- src/psaux/t1cmap.c | 5 +- src/psaux/t1decode.c | 2 +- src/pshinter/pshalgo1.c | 2 +- src/pshinter/pshalgo2.c | 2 +- src/pshinter/pshrec.c | 8 +- src/psnames/psmodule.c | 11 +-- src/raster/ftraster.c | 4 +- src/sfnt/sfdriver.c | 10 +-- src/sfnt/ttload.c | 4 +- src/sfnt/ttpost.c | 2 +- src/smooth/ftgrays.c | 25 +++--- src/type1/t1afm.c | 9 +-- src/type1/t1driver.c | 22 +++-- src/type1/t1gload.c | 2 - src/type1/t1load.c | 29 +++---- src/type1/t1objs.c | 6 +- src/type1/t1parse.c | 6 +- 43 files changed, 372 insertions(+), 185 deletions(-) create mode 100644 include/freetype/config/ftstdlib.h diff --git a/ChangeLog b/ChangeLog index d7916ff46..1c1ddbd02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,72 @@ +2002-04-12 David Turner + + * README.UNX: updated the Unix-specific quick-compilation guide to + warn about the GNU Make requirement at compile time.. + + * include/freetype/config/ftstdlib.h, + include/freetype/config/ftconfig.h, + include/freetype/config/ftheader.h, + include/freetype/internal/ftmemory.h, + include/freetype/internal/ftobjs.h, + + src/autohint/ahoptim.c, + + src/base/ftdbgmem.c, src/base/ftdebug.c, + src/base/ftmac.c, src/base/ftobjs.c, + src/base/ftsystem.c, + + src/cache/ftcimage.c, src/cache/ftcsbits.c, + + src/cff/cffdriver.c, src/cff/cffload.c, src/cff/cffobjs.c, + + src/cid/cidload.c, src/cid/cidparse.c, src/cid/cidriver.c, + + src/pcf/pcfdriver.c, src/pcf/pcfread.c, + + src/psaux/t1cmap.c, src/psaux/t1decode.c, + + src/pshinter/pshalgo1.c, src/pshinter/pshalgo2.c, + src/pshinter/pshrec.c, + + src/psnames/psmodule.c, + + src/raster/ftraster.c, + + src/sfnt/sfdriver.c, src/sfnt/ttload.c, src/sfnt/ttpost.c, + + src/smooth/ftgrays.c, + + src/type1/t1afm.c, src/type1/t1driver.c, src/type1/t1gload.c, + src/type1/t1load.c, src/type1/t1objs.c, src/type1/t1parse.c: + + added the new configuration file "ftstdlib.h" used to define + aliases for all ISO C library functions used by the engine + (e.g. strlen, qsort, setjmp, etc...) + + this eases the porting of FreeType 2 to exotic environments like + XFree86 modules/extensions.. + + also removed many #include , #include , etc... + from the engine's sources where they're not needed.. + + +2002-04-12 Vincent Caron + + * configure, builds/detect.mk: updated the build system to print + a warning message in case GNU Make isn't used to build the library. + Very nice ! + + 2002-04-11 David Turner - * README, docs/CHANGES: Updates for the 2.1.0 release. + * README, docs/CHANGES, Jamfile.in: updating for the 2.1.0 release + + * docs/FTL.txt: updated license text to provide a preffered disclaimer + and adjust copyright dates/extents + + * include/freetype/cache/ftcglyph.h: removing obsolete (and confusing + comment) + * Jamfile.in: New file. 2002-04-11 Maxim Shemanarev diff --git a/README.UNX b/README.UNX index 838ee8ab2..2ca23fe35 100644 --- a/README.UNX +++ b/README.UNX @@ -8,8 +8,8 @@ SPECIAL NOTE FOR UNIX USERS - I. Enable the TrueType bytecode hinter if you need it - ----------------------------------------------------- + I. Enable the TrueType bytecode hinter if you need it: + ------------------------------------------------------ The TrueType bytecode interpreter is disabled in all public releases of the FreeType packages for patents reasons (see @@ -34,8 +34,8 @@ SPECIAL NOTE FOR UNIX USERS - II. Determine the correct installation path - ------------------------------------------- + II. Determine the correct installation path: + -------------------------------------------- By default, the source package will install the library in "/usr/local". However, many Unix distributions now install the @@ -48,10 +48,33 @@ SPECIAL NOTE FOR UNIX USERS on the command line. This should return the installation path to use below (e.g. "/usr" or "/usr/local"). Otherwise, simply use - "/usr". + "/usr" (or what you think is adequate for your installation). - Then, to build and install the library, type: + + + III. Ensure that you're using GNU Make: + --------------------------------------- + + The FreeType build system _exclusively_ works with GNU Make. You will + not be able to compile the library with the following instructions with + any other alternative (including BSD Make !!). + + Trying to compile the library with a different Make tool will print a + message like: + "Sorry, GNU make is required to build FreeType2." + + and the build will be aborted. If this happens, install GNU Make on your + system, and use the GNUMAKE environment variable to name it. + + + + IV. Build and install the library: + ---------------------------------- + + The following should work on all Unix systems where the 'make' command + invokes GNU Make: + ./configure --prefix= make make install (as root) @@ -60,9 +83,21 @@ SPECIAL NOTE FOR UNIX USERS the "freetype-config" command. + When using a different command to invoke GNU Make, use the GNUMAKE + variable. For example, if 'gmake' is the command to use on your system, + do something like: + + GNUMAKE=gmake ./configure --prefix= + gmake + gmake install (as root) - III. Take care of XFree86 version 4 - ----------------------------------- + + If this still doesn't work, read the detailed compilation procedure + available in the file "docs/BUILD" for troubleshooting.. + + + V. Take care of XFree86 version 4: + ---------------------------------- Certain recent Linux distributions will install _several_ versions of FreeType on your system. For example, on a fresh Mandrake 8.1 diff --git a/builds/amiga/src/base/ftdebug.c b/builds/amiga/src/base/ftdebug.c index 3e163374c..80fec06a7 100644 --- a/builds/amiga/src/base/ftdebug.c +++ b/builds/amiga/src/base/ftdebug.c @@ -38,7 +38,7 @@ extern void __stdargs KVPrintF( const char *formatString, const void *values ); /* */ /* - release mode: */ /* */ - /* No error message is sent or generated. The code is free from any */ + /* No error message is sent or generated. The code is ft_free from any */ /* debugging parts. */ /* */ /*************************************************************************/ @@ -58,7 +58,6 @@ extern void __stdargs KVPrintF( const char *formatString, const void *values ); #include #include -#include FT_EXPORT_DEF( void ) diff --git a/builds/detect.mk b/builds/detect.mk index fbdbee5ad..99467a9b8 100644 --- a/builds/detect.mk +++ b/builds/detect.mk @@ -127,7 +127,7 @@ std_setup: @echo "If this does not correspond to your system or settings please remove the file" @echo "\`$(CONFIG_MK)' from this directory then read the INSTALL file for help." @echo "" - @echo "Otherwise, simply type \`make' again to build the library." + @echo "Otherwise, simply type \`$(MAKE)' again to build the library." @echo "" @$(COPY) $(CONFIG_RULES) $(CONFIG_MK) diff --git a/configure b/configure index 366c8bdd5..bd4c5231f 100644 --- a/configure +++ b/configure @@ -8,4 +8,15 @@ # Jamfile # install # -CFG="$@" make setup unix + +if [ "x$GNUMAKE" = x ]; then + GNUMAKE=make +fi + +if [ `$GNUMAKE -v 2>/dev/null|grep -ic gnu` -eq 0 ]; then + echo "Sorry, GNU make is required to build FreeType2." >&2 + echo "Please try \`GNUMAKE= $0'." >&2 + exit 1 +fi + +CFG="$@" $GNUMAKE setup unix diff --git a/include/freetype/config/ftconfig.h b/include/freetype/config/ftconfig.h index c1c2f29e3..3e76bc9d6 100644 --- a/include/freetype/config/ftconfig.h +++ b/include/freetype/config/ftconfig.h @@ -41,7 +41,7 @@ #include #include FT_CONFIG_OPTIONS_H - +#include FT_CONFIG_STANDARD_LIBRARY_H FT_BEGIN_HEADER @@ -58,24 +58,21 @@ FT_BEGIN_HEADER /*************************************************************************/ - /* We use values to know the sizes of the types. */ -#include - /* The number of bytes in an `int' type. */ -#if UINT_MAX == 0xFFFFFFFFUL +#if FT_UINT_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_INT 4 -#elif UINT_MAX == 0xFFFFU +#elif FT_UINT_MAX == 0xFFFFU #define FT_SIZEOF_INT 2 -#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU +#elif FT_UINT_MAX > 0xFFFFFFFFU && FT_UINT_MAX == 0xFFFFFFFFFFFFFFFFU #define FT_SIZEOF_INT 8 #else #error "Unsupported number of bytes in `int' type!" #endif /* The number of bytes in a `long' type. */ -#if ULONG_MAX == 0xFFFFFFFFUL +#if FT_ULONG_MAX == 0xFFFFFFFFUL #define FT_SIZEOF_LONG 4 -#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU +#elif FT_ULONG_MAX > 0xFFFFFFFFU && FT_ULONG_MAX == 0xFFFFFFFFFFFFFFFFU #define FT_SIZEOF_LONG 8 #else #error "Unsupported number of bytes in `long' type!" diff --git a/include/freetype/config/ftheader.h b/include/freetype/config/ftheader.h index 71f9a5156..e43a9e62a 100644 --- a/include/freetype/config/ftheader.h +++ b/include/freetype/config/ftheader.h @@ -108,6 +108,21 @@ #endif + /*************************************************************************/ + /* */ + /* @macro: */ + /* FT_CONFIG_STANDARD_LIBRARY_H */ + /* */ + /* @description: */ + /* A macro used in #include statements to name the file containing */ + /* FreeType 2 configuration data. */ + /* */ +#ifndef FT_CONFIG_STANDARD_LIBRARY_H +#define FT_CONFIG_STANDARD_LIBRARY_H +#endif + + + /*************************************************************************/ /* */ /* @macro: */ diff --git a/include/freetype/config/ftstdlib.h b/include/freetype/config/ftstdlib.h new file mode 100644 index 000000000..28db872c2 --- /dev/null +++ b/include/freetype/config/ftstdlib.h @@ -0,0 +1,116 @@ +/***************************************************************************/ +/* */ +/* ftstdlib.h */ +/* */ +/* ANSI-specific configuration file */ +/* */ +/* Copyright 1996-2001, 2002 by */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/* */ +/* This file is used to group all #includes to the ANSI C library */ +/* that FreeType normally requires. It also defines macros to rename */ +/* the standard functions within the FT source code */ +/* */ +/* (You're free to provide alternative when working in exotic */ +/* runtime environments :-) */ +/* */ +/***************************************************************************/ + +#ifndef __FT_STANDARD_LIBRARY_H__ +#define __FT_STANDARD_LIBRARY_H__ + + +/************************************************************************/ +/* */ +/* integer limits */ +/* */ +/* UINT_MAX and ULONG_MAX are used to automatically compute the size */ +/* of 'int' and 'long' in bytes at compile-time. So far, this works */ +/* for all platforms the library has been tested on. */ +/* */ +/* Note that on the extremely rare platforms that do not provide */ +/* integer types that are _exactly_ 16 and 32 bits wide (e.g. some */ +/* old Crays where 'int' is 36 bits !!), we do not make any guarantee */ +/* about the correct behaviour of FT2 with all fonts.. */ +/* */ +/* in these case, "ftconfig.h" will refuse to compile anyway with a */ +/* message like "couldn't find 32-bit type" or something similar */ +/* anyway.. */ +/* */ +/* */ +/* IMPORTANT NOTE: We do not define aliases for heap management and */ +/* i/o routines (i.e. malloc/free/fopen/fread/...) */ +/* since these functions should all be encapsulated */ +/* by platform-specific implementations of */ +/* "ftsystem.c" anyway !! */ +/* */ +/************************************************************************/ + +#include +#define FT_UINT_MAX UINT_MAX +#define FT_ULONG_MAX ULONG_MAX + + +/************************************************************************/ +/* */ +/* character and string processing */ +/* */ +/************************************************************************/ + +#include +#define ft_isalnum isalnum +#define ft_isupper isupper +#define ft_islower islower + + +#include +#define ft_strlen strlen +#define ft_strcmp strcmp +#define ft_strncmp strncmp +#define ft_memcpy memcpy +#define ft_strcpy strcpy +#define ft_strncpy strncpy +#define ft_memset memset +#define ft_memmove memmove + + +/************************************************************************/ +/* */ +/* sorting */ +/* */ +/************************************************************************/ + +#include /* for qsort() */ +#define ft_qsort qsort + + +/************************************************************************/ +/* */ +/* execution control */ +/* */ +/************************************************************************/ + +#include + +#define ft_jmp_buf jmp_buf /* note: this cannot be a typedef since */ + /* jmp_buf is defined as a macro */ + /* on certain platforms.. */ + +#define ft_setjmp setjmp /* same thing here */ +#define ft_longjmp longjmp /* " */ + + +/* the following is only used for debugging purposes, i.e. when */ +/* FT_DEBUG_LEVEL_ERROR or FT_DEBUG_LEVEL_TRACE are defined */ +/* */ +#include + + +#endif /* __FT_STANDARD_LIBRARY_H__ */ diff --git a/include/freetype/internal/ftmemory.h b/include/freetype/internal/ftmemory.h index 821d8c421..597b64d90 100644 --- a/include/freetype/internal/ftmemory.h +++ b/include/freetype/internal/ftmemory.h @@ -172,15 +172,11 @@ FT_BEGIN_HEADER void** P ); - /* This `#include' is needed by the MEM_xxx() macros; it should be */ - /* available on all platforms we know of. */ -#include +#define FT_MEM_SET( dest, byte, count ) ft_memset( dest, byte, count ) -#define FT_MEM_SET( dest, byte, count ) memset( dest, byte, count ) +#define FT_MEM_COPY( dest, source, count ) ft_memcpy( dest, source, count ) -#define FT_MEM_COPY( dest, source, count ) memcpy( dest, source, count ) - -#define FT_MEM_MOVE( dest, source, count ) memmove( dest, source, count ) +#define FT_MEM_MOVE( dest, source, count ) ft_memmove( dest, source, count ) /*************************************************************************/ diff --git a/include/freetype/internal/ftobjs.h b/include/freetype/internal/ftobjs.h index 4f2cbad80..796513dfd 100644 --- a/include/freetype/internal/ftobjs.h +++ b/include/freetype/internal/ftobjs.h @@ -132,7 +132,7 @@ FT_BEGIN_HEADER FT_ValidationLevel level; /* validation level */ FT_Error error; /* error returned. 0 means success */ - jmp_buf jump_buffer; /* used for exception handling */ + ft_jmp_buf jump_buffer; /* used for exception handling */ } FT_ValidatorRec; diff --git a/src/autohint/ahoptim.c b/src/autohint/ahoptim.c index e99cd1da1..6b4cdf0c6 100644 --- a/src/autohint/ahoptim.c +++ b/src/autohint/ahoptim.c @@ -61,7 +61,6 @@ #include #include -#include #define FLOAT( x ) ( (float)( (x) / 64.0 ) ) diff --git a/src/base/ftdbgmem.c b/src/base/ftdbgmem.c index 3768234e6..6ca02dadf 100644 --- a/src/base/ftdbgmem.c +++ b/src/base/ftdbgmem.c @@ -30,7 +30,6 @@ #include #include -#include typedef struct FT_MemNodeRec_* FT_MemNode; @@ -122,8 +121,6 @@ }; -#include - extern void ft_mem_debug_panic( const char* fmt, ... ) @@ -547,7 +544,7 @@ block, file_name, line_no ); if ( node->size != cur_size ) - ft_mem_debug_panic( "invalid realloc request for %p. cur_size is " + ft_mem_debug_panic( "invalid ft_realloc request for %p. cur_size is " "%ld instead of %ld in (%s:%ld)", block, cur_size, node->size, file_name, line_no ); @@ -555,7 +552,7 @@ if ( new_block == NULL ) return NULL; - memcpy( new_block, block, cur_size < new_size ? cur_size : new_size ); + ft_memcpy( new_block, block, cur_size < new_size ? cur_size : new_size ); table->file_name = file_name; table->line_no = line_no; diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c index 4263c6768..f622e771d 100644 --- a/src/base/ftdebug.c +++ b/src/base/ftdebug.c @@ -47,12 +47,6 @@ #if defined( FT_DEBUG_LEVEL_ERROR ) - -#include -#include -#include - - FT_EXPORT_DEF( void ) FT_Message( const char* fmt, ... ) { diff --git a/src/base/ftmac.c b/src/base/ftmac.c index 9d76b3880..462220df9 100644 --- a/src/base/ftmac.c +++ b/src/base/ftmac.c @@ -69,7 +69,6 @@ #include #include -#include /* for isupper() and isalnum() */ #include FT_MAC_H @@ -90,7 +89,7 @@ static char cstr[256]; - strncpy( cstr, (char*)pstr + 1, pstr[0] ); + ft_strncpy( cstr, (char*)pstr + 1, pstr[0] ); cstr[pstr[0]] = '\0'; return cstr; } @@ -106,11 +105,11 @@ /* convert path to a pascal string */ - path_len = strlen( pathname ); + path_len = ft_strlen( pathname ); if ( path_len > 255 ) return -1; p_path[0] = (unsigned char)path_len; - strncpy( (char*)p_path + 1, pathname, path_len ); + ft_strncpy( (char*)p_path + 1, pathname, path_len ); if ( FSMakeFSSpec( 0, 0, p_path, spec ) != noErr ) return -1; @@ -172,7 +171,7 @@ max = 3; count = 0; } - if ( count < max && ( isalnum( *q ) || *q == '_' ) ) + if ( count < max && ( ft_isalnum( *q ) || *q == '_' ) ) { *++p = *q; lwfn_file_name[0]++; @@ -299,7 +298,7 @@ p += names[i][0]; p++; } - strcpy( ps_name, p2c_str( names[0] ) ); /* Family name */ + ft_strcpy( ps_name, p2c_str( names[0] ) ); /* Family name */ if ( style->indexes[0] > 1 ) { @@ -410,7 +409,7 @@ } } - memcpy( p, *post_data + 2, post_size ); + ft_memcpy( p, *post_data + 2, post_size ); pfb_chunk_size += post_size; p += post_size; last_code = code; @@ -595,7 +594,7 @@ } HLock( sfnt ); - memcpy( sfnt_data, *sfnt, sfnt_size ); + ft_memcpy( sfnt_data, *sfnt, sfnt_size ); HUnlock( sfnt ); ReleaseResource( sfnt ); @@ -797,14 +796,14 @@ /* build up a complete face name */ - strcpy( fullName, famName ); + ft_strcpy( fullName, famName ); if ( style & bold ) strcat( fullName, " Bold" ); if ( style & italic ) strcat( fullName, " Italic" ); /* compare with the name we are looking for */ - if ( strcmp( fullName, fontName ) == 0 ) + if ( ft_strcmp( fullName, fontName ) == 0 ) { /* found it! */ the_font = font; diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index a12c13dba..4e4a70bdb 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -25,9 +25,6 @@ #include FT_TRUETYPE_TABLES_H #include FT_OUTLINE_H -#include /* for strcmp() */ -#include /* for setjmp() and longjmp() */ - FT_BASE_DEF( void ) ft_validator_init( FT_Validator valid, @@ -2167,7 +2164,7 @@ for ( nn = 0; nn < library->num_modules; nn++ ) { module = library->modules[nn]; - if ( strcmp( module->clazz->module_name, clazz->module_name ) == 0 ) + if ( ft_strcmp( module->clazz->module_name, clazz->module_name ) == 0 ) { /* this installed module has the same name, compare their versions */ if ( clazz->module_version <= module->clazz->module_version ) @@ -2283,7 +2280,7 @@ limit = cur + library->num_modules; for ( ; cur < limit; cur++ ) - if ( strcmp( cur[0]->clazz->module_name, module_name ) == 0 ) + if ( ft_strcmp( cur[0]->clazz->module_name, module_name ) == 0 ) { result = cur[0]; break; diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c index 32d817234..2365de257 100644 --- a/src/base/ftsystem.c +++ b/src/base/ftsystem.c @@ -34,7 +34,6 @@ #include #include -#include /*************************************************************************/ diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index 39f0aa082..86ecd09bd 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -24,9 +24,6 @@ #include "ftcerror.h" -#include /* memcmp() */ -#include /* labs() */ - /* the FT_Glyph image node type */ typedef struct FTC_ImageNodeRec_ diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 5d18ee18a..82ab84c37 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -26,8 +26,6 @@ #include "ftcerror.h" -#include /* memcmp() */ - #define FTC_SBIT_ITEMS_PER_NODE 16 diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c index 14aa24592..7db9a6976 100644 --- a/src/cff/cffdrivr.c +++ b/src/cff/cffdrivr.c @@ -257,7 +257,7 @@ if ( buffer_max > 0 ) { - FT_UInt len = strlen( gname ); + FT_UInt len = ft_strlen( gname ); if ( len >= buffer_max ) @@ -410,7 +410,7 @@ else name = (FT_String *)psnames->adobe_std_strings( sid ); - result = strcmp( glyph_name, name ); + result = ft_strcmp( glyph_name, name ); if ( sid > 390 ) FT_FREE( name ); @@ -444,10 +444,10 @@ #ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES - if ( strcmp( (const char*)interface, "glyph_name" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "glyph_name" ) == 0 ) return (FT_Module_Interface)cff_get_glyph_name; - if ( strcmp( (const char*)interface, "name_index" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "name_index" ) == 0 ) return (FT_Module_Interface)cff_get_name_index; #endif diff --git a/src/cff/cffload.c b/src/cff/cffload.c index 1e0078929..2b81ebb74 100644 --- a/src/cff/cffload.c +++ b/src/cff/cffload.c @@ -1332,7 +1332,7 @@ FT_Error error; - len = (FT_UInt)strlen( adobe_name ); + len = (FT_UInt)ft_strlen( adobe_name ); if ( !FT_ALLOC( name, len + 1 ) ) { FT_MEM_COPY( name, adobe_name, len ); diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c index 5aabfbc0b..49b673692 100644 --- a/src/cff/cffobjs.c +++ b/src/cff/cffobjs.c @@ -31,8 +31,6 @@ #include "cfferrs.h" -#include /* for strlen() */ - /*************************************************************************/ /* */ @@ -231,7 +229,7 @@ { FT_Error error; FT_String* result = 0; - FT_Int len = (FT_Int)strlen( source ); + FT_Int len = (FT_Int)ft_strlen( source ); if ( !FT_ALLOC( result, len + 1 ) ) diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 0a67a8a47..3afdd1668 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -26,9 +26,6 @@ #include "ciderrs.h" -#include -#include /* for isspace(), isalnum() */ - /*************************************************************************/ /* */ @@ -285,7 +282,7 @@ static int is_alpha( char c ) { - return ( isalnum( (int)c ) || + return ( ft_isalnum( (int)c ) || c == '.' || c == '_' ); } @@ -313,7 +310,7 @@ { /* look for `%ADOBeginFontDict' */ if ( *cur == '%' && cur + 20 < limit && - strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 ) + ft_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 ) { cur += 17; @@ -352,7 +349,7 @@ break; if ( cur[0] == name[0] && - len == (FT_Int)strlen( (const char*)name ) ) + len == (FT_Int)ft_strlen( (const char*)name ) ) { FT_Int n; diff --git a/src/cid/cidparse.c b/src/cid/cidparse.c index fde004121..821f2fe70 100644 --- a/src/cid/cidparse.c +++ b/src/cid/cidparse.c @@ -26,8 +26,6 @@ #include "ciderrs.h" -#include /* for strncmp() */ - /*************************************************************************/ /* */ @@ -73,7 +71,7 @@ if ( FT_FRAME_ENTER( 31 ) ) goto Exit; - if ( strncmp( (char *)stream->cursor, + if ( ft_strncmp( (char *)stream->cursor, "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) ) { FT_TRACE2(( "[not a valid CID-keyed font]\n" )); @@ -108,7 +106,7 @@ /* look for `StartData' */ for ( p = buffer; p < limit; p++ ) { - if ( p[0] == 'S' && strncmp( (char*)p, "StartData", 9 ) == 0 ) + if ( p[0] == 'S' && ft_strncmp( (char*)p, "StartData", 9 ) == 0 ) { /* save offset of binary data after `StartData' */ offset = (FT_ULong)( top_position - ( limit - p ) + 10 ); diff --git a/src/cid/cidriver.c b/src/cid/cidriver.c index a798a7722..594c7a4ad 100644 --- a/src/cid/cidriver.c +++ b/src/cid/cidriver.c @@ -25,8 +25,6 @@ #include "ciderrs.h" -#include /* for strcmp() */ - /*************************************************************************/ /* */ @@ -58,7 +56,7 @@ FT_UNUSED( driver ); FT_UNUSED( interface ); - if ( strcmp( (const char*)interface, "postscript_name" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "postscript_name" ) == 0 ) return (FT_Module_Interface)cid_get_postscript_name; return 0; @@ -175,7 +173,7 @@ if ( gname && gname[0] == glyph_name[0] && - strcmp( gname, glyph_name ) == 0 ) + ft_strcmp( gname, glyph_name ) == 0 ) { result = n; break; @@ -275,7 +273,7 @@ if ( gname && gname[0] == glyph_name[0] && - strcmp( gname, glyph_name ) == 0 ) + ft_strcmp( gname, glyph_name ) == 0 ) { return charcode; } diff --git a/src/pcf/pcfdriver.c b/src/pcf/pcfdriver.c index 899d034be..9fc09304b 100644 --- a/src/pcf/pcfdriver.c +++ b/src/pcf/pcfdriver.c @@ -315,9 +315,9 @@ THE SOFTWARE. if ( ( charset_registry != NULL ) && ( charset_encoding != NULL ) ) { - if ( !strcmp( face->charset_registry, "ISO10646" ) || - ( !strcmp( face->charset_registry, "ISO8859" ) && - !strcmp( face->charset_encoding, "1" ) ) ) + if ( !ft_strcmp( face->charset_registry, "ISO10646" ) || + ( !ft_strcmp( face->charset_registry, "ISO8859" ) && + !ft_strcmp( face->charset_encoding, "1" ) ) ) unicode_charmap = 1; } diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c index 923eb08eb..4c052336a 100644 --- a/src/pcf/pcfread.c +++ b/src/pcf/pcfread.c @@ -36,8 +36,6 @@ THE SOFTWARE. #include "pcferror.h" -#include /* strlen(), strcpy() */ - /*************************************************************************/ /* */ @@ -331,7 +329,7 @@ THE SOFTWARE. for ( i = 0 ; i < face->nprops && !found; i++ ) { - if ( !strcmp( properties[i].name, prop ) ) + if ( !ft_strcmp( properties[i].name, prop ) ) found = 1; } @@ -433,18 +431,18 @@ THE SOFTWARE. { /* XXX: make atom */ if ( FT_NEW_ARRAY( properties[i].name, - strlen( strings + props[i].name ) + 1 ) ) + ft_strlen( strings + props[i].name ) + 1 ) ) goto Bail; - strcpy( properties[i].name,strings + props[i].name ); + ft_strcpy( properties[i].name,strings + props[i].name ); properties[i].isString = props[i].isString; if ( props[i].isString ) { if ( FT_NEW_ARRAY( properties[i].value.atom, - strlen( strings + props[i].value ) + 1 ) ) + ft_strlen( strings + props[i].value ) + 1 ) ) goto Bail; - strcpy( properties[i].value.atom, strings + props[i].value ); + ft_strcpy( properties[i].value.atom, strings + props[i].value ); } else properties[i].value.integer = props[i].value; @@ -952,12 +950,12 @@ THE SOFTWARE. { if ( prop->isString ) { - int l = strlen( prop->value.atom ) + 1; + int l = ft_strlen( prop->value.atom ) + 1; if ( FT_NEW_ARRAY( root->family_name, l ) ) goto Exit; - strcpy( root->family_name, prop->value.atom ); + ft_strcpy( root->family_name, prop->value.atom ); } } else @@ -1025,15 +1023,15 @@ THE SOFTWARE. ( charset_encoding->isString ) ) { if ( FT_NEW_ARRAY( face->charset_encoding, - strlen( charset_encoding->value.atom ) + 1 ) ) + ft_strlen( charset_encoding->value.atom ) + 1 ) ) goto Exit; if ( FT_NEW_ARRAY( face->charset_registry, - strlen( charset_registry->value.atom ) + 1 ) ) + ft_strlen( charset_registry->value.atom ) + 1 ) ) goto Exit; - strcpy( face->charset_registry, charset_registry->value.atom ); - strcpy( face->charset_encoding, charset_encoding->value.atom ); + ft_strcpy( face->charset_registry, charset_registry->value.atom ); + ft_strcpy( face->charset_encoding, charset_encoding->value.atom ); } } } diff --git a/src/psaux/t1cmap.c b/src/psaux/t1cmap.c index 5fd8b9f44..7757f7f58 100644 --- a/src/psaux/t1cmap.c +++ b/src/psaux/t1cmap.c @@ -17,7 +17,6 @@ #include "t1cmap.h" -#include /* for qsort() */ #include FT_INTERNAL_DEBUG_H @@ -82,7 +81,7 @@ if ( gname && gname[0] == glyph_name[0] && - strcmp( gname, glyph_name ) == 0 ) + ft_strcmp( gname, glyph_name ) == 0 ) { result = n; break; @@ -337,7 +336,7 @@ } /* sort the pairs table to allow efficient binary searches */ - qsort( cmap->pairs, + ft_qsort( cmap->pairs, new_count, sizeof ( T1_CMapUniPairRec ), t1_cmap_uni_pair_compare ); diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index cac5cfee6..c8e0709c9 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -143,7 +143,7 @@ if ( name && name[0] == glyph_name[0] && - strcmp( name,glyph_name ) == 0 ) + ft_strcmp( name,glyph_name ) == 0 ) return n; } diff --git a/src/pshinter/pshalgo1.c b/src/pshinter/pshalgo1.c index 67c159edb..8fa03256e 100644 --- a/src/pshinter/pshalgo1.c +++ b/src/pshinter/pshalgo1.c @@ -757,7 +757,7 @@ /* initialize hints table */ - memset( &hints, 0, sizeof ( hints ) ); + ft_memset( &hints, 0, sizeof ( hints ) ); error = psh1_hint_table_init( &hints, &dim->hints, &dim->masks, diff --git a/src/pshinter/pshalgo2.c b/src/pshinter/pshalgo2.c index 8509d87bb..2cd3911cc 100644 --- a/src/pshinter/pshalgo2.c +++ b/src/pshinter/pshalgo2.c @@ -861,7 +861,7 @@ /* clear all fields */ - memset( glyph, 0, sizeof ( *glyph ) ); + ft_memset( glyph, 0, sizeof ( *glyph ) ); memory = globals->memory; diff --git a/src/pshinter/pshrec.c b/src/pshinter/pshrec.c index ad0485e1d..208cf78d4 100644 --- a/src/pshinter/pshrec.c +++ b/src/pshinter/pshrec.c @@ -472,7 +472,7 @@ PS_MaskRec dummy = *mask2; - memmove( mask2, mask2 + 1, delta * sizeof ( PS_MaskRec ) ); + ft_memmove( mask2, mask2 + 1, delta * sizeof ( PS_MaskRec ) ); mask2[delta] = dummy; } @@ -797,7 +797,7 @@ ps_hints_init( PS_Hints hints, FT_Memory memory ) { - memset( hints, 0, sizeof ( *hints ) ); + ft_memset( hints, 0, sizeof ( *hints ) ); hints->memory = memory; return 0; } @@ -1132,7 +1132,7 @@ FT_LOCAL_DEF( void ) t1_hints_funcs_init( T1_Hints_FuncsRec* funcs ) { - memset( (char*)funcs, 0, sizeof ( *funcs ) ); + ft_memset( (char*)funcs, 0, sizeof ( *funcs ) ); funcs->open = (T1_Hints_OpenFunc) t1_hints_open; funcs->close = (T1_Hints_CloseFunc) ps_hints_close; @@ -1197,7 +1197,7 @@ FT_LOCAL_DEF( void ) t2_hints_funcs_init( T2_Hints_FuncsRec* funcs ) { - memset( funcs, 0, sizeof ( *funcs ) ); + ft_memset( funcs, 0, sizeof ( *funcs ) ); funcs->open = (T2_Hints_OpenFunc) t2_hints_open; funcs->close = (T2_Hints_CloseFunc) ps_hints_close; diff --git a/src/psnames/psmodule.c b/src/psnames/psmodule.c index 58b7de679..a0e0386aa 100644 --- a/src/psnames/psmodule.c +++ b/src/psnames/psmodule.c @@ -25,9 +25,6 @@ #include "psnamerr.h" -#include /* for qsort() */ -#include /* for strcmp(), strncpy() */ - #ifndef FT_CONFIG_OPTION_NO_POSTSCRIPT_NAMES @@ -106,7 +103,7 @@ if ( *p && len < 64 ) { - strncpy( temp, glyph_name, len ); + ft_strncpy( temp, glyph_name, len ); temp[len] = 0; glyph_name = temp; } @@ -118,7 +115,7 @@ const char* name = sid_standard_names[n]; - if ( first == name[0] && strcmp( glyph_name, name ) == 0 ) + if ( first == name[0] && ft_strcmp( glyph_name, name ) == 0 ) return ps_names_to_unicode[n]; } @@ -127,7 +124,7 @@ } - /* qsort callback to sort the unicode map */ + /* ft_qsort callback to sort the unicode map */ FT_CALLBACK_DEF( int ) compare_uni_maps( const void* a, const void* b ) @@ -198,7 +195,7 @@ } else /* sort the table in increasing order of unicode values */ - qsort( table->maps, count, sizeof ( PS_UniMap ), compare_uni_maps ); + ft_qsort( table->maps, count, sizeof ( PS_UniMap ), compare_uni_maps ); table->num_maps = count; } diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 28475f7c0..32f813c38 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -187,7 +187,7 @@ #ifndef FT_MEM_SET -#define FT_MEM_SET( d, s, c ) memset( d, s, c ) +#define FT_MEM_SET( d, s, c ) ft_memset( d, s, c ) #endif @@ -2094,7 +2094,7 @@ { target[0] |= f1; - /* memset() is slower than the following code on many platforms. */ + /* ft_memset() is slower than the following code on many platforms. */ /* This is due to the fact that, in the vast majority of cases, */ /* the span length in bytes is relatively small. */ c2--; diff --git a/src/sfnt/sfdriver.c b/src/sfnt/sfdriver.c index 303498a08..bbc882201 100644 --- a/src/sfnt/sfdriver.c +++ b/src/sfnt/sfdriver.c @@ -33,8 +33,6 @@ #include "ttpost.h" #endif -#include /* for strcmp() */ - static void* get_sfnt_table( TT_Face face, @@ -97,7 +95,7 @@ error = TT_Get_PS_Name( face, glyph_index, &gname ); if ( !error && buffer_max > 0 ) { - FT_UInt len = (FT_UInt)( strlen( gname ) ); + FT_UInt len = (FT_UInt)( ft_strlen( gname ) ); if ( len >= buffer_max ) @@ -201,15 +199,15 @@ { FT_UNUSED( module ); - if ( strcmp( interface, "get_sfnt" ) == 0 ) + if ( ft_strcmp( interface, "get_sfnt" ) == 0 ) return (FT_Module_Interface)get_sfnt_table; #ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES - if ( strcmp( interface, "glyph_name" ) == 0 ) + if ( ft_strcmp( interface, "glyph_name" ) == 0 ) return (FT_Module_Interface)get_sfnt_glyph_name; #endif - if ( strcmp( interface, "postscript_name" ) == 0 ) + if ( ft_strcmp( interface, "postscript_name" ) == 0 ) return (FT_Module_Interface)get_sfnt_postscript_name; return 0; diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index dfa294833..5de57696c 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -26,8 +26,6 @@ #include "sferrors.h" -#include /* for qsort */ - /*************************************************************************/ /* */ @@ -1720,7 +1718,7 @@ { if ( tt_kern_pair_compare( pair0, pair0 + 1 ) != -1 ) { - qsort( (void*)face->kern_pairs, (int)num_pairs, + ft_qsort( (void*)face->kern_pairs, (int)num_pairs, sizeof ( TT_Kern0_PairRec ), tt_kern_pair_compare ); break; } diff --git a/src/sfnt/ttpost.c b/src/sfnt/ttpost.c index f6e243408..686a98764 100644 --- a/src/sfnt/ttpost.c +++ b/src/sfnt/ttpost.c @@ -50,7 +50,7 @@ #ifdef FT_CONFIG_OPTION_POSTSCRIPT_NAMES -#include +#include FT_INTERNAL_POSTSCRIPT_NAMES_H #define MAC_NAME( x ) ( (FT_String*)psnames->macintosh_name( x ) ) diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c index c12c57a33..a3025ccc3 100644 --- a/src/smooth/ftgrays.c +++ b/src/smooth/ftgrays.c @@ -81,9 +81,6 @@ /*************************************************************************/ -#include /* for memcpy() */ -#include - /* experimental support for gamma correction within the rasterizer */ #define xxxGRAYS_USE_GAMMA @@ -101,8 +98,18 @@ #define ErrRaster_MemoryOverflow -4 + + + + + + #ifdef _STANDALONE_ +#include /* for ft_memcpy() */ +#include +#include +#define FT_UINT_MAX UINT_MAX #define ErrRaster_Invalid_Mode -2 #define ErrRaster_Invalid_Outline -1 @@ -146,7 +153,7 @@ #ifndef FT_MEM_SET -#define FT_MEM_SET( d, s, c ) memset( d, s, c ) +#define FT_MEM_SET( d, s, c ) ft_memset( d, s, c ) #endif /* define this to dump debugging information */ @@ -203,7 +210,7 @@ /* increases the number of cells available in the render pool but slows */ /* down the rendering a bit. It is useful if you have a really tiny */ /* render pool. */ -#define xxxGRAYS_COMPACT +#undef GRAYS_COMPACT /*************************************************************************/ @@ -229,9 +236,7 @@ #else /* PIXEL_BITS >= 8 */ /* approximately determine the size of integers using an ANSI-C header */ -#include - -#if UINT_MAX == 0xFFFFU +#if FT_UINT_MAX == 0xFFFFU typedef long TArea; #else typedef int TArea; @@ -308,7 +313,7 @@ int cubic_level; void* memory; - jmp_buf jump_buffer; + ft_jmp_buf jump_buffer; #ifdef GRAYS_USE_GAMMA FT_Byte gamma[257]; @@ -1083,7 +1088,7 @@ #ifdef QUICK_SORT /* This is a non-recursive quicksort that directly process our cells */ - /* array. It should be faster than calling the stdlib qsort(), and we */ + /* array. It should be faster than calling the stdlib ft_qsort(), and we */ /* can even tailor our insertion threshold... */ #define QSORT_THRESHOLD 9 /* below this size, a sub-array will be sorted */ diff --git a/src/type1/t1afm.c b/src/type1/t1afm.c index df7808879..36df559ed 100644 --- a/src/type1/t1afm.c +++ b/src/type1/t1afm.c @@ -20,9 +20,6 @@ #include "t1afm.h" #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_TYPE1_TYPES_H -#include /* for qsort() */ -#include /* for strcmp() */ -#include /* for isalnum() */ /*************************************************************************/ @@ -48,7 +45,7 @@ #undef IS_KERN_PAIR #define IS_KERN_PAIR( p ) ( p[0] == 'K' && p[1] == 'P' ) -#define IS_ALPHANUM( c ) ( isalnum( c ) || \ +#define IS_ALPHANUM( c ) ( ft_isalnum( c ) || \ c == '_' || \ c == '.' ) @@ -92,7 +89,7 @@ char* gname = (char*)type1->glyph_names[n]; - if ( gname && gname[0] == temp[0] && strcmp( gname, temp ) == 0 ) + if ( gname && gname[0] == temp[0] && ft_strcmp( gname, temp ) == 0 ) { result = n; break; @@ -229,7 +226,7 @@ } /* now, sort the kern pairs according to their glyph indices */ - qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ), + ft_qsort( afm->kern_pairs, count, sizeof ( T1_Kern_Pair ), compare_kern_pairs ); Exit: diff --git a/src/type1/t1driver.c b/src/type1/t1driver.c index 1951891b0..8fdce534d 100644 --- a/src/type1/t1driver.c +++ b/src/type1/t1driver.c @@ -31,8 +31,6 @@ #include FT_INTERNAL_STREAM_H #include FT_INTERNAL_POSTSCRIPT_NAMES_H -#include /* for strcmp() */ - /*************************************************************************/ /* */ @@ -57,7 +55,7 @@ if ( buffer_max > 0 ) { - FT_UInt len = (FT_UInt)( strlen( gname ) ); + FT_UInt len = (FT_UInt)( ft_strlen( gname ) ); if (len >= buffer_max) @@ -100,7 +98,7 @@ { gname = face->type1.glyph_names[i]; - if ( !strcmp( glyph_name, gname ) ) + if ( !ft_strcmp( glyph_name, gname ) ) return (FT_UInt)i; } @@ -149,23 +147,23 @@ FT_UNUSED( driver ); FT_UNUSED( interface ); - if ( strcmp( (const char*)interface, "glyph_name" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "glyph_name" ) == 0 ) return (FT_Module_Interface)t1_get_glyph_name; - if ( strcmp( (const char*)interface, "name_index" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "name_index" ) == 0 ) return (FT_Module_Interface)t1_get_name_index; - if ( strcmp( (const char*)interface, "postscript_name" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "postscript_name" ) == 0 ) return (FT_Module_Interface)t1_get_ps_name; #ifndef T1_CONFIG_OPTION_NO_MM_SUPPORT - if ( strcmp( (const char*)interface, "get_mm" ) == 0 ) + if ( ft_strcmp( (const char*)interface, "get_mm" ) == 0 ) return (FT_Module_Interface)T1_Get_Multi_Master; - if ( strcmp( (const char*)interface, "set_mm_design") == 0 ) + if ( ft_strcmp( (const char*)interface, "set_mm_design") == 0 ) return (FT_Module_Interface)T1_Set_MM_Design; - if ( strcmp( (const char*)interface, "set_mm_blend") == 0 ) + if ( ft_strcmp( (const char*)interface, "set_mm_blend") == 0 ) return (FT_Module_Interface)T1_Set_MM_Blend; #endif return 0; @@ -333,7 +331,7 @@ if ( gname && gname[0] == glyph_name[0] && - strcmp( gname, glyph_name ) == 0 ) + ft_strcmp( gname, glyph_name ) == 0 ) { result = n; break; @@ -448,7 +446,7 @@ if ( gname && gname[0] == glyph_name[0] && - strcmp( gname, glyph_name ) == 0 ) + ft_strcmp( gname, glyph_name ) == 0 ) return charcode; } } diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c index 4ee9beb4a..7617b00bc 100644 --- a/src/type1/t1gload.c +++ b/src/type1/t1gload.c @@ -25,8 +25,6 @@ #include "t1errors.h" -#include /* for strcmp() */ - /*************************************************************************/ /* */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 2b87e51b0..c4b538ab1 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -68,11 +68,8 @@ #include FT_INTERNAL_TYPE1_TYPES_H #include "t1load.h" - #include "t1errors.h" -#include /* for strncmp(), strcmp() */ -#include /* for isalnum() */ /*************************************************************************/ @@ -770,7 +767,7 @@ /* Note: we must accept "+" as a valid character, as it is used in */ /* embedded type1 fonts in PDF documents. */ /* */ - return ( isalnum( c ) || c == '.' || c == '_' || c == '-' || c == '+' ); + return ( ft_isalnum( c ) || c == '.' || c == '_' || c == '-' || c == '+' ); } @@ -1076,15 +1073,15 @@ else { if ( cur + 17 < limit && - strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 ) + ft_strncmp( (const char*)cur, "StandardEncoding", 16 ) == 0 ) face->type1.encoding_type = T1_ENCODING_TYPE_STANDARD; else if ( cur + 15 < limit && - strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 ) + ft_strncmp( (const char*)cur, "ExpertEncoding", 14 ) == 0 ) face->type1.encoding_type = T1_ENCODING_TYPE_EXPORT; else if ( cur + 18 < limit && - strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 ) + ft_strncmp( (const char*)cur, "ISOLatin1Encoding", 17 ) == 0 ) face->type1.encoding_type = T1_ENCODING_TYPE_ISOLATIN1; else @@ -1139,7 +1136,7 @@ /* If the next token isn't `dup', we are also done. This */ /* happens when there are `holes' in the Subrs array. */ - if ( strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) + if ( ft_strncmp( (char*)parser->root.cursor, "dup", 3 ) != 0 ) break; idx = T1_ToInt( parser ); @@ -1155,7 +1152,7 @@ T1_Skip_Alpha( parser ); /* `NP' or `I' or `noaccess' */ T1_Skip_Spaces( parser ); - if ( strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) + if ( ft_strncmp( (char*)parser->root.cursor, "put", 3 ) == 0 ) { T1_Skip_Alpha( parser ); /* skip `put' */ T1_Skip_Spaces( parser ); @@ -1296,7 +1293,7 @@ name_table->elements[n][len] = '\0'; /* record index of /.notdef */ - if ( strcmp( (const char*)".notdef", + if ( ft_strcmp( (const char*)".notdef", (const char*)(name_table->elements[n]) ) == 0 ) { notdef_index = n; @@ -1336,7 +1333,7 @@ loader->num_glyphs = n; /* if /.notdef is found but does not occupy index 0, do our magic. */ - if ( strcmp( (const char*)".notdef", + if ( ft_strcmp( (const char*)".notdef", (const char*)name_table->elements[0] ) && notdef_found ) { @@ -1503,7 +1500,7 @@ { /* look for `FontDirectory', which causes problems on some fonts */ if ( *cur == 'F' && cur + 25 < limit && - strncmp( (char*)cur, "FontDirectory", 13 ) == 0 ) + ft_strncmp( (char*)cur, "FontDirectory", 13 ) == 0 ) { FT_Byte* cur2; @@ -1514,7 +1511,7 @@ /* lookup the `known' keyword */ while ( cur < limit && *cur != 'k' && - strncmp( (char*)cur, "known", 5 ) ) + ft_strncmp( (char*)cur, "known", 5 ) ) cur++; if ( cur < limit ) @@ -1563,7 +1560,7 @@ break; if ( cur[0] == name[0] && - len == (FT_Int)strlen( (const char*)name ) ) + len == (FT_Int)ft_strlen( (const char*)name ) ) { FT_Int n; @@ -1732,7 +1729,7 @@ for ( idx = 0; idx < type1->num_glyphs; idx++ ) { glyph_name = (FT_Byte*)type1->glyph_names[idx]; - if ( strcmp( (const char*)char_name, + if ( ft_strcmp( (const char*)char_name, (const char*)glyph_name ) == 0 ) { type1->encoding.char_index[charcode] = (FT_UShort)idx; @@ -1740,7 +1737,7 @@ /* Change min/max encoded char only if glyph name is */ /* not /.notdef */ - if ( strcmp( (const char*)".notdef", + if ( ft_strcmp( (const char*)".notdef", (const char*)glyph_name ) != 0 ) { if (charcode < min_char) min_char = charcode; diff --git a/src/type1/t1objs.c b/src/type1/t1objs.c index b75dace38..18d0b1e3f 100644 --- a/src/type1/t1objs.c +++ b/src/type1/t1objs.c @@ -20,8 +20,6 @@ #include FT_INTERNAL_DEBUG_H #include FT_INTERNAL_STREAM_H -#include /* strcmp() */ - #include "t1gload.h" #include "t1load.h" @@ -382,8 +380,8 @@ root->style_flags |= FT_STYLE_FLAG_ITALIC; if ( face->type1.font_info.weight ) { - if ( !strcmp( face->type1.font_info.weight, "Bold" ) || - !strcmp( face->type1.font_info.weight, "Black" ) ) + if ( !ft_strcmp( face->type1.font_info.weight, "Bold" ) || + !ft_strcmp( face->type1.font_info.weight, "Black" ) ) root->style_flags |= FT_STYLE_FLAG_BOLD; } diff --git a/src/type1/t1parse.c b/src/type1/t1parse.c index 7a366eeea..e21e57da7 100644 --- a/src/type1/t1parse.c +++ b/src/type1/t1parse.c @@ -43,8 +43,6 @@ #include "t1errors.h" -#include /* for strncmp() */ - /*************************************************************************/ /* */ @@ -203,9 +201,9 @@ /* or `%!FontType' */ { if ( size <= 16 || - ( strncmp( (const char*)parser->base_dict, + ( ft_strncmp( (const char*)parser->base_dict, "%!PS-AdobeFont-1", 16 ) && - strncmp( (const char*)parser->base_dict, + ft_strncmp( (const char*)parser->base_dict, "%!FontType", 10 ) ) ) { FT_TRACE2(( "[not a Type1 font]\n" ));