Commit 015c6e08a1e87b421b1dfcff313eeba024f4bc14

Werner Lemberg 2016-03-01T06:45:52

Fix clang warnings. * src/autofit/aflatin.c (af_latin_hints_compute_segments): Use FT_UShort for `min_flags' and `max_flags'. Initialize `prev_*' variables. * src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Fix types of local variables. * src/smooth/ftgrays.c (gray_dump_cells) [FT_DEBUG_LEVEL_TRACE]: Update `printf' format string. * src/tools/ftfuzzer/ftfuzzer.cc (setIntermediateAxis): Add cast. (LLVMFuzzerTestOneInput): Fix loop type.

diff --git a/ChangeLog b/ChangeLog
index eed0966..eb556d2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2016-03-01  Werner Lemberg  <wl@gnu.org>
+
+	Fix clang warnings.
+
+	* src/autofit/aflatin.c (af_latin_hints_compute_segments): Use
+	FT_UShort for `min_flags' and `max_flags'.
+	Initialize `prev_*' variables.
+
+	* src/cff/cffobjs.c (cff_face_init) [FT_DEBUG_LEVEL_TRACE]: Fix
+	types of local variables.
+
+	* src/smooth/ftgrays.c (gray_dump_cells) [FT_DEBUG_LEVEL_TRACE]:
+	Update `printf' format string.
+
+	* src/tools/ftfuzzer/ftfuzzer.cc (setIntermediateAxis): Add cast.
+	(LLVMFuzzerTestOneInput): Fix loop type.
+
 2016-02-29  Werner Lemberg  <wl@gnu.org>
 
 	[autofit] Add blue-zone support for Sinhala script.
diff --git a/src/autofit/aflatin.c b/src/autofit/aflatin.c
index f94190f..ff0954c 100644
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -1443,27 +1443,27 @@
       /* we call values measured along a segment (point->v)    */
       /* `coordinates', and values orthogonal to it (point->u) */
       /* `positions'                                           */
-      FT_Pos  min_pos      =  32000;
-      FT_Pos  max_pos      = -32000;
-      FT_Pos  min_coord    =  32000;
-      FT_Pos  max_coord    = -32000;
-      FT_Pos  min_flags    =  AF_FLAG_NONE;
-      FT_Pos  max_flags    =  AF_FLAG_NONE;
-      FT_Pos  min_on_coord =  32000;
-      FT_Pos  max_on_coord = -32000;
+      FT_Pos     min_pos      =  32000;
+      FT_Pos     max_pos      = -32000;
+      FT_Pos     min_coord    =  32000;
+      FT_Pos     max_coord    = -32000;
+      FT_UShort  min_flags    =  AF_FLAG_NONE;
+      FT_UShort  max_flags    =  AF_FLAG_NONE;
+      FT_Pos     min_on_coord =  32000;
+      FT_Pos     max_on_coord = -32000;
 
       FT_Bool  passed;
 
       AF_Segment  prev_segment = NULL;
 
-      FT_Pos     prev_min_pos;
-      FT_Pos     prev_max_pos;
-      FT_Pos     prev_min_coord;
-      FT_Pos     prev_max_coord;
-      FT_UShort  prev_min_flags;
-      FT_UShort  prev_max_flags;
-      FT_Pos     prev_min_on_coord;
-      FT_Pos     prev_max_on_coord;
+      FT_Pos     prev_min_pos      = min_pos;
+      FT_Pos     prev_max_pos      = max_pos;
+      FT_Pos     prev_min_coord    = min_coord;
+      FT_Pos     prev_max_coord    = max_coord;
+      FT_UShort  prev_min_flags    = min_flags;
+      FT_UShort  prev_max_flags    = max_flags;
+      FT_Pos     prev_min_on_coord = min_on_coord;
+      FT_Pos     prev_max_on_coord = max_on_coord;
 
 
       if ( point == last )  /* skip singletons -- just in case */
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 52fd0ec..b49616d 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -638,13 +638,13 @@
         /* We thus access `cff->strings' directly.                      */
         for ( idx = 1; idx < cff->num_strings; idx++ )
         {
-          FT_Byte*  s1    = cff->strings[idx - 1];
-          FT_Byte*  s2    = cff->strings[idx];
-          size_t    s1len = s2 - s1 - 1; /* without the final NULL byte */
-          size_t    l;
+          FT_Byte*    s1    = cff->strings[idx - 1];
+          FT_Byte*    s2    = cff->strings[idx];
+          FT_PtrDist  s1len = s2 - s1 - 1; /* without the final NULL byte */
+          FT_PtrDist  l;
 
 
-          FT_TRACE4(( "  %5d ", idx + 390, s ));
+          FT_TRACE4(( "  %5d ", idx + 390 ));
           for ( l = 0; l < s1len; l++ )
             FT_TRACE4(( "%c", s1[l] ));
           FT_TRACE4(( "\n" ));
@@ -653,13 +653,13 @@
         /* print last element */
         if ( cff->num_strings )
         {
-          FT_Byte*  s1    = cff->strings[cff->num_strings - 1];
-          FT_Byte*  s2    = cff->string_pool + cff->string_pool_size;
-          size_t    s1len = s2 - s1 - 1;
-          size_t    l;
+          FT_Byte*    s1    = cff->strings[cff->num_strings - 1];
+          FT_Byte*    s2    = cff->string_pool + cff->string_pool_size;
+          FT_PtrDist  s1len = s2 - s1 - 1;
+          FT_PtrDist  l;
 
 
-          FT_TRACE4(( "  %5d ", cff->num_strings + 390, s ));
+          FT_TRACE4(( "  %5d ", cff->num_strings + 390 ));
           for ( l = 0; l < s1len; l++ )
             FT_TRACE4(( "%c", s1[l] ));
           FT_TRACE4(( "\n" ));
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 9411cf9..d6d0e25 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -1503,7 +1503,8 @@ typedef ptrdiff_t  FT_PtrDist;
       printf( "%3d:", yindex );
 
       for ( cell = ras.ycells[yindex]; cell != NULL; cell = cell->next )
-        printf( " (%3ld, c:%4ld, a:%6d)", cell->x, cell->cover, cell->area );
+        printf( " (%3ld, c:%4ld, a:%6ld)",
+                cell->x, cell->cover, cell->area );
       printf( "\n" );
     }
   }
diff --git a/src/tools/ftfuzzer/ftfuzzer.cc b/src/tools/ftfuzzer/ftfuzzer.cc
index 7df7abc..39f2b39 100644
--- a/src/tools/ftfuzzer/ftfuzzer.cc
+++ b/src/tools/ftfuzzer/ftfuzzer.cc
@@ -161,7 +161,7 @@
                     variations->axis[i].def     ) / 2;
 
     if ( FT_Set_Var_Design_Coordinates( face,
-                                        coords.size(),
+                                        FT_UInt( coords.size() ),
                                         coords.data() ) )
       return;
   }
@@ -248,7 +248,7 @@
 
         // loop over all bitmap stroke sizes
         // and an arbitrary size for outlines
-        for ( long  fixed_sizes_index = 0;
+        for ( int  fixed_sizes_index = 0;
               fixed_sizes_index < face->num_fixed_sizes + 1;
               fixed_sizes_index++ )
         {