freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 29f05fd: Fix 32bit build warnings (#54239).


From: Werner LEMBERG
Subject: [freetype2] master 29f05fd: Fix 32bit build warnings (#54239).
Date: Wed, 4 Jul 2018 05:50:02 -0400 (EDT)

branch: master
commit 29f05fd02d2ba51965f994456d41ed1e9c9f769a
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    Fix 32bit build warnings (#54239).
    
    * src/base/ftbitmap.c (FT_Bitmap_Blend): Add casts to avoid signed
    vs. unsigned comparisons.
    
    * srb/sfnt/ttcolr.c (tt_face_get_colr_layer): Ditto.
---
 ChangeLog           |  9 +++++++++
 src/base/ftbitmap.c | 12 ++++++------
 src/sfnt/ttcolr.c   |  2 +-
 3 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 4941e0e..9f927fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-07-04  Werner Lemberg  <address@hidden>
+
+       Fix 32bit build warnings (#54239).
+
+       * src/base/ftbitmap.c (FT_Bitmap_Blend): Add casts to avoid signed
+       vs. unsigned comparisons.
+
+       * srb/sfnt/ttcolr.c (tt_face_get_colr_layer): Ditto.
+
 2018-07-02  Jeff Carey  <address@hidden>
 
        * src/psnames/psmodule.c (ps_unicodes_init): Fix alloc debugging.
diff --git a/src/base/ftbitmap.c b/src/base/ftbitmap.c
index 7a08cc9..dc28c40 100644
--- a/src/base/ftbitmap.c
+++ b/src/base/ftbitmap.c
@@ -860,7 +860,7 @@
 
     /* get source bitmap dimensions */
     source_llx = source_offset.x;
-    if ( FT_LONG_MIN + ( source_->rows << 6 ) + 64 > source_offset.y )
+    if ( FT_LONG_MIN + (FT_Pos)( source_->rows << 6 ) + 64 > source_offset.y )
     {
       FT_TRACE5((
         "FT_Bitmap_Blend: y coordinate overflow in source bitmap\n" ));
@@ -868,7 +868,7 @@
     }
     source_lly = source_offset.y - ( source_->rows << 6 );
 
-    if ( FT_LONG_MAX - ( source_->width << 6 ) - 64 < source_llx )
+    if ( FT_LONG_MAX - (FT_Pos)( source_->width << 6 ) - 64 < source_llx )
     {
       FT_TRACE5((
         "FT_Bitmap_Blend: x coordinate overflow in source bitmap\n" ));
@@ -881,7 +881,7 @@
     if ( target->width && target->rows )
     {
       target_llx = target_offset.x;
-      if ( FT_LONG_MIN + ( target->rows << 6 ) > target_offset.y )
+      if ( FT_LONG_MIN + (FT_Pos)( target->rows << 6 ) > target_offset.y )
       {
         FT_TRACE5((
           "FT_Bitmap_Blend: y coordinate overflow in target bitmap\n" ));
@@ -889,7 +889,7 @@
       }
       target_lly = target_offset.y - ( target->rows << 6 );
 
-      if ( FT_LONG_MAX - ( target->width << 6 ) < target_llx )
+      if ( FT_LONG_MAX - (FT_Pos)( target->width << 6 ) < target_llx )
       {
         FT_TRACE5((
           "FT_Bitmap_Blend: x coordinate overflow in target bitmap\n" ));
@@ -968,7 +968,7 @@
       target->pitch      = (int)final_width * 4;
       target->num_grays  = 256;
 
-      if ( FT_LONG_MAX / target->pitch < target->rows )
+      if ( FT_LONG_MAX / target->pitch < (int)target->rows )
       {
         FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
                      final_width, final_rows ));
@@ -995,7 +995,7 @@
 
       new_pitch = (int)final_width * 4;
 
-      if ( FT_LONG_MAX / new_pitch < final_rows )
+      if ( FT_LONG_MAX / new_pitch < (int)final_rows )
       {
         FT_TRACE5(( "FT_Blend_Bitmap: target bitmap too large (%d x %d)\n",
                      final_width, final_rows ));
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 977e149..a8ff026 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -255,7 +255,7 @@
     *aglyph_index = FT_NEXT_USHORT( iterator->p );
     *acolor_index = FT_NEXT_USHORT( iterator->p );
 
-    if ( *aglyph_index >= FT_FACE( face )->num_glyphs                ||
+    if ( *aglyph_index >= (FT_UInt)( FT_FACE( face )->num_glyphs )   ||
          ( *acolor_index != 0xFFFF                                 &&
            *acolor_index >= face->palette_data.num_palette_entries ) )
       return 0;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]