shithub: freetype+ttf2subf

Download patch

ref: 981c23b75eb78ea2e30bf70643d61ab603453bc9
parent: 3f92048ab1cf44f280d4511fa42de1bea8449744
author: Werner Lemberg <[email protected]>
date: Wed Mar 15 07:35:26 EDT 2017

Remove clang compiler warnings (#50548).

* include/freetype/internal/tttypes.h (TT_FaceRec): Make
`var_postscript_prefix_len' unsigned.

* src/autofit/afwarp.c (af_warper_compute_line_best): Remove
redundant assignment.

* src/cff/cffload.c (cff_subfont_load): Add casts.

* src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment.

* src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static'
keyword.
Add casts.
(fixed2float): Add cast.
(sfnt_get_var_ps_name): Make `p' always initialized.
Add casts.

* src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,28 @@
 2017-03-15  Werner Lemberg  <[email protected]>
 
+	Remove clang compiler warnings (#50548).
+
+	* include/freetype/internal/tttypes.h (TT_FaceRec): Make
+	`var_postscript_prefix_len' unsigned.
+
+	* src/autofit/afwarp.c (af_warper_compute_line_best): Remove
+	redundant assignment.
+
+	* src/cff/cffload.c (cff_subfont_load): Add casts.
+
+	* src/cff/cffparse.c (cff_parse_blend): Remove redundant assignment.
+
+	* src/sfnt/sfdriver.c (fmix32, murmur_hash_3_128): Add `static'
+	keyword.
+	Add casts.
+	(fixed2float): Add cast.
+	(sfnt_get_var_ps_name): Make `p' always initialized.
+	Add casts.
+
+	* src/truetype/ttgxvar.c (TT_Get_MM_Var): Add casts.
+
+2017-03-15  Werner Lemberg  <[email protected]>
+
 	[ftfuzzer] Limit number of tested faces and instances.
 
 	This is inspired by the discussion in and analysis of
--- a/include/freetype/internal/tttypes.h
+++ b/include/freetype/internal/tttypes.h
@@ -1513,7 +1513,7 @@
     FT_UInt32             variation_support;     /* since 2.7.1 */
 
     const char*           var_postscript_prefix;     /* since 2.7.2 */
-    FT_Int                var_postscript_prefix_len; /* since 2.7.2 */
+    FT_UInt               var_postscript_prefix_len; /* since 2.7.2 */
 
 #endif
 
--- a/src/autofit/afwarp.c
+++ b/src/autofit/afwarp.c
@@ -98,7 +98,6 @@
       if ( xx1min + w < warper->x2min )
         xx1min = warper->x2min - w;
 
-      xx1max = warper->x1max;
       if ( xx1max + w > warper->x2max )
         xx1max = warper->x2max - w;
 
--- a/src/cff/cffload.c
+++ b/src/cff/cffload.c
@@ -2084,7 +2084,8 @@
         {
           do
           {
-            driver->random_seed = (FT_Int32)cff_random( driver->random_seed );
+            driver->random_seed =
+              (FT_Int32)cff_random( (FT_UInt32)driver->random_seed );
 
           } while ( driver->random_seed < 0 );
         }
@@ -2097,7 +2098,7 @@
           do
           {
             face->root.internal->random_seed =
-              (FT_Int32)cff_random( face->root.internal->random_seed );
+              (FT_Int32)cff_random( (FT_UInt32)face->root.internal->random_seed );
 
           } while ( face->root.internal->random_seed < 0 );
         }
--- a/src/cff/cffparse.c
+++ b/src/cff/cffparse.c
@@ -894,8 +894,6 @@
     FT_Error     error;
 
 
-    error = FT_ERR( Stack_Underflow );
-
     if ( !priv || !priv->subfont )
     {
       error = FT_THROW( Invalid_File_Format );
--- a/src/sfnt/sfdriver.c
+++ b/src/sfnt/sfdriver.c
@@ -271,7 +271,7 @@
 #define ROTL32( x, r )  ( x << r ) | ( x >> ( 32 - r ) )
 
 
-  FT_UInt32
+  static FT_UInt32
   fmix32( FT_UInt32  h )
   {
     h ^= h >> 16;
@@ -284,14 +284,14 @@
   }
 
 
-  void
-  murmur_hash_3_128( const void*  key,
-                     const int    len,
-                     FT_UInt32    seed,
-                     void*        out )
+  static void
+  murmur_hash_3_128( const void*         key,
+                     const unsigned int  len,
+                     FT_UInt32           seed,
+                     void*               out )
   {
     const FT_Byte*  data    = (const FT_Byte*)key;
-    const int       nblocks = len / 16;
+    const int       nblocks = (int)len / 16;
 
     FT_UInt32  h1 = seed;
     FT_UInt32  h2 = seed;
@@ -365,11 +365,11 @@
       switch ( len & 15 )
       {
       case 15:
-        k4 ^= tail[14] << 16;
+        k4 ^= (FT_UInt32)tail[14] << 16;
       case 14:
-        k4 ^= tail[13] << 8;
+        k4 ^= (FT_UInt32)tail[13] << 8;
       case 13:
-        k4 ^= tail[12] << 0;
+        k4 ^= (FT_UInt32)tail[12];
         k4 *= c4;
         k4  = ROTL32( k4, 18 );
         k4 *= c1;
@@ -376,13 +376,13 @@
         h4 ^= k4;
 
       case 12:
-        k3 ^= tail[11] << 24;
+        k3 ^= (FT_UInt32)tail[11] << 24;
       case 11:
-        k3 ^= tail[10] << 16;
+        k3 ^= (FT_UInt32)tail[10] << 16;
       case 10:
-        k3 ^= tail[9] << 8;
+        k3 ^= (FT_UInt32)tail[9] << 8;
       case 9:
-        k3 ^= tail[8] << 0;
+        k3 ^= (FT_UInt32)tail[8];
         k3 *= c3;
         k3  = ROTL32( k3, 17 );
         k3 *= c4;
@@ -389,13 +389,13 @@
         h3 ^= k3;
 
       case 8:
-        k2 ^= tail[7] << 24;
+        k2 ^= (FT_UInt32)tail[7] << 24;
       case 7:
-        k2 ^= tail[6] << 16;
+        k2 ^= (FT_UInt32)tail[6] << 16;
       case 6:
-        k2 ^= tail[5] << 8;
+        k2 ^= (FT_UInt32)tail[5] << 8;
       case 5:
-        k2 ^= tail[4] << 0;
+        k2 ^= (FT_UInt32)tail[4];
         k2 *= c2;
         k2  = ROTL32( k2, 16 );
         k2 *= c3;
@@ -402,13 +402,13 @@
         h2 ^= k2;
 
       case 4:
-        k1 ^= tail[3] << 24;
+        k1 ^= (FT_UInt32)tail[3] << 24;
       case 3:
-        k1 ^= tail[2] << 16;
+        k1 ^= (FT_UInt32)tail[2] << 16;
       case 2:
-        k1 ^= tail[1] << 8;
+        k1 ^= (FT_UInt32)tail[1] << 8;
       case 1:
-        k1 ^= tail[0] << 0;
+        k1 ^= (FT_UInt32)tail[0];
         k1 *= c1;
         k1  = ROTL32( k1, 15 );
         k1 *= c2;
@@ -699,7 +699,7 @@
     /* get digits of fractional part */
     for ( i = 0; i < 5; i++ )
     {
-      *p++ = '0' + frac_part / 0x10000L;
+      *p++ = '0' + (char)( frac_part / 0x10000L );
 
       frac_part %= 0x10000L;
       if ( !frac_part )
@@ -875,6 +875,8 @@
       if ( ps_name )
       {
         result = ps_name;
+        p      = result + ft_strlen( result ) + 1;
+
         goto check_length;
       }
       else
@@ -940,7 +942,7 @@
 
       for ( i = 0; i < num_coords; i++, coords++, axis++ )
       {
-        FT_ULong  t;
+        char  t;
 
 
         /* omit axis value descriptor if it is identical */
@@ -951,16 +953,16 @@
         *p++ = '_';
         p    = fixed2float( *coords, p );
 
-        t = axis->tag >> 24 & 0xFF;
+        t = (char)( axis->tag >> 24 );
         if ( t != ' ' && ft_isalnum( t ) )
           *p++ = t;
-        t = axis->tag >> 16 & 0xFF;
+        t = (char)( axis->tag >> 16 );
         if ( t != ' ' && ft_isalnum( t ) )
           *p++ = t;
-        t = axis->tag >> 8 & 0xFF;
+        t = (char)( axis->tag >> 8 );
         if ( t != ' ' && ft_isalnum( t ) )
           *p++ = t;
-        t = axis->tag & 0xFF;
+        t = (char)axis->tag;
         if ( t != ' ' && ft_isalnum( t ) )
           *p++ = t;
       }
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -2205,8 +2205,8 @@
 
             ns = &mmvar->namedstyle[fvar_head.instanceCount];
 
-            ns->strid = strid;
-            ns->psid  = psid;
+            ns->strid = (FT_UInt)strid;
+            ns->psid  = (FT_UInt)psid;
 
             a = mmvar->axis;
             c = ns->coords;