From c9c64388403a4e73b1d2686c5d6c4a91111b4f49 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 1 Aug 2009 00:32:14 +0900 Subject: [PATCH] sfnt: Cast a character code to FT_UInt32 for LP64 system. --- ChangeLog | 13 +++++++++++++ src/sfnt/ttcmap.c | 30 +++++++++++++++--------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6812348db..4b266eedb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-07-31 suzuki toshiya + + sfnt: Cast a character code to FT_UInt32 for LP64 system. + + * src/sfnt/ttcmap.c (tt_cmap14_char_map_nondef_binary, + tt_cmap14_variants, tt_cmap14_char_variants, + tt_cmap14_def_char_count, tt_cmap14_get_def_chars, + tt_cmap14_get_nondef_chars, tt_cmap14_variant_chars) + Insert casts when FT_UInt32 variable is loaded by + TT_NEXT_{UINT24|ULONG}. Because most of them are + compared with FT_UInt32 values in public API, replacing + FT_UFast is not recommended. + 2009-07-31 suzuki toshiya sfnt: Cast a character code to FT_UInt32 for LP64 system. diff --git a/src/sfnt/ttcmap.c b/src/sfnt/ttcmap.c index c55afe2ba..0aeae5003 100644 --- a/src/sfnt/ttcmap.c +++ b/src/sfnt/ttcmap.c @@ -2912,7 +2912,7 @@ { FT_UInt32 mid = ( min + max ) >> 1; 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 ) @@ -3039,7 +3039,7 @@ result = cmap14->results; for ( i = 0; i < count; ++i ) { - result[i] = TT_NEXT_UINT24( p ); + result[i] = (FT_UInt32)TT_NEXT_UINT24( p ); p += 8; } result[i] = 0; @@ -3089,7 +3089,7 @@ static FT_UInt 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; @@ -3116,14 +3116,14 @@ 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 ) ) return NULL; for ( q = cmap14->results; numRanges > 0; --numRanges ) { - FT_UInt32 uni = TT_NEXT_UINT24( p ); + FT_UInt32 uni = (FT_UInt32)TT_NEXT_UINT24( p ); cnt = FT_NEXT_BYTE( p ) + 1; @@ -3151,7 +3151,7 @@ FT_UInt32 *ret; - numMappings = TT_NEXT_ULONG( p ); + numMappings = (FT_UInt32)TT_NEXT_ULONG( p ); if ( tt_cmap14_ensure( cmap14, ( numMappings + 1 ), memory ) ) return NULL; @@ -3159,7 +3159,7 @@ ret = cmap14->results; for ( i = 0; i < numMappings; ++i ) { - ret[i] = TT_NEXT_UINT24( p ); + ret[i] = (FT_UInt32)TT_NEXT_UINT24( p ); p += 2; } ret[i] = 0; @@ -3213,9 +3213,9 @@ p = cmap->data + nondefOff; dp = cmap->data + defOff; - numMappings = TT_NEXT_ULONG( p ); + numMappings = (FT_UInt32)TT_NEXT_ULONG( p ); dcnt = tt_cmap14_def_char_count( dp ); - numRanges = TT_NEXT_ULONG( dp ); + numRanges = (FT_UInt32)TT_NEXT_ULONG( dp ); if ( numMappings == 0 ) return tt_cmap14_get_def_chars( cmap, cmap->data + defOff, @@ -3228,10 +3228,10 @@ return NULL; ret = cmap14->results; - duni = TT_NEXT_UINT24( dp ); + duni = (FT_UInt32)TT_NEXT_UINT24( dp ); dcnt = FT_NEXT_BYTE( dp ); di = 1; - nuni = TT_NEXT_UINT24( p ); + nuni = (FT_UInt32)TT_NEXT_UINT24( p ); p += 2; ni = 1; i = 0; @@ -3248,7 +3248,7 @@ if ( di > numRanges ) break; - duni = TT_NEXT_UINT24( dp ); + duni = (FT_UInt32)TT_NEXT_UINT24( dp ); dcnt = FT_NEXT_BYTE( dp ); } else @@ -3261,7 +3261,7 @@ if ( ni > numMappings ) break; - nuni = TT_NEXT_UINT24( p ); + nuni = (FT_UInt32)TT_NEXT_UINT24( p ); p += 2; } } @@ -3274,7 +3274,7 @@ ret[i++] = nuni; while ( ni < numMappings ) { - ret[i++] = TT_NEXT_UINT24( p ); + ret[i++] = (FT_UInt32)TT_NEXT_UINT24( p ); p += 2; ++ni; } @@ -3289,7 +3289,7 @@ while ( di < numRanges ) { - duni = TT_NEXT_UINT24( dp ); + duni = (FT_UInt32)TT_NEXT_UINT24( dp ); dcnt = FT_NEXT_BYTE( dp ); for ( k = 0; k <= dcnt; ++k )