Commit b61d92898ed0e7e8ce66b6ec8298c3917a757e89

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

pcf: Improve PCF_PropertyRec.value names on LP64 platforms.

diff --git a/ChangeLog b/ChangeLog
index 6952632..0fb17c2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,23 @@
 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
+	`integer' is replaced by `l', `cardinal' is replaced
+	by `ul', to fix the difference between the name and
+	the types on LP64 platforms.
+
+	* src/pcf/pcfdrivr.c (pcf_get_bdf_property): Reflect
+	PCF_PropertyRec.value change, with appropriate casts
+	to FT_Int32/FT_UInt32.  Their destinations
+	BDF_PropertyRec.{integer|cardinal} are public and
+	explicitly defined as FT_Int32/FT_UInt32.
+
+	* src/pcf/pcfread.c (pcf_get_properties, pcf_load_font):
+	Reflect PCF_PropertyRec.value change.
+
+2009-07-31  suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+
 	pcf: Fix some data types mismatching with their sources.
 
 	* src/pcf/pcfdrivr.c (pcf_cmap_char_index): The type of
diff --git a/src/pcf/pcf.h b/src/pcf/pcf.h
index 9d2d8e0..1cd56c1 100644
--- a/src/pcf/pcf.h
+++ b/src/pcf/pcf.h
@@ -72,8 +72,8 @@ FT_BEGIN_HEADER
     union
     {
       FT_String*  atom;
-      FT_Long     integer;
-      FT_ULong    cardinal;
+      FT_Long     l;
+      FT_ULong    ul;
 
     } value;
 
diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c
index edcd81f..799b498 100644
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -585,12 +585,17 @@ THE SOFTWARE.
       }
       else
       {
+        if ( prop->value.l > 0x7FFFFFFFL || prop->value.l < ( -1 - 0x7FFFFFFFL ) )
+        {
+          FT_TRACE1(( "pcf_get_bdf_property: " ));
+          FT_TRACE1(( "too large integer 0x%x is truncated\n" ));
+        }
         /* Apparently, the PCF driver loads all properties as signed integers!
          * This really doesn't seem to be a problem, because this is
          * sufficient for any meaningful values.
          */
         aproperty->type      = BDF_PROPERTY_TYPE_INTEGER;
-        aproperty->u.integer = prop->value.integer;
+        aproperty->u.integer = (FT_Int32)prop->value.l;
       }
       return 0;
     }
diff --git a/src/pcf/pcfread.c b/src/pcf/pcfread.c
index 6620974..476ffbd 100644
--- a/src/pcf/pcfread.c
+++ b/src/pcf/pcfread.c
@@ -542,9 +542,9 @@ THE SOFTWARE.
       }
       else
       {
-        properties[i].value.integer = props[i].value;
+        properties[i].value.l = props[i].value;
 
-        FT_TRACE4(( " %d\n", properties[i].value.integer ));
+        FT_TRACE4(( " %d\n", properties[i].value.l ));
       }
     }
 
@@ -1201,7 +1201,7 @@ THE SOFTWARE.
 
         prop = pcf_find_property( face, "AVERAGE_WIDTH" );
         if ( prop )
-          bsize->width = (FT_Short)( ( prop->value.integer + 5 ) / 10 );
+          bsize->width = (FT_Short)( ( prop->value.l + 5 ) / 10 );
         else
           bsize->width = (FT_Short)( bsize->height * 2/3 );
 
@@ -1209,19 +1209,19 @@ THE SOFTWARE.
         if ( prop )
           /* convert from 722.7 decipoints to 72 points per inch */
           bsize->size =
-            (FT_Pos)( ( prop->value.integer * 64 * 7200 + 36135L ) / 72270L );
+            (FT_Pos)( ( prop->value.l * 64 * 7200 + 36135L ) / 72270L );
 
         prop = pcf_find_property( face, "PIXEL_SIZE" );
         if ( prop )
-          bsize->y_ppem = (FT_Short)prop->value.integer << 6;
+          bsize->y_ppem = (FT_Short)prop->value.l << 6;
 
         prop = pcf_find_property( face, "RESOLUTION_X" );
         if ( prop )
-          resolution_x = (FT_Short)prop->value.integer;
+          resolution_x = (FT_Short)prop->value.l;
 
         prop = pcf_find_property( face, "RESOLUTION_Y" );
         if ( prop )
-          resolution_y = (FT_Short)prop->value.integer;
+          resolution_y = (FT_Short)prop->value.l;
 
         if ( bsize->y_ppem == 0 )
         {