Commit eb1bba9be421ebf2eb95cfb9c6129836b96009fa

Werner Lemberg 2015-06-30T09:46:39

Fix some clang compiler warnings. * src/base/ftoutln.c (FT_Outline_EmboldenXY), src/cff/cf2intrp.c (cf2_interpT2CharString), src/truetype/ttgload.c (load_truetype_glyph), src/truetype/ttgxvar.c (tt_handle_deltas), src/truetype/ttinterp.c (Ins_INSTCTRL): Fix signedness issues.

diff --git a/ChangeLog b/ChangeLog
index eb6a627..11b2064 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2015-06-30  Werner Lemberg  <wl@gnu.org>
+
+	Fix some clang compiler warnings.
+
+	* src/base/ftoutln.c (FT_Outline_EmboldenXY), src/cff/cf2intrp.c
+	(cf2_interpT2CharString), src/truetype/ttgload.c
+	(load_truetype_glyph), src/truetype/ttgxvar.c (tt_handle_deltas),
+	src/truetype/ttinterp.c (Ins_INSTCTRL): Fix signedness issues.
+
 2015-06-29  Alexei Podtelezhnikov <apodtele@gmail.com>
 
 	[truetype] Speed up bytecode interpreter.
@@ -8,7 +17,8 @@
 
 	[base] Speed up emboldening.
 
-	* src/base/ftoutln.c (FT_Outline_EmboldenXY): Use `FT_Vector_NormLen'.
+	* src/base/ftoutln.c (FT_Outline_EmboldenXY): Use
+	`FT_Vector_NormLen'.
 
 2015-06-29  Alexei Podtelezhnikov <apodtele@gmail.com>
 
diff --git a/include/freetype/internal/ftcalc.h b/include/freetype/internal/ftcalc.h
index d4d4337..67ade7e 100644
--- a/include/freetype/internal/ftcalc.h
+++ b/include/freetype/internal/ftcalc.h
@@ -302,9 +302,9 @@ FT_BEGIN_HEADER
   /*
    *  This function normalizes a vector and returns its original length.
    *  The normalized vector is a 16.16 fixed-point unit vector with length
-   *  close to 0x10000. The accuracy of the returned length is limited to
-   *  16 bits also. The function utilizes quick inverse square root
-   *  aproximation without divisions and square roots relying on Newton's
+   *  close to 0x10000.  The accuracy of the returned length is limited to
+   *  16 bits also.  The function utilizes quick inverse square root
+   *  approximation without divisions and square roots relying on Newton's
    *  iterations instead.
    */
   FT_BASE( FT_UInt32 )
diff --git a/src/base/ftoutln.c b/src/base/ftoutln.c
index 066eb7e..f71a1e7 100644
--- a/src/base/ftoutln.c
+++ b/src/base/ftoutln.c
@@ -946,7 +946,7 @@
       /* compute incoming normalized vector */
       in.x = v_cur.x - v_prev.x;
       in.y = v_cur.y - v_prev.y;
-      l_in = FT_Vector_NormLen( &in );
+      l_in = (FT_Fixed)FT_Vector_NormLen( &in );
 
       for ( n = first; n <= last; n++ )
       {
@@ -958,7 +958,7 @@
         /* compute outgoing normalized vector */
         out.x = v_next.x - v_cur.x;
         out.y = v_next.y - v_cur.y;
-        l_out = FT_Vector_NormLen( &out );
+        l_out = (FT_Fixed)FT_Vector_NormLen( &out );
 
         d = FT_MulFix( in.x, out.x ) + FT_MulFix( in.y, out.y );
 
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index 537e060..ff3fa9a 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -1305,7 +1305,7 @@
           /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
           /* we enforce it by clearing the second bit           */
           /* (and sorting the stack indexing to suit)           */
-          count  = count1 & ~2;
+          count  = count1 & ~2U;
           index += count1 - count;
 
           FT_TRACE4(( " vvcurveto\n" ));
@@ -1350,7 +1350,7 @@
           /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
           /* we enforce it by clearing the second bit           */
           /* (and sorting the stack indexing to suit)           */
-          count  = count1 & ~2;
+          count  = count1 & ~2U;
           index += count1 - count;
 
           FT_TRACE4(( " hhcurveto\n" ));
@@ -1399,7 +1399,7 @@
           /* 8n+4, or 8n+5, we enforce it by clearing the     */
           /* second bit                                       */
           /* (and sorting the stack indexing to suit)         */
-          count  = count1 & ~2;
+          count  = count1 & ~2U;
           index += count1 - count;
 
           FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index e1acd69..c35d835 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -1582,7 +1582,7 @@
         error = TT_Vary_Apply_Glyph_Deltas( (TT_Face)(loader->face),
                                              glyph_index,
                                              &outline,
-                                             outline.n_points );
+                                             (FT_UInt)outline.n_points );
         if ( error )
           goto Exit;
 
@@ -1679,7 +1679,7 @@
 
       if ( face->doblend )
       {
-        FT_UInt      i, limit;
+        short        i, limit;
         FT_SubGlyph  subglyph;
 
         FT_Outline  outline;
@@ -1690,11 +1690,11 @@
         FT_Memory  memory = face->root.memory;
 
 
-        limit = gloader->current.num_subglyphs;
+        limit = (short)gloader->current.num_subglyphs;
 
         /* construct an outline structure for              */
         /* communication with `TT_Vary_Apply_Glyph_Deltas' */
-        outline.n_points   = gloader->current.num_subglyphs + 4;
+        outline.n_points   = (short)( gloader->current.num_subglyphs + 4 );
         outline.n_contours = outline.n_points;
 
         if ( FT_NEW_ARRAY( points, outline.n_points )   ||
@@ -1748,7 +1748,7 @@
                          face,
                          glyph_index,
                          &outline,
-                         outline.n_points ) ) != 0 )
+                         (FT_UInt)outline.n_points ) ) != 0 )
           goto Exit1;
 
         subglyph = gloader->current.subglyphs + gloader->base.num_subglyphs;
diff --git a/src/truetype/ttgxvar.c b/src/truetype/ttgxvar.c
index 2b12483..ee884ae 100644
--- a/src/truetype/ttgxvar.c
+++ b/src/truetype/ttgxvar.c
@@ -1649,13 +1649,13 @@
   {
     FT_Vector*  out_points;
 
-    FT_UInt  first_point;
-    FT_UInt  end_point;
+    FT_Int  first_point;
+    FT_Int  end_point;
 
-    FT_UInt  first_delta;
-    FT_UInt  cur_delta;
+    FT_Int  first_delta;
+    FT_Int  cur_delta;
 
-    FT_UInt   point;
+    FT_Int    point;
     FT_Short  contour;
 
 
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index caa4d0f..d00a0f8 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -5147,11 +5147,11 @@
   Ins_INSTCTRL( TT_ExecContext  exc,
                 FT_Long*        args )
   {
-    FT_Long  K, L, Kf;
+    FT_ULong  K, L, Kf;
 
 
-    K = args[1];
-    L = args[0];
+    K = (FT_ULong)args[1];
+    L = (FT_ULong)args[0];
 
     /* selector values cannot be `OR'ed;                 */
     /* they are indices starting with index 1, not flags */