[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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
diff --git a/ChangeLog b/ChangeLog
index da074a7..ffb6fa4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-10-29 Werner Lemberg <wl@gnu.org>
+
+ [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 <wl@gnu.org>
[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;