pcf: Improve PCF_PropertyRec.value names on LP64 platforms.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115
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 )
{