Commit 24e4e96aff8885c2b5666c2f5fe6d1f112275d4e

Werner Lemberg 2015-02-25T06:57:16

[cache] Signedness fixes. * src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcimage.c, src/cache/ftcmanag.c, src/cache/ftcsbits.c: Apply.

diff --git a/ChangeLog b/ChangeLog
index 0295286..a92daa5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-02-25  Werner Lemberg  <wl@gnu.org>
 
+	[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  <wl@gnu.org>
+
 	Change dimension fields in `FTC_ImageTypeRec' to unsigned type.
 
 	This doesn't break ABI.
diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c
index dbee89a..ac3290c 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 a127435..3b3052c 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 f258764..47e4939 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 5d70090..5c526ad 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 0945f2b..8141719 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;
       }
     }