forked from minhngoc25a/freetype2
Fix clang warnings.
* src/gxvalid/gxvcmmn.h (GXV_SET_ERR_IF_PARANOID): Use 'do' block. * src/gxvalid/gxvmod.c (GXV_TABLE_LOAD, GXV_TABLE_VALIDATE): Ditto. * src/smooth/ftgrays.c (gray_convert_glyph): Add cast. * src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String): Remove cast. * src/type1/t1load.c (read_binay_data): Use `FT_ULong` for `size` parameter. (parse_subrs, parse_charstrings, parse_dict): Ditto; also add some casts.
This commit is contained in:
parent
9597fd7b40
commit
d31bafcb9c
|
@ -61,8 +61,11 @@ FT_BEGIN_HEADER
|
||||||
|
|
||||||
#undef GXV_LOAD_UNUSED_VARS /* debug purpose */
|
#undef GXV_LOAD_UNUSED_VARS /* debug purpose */
|
||||||
|
|
||||||
#define IS_PARANOID_VALIDATION ( gxvalid->root->level >= FT_VALIDATE_PARANOID )
|
#define IS_PARANOID_VALIDATION \
|
||||||
#define GXV_SET_ERR_IF_PARANOID( err ) { if ( IS_PARANOID_VALIDATION ) ( err ); }
|
( gxvalid->root->level >= FT_VALIDATE_PARANOID )
|
||||||
|
#define GXV_SET_ERR_IF_PARANOID( err ) \
|
||||||
|
do { if ( IS_PARANOID_VALIDATION ) ( err ); } while ( 0 )
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
|
|
@ -77,6 +77,8 @@
|
||||||
FT_ULong len_ ## _sfnt = 0
|
FT_ULong len_ ## _sfnt = 0
|
||||||
|
|
||||||
#define GXV_TABLE_LOAD( _sfnt ) \
|
#define GXV_TABLE_LOAD( _sfnt ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
|
if ( ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) && \
|
||||||
( gx_flags & FT_VALIDATE_ ## _sfnt ) ) \
|
( gx_flags & FT_VALIDATE_ ## _sfnt ) ) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -84,9 +86,12 @@
|
||||||
&_sfnt, &len_ ## _sfnt ); \
|
&_sfnt, &len_ ## _sfnt ); \
|
||||||
if ( error ) \
|
if ( error ) \
|
||||||
goto Exit; \
|
goto Exit; \
|
||||||
}
|
} \
|
||||||
|
} while ( 0 )
|
||||||
|
|
||||||
#define GXV_TABLE_VALIDATE( _sfnt ) \
|
#define GXV_TABLE_VALIDATE( _sfnt ) \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
if ( _sfnt ) \
|
if ( _sfnt ) \
|
||||||
{ \
|
{ \
|
||||||
ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
|
ft_validator_init( &valid, _sfnt, _sfnt + len_ ## _sfnt, \
|
||||||
|
@ -96,7 +101,8 @@
|
||||||
error = valid.error; \
|
error = valid.error; \
|
||||||
if ( error ) \
|
if ( error ) \
|
||||||
goto Exit; \
|
goto Exit; \
|
||||||
}
|
} \
|
||||||
|
} while ( 0 )
|
||||||
|
|
||||||
#define GXV_TABLE_SET( _sfnt ) \
|
#define GXV_TABLE_SET( _sfnt ) \
|
||||||
if ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) \
|
if ( FT_VALIDATE_ ## _sfnt ## _INDEX < table_count ) \
|
||||||
|
|
|
@ -1986,7 +1986,7 @@ typedef ptrdiff_t FT_PtrDist;
|
||||||
ras.ycells[w] = ras.cell_null;
|
ras.ycells[w] = ras.cell_null;
|
||||||
|
|
||||||
/* memory management: skip ycells */
|
/* memory management: skip ycells */
|
||||||
n = ( width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
|
n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
|
||||||
sizeof ( TCell );
|
sizeof ( TCell );
|
||||||
|
|
||||||
ras.cell_free = buffer + n;
|
ras.cell_free = buffer + n;
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
/* For ordinary fonts get the character data stored in the face record. */
|
/* For ordinary fonts get the character data stored in the face record. */
|
||||||
{
|
{
|
||||||
char_string->pointer = type1->charstrings[glyph_index];
|
char_string->pointer = type1->charstrings[glyph_index];
|
||||||
char_string->length = (FT_Int)type1->charstrings_len[glyph_index];
|
char_string->length = type1->charstrings_len[glyph_index];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !error )
|
if ( !error )
|
||||||
|
|
|
@ -1346,7 +1346,7 @@
|
||||||
|
|
||||||
static int
|
static int
|
||||||
read_binary_data( T1_Parser parser,
|
read_binary_data( T1_Parser parser,
|
||||||
FT_Long* size,
|
FT_ULong* size,
|
||||||
FT_Byte** base,
|
FT_Byte** base,
|
||||||
FT_Bool incremental )
|
FT_Bool incremental )
|
||||||
{
|
{
|
||||||
|
@ -1378,7 +1378,7 @@
|
||||||
if ( s >= 0 && s < limit - *base )
|
if ( s >= 0 && s < limit - *base )
|
||||||
{
|
{
|
||||||
parser->root.cursor += s + 1;
|
parser->root.cursor += s + 1;
|
||||||
*size = s;
|
*size = (FT_ULong)s;
|
||||||
return !parser->root.error;
|
return !parser->root.error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1803,7 +1803,7 @@
|
||||||
for ( count = 0; ; count++ )
|
for ( count = 0; ; count++ )
|
||||||
{
|
{
|
||||||
FT_Long idx;
|
FT_Long idx;
|
||||||
FT_Long size;
|
FT_ULong size;
|
||||||
FT_Byte* base;
|
FT_Byte* base;
|
||||||
|
|
||||||
|
|
||||||
|
@ -1861,7 +1861,7 @@
|
||||||
/* some fonts define empty subr records -- this is not totally */
|
/* some fonts define empty subr records -- this is not totally */
|
||||||
/* compliant to the specification (which says they should at */
|
/* compliant to the specification (which says they should at */
|
||||||
/* least contain a `return'), but we support them anyway */
|
/* least contain a `return'), but we support them anyway */
|
||||||
if ( size < face->type1.private_dict.lenIV )
|
if ( size < (FT_ULong)face->type1.private_dict.lenIV )
|
||||||
{
|
{
|
||||||
error = FT_THROW( Invalid_File_Format );
|
error = FT_THROW( Invalid_File_Format );
|
||||||
goto Fail;
|
goto Fail;
|
||||||
|
@ -1872,7 +1872,7 @@
|
||||||
goto Fail;
|
goto Fail;
|
||||||
FT_MEM_COPY( temp, base, size );
|
FT_MEM_COPY( temp, base, size );
|
||||||
psaux->t1_decrypt( temp, size, 4330 );
|
psaux->t1_decrypt( temp, size, 4330 );
|
||||||
size -= face->type1.private_dict.lenIV;
|
size -= (FT_ULong)face->type1.private_dict.lenIV;
|
||||||
error = T1_Add_Table( table, (FT_Int)idx,
|
error = T1_Add_Table( table, (FT_Int)idx,
|
||||||
temp + face->type1.private_dict.lenIV, size );
|
temp + face->type1.private_dict.lenIV, size );
|
||||||
FT_FREE( temp );
|
FT_FREE( temp );
|
||||||
|
@ -1977,7 +1977,7 @@
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
FT_Long size;
|
FT_ULong size;
|
||||||
FT_Byte* base;
|
FT_Byte* base;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2071,7 +2071,7 @@
|
||||||
FT_Byte* temp = NULL;
|
FT_Byte* temp = NULL;
|
||||||
|
|
||||||
|
|
||||||
if ( size <= face->type1.private_dict.lenIV )
|
if ( size <= (FT_ULong)face->type1.private_dict.lenIV )
|
||||||
{
|
{
|
||||||
error = FT_THROW( Invalid_File_Format );
|
error = FT_THROW( Invalid_File_Format );
|
||||||
goto Fail;
|
goto Fail;
|
||||||
|
@ -2082,7 +2082,7 @@
|
||||||
goto Fail;
|
goto Fail;
|
||||||
FT_MEM_COPY( temp, base, size );
|
FT_MEM_COPY( temp, base, size );
|
||||||
psaux->t1_decrypt( temp, size, 4330 );
|
psaux->t1_decrypt( temp, size, 4330 );
|
||||||
size -= face->type1.private_dict.lenIV;
|
size -= (FT_ULong)face->type1.private_dict.lenIV;
|
||||||
error = T1_Add_Table( code_table, n,
|
error = T1_Add_Table( code_table, n,
|
||||||
temp + face->type1.private_dict.lenIV, size );
|
temp + face->type1.private_dict.lenIV, size );
|
||||||
FT_FREE( temp );
|
FT_FREE( temp );
|
||||||
|
@ -2334,7 +2334,7 @@
|
||||||
else if ( *cur == 'R' && cur + 6 < limit && *(cur + 1) == 'D' &&
|
else if ( *cur == 'R' && cur + 6 < limit && *(cur + 1) == 'D' &&
|
||||||
have_integer )
|
have_integer )
|
||||||
{
|
{
|
||||||
FT_Long s;
|
FT_ULong s;
|
||||||
FT_Byte* b;
|
FT_Byte* b;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2347,7 +2347,7 @@
|
||||||
else if ( *cur == '-' && cur + 6 < limit && *(cur + 1) == '|' &&
|
else if ( *cur == '-' && cur + 6 < limit && *(cur + 1) == '|' &&
|
||||||
have_integer )
|
have_integer )
|
||||||
{
|
{
|
||||||
FT_Long s;
|
FT_ULong s;
|
||||||
FT_Byte* b;
|
FT_Byte* b;
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue