From 24e4e96aff8885c2b5666c2f5fe6d1f112275d4e Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 25 Feb 2015 06:57:16 +0100 Subject: [PATCH] [cache] Signedness fixes. * src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcimage.c, src/cache/ftcmanag.c, src/cache/ftcsbits.c: Apply. --- ChangeLog | 7 +++++++ src/cache/ftcbasic.c | 14 +++++++++----- src/cache/ftccmap.c | 2 +- src/cache/ftcimage.c | 4 ++-- src/cache/ftcmanag.c | 7 +++++-- src/cache/ftcsbits.c | 6 +++--- 6 files changed, 27 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02952866f..a92daa50a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-02-25 Werner Lemberg + + [cache] Signedness fixes. + + * src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcimage.c, + src/cache/ftcmanag.c, src/cache/ftcsbits.c: Apply. + 2015-02-25 Werner Lemberg Change dimension fields in `FTC_ImageTypeRec' to unsigned type. diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index dbee89a63..ac3290cef 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -138,8 +138,10 @@ FT_Face face = size->face; - error = FT_Load_Glyph( face, gindex, - family->attrs.load_flags | FT_LOAD_RENDER ); + error = FT_Load_Glyph( + face, + gindex, + (FT_Int)family->attrs.load_flags | FT_LOAD_RENDER ); if ( !error ) *aface = face; } @@ -169,7 +171,9 @@ { face = size->face; - error = FT_Load_Glyph( face, gindex, family->attrs.load_flags ); + error = FT_Load_Glyph( face, + gindex, + (FT_Int)family->attrs.load_flags ); if ( !error ) { if ( face->glyph->format == FT_GLYPH_FORMAT_BITMAP || @@ -300,7 +304,7 @@ if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", - type->flags & ~((FT_ULong)FT_UINT_MAX) )); + (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; @@ -481,7 +485,7 @@ if ( (FT_ULong)( type->flags - FT_INT_MIN ) > FT_UINT_MAX ) FT_TRACE1(( "FTC_ImageCache_Lookup:" " higher bits in load_flags 0x%x are dropped\n", - type->flags & ~((FT_ULong)FT_UINT_MAX) )); + (FT_ULong)type->flags & ~((FT_ULong)FT_UINT_MAX) )); query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; diff --git a/src/cache/ftccmap.c b/src/cache/ftccmap.c index a12743569..3b3052cdf 100644 --- a/src/cache/ftccmap.c +++ b/src/cache/ftccmap.c @@ -270,7 +270,7 @@ query.cmap_index = (FT_UInt)cmap_index; query.char_code = char_code; - hash = FTC_CMAP_HASH( face_id, cmap_index, char_code ); + hash = FTC_CMAP_HASH( face_id, (FT_UInt)cmap_index, char_code ); #if 1 FTC_CACHE_LOOKUP_CMP( cache, ftc_cmap_node_compare, hash, &query, diff --git a/src/cache/ftcimage.c b/src/cache/ftcimage.c index f258764e0..47e49393b 100644 --- a/src/cache/ftcimage.c +++ b/src/cache/ftcimage.c @@ -133,9 +133,9 @@ outg = (FT_OutlineGlyph)glyph; - size = outg->outline.n_points * + size = (FT_Offset)outg->outline.n_points * ( sizeof ( FT_Vector ) + sizeof ( FT_Byte ) ) + - outg->outline.n_contours * sizeof ( FT_Short ) + + (FT_Offset)outg->outline.n_contours * sizeof ( FT_Short ) + sizeof ( *outg ); } break; diff --git a/src/cache/ftcmanag.c b/src/cache/ftcmanag.c index 5d70090dd..5c526adaf 100644 --- a/src/cache/ftcmanag.c +++ b/src/cache/ftcmanag.c @@ -60,8 +60,11 @@ if ( scaler->pixel ) error = FT_Set_Pixel_Sizes( face, scaler->width, scaler->height ); else - error = FT_Set_Char_Size( face, scaler->width, scaler->height, - scaler->x_res, scaler->y_res ); + error = FT_Set_Char_Size( face, + (FT_F26Dot6)scaler->width, + (FT_F26Dot6)scaler->height, + scaler->x_res, + scaler->y_res ); if ( error ) { FT_Done_Size( size ); diff --git a/src/cache/ftcsbits.c b/src/cache/ftcsbits.c index 0945f2b26..814171916 100644 --- a/src/cache/ftcsbits.c +++ b/src/cache/ftcsbits.c @@ -52,7 +52,7 @@ if ( pitch < 0 ) pitch = -pitch; - size = (FT_ULong)( pitch * bitmap->rows ); + size = (FT_ULong)pitch * bitmap->rows; if ( !FT_ALLOC( sbit->buffer, size ) ) FT_MEM_COPY( sbit->buffer, bitmap->buffer, size ); @@ -181,7 +181,7 @@ /* now, compute size */ if ( asize ) - *asize = FT_ABS( sbit->pitch ) * sbit->height; + *asize = (FT_ULong)FT_ABS( sbit->pitch ) * sbit->height; } /* glyph loading successful */ @@ -302,7 +302,7 @@ pitch = -pitch; /* add the size of a given glyph image */ - size += pitch * sbit->height; + size += (FT_Offset)pitch * sbit->height; } }