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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
diff --git a/ChangeLog b/ChangeLog
index 765fd6e..80913fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
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>
+
[cff] Make Adobe CFF engine work correctly on 64bit hosts.
Reported by numerous people on the `freetype-devel' list. Without
diff --git a/src/base/fttrigon.c b/src/base/fttrigon.c
index 77521fe..09719ad 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 6814f64..bdf87c3 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 0ca29d4..6f9a045 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 1c55cff..9622212 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 60d4d4b..6ce370b 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 */