Don't use `FT_PtrDist' for lengths.

Use FT_UInt instead.

* include/internal/psaux.h (PS_Table_FuncsRec, PS_TableRec,
T1_DecoderRec): Do it.

* include/internal/t1types.h (T1_FontRec): Ditto.

* src/cid/cidload.c (cid_parse_dict): Updated.
* src/pfr/pfrload.c (pfr_extra_item_load_font_id): Ditto.
* src/psaux/psobjs.c (ps_table_add), src/psaux/psobjs.h: Ditto.
* src/type1/t1load.c (parse_blend_axis_types, parse_encoding,
parse_chharstrings, parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_encoding, t42_parse_charstrings,
t42_parse_dict): Ditto.
This commit is contained in:
Werner Lemberg 2015-02-18 09:22:06 +01:00
parent 6a0ded7641
commit 6bd7d28fc7
9 changed files with 69 additions and 56 deletions

View File

@ -1,3 +1,22 @@
2015-02-18 Werner Lemberg <wl@gnu.org>
Don't use `FT_PtrDist' for lengths.
Use FT_UInt instead.
* include/internal/psaux.h (PS_Table_FuncsRec, PS_TableRec,
T1_DecoderRec): Do it.
* include/internal/t1types.h (T1_FontRec): Ditto.
* src/cid/cidload.c (cid_parse_dict): Updated.
* src/pfr/pfrload.c (pfr_extra_item_load_font_id): Ditto.
* src/psaux/psobjs.c (ps_table_add), src/psaux/psobjs.h: Ditto.
* src/type1/t1load.c (parse_blend_axis_types, parse_encoding,
parse_chharstrings, parse_dict): Ditto.
* src/type42/t42parse.c (t42_parse_encoding, t42_parse_charstrings,
t42_parse_dict): Ditto.
2015-02-18 Werner Lemberg <wl@gnu.org>
* src/type1/t1driver.c (t1_ps_get_font_value): Clean up.

View File

@ -71,10 +71,10 @@ FT_BEGIN_HEADER
(*done)( PS_Table table );
FT_Error
(*add)( PS_Table table,
FT_Int idx,
void* object,
FT_PtrDist length );
(*add)( PS_Table table,
FT_Int idx,
void* object,
FT_UInt length );
void
(*release)( PS_Table table );
@ -127,7 +127,7 @@ FT_BEGIN_HEADER
FT_Int max_elems;
FT_Int num_elems;
FT_Byte** elements; /* addresses of table elements */
FT_PtrDist* lengths; /* lengths of table elements */
FT_UInt* lengths; /* lengths of table elements */
FT_Memory memory;
PS_Table_FuncsRec funcs;
@ -677,7 +677,7 @@ FT_BEGIN_HEADER
FT_Int lenIV; /* internal for sub routine calls */
FT_UInt num_subrs;
FT_Byte** subrs;
FT_PtrDist* subrs_len; /* array of subrs length (optional) */
FT_UInt* subrs_len; /* array of subrs length (optional) */
FT_Matrix font_matrix;
FT_Vector font_offset;

View File

@ -106,12 +106,12 @@ FT_BEGIN_HEADER
FT_Int num_subrs;
FT_Byte** subrs;
FT_PtrDist* subrs_len;
FT_UInt* subrs_len;
FT_Int num_glyphs;
FT_String** glyph_names; /* array of glyph names */
FT_Byte** charstrings; /* array of glyph charstrings */
FT_PtrDist* charstrings_len;
FT_UInt* charstrings_len;
FT_Byte paint_type;
FT_Byte font_type;

View File

@ -342,11 +342,11 @@
/* look for immediates */
if ( *cur == '/' && cur + 2 < limit )
{
FT_PtrDist len;
FT_UInt len;
cur++;
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
if ( len > 0 && len < 22 )
{
@ -363,10 +363,10 @@
if ( !name )
break;
if ( cur[0] == name[0] &&
len == (FT_PtrDist)ft_strlen( (const char*)name ) )
if ( cur[0] == name[0] &&
len == ft_strlen( (const char*)name ) )
{
FT_PtrDist n;
FT_UInt n;
for ( n = 1; n < len; n++ )

View File

@ -449,9 +449,9 @@
FT_Byte* limit,
PFR_PhyFont phy_font )
{
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
FT_PtrDist len = limit - p;
FT_Error error = FT_Err_Ok;
FT_Memory memory = phy_font->memory;
FT_UInt len = (FT_UInt)( limit - p );
if ( phy_font->font_id != NULL )

View File

@ -165,10 +165,10 @@
/* reallocation fails. */
/* */
FT_LOCAL_DEF( FT_Error )
ps_table_add( PS_Table table,
FT_Int idx,
void* object,
FT_PtrDist length )
ps_table_add( PS_Table table,
FT_Int idx,
void* object,
FT_UInt length )
{
if ( idx < 0 || idx >= table->max_elems )
{
@ -176,12 +176,6 @@
return FT_THROW( Invalid_Argument );
}
if ( length < 0 )
{
FT_ERROR(( "ps_table_add: invalid length\n" ));
return FT_THROW( Invalid_Argument );
}
/* grow the base block if needed */
if ( table->cursor + length > table->capacity )
{
@ -932,7 +926,7 @@
FT_Memory memory )
{
FT_Byte* cur = *cursor;
FT_PtrDist len = 0;
FT_UInt len = 0;
FT_Int count;
FT_String* result;
FT_Error error;
@ -972,7 +966,7 @@
}
}
len = cur - *cursor;
len = (FT_UInt)( cur - *cursor );
if ( cur >= limit || FT_ALLOC( result, len + 1 ) )
return 0;

View File

@ -52,10 +52,10 @@ FT_BEGIN_HEADER
FT_Memory memory );
FT_LOCAL( FT_Error )
ps_table_add( PS_Table table,
FT_Int idx,
void* object,
FT_PtrDist length );
ps_table_add( PS_Table table,
FT_Int idx,
void* object,
FT_UInt length );
FT_LOCAL( void )
ps_table_done( PS_Table table );

View File

@ -599,23 +599,23 @@
/* each token is an immediate containing the name of the axis */
for ( n = 0; n < num_axis; n++ )
{
T1_Token token = axis_tokens + n;
FT_Byte* name;
FT_PtrDist len;
T1_Token token = axis_tokens + n;
FT_Byte* name;
FT_UInt len;
/* skip first slash, if any */
if ( token->start[0] == '/' )
token->start++;
len = token->limit - token->start;
len = (FT_UInt)( token->limit - token->start );
if ( len == 0 )
{
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
if ( FT_ALLOC( blend->axis_names[n], (FT_Long)( len + 1 ) ) )
if ( FT_ALLOC( blend->axis_names[n], len + 1 ) )
goto Exit;
name = (FT_Byte*)blend->axis_names[n];
@ -1285,7 +1285,7 @@
if ( cur + 2 < limit && *cur == '/' && n < count )
{
FT_PtrDist len;
FT_UInt len;
cur++;
@ -1297,7 +1297,7 @@
if ( parser->root.error )
return;
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
parser->root.error = T1_Add_Table( char_table, charcode,
cur, len + 1 );
@ -1606,7 +1606,7 @@
if ( *cur == '/' )
{
FT_PtrDist len;
FT_UInt len;
if ( cur + 2 >= limit )
@ -1616,7 +1616,7 @@
}
cur++; /* skip `/' */
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) )
return;
@ -1928,7 +1928,7 @@
/* look for immediates */
else if ( *cur == '/' && cur + 2 < limit )
{
FT_PtrDist len;
FT_UInt len;
cur++;
@ -1938,7 +1938,7 @@
if ( parser->root.error )
goto Exit;
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
if ( len > 0 && len < 22 && parser->root.cursor < limit )
{
@ -1955,9 +1955,9 @@
if ( !name )
break;
if ( cur[0] == name[0] &&
len == (FT_PtrDist)ft_strlen( (const char *)name ) &&
ft_memcmp( cur, name, len ) == 0 )
if ( cur[0] == name[0] &&
len == ft_strlen( (const char *)name ) &&
ft_memcmp( cur, name, len ) == 0 )
{
/* We found it -- run the parsing callback! */
/* We record every instance of every field */

View File

@ -433,7 +433,7 @@
if ( cur + 2 < limit && *cur == '/' && n < count )
{
FT_PtrDist len;
FT_UInt len;
cur++;
@ -445,7 +445,7 @@
if ( parser->root.error )
return;
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
parser->root.error = T1_Add_Table( char_table, charcode,
cur, len + 1 );
@ -873,7 +873,7 @@
if ( *cur == '/' )
{
FT_PtrDist len;
FT_UInt len;
if ( cur + 2 >= limit )
@ -884,7 +884,7 @@
}
cur++; /* skip `/' */
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
error = T1_Add_Table( name_table, n, cur, len + 1 );
if ( error )
@ -914,7 +914,7 @@
goto Fail;
}
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
error = T1_Add_Table( code_table, n, cur, len + 1 );
if ( error )
@ -1135,7 +1135,7 @@
/* look for immediates */
else if ( *cur == '/' && cur + 2 < limit )
{
FT_PtrDist len;
FT_UInt len;
cur++;
@ -1145,7 +1145,7 @@
if ( parser->root.error )
goto Exit;
len = parser->root.cursor - cur;
len = (FT_UInt)( parser->root.cursor - cur );
if ( len > 0 && len < 22 && parser->root.cursor < limit )
{
@ -1164,9 +1164,9 @@
if ( !name )
continue;
if ( cur[0] == name[0] &&
len == (FT_PtrDist)ft_strlen( (const char *)name ) &&
ft_memcmp( cur, name, len ) == 0 )
if ( cur[0] == name[0] &&
len == ft_strlen( (const char *)name ) &&
ft_memcmp( cur, name, len ) == 0 )
{
/* we found it -- run the parsing callback! */
parser->root.error = t42_load_keyword( face,