From c06889eb2c42b40d9ef557b03c9b57d6057e0f12 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Wed, 12 Jun 2013 10:58:06 +0200 Subject: [PATCH] More compiler warning fixes. */*: Use cast to `FT_Bool' (or `Bool') where appropriate. --- ChangeLog | 6 ++++++ src/base/ftobjs.c | 4 ++-- src/cff/cf2font.c | 8 +++++--- src/cff/cf2hints.c | 23 ++++++++++++----------- src/cff/cf2intrp.c | 6 +++--- src/cff/cf2read.c | 2 +- src/raster/ftraster.c | 6 ++++-- src/type1/t1load.c | 2 +- 8 files changed, 34 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9968449e1..bf8cd32cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-06-12 Werner Lemberg + + More compiler warning fixes. + + */*: Use cast to `FT_Bool' (or `Bool') where appropriate. + 2013-06-10 Werner Lemberg [truetype] Improve handling of broken sbit advance widths. diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c index ac2a39c6a..d6b2126be 100644 --- a/src/base/ftobjs.c +++ b/src/base/ftobjs.c @@ -4513,9 +4513,9 @@ service = (FT_Service_Properties)interface; if ( set ) - missing_func = !service->set_property; + missing_func = (FT_Bool)( !service->set_property ); else - missing_func = !service->get_property; + missing_func = (FT_Bool)( !service->get_property ); if ( missing_func ) { diff --git a/src/cff/cf2font.c b/src/cff/cf2font.c index 8b2331d62..479d9125d 100644 --- a/src/cff/cf2font.c +++ b/src/cff/cf2font.c @@ -157,7 +157,8 @@ /* if a CID fontDict has changed, we need to recompute some cached */ /* data */ - needExtraSetup = font->lastSubfont != cf2_getSubfont( decoder ); + needExtraSetup = + (FT_Bool)( font->lastSubfont != cf2_getSubfont( decoder ) ); /* if ppem has changed, we need to recompute some cached data */ /* note: because of CID font matrix concatenation, ppem and transform */ @@ -170,7 +171,7 @@ } /* copy hinted flag on each call */ - font->hinted = font->renderingFlags & CF2_FlagsHinted; + font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted ); /* determine if transform has changed; */ /* include Fontmatrix but ignore translation */ @@ -204,7 +205,8 @@ */ if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) ) { - font->stemDarkened = font->renderingFlags & CF2_FlagsDarkened; + font->stemDarkened = + (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened ); /* blue zones depend on darkened flag */ needExtraSetup = TRUE; diff --git a/src/cff/cf2hints.c b/src/cff/cf2hints.c index 1666e4fc2..96bd49f18 100644 --- a/src/cff/cf2hints.c +++ b/src/cff/cf2hints.c @@ -217,52 +217,52 @@ FT_LOCAL_DEF( FT_Bool ) cf2_hint_isValid( const CF2_Hint hint ) { - return hint->flags != 0; + return (FT_Bool)( hint->flags != 0 ); } static FT_Bool cf2_hint_isPair( const CF2_Hint hint ) { - return ( hint->flags & - ( CF2_PairBottom | CF2_PairTop ) ) != 0; + return (FT_Bool)( ( hint->flags & + ( CF2_PairBottom | CF2_PairTop ) ) != 0 ); } static FT_Bool cf2_hint_isPairTop( const CF2_Hint hint ) { - return ( hint->flags & CF2_PairTop ) != 0; + return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 ); } FT_LOCAL_DEF( FT_Bool ) cf2_hint_isTop( const CF2_Hint hint ) { - return ( hint->flags & - ( CF2_PairTop | CF2_GhostTop ) ) != 0; + return (FT_Bool)( ( hint->flags & + ( CF2_PairTop | CF2_GhostTop ) ) != 0 ); } FT_LOCAL_DEF( FT_Bool ) cf2_hint_isBottom( const CF2_Hint hint ) { - return ( hint->flags & - ( CF2_PairBottom | CF2_GhostBottom ) ) != 0; + return (FT_Bool)( ( hint->flags & + ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 ); } static FT_Bool cf2_hint_isLocked( const CF2_Hint hint ) { - return ( hint->flags & CF2_Locked ) != 0; + return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 ); } static FT_Bool cf2_hint_isSynthetic( const CF2_Hint hint ) { - return ( hint->flags & CF2_Synthetic ) != 0; + return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 ); } @@ -462,7 +462,8 @@ hintmap->edge[i].dsCoord + moveDown - downMinCounter ) { move = moveDown; - saveEdge = moveUp < -moveDown; /* true if non-optimum move */ + /* true if non-optimum move */ + saveEdge = (FT_Bool)( moveUp < -moveDown ); } else { diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c index 5b73e6049..5610917cc 100644 --- a/src/cff/cf2intrp.c +++ b/src/cff/cf2intrp.c @@ -287,7 +287,7 @@ { CF2_UInt i; CF2_UInt count = cf2_stack_count( opStack ); - FT_Bool hasWidthArg = count & 1; + FT_Bool hasWidthArg = (FT_Bool)( count & 1 ); /* variable accumulates delta values from operand stack */ CF2_Fixed position = hintOffset; @@ -357,8 +357,8 @@ if ( doConditionalLastRead ) { - FT_Bool lastIsX = cf2_fixedAbs( vals[10] - *curX ) > - cf2_fixedAbs( vals[11] - *curY ); + FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) > + cf2_fixedAbs( vals[11] - *curY ) ); CF2_Fixed lastVal = cf2_stack_getReal( opStack, index ); diff --git a/src/cff/cf2read.c b/src/cff/cf2read.c index cb671ecc0..2b429e3ee 100644 --- a/src/cff/cf2read.c +++ b/src/cff/cf2read.c @@ -105,7 +105,7 @@ FT_LOCAL_DEF( FT_Bool ) cf2_buf_isEnd( CF2_Buffer buf ) { - return buf->ptr >= buf->end; + return (FT_Bool)( buf->ptr >= buf->end ); } diff --git a/src/raster/ftraster.c b/src/raster/ftraster.c index 486599477..bbd503d97 100644 --- a/src/raster/ftraster.c +++ b/src/raster/ftraster.c @@ -453,8 +453,10 @@ #define FRAC( x ) ( (x) & ( ras.precision - 1 ) ) #define SCALED( x ) ( ( (ULong)(x) << ras.scale_shift ) - ras.precision_half ) -#define IS_BOTTOM_OVERSHOOT( x ) ( CEILING( x ) - x >= ras.precision_half ) -#define IS_TOP_OVERSHOOT( x ) ( x - FLOOR( x ) >= ras.precision_half ) +#define IS_BOTTOM_OVERSHOOT( x ) \ + (Bool)( CEILING( x ) - x >= ras.precision_half ) +#define IS_TOP_OVERSHOOT( x ) \ + (Bool)( x - FLOOR( x ) >= ras.precision_half ) /* The most used variables are positioned at the top of the structure. */ /* Thus, their offset can be coded with less opcodes, resulting in a */ diff --git a/src/type1/t1load.c b/src/type1/t1load.c index 9da5d0084..1c834a17b 100644 --- a/src/type1/t1load.c +++ b/src/type1/t1load.c @@ -72,7 +72,7 @@ #ifdef FT_CONFIG_OPTION_INCREMENTAL -#define IS_INCREMENTAL ( face->root.internal->incremental_interface != 0 ) +#define IS_INCREMENTAL (FT_Bool)( face->root.internal->incremental_interface != 0 ) #else #define IS_INCREMENTAL 0 #endif