[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.
This commit is contained in:
Werner Lemberg 2015-02-19 10:44:18 +01:00
parent 81e5ff53a8
commit b57bb11ad0
9 changed files with 47 additions and 36 deletions

View File

@ -1,3 +1,12 @@
2015-02-19 Werner Lemberg <wl@gnu.org>
[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 <wl@gnu.org>
[autofit] Use macros for (unsigned) flags, not enumerations.

View File

@ -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 )
{

View File

@ -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++ )

View File

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

View File

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

View File

@ -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++ )

View File

@ -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++ )

View File

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

View File

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