Fix clang fixes.

* src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate): Use
correct types.

* src/cff/cf2intrp.c (cf2_interpT2CharString) <default>: Force
unsigned for computations.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Ditto.
* src/cff/cffparse.c (cff_parse_integer): Ditto.

* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
This commit is contained in:
Werner Lemberg 2013-05-04 18:57:56 +02:00
parent 77c39b1deb
commit e6e8362728
6 changed files with 39 additions and 24 deletions

View File

@ -1,3 +1,17 @@
2013-05-04 Werner Lemberg <wl@gnu.org>
Fix clang fixes.
* src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate): Use
correct types.
* src/cff/cf2intrp.c (cf2_interpT2CharString) <default>: Force
unsigned for computations.
* src/cff/cffgload.c (cff_decoder_parse_charstrings): Ditto.
* src/cff/cffparse.c (cff_parse_integer): Ditto.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto.
2013-05-04 Werner Lemberg <wl@gnu.org> 2013-05-04 Werner Lemberg <wl@gnu.org>
[cff] Make Adobe CFF engine work correctly on 64bit hosts. [cff] Make Adobe CFF engine work correctly on 64bit hosts.

View File

@ -119,7 +119,7 @@
static FT_Int static FT_Int
ft_trig_prenorm( FT_Vector* vec ) ft_trig_prenorm( FT_Vector* vec )
{ {
FT_Fixed x, y; FT_Pos x, y;
FT_Int shift; FT_Int shift;
@ -131,8 +131,8 @@
if ( shift <= FT_TRIG_SAFE_MSB ) if ( shift <= FT_TRIG_SAFE_MSB )
{ {
shift = FT_TRIG_SAFE_MSB - shift; shift = FT_TRIG_SAFE_MSB - shift;
vec->x = (FT_Fixed)( (FT_UInt32)x << shift ); vec->x = (FT_Pos)( (FT_ULong)x << shift );
vec->y = (FT_Fixed)( (FT_UInt32)y << shift ); vec->y = (FT_Pos)( (FT_ULong)y << shift );
} }
else else
{ {
@ -392,8 +392,8 @@
else else
{ {
shift = -shift; shift = -shift;
vec->x = (FT_Fixed)( (FT_UInt32)v.x << shift ); vec->x = (FT_Pos)( (FT_ULong)v.x << shift );
vec->y = (FT_Fixed)( (FT_UInt32)v.y << shift ); vec->y = (FT_Pos)( (FT_ULong)v.y << shift );
} }
} }
} }

View File

@ -1458,10 +1458,11 @@
CF2_Fixed v; CF2_Fixed v;
v = (CF2_Fixed)( ( cf2_buf_readByte( charstring ) << 24 ) | v = (CF2_Fixed)
( cf2_buf_readByte( charstring ) << 16 ) | ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) |
( cf2_buf_readByte( charstring ) << 8 ) | ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) |
cf2_buf_readByte( charstring ) ); ( (FT_UInt32)cf2_buf_readByte( charstring ) << 8 ) |
(FT_UInt32)cf2_buf_readByte( charstring ) );
FT_TRACE4(( " %.2f", v / 65536.0 )); FT_TRACE4(( " %.2f", v / 65536.0 ));

View File

@ -975,7 +975,7 @@
{ {
if ( ip + 1 >= limit ) if ( ip + 1 >= limit )
goto Syntax_Error; goto Syntax_Error;
val = (FT_Short)( ( ip[0] << 8 ) | ip[1] ); val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] );
ip += 2; ip += 2;
} }
else if ( v < 247 ) else if ( v < 247 )
@ -996,10 +996,10 @@
{ {
if ( ip + 3 >= limit ) if ( ip + 3 >= limit )
goto Syntax_Error; goto Syntax_Error;
val = (FT_Int32)( ( ip[0] << 24 ) | val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
( ip[1] << 16 ) | ( (FT_UInt32)ip[1] << 16 ) |
( ip[2] << 8 ) | ( (FT_UInt32)ip[2] << 8 ) |
ip[3] ); (FT_UInt32)ip[3] );
ip += 4; ip += 4;
if ( charstring_type == 2 ) if ( charstring_type == 2 )
shift = 0; shift = 0;

View File

@ -65,7 +65,7 @@
if ( p + 2 > limit ) if ( p + 2 > limit )
goto Bad; goto Bad;
val = (FT_Short)( ( p[0] << 8 ) | p[1] ); val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] );
p += 2; p += 2;
} }
else if ( v == 29 ) else if ( v == 29 )
@ -73,10 +73,10 @@
if ( p + 4 > limit ) if ( p + 4 > limit )
goto Bad; goto Bad;
val = (FT_Long)( ( p[0] << 24 ) | val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) |
( p[1] << 16 ) | ( (FT_ULong)p[1] << 16 ) |
( p[2] << 8 ) | ( (FT_ULong)p[2] << 8 ) |
p[3] ); (FT_ULong)p[3] );
p += 4; p += 4;
} }
else if ( v < 247 ) else if ( v < 247 )

View File

@ -565,10 +565,10 @@
goto Syntax_Error; goto Syntax_Error;
} }
value = (FT_Int32)( ( ip[0] << 24 ) | value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) |
( ip[1] << 16 ) | ( (FT_UInt32)ip[1] << 16 ) |
( ip[2] << 8 ) | ( (FT_UInt32)ip[2] << 8 ) |
ip[3] ); (FT_UInt32)ip[3] );
ip += 4; ip += 4;
/* According to the specification, values > 32000 or < -32000 must */ /* According to the specification, values > 32000 or < -32000 must */