From 76abc75c2637cffc692fee6b16396c8f56091252 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 16 Feb 2015 22:00:27 +0100 Subject: [PATCH] [base] Finish compiler warning fixes for signedness issues. * src/base/ftglyph.c, src/base/ftlcdfil.c, src/base/ftstroke.c: Apply. --- ChangeLog | 7 +++++++ src/base/ftglyph.c | 14 +++++++++----- src/base/ftlcdfil.c | 12 ++++++------ src/base/ftstroke.c | 20 +++++++++++--------- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5bf7acda1..78b4db1da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-02-16 Werner Lemberg + + [base] Finish compiler warning fixes for signedness issues. + + * src/base/ftglyph.c, src/base/ftlcdfil.c, src/base/ftstroke.c: + Apply. + 2015-02-16 Werner Lemberg * include/tttables.h (TT_OS2): `fsType' must be FT_UShort. diff --git a/src/base/ftglyph.c b/src/base/ftglyph.c index 1817c4916..2c10a99db 100644 --- a/src/base/ftglyph.c +++ b/src/base/ftglyph.c @@ -126,9 +126,9 @@ cbox->xMin = glyph->left << 6; - cbox->xMax = cbox->xMin + ( glyph->bitmap.width << 6 ); + cbox->xMax = cbox->xMin + (FT_Pos)( glyph->bitmap.width << 6 ); cbox->yMax = glyph->top << 6; - cbox->yMin = cbox->yMax - ( glyph->bitmap.rows << 6 ); + cbox->yMin = cbox->yMax - (FT_Pos)( glyph->bitmap.rows << 6 ); } @@ -173,7 +173,9 @@ } /* allocate new outline */ - error = FT_Outline_New( library, source->n_points, source->n_contours, + error = FT_Outline_New( library, + (FT_UInt)source->n_points, + source->n_contours, &glyph->outline ); if ( error ) goto Exit; @@ -205,8 +207,10 @@ FT_Library library = FT_GLYPH( source )->library; - error = FT_Outline_New( library, source->outline.n_points, - source->outline.n_contours, &target->outline ); + error = FT_Outline_New( library, + (FT_UInt)source->outline.n_points, + source->outline.n_contours, + &target->outline ); if ( !error ) FT_Outline_Copy( &source->outline, &target->outline ); diff --git a/src/base/ftlcdfil.c b/src/base/ftlcdfil.c index 787f6b800..ff6f7e98c 100644 --- a/src/base/ftlcdfil.c +++ b/src/base/ftlcdfil.c @@ -48,7 +48,7 @@ /* take care of bitmap flow */ if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * ( bitmap->rows - 1 ); + line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); /* `fir' and `pix' must be at least 32 bit wide, since the sum of */ /* the values in `weights' can exceed 0xFF */ @@ -112,7 +112,7 @@ /* take care of bitmap flow */ if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * ( bitmap->rows - 1 ); + column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; width > 0; width--, column++ ) { @@ -182,7 +182,7 @@ FT_UInt height = (FT_UInt)bitmap->rows; FT_Int pitch = bitmap->pitch; - static const int filters[3][3] = + static const unsigned int filters[3][3] = { { 65538 * 9/13, 65538 * 1/6, 65538 * 1/13 }, { 65538 * 3/13, 65538 * 4/6, 65538 * 3/13 }, @@ -200,7 +200,7 @@ /* take care of bitmap flow */ if ( bitmap->pitch < 0 ) - line -= bitmap->pitch * ( bitmap->rows - 1 ); + line -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; height > 0; height--, line += pitch ) { @@ -243,12 +243,12 @@ /* take care of bitmap flow */ if ( bitmap->pitch < 0 ) - column -= bitmap->pitch * ( bitmap->rows - 1 ); + column -= bitmap->pitch * (FT_Int)( bitmap->rows - 1 ); for ( ; width > 0; width--, column++ ) { FT_Byte* col = column; - FT_Byte* col_end = col + height * pitch; + FT_Byte* col_end = col + (FT_Int)height * pitch; for ( ; col < col_end; col += 3 * pitch ) diff --git a/src/base/ftstroke.c b/src/base/ftstroke.c index 69a403fdf..d7f92839d 100644 --- a/src/base/ftstroke.c +++ b/src/base/ftstroke.c @@ -347,7 +347,7 @@ ft_stroke_border_close( FT_StrokeBorder border, FT_Bool reverse ) { - FT_UInt start = border->start; + FT_UInt start = (FT_UInt)border->start; FT_UInt count = border->num_points; @@ -599,7 +599,7 @@ if ( border->start >= 0 ) ft_stroke_border_close( border, FALSE ); - border->start = border->num_points; + border->start = (FT_Int)border->num_points; border->movable = FALSE; return ft_stroke_border_lineto( border, to, FALSE ); @@ -742,7 +742,7 @@ } } - outline->n_points = (short)( outline->n_points + border->num_points ); + outline->n_points += (short)border->num_points; FT_ASSERT( FT_Outline_Check( outline ) == 0 ); } @@ -1822,7 +1822,7 @@ FT_ASSERT( left->start >= 0 ); - new_points = left->num_points - left->start; + new_points = (FT_Int)left->num_points - left->start; if ( new_points > 0 ) { error = ft_stroke_border_grow( right, (FT_UInt)new_points ); @@ -1862,8 +1862,8 @@ } } - left->num_points = left->start; - right->num_points += new_points; + left->num_points = (FT_UInt)left->start; + right->num_points += (FT_UInt)new_points; right->movable = FALSE; left->movable = FALSE; @@ -2118,7 +2118,7 @@ FT_UInt last; /* index of last point in contour */ - last = outline->contours[n]; + last = (FT_UInt)outline->contours[n]; limit = outline->points + last; /* skip empty points; we don't stroke these */ @@ -2347,7 +2347,9 @@ FT_Outline_Done( glyph->library, outline ); error = FT_Outline_New( glyph->library, - num_points, num_contours, outline ); + num_points, + (FT_Int)num_contours, + outline ); if ( error ) goto Fail; @@ -2437,7 +2439,7 @@ error = FT_Outline_New( glyph->library, num_points, - num_contours, + (FT_Int)num_contours, outline ); if ( error ) goto Fail;