diff --git a/include/freetype/internal/psaux.h b/include/freetype/internal/psaux.h index d2dabc7fe..76cbebdba 100644 --- a/include/freetype/internal/psaux.h +++ b/include/freetype/internal/psaux.h @@ -276,7 +276,7 @@ FT_BEGIN_HEADER { \ sizeof ( _ident ) - 1, \ _ident, T1CODE, _type, \ - 0, \ + NULL, \ FT_FIELD_OFFSET( _fname ), \ FT_FIELD_SIZE( _fname ), \ 0, 0, \ @@ -297,7 +297,7 @@ FT_BEGIN_HEADER { \ sizeof ( _ident ) - 1, \ _ident, T1CODE, _type, \ - 0, \ + NULL, \ FT_FIELD_OFFSET( _fname ), \ FT_FIELD_SIZE_DELTA( _fname ), \ _max, \ @@ -309,7 +309,7 @@ FT_BEGIN_HEADER { \ sizeof ( _ident ) - 1, \ _ident, T1CODE, _type, \ - 0, \ + NULL, \ FT_FIELD_OFFSET( _fname ), \ FT_FIELD_SIZE_DELTA( _fname ), \ _max, 0, \ @@ -359,6 +359,8 @@ FT_BEGIN_HEADER #define T1_FIELD_CALLBACK( _ident, _name, _dict ) \ T1_NEW_CALLBACK_FIELD( _ident, _name, _dict ) +#define T1_FIELD_ZERO { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 } + /*************************************************************************/ /*************************************************************************/ diff --git a/src/cid/cidload.c b/src/cid/cidload.c index 356673a61..7984a45f9 100644 --- a/src/cid/cidload.c +++ b/src/cid/cidload.c @@ -388,7 +388,7 @@ T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 ) T1_FIELD_CALLBACK( "FontName", parse_font_name, 0 ) - { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 } + T1_FIELD_ZERO }; @@ -469,15 +469,11 @@ T1_Field keyword = (T1_Field)cid_field_records; - for (;;) + while ( keyword->len ) { - FT_Byte* name; + FT_Byte* name = (FT_Byte*)keyword->ident; - name = (FT_Byte*)keyword->ident; - if ( !name ) - break; - if ( keyword->len == len && ft_memcmp( cur, name, len ) == 0 ) { @@ -489,6 +485,7 @@ return parser->root.error; break; } + keyword++; } } diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 6a2d2801d..5acd52a47 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -2284,7 +2284,7 @@ T1_FIELD_DICT_PRIVATE ) #endif - { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 } + T1_FIELD_ZERO }; @@ -2392,15 +2392,11 @@ T1_Field keyword = (T1_Field)t1_keywords; - for (;;) + while ( keyword->len ) { - FT_Byte* name; + FT_Byte* name = (FT_Byte*)keyword->ident; - name = (FT_Byte*)keyword->ident; - if ( !name ) - break; - if ( keyword->len == len && ft_memcmp( cur, name, len ) == 0 ) { diff --git a/src/type42/t42parse.c b/src/type42/t42parse.c index 71654c7b3..889bd1803 100644 --- a/src/type42/t42parse.c +++ b/src/type42/t42parse.c @@ -99,7 +99,7 @@ T1_FIELD_CALLBACK( "CharStrings", t42_parse_charstrings, 0 ) T1_FIELD_CALLBACK( "sfnts", t42_parse_sfnts, 0 ) - { 0, NULL, 0, 0, NULL, 0, 0, 0, 0, 0 } + T1_FIELD_ZERO }; @@ -1195,8 +1195,6 @@ { T42_Parser parser = &loader->parser; FT_Byte* limit; - FT_Int n_keywords = (FT_Int)( sizeof ( t42_keywords ) / - sizeof ( t42_keywords[0] ) ); parser->root.cursor = base; @@ -1273,16 +1271,13 @@ if ( len > 0 && len < 22 && parser->root.cursor < limit ) { - int i; + T1_Field keyword = (T1_Field)t42_keywords; /* now compare the immediate name to the keyword table */ - - /* loop through all known keywords */ - for ( i = 0; i < n_keywords; i++ ) + while ( keyword->len ) { - T1_Field keyword = (T1_Field)&t42_keywords[i]; - FT_Byte *name = (FT_Byte*)keyword->ident; + FT_Byte* name = (FT_Byte*)keyword->ident; if ( !name ) @@ -1299,6 +1294,8 @@ return parser->root.error; break; } + + keyword++; } } }