ref: b57bb11ad015e2d41426d435d6e5ba692afba207
parent: 81e5ff53a89b454a3984a7181516dfb4cb22187a
author: Werner Lemberg <[email protected]>
date: Thu Feb 19 05:44:18 EST 2015
[autofit] Fix signedness issues. * src/autofit/afangles.c, src/autofit/afcjk.c, src/autofit/afglobal.c, src/autofit/afhints.c, src/autofit/aflatin.c, src/autofit/aflatin2.c, src/autofit/afwarp.c, src/autofit/hbshim.c: Apply.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2015-02-19 Werner Lemberg <[email protected]>
+ [autofit] Fix signedness issues.
+
+ * src/autofit/afangles.c, src/autofit/afcjk.c,
+ src/autofit/afglobal.c, src/autofit/afhints.c,
+ src/autofit/aflatin.c, src/autofit/aflatin2.c, src/autofit/afwarp.c,
+ src/autofit/hbshim.c: Apply.
+
+2015-02-19 Werner Lemberg <[email protected]>
+
[autofit] Use macros for (unsigned) flags, not enumerations.
This harmonizes with other code in FreeType (and reduces the number
--- a/src/autofit/afangles.c
+++ b/src/autofit/afangles.c
@@ -259,7 +259,7 @@
sum += table[j].org;
table[j].org = 0;
}
- table[cur_idx].org = sum / j;
+ table[cur_idx].org = sum / (FT_Pos)j;
if ( i < *count - 1 )
{
--- a/src/autofit/afcjk.c
+++ b/src/autofit/afcjk.c
@@ -260,8 +260,8 @@
FT_Pos fills[AF_BLUE_STRING_MAX_LEN];
FT_Pos flats[AF_BLUE_STRING_MAX_LEN];
- FT_Int num_fills;
- FT_Int num_flats;
+ FT_UInt num_fills;
+ FT_UInt num_flats;
FT_Bool fill;
@@ -1354,13 +1354,13 @@
static FT_Pos
af_cjk_snap_width( AF_Width widths,
- FT_Int count,
+ FT_UInt count,
FT_Pos width )
{
- int n;
- FT_Pos best = 64 + 32 + 2;
- FT_Pos reference = width;
- FT_Pos scaled;
+ FT_UInt n;
+ FT_Pos best = 64 + 32 + 2;
+ FT_Pos reference = width;
+ FT_Pos scaled;
for ( n = 0; n < count; n++ )
--- a/src/autofit/afglobal.c
+++ b/src/autofit/afglobal.c
@@ -314,8 +314,9 @@
memory = face->memory;
- if ( FT_ALLOC( globals, sizeof ( *globals ) +
- face->num_glyphs * sizeof ( FT_Byte ) ) )
+ if ( FT_ALLOC( globals,
+ sizeof ( *globals ) +
+ (FT_ULong)face->num_glyphs * sizeof ( FT_Byte ) ) )
goto Exit;
globals->face = face;
--- a/src/autofit/afhints.c
+++ b/src/autofit/afhints.c
@@ -612,7 +612,7 @@
/* first of all, reallocate the contours array if necessary */
new_max = (FT_UInt)outline->n_contours;
- old_max = hints->max_contours;
+ old_max = (FT_UInt)hints->max_contours;
if ( new_max <= AF_CONTOURS_EMBEDDED )
{
@@ -627,12 +627,12 @@
if ( hints->contours == hints->embedded.contours )
hints->contours = NULL;
- new_max = ( new_max + 3 ) & ~3; /* round up to a multiple of 4 */
+ new_max = ( new_max + 3 ) & ~3U; /* round up to a multiple of 4 */
if ( FT_RENEW_ARRAY( hints->contours, old_max, new_max ) )
goto Exit;
- hints->max_contours = new_max;
+ hints->max_contours = (FT_Int)new_max;
}
/*
@@ -641,7 +641,7 @@
* hint metrics appropriately
*/
new_max = (FT_UInt)( outline->n_points + 2 );
- old_max = hints->max_points;
+ old_max = (FT_UInt)hints->max_points;
if ( new_max <= AF_POINTS_EMBEDDED )
{
@@ -656,12 +656,12 @@
if ( hints->points == hints->embedded.points )
hints->points = NULL;
- new_max = ( new_max + 2 + 7 ) & ~7; /* round up to a multiple of 8 */
+ new_max = ( new_max + 2 + 7 ) & ~7U; /* round up to a multiple of 8 */
if ( FT_RENEW_ARRAY( hints->points, old_max, new_max ) )
goto Exit;
- hints->max_points = new_max;
+ hints->max_points = (FT_Int)new_max;
}
hints->num_points = outline->n_points;
--- a/src/autofit/aflatin.c
+++ b/src/autofit/aflatin.c
@@ -261,8 +261,8 @@
FT_Pos flats [AF_BLUE_STRING_MAX_LEN];
FT_Pos rounds[AF_BLUE_STRING_MAX_LEN];
- FT_Int num_flats;
- FT_Int num_rounds;
+ FT_UInt num_flats;
+ FT_UInt num_rounds;
AF_LatinBlue blue;
FT_Error error;
@@ -2020,13 +2020,13 @@
static FT_Pos
af_latin_snap_width( AF_Width widths,
- FT_Int count,
+ FT_UInt count,
FT_Pos width )
{
- int n;
- FT_Pos best = 64 + 32 + 2;
- FT_Pos reference = width;
- FT_Pos scaled;
+ FT_UInt n;
+ FT_Pos best = 64 + 32 + 2;
+ FT_Pos reference = width;
+ FT_Pos scaled;
for ( n = 0; n < count; n++ )
--- a/src/autofit/aflatin2.c
+++ b/src/autofit/aflatin2.c
@@ -1572,13 +1572,13 @@
static FT_Pos
af_latin2_snap_width( AF_Width widths,
- FT_Int count,
+ FT_UInt count,
FT_Pos width )
{
- int n;
- FT_Pos best = 64 + 32 + 2;
- FT_Pos reference = width;
- FT_Pos scaled;
+ FT_UInt n;
+ FT_Pos best = 64 + 32 + 2;
+ FT_Pos reference = width;
+ FT_Pos scaled;
for ( n = 0; n < count; n++ )
--- a/src/autofit/afwarp.c
+++ b/src/autofit/afwarp.c
@@ -76,10 +76,10 @@
FT_Pos xx2,
AF_WarpScore base_distort,
AF_Segment segments,
- FT_UInt num_segments )
+ FT_Int num_segments )
{
FT_Int idx_min, idx_max, idx0;
- FT_UInt nn;
+ FT_Int nn;
AF_WarpScore scores[65];
@@ -171,7 +171,7 @@
FT_Fixed org_scale;
FT_Pos org_delta;
- FT_UInt nn, num_points, num_segments;
+ FT_Int nn, num_points, num_segments;
FT_Int X1, X2;
FT_Int w;
--- a/src/autofit/hbshim.c
+++ b/src/autofit/hbshim.c
@@ -187,7 +187,7 @@
count = 0;
#endif
- for ( idx = -1; hb_set_next( gsub_lookups, &idx ); )
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups, &idx ); )
{
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE4(( " %d", idx ));
@@ -218,7 +218,7 @@
count = 0;
#endif
- for ( idx = -1; hb_set_next( gpos_lookups, &idx ); )
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gpos_lookups, &idx ); )
{
#ifdef FT_DEBUG_LEVEL_TRACE
FT_TRACE4(( " %d", idx ));
@@ -267,7 +267,8 @@
GET_UTF8_CHAR( ch, p );
- for ( idx = -1; hb_set_next( gsub_lookups, &idx ); )
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_lookups,
+ &idx ); )
{
hb_codepoint_t gidx = FT_Get_Char_Index( globals->face, ch );
@@ -344,7 +345,7 @@
count = 0;
#endif
- for ( idx = -1; hb_set_next( gsub_glyphs, &idx ); )
+ for ( idx = HB_SET_VALUE_INVALID; hb_set_next( gsub_glyphs, &idx ); )
{
#ifdef FT_DEBUG_LEVEL_TRACE
if ( !( count % 10 ) )
@@ -441,7 +442,7 @@
if ( feature )
{
- FT_UInt upem = metrics->globals->face->units_per_EM;
+ FT_Int upem = (FT_Int)metrics->globals->face->units_per_EM;
hb_font_t* font = metrics->globals->hb_font;
hb_buffer_t* buf = hb_buffer_create();