Commit c06889eb2c42b40d9ef557b03c9b57d6057e0f12

Werner Lemberg 2013-06-12T10:58:06

More compiler warning fixes. */*: Use cast to `FT_Bool' (or `Bool') where appropriate.

diff --git a/ChangeLog b/ChangeLog
index 9968449..bf8cd32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-06-12  Werner Lemberg  <wl@gnu.org>
+
+	More compiler warning fixes.
+
+	*/*: Use cast to `FT_Bool' (or `Bool') where appropriate.
+
 2013-06-10  Werner Lemberg  <wl@gnu.org>
 
 	[truetype] Improve handling of broken sbit advance widths.
diff --git a/src/base/ftobjs.c b/src/base/ftobjs.c
index ac2a39c..d6b2126 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 8b2331d..479d912 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 1666e4f..96bd49f 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 5b73e60..5610917 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 cb671ec..2b429e3 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 4865994..bbd503d 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 9da5d00..1c834a1 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