Compare commits

...

89 Commits

Author SHA1 Message Date
suzuki toshiya 22769f6645 sfnt: Cast a charcode to 32-bit in cmap format 14 parser. 2009-07-03 18:01:44 +09:00
suzuki toshiya 7a726cb2b9 sfnt: Cast a charcode to 32-bit in cmap format 12 parser. 2009-07-03 18:01:44 +09:00
suzuki toshiya 988838f9d8 psaux: Fix a few casts to FT_Int32 value. 2009-07-03 18:01:43 +09:00
suzuki toshiya 8224bd671b sfnt: Fix a data type mismatching with its source. 2009-07-03 18:01:43 +09:00
suzuki toshiya 48efcb612f sfnt: Extend a few local variables to load 32-bit values. 2009-07-03 18:01:43 +09:00
suzuki toshiya 8a5c493640 pfr: Extend `num_aux' to take 32-bit value. 2009-07-03 18:01:42 +09:00
suzuki toshiya 12f2ee55a1 pcf: Truncate FT_ULong `nprops' to fit to int PCF_Face->nprops. 2009-07-03 18:01:42 +09:00
suzuki toshiya 2dacccc174 gxvalid: Extend a few local variables to reduce the casts. 2009-07-03 18:01:42 +09:00
suzuki toshiya 8b03a77d88 gxvalid: Extend `settingTable' to take 32-bit offset. 2009-07-03 18:01:41 +09:00
suzuki toshiya d5867413ab autofit: Cast FT_Long glyph_count to compare with FT_UInt GID. 2009-07-03 18:01:41 +09:00
suzuki toshiya 6c2176b86f smooth: Exclude 16-bit system in invalid pitch/height check. 2009-07-03 18:01:41 +09:00
suzuki toshiya ac079164bd cff: Type large constants > 0x7FFF as long for 16-bit systems. 2009-07-03 18:01:41 +09:00
suzuki toshiya 8114d2d684 base: Remove an unused variable. 2009-07-03 18:01:40 +09:00
suzuki toshiya 7a95cd876a cache: Check higher bits in flags for non ILP32 systems. 2009-07-03 18:01:40 +09:00
suzuki toshiya 7c67ddbf03 sfnt: Ignore invalid GIDs in glyph name lookup. 2009-07-03 18:01:40 +09:00
suzuki toshiya 1e1cb06cf9 pcf: Fix a comparison between FT_Long and FT_ULong. 2009-07-03 18:01:39 +09:00
suzuki toshiya 277733fc8d gxvalid: Guarantee `nFeatureFlags' size up to 32-bit. 2009-07-03 18:01:39 +09:00
suzuki toshiya 3fa528c45d sfnt: Insert explicit cast for LP64 system. 2009-07-03 18:01:39 +09:00
suzuki toshiya 3114e3cb18 gxvalid: Guarantee `just' table size upto 32-bit. 2009-07-03 18:01:38 +09:00
suzuki toshiya aed4ae7da9 gxvalid: Guarantee `trak' table size upto 32-bit. 2009-07-03 18:01:38 +09:00
suzuki toshiya 88aae380f2 type1: Fix a data type mismatching with its source. 2009-07-03 18:01:38 +09:00
suzuki toshiya dd045a511b pfr: Fix a data type mismatching with its source. 2009-07-03 18:01:38 +09:00
suzuki toshiya 089e4a53e5 pfr: Fix a data type mismatching with its source. 2009-07-03 18:01:37 +09:00
suzuki toshiya 1e597e5e86 pfr: Fix a data type mismatching with its source. 2009-07-03 18:01:37 +09:00
suzuki toshiya 1cf2cd8758 smooth: Improve the format in debug message. 2009-07-03 18:01:37 +09:00
suzuki toshiya bd38f8c2e2 sfnt: Fix a data type mismatching with its source. 2009-07-03 18:01:37 +09:00
suzuki toshiya 018a2e5f3f psaux: Fix a data type mismatching with its source. 2009-07-03 18:01:36 +09:00
suzuki toshiya c156c52cd9 truetype: Extend TrueType GX packed deltas to FT_Offset. 2009-07-03 18:01:36 +09:00
suzuki toshiya c7a2e69ed8 truetype: Extend mmvar_len to hold size_t values. 2009-07-03 18:01:36 +09:00
suzuki toshiya dc4357df7d truetype: Check invalid function number in IDEF instruction. 2009-07-03 18:01:35 +09:00
suzuki toshiya a72a4bd3b7 truetype: Check invalid function number in FDEF instruction. 2009-07-03 18:01:35 +09:00
suzuki toshiya 34bc30a5f0 truetype: Truncate the deltas of composite glyph at 16-bit values. 2009-07-03 18:01:35 +09:00
suzuki toshiya ad2badcb44 truetype: Truncate the instructions upto 16-bit per a glyph. 2009-07-03 18:01:34 +09:00
suzuki toshiya de9c435bc1 truetype: Cast the numerical operands to 32-bit for LP64 systems. 2009-07-03 18:01:34 +09:00
suzuki toshiya 009c39c1d9 truetype: Cast the project vector to 32-bit for LP64 system. 2009-07-03 18:01:34 +09:00
suzuki toshiya 19714ca65b truetype: Cast the scaling params to 32-bit for LP64 system. 2009-07-03 18:01:33 +09:00
suzuki toshiya 6b7c0a901c sfnt: Cast a character code to FT_UInt32 for LP64 system. 2009-07-03 18:01:33 +09:00
suzuki toshiya 2abe8d63fc sfnt: Cast a character code to FT_UInt32 for LP64 system. 2009-07-03 18:01:33 +09:00
suzuki toshiya 13cdd027d2 sfnt: Extend TT_BDF->strings_size to FT_ULong for huge BDF. 2009-07-03 18:01:32 +09:00
suzuki toshiya a0f7778bd4 psaux: Handle the string length by FT_Offset variables. 2009-07-03 18:01:32 +09:00
suzuki toshiya 74d4783ec1 pcf: Fix some data types mismatching with their sources. 2009-07-03 18:01:32 +09:00
suzuki toshiya 8ffff68644 pcf: Handle the string length by size_t variables. 2009-07-03 18:01:31 +09:00
suzuki toshiya daebaaa815 pcf: Fix some data types mismatching with their sources. 2009-07-03 18:01:31 +09:00
suzuki toshiya 374066a0b8 otvalid: Truncate the glyph index to 16-bit. 2009-07-03 18:01:31 +09:00
suzuki toshiya 9ba196935a cache: Insert explict casts for LP64 systems. 2009-07-03 18:01:31 +09:00
suzuki toshiya 2bb188d0f2 cache: Fix some data types mismatching with their sources. 2009-07-03 18:01:30 +09:00
suzuki toshiya d22f5a532a XXX_cmap_encoding_char_next() return FT_UInt32 values. 2009-07-03 18:01:30 +09:00
suzuki toshiya 2faa635ce6 truetype: Extend TT_Face->num_locations for broken TTFs. 2009-07-03 18:01:29 +09:00
suzuki toshiya 9a3c169704 smooth: Fix some data types mismatching with their sources. 2009-07-03 18:01:29 +09:00
suzuki toshiya 5ac77d159e cff: Fix some data types mismatching with their sources. 2009-07-03 18:01:29 +09:00
suzuki toshiya cac24ae82d autofit: Fix some data types mismatching with their sources. 2009-07-03 18:01:28 +09:00
suzuki toshiya 663e9c4d59 autofit: Count the size of the memory object by ptrdiff_t. 2009-07-03 18:01:28 +09:00
suzuki toshiya 1c4274eeb7 autofit: Fix for unused variable `first'. 2009-07-03 18:01:28 +09:00
suzuki toshiya ea7b019422 Improve bitmap size or pixel variables for 16-bit systems. 2009-07-03 18:01:28 +09:00
suzuki toshiya efc8509f72 psaux: Prevent invalid arguments to afm_parser_read_vals(). 2009-07-03 18:01:27 +09:00
suzuki toshiya 080dd83d46 base: Prevent some overflows on LP64 systems. 2009-07-03 18:01:27 +09:00
suzuki toshiya 885d4ff7a3 cff: Cast the long variables to 32-bit for LP64 systems. 2009-07-03 18:01:26 +09:00
suzuki toshiya cf37b538d8 pcf: Improve PCF_PropertyRec.value names on LP64 platforms. 2009-07-03 18:01:26 +09:00
suzuki toshiya 902cff743d pcf: Fix some data types mismatching with their sources. 2009-07-03 18:01:26 +09:00
suzuki toshiya 2d7050ec80 bdf: Improve bdf_property_t.value names for LP64 platforms. 2009-07-03 18:01:26 +09:00
suzuki toshiya 436db93a58 bdf: Fix some data types mismatching with their sources. 2009-07-03 18:01:25 +09:00
suzuki toshiya 20be5c0b58 autofit: Improve Unicode range definitions. 2009-07-03 18:01:25 +09:00
suzuki toshiya bdf8399ef7 smooth: Fix a data type mismatching with its source. 2009-07-03 18:01:25 +09:00
suzuki toshiya d03e2f981f smooth: Fix a data type mismatching with its source. 2009-07-03 18:01:24 +09:00
suzuki toshiya 0102bb6fe6 cache: Disable the legacy compatibility if 16-bit system. 2009-07-03 18:01:24 +09:00
suzuki toshiya b9d2a0e2ad cache: Check 32-bit glyph index on 16-bit systems. 2009-07-03 18:01:24 +09:00
suzuki toshiya d7c0e4bef1 cache: Fix some data types mismatching with their sources. 2009-07-03 18:01:23 +09:00
suzuki toshiya 12742fd35a cache: Fix some data types mismatching with their sources. 2009-07-03 18:01:23 +09:00
suzuki toshiya 6867d87ca8 cache: Cast NULL to a required function type explicitly. 2009-07-03 18:01:23 +09:00
suzuki toshiya e4831fc3c3 fttypes.h: Cast FT_MAKE_TAG output to FT_Tag exlicitly. 2009-07-03 18:01:22 +09:00
suzuki toshiya 9f8e1eff87 psnames: Handle Unicode codepoints by FT_UInt32 variables. 2009-07-03 18:01:22 +09:00
suzuki toshiya 2cd993da4d psaux: Use size_t variable to pass the buffer size. 2009-07-03 18:01:22 +09:00
suzuki toshiya da874016eb type1: Use size_t variable to pass the string length. 2009-07-03 18:01:22 +09:00
suzuki toshiya 3fb76769ed cid: Fix some data types mismatching with their sources. 2009-07-03 18:01:21 +09:00
suzuki toshiya 8f357a2e2e cff: Fix for unused variable `rest'. 2009-07-03 18:01:21 +09:00
suzuki toshiya c1608d1257 cff: Fix some data types mismatching with their sources. 2009-07-03 18:01:21 +09:00
suzuki toshiya 328a0cc745 bdf: Fix some data types mismatching with their sources. 2009-07-03 18:01:20 +09:00
suzuki toshiya b06e906ec2 sfnt: Count the size of the memory object by ptrdiff_t. 2009-07-03 18:01:20 +09:00
suzuki toshiya 2680780884 lzw: Count the size of the memory object by ptrdiff_t. 2009-07-03 18:01:20 +09:00
suzuki toshiya 351d3c9682 otvalid: Count the table size on memory by ptrdiff_t. 2009-07-03 18:01:19 +09:00
suzuki toshiya d5337b8965 otvalid: Prevent an overflow by GPOS/GSUB 32b-bit offset. 2009-07-03 18:01:19 +09:00
suzuki toshiya 4053559b19 ftobjs.c: Prevent an overflow in glyph index handling. 2009-07-03 18:01:19 +09:00
suzuki toshiya 4b431ddca8 Improve the variable types in raccess_make_file_name(). 2009-07-03 18:01:19 +09:00
suzuki toshiya ab888c9c87 ftpatent.c: Fix for unused variable `error'. 2009-07-03 18:01:18 +09:00
suzuki toshiya f23aef3f09 type1: Check invalid string longer than PostScript limit. 2009-07-03 18:01:18 +09:00
suzuki toshiya 848dbd9840 gzip: Use FT2 zcalloc() & zfree() in ftgzip.c by default. 2009-07-03 18:01:18 +09:00
suzuki toshiya 4f9802468e gzip: Distinguish PureC from TurboC on MSDOS. 2009-07-03 18:01:17 +09:00
suzuki toshiya 5baa5c0983 gxvalid: Insert PureC pragma to allow unevaluated variables. 2009-07-03 18:01:17 +09:00
suzuki toshiya db4a2afc5f gxvalid: Pass the union by the pointer instead of the value. 2009-07-03 18:01:17 +09:00
107 changed files with 1946 additions and 539 deletions

1119
ChangeLog

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
#if defined( __GXVALID_H__ )
#pragma warn -aus /* too many unevaluated variables in gxvalid */
#endif
#ifndef ATARI_H #ifndef ATARI_H
#define ATARI_H #define ATARI_H

View File

@ -61,6 +61,7 @@
#define FT_CHAR_BIT CHAR_BIT #define FT_CHAR_BIT CHAR_BIT
#define FT_INT_MAX INT_MAX #define FT_INT_MAX INT_MAX
#define FT_INT_MIN INT_MIN
#define FT_UINT_MAX UINT_MAX #define FT_UINT_MAX UINT_MAX
#define FT_ULONG_MAX ULONG_MAX #define FT_ULONG_MAX ULONG_MAX

View File

@ -474,6 +474,7 @@ FT_BEGIN_HEADER
/* this macro. */ /* this macro. */
/* */ /* */
#define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \ #define FT_MAKE_TAG( _x1, _x2, _x3, _x4 ) \
(FT_Tag) \
( ( (FT_ULong)_x1 << 24 ) | \ ( ( (FT_ULong)_x1 << 24 ) | \
( (FT_ULong)_x2 << 16 ) | \ ( (FT_ULong)_x2 << 16 ) | \
( (FT_ULong)_x3 << 8 ) | \ ( (FT_ULong)_x3 << 8 ) | \

View File

@ -36,11 +36,13 @@ FT_TRACE_DEF( raster ) /* monochrome rasterizer (ftraster.c) */
FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */ FT_TRACE_DEF( smooth ) /* anti-aliasing raster (ftgrays.c) */
FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */ FT_TRACE_DEF( mm ) /* MM interface (ftmm.c) */
FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */ FT_TRACE_DEF( raccess ) /* resource fork accessor (ftrfork.c) */
FT_TRACE_DEF( synth ) /* bold/slant synthesizer (ftsynth.c) */
/* Cache sub-system */ /* Cache sub-system */
FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */ FT_TRACE_DEF( cache ) /* cache sub-system (ftcache.c, etc.) */
/* SFNT driver components */ /* SFNT driver components */
FT_TRACE_DEF( sfdriver ) /* SFNT font driver (sfdriver.c) */
FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */ FT_TRACE_DEF( sfobjs ) /* SFNT object handler (sfobjs.c) */
FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */ FT_TRACE_DEF( ttcmap ) /* charmap handler (ttcmap.c) */
FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */ FT_TRACE_DEF( ttkern ) /* kerning handler (ttkern.c) */

View File

@ -360,7 +360,7 @@ FT_BEGIN_HEADER
FT_Error FT_Error
(*to_bytes)( PS_Parser parser, (*to_bytes)( PS_Parser parser,
FT_Byte* bytes, FT_Byte* bytes,
FT_Long max_bytes, FT_Offset max_bytes,
FT_Long* pnum_bytes, FT_Long* pnum_bytes,
FT_Bool delimiters ); FT_Bool delimiters );
@ -689,7 +689,7 @@ FT_BEGIN_HEADER
T1_Decoder_Callback parse_callback; T1_Decoder_Callback parse_callback;
T1_Decoder_FuncsRec funcs; T1_Decoder_FuncsRec funcs;
FT_Int* buildchar; FT_Long* buildchar;
FT_UInt len_buildchar; FT_UInt len_buildchar;
FT_Bool seac; FT_Bool seac;
@ -755,7 +755,7 @@ FT_BEGIN_HEADER
FT_Int FT_Int
(*get_index)( const char* name, (*get_index)( const char* name,
FT_UInt len, FT_Offset len,
void* user_data ); void* user_data );
void* user_data; void* user_data;

View File

@ -98,7 +98,7 @@ FT_BEGIN_HEADER
(*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes, (*PS_Unicodes_CharIndexFunc)( PS_Unicodes unicodes,
FT_UInt32 unicode ); FT_UInt32 unicode );
typedef FT_ULong typedef FT_UInt32
(*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes, (*PS_Unicodes_CharNextFunc)( PS_Unicodes unicodes,
FT_UInt32 *unicode ); FT_UInt32 *unicode );

View File

@ -230,7 +230,7 @@ FT_BEGIN_HEADER
/* undocumented, optional: has the same meaning as len_buildchar */ /* undocumented, optional: has the same meaning as len_buildchar */
/* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */ /* for Type 2 fonts; manipulated by othersubrs 19, 24, and 25 */
FT_UInt len_buildchar; FT_UInt len_buildchar;
FT_Int* buildchar; FT_Long* buildchar;
/* since version 2.1 - interface to PostScript hinter */ /* since version 2.1 - interface to PostScript hinter */
const void* pshinter; const void* pshinter;

View File

@ -902,7 +902,7 @@ FT_BEGIN_HEADER
FT_Byte* table; FT_Byte* table;
FT_Byte* table_end; FT_Byte* table_end;
FT_Byte* strings; FT_Byte* strings;
FT_UInt32 strings_size; FT_ULong strings_size;
FT_UInt num_strikes; FT_UInt num_strikes;
FT_Bool loaded; FT_Bool loaded;
@ -1401,7 +1401,7 @@ FT_BEGIN_HEADER
FT_Byte* vert_metrics; FT_Byte* vert_metrics;
FT_ULong vert_metrics_size; FT_ULong vert_metrics_size;
FT_UInt num_locations; FT_ULong num_locations; /* in broken TTF, gid > 0xFFFF */
FT_Byte* glyph_locations; FT_Byte* glyph_locations;
FT_Byte* hdmx_table; FT_Byte* hdmx_table;

View File

@ -1020,7 +1020,7 @@
AF_AxisHints axis = &hints->axis[dim]; AF_AxisHints axis = &hints->axis[dim];
AF_Edge edges = axis->edges; AF_Edge edges = axis->edges;
AF_Edge edge_limit = edges + axis->num_edges; AF_Edge edge_limit = edges + axis->num_edges;
FT_Int n_edges; FT_PtrDist n_edges;
AF_Edge edge; AF_Edge edge;
AF_Edge anchor = 0; AF_Edge anchor = 0;
FT_Pos delta = 0; FT_Pos delta = 0;
@ -1444,29 +1444,29 @@
static const AF_Script_UniRangeRec af_cjk_uniranges[] = static const AF_Script_UniRangeRec af_cjk_uniranges[] =
{ {
#if 0 #if 0
{ 0x0100UL, 0xFFFFUL }, /* why this? */ AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */
#endif #endif
{ 0x2E80UL, 0x2EFFUL }, /* CJK Radicals Supplement */ AF_UNIRANGE_REC( 0x2E80UL, 0x2EFFUL ), /* CJK Radicals Supplement */
{ 0x2F00UL, 0x2FDFUL }, /* Kangxi Radicals */ AF_UNIRANGE_REC( 0x2F00UL, 0x2FDFUL ), /* Kangxi Radicals */
{ 0x3000UL, 0x303FUL }, /* CJK Symbols and Punctuation */ AF_UNIRANGE_REC( 0x3000UL, 0x303FUL ), /* CJK Symbols and Punctuation */
{ 0x3040UL, 0x309FUL }, /* Hiragana */ AF_UNIRANGE_REC( 0x3040UL, 0x309FUL ), /* Hiragana */
{ 0x30A0UL, 0x30FFUL }, /* Katakana */ AF_UNIRANGE_REC( 0x30A0UL, 0x30FFUL ), /* Katakana */
{ 0x3100UL, 0x312FUL }, /* Bopomofo */ AF_UNIRANGE_REC( 0x3100UL, 0x312FUL ), /* Bopomofo */
{ 0x3130UL, 0x318FUL }, /* Hangul Compatibility Jamo */ AF_UNIRANGE_REC( 0x3130UL, 0x318FUL ), /* Hangul Compatibility Jamo */
{ 0x31A0UL, 0x31BFUL }, /* Bopomofo Extended */ AF_UNIRANGE_REC( 0x31A0UL, 0x31BFUL ), /* Bopomofo Extended */
{ 0x31C0UL, 0x31EFUL }, /* CJK Strokes */ AF_UNIRANGE_REC( 0x31C0UL, 0x31EFUL ), /* CJK Strokes */
{ 0x31F0UL, 0x31FFUL }, /* Katakana Phonetic Extensions */ AF_UNIRANGE_REC( 0x31F0UL, 0x31FFUL ), /* Katakana Phonetic Extensions */
{ 0x3200UL, 0x32FFUL }, /* Enclosed CJK Letters and Months */ AF_UNIRANGE_REC( 0x3200UL, 0x32FFUL ), /* Enclosed CJK Letters and Months */
{ 0x3300UL, 0x33FFUL }, /* CJK Compatibility */ AF_UNIRANGE_REC( 0x3300UL, 0x33FFUL ), /* CJK Compatibility */
{ 0x3400UL, 0x4DBFUL }, /* CJK Unified Ideographs Extension A */ AF_UNIRANGE_REC( 0x3400UL, 0x4DBFUL ), /* CJK Unified Ideographs Extension A */
{ 0x4DC0UL, 0x4DFFUL }, /* Yijing Hexagram Symbols */ AF_UNIRANGE_REC( 0x4DC0UL, 0x4DFFUL ), /* Yijing Hexagram Symbols */
{ 0x4E00UL, 0x9FFFUL }, /* CJK Unified Ideographs */ AF_UNIRANGE_REC( 0x4E00UL, 0x9FFFUL ), /* CJK Unified Ideographs */
{ 0xF900UL, 0xFAFFUL }, /* CJK Compatibility Ideographs */ AF_UNIRANGE_REC( 0xF900UL, 0xFAFFUL ), /* CJK Compatibility Ideographs */
{ 0xFE30UL, 0xFE4FUL }, /* CJK Compatibility Forms */ AF_UNIRANGE_REC( 0xFE30UL, 0xFE4FUL ), /* CJK Compatibility Forms */
{ 0xFF00UL, 0xFFEFUL }, /* Halfwidth and Fullwidth Forms */ AF_UNIRANGE_REC( 0xFF00UL, 0xFFEFUL ), /* Halfwidth and Fullwidth Forms */
{ 0x20000UL, 0x2A6DFUL }, /* CJK Unified Ideographs Extension B */ AF_UNIRANGE_REC( 0x20000UL, 0x2A6DFUL ), /* CJK Unified Ideographs Extension B */
{ 0x2F800UL, 0x2FA1FUL }, /* CJK Compatibility Ideographs Supplement */ AF_UNIRANGE_REC( 0x2F800UL, 0x2FA1FUL ), /* CJK Compatibility Ideographs Supplement */
{ 0UL, 0UL } AF_UNIRANGE_REC( 0UL, 0UL )
}; };
@ -1488,7 +1488,7 @@
static const AF_Script_UniRangeRec af_cjk_uniranges[] = static const AF_Script_UniRangeRec af_cjk_uniranges[] =
{ {
{ 0, 0 } AF_UNIRANGE_REC( 0UL, 0UL )
}; };

View File

@ -65,7 +65,7 @@
typedef struct AF_FaceGlobalsRec_ typedef struct AF_FaceGlobalsRec_
{ {
FT_Face face; FT_Face face;
FT_UInt glyph_count; /* same as face->num_glyphs */ FT_Long glyph_count; /* same as face->num_glyphs */
FT_Byte* glyph_scripts; FT_Byte* glyph_scripts;
AF_ScriptMetrics metrics[AF_SCRIPT_MAX]; AF_ScriptMetrics metrics[AF_SCRIPT_MAX];
@ -124,7 +124,7 @@
gindex = FT_Get_Char_Index( face, charcode ); gindex = FT_Get_Char_Index( face, charcode );
if ( gindex != 0 && if ( gindex != 0 &&
gindex < globals->glyph_count && gindex < (FT_ULong)globals->glyph_count &&
gscripts[gindex] == AF_SCRIPT_LIST_NONE ) gscripts[gindex] == AF_SCRIPT_LIST_NONE )
{ {
gscripts[gindex] = (FT_Byte)ss; gscripts[gindex] = (FT_Byte)ss;
@ -137,7 +137,7 @@
if ( gindex == 0 || charcode > range->last ) if ( gindex == 0 || charcode > range->last )
break; break;
if ( gindex < globals->glyph_count && if ( gindex < (FT_ULong)globals->glyph_count &&
gscripts[gindex] == AF_SCRIPT_LIST_NONE ) gscripts[gindex] == AF_SCRIPT_LIST_NONE )
{ {
gscripts[gindex] = (FT_Byte)ss; gscripts[gindex] = (FT_Byte)ss;
@ -152,7 +152,7 @@
FT_UInt gindex = FT_Get_Char_Index( face, i ); FT_UInt gindex = FT_Get_Char_Index( face, i );
if ( gindex != 0 && gindex < globals->glyph_count ) if ( gindex != 0 && gindex < (FT_ULong)globals->glyph_count )
gscripts[gindex] |= AF_DIGIT; gscripts[gindex] |= AF_DIGIT;
} }
@ -162,7 +162,7 @@
* XXX: Shouldn't we disable hinting or do something similar? * XXX: Shouldn't we disable hinting or do something similar?
*/ */
{ {
FT_UInt nn; FT_Long nn;
for ( nn = 0; nn < globals->glyph_count; nn++ ) for ( nn = 0; nn < globals->glyph_count; nn++ )
@ -252,12 +252,12 @@
FT_UInt gidx; FT_UInt gidx;
AF_ScriptClass clazz; AF_ScriptClass clazz;
FT_UInt script = options & 15; FT_UInt script = options & 15;
const FT_UInt script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) / const FT_Offset script_max = sizeof ( AF_SCRIPT_CLASSES_GET ) /
sizeof ( AF_SCRIPT_CLASSES_GET[0] ); sizeof ( AF_SCRIPT_CLASSES_GET[0] );
FT_Error error = AF_Err_Ok; FT_Error error = AF_Err_Ok;
if ( gindex >= globals->glyph_count ) if ( gindex >= (FT_ULong)globals->glyph_count )
{ {
error = AF_Err_Invalid_Argument; error = AF_Err_Invalid_Argument;
goto Exit; goto Exit;
@ -310,7 +310,7 @@
af_face_globals_is_digit( AF_FaceGlobals globals, af_face_globals_is_digit( AF_FaceGlobals globals,
FT_UInt gindex ) FT_UInt gindex )
{ {
if ( gindex < globals->glyph_count ) if ( gindex < (FT_ULong)globals->glyph_count )
return (FT_Bool)( globals->glyph_scripts[gindex] & AF_DIGIT ); return (FT_Bool)( globals->glyph_scripts[gindex] & AF_DIGIT );
return (FT_Bool)0; return (FT_Bool)0;

View File

@ -34,7 +34,7 @@
{ {
FT_Int old_max = axis->max_segments; FT_Int old_max = axis->max_segments;
FT_Int new_max = old_max; FT_Int new_max = old_max;
FT_Int big_max = FT_INT_MAX / sizeof ( *segment ); FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *segment ) );
if ( old_max >= big_max ) if ( old_max >= big_max )
@ -77,7 +77,7 @@
{ {
FT_Int old_max = axis->max_edges; FT_Int old_max = axis->max_edges;
FT_Int new_max = old_max; FT_Int new_max = old_max;
FT_Int big_max = FT_INT_MAX / sizeof ( *edge ); FT_Int big_max = (FT_Int)( FT_INT_MAX / sizeof ( *edge ) );
if ( old_max >= big_max ) if ( old_max >= big_max )
@ -645,6 +645,7 @@
FT_Int contour_index = 0; FT_Int contour_index = 0;
FT_UNUSED( first );
for ( point = points; point < point_limit; point++, vec++, tag++ ) for ( point = points; point < point_limit; point++, vec++, tag++ )
{ {
point->fx = (FT_Short)vec->x; point->fx = (FT_Short)vec->x;
@ -940,8 +941,8 @@
} }
{ {
FT_UInt min, max, mid; FT_PtrDist min, max, mid;
FT_Pos fpos; FT_Pos fpos;
/* find enclosing edges */ /* find enclosing edges */
@ -952,7 +953,7 @@
/* for small edge counts, a linear search is better */ /* for small edge counts, a linear search is better */
if ( max <= 8 ) if ( max <= 8 )
{ {
FT_UInt nn; FT_PtrDist nn;
for ( nn = 0; nn < max; nn++ ) for ( nn = 0; nn < max; nn++ )
if ( edges[nn].fpos >= u ) if ( edges[nn].fpos >= u )

View File

@ -81,10 +81,10 @@
static const AF_Script_UniRangeRec af_indic_uniranges[] = static const AF_Script_UniRangeRec af_indic_uniranges[] =
{ {
#if 0 #if 0
{ 0x0100, 0xFFFF }, /* why this? */ AF_UNIRANGE_REC( 0x0100UL, 0xFFFFUL ), /* why this? */
#endif #endif
{ 0x0900, 0x0DFF}, /* Indic Range */ AF_UNIRANGE_REC( 0x0900UL, 0x0DFFUL), /* Indic Range */
{ 0, 0 } AF_UNIRANGE_REC( 0UL, 0UL)
}; };

View File

@ -198,7 +198,8 @@
for ( ; p < limit && *p; p++ ) for ( ; p < limit && *p; p++ )
{ {
FT_UInt glyph_index; FT_UInt glyph_index;
FT_Int best_point, best_y, best_first, best_last; FT_Pos best_y; /* same as points.y */
FT_Int best_point, best_first, best_last;
FT_Vector* points; FT_Vector* points;
FT_Bool round = 0; FT_Bool round = 0;
@ -1617,7 +1618,7 @@
/* not hinted, appear a lot bolder or thinner than the */ /* not hinted, appear a lot bolder or thinner than the */
/* vertical stems. */ /* vertical stems. */
FT_Int delta; FT_Pos delta;
dist = ( dist + 22 ) & ~63; dist = ( dist + 22 ) & ~63;
@ -1701,7 +1702,7 @@
AF_AxisHints axis = &hints->axis[dim]; AF_AxisHints axis = &hints->axis[dim];
AF_Edge edges = axis->edges; AF_Edge edges = axis->edges;
AF_Edge edge_limit = edges + axis->num_edges; AF_Edge edge_limit = edges + axis->num_edges;
FT_Int n_edges; FT_PtrDist n_edges;
AF_Edge edge; AF_Edge edge;
AF_Edge anchor = 0; AF_Edge anchor = 0;
FT_Int has_serifs = 0; FT_Int has_serifs = 0;
@ -2177,33 +2178,33 @@
static const AF_Script_UniRangeRec af_latin_uniranges[] = static const AF_Script_UniRangeRec af_latin_uniranges[] =
{ {
{ 0x0020 , 0x007F }, /* Basic Latin (no control chars) */ AF_UNIRANGE_REC( 0x0020UL, 0x007FUL ), /* Basic Latin (no control chars) */
{ 0x00A0 , 0x00FF }, /* Latin-1 Supplement (no control chars) */ AF_UNIRANGE_REC( 0x00A0UL, 0x00FFUL ), /* Latin-1 Supplement (no control chars) */
{ 0x0100 , 0x017F }, /* Latin Extended-A */ AF_UNIRANGE_REC( 0x0100UL, 0x017FUL ), /* Latin Extended-A */
{ 0x0180 , 0x024F }, /* Latin Extended-B */ AF_UNIRANGE_REC( 0x0180UL, 0x024FUL ), /* Latin Extended-B */
{ 0x0250 , 0x02AF }, /* IPA Extensions */ AF_UNIRANGE_REC( 0x0250UL, 0x02AFUL ), /* IPA Extensions */
{ 0x02B0 , 0x02FF }, /* Spacing Modifier Letters */ AF_UNIRANGE_REC( 0x02B0UL, 0x02FFUL ), /* Spacing Modifier Letters */
{ 0x0300 , 0x036F }, /* Combining Diacritical Marks */ AF_UNIRANGE_REC( 0x0300UL, 0x036FUL ), /* Combining Diacritical Marks */
{ 0x0370 , 0x03FF }, /* Greek and Coptic */ AF_UNIRANGE_REC( 0x0370UL, 0x03FFUL ), /* Greek and Coptic */
{ 0x0400 , 0x04FF }, /* Cyrillic */ AF_UNIRANGE_REC( 0x0400UL, 0x04FFUL ), /* Cyrillic */
{ 0x0500 , 0x052F }, /* Cyrillic Supplement */ AF_UNIRANGE_REC( 0x0500UL, 0x052FUL ), /* Cyrillic Supplement */
{ 0x1D00 , 0x1D7F }, /* Phonetic Extensions */ AF_UNIRANGE_REC( 0x1D00UL, 0x1D7FUL ), /* Phonetic Extensions */
{ 0x1D80 , 0x1DBF }, /* Phonetic Extensions Supplement */ AF_UNIRANGE_REC( 0x1D80UL, 0x1DBFUL ), /* Phonetic Extensions Supplement */
{ 0x1DC0 , 0x1DFF }, /* Combining Diacritical Marks Supplement */ AF_UNIRANGE_REC( 0x1DC0UL, 0x1DFFUL ), /* Combining Diacritical Marks Supplement */
{ 0x1E00 , 0x1EFF }, /* Latin Extended Additional */ AF_UNIRANGE_REC( 0x1E00UL, 0x1EFFUL ), /* Latin Extended Additional */
{ 0x1F00 , 0x1FFF }, /* Greek Extended */ AF_UNIRANGE_REC( 0x1F00UL, 0x1FFFUL ), /* Greek Extended */
{ 0x2000 , 0x206F }, /* General Punctuation */ AF_UNIRANGE_REC( 0x2000UL, 0x206FUL ), /* General Punctuation */
{ 0x2070 , 0x209F }, /* Superscripts and Subscripts */ AF_UNIRANGE_REC( 0x2070UL, 0x209FUL ), /* Superscripts and Subscripts */
{ 0x20A0 , 0x20CF }, /* Currency Symbols */ AF_UNIRANGE_REC( 0x20A0UL, 0x20CFUL ), /* Currency Symbols */
{ 0x2150 , 0x218F }, /* Number Forms */ AF_UNIRANGE_REC( 0x2150UL, 0x218FUL ), /* Number Forms */
{ 0x2460 , 0x24FF }, /* Enclosed Alphanumerics */ AF_UNIRANGE_REC( 0x2460UL, 0x24FFUL ), /* Enclosed Alphanumerics */
{ 0x2C60 , 0x2C7F }, /* Latin Extended-C */ AF_UNIRANGE_REC( 0x2C60UL, 0x2C7FUL ), /* Latin Extended-C */
{ 0x2DE0 , 0x2DFF }, /* Cyrillic Extended-A */ AF_UNIRANGE_REC( 0x2DE0UL, 0x2DFFUL ), /* Cyrillic Extended-A */
{ 0xA640U , 0xA69FU }, /* Cyrillic Extended-B */ AF_UNIRANGE_REC( 0xA640UL, 0xA69FUL ), /* Cyrillic Extended-B */
{ 0xA720U , 0xA7FFU }, /* Latin Extended-D */ AF_UNIRANGE_REC( 0xA720UL, 0xA7FFUL ), /* Latin Extended-D */
{ 0xFB00U , 0xFB06U }, /* Alphab. Present. Forms (Latin Ligs) */ AF_UNIRANGE_REC( 0xFB00UL, 0xFB06UL ), /* Alphab. Present. Forms (Latin Ligs) */
{ 0x1D400UL, 0x1D7FFUL }, /* Mathematical Alphanumeric Symbols */ AF_UNIRANGE_REC( 0x1D400UL, 0x1D7FFUL ), /* Mathematical Alphanumeric Symbols */
{ 0 , 0 } AF_UNIRANGE_REC( 0UL, 0UL )
}; };

View File

@ -2320,9 +2320,9 @@
static const AF_Script_UniRangeRec af_latin2_uniranges[] = static const AF_Script_UniRangeRec af_latin2_uniranges[] =
{ {
{ 32, 127 }, /* XXX: TODO: Add new Unicode ranges here! */ AF_UNIRANGE_REC( 32UL, 127UL ), /* XXX: TODO: Add new Unicode ranges here! */
{ 160, 255 }, AF_UNIRANGE_REC( 160UL, 255UL ),
{ 0, 0 } AF_UNIRANGE_REC( 0UL, 0UL )
}; };

View File

@ -322,6 +322,8 @@ extern void* _af_debug_hints;
} AF_Script_UniRangeRec; } AF_Script_UniRangeRec;
#define AF_UNIRANGE_REC( a, b ) { (FT_UInt32)(a), (FT_UInt32)(b) }
typedef const AF_Script_UniRangeRec *AF_Script_UniRange; typedef const AF_Script_UniRangeRec *AF_Script_UniRange;
@ -330,7 +332,7 @@ extern void* _af_debug_hints;
AF_Script script; AF_Script script;
AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */ AF_Script_UniRange script_uni_ranges; /* last must be { 0, 0 } */
FT_UInt script_metrics_size; FT_Offset script_metrics_size;
AF_Script_InitMetricsFunc script_metrics_init; AF_Script_InitMetricsFunc script_metrics_init;
AF_Script_ScaleMetricsFunc script_metrics_scale; AF_Script_ScaleMetricsFunc script_metrics_scale;
AF_Script_DoneMetricsFunc script_metrics_done; AF_Script_DoneMetricsFunc script_metrics_done;

View File

@ -140,7 +140,7 @@
if ( flags & FT_ADVANCE_FLAG_FAST_ONLY ) if ( flags & FT_ADVANCE_FLAG_FAST_ONLY )
return FT_Err_Unimplemented_Feature; return FT_Err_Unimplemented_Feature;
flags |= FT_LOAD_ADVANCE_ONLY; flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
{ {
error = FT_Load_Glyph( face, start + nn, flags ); error = FT_Load_Glyph( face, start + nn, flags );

View File

@ -228,8 +228,12 @@
if ( !bitmap || !bitmap->buffer ) if ( !bitmap || !bitmap->buffer )
return FT_Err_Invalid_Argument; return FT_Err_Invalid_Argument;
xstr = FT_PIX_ROUND( xStrength ) >> 6; if ( ( ( FT_PIX_ROUND( xStrength ) >> 6 ) > FT_INT_MAX ) ||
ystr = FT_PIX_ROUND( yStrength ) >> 6; ( ( FT_PIX_ROUND( yStrength ) >> 6 ) > FT_INT_MAX ) )
return FT_Err_Invalid_Argument;
xstr = (FT_Int)FT_PIX_ROUND( xStrength ) >> 6;
ystr = (FT_Int)FT_PIX_ROUND( yStrength ) >> 6;
if ( xstr == 0 && ystr == 0 ) if ( xstr == 0 && ystr == 0 )
return FT_Err_Ok; return FT_Err_Ok;

View File

@ -110,12 +110,12 @@
FT_EXPORT_DEF( FT_Int32 ) FT_EXPORT_DEF( FT_Int32 )
FT_Sqrt32( FT_Int32 x ) FT_Sqrt32( FT_Int32 x )
{ {
FT_ULong val, root, newroot, mask; FT_UInt32 val, root, newroot, mask;
root = 0; root = 0;
mask = 0x40000000L; mask = (FT_UInt32)0x40000000UL;
val = (FT_ULong)x; val = (FT_UInt32)x;
do do
{ {
@ -362,6 +362,7 @@
long s; long s;
/* XXX: this function does not allow 64-bit arguments */
if ( a == 0 || b == c ) if ( a == 0 || b == c )
return a; return a;
@ -377,12 +378,12 @@
FT_Int64 temp, temp2; FT_Int64 temp, temp2;
ft_multo64( a, b, &temp ); ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );
temp2.hi = 0; temp2.hi = 0;
temp2.lo = (FT_UInt32)(c >> 1); temp2.lo = (FT_UInt32)(c >> 1);
FT_Add64( &temp, &temp2, &temp ); FT_Add64( &temp, &temp2, &temp );
a = ft_div64by32( temp.hi, temp.lo, c ); a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );
} }
else else
a = 0x7FFFFFFFL; a = 0x7FFFFFFFL;
@ -416,8 +417,8 @@
FT_Int64 temp; FT_Int64 temp;
ft_multo64( a, b, &temp ); ft_multo64( (FT_Int32)a, (FT_Int32)b, &temp );
a = ft_div64by32( temp.hi, temp.lo, c ); a = ft_div64by32( temp.hi, temp.lo, (FT_Int32)c );
} }
else else
a = 0x7FFFFFFFL; a = 0x7FFFFFFFL;
@ -539,13 +540,14 @@
FT_UInt32 q; FT_UInt32 q;
s = a; a = FT_ABS( a ); /* XXX: this function does not allow 64-bit arguments */
s ^= b; b = FT_ABS( b ); s = (FT_Int32)a; a = FT_ABS( a );
s ^= (FT_Int32)b; b = FT_ABS( b );
if ( b == 0 ) if ( b == 0 )
{ {
/* check for division by 0 */ /* check for division by 0 */
q = 0x7FFFFFFFL; q = (FT_UInt32)0x7FFFFFFFL;
} }
else if ( ( a >> 16 ) == 0 ) else if ( ( a >> 16 ) == 0 )
{ {
@ -562,7 +564,7 @@
temp2.hi = 0; temp2.hi = 0;
temp2.lo = (FT_UInt32)( b >> 1 ); temp2.lo = (FT_UInt32)( b >> 1 );
FT_Add64( &temp, &temp2, &temp ); FT_Add64( &temp, &temp2, &temp );
q = ft_div64by32( temp.hi, temp.lo, b ); q = ft_div64by32( temp.hi, temp.lo, (FT_Int32)b );
} }
return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q ); return ( s < 0 ? -(FT_Int32)q : (FT_Int32)q );
@ -840,7 +842,7 @@
FT_Pos out_x, FT_Pos out_x,
FT_Pos out_y ) FT_Pos out_y )
{ {
FT_Int result; FT_Long result; /* avoid overflow on 16-bit system */
/* deal with the trivial cases quickly */ /* deal with the trivial cases quickly */
@ -889,8 +891,9 @@
FT_Int64 z1, z2; FT_Int64 z1, z2;
ft_multo64( in_x, out_y, &z1 ); /* XXX: this function does not allow 64-bit arguments */
ft_multo64( in_y, out_x, &z2 ); ft_multo64( (FT_Int32)in_x, (FT_Int32)out_y, &z1 );
ft_multo64( (FT_Int32)in_y, (FT_Int32)out_x, &z2 );
if ( z1.hi > z2.hi ) if ( z1.hi > z2.hi )
result = +1; result = +1;
@ -906,7 +909,8 @@
#endif #endif
} }
return result; /* XXX: only the sign of return value, +1/0/-1 must be used */
return (FT_Int)result;
} }

View File

@ -507,7 +507,6 @@
FT_Vector* origin, FT_Vector* origin,
FT_Bool destroy ) FT_Bool destroy )
{ {
FT_Library library;
FT_GlyphSlotRec dummy; FT_GlyphSlotRec dummy;
FT_GlyphSlot_InternalRec dummy_internal; FT_GlyphSlot_InternalRec dummy_internal;
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
@ -528,7 +527,6 @@
if ( !glyph ) if ( !glyph )
goto Bad; goto Bad;
library = glyph->library;
clazz = glyph->clazz; clazz = glyph->clazz;
/* when called with a bitmap glyph, do nothing and return successfully */ /* when called with a bitmap glyph, do nothing and return successfully */

View File

@ -3054,7 +3054,12 @@
FT_CMap cmap = FT_CMAP( face->charmap ); FT_CMap cmap = FT_CMAP( face->charmap );
result = cmap->clazz->char_index( cmap, charcode ); if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
FT_TRACE1(( " 0x%x is truncated\n", charcode ));
}
result = cmap->clazz->char_index( cmap, (FT_UInt32)charcode );
} }
return result; return result;
} }
@ -3134,8 +3139,20 @@
FT_CMap vcmap = FT_CMAP( charmap ); FT_CMap vcmap = FT_CMAP( charmap );
result = vcmap->clazz->char_var_index( vcmap, ucmap, charcode, if ( charcode > 0xFFFFFFFFUL )
variantSelector ); {
FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
FT_TRACE1(( " 0x%x is truncated\n", charcode ));
}
if ( variantSelector > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
}
result = vcmap->clazz->char_var_index( vcmap, ucmap,
(FT_UInt32)charcode,
(FT_UInt32)variantSelector );
} }
} }
@ -3163,8 +3180,20 @@
FT_CMap vcmap = FT_CMAP( charmap ); FT_CMap vcmap = FT_CMAP( charmap );
result = vcmap->clazz->char_var_default( vcmap, charcode, if ( charcode > 0xFFFFFFFFUL )
variantSelector ); {
FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
FT_TRACE1(( " 0x%x is truncated\n", charcode ));
}
if ( variantSelector > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
}
result = vcmap->clazz->char_var_default( vcmap,
(FT_UInt32)charcode,
(FT_UInt32)variantSelector );
} }
} }
@ -3219,7 +3248,14 @@
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory = FT_FACE_MEMORY( face );
result = vcmap->clazz->charvariant_list( vcmap, memory, charcode ); if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large charcode" ));
FT_TRACE1(( " 0x%x is truncated\n", charcode ));
}
result = vcmap->clazz->charvariant_list( vcmap, memory,
(FT_UInt32)charcode );
} }
} }
return result; return result;
@ -3246,8 +3282,14 @@
FT_Memory memory = FT_FACE_MEMORY( face ); FT_Memory memory = FT_FACE_MEMORY( face );
if ( variantSelector > 0xFFFFFFFFUL )
{
FT_TRACE1(( "FT_Get_Char_Index: too large variantSelector" ));
FT_TRACE1(( " 0x%x is truncated\n", variantSelector ));
}
result = vcmap->clazz->variantchar_list( vcmap, memory, result = vcmap->clazz->variantchar_list( vcmap, memory,
variantSelector ); (FT_UInt32)variantSelector );
} }
} }
@ -3297,7 +3339,7 @@
((FT_Byte*)buffer)[0] = 0; ((FT_Byte*)buffer)[0] = 0;
if ( face && if ( face &&
glyph_index <= (FT_UInt)face->num_glyphs && (FT_Long)glyph_index <= face->num_glyphs &&
FT_HAS_GLYPH_NAMES( face ) ) FT_HAS_GLYPH_NAMES( face ) )
{ {
FT_Service_GlyphDict service; FT_Service_GlyphDict service;

View File

@ -103,6 +103,7 @@
} }
Exit: Exit:
FT_UNUSED( error );
FT_FRAME_EXIT(); FT_FRAME_EXIT();
return result; return result;
} }

View File

@ -752,9 +752,9 @@
const char *insertion ) const char *insertion )
{ {
char* new_name; char* new_name;
char* tmp; const char* tmp;
const char* slash; const char* slash;
unsigned new_length; size_t new_length;
FT_Error error = FT_Err_Ok; FT_Error error = FT_Err_Ok;
FT_UNUSED( error ); FT_UNUSED( error );

View File

@ -18,11 +18,21 @@
#include <ft2build.h> #include <ft2build.h>
#include FT_SYNTHESIS_H #include FT_SYNTHESIS_H
#include FT_INTERNAL_DEBUG_H
#include FT_INTERNAL_OBJECTS_H #include FT_INTERNAL_OBJECTS_H
#include FT_OUTLINE_H #include FT_OUTLINE_H
#include FT_BITMAP_H #include FT_BITMAP_H
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_synth
/*************************************************************************/ /*************************************************************************/
/*************************************************************************/ /*************************************************************************/
/**** ****/ /**** ****/
@ -106,6 +116,18 @@
xstr = 1 << 6; xstr = 1 << 6;
ystr &= ~63; ystr &= ~63;
/*
* XXX: overflow check for 16-bit system, for compatibility
* with FT_GlyphSlot_Embolden() since freetype-2.1.10.
* unfortunately, this function return no informations
* about the cause of error.
*/
if ( ( ystr >> 6 ) > FT_INT_MAX || ( ystr >> 6 ) < FT_INT_MIN )
{
FT_TRACE1(( "FT_GlyphSlot_Embolden:" ));
FT_TRACE1(( "too strong embolding parameter ystr=%d\n", ystr ));
return;
}
error = FT_GlyphSlot_Own_Bitmap( slot ); error = FT_GlyphSlot_Own_Bitmap( slot );
if ( error ) if ( error )
return; return;
@ -129,8 +151,9 @@
slot->metrics.vertBearingY += ystr; slot->metrics.vertBearingY += ystr;
slot->metrics.vertAdvance += ystr; slot->metrics.vertAdvance += ystr;
/* XXX: 16-bit overflow case must be excluded before here */
if ( slot->format == FT_GLYPH_FORMAT_BITMAP ) if ( slot->format == FT_GLYPH_FORMAT_BITMAP )
slot->bitmap_top += ystr >> 6; slot->bitmap_top += (FT_Int)( ystr >> 6 );
} }

View File

@ -72,10 +72,10 @@
val = ( val >= 0 ) ? val : -val; val = ( val >= 0 ) ? val : -val;
v1 = (FT_UInt32)val >> 16; v1 = (FT_UInt32)val >> 16;
v2 = (FT_UInt32)val & 0xFFFFL; v2 = (FT_UInt32)(val & 0xFFFFL);
k1 = FT_TRIG_SCALE >> 16; /* constant */ k1 = (FT_UInt32)FT_TRIG_SCALE >> 16; /* constant */
k2 = FT_TRIG_SCALE & 0xFFFFL; /* constant */ k2 = (FT_UInt32)(FT_TRIG_SCALE & 0xFFFFL); /* constant */
hi = k1 * v1; hi = k1 * v1;
lo1 = k1 * v2 + k2 * v1; /* can't overflow */ lo1 = k1 * v2 + k2 * v1; /* can't overflow */
@ -86,7 +86,7 @@
hi += lo1 >> 16; hi += lo1 >> 16;
if ( lo1 < lo3 ) if ( lo1 < lo3 )
hi += 0x10000UL; hi += (FT_UInt32)0x10000UL;
val = (FT_Fixed)hi; val = (FT_Fixed)hi;
@ -433,7 +433,7 @@
if ( shift > 0 ) if ( shift > 0 )
{ {
FT_Int32 half = 1L << ( shift - 1 ); FT_Int32 half = (FT_Int32)1L << ( shift - 1 );
vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift; vec->x = ( v.x + half + FT_SIGN_LONG( v.x ) ) >> shift;

View File

@ -114,8 +114,8 @@ FT_BEGIN_HEADER
union union
{ {
char* atom; char* atom;
long int32; long l;
unsigned long card32; unsigned long ul;
} value; /* Value of the property. */ } value; /* Value of the property. */

View File

@ -53,7 +53,7 @@ THE SOFTWARE.
typedef struct BDF_CMapRec_ typedef struct BDF_CMapRec_
{ {
FT_CMapRec cmap; FT_CMapRec cmap;
FT_UInt num_encodings; FT_ULong num_encodings; /* ftobjs.h: FT_CMap->clazz->size */
BDF_encoding_el* encodings; BDF_encoding_el* encodings;
} BDF_CMapRec, *BDF_CMap; } BDF_CMapRec, *BDF_CMap;
@ -92,8 +92,8 @@ THE SOFTWARE.
{ {
BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_CMap cmap = (BDF_CMap)bdfcmap;
BDF_encoding_el* encodings = cmap->encodings; BDF_encoding_el* encodings = cmap->encodings;
FT_UInt min, max, mid; FT_ULong min, max, mid; /* num_encodings */
FT_UInt result = 0; FT_UShort result = 0; /* encodings->glyph */
min = 0; min = 0;
@ -101,7 +101,7 @@ THE SOFTWARE.
while ( min < max ) while ( min < max )
{ {
FT_UInt32 code; FT_ULong code;
mid = ( min + max ) >> 1; mid = ( min + max ) >> 1;
@ -131,9 +131,9 @@ THE SOFTWARE.
{ {
BDF_CMap cmap = (BDF_CMap)bdfcmap; BDF_CMap cmap = (BDF_CMap)bdfcmap;
BDF_encoding_el* encodings = cmap->encodings; BDF_encoding_el* encodings = cmap->encodings;
FT_UInt min, max, mid; FT_ULong min, max, mid; /* num_encodings */
FT_UInt32 charcode = *acharcode + 1; FT_UShort result = 0; /* encodings->glyph */
FT_UInt result = 0; FT_ULong charcode = *acharcode + 1;
min = 0; min = 0;
@ -141,7 +141,7 @@ THE SOFTWARE.
while ( min < max ) while ( min < max )
{ {
FT_UInt32 code; FT_ULong code; /* same as BDF_encoding_el.enc */
mid = ( min + max ) >> 1; mid = ( min + max ) >> 1;
@ -169,7 +169,14 @@ THE SOFTWARE.
} }
Exit: Exit:
*acharcode = charcode; if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
*acharcode = 0;
/* XXX: result should be changed to indicate an overflow error */
}
else
*acharcode = (FT_UInt32)charcode;
return result; return result;
} }
@ -196,9 +203,8 @@ THE SOFTWARE.
bdf_font_t* font = bdf->bdffont; bdf_font_t* font = bdf->bdffont;
bdf_property_t* prop; bdf_property_t* prop;
int nn, len; char* strings[4] = { NULL, NULL, NULL, NULL };
char* strings[4] = { NULL, NULL, NULL, NULL }; size_t nn, len, lengths[4];
int lengths[4];
face->style_flags = 0; face->style_flags = 0;
@ -284,7 +290,7 @@ THE SOFTWARE.
/* add_style_name and setwidth_name */ /* add_style_name and setwidth_name */
if ( nn == 0 || nn == 3 ) if ( nn == 0 || nn == 3 )
{ {
int mm; size_t mm;
for ( mm = 0; mm < len; mm++ ) for ( mm = 0; mm < len; mm++ )
@ -426,7 +432,7 @@ THE SOFTWARE.
prop = bdf_get_font_property( font, "AVERAGE_WIDTH" ); prop = bdf_get_font_property( font, "AVERAGE_WIDTH" );
if ( prop ) if ( prop )
bsize->width = (FT_Short)( ( prop->value.int32 + 5 ) / 10 ); bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );
else else
bsize->width = (FT_Short)( bsize->height * 2/3 ); bsize->width = (FT_Short)( bsize->height * 2/3 );
@ -434,21 +440,21 @@ THE SOFTWARE.
if ( prop ) if ( prop )
/* convert from 722.7 decipoints to 72 points per inch */ /* convert from 722.7 decipoints to 72 points per inch */
bsize->size = bsize->size =
(FT_Pos)( ( prop->value.int32 * 64 * 7200 + 36135L ) / 72270L ); (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );
else else
bsize->size = bsize->width << 6; bsize->size = bsize->width << 6;
prop = bdf_get_font_property( font, "PIXEL_SIZE" ); prop = bdf_get_font_property( font, "PIXEL_SIZE" );
if ( prop ) if ( prop )
bsize->y_ppem = (FT_Short)prop->value.int32 << 6; bsize->y_ppem = (FT_Short)prop->value.l << 6;
prop = bdf_get_font_property( font, "RESOLUTION_X" ); prop = bdf_get_font_property( font, "RESOLUTION_X" );
if ( prop ) if ( prop )
resolution_x = (FT_Short)prop->value.int32; resolution_x = (FT_Short)prop->value.l;
prop = bdf_get_font_property( font, "RESOLUTION_Y" ); prop = bdf_get_font_property( font, "RESOLUTION_Y" );
if ( prop ) if ( prop )
resolution_y = (FT_Short)prop->value.int32; resolution_y = (FT_Short)prop->value.l;
if ( bsize->y_ppem == 0 ) if ( bsize->y_ppem == 0 )
{ {
@ -479,7 +485,12 @@ THE SOFTWARE.
(face->en_table[n]).glyph = (FT_Short)n; (face->en_table[n]).glyph = (FT_Short)n;
if ( cur[n].encoding == font->default_char ) if ( cur[n].encoding == font->default_char )
face->default_glyph = n; {
if ( n < FT_UINT_MAX )
face->default_glyph = (FT_UInt)n;
else
FT_TRACE1(( "idx %d is too large for this system\n", n ));
}
} }
} }
@ -671,7 +682,10 @@ THE SOFTWARE.
bitmap->rows = glyph.bbx.height; bitmap->rows = glyph.bbx.height;
bitmap->width = glyph.bbx.width; bitmap->width = glyph.bbx.width;
bitmap->pitch = glyph.bpr; if ( glyph.bpr > INT_MAX )
FT_TRACE1(( "BDF_Glyph_Load: too large pitch %d is truncated\n",
glyph.bpr ));
bitmap->pitch = (int)glyph.bpr; /* same as FT_Bitmap.pitch */
/* note: we don't allocate a new array to hold the bitmap; */ /* note: we don't allocate a new array to hold the bitmap; */
/* we can simply point to it */ /* we can simply point to it */
@ -743,13 +757,23 @@ THE SOFTWARE.
break; break;
case BDF_INTEGER: case BDF_INTEGER:
if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{
FT_TRACE1(( "bdf_get_bdf_property: " ));
FT_TRACE1(( "too large integer 0x%x is truncated\n" ));
}
aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
aproperty->u.integer = prop->value.int32; aproperty->u.integer = (FT_Int32)prop->value.l;
break; break;
case BDF_CARDINAL: case BDF_CARDINAL:
if ( prop->value.ul > 0xFFFFFFFFUL )
{
FT_TRACE1(( "bdf_get_bdf_property: " ));
FT_TRACE1(( "too large cardinal 0x%x is truncated\n" ));
}
aproperty->type = BDF_PROPERTY_TYPE_CARDINAL; aproperty->type = BDF_PROPERTY_TYPE_CARDINAL;
aproperty->u.cardinal = prop->value.card32; aproperty->u.cardinal = (FT_UInt32)prop->value.ul;
break; break;
default: default:

View File

@ -415,18 +415,18 @@
static FT_Error static FT_Error
_bdf_list_ensure( _bdf_list_t* list, _bdf_list_ensure( _bdf_list_t* list,
int num_items ) unsigned long num_items ) /* same as _bdf_list_t.used */
{ {
FT_Error error = BDF_Err_Ok; FT_Error error = BDF_Err_Ok;
if ( num_items > (int)list->size ) if ( num_items > list->size )
{ {
int oldsize = list->size; unsigned long oldsize = list->size; /* same as _bdf_list_t.size */
int newsize = oldsize + ( oldsize >> 1 ) + 4; unsigned long newsize = oldsize + ( oldsize >> 1 ) + 4;
int bigsize = FT_INT_MAX / sizeof ( char* ); unsigned long bigsize = (unsigned long)( FT_INT_MAX / sizeof ( char* ) );
FT_Memory memory = list->memory; FT_Memory memory = list->memory;
if ( oldsize == bigsize ) if ( oldsize == bigsize )
@ -614,8 +614,8 @@
{ {
_bdf_line_func_t cb; _bdf_line_func_t cb;
unsigned long lineno, buf_size; unsigned long lineno, buf_size;
int refill, bytes, hold, to_skip; int refill, hold, to_skip;
int start, end, cursor, avail; ptrdiff_t bytes, start, end, cursor, avail;
char* buf = 0; char* buf = 0;
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FT_Error error = BDF_Err_Ok; FT_Error error = BDF_Err_Ok;
@ -648,8 +648,8 @@
{ {
if ( refill ) if ( refill )
{ {
bytes = (int)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor, bytes = (ptrdiff_t)FT_Stream_TryRead( stream, (FT_Byte*)buf + cursor,
(FT_ULong)(buf_size - cursor) ); (FT_ULong)(buf_size - cursor) );
avail = cursor + bytes; avail = cursor + bytes;
cursor = 0; cursor = 0;
refill = 0; refill = 0;
@ -1289,11 +1289,11 @@
break; break;
case BDF_INTEGER: case BDF_INTEGER:
fp->value.int32 = _bdf_atol( value, 0, 10 ); fp->value.l = _bdf_atol( value, 0, 10 );
break; break;
case BDF_CARDINAL: case BDF_CARDINAL:
fp->value.card32 = _bdf_atoul( value, 0, 10 ); fp->value.ul = _bdf_atoul( value, 0, 10 );
break; break;
default: default:
@ -1359,11 +1359,11 @@
break; break;
case BDF_INTEGER: case BDF_INTEGER:
fp->value.int32 = _bdf_atol( value, 0, 10 ); fp->value.l = _bdf_atol( value, 0, 10 );
break; break;
case BDF_CARDINAL: case BDF_CARDINAL:
fp->value.card32 = _bdf_atoul( value, 0, 10 ); fp->value.ul = _bdf_atoul( value, 0, 10 );
break; break;
} }
@ -1387,11 +1387,11 @@
/* present, and the SPACING property should override the default */ /* present, and the SPACING property should override the default */
/* spacing. */ /* spacing. */
if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 ) if ( ft_memcmp( name, "DEFAULT_CHAR", 12 ) == 0 )
font->default_char = fp->value.int32; font->default_char = fp->value.l;
else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 ) else if ( ft_memcmp( name, "FONT_ASCENT", 11 ) == 0 )
font->font_ascent = fp->value.int32; font->font_ascent = fp->value.l;
else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 ) else if ( ft_memcmp( name, "FONT_DESCENT", 12 ) == 0 )
font->font_descent = fp->value.int32; font->font_descent = fp->value.l;
else if ( ft_memcmp( name, "SPACING", 7 ) == 0 ) else if ( ft_memcmp( name, "SPACING", 7 ) == 0 )
{ {
if ( !fp->value.atom ) if ( !fp->value.atom )

53
src/cache/ftcbasic.c vendored
View File

@ -25,6 +25,8 @@
#include "ftccback.h" #include "ftccback.h"
#include "ftcerror.h" #include "ftcerror.h"
#define FT_COMPONENT trace_cache
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #ifdef FT_CONFIG_OPTION_OLD_INTERNALS
@ -139,8 +141,15 @@
error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id, error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
&face ); &face );
if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
{
FT_TRACE1(( "ftc_basic_family_get_count: too large number of glyphs " ));
FT_TRACE1(( "in this face, truncated\n", face->num_glyphs ));
}
if ( !error ) if ( !error )
result = face->num_glyphs; result = (FT_UInt)face->num_glyphs;
return result; return result;
} }
@ -319,13 +328,13 @@
if ( anode ) if ( anode )
*anode = NULL; *anode = NULL;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )
/* /*
* This one is a major hack used to detect whether we are passed a * This one is a major hack used to detect whether we are passed a
* regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one. * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
*/ */
if ( type->width >= 0x10000 ) if ( (FT_ULong)type->width >= 0x10000L )
{ {
FTC_OldImageDesc desc = (FTC_OldImageDesc)type; FTC_OldImageDesc desc = (FTC_OldImageDesc)type;
@ -340,10 +349,16 @@
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
{ {
if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
{
FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));
}
query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width; query.attrs.scaler.width = type->width;
query.attrs.scaler.height = type->height; query.attrs.scaler.height = type->height;
query.attrs.load_flags = type->flags; query.attrs.load_flags = (FT_UInt)type->flags;
} }
query.attrs.scaler.pixel = 1; query.attrs.scaler.pixel = 1;
@ -409,8 +424,15 @@
if ( anode ) if ( anode )
*anode = NULL; *anode = NULL;
/* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
if ( load_flags > FT_UINT_MAX )
{
FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
}
query.attrs.scaler = scaler[0]; query.attrs.scaler = scaler[0];
query.attrs.load_flags = load_flags; query.attrs.load_flags = (FT_UInt)load_flags;
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex; hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex;
@ -642,12 +664,12 @@
*ansbit = NULL; *ansbit = NULL;
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS #if defined( FT_CONFIG_OPTION_OLD_INTERNALS ) && ( FT_INT_MAX > 0xFFFFU )
/* This one is a major hack used to detect whether we are passed a /* This one is a major hack used to detect whether we are passed a
* regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one. * regular FTC_ImageType handle, or a legacy FTC_OldImageDesc one.
*/ */
if ( type->width >= 0x10000 ) if ( (FT_ULong)type->width >= 0x10000L )
{ {
FTC_OldImageDesc desc = (FTC_OldImageDesc)type; FTC_OldImageDesc desc = (FTC_OldImageDesc)type;
@ -662,10 +684,16 @@
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
{ {
if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX )
{
FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" ));
FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) ));
}
query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.face_id = type->face_id;
query.attrs.scaler.width = type->width; query.attrs.scaler.width = type->width;
query.attrs.scaler.height = type->height; query.attrs.scaler.height = type->height;
query.attrs.load_flags = type->flags; query.attrs.load_flags = (FT_UInt)type->flags;
} }
query.attrs.scaler.pixel = 1; query.attrs.scaler.pixel = 1;
@ -732,8 +760,15 @@
*ansbit = NULL; *ansbit = NULL;
/* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */
if ( load_flags > FT_UINT_MAX )
{
FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" ));
FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) ));
}
query.attrs.scaler = scaler[0]; query.attrs.scaler = scaler[0];
query.attrs.load_flags = load_flags; query.attrs.load_flags = (FT_UInt)load_flags;
/* beware, the hash must be the same for all glyph ranges! */ /* beware, the hash must be the same for all glyph ranges! */
hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +

10
src/cache/ftccache.c vendored
View File

@ -93,9 +93,9 @@
for (;;) for (;;)
{ {
FTC_Node node, *pnode; FTC_Node node, *pnode;
FT_UInt p = cache->p; FT_UFast p = cache->p;
FT_UInt mask = cache->mask; FT_UFast mask = cache->mask;
FT_UInt count = mask + p + 1; /* number of buckets */ FT_UFast count = mask + p + 1; /* number of buckets */
/* do we need to shrink the buckets array? */ /* do we need to shrink the buckets array? */
@ -153,7 +153,7 @@
/* do we need to expand the buckets array? */ /* do we need to expand the buckets array? */
else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD ) else if ( cache->slack > (FT_Long)count * FTC_HASH_SUB_LOAD )
{ {
FT_UInt old_index = p + mask; FT_UFast old_index = p + mask;
FTC_Node* pold; FTC_Node* pold;
@ -347,7 +347,7 @@
{ {
FTC_Manager manager = cache->manager; FTC_Manager manager = cache->manager;
FT_UFast i; FT_UFast i;
FT_UInt count; FT_UFast count;
count = cache->p + cache->mask + 1; count = cache->p + cache->mask + 1;

View File

@ -91,7 +91,7 @@ FT_BEGIN_HEADER
FT_Pointer query, FT_Pointer query,
FTC_Cache cache ); FTC_Cache cache );
typedef FT_ULong typedef FT_Offset
(*FTC_Node_WeightFunc)( FTC_Node node, (*FTC_Node_WeightFunc)( FTC_Node node,
FTC_Cache cache ); FTC_Cache cache );
@ -121,7 +121,7 @@ FT_BEGIN_HEADER
FTC_Node_CompareFunc node_remove_faceid; FTC_Node_CompareFunc node_remove_faceid;
FTC_Node_FreeFunc node_free; FTC_Node_FreeFunc node_free;
FT_UInt cache_size; FT_Offset cache_size;
FTC_Cache_InitFunc cache_init; FTC_Cache_InitFunc cache_init;
FTC_Cache_DoneFunc cache_done; FTC_Cache_DoneFunc cache_done;
@ -202,7 +202,7 @@ FT_BEGIN_HEADER
FTC_Cache _cache = FTC_CACHE(cache); \ FTC_Cache _cache = FTC_CACHE(cache); \
FT_UInt32 _hash = (FT_UInt32)(hash); \ FT_UInt32 _hash = (FT_UInt32)(hash); \
FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \ FTC_Node_CompareFunc _nodcomp = (FTC_Node_CompareFunc)(nodecmp); \
FT_UInt _idx; \ FT_UFast _idx; \
\ \
\ \
error = 0; \ error = 0; \

View File

@ -36,7 +36,7 @@
FT_Pointer gquery, FT_Pointer gquery,
FTC_Cache cache ); FTC_Cache cache );
FT_LOCAL( FT_ULong ) FT_LOCAL( FT_Offset )
ftc_inode_weight( FTC_Node inode, ftc_inode_weight( FTC_Node inode,
FTC_Cache cache ); FTC_Cache cache );
@ -50,7 +50,7 @@
FT_Pointer gquery, FT_Pointer gquery,
FTC_Cache cache ); FTC_Cache cache );
FT_LOCAL( FT_ULong ) FT_LOCAL( FT_Offset )
ftc_snode_weight( FTC_Node snode, ftc_snode_weight( FTC_Node snode,
FTC_Cache cache ); FTC_Cache cache );

2
src/cache/ftccmap.c vendored
View File

@ -174,7 +174,7 @@
/* compute the weight of a given cmap node */ /* compute the weight of a given cmap node */
FT_CALLBACK_DEF( FT_ULong ) FT_CALLBACK_DEF( FT_Offset )
ftc_cmap_node_weight( FTC_Node cnode, ftc_cmap_node_weight( FTC_Node cnode,
FTC_Cache cache ) FTC_Cache cache )
{ {

View File

@ -103,12 +103,12 @@
} }
FT_LOCAL_DEF( FT_ULong ) FT_LOCAL_DEF( FT_Offset )
ftc_inode_weight( FTC_Node ftcinode, ftc_inode_weight( FTC_Node ftcinode,
FTC_Cache ftccache ) FTC_Cache ftccache )
{ {
FTC_INode inode = (FTC_INode)ftcinode; FTC_INode inode = (FTC_INode)ftcinode;
FT_ULong size = 0; FT_Offset size = 0;
FT_Glyph glyph = inode->glyph; FT_Glyph glyph = inode->glyph;
FT_UNUSED( ftccache ); FT_UNUSED( ftccache );
@ -151,7 +151,7 @@
#if 0 #if 0
FT_LOCAL_DEF( FT_ULong ) FT_LOCAL_DEF( FT_Offset )
FTC_INode_Weight( FTC_INode inode ) FTC_INode_Weight( FTC_INode inode )
{ {
return ftc_inode_weight( FTC_NODE( inode ), NULL ); return ftc_inode_weight( FTC_NODE( inode ), NULL );

View File

@ -665,7 +665,9 @@
/* this will remove all FTC_SizeNode that correspond to /* this will remove all FTC_SizeNode that correspond to
* the face_id as well * the face_id as well
*/ */
FTC_MruList_RemoveSelection( &manager->faces, NULL, face_id ); FTC_MruList_RemoveSelection( &manager->faces,
(FTC_MruNode_CompareFunc)NULL,
face_id );
for ( nn = 0; nn < manager->num_caches; nn++ ) for ( nn = 0; nn < manager->num_caches; nn++ )
FTC_Cache_RemoveFaceID( manager->caches[nn], face_id ); FTC_Cache_RemoveFaceID( manager->caches[nn], face_id );

2
src/cache/ftcmru.h vendored
View File

@ -107,7 +107,7 @@ FT_BEGIN_HEADER
typedef struct FTC_MruListClassRec_ typedef struct FTC_MruListClassRec_
{ {
FT_UInt node_size; FT_Offset node_size;
FTC_MruNode_CompareFunc node_compare; FTC_MruNode_CompareFunc node_compare;
FTC_MruNode_InitFunc node_init; FTC_MruNode_InitFunc node_init;
FTC_MruNode_ResetFunc node_reset; FTC_MruNode_ResetFunc node_reset;

View File

@ -129,7 +129,7 @@
FT_Int temp; FT_Int temp;
FT_GlyphSlot slot = face->glyph; FT_GlyphSlot slot = face->glyph;
FT_Bitmap* bitmap = &slot->bitmap; FT_Bitmap* bitmap = &slot->bitmap;
FT_Int xadvance, yadvance; FT_Pos xadvance, yadvance; /* FT_GlyphSlot->advance.{x|y} */
if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) if ( slot->format != FT_GLYPH_FORMAT_BITMAP )
@ -263,7 +263,7 @@
} }
FT_LOCAL_DEF( FT_ULong ) FT_LOCAL_DEF( FT_Offset )
ftc_snode_weight( FTC_Node ftcsnode, ftc_snode_weight( FTC_Node ftcsnode,
FTC_Cache cache ) FTC_Cache cache )
{ {
@ -271,7 +271,7 @@
FT_UInt count = snode->count; FT_UInt count = snode->count;
FTC_SBit sbit = snode->sbits; FTC_SBit sbit = snode->sbits;
FT_Int pitch; FT_Int pitch;
FT_ULong size; FT_Offset size;
FT_UNUSED( cache ); FT_UNUSED( cache );
@ -300,7 +300,7 @@
#if 0 #if 0
FT_LOCAL_DEF( FT_ULong ) FT_LOCAL_DEF( FT_Offset )
FTC_SNode_Weight( FTC_SNode snode ) FTC_SNode_Weight( FTC_SNode snode )
{ {
return ftc_snode_weight( FTC_NODE( snode ), NULL ); return ftc_snode_weight( FTC_NODE( snode ), NULL );

View File

@ -65,7 +65,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
cff_cmap_encoding_char_next( CFF_CMapStd cmap, cff_cmap_encoding_char_next( CFF_CMapStd cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -192,7 +192,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
cff_cmap_unicode_char_next( PS_Unicodes unicodes, cff_cmap_unicode_char_next( PS_Unicodes unicodes,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {

View File

@ -200,7 +200,7 @@
FT_GlyphSlot slot = face->glyph; FT_GlyphSlot slot = face->glyph;
flags |= FT_LOAD_ADVANCE_ONLY; flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
for ( nn = 0; nn < count; nn++ ) for ( nn = 0; nn < count; nn++ )
{ {
@ -495,8 +495,19 @@
*ordering = cff->ordering; *ordering = cff->ordering;
} }
/*
* XXX: According to Adobe TechNote #5176, the supplement in CFF
* can be a real number. We truncate it to fit public API
* since freetype-2.3.6.
*/
if ( supplement ) if ( supplement )
*supplement = dict->cid_supplement; {
if ( dict->cid_supplement < FT_INT_MIN ||
dict->cid_supplement > FT_INT_MAX )
FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
dict->cid_supplement ));
*supplement = (FT_Int)dict->cid_supplement;
}
} }
Fail: Fail:

View File

@ -935,18 +935,18 @@
ip += 2; ip += 2;
} }
else if ( v < 247 ) else if ( v < 247 )
val = (FT_Long)v - 139; val = (FT_Int32)v - 139;
else if ( v < 251 ) else if ( v < 251 )
{ {
if ( ip >= limit ) if ( ip >= limit )
goto Syntax_Error; goto Syntax_Error;
val = ( (FT_Long)v - 247 ) * 256 + *ip++ + 108; val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
} }
else if ( v < 255 ) else if ( v < 255 )
{ {
if ( ip >= limit ) if ( ip >= limit )
goto Syntax_Error; goto Syntax_Error;
val = -( (FT_Long)v - 251 ) * 256 - *ip++ - 108; val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
} }
else else
{ {
@ -2580,8 +2580,8 @@
FT_Byte fd_index = cff_fd_select_get( &cff->fd_select, FT_Byte fd_index = cff_fd_select_get( &cff->fd_select,
glyph_index ); glyph_index );
FT_Int top_upm = cff->top_font.font_dict.units_per_em; FT_ULong top_upm = cff->top_font.font_dict.units_per_em;
FT_Int sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em; FT_ULong sub_upm = cff->subfonts[fd_index]->font_dict.units_per_em;
font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix; font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;

View File

@ -847,7 +847,7 @@
/* this constant is given in the CFF specification */ /* this constant is given in the CFF specification */
if ( sid < 65000 ) if ( sid < 65000L )
charset->sids[j] = sid; charset->sids[j] = sid;
else else
{ {
@ -890,16 +890,16 @@
/* check whether the range contains at least one valid glyph; */ /* check whether the range contains at least one valid glyph; */
/* the constant is given in the CFF specification */ /* the constant is given in the CFF specification */
if ( glyph_sid >= 65000 ) { if ( glyph_sid >= 65000L ) {
FT_ERROR(( "cff_charset_load: invalid SID range\n" )); FT_ERROR(( "cff_charset_load: invalid SID range\n" ));
error = CFF_Err_Invalid_File_Format; error = CFF_Err_Invalid_File_Format;
goto Exit; goto Exit;
} }
/* try to rescue some of the SIDs if `nleft' is too large */ /* try to rescue some of the SIDs if `nleft' is too large */
if ( nleft > 65000 - 1 || glyph_sid >= 65000 - nleft ) { if ( nleft > 65000L - 1L || glyph_sid >= 65000L - nleft ) {
FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" )); FT_ERROR(( "cff_charset_load: invalid SID range trimmed\n" ));
nleft = 65000 - 1 - glyph_sid; nleft = ( FT_UInt )( 65000L - 1L - glyph_sid );
} }
/* Fill in the range of sids -- `nleft + 1' glyphs. */ /* Fill in the range of sids -- `nleft + 1' glyphs. */

View File

@ -224,8 +224,8 @@
CFF_Font font = (CFF_Font)face->extra.data; CFF_Font font = (CFF_Font)face->extra.data;
CFF_Internal internal = (CFF_Internal)size->internal; CFF_Internal internal = (CFF_Internal)size->internal;
FT_Int top_upm = font->top_font.font_dict.units_per_em; FT_ULong top_upm = font->top_font.font_dict.units_per_em;
FT_UInt i; FT_UInt i;
funcs->set_scale( internal->topfont, funcs->set_scale( internal->topfont,
@ -235,7 +235,7 @@
for ( i = font->num_subfonts; i > 0; i-- ) for ( i = font->num_subfonts; i > 0; i-- )
{ {
CFF_SubFont sub = font->subfonts[i - 1]; CFF_SubFont sub = font->subfonts[i - 1];
FT_Int sub_upm = sub->font_dict.units_per_em; FT_ULong sub_upm = sub->font_dict.units_per_em;
FT_Pos x_scale, y_scale; FT_Pos x_scale, y_scale;
@ -296,8 +296,8 @@
CFF_Font font = (CFF_Font)cffface->extra.data; CFF_Font font = (CFF_Font)cffface->extra.data;
CFF_Internal internal = (CFF_Internal)size->internal; CFF_Internal internal = (CFF_Internal)size->internal;
FT_Int top_upm = font->top_font.font_dict.units_per_em; FT_ULong top_upm = font->top_font.font_dict.units_per_em;
FT_UInt i; FT_UInt i;
funcs->set_scale( internal->topfont, funcs->set_scale( internal->topfont,
@ -307,7 +307,7 @@
for ( i = font->num_subfonts; i > 0; i-- ) for ( i = font->num_subfonts; i > 0; i-- )
{ {
CFF_SubFont sub = font->subfonts[i - 1]; CFF_SubFont sub = font->subfonts[i - 1];
FT_Int sub_upm = sub->font_dict.units_per_em; FT_ULong sub_upm = sub->font_dict.units_per_em;
FT_Pos x_scale, y_scale; FT_Pos x_scale, y_scale;
@ -584,7 +584,7 @@
if ( sub->units_per_em ) if ( sub->units_per_em )
{ {
FT_Int scaling; FT_Long scaling;
if ( top->units_per_em > 1 && sub->units_per_em > 1 ) if ( top->units_per_em > 1 && sub->units_per_em > 1 )
@ -766,22 +766,22 @@
/* */ /* */
/* Compute face flags. */ /* Compute face flags. */
/* */ /* */
flags = FT_FACE_FLAG_SCALABLE | /* scalable outlines */ flags = (FT_UInt32)( FT_FACE_FLAG_SCALABLE | /* scalable outlines */
FT_FACE_FLAG_HORIZONTAL | /* horizontal data */ FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
FT_FACE_FLAG_HINTER; /* has native hinter */ FT_FACE_FLAG_HINTER ); /* has native hinter */
if ( sfnt_format ) if ( sfnt_format )
flags |= FT_FACE_FLAG_SFNT; flags |= (FT_UInt32)FT_FACE_FLAG_SFNT;
/* fixed width font? */ /* fixed width font? */
if ( dict->is_fixed_pitch ) if ( dict->is_fixed_pitch )
flags |= FT_FACE_FLAG_FIXED_WIDTH; flags |= (FT_UInt32)FT_FACE_FLAG_FIXED_WIDTH;
/* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */ /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
#if 0 #if 0
/* kerning available? */ /* kerning available? */
if ( face->kern_pairs ) if ( face->kern_pairs )
flags |= FT_FACE_FLAG_KERNING; flags |= (FT_UInt32)FT_FACE_FLAG_KERNING;
#endif #endif
cffface->face_flags = flags; cffface->face_flags = flags;

View File

@ -130,8 +130,8 @@
static FT_Fixed static FT_Fixed
cff_parse_real( FT_Byte* start, cff_parse_real( FT_Byte* start,
FT_Byte* limit, FT_Byte* limit,
FT_Int power_ten, FT_Long power_ten,
FT_Int* scaling ) FT_Long* scaling )
{ {
FT_Byte* p = start; FT_Byte* p = start;
FT_UInt nib; FT_UInt nib;
@ -139,7 +139,7 @@
FT_Long result, number, rest, exponent; FT_Long result, number, rest, exponent;
FT_Int sign = 0, exponent_sign = 0; FT_Int sign = 0, exponent_sign = 0;
FT_Int exponent_add, integer_length, fraction_length; FT_Long exponent_add, integer_length, fraction_length;
if ( scaling ) if ( scaling )
@ -155,6 +155,8 @@
integer_length = 0; integer_length = 0;
fraction_length = 0; fraction_length = 0;
FT_UNUSED( rest );
/* First of all, read the integer part. */ /* First of all, read the integer part. */
phase = 4; phase = 4;
@ -284,7 +286,7 @@
{ {
if ( exponent > 0 ) if ( exponent > 0 )
{ {
FT_Int new_fraction_length, shift; FT_Long new_fraction_length, shift;
/* Make `scaling' as small as possible. */ /* Make `scaling' as small as possible. */
@ -384,7 +386,7 @@
/* but return `10^scaling' times the number read in */ /* but return `10^scaling' times the number read in */
static FT_Fixed static FT_Fixed
cff_parse_fixed_scaled( FT_Byte** d, cff_parse_fixed_scaled( FT_Byte** d,
FT_Int scaling ) FT_Long scaling )
{ {
return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL ) return **d == 30 ? cff_parse_real( d[0], d[1], scaling, NULL )
: ( cff_parse_integer( d[0], d[1] ) * : ( cff_parse_integer( d[0], d[1] ) *
@ -397,7 +399,7 @@
/* the scaling factor (as a power of 10) */ /* the scaling factor (as a power of 10) */
static FT_Fixed static FT_Fixed
cff_parse_fixed_dynamic( FT_Byte** d, cff_parse_fixed_dynamic( FT_Byte** d,
FT_Int* scaling ) FT_Long* scaling )
{ {
FT_ASSERT( scaling ); FT_ASSERT( scaling );
@ -450,7 +452,7 @@
if ( parser->top >= parser->stack + 6 ) if ( parser->top >= parser->stack + 6 )
{ {
FT_Int scaling; FT_Long scaling;
error = CFF_Err_Ok; error = CFF_Err_Ok;
@ -552,7 +554,12 @@
{ {
dict->cid_registry = (FT_UInt)cff_parse_num ( data++ ); dict->cid_registry = (FT_UInt)cff_parse_num ( data++ );
dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ ); dict->cid_ordering = (FT_UInt)cff_parse_num ( data++ );
dict->cid_supplement = (FT_ULong)cff_parse_num( data ); if ( **data == 30 )
FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
dict->cid_supplement = cff_parse_num( data );
if ( dict->cid_supplement < 0 )
FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
dict->cid_supplement ));
error = CFF_Err_Ok; error = CFF_Err_Ok;
} }

View File

@ -130,7 +130,7 @@ FT_BEGIN_HEADER
/* these should only be used for the top-level font dictionary */ /* these should only be used for the top-level font dictionary */
FT_UInt cid_registry; FT_UInt cid_registry;
FT_UInt cid_ordering; FT_UInt cid_ordering;
FT_ULong cid_supplement; FT_Long cid_supplement;
FT_Long cid_font_version; FT_Long cid_font_version;
FT_Long cid_font_revision; FT_Long cid_font_revision;

View File

@ -86,13 +86,13 @@
/* `StartData' or `/sfnts' */ /* `StartData' or `/sfnts' */
{ {
FT_Byte buffer[256 + 10]; FT_Byte buffer[256 + 10];
FT_Int read_len = 256 + 10; FT_Long read_len = 256 + 10; /* same as signed FT_Stream->size */
FT_Byte* p = buffer; FT_Byte* p = buffer;
for ( offset = (FT_ULong)FT_STREAM_POS(); ; offset += 256 ) for ( offset = FT_STREAM_POS(); ; offset += 256 )
{ {
FT_Int stream_len; FT_Long stream_len; /* same as signed FT_Stream->size */
stream_len = stream->size - FT_STREAM_POS(); stream_len = stream->size - FT_STREAM_POS();

View File

@ -71,10 +71,10 @@
static void static void
gxv_bsln_LookupValue_validate( FT_UShort glyph, gxv_bsln_LookupValue_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UShort v = value.u; FT_UShort v = value_p->u;
FT_UShort* ctlPoints; FT_UShort* ctlPoints;
FT_UNUSED( glyph ); FT_UNUSED( glyph );
@ -122,7 +122,7 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_bsln_LookupFmt4_transit( FT_UShort relative_gindex, gxv_bsln_LookupFmt4_transit( FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -132,7 +132,7 @@
GXV_LookupValueDesc value; GXV_LookupValueDesc value;
/* XXX: check range ? */ /* XXX: check range ? */
offset = (FT_UShort)( base_value.u + offset = (FT_UShort)( base_value_p->u +
( relative_gindex * sizeof ( FT_UShort ) ) ); ( relative_gindex * sizeof ( FT_UShort ) ) );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;

View File

@ -448,7 +448,7 @@
} }
value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign ); value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
valid->lookupval_func( i, value, valid ); valid->lookupval_func( i, &value, valid );
} }
valid->subtable_length = p - table; valid->subtable_length = p - table;
@ -553,7 +553,7 @@
} }
for ( gid = firstGlyph; gid <= lastGlyph; gid++ ) for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
valid->lookupval_func( gid, value, valid ); valid->lookupval_func( gid, &value, valid );
} }
gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid ); gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );
@ -631,11 +631,11 @@
for ( gid = firstGlyph; gid <= lastGlyph; gid++ ) for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
{ {
value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ), value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ),
base_value, &base_value,
limit, limit,
valid ); valid );
valid->lookupval_func( gid, value, valid ); valid->lookupval_func( gid, &value, valid );
} }
} }
@ -710,7 +710,7 @@
} }
prev_glyph = glyph; prev_glyph = glyph;
valid->lookupval_func( glyph, value, valid ); valid->lookupval_func( glyph, &value, valid );
} }
gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid ); gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid );
@ -750,7 +750,7 @@
{ {
GXV_LIMIT_CHECK( 2 ); GXV_LIMIT_CHECK( 2 );
value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign ); value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
valid->lookupval_func( (FT_UShort)( firstGlyph + i ), value, valid ); valid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, valid );
} }
valid->subtable_length = p - table; valid->subtable_length = p - table;
@ -1181,7 +1181,7 @@
if ( NULL != valid->statetable.entry_validate_func ) if ( NULL != valid->statetable.entry_validate_func )
valid->statetable.entry_validate_func( state, valid->statetable.entry_validate_func( state,
flags, flags,
glyphOffset, &glyphOffset,
statetable_table, statetable_table,
statetable_limit, statetable_limit,
valid ); valid );
@ -1352,15 +1352,15 @@
static void static void
gxv_XClassTable_lookupval_validate( FT_UShort glyph, gxv_XClassTable_lookupval_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UNUSED( glyph ); FT_UNUSED( glyph );
if ( value.u >= valid->xstatetable.nClasses ) if ( value_p->u >= valid->xstatetable.nClasses )
FT_INVALID_DATA; FT_INVALID_DATA;
if ( value.u > valid->xstatetable.maxClassID ) if ( value_p->u > valid->xstatetable.maxClassID )
valid->xstatetable.maxClassID = value.u; valid->xstatetable.maxClassID = value_p->u;
} }
@ -1392,7 +1392,7 @@
*/ */
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_XClassTable_lookupfmt4_transit( FT_UShort relative_gindex, gxv_XClassTable_lookupfmt4_transit( FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -1402,7 +1402,7 @@
GXV_LookupValueDesc value; GXV_LookupValueDesc value;
/* XXX: check range? */ /* XXX: check range? */
offset = (FT_UShort)( base_value.u + offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof ( FT_UShort ) ); relative_gindex * sizeof ( FT_UShort ) );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;
@ -1556,7 +1556,7 @@
if ( NULL != valid->xstatetable.entry_validate_func ) if ( NULL != valid->xstatetable.entry_validate_func )
valid->xstatetable.entry_validate_func( state, valid->xstatetable.entry_validate_func( state,
flags, flags,
glyphOffset, &glyphOffset,
xstatetable_table, xstatetable_table,
xstatetable_limit, xstatetable_limit,
valid ); valid );

View File

@ -79,6 +79,8 @@ FT_BEGIN_HEADER
} GXV_LookupValueDesc; } GXV_LookupValueDesc;
typedef const GXV_LookupValueDesc* GXV_LookupValueCPtr;
typedef enum GXV_LookupValue_SignSpec_ typedef enum GXV_LookupValue_SignSpec_
{ {
GXV_LOOKUPVALUE_UNSIGNED = 0, GXV_LOOKUPVALUE_UNSIGNED = 0,
@ -89,12 +91,12 @@ FT_BEGIN_HEADER
typedef void typedef void
(*GXV_Lookup_Value_Validate_Func)( FT_UShort glyph, (*GXV_Lookup_Value_Validate_Func)( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ); GXV_Validator valid );
typedef GXV_LookupValueDesc typedef GXV_LookupValueDesc
(*GXV_Lookup_Fmt4_Transit_Func)( FT_UShort relative_gindex, (*GXV_Lookup_Fmt4_Transit_Func)( FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ); GXV_Validator valid );
@ -134,6 +136,7 @@ FT_BEGIN_HEADER
} GXV_StateTable_GlyphOffsetDesc; } GXV_StateTable_GlyphOffsetDesc;
typedef const GXV_StateTable_GlyphOffsetDesc* GXV_StateTable_GlyphOffsetCPtr;
typedef void typedef void
(*GXV_StateTable_Subtable_Setup_Func)( FT_UShort table_size, (*GXV_StateTable_Subtable_Setup_Func)( FT_UShort table_size,
@ -149,7 +152,7 @@ FT_BEGIN_HEADER
(*GXV_StateTable_Entry_Validate_Func)( (*GXV_StateTable_Entry_Validate_Func)(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes statetable_table, FT_Bytes statetable_table,
FT_Bytes statetable_limit, FT_Bytes statetable_limit,
GXV_Validator valid ); GXV_Validator valid );
@ -175,6 +178,8 @@ FT_BEGIN_HEADER
typedef GXV_StateTable_GlyphOffsetDesc GXV_XStateTable_GlyphOffsetDesc; typedef GXV_StateTable_GlyphOffsetDesc GXV_XStateTable_GlyphOffsetDesc;
typedef const GXV_XStateTable_GlyphOffsetDesc* GXV_XStateTable_GlyphOffsetCPtr;
typedef void typedef void
(*GXV_XStateTable_Subtable_Setup_Func)( FT_ULong table_size, (*GXV_XStateTable_Subtable_Setup_Func)( FT_ULong table_size,
FT_ULong classTable, FT_ULong classTable,
@ -189,7 +194,7 @@ FT_BEGIN_HEADER
(*GXV_XStateTable_Entry_Validate_Func)( (*GXV_XStateTable_Entry_Validate_Func)(
FT_UShort state, FT_UShort state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes xstatetable_table, FT_Bytes xstatetable_table,
FT_Bytes xstatetable_limit, FT_Bytes xstatetable_limit,
GXV_Validator valid ); GXV_Validator valid );

View File

@ -199,7 +199,7 @@
FT_UShort feature; FT_UShort feature;
FT_UShort nSettings; FT_UShort nSettings;
FT_UInt settingTable; FT_ULong settingTable;
FT_UShort featureFlags; FT_UShort featureFlags;
FT_Bool exclusive; FT_Bool exclusive;

View File

@ -323,15 +323,15 @@
static void static void
gxv_just_pcTable_LookupValue_entry_validate( FT_UShort glyph, gxv_just_pcTable_LookupValue_entry_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UNUSED( glyph ); FT_UNUSED( glyph );
if ( value.u > GXV_JUST_DATA( pc_offset_max ) ) if ( value_p->u > GXV_JUST_DATA( pc_offset_max ) )
GXV_JUST_DATA( pc_offset_max ) = value.u; GXV_JUST_DATA( pc_offset_max ) = value_p->u;
if ( value.u < GXV_JUST_DATA( pc_offset_max ) ) if ( value_p->u < GXV_JUST_DATA( pc_offset_max ) )
GXV_JUST_DATA( pc_offset_min ) = value.u; GXV_JUST_DATA( pc_offset_min ) = value_p->u;
} }
@ -384,7 +384,7 @@
gxv_just_classTable_entry_validate( gxv_just_classTable_entry_validate(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -395,7 +395,7 @@
FT_UShort currentClass; FT_UShort currentClass;
FT_UNUSED( state ); FT_UNUSED( state );
FT_UNUSED( glyphOffset ); FT_UNUSED( glyphOffset_p );
FT_UNUSED( table ); FT_UNUSED( table );
FT_UNUSED( limit ); FT_UNUSED( limit );
FT_UNUSED( valid ); FT_UNUSED( valid );
@ -449,15 +449,15 @@
static void static void
gxv_just_wdcTable_LookupValue_validate( FT_UShort glyph, gxv_just_wdcTable_LookupValue_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UNUSED( glyph ); FT_UNUSED( glyph );
if ( value.u > GXV_JUST_DATA( wdc_offset_max ) ) if ( value_p->u > GXV_JUST_DATA( wdc_offset_max ) )
GXV_JUST_DATA( wdc_offset_max ) = value.u; GXV_JUST_DATA( wdc_offset_max ) = value_p->u;
if ( value.u < GXV_JUST_DATA( wdc_offset_min ) ) if ( value_p->u < GXV_JUST_DATA( wdc_offset_min ) )
GXV_JUST_DATA( wdc_offset_min ) = value.u; GXV_JUST_DATA( wdc_offset_min ) = value_p->u;
} }
@ -557,7 +557,7 @@
{ {
FT_Bytes p = table; FT_Bytes p = table;
FT_Bytes limit = 0; FT_Bytes limit = 0;
FT_UInt table_size; FT_Offset table_size;
GXV_ValidatorRec validrec; GXV_ValidatorRec validrec;
GXV_Validator valid = &validrec; GXV_Validator valid = &validrec;

View File

@ -256,7 +256,7 @@
gxv_kern_subtable_fmt1_entry_validate( gxv_kern_subtable_fmt1_entry_validate(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -268,7 +268,7 @@
FT_UShort kernValue; FT_UShort kernValue;
FT_UNUSED( state ); FT_UNUSED( state );
FT_UNUSED( glyphOffset ); FT_UNUSED( glyphOffset_p );
push = (FT_UShort)( ( flags >> 15 ) & 1 ); push = (FT_UShort)( ( flags >> 15 ) & 1 );

View File

@ -83,10 +83,10 @@
static void static void
gxv_lcar_LookupValue_validate( FT_UShort glyph, gxv_lcar_LookupValue_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = valid->root->base + value.u; FT_Bytes p = valid->root->base + value_p->u;
FT_Bytes limit = valid->root->limit; FT_Bytes limit = valid->root->limit;
FT_UShort count; FT_UShort count;
FT_Short partial; FT_Short partial;
@ -146,7 +146,7 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_lcar_LookupFmt4_transit( FT_UShort relative_gindex, gxv_lcar_LookupFmt4_transit( FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -158,7 +158,7 @@
FT_UNUSED( lookuptbl_limit ); FT_UNUSED( lookuptbl_limit );
/* XXX: check range? */ /* XXX: check range? */
offset = (FT_UShort)( base_value.u + offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof ( FT_UShort ) ); relative_gindex * sizeof ( FT_UShort ) );
p = valid->root->base + offset; p = valid->root->base + offset;
limit = valid->root->limit; limit = valid->root->limit;

View File

@ -85,17 +85,17 @@
/* /*
* nFeatureFlags is typed to FT_UInt to accept that in * nFeatureFlags is typed to FT_ULong to accept that in
* mort (typed FT_UShort) and morx (typed FT_ULong). * mort (typed FT_UShort) and morx (typed FT_ULong).
*/ */
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
gxv_mort_featurearray_validate( FT_Bytes table, gxv_mort_featurearray_validate( FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
FT_UInt nFeatureFlags, FT_ULong nFeatureFlags,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_Bytes p = table; FT_Bytes p = table;
FT_UInt i; FT_ULong i;
GXV_mort_featureRec f = GXV_MORT_FEATURE_OFF; GXV_mort_featureRec f = GXV_MORT_FEATURE_OFF;

View File

@ -54,7 +54,7 @@
FT_LOCAL( void ) FT_LOCAL( void )
gxv_mort_featurearray_validate( FT_Bytes table, gxv_mort_featurearray_validate( FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
FT_UInt nFeatureFlags, FT_ULong nFeatureFlags,
GXV_Validator valid ); GXV_Validator valid );
FT_LOCAL( void ) FT_LOCAL( void )

View File

@ -64,7 +64,7 @@
gxv_mort_subtable_type0_entry_validate( gxv_mort_subtable_type0_entry_validate(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -80,7 +80,7 @@
FT_UNUSED( limit ); FT_UNUSED( limit );
FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */ FT_UNUSED( GXV_Mort_IndicScript_Msg[verb] ); /* for the non-debugging */
FT_UNUSED( glyphOffset ); /* case */ FT_UNUSED( glyphOffset_p ); /* case */
markFirst = (FT_UShort)( ( flags >> 15 ) & 1 ); markFirst = (FT_UShort)( ( flags >> 15 ) & 1 );
@ -91,7 +91,7 @@
verb = (FT_UShort)( flags & 0x000F ); verb = (FT_UShort)( flags & 0x000F );
GXV_TRACE(( " IndicScript MorphRule for glyphOffset 0x%04x", GXV_TRACE(( " IndicScript MorphRule for glyphOffset 0x%04x",
glyphOffset.u )); glyphOffset_p->u ));
GXV_TRACE(( " markFirst=%01d", markFirst )); GXV_TRACE(( " markFirst=%01d", markFirst ));
GXV_TRACE(( " dontAdvance=%01d", dontAdvance )); GXV_TRACE(( " dontAdvance=%01d", dontAdvance ));
GXV_TRACE(( " markLast=%01d", markLast )); GXV_TRACE(( " markLast=%01d", markLast ));

View File

@ -135,7 +135,7 @@
gxv_mort_subtable_type1_entry_validate( gxv_mort_subtable_type1_entry_validate(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -154,8 +154,8 @@
dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
reserved = (FT_Short)( flags & 0x3FFF ); reserved = (FT_Short)( flags & 0x3FFF );
markOffset = (FT_Short)( glyphOffset.ul >> 16 ); markOffset = (FT_Short)( glyphOffset_p->ul >> 16 );
currentOffset = (FT_Short)( glyphOffset.ul ); currentOffset = (FT_Short)( glyphOffset_p->ul );
if ( 0 < reserved ) if ( 0 < reserved )
{ {

View File

@ -189,7 +189,7 @@
gxv_mort_subtable_type2_entry_validate( gxv_mort_subtable_type2_entry_validate(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -199,7 +199,7 @@
FT_UShort offset; FT_UShort offset;
FT_UNUSED( state ); FT_UNUSED( state );
FT_UNUSED( glyphOffset ); FT_UNUSED( glyphOffset_p );
FT_UNUSED( limit ); FT_UNUSED( limit );

View File

@ -40,12 +40,12 @@
static void static void
gxv_mort_subtable_type4_lookupval_validate( FT_UShort glyph, gxv_mort_subtable_type4_lookupval_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UNUSED( glyph ); FT_UNUSED( glyph );
gxv_glyphid_validate( value.u, valid ); gxv_glyphid_validate( value_p->u, valid );
} }
/* /*
@ -78,7 +78,7 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_mort_subtable_type4_lookupfmt4_transit( gxv_mort_subtable_type4_lookupfmt4_transit(
FT_UShort relative_gindex, FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -88,7 +88,7 @@
GXV_LookupValueDesc value; GXV_LookupValueDesc value;
/* XXX: check range? */ /* XXX: check range? */
offset = (FT_UShort)( base_value.u + offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof ( FT_UShort ) ); relative_gindex * sizeof ( FT_UShort ) );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;

View File

@ -139,7 +139,7 @@
gxv_mort_subtable_type5_entry_validate( gxv_mort_subtable_type5_entry_validate(
FT_Byte state, FT_Byte state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -168,8 +168,8 @@
currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F ); currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F );
markedInsertCount = (FT_Byte)( flags & 0x001F ); markedInsertCount = (FT_Byte)( flags & 0x001F );
currentInsertList = (FT_UShort)( glyphOffset.ul >> 16 ); currentInsertList = (FT_UShort)( glyphOffset->ul >> 16 );
markedInsertList = (FT_UShort)( glyphOffset.ul ); markedInsertList = (FT_UShort)( glyphOffset->ul );
if ( 0 != currentInsertList && 0 != currentInsertCount ) if ( 0 != currentInsertList && 0 != currentInsertCount )
{ {

View File

@ -69,8 +69,8 @@
FT_ULong length; FT_ULong length;
FT_ULong coverage; FT_ULong coverage;
FT_ULong subFeatureFlags; FT_ULong subFeatureFlags;
FT_UInt type; FT_ULong type;
FT_UInt rest; FT_ULong rest;
GXV_LIMIT_CHECK( 4 + 4 + 4 ); GXV_LIMIT_CHECK( 4 + 4 + 4 );

View File

@ -42,7 +42,7 @@
gxv_morx_subtable_type0_entry_validate( gxv_morx_subtable_type0_entry_validate(
FT_UShort state, FT_UShort state,
FT_UShort flags, FT_UShort flags,
GXV_XStateTable_GlyphOffsetDesc glyphOffset, GXV_XStateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -54,7 +54,7 @@
FT_UShort verb; FT_UShort verb;
FT_UNUSED( state ); FT_UNUSED( state );
FT_UNUSED( glyphOffset ); FT_UNUSED( glyphOffset_p );
FT_UNUSED( table ); FT_UNUSED( table );
FT_UNUSED( limit ); FT_UNUSED( limit );

View File

@ -103,7 +103,7 @@
gxv_morx_subtable_type1_entry_validate( gxv_morx_subtable_type1_entry_validate(
FT_UShort state, FT_UShort state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -127,8 +127,8 @@
reserved = (FT_UShort)( flags & 0x3FFF ); reserved = (FT_UShort)( flags & 0x3FFF );
markIndex = (FT_Short)( glyphOffset.ul >> 16 ); markIndex = (FT_Short)( glyphOffset_p->ul >> 16 );
currentIndex = (FT_Short)( glyphOffset.ul ); currentIndex = (FT_Short)( glyphOffset_p->ul );
GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n", GXV_TRACE(( " setMark=%01d dontAdvance=%01d\n",
setMark, dontAdvance )); setMark, dontAdvance ));
@ -155,14 +155,14 @@
static void static void
gxv_morx_subtable_type1_LookupValue_validate( FT_UShort glyph, gxv_morx_subtable_type1_LookupValue_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
FT_UNUSED( glyph ); /* for the non-debugging case */ FT_UNUSED( glyph ); /* for the non-debugging case */
GXV_TRACE(( "morx subtable type1 subst.: %d -> %d\n", glyph, value.u )); GXV_TRACE(( "morx subtable type1 subst.: %d -> %d\n", glyph, value_p->u ));
if ( value.u > valid->face->num_glyphs ) if ( value_p->u > valid->face->num_glyphs )
FT_INVALID_GLYPH_ID; FT_INVALID_GLYPH_ID;
} }
@ -170,7 +170,7 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_morx_subtable_type1_LookupFmt4_transit( gxv_morx_subtable_type1_LookupFmt4_transit(
FT_UShort relative_gindex, FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -180,7 +180,7 @@
GXV_LookupValueDesc value; GXV_LookupValueDesc value;
/* XXX: check range? */ /* XXX: check range? */
offset = (FT_UShort)( base_value.u + offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof ( FT_UShort ) ); relative_gindex * sizeof ( FT_UShort ) );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;

View File

@ -186,7 +186,7 @@
gxv_morx_subtable_type2_entry_validate( gxv_morx_subtable_type2_entry_validate(
FT_UShort state, FT_UShort state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -206,7 +206,7 @@
performAction = (FT_UShort)( ( flags >> 13 ) & 1 ); performAction = (FT_UShort)( ( flags >> 13 ) & 1 );
reserved = (FT_UShort)( flags & 0x1FFF ); reserved = (FT_UShort)( flags & 0x1FFF );
ligActionIndex = glyphOffset.u; ligActionIndex = glyphOffset_p->u;
if ( reserved > 0 ) if ( reserved > 0 )
GXV_TRACE(( " reserved 14bit is non-zero\n" )); GXV_TRACE(( " reserved 14bit is non-zero\n" ));

View File

@ -136,7 +136,7 @@
gxv_morx_subtable_type5_entry_validate( gxv_morx_subtable_type5_entry_validate(
FT_UShort state, FT_UShort state,
FT_UShort flags, FT_UShort flags,
GXV_StateTable_GlyphOffsetDesc glyphOffset, GXV_StateTable_GlyphOffsetCPtr glyphOffset_p,
FT_Bytes table, FT_Bytes table,
FT_Bytes limit, FT_Bytes limit,
GXV_Validator valid ) GXV_Validator valid )
@ -165,8 +165,8 @@
currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F ); currentInsertCount = (FT_Byte)( ( flags >> 5 ) & 0x1F );
markedInsertCount = (FT_Byte)( flags & 0x001F ); markedInsertCount = (FT_Byte)( flags & 0x001F );
currentInsertList = (FT_Byte) ( glyphOffset.ul >> 16 ); currentInsertList = (FT_Byte) ( glyphOffset_p->ul >> 16 );
markedInsertList = (FT_UShort)( glyphOffset.ul ); markedInsertList = (FT_UShort)( glyphOffset_p->ul );
if ( currentInsertList && 0 != currentInsertCount ) if ( currentInsertList && 0 != currentInsertCount )
gxv_morx_subtable_type5_InsertList_validate( currentInsertList, gxv_morx_subtable_type5_InsertList_validate( currentInsertList,

View File

@ -67,18 +67,18 @@
static void static void
gxv_opbd_LookupValue_validate( FT_UShort glyph, gxv_opbd_LookupValue_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
/* offset in LookupTable is measured from the head of opbd table */ /* offset in LookupTable is measured from the head of opbd table */
FT_Bytes p = valid->root->base + value.u; FT_Bytes p = valid->root->base + value_p->u;
FT_Bytes limit = valid->root->limit; FT_Bytes limit = valid->root->limit;
FT_Short delta_value; FT_Short delta_value;
int i; int i;
if ( value.u < GXV_OPBD_DATA( valueOffset_min ) ) if ( value_p->u < GXV_OPBD_DATA( valueOffset_min ) )
GXV_OPBD_DATA( valueOffset_min ) = value.u; GXV_OPBD_DATA( valueOffset_min ) = value_p->u;
for ( i = 0; i < 4; i++ ) for ( i = 0; i < 4; i++ )
{ {
@ -132,7 +132,7 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_opbd_LookupFmt4_transit( FT_UShort relative_gindex, gxv_opbd_LookupFmt4_transit( FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -142,7 +142,7 @@
FT_UNUSED( valid ); FT_UNUSED( valid );
/* XXX: check range? */ /* XXX: check range? */
value.u = (FT_UShort)( base_value.u + value.u = (FT_UShort)( base_value_p->u +
relative_gindex * 4 * sizeof ( FT_Short ) ); relative_gindex * 4 * sizeof ( FT_Short ) );
return value; return value;

View File

@ -168,10 +168,10 @@
static void static void
gxv_prop_LookupValue_validate( FT_UShort glyph, gxv_prop_LookupValue_validate( FT_UShort glyph,
GXV_LookupValueDesc value, GXV_LookupValueCPtr value_p,
GXV_Validator valid ) GXV_Validator valid )
{ {
gxv_prop_property_validate( value.u, glyph, valid ); gxv_prop_property_validate( value_p->u, glyph, valid );
} }
@ -204,7 +204,7 @@
static GXV_LookupValueDesc static GXV_LookupValueDesc
gxv_prop_LookupFmt4_transit( FT_UShort relative_gindex, gxv_prop_LookupFmt4_transit( FT_UShort relative_gindex,
GXV_LookupValueDesc base_value, GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit, FT_Bytes lookuptbl_limit,
GXV_Validator valid ) GXV_Validator valid )
{ {
@ -214,7 +214,7 @@
GXV_LookupValueDesc value; GXV_LookupValueDesc value;
/* XXX: check range? */ /* XXX: check range? */
offset = (FT_UShort)( base_value.u + offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof( FT_UShort ) ); relative_gindex * sizeof( FT_UShort ) );
p = valid->lookuptbl_head + offset; p = valid->lookuptbl_head + offset;
limit = lookuptbl_limit; limit = lookuptbl_limit;

View File

@ -198,7 +198,7 @@
{ {
FT_Bytes p = table; FT_Bytes p = table;
FT_Bytes limit = 0; FT_Bytes limit = 0;
FT_UInt table_size; FT_Offset table_size;
GXV_ValidatorRec validrec; GXV_ValidatorRec validrec;
GXV_Validator valid = &validrec; GXV_Validator valid = &validrec;

View File

@ -58,7 +58,9 @@
/* original ZLib. */ /* original ZLib. */
#define NO_DUMMY_DECL #define NO_DUMMY_DECL
#define MY_ZCALLOC #ifndef USE_ZLIB_ZCALLOC
#define MY_ZCALLOC /* prevent all zcalloc() & zfree() in zutils.c */
#endif
#include "zlib.h" #include "zlib.h"
@ -121,7 +123,7 @@
} }
#ifndef FT_CONFIG_OPTION_SYSTEM_ZLIB #if !defined( FT_CONFIG_OPTION_SYSTEM_ZLIB ) && !defined( USE_ZLIB_ZCALLOC )
local voidpf local voidpf
zcalloc ( voidpf opaque, zcalloc ( voidpf opaque,
@ -138,7 +140,7 @@
ft_gzip_free( (FT_Memory)opaque, ptr ); ft_gzip_free( (FT_Memory)opaque, ptr );
} }
#endif /* !SYSTEM_ZLIB */ #endif /* !SYSTEM_ZLIB && !USE_ZLIB_ZCALLOC */
/***************************************************************************/ /***************************************************************************/

View File

@ -49,7 +49,7 @@ void zmemzero(dest, len)
} }
#endif #endif
#ifdef __TURBOC__ #if defined( MSDOS ) && defined( __TURBOC__ ) && !defined( MY_ZCALLOC )
#if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__)
/* Small and medium model in Turbo C are for now limited to near allocation /* Small and medium model in Turbo C are for now limited to near allocation
* with reduced MAX_WBITS and MAX_MEM_LEVEL * with reduced MAX_WBITS and MAX_MEM_LEVEL
@ -126,10 +126,10 @@ void zcfree (voidpf opaque, voidpf ptr)
Assert(0, "zcfree: ptr not found"); Assert(0, "zcfree: ptr not found");
} }
#endif #endif
#endif /* __TURBOC__ */ #endif /* MSDOS && __TURBOC__ */
#if defined(M_I86) && !defined(__32BIT__) #if defined(M_I86) && !defined(__32BIT__) && !defined( MY_ZCALLOC )
/* Microsoft C in 16-bit mode */ /* Microsoft C in 16-bit mode */
# define MY_ZCALLOC # define MY_ZCALLOC

View File

@ -113,8 +113,8 @@
{ {
FT_Memory memory = state->memory; FT_Memory memory = state->memory;
FT_Error error; FT_Error error;
FT_UInt old_size = state->stack_size; FT_Offset old_size = state->stack_size;
FT_UInt new_size = old_size; FT_Offset new_size = old_size;
new_size = new_size + ( new_size >> 1 ) + 4; new_size = new_size + ( new_size >> 1 ) + 4;

View File

@ -118,7 +118,7 @@
FT_Int buf_offset; FT_Int buf_offset;
FT_Int buf_size; FT_Int buf_size;
FT_Bool buf_clear; FT_Bool buf_clear;
FT_Int buf_total; FT_Offset buf_total;
FT_UInt max_bits; /* max code bits, from file header */ FT_UInt max_bits; /* max code bits, from file header */
FT_Int block_mode; /* block mode flag, from file header */ FT_Int block_mode; /* block mode flag, from file header */
@ -137,7 +137,7 @@
FT_Byte* stack; /* character stack */ FT_Byte* stack; /* character stack */
FT_UInt stack_top; FT_UInt stack_top;
FT_UInt stack_size; FT_Offset stack_size;
FT_Byte stack_0[FT_LZW_DEFAULT_STACK_SIZE]; /* minimize heap alloc */ FT_Byte stack_0[FT_LZW_DEFAULT_STACK_SIZE]; /* minimize heap alloc */
FT_Stream source; /* source stream */ FT_Stream source; /* source stream */

View File

@ -209,7 +209,7 @@
{ {
if ( format & 1 ) if ( format & 1 )
{ {
FT_UInt table_size; FT_PtrDist table_size;
OTV_OPTIONAL_TABLE( device ); OTV_OPTIONAL_TABLE( device );
@ -911,7 +911,8 @@
{ {
case 1: /* ExtensionPosFormat1 */ case 1: /* ExtensionPosFormat1 */
{ {
FT_UInt ExtensionLookupType, ExtensionOffset; FT_UInt ExtensionLookupType;
FT_ULong ExtensionOffset;
OTV_Validate_Func validate; OTV_Validate_Func validate;

View File

@ -415,7 +415,8 @@
{ {
case 1: /* ExtensionSubstFormat1 */ case 1: /* ExtensionSubstFormat1 */
{ {
FT_UInt ExtensionLookupType, ExtensionOffset; FT_UInt ExtensionLookupType;
FT_ULong ExtensionOffset;
OTV_Validate_Func validate; OTV_Validate_Func validate;

View File

@ -82,12 +82,25 @@
FT_Byte* volatile math; FT_Byte* volatile math;
FT_ULong len_base, len_gdef, len_gpos, len_gsub, len_jstf; FT_ULong len_base, len_gdef, len_gpos, len_gsub, len_jstf;
FT_ULong len_math; FT_ULong len_math;
FT_UInt num_glyphs = (FT_UInt)face->num_glyphs;
FT_ValidatorRec volatile valid; FT_ValidatorRec volatile valid;
base = gdef = gpos = gsub = jstf = math = NULL; base = gdef = gpos = gsub = jstf = math = NULL;
len_base = len_gdef = len_gpos = len_gsub = len_jstf = len_math = 0; len_base = len_gdef = len_gpos = len_gsub = len_jstf = len_math = 0;
/*
* XXX: OpenType tables cannot handle 32-bit glyph index,
* although broken TrueType can have 32-bit glyph index.
*/
if ( face->num_glyphs > 0xFFFFL )
{
FT_TRACE1(( "otv_validate: Invalid glyphs index (0x0000FFFF - 0x%08x) ",
face->num_glyphs ));
FT_TRACE1(( "are not handled by OpenType tables\n" ));
num_glyphs = 0xFFFF;
}
/* load tables */ /* load tables */
if ( ot_flags & FT_VALIDATE_BASE ) if ( ot_flags & FT_VALIDATE_BASE )
@ -148,7 +161,7 @@
{ {
ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT ); ft_validator_init( &valid, gpos, gpos + len_gpos, FT_VALIDATE_DEFAULT );
if ( ft_setjmp( valid.jump_buffer ) == 0 ) if ( ft_setjmp( valid.jump_buffer ) == 0 )
otv_GPOS_validate( gpos, face->num_glyphs, &valid ); otv_GPOS_validate( gpos, num_glyphs, &valid );
error = valid.error; error = valid.error;
if ( error ) if ( error )
goto Exit; goto Exit;
@ -158,7 +171,7 @@
{ {
ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT ); ft_validator_init( &valid, gsub, gsub + len_gsub, FT_VALIDATE_DEFAULT );
if ( ft_setjmp( valid.jump_buffer ) == 0 ) if ( ft_setjmp( valid.jump_buffer ) == 0 )
otv_GSUB_validate( gsub, face->num_glyphs, &valid ); otv_GSUB_validate( gsub, num_glyphs, &valid );
error = valid.error; error = valid.error;
if ( error ) if ( error )
goto Exit; goto Exit;
@ -168,7 +181,7 @@
{ {
ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT ); ft_validator_init( &valid, gdef, gdef + len_gdef, FT_VALIDATE_DEFAULT );
if ( ft_setjmp( valid.jump_buffer ) == 0 ) if ( ft_setjmp( valid.jump_buffer ) == 0 )
otv_GDEF_validate( gdef, gsub, gpos, face->num_glyphs, &valid ); otv_GDEF_validate( gdef, gsub, gpos, num_glyphs, &valid );
error = valid.error; error = valid.error;
if ( error ) if ( error )
goto Exit; goto Exit;
@ -178,7 +191,7 @@
{ {
ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT ); ft_validator_init( &valid, jstf, jstf + len_jstf, FT_VALIDATE_DEFAULT );
if ( ft_setjmp( valid.jump_buffer ) == 0 ) if ( ft_setjmp( valid.jump_buffer ) == 0 )
otv_JSTF_validate( jstf, gsub, gpos, face->num_glyphs, &valid ); otv_JSTF_validate( jstf, gsub, gpos, num_glyphs, &valid );
error = valid.error; error = valid.error;
if ( error ) if ( error )
goto Exit; goto Exit;
@ -188,7 +201,7 @@
{ {
ft_validator_init( &valid, math, math + len_math, FT_VALIDATE_DEFAULT ); ft_validator_init( &valid, math, math + len_math, FT_VALIDATE_DEFAULT );
if ( ft_setjmp( valid.jump_buffer ) == 0 ) if ( ft_setjmp( valid.jump_buffer ) == 0 )
otv_MATH_validate( math, face->num_glyphs, &valid ); otv_MATH_validate( math, num_glyphs, &valid );
error = valid.error; error = valid.error;
if ( error ) if ( error )
goto Exit; goto Exit;

View File

@ -72,8 +72,8 @@ FT_BEGIN_HEADER
union union
{ {
FT_String* atom; FT_String* atom;
FT_Long integer; FT_Long l;
FT_ULong cardinal; FT_ULong ul;
} value; } value;

View File

@ -111,7 +111,7 @@ THE SOFTWARE.
while ( min < max ) while ( min < max )
{ {
FT_UInt32 code; FT_ULong code;
mid = ( min + max ) >> 1; mid = ( min + max ) >> 1;
@ -140,7 +140,7 @@ THE SOFTWARE.
PCF_CMap cmap = (PCF_CMap)pcfcmap; PCF_CMap cmap = (PCF_CMap)pcfcmap;
PCF_Encoding encodings = cmap->encodings; PCF_Encoding encodings = cmap->encodings;
FT_UInt min, max, mid; FT_UInt min, max, mid;
FT_UInt32 charcode = *acharcode + 1; FT_ULong charcode = *acharcode + 1;
FT_UInt result = 0; FT_UInt result = 0;
@ -149,7 +149,7 @@ THE SOFTWARE.
while ( min < max ) while ( min < max )
{ {
FT_UInt32 code; FT_ULong code;
mid = ( min + max ) >> 1; mid = ( min + max ) >> 1;
@ -175,7 +175,14 @@ THE SOFTWARE.
} }
Exit: Exit:
*acharcode = charcode; if ( charcode > 0xFFFFFFFFUL )
{
FT_TRACE1(( "pcf_cmap_char_next: charcode 0x%x > 32bit API" ));
*acharcode = 0;
/* XXX: result should be changed to indicate an overflow error */
}
else
*acharcode = (FT_UInt32)charcode;
return result; return result;
} }
@ -448,7 +455,7 @@ THE SOFTWARE.
FT_Error error = PCF_Err_Ok; FT_Error error = PCF_Err_Ok;
FT_Bitmap* bitmap = &slot->bitmap; FT_Bitmap* bitmap = &slot->bitmap;
PCF_Metric metric; PCF_Metric metric;
int bytes; FT_Offset bytes;
FT_UNUSED( load_flags ); FT_UNUSED( load_flags );
@ -578,12 +585,17 @@ THE SOFTWARE.
} }
else else
{ {
if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
{
FT_TRACE1(( "pcf_get_bdf_property: " ));
FT_TRACE1(( "too large integer 0x%x is truncated\n" ));
}
/* Apparently, the PCF driver loads all properties as signed integers! /* Apparently, the PCF driver loads all properties as signed integers!
* This really doesn't seem to be a problem, because this is * This really doesn't seem to be a problem, because this is
* sufficient for any meaningful values. * sufficient for any meaningful values.
*/ */
aproperty->type = BDF_PROPERTY_TYPE_INTEGER; aproperty->type = BDF_PROPERTY_TYPE_INTEGER;
aproperty->u.integer = prop->value.integer; aproperty->u.integer = (FT_Int32)prop->value.l;
} }
return 0; return 0;
} }

View File

@ -289,13 +289,13 @@ THE SOFTWARE.
static FT_Error static FT_Error
pcf_seek_to_table_type( FT_Stream stream, pcf_seek_to_table_type( FT_Stream stream,
PCF_Table tables, PCF_Table tables,
FT_Int ntables, FT_ULong ntables, /* same as PCF_Toc->count */
FT_ULong type, FT_ULong type,
FT_ULong *aformat, FT_ULong *aformat,
FT_ULong *asize ) FT_ULong *asize )
{ {
FT_Error error = PCF_Err_Invalid_File_Format; FT_Error error = PCF_Err_Invalid_File_Format;
FT_Int i; FT_ULong i;
for ( i = 0; i < ntables; i++ ) for ( i = 0; i < ntables; i++ )
@ -327,10 +327,10 @@ THE SOFTWARE.
static FT_Bool static FT_Bool
pcf_has_table_type( PCF_Table tables, pcf_has_table_type( PCF_Table tables,
FT_Int ntables, FT_ULong ntables, /* same as PCF_Toc->count */
FT_ULong type ) FT_ULong type )
{ {
FT_Int i; FT_ULong i;
for ( i = 0; i < ntables; i++ ) for ( i = 0; i < ntables; i++ )
@ -399,7 +399,7 @@ THE SOFTWARE.
{ {
PCF_ParseProperty props = 0; PCF_ParseProperty props = 0;
PCF_Property properties; PCF_Property properties;
FT_UInt nprops, i; FT_ULong nprops, i;
FT_ULong format, size; FT_ULong format, size;
FT_Error error; FT_Error error;
FT_Memory memory = FT_FACE(face)->memory; FT_Memory memory = FT_FACE(face)->memory;
@ -433,7 +433,10 @@ THE SOFTWARE.
if ( error ) if ( error )
goto Bail; goto Bail;
FT_TRACE4(( " nprop = %d\n", nprops )); FT_TRACE4(( " nprop = %d (truncate %d props)\n",
(int)nprops, nprops - (int)nprops ));
nprops = nprops - (int)nprops;
/* rough estimate */ /* rough estimate */
if ( nprops > size / PCF_PROPERTY_SIZE ) if ( nprops > size / PCF_PROPERTY_SIZE )
@ -442,7 +445,7 @@ THE SOFTWARE.
goto Bail; goto Bail;
} }
face->nprops = nprops; face->nprops = (int)nprops;
if ( FT_NEW_ARRAY( props, nprops ) ) if ( FT_NEW_ARRAY( props, nprops ) )
goto Bail; goto Bail;
@ -542,9 +545,9 @@ THE SOFTWARE.
} }
else else
{ {
properties[i].value.integer = props[i].value; properties[i].value.l = props[i].value;
FT_TRACE4(( " %d\n", properties[i].value.integer )); FT_TRACE4(( " %d\n", properties[i].value.l ));
} }
} }
@ -661,7 +664,7 @@ THE SOFTWARE.
FT_Long* offsets; FT_Long* offsets;
FT_Long bitmapSizes[GLYPHPADOPTIONS]; FT_Long bitmapSizes[GLYPHPADOPTIONS];
FT_ULong format, size; FT_ULong format, size;
int nbitmaps, i, sizebitmaps = 0; FT_ULong nbitmaps, i, sizebitmaps = 0;
error = pcf_seek_to_table_type( stream, error = pcf_seek_to_table_type( stream,
@ -692,7 +695,8 @@ THE SOFTWARE.
FT_TRACE4(( " number of bitmaps: %d\n", nbitmaps )); FT_TRACE4(( " number of bitmaps: %d\n", nbitmaps ));
if ( nbitmaps != face->nmetrics ) /* XXX: PCF_Face->nmetrics is singed FT_Long, see pcf.h */
if ( face->nmetrics < 0 || nbitmaps != ( FT_ULong )face->nmetrics )
return PCF_Err_Invalid_File_Format; return PCF_Err_Invalid_File_Format;
if ( FT_NEW_ARRAY( offsets, nbitmaps ) ) if ( FT_NEW_ARRAY( offsets, nbitmaps ) )
@ -992,9 +996,9 @@ THE SOFTWARE.
PCF_Property prop; PCF_Property prop;
int nn, len; size_t nn, len;
char* strings[4] = { NULL, NULL, NULL, NULL }; char* strings[4] = { NULL, NULL, NULL, NULL };
int lengths[4]; size_t lengths[4];
face->style_flags = 0; face->style_flags = 0;
@ -1076,7 +1080,7 @@ THE SOFTWARE.
/* add_style_name and setwidth_name */ /* add_style_name and setwidth_name */
if ( nn == 0 || nn == 3 ) if ( nn == 0 || nn == 3 )
{ {
int mm; size_t mm;
for ( mm = 0; mm < len; mm++ ) for ( mm = 0; mm < len; mm++ )
@ -1201,7 +1205,7 @@ THE SOFTWARE.
prop = pcf_find_property( face, "AVERAGE_WIDTH" ); prop = pcf_find_property( face, "AVERAGE_WIDTH" );
if ( prop ) if ( prop )
bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 ); bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );
else else
bsize->width = (FT_Short)( bsize->height * 2/3 ); bsize->width = (FT_Short)( bsize->height * 2/3 );
@ -1209,19 +1213,19 @@ THE SOFTWARE.
if ( prop ) if ( prop )
/* convert from 722.7 decipoints to 72 points per inch */ /* convert from 722.7 decipoints to 72 points per inch */
bsize->size = bsize->size =
(FT_Pos)( ( prop->value.integer * 64 * 7200 + 36135L ) / 72270L ); (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );
prop = pcf_find_property( face, "PIXEL_SIZE" ); prop = pcf_find_property( face, "PIXEL_SIZE" );
if ( prop ) if ( prop )
bsize->y_ppem = (FT_Short)prop->value.integer << 6; bsize->y_ppem = (FT_Short)prop->value.l << 6;
prop = pcf_find_property( face, "RESOLUTION_X" ); prop = pcf_find_property( face, "RESOLUTION_X" );
if ( prop ) if ( prop )
resolution_x = (FT_Short)prop->value.integer; resolution_x = (FT_Short)prop->value.l;
prop = pcf_find_property( face, "RESOLUTION_Y" ); prop = pcf_find_property( face, "RESOLUTION_Y" );
if ( prop ) if ( prop )
resolution_y = (FT_Short)prop->value.integer; resolution_y = (FT_Short)prop->value.l;
if ( bsize->y_ppem == 0 ) if ( bsize->y_ppem == 0 )
{ {

View File

@ -42,9 +42,9 @@ in this Software without prior written authorization from The Open Group.
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
BitOrderInvert( unsigned char* buf, BitOrderInvert( unsigned char* buf,
int nbytes ) size_t nbytes )
{ {
for ( ; --nbytes >= 0; buf++ ) for ( ; nbytes > 0; nbytes--, buf++ )
{ {
unsigned int val = *buf; unsigned int val = *buf;
@ -64,7 +64,7 @@ in this Software without prior written authorization from The Open Group.
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
TwoByteSwap( unsigned char* buf, TwoByteSwap( unsigned char* buf,
int nbytes ) size_t nbytes )
{ {
unsigned char c; unsigned char c;
@ -83,7 +83,7 @@ in this Software without prior written authorization from The Open Group.
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
FourByteSwap( unsigned char* buf, FourByteSwap( unsigned char* buf,
int nbytes ) size_t nbytes )
{ {
unsigned char c; unsigned char c;

View File

@ -37,15 +37,15 @@ FT_BEGIN_HEADER
FT_LOCAL( void ) FT_LOCAL( void )
BitOrderInvert( unsigned char* buf, BitOrderInvert( unsigned char* buf,
int nbytes ); size_t nbytes );
FT_LOCAL( void ) FT_LOCAL( void )
TwoByteSwap( unsigned char* buf, TwoByteSwap( unsigned char* buf,
int nbytes ); size_t nbytes );
FT_LOCAL( void ) FT_LOCAL( void )
FourByteSwap( unsigned char* buf, FourByteSwap( unsigned char* buf,
int nbytes ); size_t nbytes );
FT_END_HEADER FT_END_HEADER

View File

@ -88,7 +88,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
pfr_cmap_char_next( PFR_CMap cmap, pfr_cmap_char_next( PFR_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {

View File

@ -716,7 +716,8 @@
{ {
FT_Error error; FT_Error error;
FT_Memory memory = stream->memory; FT_Memory memory = stream->memory;
FT_UInt flags, num_aux; FT_UInt flags;
FT_ULong num_aux;
FT_Byte* p; FT_Byte* p;
FT_Byte* limit; FT_Byte* limit;

View File

@ -630,18 +630,35 @@
&xpos, &ypos, &xpos, &ypos,
&xsize, &ysize, &xsize, &ysize,
&advance, &format ); &advance, &format );
/*
* XXX: on 16bit system, we return an error for huge bitmap
* which causes a size truncation, because truncated
* size properties makes bitmap glyph broken.
*/
if ( xpos > FT_INT_MAX || ( ypos + ysize ) > FT_INT_MAX )
{
FT_TRACE1(( "pfr_slot_load_bitmap:" ));
FT_TRACE1(( "huge bitmap glyph %dx%d over FT_GlyphSlot\n",
xpos, ypos ));
error = PFR_Err_Invalid_Pixel_Size;
}
if ( !error ) if ( !error )
{ {
glyph->root.format = FT_GLYPH_FORMAT_BITMAP; glyph->root.format = FT_GLYPH_FORMAT_BITMAP;
/* Set up glyph bitmap and metrics */ /* Set up glyph bitmap and metrics */
/* XXX: needs casts to fit FT_Bitmap.{width|rows|pitch} */
glyph->root.bitmap.width = (FT_Int)xsize; glyph->root.bitmap.width = (FT_Int)xsize;
glyph->root.bitmap.rows = (FT_Int)ysize; glyph->root.bitmap.rows = (FT_Int)ysize;
glyph->root.bitmap.pitch = (FT_Long)( xsize + 7 ) >> 3; glyph->root.bitmap.pitch = (FT_Int)( xsize + 7 ) >> 3;
glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO; glyph->root.bitmap.pixel_mode = FT_PIXEL_MODE_MONO;
glyph->root.metrics.width = (FT_Long)xsize << 6; /* XXX: needs casts to fit FT_Glyph_Metrics.{width|height} */
glyph->root.metrics.height = (FT_Long)ysize << 6; glyph->root.metrics.width = (FT_Pos)xsize << 6;
glyph->root.metrics.height = (FT_Pos)ysize << 6;
glyph->root.metrics.horiBearingX = xpos << 6; glyph->root.metrics.horiBearingX = xpos << 6;
glyph->root.metrics.horiBearingY = ypos << 6; glyph->root.metrics.horiBearingY = ypos << 6;
glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 2 ) ); glyph->root.metrics.horiAdvance = FT_PIX_ROUND( ( advance >> 2 ) );
@ -649,8 +666,9 @@
glyph->root.metrics.vertBearingY = 0; glyph->root.metrics.vertBearingY = 0;
glyph->root.metrics.vertAdvance = size->root.metrics.height; glyph->root.metrics.vertAdvance = size->root.metrics.height;
glyph->root.bitmap_left = xpos; /* XXX: needs casts fit FT_GlyphSlotRec.bitmap_{left|top} */
glyph->root.bitmap_top = ypos + ysize; glyph->root.bitmap_left = (FT_Int)xpos;
glyph->root.bitmap_top = (FT_Int)(ypos + ysize);
/* Allocate and read bitmap data */ /* Allocate and read bitmap data */
{ {

View File

@ -200,7 +200,7 @@ FT_BEGIN_HEADER
FT_Byte flags; FT_Byte flags;
FT_Short base_adj; FT_Short base_adj;
FT_UInt pair_size; FT_UInt pair_size;
FT_UInt32 offset; FT_Offset offset;
FT_UInt32 pair1; FT_UInt32 pair1;
FT_UInt32 pair2; FT_UInt32 pair2;
@ -252,7 +252,7 @@ FT_BEGIN_HEADER
FT_UInt blue_scale; FT_UInt blue_scale;
FT_UInt num_chars; FT_UInt num_chars;
FT_UInt32 chars_offset; FT_Offset chars_offset;
PFR_Char chars; PFR_Char chars;
FT_UInt num_kern_pairs; FT_UInt num_kern_pairs;
@ -260,7 +260,7 @@ FT_BEGIN_HEADER
PFR_KernItem* kern_items_tail; PFR_KernItem* kern_items_tail;
/* not part of the spec, but used during load */ /* not part of the spec, but used during load */
FT_UInt32 bct_offset; FT_Long bct_offset;
FT_Byte* cursor; FT_Byte* cursor;
} PFR_PhyFontRec, *PFR_PhyFont; } PFR_PhyFontRec, *PFR_PhyFont;

View File

@ -366,11 +366,11 @@
FT_LOCAL_DEF( FT_Int ) FT_LOCAL_DEF( FT_Int )
afm_parser_read_vals( AFM_Parser parser, afm_parser_read_vals( AFM_Parser parser,
AFM_Value vals, AFM_Value vals,
FT_Int n ) FT_UInt n )
{ {
AFM_Stream stream = parser->stream; AFM_Stream stream = parser->stream;
char* str; char* str;
FT_Int i; FT_UInt i;
if ( n > AFM_MAX_ARGUMENTS ) if ( n > AFM_MAX_ARGUMENTS )
@ -378,7 +378,7 @@
for ( i = 0; i < n; i++ ) for ( i = 0; i < n; i++ )
{ {
FT_UInt len; FT_Offset len;
AFM_Value val = vals + i; AFM_Value val = vals + i;
@ -440,7 +440,7 @@
FT_LOCAL_DEF( char* ) FT_LOCAL_DEF( char* )
afm_parser_next_key( AFM_Parser parser, afm_parser_next_key( AFM_Parser parser,
FT_Bool line, FT_Bool line,
FT_UInt* len ) FT_Offset* len )
{ {
AFM_Stream stream = parser->stream; AFM_Stream stream = parser->stream;
char* key = 0; /* make stupid compiler happy */ char* key = 0; /* make stupid compiler happy */
@ -488,7 +488,7 @@
} }
if ( len ) if ( len )
*len = ( key ) ? AFM_STREAM_KEY_LEN( stream, key ) *len = ( key ) ? (FT_Offset)AFM_STREAM_KEY_LEN( stream, key )
: 0; : 0;
return key; return key;
@ -497,7 +497,7 @@
static AFM_Token static AFM_Token
afm_tokenize( const char* key, afm_tokenize( const char* key,
FT_UInt len ) FT_Offset len )
{ {
int n; int n;
@ -585,7 +585,7 @@
AFM_FontInfo fi = parser->FontInfo; AFM_FontInfo fi = parser->FontInfo;
AFM_TrackKern tk; AFM_TrackKern tk;
char* key; char* key;
FT_UInt len; FT_Offset len;
int n = -1; int n = -1;
@ -686,7 +686,7 @@
AFM_FontInfo fi = parser->FontInfo; AFM_FontInfo fi = parser->FontInfo;
AFM_KernPair kp; AFM_KernPair kp;
char* key; char* key;
FT_UInt len; FT_Offset len;
int n = -1; int n = -1;
@ -774,9 +774,9 @@
static FT_Error static FT_Error
afm_parse_kern_data( AFM_Parser parser ) afm_parse_kern_data( AFM_Parser parser )
{ {
FT_Error error; FT_Error error;
char* key; char* key;
FT_UInt len; FT_Offset len;
while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 ) while ( ( key = afm_parser_next_key( parser, 1, &len ) ) != 0 )
@ -818,8 +818,8 @@
FT_UInt n, FT_UInt n,
AFM_Token end_section ) AFM_Token end_section )
{ {
char* key; char* key;
FT_UInt len; FT_Offset len;
while ( n-- > 0 ) while ( n-- > 0 )
@ -850,7 +850,7 @@
AFM_FontInfo fi = parser->FontInfo; AFM_FontInfo fi = parser->FontInfo;
FT_Error error = PSaux_Err_Syntax_Error; FT_Error error = PSaux_Err_Syntax_Error;
char* key; char* key;
FT_UInt len; FT_Offset len;
FT_Int metrics_sets = 0; FT_Int metrics_sets = 0;

View File

@ -71,13 +71,13 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Int ) FT_LOCAL( FT_Int )
afm_parser_read_vals( AFM_Parser parser, afm_parser_read_vals( AFM_Parser parser,
AFM_Value vals, AFM_Value vals,
FT_Int n ); FT_UInt n );
/* read the next key from the next line or column */ /* read the next key from the next line or column */
FT_LOCAL( char* ) FT_LOCAL( char* )
afm_parser_next_key( AFM_Parser parser, afm_parser_next_key( AFM_Parser parser,
FT_Bool line, FT_Bool line,
FT_UInt* len ); FT_Offset* len );
FT_END_HEADER FT_END_HEADER

View File

@ -239,7 +239,7 @@
PS_Conv_StringDecode( FT_Byte** cursor, PS_Conv_StringDecode( FT_Byte** cursor,
FT_Byte* limit, FT_Byte* limit,
FT_Byte* buffer, FT_Byte* buffer,
FT_UInt n ) FT_Offset n )
{ {
FT_Byte* p; FT_Byte* p;
FT_UInt r = 0; FT_UInt r = 0;
@ -334,7 +334,7 @@
PS_Conv_ASCIIHexDecode( FT_Byte** cursor, PS_Conv_ASCIIHexDecode( FT_Byte** cursor,
FT_Byte* limit, FT_Byte* limit,
FT_Byte* buffer, FT_Byte* buffer,
FT_UInt n ) FT_Offset n )
{ {
FT_Byte* p; FT_Byte* p;
FT_UInt r = 0; FT_UInt r = 0;
@ -423,7 +423,7 @@
PS_Conv_EexecDecode( FT_Byte** cursor, PS_Conv_EexecDecode( FT_Byte** cursor,
FT_Byte* limit, FT_Byte* limit,
FT_Byte* buffer, FT_Byte* buffer,
FT_UInt n, FT_Offset n,
FT_UShort* seed ) FT_UShort* seed )
{ {
FT_Byte* p; FT_Byte* p;

View File

@ -46,20 +46,20 @@ FT_BEGIN_HEADER
PS_Conv_StringDecode( FT_Byte** cursor, PS_Conv_StringDecode( FT_Byte** cursor,
FT_Byte* limit, FT_Byte* limit,
FT_Byte* buffer, FT_Byte* buffer,
FT_UInt n ); FT_Offset n );
#endif #endif
FT_LOCAL( FT_UInt ) FT_LOCAL( FT_UInt )
PS_Conv_ASCIIHexDecode( FT_Byte** cursor, PS_Conv_ASCIIHexDecode( FT_Byte** cursor,
FT_Byte* limit, FT_Byte* limit,
FT_Byte* buffer, FT_Byte* buffer,
FT_UInt n ); FT_Offset n );
FT_LOCAL( FT_UInt ) FT_LOCAL( FT_UInt )
PS_Conv_EexecDecode( FT_Byte** cursor, PS_Conv_EexecDecode( FT_Byte** cursor,
FT_Byte* limit, FT_Byte* limit,
FT_Byte* buffer, FT_Byte* buffer,
FT_UInt n, FT_Offset n,
FT_UShort* seed ); FT_UShort* seed );

View File

@ -1313,7 +1313,7 @@
FT_LOCAL_DEF( FT_Error ) FT_LOCAL_DEF( FT_Error )
ps_parser_to_bytes( PS_Parser parser, ps_parser_to_bytes( PS_Parser parser,
FT_Byte* bytes, FT_Byte* bytes,
FT_Long max_bytes, FT_Offset max_bytes,
FT_Long* pnum_bytes, FT_Long* pnum_bytes,
FT_Bool delimiters ) FT_Bool delimiters )
{ {

View File

@ -111,7 +111,7 @@ FT_BEGIN_HEADER
FT_LOCAL( FT_Error ) FT_LOCAL( FT_Error )
ps_parser_to_bytes( PS_Parser parser, ps_parser_to_bytes( PS_Parser parser,
FT_Byte* bytes, FT_Byte* bytes,
FT_Long max_bytes, FT_Offset max_bytes,
FT_Long* pnum_bytes, FT_Long* pnum_bytes,
FT_Bool delimiters ); FT_Bool delimiters );

View File

@ -95,7 +95,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
t1_cmap_std_char_next( T1_CMapStd cmap, t1_cmap_std_char_next( T1_CMapStd cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -213,7 +213,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
t1_cmap_custom_char_next( T1_CMapCustom cmap, t1_cmap_custom_char_next( T1_CMapCustom cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -312,7 +312,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
t1_cmap_unicode_char_next( PS_Unicodes unicodes, t1_cmap_unicode_char_next( PS_Unicodes unicodes,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {

View File

@ -594,7 +594,7 @@
if ( ip[-1] >= 32 ) if ( ip[-1] >= 32 )
{ {
if ( ip[-1] < 247 ) if ( ip[-1] < 247 )
value = (FT_Long)ip[-1] - 139; value = (FT_Int32)ip[-1] - 139;
else else
{ {
if ( ++ip > limit ) if ( ++ip > limit )
@ -605,9 +605,9 @@
} }
if ( ip[-2] < 251 ) if ( ip[-2] < 251 )
value = ( ( (FT_Long)ip[-2] - 247 ) << 8 ) + ip[-1] + 108; value = ( ( (FT_Int32)ip[-2] - 247 ) << 8 ) + ip[-1] + 108;
else else
value = -( ( ( (FT_Long)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 ); value = -( ( ( (FT_Int32)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 );
} }
if ( !large_int ) if ( !large_int )

View File

@ -34,7 +34,7 @@
#define VARIANT_BIT 0x80000000UL #define VARIANT_BIT 0x80000000UL
#define BASE_GLYPH( code ) ( (code) & ~VARIANT_BIT ) #define BASE_GLYPH( code ) ( (FT_UInt32)( (code) & ~VARIANT_BIT ) )
/* Return the Unicode value corresponding to a given glyph. Note that */ /* Return the Unicode value corresponding to a given glyph. Note that */
@ -58,7 +58,7 @@
/* `uniXXXXYYYYZZZZ'... */ /* `uniXXXXYYYYZZZZ'... */
FT_Int count; FT_Int count;
FT_ULong value = 0; FT_UInt32 value = 0;
const char* p = glyph_name + 3; const char* p = glyph_name + 3;
@ -93,7 +93,7 @@
if ( *p == '\0' ) if ( *p == '\0' )
return value; return value;
if ( *p == '.' ) if ( *p == '.' )
return value | VARIANT_BIT; return (FT_UInt32)( value | VARIANT_BIT );
} }
} }
@ -102,7 +102,7 @@
if ( glyph_name[0] == 'u' ) if ( glyph_name[0] == 'u' )
{ {
FT_Int count; FT_Int count;
FT_ULong value = 0; FT_UInt32 value = 0;
const char* p = glyph_name + 1; const char* p = glyph_name + 1;
@ -133,7 +133,7 @@
if ( *p == '\0' ) if ( *p == '\0' )
return value; return value;
if ( *p == '.' ) if ( *p == '.' )
return value | VARIANT_BIT; return (FT_UInt32)( value | VARIANT_BIT );
} }
} }
@ -155,9 +155,10 @@
/* now look up the glyph in the Adobe Glyph List */ /* now look up the glyph in the Adobe Glyph List */
if ( !dot ) if ( !dot )
return ft_get_adobe_glyph_index( glyph_name, p ); return (FT_UInt32)ft_get_adobe_glyph_index( glyph_name, p );
else else
return ft_get_adobe_glyph_index( glyph_name, dot ) | VARIANT_BIT; return (FT_UInt32)( ft_get_adobe_glyph_index( glyph_name, dot ) |
VARIANT_BIT );
} }
} }
@ -436,7 +437,7 @@
} }
static FT_ULong static FT_UInt32
ps_unicodes_char_next( PS_Unicodes table, ps_unicodes_char_next( PS_Unicodes table,
FT_UInt32 *unicode ) FT_UInt32 *unicode )
{ {

View File

@ -49,6 +49,15 @@
#include FT_SERVICE_SFNT_H #include FT_SERVICE_SFNT_H
#include FT_SERVICE_TT_CMAP_H #include FT_SERVICE_TT_CMAP_H
/*************************************************************************/
/* */
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
/* messages during execution. */
/* */
#undef FT_COMPONENT
#define FT_COMPONENT trace_sfdriver
/* /*
* SFNT TABLE SERVICE * SFNT TABLE SERVICE
@ -157,11 +166,19 @@
sfnt_get_name_index( TT_Face face, sfnt_get_name_index( TT_Face face,
FT_String* glyph_name ) FT_String* glyph_name )
{ {
FT_Face root = &face->root; FT_Face root = &face->root;
FT_Long i; FT_UInt i, max_gid = FT_UINT_MAX;
for ( i = 0; i < root->num_glyphs; i++ ) if ( root->num_glyphs < 0 )
return 0;
else if ( ( FT_ULong ) root->num_glyphs < FT_UINT_MAX )
max_gid = ( FT_UInt ) root->num_glyphs;
else
FT_TRACE0(( "Ignore glyph names for invalid GID 0x%08x - 0x%08x\n",
FT_UINT_MAX, root->num_glyphs ));
for ( i = 0; i < max_gid; i++ )
{ {
FT_String* gname; FT_String* gname;
FT_Error error = tt_face_get_ps_name( face, i, &gname ); FT_Error error = tt_face_get_ps_name( face, i, &gname );
@ -171,7 +188,7 @@
continue; continue;
if ( !ft_strcmp( glyph_name, gname ) ) if ( !ft_strcmp( glyph_name, gname ) )
return (FT_UInt)i; return i;
} }
return 0; return 0;

View File

@ -749,8 +749,8 @@
/* now set up root fields */ /* now set up root fields */
{ {
FT_Face root = &face->root; FT_Face root = &face->root;
FT_Int32 flags = root->face_flags; FT_Long flags = root->face_flags;
/*********************************************************************/ /*********************************************************************/

View File

@ -84,7 +84,7 @@
FT_Byte* p = bdf->table; FT_Byte* p = bdf->table;
FT_UInt version = FT_NEXT_USHORT( p ); FT_UInt version = FT_NEXT_USHORT( p );
FT_UInt num_strikes = FT_NEXT_USHORT( p ); FT_UInt num_strikes = FT_NEXT_USHORT( p );
FT_UInt32 strings = FT_NEXT_ULONG ( p ); FT_ULong strings = FT_NEXT_ULONG ( p );
FT_UInt count; FT_UInt count;
FT_Byte* strike; FT_Byte* strike;
@ -141,13 +141,13 @@
const char* property_name, const char* property_name,
BDF_PropertyRec *aprop ) BDF_PropertyRec *aprop )
{ {
TT_BDF bdf = &face->bdf; TT_BDF bdf = &face->bdf;
FT_Size size = FT_FACE(face)->size; FT_Size size = FT_FACE(face)->size;
FT_Error error = 0; FT_Error error = 0;
FT_Byte* p; FT_Byte* p;
FT_UInt count; FT_UInt count;
FT_Byte* strike; FT_Byte* strike;
FT_UInt property_len; FT_Offset property_len;
aprop->type = BDF_PROPERTY_TYPE_NONE; aprop->type = BDF_PROPERTY_TYPE_NONE;

View File

@ -125,7 +125,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap0_char_next( TT_CMap cmap, tt_cmap0_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -460,7 +460,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap2_char_next( TT_CMap cmap, tt_cmap2_char_next( TT_CMap cmap,
FT_UInt32 *pcharcode ) FT_UInt32 *pcharcode )
{ {
@ -659,7 +659,7 @@
p = table + 6; p = table + 6;
cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1; cmap->num_ranges = FT_PEEK_USHORT( p ) >> 1;
cmap->cur_charcode = 0xFFFFFFFFUL; cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
cmap->cur_gindex = 0; cmap->cur_gindex = 0;
return SFNT_Err_Ok; return SFNT_Err_Ok;
@ -737,7 +737,7 @@
if ( cmap->cur_charcode >= 0xFFFFUL ) if ( cmap->cur_charcode >= 0xFFFFUL )
goto Fail; goto Fail;
charcode = cmap->cur_charcode + 1; charcode = (FT_UInt)cmap->cur_charcode + 1;
if ( charcode < cmap->cur_start ) if ( charcode < cmap->cur_start )
charcode = cmap->cur_start; charcode = cmap->cur_start;
@ -799,7 +799,7 @@
} }
Fail: Fail:
cmap->cur_charcode = 0xFFFFFFFFUL; cmap->cur_charcode = (FT_UInt32)0xFFFFFFFFUL;
cmap->cur_gindex = 0; cmap->cur_gindex = 0;
} }
@ -1088,7 +1088,7 @@
FT_UInt num_segs2, start, end, offset; FT_UInt num_segs2, start, end, offset;
FT_Int delta; FT_Int delta;
FT_UInt max, min, mid, num_segs; FT_UInt max, min, mid, num_segs;
FT_UInt charcode = *pcharcode; FT_UInt charcode = (FT_UInt)*pcharcode;
FT_UInt gindex = 0; FT_UInt gindex = 0;
FT_Byte* p; FT_Byte* p;
@ -1330,7 +1330,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap4_char_next( TT_CMap cmap, tt_cmap4_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -1481,7 +1481,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap6_char_next( TT_CMap cmap, tt_cmap6_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -1734,7 +1734,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap8_char_next( TT_CMap cmap, tt_cmap8_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -1892,7 +1892,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap10_char_next( TT_CMap cmap, tt_cmap10_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -2210,7 +2210,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap12_char_next( TT_CMap cmap, tt_cmap12_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -2228,8 +2228,10 @@
if ( cmap12->valid ) if ( cmap12->valid )
{ {
gindex = cmap12->cur_gindex; gindex = cmap12->cur_gindex;
/* XXX: check cur_charcode overflow is expected */
if ( gindex ) if ( gindex )
*pchar_code = cmap12->cur_charcode; *pchar_code = (FT_UInt32)cmap12->cur_charcode;
} }
else else
gindex = 0; gindex = 0;
@ -2237,7 +2239,8 @@
else else
gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 ); gindex = tt_cmap12_char_map_binary( cmap, pchar_code, 1 );
return gindex; /* XXX: check gindex overflow is expected */
return (FT_UInt32)gindex;
} }
@ -2526,12 +2529,12 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap13_char_next( TT_CMap cmap, tt_cmap13_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
TT_CMap13 cmap13 = (TT_CMap13)cmap; TT_CMap13 cmap13 = (TT_CMap13)cmap;
FT_ULong gindex; FT_UInt gindex;
if ( cmap13->cur_charcode >= 0xFFFFFFFFUL ) if ( cmap13->cur_charcode >= 0xFFFFFFFFUL )
@ -2664,7 +2667,7 @@
* cmap 14 query functions. The data is overwritten * cmap 14 query functions. The data is overwritten
* on each call to these functions. * on each call to these functions.
*/ */
FT_UInt max_results; FT_UInt32 max_results;
FT_UInt32* results; FT_UInt32* results;
FT_Memory memory; FT_Memory memory;
@ -2685,10 +2688,10 @@
static FT_Error static FT_Error
tt_cmap14_ensure( TT_CMap14 cmap, tt_cmap14_ensure( TT_CMap14 cmap,
FT_UInt num_results, FT_UInt32 num_results,
FT_Memory memory ) FT_Memory memory )
{ {
FT_UInt old_max = cmap->max_results; FT_UInt32 old_max = cmap->max_results;
FT_Error error = 0; FT_Error error = 0;
@ -2834,7 +2837,7 @@
} }
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt32 )
tt_cmap14_char_next( TT_CMap cmap, tt_cmap14_char_next( TT_CMap cmap,
FT_UInt32 *pchar_code ) FT_UInt32 *pchar_code )
{ {
@ -2912,7 +2915,7 @@
{ {
FT_UInt32 mid = ( min + max ) >> 1; FT_UInt32 mid = ( min + max ) >> 1;
FT_Byte* p = base + 5 * mid; FT_Byte* p = base + 5 * mid;
FT_UInt32 uni = TT_NEXT_UINT24( p ); FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
if ( char_code < uni ) if ( char_code < uni )
@ -2961,10 +2964,10 @@
FT_CALLBACK_DEF( FT_UInt ) FT_CALLBACK_DEF( FT_UInt )
tt_cmap14_char_var_index( TT_CMap cmap, tt_cmap14_char_var_index( TT_CMap cmap,
TT_CMap ucmap, TT_CMap ucmap,
FT_ULong charcode, FT_UInt32 charcode,
FT_ULong variantSelector) FT_UInt32 variantSelector)
{ {
FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector ); FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
FT_ULong defOff; FT_ULong defOff;
@ -2994,9 +2997,9 @@
FT_CALLBACK_DEF( FT_Int ) FT_CALLBACK_DEF( FT_Int )
tt_cmap14_char_var_isdefault( TT_CMap cmap, tt_cmap14_char_var_isdefault( TT_CMap cmap,
FT_ULong charcode, FT_UInt32 charcode,
FT_ULong variantSelector ) FT_UInt32 variantSelector )
{ {
FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector ); FT_Byte* p = tt_cmap14_find_variant( cmap->data + 6, variantSelector );
FT_ULong defOff; FT_ULong defOff;
@ -3027,10 +3030,10 @@
FT_Memory memory ) FT_Memory memory )
{ {
TT_CMap14 cmap14 = (TT_CMap14)cmap; TT_CMap14 cmap14 = (TT_CMap14)cmap;
FT_UInt count = cmap14->num_selectors; FT_UInt32 count = cmap14->num_selectors;
FT_Byte* p = cmap->data + 10; FT_Byte* p = cmap->data + 10;
FT_UInt32* result; FT_UInt32* result;
FT_UInt i; FT_UInt32 i;
if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) ) if ( tt_cmap14_ensure( cmap14, ( count + 1 ), memory ) )
@ -3039,7 +3042,7 @@
result = cmap14->results; result = cmap14->results;
for ( i = 0; i < count; ++i ) for ( i = 0; i < count; ++i )
{ {
result[i] = TT_NEXT_UINT24( p ); result[i] = (FT_UInt32)TT_NEXT_UINT24( p );
p += 8; p += 8;
} }
result[i] = 0; result[i] = 0;
@ -3051,10 +3054,10 @@
FT_CALLBACK_DEF( FT_UInt32 * ) FT_CALLBACK_DEF( FT_UInt32 * )
tt_cmap14_char_variants( TT_CMap cmap, tt_cmap14_char_variants( TT_CMap cmap,
FT_Memory memory, FT_Memory memory,
FT_ULong charCode ) FT_UInt32 charCode )
{ {
TT_CMap14 cmap14 = (TT_CMap14) cmap; TT_CMap14 cmap14 = (TT_CMap14) cmap;
FT_UInt count = cmap14->num_selectors; FT_UInt32 count = cmap14->num_selectors;
FT_Byte* p = cmap->data + 10; FT_Byte* p = cmap->data + 10;
FT_UInt32* q; FT_UInt32* q;
@ -3089,7 +3092,7 @@
static FT_UInt static FT_UInt
tt_cmap14_def_char_count( FT_Byte *p ) tt_cmap14_def_char_count( FT_Byte *p )
{ {
FT_UInt32 numRanges = TT_NEXT_ULONG( p ); FT_UInt32 numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
FT_UInt tot = 0; FT_UInt tot = 0;
@ -3116,14 +3119,14 @@
cnt = tt_cmap14_def_char_count( p ); cnt = tt_cmap14_def_char_count( p );
numRanges = TT_NEXT_ULONG( p ); numRanges = (FT_UInt32)TT_NEXT_ULONG( p );
if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) ) if ( tt_cmap14_ensure( cmap14, ( cnt + 1 ), memory ) )
return NULL; return NULL;
for ( q = cmap14->results; numRanges > 0; --numRanges ) for ( q = cmap14->results; numRanges > 0; --numRanges )
{ {
FT_UInt uni = TT_NEXT_UINT24( p ); FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p );
cnt = FT_NEXT_BYTE( p ) + 1; cnt = FT_NEXT_BYTE( p ) + 1;
@ -3151,7 +3154,7 @@
FT_UInt32 *ret; FT_UInt32 *ret;
numMappings = TT_NEXT_ULONG( p ); numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) ) if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) )
return NULL; return NULL;
@ -3159,7 +3162,7 @@
ret = cmap14->results; ret = cmap14->results;
for ( i = 0; i < numMappings; ++i ) for ( i = 0; i < numMappings; ++i )
{ {
ret[i] = TT_NEXT_UINT24( p ); ret[i] = (FT_UInt32)TT_NEXT_UINT24( p );
p += 2; p += 2;
} }
ret[i] = 0; ret[i] = 0;
@ -3171,7 +3174,7 @@
FT_CALLBACK_DEF( FT_UInt32 * ) FT_CALLBACK_DEF( FT_UInt32 * )
tt_cmap14_variant_chars( TT_CMap cmap, tt_cmap14_variant_chars( TT_CMap cmap,
FT_Memory memory, FT_Memory memory,
FT_ULong variantSelector ) FT_UInt32 variantSelector )
{ {
FT_Byte *p = tt_cmap14_find_variant( cmap->data + 6, FT_Byte *p = tt_cmap14_find_variant( cmap->data + 6,
variantSelector ); variantSelector );
@ -3213,9 +3216,9 @@
p = cmap->data + nondefOff; p = cmap->data + nondefOff;
dp = cmap->data + defOff; dp = cmap->data + defOff;
numMappings = TT_NEXT_ULONG( p ); numMappings = (FT_UInt32)TT_NEXT_ULONG( p );
dcnt = tt_cmap14_def_char_count( dp ); dcnt = tt_cmap14_def_char_count( dp );
numRanges = TT_NEXT_ULONG( dp ); numRanges = (FT_UInt32)TT_NEXT_ULONG( dp );
if ( numMappings == 0 ) if ( numMappings == 0 )
return tt_cmap14_get_def_chars( cmap, cmap->data + defOff, return tt_cmap14_get_def_chars( cmap, cmap->data + defOff,
@ -3228,10 +3231,10 @@
return NULL; return NULL;
ret = cmap14->results; ret = cmap14->results;
duni = TT_NEXT_UINT24( dp ); duni = (FT_UInt32)TT_NEXT_UINT24( dp );
dcnt = FT_NEXT_BYTE( dp ); dcnt = FT_NEXT_BYTE( dp );
di = 1; di = 1;
nuni = TT_NEXT_UINT24( p ); nuni = (FT_UInt32)TT_NEXT_UINT24( p );
p += 2; p += 2;
ni = 1; ni = 1;
i = 0; i = 0;
@ -3248,7 +3251,7 @@
if ( di > numRanges ) if ( di > numRanges )
break; break;
duni = TT_NEXT_UINT24( dp ); duni = (FT_UInt32)TT_NEXT_UINT24( dp );
dcnt = FT_NEXT_BYTE( dp ); dcnt = FT_NEXT_BYTE( dp );
} }
else else
@ -3261,7 +3264,7 @@
if ( ni > numMappings ) if ( ni > numMappings )
break; break;
nuni = TT_NEXT_UINT24( p ); nuni = (FT_UInt32)TT_NEXT_UINT24( p );
p += 2; p += 2;
} }
} }
@ -3274,7 +3277,7 @@
ret[i++] = nuni; ret[i++] = nuni;
while ( ni < numMappings ) while ( ni < numMappings )
{ {
ret[i++] = TT_NEXT_UINT24( p ); ret[i++] = (FT_UInt32)TT_NEXT_UINT24( p );
p += 2; p += 2;
++ni; ++ni;
} }
@ -3289,7 +3292,7 @@
while ( di < numRanges ) while ( di < numRanges )
{ {
duni = TT_NEXT_UINT24( dp ); duni = (FT_UInt32)TT_NEXT_UINT24( dp );
dcnt = FT_NEXT_BYTE( dp ); dcnt = FT_NEXT_BYTE( dp );
for ( k = 0; k <= dcnt; ++k ) for ( k = 0; k <= dcnt; ++k )

View File

@ -87,7 +87,7 @@
{ {
FT_UInt num_pairs, length, coverage; FT_UInt num_pairs, length, coverage;
FT_Byte* p_next; FT_Byte* p_next;
FT_UInt32 mask = 1UL << nn; FT_UInt32 mask = (FT_UInt32)1UL << nn;
if ( p + 6 > p_limit ) if ( p + 6 > p_limit )
@ -126,8 +126,8 @@
*/ */
if ( num_pairs > 0 ) if ( num_pairs > 0 )
{ {
FT_UInt count; FT_ULong count;
FT_UInt old_pair; FT_ULong old_pair;
old_pair = FT_NEXT_ULONG( p ); old_pair = FT_NEXT_ULONG( p );

View File

@ -275,7 +275,7 @@
/* need to define them to "float" or "double" when experimenting with */ /* need to define them to "float" or "double" when experimenting with */
/* new algorithms */ /* new algorithms */
typedef int TCoord; /* integer scanline/pixel coordinate */ typedef long TCoord; /* integer scanline/pixel coordinate */
typedef long TPos; /* sub-pixel coordinate */ typedef long TPos; /* sub-pixel coordinate */
/* determine the type used to store cell areas. This normally takes at */ /* determine the type used to store cell areas. This normally takes at */
@ -306,8 +306,8 @@
typedef struct TCell_ typedef struct TCell_
{ {
int x; TPos x; /* same with TWorker.ex */
int cover; TCoord cover; /* same with TWorker.cover */
TArea area; TArea area;
PCell next; PCell next;
@ -322,12 +322,12 @@
TPos count_ex, count_ey; TPos count_ex, count_ey;
TArea area; TArea area;
int cover; TCoord cover;
int invalid; int invalid;
PCell cells; PCell cells;
int max_cells; FT_PtrDist max_cells;
int num_cells; FT_PtrDist num_cells;
TCoord cx, cy; TCoord cx, cy;
TPos x, y; TPos x, y;
@ -359,7 +359,7 @@
long buffer_size; long buffer_size;
PCell* ycells; PCell* ycells;
int ycount; TPos ycount;
} TWorker, *PWorker; } TWorker, *PWorker;
@ -456,7 +456,7 @@
gray_find_cell( RAS_ARG ) gray_find_cell( RAS_ARG )
{ {
PCell *pcell, cell; PCell *pcell, cell;
int x = ras.ex; TPos x = ras.ex;
if ( x > ras.count_ex ) if ( x > ras.count_ex )
@ -588,9 +588,9 @@
TPos x2, TPos x2,
TCoord y2 ) TCoord y2 )
{ {
TCoord ex1, ex2, fx1, fx2, delta; TCoord ex1, ex2, fx1, fx2, delta, mod, lift, rem;
long p, first, dx; long p, first, dx;
int incr, lift, mod, rem; int incr;
dx = x2 - x1; dx = x2 - x1;
@ -612,7 +612,7 @@
if ( ex1 == ex2 ) if ( ex1 == ex2 )
{ {
delta = y2 - y1; delta = y2 - y1;
ras.area += (TArea)( fx1 + fx2 ) * delta; ras.area += (TArea)(( fx1 + fx2 ) * delta);
ras.cover += delta; ras.cover += delta;
return; return;
} }
@ -640,7 +640,7 @@
mod += (TCoord)dx; mod += (TCoord)dx;
} }
ras.area += (TArea)( fx1 + first ) * delta; ras.area += (TArea)(( fx1 + first ) * delta);
ras.cover += delta; ras.cover += delta;
ex1 += incr; ex1 += incr;
@ -670,7 +670,7 @@
delta++; delta++;
} }
ras.area += (TArea)ONE_PIXEL * delta; ras.area += (TArea)(ONE_PIXEL * delta);
ras.cover += delta; ras.cover += delta;
y1 += delta; y1 += delta;
ex1 += incr; ex1 += incr;
@ -679,7 +679,7 @@
} }
delta = y2 - y1; delta = y2 - y1;
ras.area += (TArea)( fx2 + ONE_PIXEL - first ) * delta; ras.area += (TArea)(( fx2 + ONE_PIXEL - first ) * delta);
ras.cover += delta; ras.cover += delta;
} }
@ -692,10 +692,10 @@
gray_render_line( RAS_ARG_ TPos to_x, gray_render_line( RAS_ARG_ TPos to_x,
TPos to_y ) TPos to_y )
{ {
TCoord ey1, ey2, fy1, fy2; TCoord ey1, ey2, fy1, fy2, mod;
TPos dx, dy, x, x2; TPos dx, dy, x, x2;
long p, first; long p, first;
int delta, rem, mod, lift, incr; int delta, rem, lift, incr;
ey1 = TRUNC( ras.last_ey ); ey1 = TRUNC( ras.last_ey );
@ -739,7 +739,7 @@
{ {
TCoord ex = TRUNC( ras.x ); TCoord ex = TRUNC( ras.x );
TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 ); TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 );
TPos area; TArea area;
first = ONE_PIXEL; first = ONE_PIXEL;
@ -1231,7 +1231,7 @@
gray_hline( RAS_ARG_ TCoord x, gray_hline( RAS_ARG_ TCoord x,
TCoord y, TCoord y,
TPos area, TPos area,
int acount ) TCoord acount )
{ {
FT_Span* span; FT_Span* span;
int count; int count;
@ -1271,6 +1271,10 @@
if ( x >= 32767 ) if ( x >= 32767 )
x = 32767; x = 32767;
/* FT_Span.y is an integer, so limit our coordinates appropriately */
if ( y >= FT_INT_MAX )
y = FT_INT_MAX;
if ( coverage ) if ( coverage )
{ {
/* see whether we can add this span to the current list */ /* see whether we can add this span to the current list */
@ -1309,7 +1313,7 @@
#endif /* FT_DEBUG_LEVEL_TRACE */ #endif /* FT_DEBUG_LEVEL_TRACE */
ras.num_gray_spans = 0; ras.num_gray_spans = 0;
ras.span_y = y; ras.span_y = (int)y;
count = 0; count = 0;
span = ras.gray_spans; span = ras.gray_spans;
@ -1345,7 +1349,7 @@
printf( "%3d:", yindex ); printf( "%3d:", yindex );
for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next ) for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
printf( " (%3d, c:%4d, a:%6d)", cell->x, cell->cover, cell->area ); printf( " (%3ld, c:%4ld, a:%6d)", cell->x, cell->cover, cell->area );
printf( "\n" ); printf( "\n" );
} }
} }
@ -1377,7 +1381,7 @@
for ( ; cell != NULL; cell = cell->next ) for ( ; cell != NULL; cell = cell->next )
{ {
TArea area; TPos area;
if ( cell->x > x && cover != 0 ) if ( cell->x > x && cover != 0 )

View File

@ -196,6 +196,10 @@
#endif #endif
#if FT_UINT_MAX > 0xFFFFU
/* if pitch or height is not FT_UInt, check must be enabled */
if ( pitch > 0xFFFF || height > 0xFFFF ) if ( pitch > 0xFFFF || height > 0xFFFF )
{ {
FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n", FT_ERROR(( "ft_smooth_render_generic: glyph too large: %d x %d\n",
@ -203,6 +207,8 @@
return Smooth_Err_Raster_Overflow; return Smooth_Err_Raster_Overflow;
} }
#endif
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY; bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
bitmap->num_grays = 256; bitmap->num_grays = 256;
bitmap->width = width; bitmap->width = width;
@ -319,12 +325,19 @@
FT_Outline_Translate( outline, x_shift, y_shift ); FT_Outline_Translate( outline, x_shift, y_shift );
/*
* XXX: on 16bit system, we return an error for huge bitmap
* to prevent an overflow.
*/
if ( x_left > FT_INT_MAX || y_top > FT_INT_MAX )
return Smooth_Err_Invalid_Pixel_Size;
if ( error ) if ( error )
goto Exit; goto Exit;
slot->format = FT_GLYPH_FORMAT_BITMAP; slot->format = FT_GLYPH_FORMAT_BITMAP;
slot->bitmap_left = x_left; slot->bitmap_left = (FT_Int)x_left;
slot->bitmap_top = y_top; slot->bitmap_top = (FT_Int)y_top;
Exit: Exit:
if ( outline && origin ) if ( outline && origin )

View File

@ -63,7 +63,7 @@
int int
dummy_get_index( const char* name, dummy_get_index( const char* name,
FT_UInt len, FT_Offset len,
void* user_data ) void* user_data )
{ {
if ( len ) if ( len )

Some files were not shown because too many files have changed in this diff Show More