freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 328d684: [truetype] Remove clang warnings.


From: Werner LEMBERG
Subject: [freetype2] master 328d684: [truetype] Remove clang warnings.
Date: Fri, 28 Oct 2016 22:19:17 +0000 (UTC)

branch: master
commit 328d68449da9fd6bf28a92c06a65cb0070a7915a
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [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.
---
 ChangeLog               |   11 +++++++++++
 src/truetype/ttinterp.c |   13 ++++++++-----
 src/truetype/ttinterp.h |    8 ++++----
 3 files changed, 23 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index da074a7..ffb6fa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-10-29  Werner Lemberg  <address@hidden>
+
+       [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  <address@hidden>
 
        [truetype] Fix commit from 2014-11-24.
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 230b130..7287503 100644
--- 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  */
diff --git a/src/truetype/ttinterp.h b/src/truetype/ttinterp.h
index be87e08..33a9b12 100644
--- a/src/truetype/ttinterp.h
+++ b/src/truetype/ttinterp.h
@@ -411,10 +411,10 @@ FT_BEGIN_HEADER
     /* 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;
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]