From dc8ad54f1064430115c93ab88dd968c31782ccdd Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Tue, 9 Dec 2003 02:12:14 +0000 Subject: [PATCH] * include/freetype/internal/psaux.h (PS_TableRec): Change type of `lengths' to FT_PtrDist. (T1_DecoderRec): Change type of `subrs_len' to FT_PtrDist. * include/freetype/internal/t1types.h (T1_FontRec): Change type of `subrs_len' and `charstrings_len' to FT_PtrDist. * src/base/ftobjs.c (Mac_Read_POST_Resource): Replace `junk' variable with better solution. (IsMacResource): Remove unused variable `map_len'. Replace `junk' variable with better solution. (FT_Open_Face) [!FT_MACINTOSH]: Add conditional FT_CONFIG_OPTION_MAC_FONTS. * src/autohint/ahhint.c (ah_hinter_hint_edges, ah_hinter_align_strong_points): Add some casts. * src/base/ftoutln.c (FT_OrientationExtremumRec): Change type of `pos' to FT_Long. * src/base/ftobjs.c (Mac_Read_POST_Resource, Mac_Read_sfnt_Resource): Change type of `len' to FT_Long. * src/type42/t42parse.c (t42_parse_dict): Add cast for `n_keywords'. --- ChangeLog | 28 ++++++++++++++++++++++ include/freetype/internal/psaux.h | 4 ++-- include/freetype/internal/t1types.h | 4 ++-- src/autohint/ahhint.c | 4 ++-- src/base/ftobjs.c | 36 +++++++++++++---------------- src/base/ftoutln.c | 8 +++---- src/psaux/psobjs.c | 2 +- src/type42/t42parse.c | 4 ++-- 8 files changed, 57 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ff28eb7a..9b9f670e7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2003-12-08 Werner Lemberg + + * include/freetype/internal/psaux.h (PS_TableRec): Change type + of `lengths' to FT_PtrDist. + (T1_DecoderRec): Change type of `subrs_len' to FT_PtrDist. + * include/freetype/internal/t1types.h (T1_FontRec): Change type + of `subrs_len' and `charstrings_len' to FT_PtrDist. + + * src/base/ftobjs.c (Mac_Read_POST_Resource): Replace `junk' + variable with better solution. + (IsMacResource): Remove unused variable `map_len'. + Replace `junk' variable with better solution. + (FT_Open_Face) [!FT_MACINTOSH]: Add conditional + FT_CONFIG_OPTION_MAC_FONTS. + +2003-12-08 Wolfgang Domröse + + * src/autohint/ahhint.c (ah_hinter_hint_edges, + ah_hinter_align_strong_points): Add some casts. + + * src/base/ftoutln.c (FT_OrientationExtremumRec): Change type + of `pos' to FT_Long. + + * src/base/ftobjs.c (Mac_Read_POST_Resource, + Mac_Read_sfnt_Resource): Change type of `len' to FT_Long. + + * src/type42/t42parse.c (t42_parse_dict): Add cast for `n_keywords'. + 2003-12-07 Werner Lemberg * docs/raster.txt: New file, taken from FreeType 1 and completely diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index e013d52fa..8d419be08 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -124,7 +124,7 @@ FT_BEGIN_HEADER FT_Int max_elems; FT_Int num_elems; FT_Byte** elements; /* addresses of table elements */ - FT_Int* lengths; /* lengths of table elements */ + FT_PtrDist* lengths; /* lengths of table elements */ FT_Memory memory; PS_Table_FuncsRec funcs; @@ -658,7 +658,7 @@ FT_BEGIN_HEADER FT_Int lenIV; /* internal for sub routine calls */ FT_UInt num_subrs; FT_Byte** subrs; - FT_Int* subrs_len; /* array of subrs length (optional) */ + FT_PtrDist* subrs_len; /* array of subrs length (optional) */ FT_Matrix font_matrix; FT_Vector font_offset; diff --git a/include/freetype/internal/t1types.h b/include/freetype/internal/t1types.h index 08bdfb1a2..8de9a6b91 100644 --- a/include/freetype/internal/t1types.h +++ b/include/freetype/internal/t1types.h @@ -102,12 +102,12 @@ FT_BEGIN_HEADER FT_Int num_subrs; FT_Byte** subrs; - FT_Int* subrs_len; + FT_PtrDist* subrs_len; FT_Int num_glyphs; FT_String** glyph_names; /* array of glyph names */ FT_Byte** charstrings; /* array of glyph charstrings */ - FT_Int* charstrings_len; + FT_PtrDist* charstrings_len; FT_Byte paint_type; FT_Byte font_type; diff --git a/src/autohint/ahhint.c b/src/autohint/ahhint.c index 4a10bd56e..aad5725fa 100644 --- a/src/autohint/ahhint.c +++ b/src/autohint/ahhint.c @@ -703,7 +703,7 @@ /* the third (lowest) stem aligns with the base line; it might end up */ /* one pixel higher or lower. */ - n_edges = edge_limit - edges; + n_edges = (FT_Int)( edge_limit - edges ); if ( !dimension && ( n_edges == 6 || n_edges == 12 ) ) { AH_EdgeRec *edge1, *edge2, *edge3; @@ -943,7 +943,7 @@ /* find enclosing edges */ min = 0; - max = edge_limit - edges; + max = (FT_UInt)( edge_limit - edges ); while ( min < max ) { diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index 69f74c07e..8d1c5fa2a 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -1135,9 +1135,10 @@ FT_Error error = FT_Err_Cannot_Open_Resource; FT_Memory memory = library->memory; FT_Byte* pfb_data; - int i, type, flags, len; + int i, type, flags; + FT_Long len; FT_Long pfb_len, pfb_pos, pfb_lenpos; - FT_Long rlen, junk, temp; + FT_Long rlen, temp; FT_Long *offsets; @@ -1156,12 +1157,11 @@ /* Find all the POST resource offsets */ for ( i = 0; i < resource_cnt; ++i ) { - (void)FT_READ_USHORT( junk ); /* resource id */ - (void)FT_READ_USHORT( junk ); /* rsource name */ + (void)FT_STREAM_SKIP( 4 ); /* resource id and resource name */ if ( FT_READ_LONG( temp ) ) goto Exit; offsets[i] = resource_data + ( temp & 0xFFFFFFL ); - (void)FT_READ_LONG( junk ); /* mbz */ + (void)FT_STREAM_SKIP( 4 ); /* mbz */ } /* Find the length of all the POST resources, concatenated. Assume */ @@ -1273,7 +1273,7 @@ FT_Error error; int i; FT_Long flag_offset= 0xFFFFFFL; - FT_Long rlen, junk; + FT_Long rlen; int is_cff; @@ -1288,12 +1288,11 @@ for ( i = 0; i <= face_index; ++i ) { - (void)FT_READ_USHORT( junk ); /* resource id */ - (void)FT_READ_USHORT( junk ); /* rsource name */ + (void)FT_STREAM_SKIP( 4 ); /* resource id and resource name */ if ( FT_READ_LONG( flag_offset ) ) goto Exit; flag_offset &= 0xFFFFFFL; - (void)FT_READ_LONG( junk ); /* mbz */ + (void)FT_STREAM_SKIP( 4 ); /* mbz */ } if ( flag_offset == 0xFFFFFFL ) @@ -1344,9 +1343,9 @@ { FT_Error error; unsigned char head[16], head2[16]; - FT_Long rdata_pos, map_pos, rdata_len, map_len; + FT_Long rdata_pos, map_pos, rdata_len; int allzeros, allmatch, i, cnt, subcnt; - FT_Long type_list, rpos, junk; + FT_Long type_list, rpos; FT_ULong tag; @@ -1369,10 +1368,7 @@ ( head[ 9] << 16 ) | ( head[10] << 8 ) | head[11]; - map_len = ( head[12] << 24 ) | - ( head[13] << 16 ) | - ( head[14] << 8 ) | - head[15]; + /* map_len = head[12] .. head[15] */ if ( rdata_pos + rdata_len != map_pos || map_pos == resource_offset ) return FT_Err_Unknown_File_Format; @@ -1402,9 +1398,9 @@ /* If we've gotten this far then it's probably a mac resource file. */ /* Now, does it contain any interesting resources? */ - (void)FT_READ_LONG( junk ); /* skip handle to next resource map */ - (void)FT_READ_USHORT( junk ); /* skip file resource number */ - (void)FT_READ_USHORT( junk ); /* skip attributes */ + /* Skip handle to next resource map, the file resource number, and */ + /* attributes. */ + (void)FT_STREAM_SKIP( 4 + 2 + 2 ); if ( FT_READ_USHORT( type_list ) ) goto Exit; @@ -1675,7 +1671,7 @@ FT_ERROR_BASE( error ) != FT_Err_Invalid_Stream_Operation ) goto Fail2; -#ifndef FT_MACINTOSH +#if !defined( FT_MACINTOSH ) && defined( FT_CONFIG_OPTION_MAC_FONTS ) error = load_mac_face( library, stream, face_index, aface, args ); if ( !error ) { @@ -1690,7 +1686,7 @@ if ( FT_ERROR_BASE( error ) != FT_Err_Unknown_File_Format ) goto Fail2; -#endif /* !FT_MACINTOSH */ +#endif /* !FT_MACINTOSH && FT_CONFIG_OPTION_MAC_FONTS */ /* no driver is able to handle this format */ error = FT_Err_Unknown_File_Format; diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c index c19e2105c..5bcdf137d 100644 --- a/src/base/ftoutln.c +++ b/src/base/ftoutln.c @@ -658,10 +658,10 @@ typedef struct FT_OrientationExtremumRec_ { - FT_Int index; - FT_Int pos; - FT_Int first; - FT_Int last; + FT_Int index; + FT_Long pos; + FT_Int first; + FT_Int last; } FT_OrientationExtremumRec; diff --git a/src/psaux/psobjs.c b/src/psaux/psobjs.c index 826947db0..7f495308a 100644 --- a/src/psaux/psobjs.c +++ b/src/psaux/psobjs.c @@ -142,7 +142,7 @@ /* table :: The target table. */ /* */ /* */ - /* idx :: The index of the object in the table. */ + /* idx :: The index of the object in the table. */ /* */ /* object :: The address of the object to copy in memory. */ /* */ diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index 20dcb90ed..bf9794790 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -964,8 +964,8 @@ { T42_Parser parser = &loader->parser; FT_Byte* limit; - int n_keywords = sizeof ( t42_keywords ) / - sizeof ( t42_keywords[0] ); + FT_Int n_keywords = (FT_Int)( sizeof ( t42_keywords ) / + sizeof ( t42_keywords[0] ) ); parser->root.cursor = base;