From b61d92898ed0e7e8ce66b6ec8298c3917a757e89 Mon Sep 17 00:00:00 2001 From: suzuki toshiya Date: Sat, 1 Aug 2009 00:30:23 +0900 Subject: [PATCH] pcf: Improve PCF_PropertyRec.value names on LP64 platforms. --- ChangeLog | 18 ++++++++++++++++++ src/pcf/pcf.h | 4 ++-- src/pcf/pcfdrivr.c | 7 ++++++- src/pcf/pcfread.c | 14 +++++++------- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6952632cb..0fb17c230 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2009-07-31 suzuki toshiya + + 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 pcf: Fix some data types mismatching with their sources. 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 ) {