shithub: freetype+ttf2subf

Download patch

ref: 328d68449da9fd6bf28a92c06a65cb0070a7915a
parent: ddf38726996d2293ea11f6f322ae5abb9049fbed
author: Werner Lemberg <[email protected]>
date: Fri Oct 28 20:18:56 EDT 2016

[truetype] Remove clang warnings.

* src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for
loop counter handling.

* src/truetype/ttinterp.c: Updated.
(Ins_SCANTYPE): Use signed constant.
(TT_RunIns): Ensure `num_twilight_points' is 16bit.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-10-29  Werner Lemberg  <[email protected]>
+
+	[truetype] Remove clang warnings.
+
+	* src/truetype/ttinterp.h (TT_ExecContextRec): Using `FT_ULong' for
+	loop counter handling.
+
+	* src/truetype/ttinterp.c: Updated.
+	(Ins_SCANTYPE): Use signed constant.
+	(TT_RunIns): Ensure `num_twilight_points' is 16bit.
+
 2016-10-27  Werner Lemberg  <[email protected]>
 
 	[truetype] Fix commit from 2014-11-24.
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -3964,7 +3964,7 @@
 
       exc->step_ins = FALSE;
 
-      exc->loopcall_counter += args[0];
+      exc->loopcall_counter += (FT_ULong)args[0];
       if ( exc->loopcall_counter > exc->loopcall_counter_max )
         exc->error = FT_THROW( Execution_Too_Long );
     }
@@ -5180,7 +5180,7 @@
                 FT_Long*        args )
   {
     if ( args[0] >= 0 )
-      exc->GS.scan_type = (FT_Int)args[0] & 0xFFFFU;
+      exc->GS.scan_type = (FT_Int)args[0] & 0xFFFF;
   }
 
 
@@ -7550,8 +7550,8 @@
   FT_EXPORT_DEF( FT_Error )
   TT_RunIns( TT_ExecContext  exc )
   {
-    FT_Long    ins_counter = 0;  /* executed instructions counter */
-    FT_Long    num_twilight_points;
+    FT_ULong   ins_counter = 0;  /* executed instructions counter */
+    FT_ULong   num_twilight_points;
     FT_UShort  i;
 
 #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
@@ -7593,11 +7593,14 @@
                                   2 * ( exc->pts.n_points + exc->cvtSize ) );
     if ( exc->twilight.n_points > num_twilight_points )
     {
+      if ( num_twilight_points > 0xFFFFU )
+        num_twilight_points = 0xFFFFU;
+
       FT_TRACE5(( "TT_RunIns: Resetting number of twilight points\n"
                   "           from %d to the more reasonable value %d\n",
                   exc->twilight.n_points,
                   num_twilight_points ));
-      exc->twilight.n_points = num_twilight_points;
+      exc->twilight.n_points = (FT_UShort)num_twilight_points;
     }
 
     /* Set up loop detectors.  We restrict the number of LOOPCALL loops  */
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -411,10 +411,10 @@
     /* We maintain two counters (in addition to the instruction counter) */
     /* that act as loop detectors for LOOPCALL and jump opcodes with     */
     /* negative arguments.                                               */
-    FT_Long            loopcall_counter;
-    FT_Long            loopcall_counter_max;
-    FT_Long            neg_jump_counter;
-    FT_Long            neg_jump_counter_max;
+    FT_ULong           loopcall_counter;
+    FT_ULong           loopcall_counter_max;
+    FT_ULong           neg_jump_counter;
+    FT_ULong           neg_jump_counter_max;
 
   } TT_ExecContextRec;