Commit cb13e7109ce10a3860066e59ce8907ac67d2e297

Werner Lemberg 2015-02-23T06:41:52

[smooth] Signedness fixes. * src/smooth/ftgrays.c, src/smooth/ftsmooth.c: Apply.

diff --git a/ChangeLog b/ChangeLog
index f20ecf4..17e4379 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2015-02-22  Werner Lemberg  <wl@gnu.org>
 
+	[smooth] Signedness fixes.
+
+	* src/smooth/ftgrays.c, src/smooth/ftsmooth.c: Apply.
+
+2015-02-22  Werner Lemberg  <wl@gnu.org>
+
 	* src/raster/ftraster.c: Use the file's typedefs everywhere.
 
 2015-02-22  Werner Lemberg  <wl@gnu.org>
diff --git a/src/smooth/ftgrays.c b/src/smooth/ftgrays.c
index 1347141..2ac451a 100644
--- a/src/smooth/ftgrays.c
+++ b/src/smooth/ftgrays.c
@@ -476,7 +476,7 @@ typedef ptrdiff_t  FT_PtrDist;
   /*                                                                       */
   static void
   gray_init_cells( RAS_ARG_ void*  buffer,
-                   long            byte_size )
+                            long   byte_size )
   {
     ras.buffer      = buffer;
     ras.buffer_size = byte_size;
@@ -634,8 +634,8 @@ typedef ptrdiff_t  FT_PtrDist;
       ras.ey    = ey;
     }
 
-    ras.invalid = ( (unsigned)ey >= (unsigned)ras.count_ey ||
-                              ex >= ras.count_ex           );
+    ras.invalid = ( (unsigned int)ey >= (unsigned int)ras.count_ey ||
+                                  ex >= ras.count_ex               );
   }
 
 
@@ -1208,7 +1208,7 @@ typedef ptrdiff_t  FT_PtrDist;
     /* first of all, compute the scanline offset */
     p = (unsigned char*)map->buffer - y * map->pitch;
     if ( map->pitch >= 0 )
-      p += (unsigned)( ( map->rows - 1 ) * map->pitch );
+      p += ( map->rows - 1 ) * (unsigned int)map->pitch;
 
     for ( ; count > 0; count--, spans++ )
     {
@@ -1838,13 +1838,13 @@ typedef ptrdiff_t  FT_PtrDist;
           ras.ycells = (PCell*)ras.buffer;
           ras.ycount = band->max - band->min;
 
-          cell_start = sizeof ( PCell ) * ras.ycount;
-          cell_mod   = cell_start % sizeof ( TCell );
+          cell_start = (long)sizeof ( PCell ) * ras.ycount;
+          cell_mod   = cell_start % (long)sizeof ( TCell );
           if ( cell_mod > 0 )
-            cell_start += sizeof ( TCell ) - cell_mod;
+            cell_start += (long)sizeof ( TCell ) - cell_mod;
 
           cell_end  = ras.buffer_size;
-          cell_end -= cell_end % sizeof ( TCell );
+          cell_end -= cell_end % (long)sizeof ( TCell );
 
           cells_max = (PCell)( (char*)ras.buffer + cell_end );
           ras.cells = (PCell)( (char*)ras.buffer + cell_start );
@@ -1921,7 +1921,8 @@ typedef ptrdiff_t  FT_PtrDist;
 
     TCell  buffer[FT_MAX( FT_RENDER_POOL_SIZE, 2048 ) / sizeof ( TCell )];
     long   buffer_size = sizeof ( buffer );
-    int    band_size   = (int)( buffer_size / ( sizeof ( TCell ) * 8 ) );
+    int    band_size   = (int)( buffer_size /
+                                (long)( sizeof ( TCell ) * 8 ) );
 
 
     if ( !raster )
@@ -1965,8 +1966,8 @@ typedef ptrdiff_t  FT_PtrDist;
       /* compute clip box from target pixmap */
       ras.clip_box.xMin = 0;
       ras.clip_box.yMin = 0;
-      ras.clip_box.xMax = target_map->width;
-      ras.clip_box.yMax = target_map->rows;
+      ras.clip_box.xMax = (FT_Pos)target_map->width;
+      ras.clip_box.yMax = (FT_Pos)target_map->rows;
     }
     else if ( params->flags & FT_RASTER_FLAG_CLIP )
       ras.clip_box = params->clip_box;
diff --git a/src/smooth/ftsmooth.c b/src/smooth/ftsmooth.c
index 4430cc1..3620550 100644
--- a/src/smooth/ftsmooth.c
+++ b/src/smooth/ftsmooth.c
@@ -230,7 +230,7 @@
     }
 
     /* allocate new one */
-    if ( FT_ALLOC( bitmap->buffer, (FT_ULong)pitch * height ) )
+    if ( FT_ALLOC( bitmap->buffer, (FT_ULong)( pitch * height ) ) )
       goto Exit;
     else
       have_buffer = TRUE;
@@ -243,8 +243,8 @@
 
     bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
     bitmap->num_grays  = 256;
-    bitmap->width      = width;
-    bitmap->rows       = height;
+    bitmap->width      = (unsigned int)width;
+    bitmap->rows       = (unsigned int)height;
     bitmap->pitch      = pitch;
 
     /* translate outline to render it into the bitmap */