[type1, cid, type42] Post-cleanup.

* include/freetype/internal/psaux.h (T1_FIELD_ZERO): Terminating macro.
* src/cid/cidload.c (cid_parse_dict): Use while-loop.
* src/type1/t1load.c (parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_dict): Ditto.
This commit is contained in:
Alexei Podtelezhnikov 2023-09-09 22:20:00 -04:00
parent 3302e2f60c
commit 8d0897b37d
4 changed files with 18 additions and 26 deletions

View File

@ -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 }
/*************************************************************************/
/*************************************************************************/

View File

@ -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++;
}
}

View File

@ -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 )
{

View File

@ -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++;
}
}
}