diff --git a/ChangeLog b/ChangeLog index 765fd6eb2..80913fe65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2013-05-04 Werner Lemberg + + Fix clang fixes. + + * src/base/fttrigon.c (ft_trig_prenorm, FT_Vector_Rotate): Use + correct types. + + * src/cff/cf2intrp.c (cf2_interpT2CharString) : 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 [cff] Make Adobe CFF engine work correctly on 64bit hosts. diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c index 77521fe23..09719ad4d 100644 --- a/src/base/fttrigon.c +++ b/src/base/fttrigon.c @@ -119,8 +119,8 @@ static FT_Int ft_trig_prenorm( FT_Vector* vec ) { - FT_Fixed x, y; - FT_Int shift; + FT_Pos x, y; + FT_Int shift; x = vec->x; @@ -131,8 +131,8 @@ if ( shift <= FT_TRIG_SAFE_MSB ) { shift = FT_TRIG_SAFE_MSB - shift; - vec->x = (FT_Fixed)( (FT_UInt32)x << shift ); - vec->y = (FT_Fixed)( (FT_UInt32)y << shift ); + vec->x = (FT_Pos)( (FT_ULong)x << shift ); + vec->y = (FT_Pos)( (FT_ULong)y << shift ); } else { @@ -392,8 +392,8 @@ else { shift = -shift; - vec->x = (FT_Fixed)( (FT_UInt32)v.x << shift ); - vec->y = (FT_Fixed)( (FT_UInt32)v.y << shift ); + vec->x = (FT_Pos)( (FT_ULong)v.x << shift ); + vec->y = (FT_Pos)( (FT_ULong)v.y << shift ); } } } diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 6814f6465..bdf87c3e9 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -1458,10 +1458,11 @@ CF2_Fixed v; - v = (CF2_Fixed)( ( cf2_buf_readByte( charstring ) << 24 ) | - ( cf2_buf_readByte( charstring ) << 16 ) | - ( cf2_buf_readByte( charstring ) << 8 ) | - cf2_buf_readByte( charstring ) ); + v = (CF2_Fixed) + ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) | + ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) | + ( (FT_UInt32)cf2_buf_readByte( charstring ) << 8 ) | + (FT_UInt32)cf2_buf_readByte( charstring ) ); FT_TRACE4(( " %.2f", v / 65536.0 )); diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c index 0ca29d4d0..6f9a045c8 100644 --- a/src/cff/cffgload.c +++ b/src/cff/cffgload.c @@ -975,7 +975,7 @@ { if ( ip + 1 >= limit ) goto Syntax_Error; - val = (FT_Short)( ( ip[0] << 8 ) | ip[1] ); + val = (FT_Short)( ( (FT_UShort)ip[0] << 8 ) | ip[1] ); ip += 2; } else if ( v < 247 ) @@ -996,10 +996,10 @@ { if ( ip + 3 >= limit ) goto Syntax_Error; - val = (FT_Int32)( ( ip[0] << 24 ) | - ( ip[1] << 16 ) | - ( ip[2] << 8 ) | - ip[3] ); + val = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); ip += 4; if ( charstring_type == 2 ) shift = 0; diff --git a/src/cff/cffparse.c b/src/cff/cffparse.c index 1c55cff58..96222120b 100644 --- a/src/cff/cffparse.c +++ b/src/cff/cffparse.c @@ -65,7 +65,7 @@ if ( p + 2 > limit ) goto Bad; - val = (FT_Short)( ( p[0] << 8 ) | p[1] ); + val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] ); p += 2; } else if ( v == 29 ) @@ -73,10 +73,10 @@ if ( p + 4 > limit ) goto Bad; - val = (FT_Long)( ( p[0] << 24 ) | - ( p[1] << 16 ) | - ( p[2] << 8 ) | - p[3] ); + val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) | + ( (FT_ULong)p[1] << 16 ) | + ( (FT_ULong)p[2] << 8 ) | + (FT_ULong)p[3] ); p += 4; } else if ( v < 247 ) diff --git a/src/psaux/t1decode.c b/src/psaux/t1decode.c index 60d4d4bc2..6ce370bfa 100644 --- a/src/psaux/t1decode.c +++ b/src/psaux/t1decode.c @@ -565,10 +565,10 @@ goto Syntax_Error; } - value = (FT_Int32)( ( ip[0] << 24 ) | - ( ip[1] << 16 ) | - ( ip[2] << 8 ) | - ip[3] ); + value = (FT_Int32)( ( (FT_UInt32)ip[0] << 24 ) | + ( (FT_UInt32)ip[1] << 16 ) | + ( (FT_UInt32)ip[2] << 8 ) | + (FT_UInt32)ip[3] ); ip += 4; /* According to the specification, values > 32000 or < -32000 must */