shithub: freetype+ttf2subf

Download patch

ref: e6e8362728e2d644835c705ce735c8cc8f4a20a5
parent: 77c39b1deb0d44f1a642335ae72af66b91271cf9
author: Werner Lemberg <[email protected]>
date: Sat May 4 14:57:56 EDT 2013

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.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2013-05-04  Werner Lemberg  <[email protected]>
 
+	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  <[email protected]>
+
 	[cff] Make Adobe CFF engine work correctly on 64bit hosts.
 
 	Reported by numerous people on the `freetype-devel' list.  Without
--- 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 );
       }
     }
   }
--- 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 ));
 
--- 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;
--- 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 )
--- 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 */