Commit 072e55233e46b9d576bf5440da09ae2f08c5755d

suzuki toshiya 2009-08-01T00:30:23

cff: Cast the long variables to 32-bit for LP64 systems.

diff --git a/ChangeLog b/ChangeLog
index 0fb17c2..95f68eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
 
+	cff: Cast the long variables to 32-bit for LP64 systems.
+
+	* src/cff/cffdrivr.c (cff_get_advances): Insert
+	explicit cast to modify a 32-bit flag by unsigned
+	long constant.
+
+	* src/cff/cffobjs.c (cff_face_init): Ditto.
+
+	* src/cff/cffgload.c (cff_decoder_parse_charstrings):
+	Replace the casts to FT_Long by the casts to FT_Int32
+	for LP64 platforms.
+
+2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
 	pcf: Improve PCF_PropertyRec.value names on LP64 platforms.
 
 	* src/pcf/pcf.h: In PCF_PropertyRec.value, the member
diff --git a/src/cff/cffdrivr.c b/src/cff/cffdrivr.c
index 2ae6423..129a57c 100644
--- a/src/cff/cffdrivr.c
+++ b/src/cff/cffdrivr.c
@@ -200,7 +200,7 @@
     FT_GlyphSlot  slot  = face->glyph;
 
 
-    flags |= FT_LOAD_ADVANCE_ONLY;
+    flags |= (FT_UInt32)FT_LOAD_ADVANCE_ONLY;
 
     for ( nn = 0; nn < count; nn++ )
     {
diff --git a/src/cff/cffgload.c b/src/cff/cffgload.c
index e32d890..d8b74fb 100644
--- a/src/cff/cffgload.c
+++ b/src/cff/cffgload.c
@@ -935,18 +935,18 @@
           ip += 2;
         }
         else if ( v < 247 )
-          val = (FT_Long)v - 139;
+          val = (FT_Int32)v - 139;
         else if ( v < 251 )
         {
           if ( ip >= limit )
             goto Syntax_Error;
-          val = ( (FT_Long)v - 247 ) * 256 + *ip++ + 108;
+          val = ( (FT_Int32)v - 247 ) * 256 + *ip++ + 108;
         }
         else if ( v < 255 )
         {
           if ( ip >= limit )
             goto Syntax_Error;
-          val = -( (FT_Long)v - 251 ) * 256 - *ip++ - 108;
+          val = -( (FT_Int32)v - 251 ) * 256 - *ip++ - 108;
         }
         else
         {
diff --git a/src/cff/cffobjs.c b/src/cff/cffobjs.c
index 9528815..555f2b0 100644
--- a/src/cff/cffobjs.c
+++ b/src/cff/cffobjs.c
@@ -766,22 +766,22 @@
         /*                                                                 */
         /* Compute face flags.                                             */
         /*                                                                 */
-        flags = FT_FACE_FLAG_SCALABLE   |       /* scalable outlines */
-                FT_FACE_FLAG_HORIZONTAL |       /* horizontal data   */
-                FT_FACE_FLAG_HINTER;            /* has native hinter */
+        flags = (FT_UInt32)( FT_FACE_FLAG_SCALABLE   | /* scalable outlines */
+                             FT_FACE_FLAG_HORIZONTAL | /* horizontal data   */
+                             FT_FACE_FLAG_HINTER );    /* has native hinter */
 
         if ( sfnt_format )
-          flags |= FT_FACE_FLAG_SFNT;
+          flags |= (FT_UInt32)FT_FACE_FLAG_SFNT;
 
         /* fixed width font? */
         if ( dict->is_fixed_pitch )
-          flags |= FT_FACE_FLAG_FIXED_WIDTH;
+          flags |= (FT_UInt32)FT_FACE_FLAG_FIXED_WIDTH;
 
   /* XXX: WE DO NOT SUPPORT KERNING METRICS IN THE GPOS TABLE FOR NOW */
 #if 0
         /* kerning available? */
         if ( face->kern_pairs )
-          flags |= FT_FACE_FLAG_KERNING;
+          flags |= (FT_UInt32)FT_FACE_FLAG_KERNING;
 #endif
 
         cffface->face_flags = flags;