[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.
This commit is contained in:
Werner Lemberg 2016-10-29 00:18:56 +02:00
parent ddf3872699
commit 328d68449d
3 changed files with 23 additions and 9 deletions

View File

@ -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.

View File

@ -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 */

View File

@ -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;