diff options
author | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-07-03 18:01:26 +0900 |
---|---|---|
committer | suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp> | 2009-07-03 18:01:26 +0900 |
commit | cf37b538d82bded910121eebc44514174048462b (patch) | |
tree | 9f89d52a60ff76b52c6c845a6778039b88e62e0e | |
parent | 902cff743d9b322b1bc02d638cab7e39a2821a76 (diff) | |
download | freetype2-cf37b538d82bded910121eebc44514174048462b.tar.gz |
pcf: Improve PCF_PropertyRec.value names on LP64 platforms.
-rw-r--r-- | ChangeLog | 18 | ||||
-rw-r--r-- | src/pcf/pcf.h | 4 | ||||
-rw-r--r-- | src/pcf/pcfdrivr.c | 7 | ||||
-rw-r--r-- | src/pcf/pcfread.c | 14 |
4 files changed, 33 insertions, 10 deletions
@@ -1,5 +1,23 @@ 2009-07-03 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-03 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 9d2d8e0e4..1cd56c13a 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 edcd81f4e..799b498c0 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 662097457..476ffbd53 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 ) { |