shithub: freetype+ttf2subf

Download patch

ref: 24e4e96aff8885c2b5666c2f5fe6d1f112275d4e
parent: 559727d5196633c735298fe16f7f1e835fe94ef7
author: Werner Lemberg <[email protected]>
date: Wed Feb 25 01:57:16 EST 2015

[cache] Signedness fixes.

* src/cache/ftcbasic.c, src/cache/ftccmap.c, src/cache/ftcimage.c,
src/cache/ftcmanag.c, src/cache/ftcsbits.c: Apply.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2015-02-25  Werner Lemberg  <[email protected]>
 
+	[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  <[email protected]>
+
 	Change dimension fields in `FTC_ImageTypeRec' to unsigned type.
 
 	This doesn't break ABI.
--- 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;
--- 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,
--- 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;
--- 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 );
--- 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;
       }
     }