From 99aa14c226abb6ee6130cc7ef91cb97695dc49cc Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Mon, 5 Sep 2005 19:31:27 +0000 Subject: [PATCH] Fixes for `make multi' and using C++ compiler. * gxvalid/gxvcommn.c (gxv_set_length_by_ushort_offset, gxv_set_length_by_ulong_offset, gxv_array_getlimits_byte, gxv_array_getlimits_ushort): Declare with FT_LOCAL_DEF. (gxv_compare_ranges): Make it static. (gxv_LookupTable_fmt0_validate, gxv_LookupTable_fmt2_validate, gxv_LookupTable_fmt4_validate, gxv_LookupTable_fmt6_validate, gxv_LookupTable_fmt8_validate, gxv_LookupTable_validate): Improve trace messages. (gxv_StateArray_validate, gxv_XStateArray_validate): s/class/clazz/. (GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE, GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Move to gxvcommn.h. * gxvalid/gxvcommn.h: Add prototypes for gxv_StateTable_subtable_setup, gxv_XStateTable_subtable_setup, gxv_XStateTable_validate, gxv_array_getlimits_byte, gxv_array_getlimits_ushort, gxv_set_length_by_ushort_offset, gxv_set_length_by_ulong_offset, gxv_odtect_add_range, gxv_odtect_validate. (GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE, GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Moved from gxvcommn.c. * src/gxvalid/gxvbsln.c (gxv_bsln_LookupValue_validate, gxv_bsln_parts_fmt1_validate): Improve trace messages. * gxvalid/gxvfeat.c: Split off predefined registry stuff to... * gxvalid/gxvfeat.h: New file. * gxvalid/gxvjust.c (gxv_just_wdc_entry_validate): Improve trace message. * gxvalid/gxvkern.c (GXV_kern_Dialect): Add KERN_DIALECT_UNKNOWN. (gxv_kern_subtable_fmt1_valueTable_load, gxv_kern_subtable_fmt1_subtable_setup, gxv_kern_subtable_fmt1_entry_validate): Fix C++ compiler errors. (gxv_kern_coverage_validate): Use KERN_DIALECT_UNKWOWN. Improve trace message. (gxv_kern_validate_generic): Fix C++ compiler error. Improve trace message. (gxv_kern_validate_classic): Fix C++ compiler error. * gxvalid/gxvmort0.c (gxv_mort_subtable_type0_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmort1.c (gxv_mort_subtable_type1_substitutionTable_load, gxv_mort_subtable_type1_subtable_setup): Fix C++ compiler errors. (gxv_mort_subtable_type1_substTable_validate): Improve trace message. (gxv_mort_subtable_type1_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmort2.c (gxv_mort_subtable_type2_opttable_load, gxv_mort_subtable_type2_subtable_setup, gxv_mort_subtable_type2_ligActionOffset_validate, gxv_mort_subtable_type2_ligatureTable_validate): Fix C++ compiler errors. (gxv_mort_subtable_type2_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmort4.c (gxv_mort_subtable_type4_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup, gxv_mort_subtable_type5_InsertList_validate): Fix C++ compiler errors. (gxv_mort_subtable_type5_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmort.c: Include gxvfeat.h. (gxv_mort_featurearray_validate, gxv_mort_coverage_validate): Declare with FT_LOCAL_DEF. (gxv_mort_subtables_validate, gxv_mort_validate): Improve trace messages. * gxvalid/gxvmort.h (gxv_mort_feature_validate): Remove. * gxvalid/gxvmorx0.c (gxv_morx_subtable_type0_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmorx1.c (gxv_morx_subtable_type1_substitutionTable_load, gxv_morx_subtable_type1_subtable_setup, gxv_morx_subtable_type1_entry_validate, gxv_morx_subtable_type1_substitutionTable_validate): Fix C++ compiler errors. (gxv_morx_subtable_type1_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmorx2.c (gxv_morx_subtable_type2_opttable_load, gxv_morx_subtable_type2_subtable_setup, gxv_morx_subtable_type2_ligActionIndex_validate, gxv_morx_subtable_type2_ligatureTable_validate): Fix C++ compiler errors. (gxv_morx_subtable_type2_validate): Declare with FT_LOCAL_DEF. Fix typo. * gxvalid/gxvmorx4.c (gxv_morx_subtable_type4_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmorx5.c (gxv_morx_subtable_type5_insertionGlyph_load, gxv_morx_subtable_type5_subtable_setup): Fix C++ compiler error. (gxv_morx_subtable_type5_validate): Declare with FT_LOCAL_DEF. * gxvalid/gxvmorx.c (gxv_morx_subtables_validate, gxv_morx_validate): Improve trace message. * gxvalid/gxvopbd.c (gxv_opbd_LookupFmt4_transit): Fix compiler warnings. (gxv_opbd_validate): Improve trace message. * gxvalid/gxvprop.c: Decorate constants with `U' and `L' where appropriate. (gxv_prop_zero_advance_validate, gxv_prop_validate): Improve trace message. * gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): Remove unused parameter. Update all callers. (gxv_trak_validate): Improve trace message. * rules.mk (GXV_DRV_H): Add gxvfeat.h. --- ChangeLog | 131 ++++++++++++++++++++++++++++++- src/gxvalid/gxvbsln.c | 4 +- src/gxvalid/gxvcommn.c | 40 ++++------ src/gxvalid/gxvcommn.h | 75 +++++++++++++++++- src/gxvalid/gxvfeat.c | 135 +------------------------------- src/gxvalid/gxvfeat.h | 172 +++++++++++++++++++++++++++++++++++++++++ src/gxvalid/gxvjust.c | 2 +- src/gxvalid/gxvkern.c | 26 ++++--- src/gxvalid/gxvmort.c | 11 +-- src/gxvalid/gxvmort.h | 4 - src/gxvalid/gxvmort0.c | 2 +- src/gxvalid/gxvmort1.c | 8 +- src/gxvalid/gxvmort2.c | 10 +-- src/gxvalid/gxvmort4.c | 2 +- src/gxvalid/gxvmort5.c | 6 +- src/gxvalid/gxvmorx.c | 6 +- src/gxvalid/gxvmorx.h | 4 +- src/gxvalid/gxvmorx0.c | 2 +- src/gxvalid/gxvmorx1.c | 10 +-- src/gxvalid/gxvmorx2.c | 12 +-- src/gxvalid/gxvmorx4.c | 2 +- src/gxvalid/gxvmorx5.c | 6 +- src/gxvalid/gxvopbd.c | 39 ++++++---- src/gxvalid/gxvprop.c | 78 +++++++++---------- src/gxvalid/gxvtrak.c | 37 ++++----- src/gxvalid/rules.mk | 29 +++---- 26 files changed, 544 insertions(+), 309 deletions(-) create mode 100644 src/gxvalid/gxvfeat.h diff --git a/ChangeLog b/ChangeLog index dee79adb5..ac2fbe3cf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,126 @@ +2005-09-05 Werner Lemberg + + Fixes for `make multi' and using C++ compiler. + + * gxvalid/gxvcommn.c (gxv_set_length_by_ushort_offset, + gxv_set_length_by_ulong_offset, gxv_array_getlimits_byte, + gxv_array_getlimits_ushort): Declare with FT_LOCAL_DEF. + (gxv_compare_ranges): Make it static. + (gxv_LookupTable_fmt0_validate, gxv_LookupTable_fmt2_validate, + gxv_LookupTable_fmt4_validate, gxv_LookupTable_fmt6_validate, + gxv_LookupTable_fmt8_validate, gxv_LookupTable_validate): Improve + trace messages. + (gxv_StateArray_validate, gxv_XStateArray_validate): s/class/clazz/. + (GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE, + GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Move to + gxvcommn.h. + + * gxvalid/gxvcommn.h: Add prototypes for + gxv_StateTable_subtable_setup, gxv_XStateTable_subtable_setup, + gxv_XStateTable_validate, gxv_array_getlimits_byte, + gxv_array_getlimits_ushort, gxv_set_length_by_ushort_offset, + gxv_set_length_by_ulong_offset, gxv_odtect_add_range, + gxv_odtect_validate. + (GXV_STATETABLE_HEADER_SIZE, GXV_STATEHEADER_SIZE, + GXV_XSTATETABLE_HEADER_SIZE, GXV_XSTATEHEADER_SIZE): Moved from + gxvcommn.c. + + * src/gxvalid/gxvbsln.c (gxv_bsln_LookupValue_validate, + gxv_bsln_parts_fmt1_validate): Improve trace messages. + + * gxvalid/gxvfeat.c: Split off predefined registry stuff to... + * gxvalid/gxvfeat.h: New file. + + * gxvalid/gxvjust.c (gxv_just_wdc_entry_validate): Improve trace + message. + + * gxvalid/gxvkern.c (GXV_kern_Dialect): Add KERN_DIALECT_UNKNOWN. + (gxv_kern_subtable_fmt1_valueTable_load, + gxv_kern_subtable_fmt1_subtable_setup, + gxv_kern_subtable_fmt1_entry_validate): Fix C++ compiler errors. + (gxv_kern_coverage_validate): Use KERN_DIALECT_UNKWOWN. + Improve trace message. + (gxv_kern_validate_generic): Fix C++ compiler error. + Improve trace message. + (gxv_kern_validate_classic): Fix C++ compiler error. + + * gxvalid/gxvmort0.c (gxv_mort_subtable_type0_validate): Declare + with FT_LOCAL_DEF. + + * gxvalid/gxvmort1.c + (gxv_mort_subtable_type1_substitutionTable_load, + gxv_mort_subtable_type1_subtable_setup): Fix C++ compiler errors. + (gxv_mort_subtable_type1_substTable_validate): Improve trace + message. + (gxv_mort_subtable_type1_validate): Declare with FT_LOCAL_DEF. + + * gxvalid/gxvmort2.c (gxv_mort_subtable_type2_opttable_load, + gxv_mort_subtable_type2_subtable_setup, + gxv_mort_subtable_type2_ligActionOffset_validate, + gxv_mort_subtable_type2_ligatureTable_validate): Fix C++ compiler + errors. + (gxv_mort_subtable_type2_validate): Declare with FT_LOCAL_DEF. + + * gxvalid/gxvmort4.c (gxv_mort_subtable_type4_validate): Declare + with FT_LOCAL_DEF. + + * gxvalid/gxvmort5.c (gxv_mort_subtable_type5_subtable_setup, + gxv_mort_subtable_type5_InsertList_validate): Fix C++ compiler + errors. + (gxv_mort_subtable_type5_validate): Declare with FT_LOCAL_DEF. + + * gxvalid/gxvmort.c: Include gxvfeat.h. + (gxv_mort_featurearray_validate, gxv_mort_coverage_validate): + Declare with FT_LOCAL_DEF. + (gxv_mort_subtables_validate, gxv_mort_validate): Improve trace + messages. + + * gxvalid/gxvmort.h (gxv_mort_feature_validate): Remove. + + * gxvalid/gxvmorx0.c (gxv_morx_subtable_type0_validate): Declare + with FT_LOCAL_DEF. + + * gxvalid/gxvmorx1.c + (gxv_morx_subtable_type1_substitutionTable_load, + gxv_morx_subtable_type1_subtable_setup, + gxv_morx_subtable_type1_entry_validate, + gxv_morx_subtable_type1_substitutionTable_validate): Fix C++ + compiler errors. + (gxv_morx_subtable_type1_validate): Declare with FT_LOCAL_DEF. + + * gxvalid/gxvmorx2.c (gxv_morx_subtable_type2_opttable_load, + gxv_morx_subtable_type2_subtable_setup, + gxv_morx_subtable_type2_ligActionIndex_validate, + gxv_morx_subtable_type2_ligatureTable_validate): Fix C++ compiler + errors. + (gxv_morx_subtable_type2_validate): Declare with FT_LOCAL_DEF. + Fix typo. + + * gxvalid/gxvmorx4.c (gxv_morx_subtable_type4_validate): Declare + with FT_LOCAL_DEF. + + * gxvalid/gxvmorx5.c (gxv_morx_subtable_type5_insertionGlyph_load, + gxv_morx_subtable_type5_subtable_setup): Fix C++ compiler error. + (gxv_morx_subtable_type5_validate): Declare with FT_LOCAL_DEF. + + * gxvalid/gxvmorx.c (gxv_morx_subtables_validate, + gxv_morx_validate): Improve trace message. + + * gxvalid/gxvopbd.c (gxv_opbd_LookupFmt4_transit): Fix compiler + warnings. + (gxv_opbd_validate): Improve trace message. + + * gxvalid/gxvprop.c: Decorate constants with `U' and `L' where + appropriate. + (gxv_prop_zero_advance_validate, gxv_prop_validate): Improve trace + message. + + * gxvalid/gxvtrak.c (gxv_trak_trackTable_validate): Remove unused + parameter. Update all callers. + (gxv_trak_validate): Improve trace message. + + * rules.mk (GXV_DRV_H): Add gxvfeat.h. + 2005-09-01 Werner Lemberg * src/gxvalid/gxvbsln.c (GXV_BSLN_VALUE_EMPTY): Add `U'. @@ -8,7 +131,7 @@ * src/gxvalid/gxvmorx0.c, src/gxvalid/gxvmorx1.c, src/gxvalid/gxvmorx2.c, src/gxvalid/gxvmorx4.c, - src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve tracing + src/gxvalid/gxvmorx5.c, src/gxvalid/gxvmort.c: Improve trace messages. Decorate constants with `U' and `L' where appropriate. Fix compiler warnings. @@ -17,7 +140,7 @@ * src/truetype/ttgload.c (load_truetype_glyph): Fix typo. - * src/gxvalid/gxvbsln.c (gxv_bsln_validate): Fix tracing message. + * src/gxvalid/gxvbsln.c (gxv_bsln_validate): Fix trace message. * src/gxvalid/gxvcommn.c (gxv_odtect_add_range): Use `const'. @@ -25,7 +148,7 @@ src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmod.c, src/gxvalid/gxvmort0.c, src/gxvalid/gxvmort1.c, src/gxvalid/gxvmort2.c, src/gxvalid/gxvmort4.c, - src/gxvalid/gxvmort5.c, src/gxvalid/gxvmort.c: Improve tracing + src/gxvalid/gxvmort5.c, src/gxvalid/gxvmort.c: Improve trace messages. Decorate constants with `U' and `L' where appropriate. Fix compiler warnings. @@ -37,7 +160,7 @@ * src/gxvalid/gxvcommn.c: Fix compiler warnings. (gxv_XEntryTable_validate, gxv_compare_ranges): Remove unused parameter. Update all callers. - Improve tracing messages. + Improve trace messages. Some formatting. 2005-08-29 Werner Lemberg diff --git a/src/gxvalid/gxvbsln.c b/src/gxvalid/gxvbsln.c index 5a6389fef..c330138df 100644 --- a/src/gxvalid/gxvbsln.c +++ b/src/gxvalid/gxvbsln.c @@ -80,7 +80,7 @@ FT_UNUSED( glyph ); - GXV_NAME_ENTER( " lookup value" ); + GXV_NAME_ENTER( "lookup value" ); if ( v >= GXV_BSLN_VALUE_COUNT ) FT_INVALID_DATA; @@ -171,7 +171,7 @@ FT_Bytes p = tables; - GXV_NAME_ENTER( " parts format 1" ); + GXV_NAME_ENTER( "parts format 1" ); /* deltas */ gxv_bsln_parts_fmt0_validate( p, limit, valid ); diff --git a/src/gxvalid/gxvcommn.c b/src/gxvalid/gxvcommn.c index 5e0b6f37d..c7bdfd194 100644 --- a/src/gxvalid/gxvcommn.c +++ b/src/gxvalid/gxvcommn.c @@ -58,13 +58,13 @@ } - static void + FT_LOCAL_DEF( void ) gxv_set_length_by_ushort_offset( FT_UShort* offset, FT_UShort** length, FT_UShort* buff, FT_UInt nmemb, FT_UShort limit, - GXV_Validator valid) + GXV_Validator valid ) { FT_UInt i; @@ -123,7 +123,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_set_length_by_ulong_offset( FT_ULong* offset, FT_ULong** length, FT_ULong* buff, @@ -176,7 +176,7 @@ /*************************************************************************/ - static void + FT_LOCAL_DEF( void ) gxv_array_getlimits_byte( FT_Bytes table, FT_Bytes limit, FT_Byte* min, @@ -205,7 +205,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_array_getlimits_ushort( FT_Bytes table, FT_Bytes limit, FT_UShort* min, @@ -430,7 +430,7 @@ GXV_LookupValueDesc value; - GXV_NAME_ENTER( " LookupTable format 0" ); + GXV_NAME_ENTER( "LookupTable format 0" ); GXV_LIMIT_CHECK( 2 * valid->face->num_glyphs ); @@ -507,7 +507,7 @@ GXV_LookupValueDesc value; - GXV_NAME_ENTER( " LookupTable format 2" ); + GXV_NAME_ENTER( "LookupTable format 2" ); unitSize = nUnits = 0; gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid ); @@ -581,7 +581,7 @@ GXV_LookupValueDesc value; - GXV_NAME_ENTER( " LookupTable format 4" ); + GXV_NAME_ENTER( "LookupTable format 4" ); unitSize = nUnits = 0; gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid ); @@ -678,7 +678,7 @@ GXV_LookupValueDesc value; - GXV_NAME_ENTER( " LookupTable format 6" ); + GXV_NAME_ENTER( "LookupTable format 6" ); unitSize = nUnits = 0; gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid ); @@ -731,7 +731,7 @@ FT_UShort glyphCount; - GXV_NAME_ENTER( " LookupTable format 8" ); + GXV_NAME_ENTER( "LookupTable format 8" ); /* firstGlyph + glyphCount */ GXV_LIMIT_CHECK( 2 + 2 ); @@ -778,7 +778,7 @@ GXV_Validate_Func func; - GXV_NAME_ENTER(" LookupTable" ); + GXV_NAME_ENTER( "LookupTable" ); /* lookuptbl_head may be used in fmt4 transit function. */ valid->lookuptbl_head = table; @@ -1028,7 +1028,7 @@ { FT_Bytes p = table; FT_Bytes limit = table + *length_p; - FT_Byte class; + FT_Byte clazz; FT_Byte entry; @@ -1050,7 +1050,7 @@ while ( p + ( 1 + maxClassID ) <= limit ) { (*maxState_p)++; - for ( class = 0; class <= maxClassID; class++ ) + for ( clazz = 0; clazz <= maxClassID; clazz++ ) { entry = FT_NEXT_BYTE( p ); *maxEntry_p = FT_MAX( *maxEntry_p, entry ); @@ -1220,9 +1220,6 @@ FT_UShort stateArray; /* offset to StateArray */ FT_UShort entryTable; /* offset to EntryTable */ -#define GXV_STATETABLE_HEADER_SIZE ( 2 + 2 + 2 + 2 ) -#define GXV_STATEHEADER_SIZE GXV_STATETABLE_HEADER_SIZE - FT_UShort classTable_length; FT_UShort stateArray_length; FT_UShort entryTable_length; @@ -1416,7 +1413,7 @@ { FT_Bytes p = table; FT_Bytes limit = table + *length_p; - FT_UShort class; + FT_UShort clazz; FT_UShort entry; @@ -1438,7 +1435,7 @@ while ( p + ( ( 1 + maxClassID ) * 2 ) <= limit ) { (*maxState_p)++; - for ( class = 0; class <= maxClassID; class++ ) + for ( clazz = 0; clazz <= maxClassID; clazz++ ) { entry = FT_NEXT_USHORT( p ); *maxEntry_p = FT_MAX( *maxEntry_p, entry ); @@ -1564,9 +1561,6 @@ FT_ULong stateArray; /* offset to StateArray */ FT_ULong entryTable; /* offset to EntryTable */ -#define GXV_XSTATETABLE_HEADER_SIZE ( 4 + 4 + 4 + 4 ) -#define GXV_XSTATEHEADER_SIZE GXV_XSTATETABLE_HEADER_SIZE - FT_ULong classTable_length; FT_ULong stateArray_length; FT_ULong entryTable_length; @@ -1669,7 +1663,7 @@ /*************************************************************************/ /*************************************************************************/ - FT_LOCAL_DEF( int ) + static int gxv_compare_ranges( FT_Bytes table1_start, FT_ULong table1_length, FT_Bytes table2_start, @@ -1712,7 +1706,7 @@ FT_LOCAL_DEF( void ) gxv_odtect_validate( GXV_odtect_Range odtect, - GXV_Validator valid ) + GXV_Validator valid ) { FT_UInt i, j; diff --git a/src/gxvalid/gxvcommn.h b/src/gxvalid/gxvcommn.h index 3b83c007f..14fef98c1 100644 --- a/src/gxvalid/gxvcommn.h +++ b/src/gxvalid/gxvcommn.h @@ -409,20 +409,76 @@ FT_BEGIN_HEADER /*************************************************************************/ /*************************************************************************/ + FT_LOCAL( void ) + gxv_StateTable_subtable_setup( FT_UShort table_size, + FT_UShort classTable, + FT_UShort stateArray, + FT_UShort entryTable, + FT_UShort* classTable_length_p, + FT_UShort* stateArray_length_p, + FT_UShort* entryTable_length_p, + GXV_Validator valid ); + + FT_LOCAL( void ) + gxv_XStateTable_subtable_setup( FT_ULong table_size, + FT_ULong classTable, + FT_ULong stateArray, + FT_ULong entryTable, + FT_ULong* classTable_length_p, + FT_ULong* stateArray_length_p, + FT_ULong* entryTable_length_p, + GXV_Validator valid ); + FT_LOCAL( void ) gxv_StateTable_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ); + FT_LOCAL( void ) + gxv_XStateTable_validate( FT_Bytes table, + FT_Bytes limit, + GXV_Validator valid ); + /*************************************************************************/ /*************************************************************************/ /***** *****/ - /***** UTILITY MACRO *****/ + /***** UTILITY MACROS AND FUNCTIONS *****/ /***** *****/ /*************************************************************************/ /*************************************************************************/ + FT_LOCAL( void ) + gxv_array_getlimits_byte( FT_Bytes table, + FT_Bytes limit, + FT_Byte* min, + FT_Byte* max, + GXV_Validator valid ); + + FT_LOCAL( void ) + gxv_array_getlimits_ushort( FT_Bytes table, + FT_Bytes limit, + FT_UShort* min, + FT_UShort* max, + GXV_Validator valid ); + + FT_LOCAL( void ) + gxv_set_length_by_ushort_offset( FT_UShort* offset, + FT_UShort** length, + FT_UShort* buff, + FT_UInt nmemb, + FT_UShort limit, + GXV_Validator valid ); + + FT_LOCAL( void ) + gxv_set_length_by_ulong_offset( FT_ULong* offset, + FT_ULong** length, + FT_ULong* buff, + FT_UInt nmemb, + FT_ULong limit, + GXV_Validator valid); + + #define GXV_SUBTABLE_OFFSET_CHECK( _offset ) \ FT_BEGIN_STMNT \ if ( (_offset) > valid->subtable_length ) \ @@ -439,6 +495,12 @@ FT_BEGIN_HEADER #define GXV_USHORT_TO_SHORT( _us ) \ ( ( 0x8000U < ( _us ) ) ? ( ( _us ) - 0x8000U ) : ( _us ) ) +#define GXV_STATETABLE_HEADER_SIZE ( 2 + 2 + 2 + 2 ) +#define GXV_STATEHEADER_SIZE GXV_STATETABLE_HEADER_SIZE + +#define GXV_XSTATETABLE_HEADER_SIZE ( 4 + 4 + 4 + 4 ) +#define GXV_XSTATEHEADER_SIZE GXV_XSTATETABLE_HEADER_SIZE + /*************************************************************************/ /*************************************************************************/ @@ -464,6 +526,17 @@ FT_BEGIN_HEADER } GXV_odtect_RangeRec, *GXV_odtect_Range; + FT_LOCAL( void ) + gxv_odtect_add_range( FT_Bytes start, + FT_ULong length, + const FT_String* name, + GXV_odtect_Range odtect ); + + FT_LOCAL( void ) + gxv_odtect_validate( GXV_odtect_Range odtect, + GXV_Validator valid ); + + #define GXV_ODTECT( n, odtect ) \ GXV_odtect_DataRec odtect ## _range[n]; \ GXV_odtect_RangeRec odtect ## _rec = { 0, NULL }; \ diff --git a/src/gxvalid/gxvfeat.c b/src/gxvalid/gxvfeat.c index ceeff9f5c..05e784b91 100644 --- a/src/gxvalid/gxvfeat.c +++ b/src/gxvalid/gxvfeat.c @@ -26,6 +26,7 @@ #include "gxvalid.h" #include "gxvcommn.h" +#include "gxvfeat.h" /*************************************************************************/ @@ -38,140 +39,6 @@ #define FT_COMPONENT trace_gxvfeat - /*************************************************************************/ - /*************************************************************************/ - /***** *****/ - /***** Registry predefined by Apple *****/ - /***** *****/ - /*************************************************************************/ - /*************************************************************************/ - - /* TODO: More compact format */ - typedef struct GXV_Feature_RegistryRec_ - { - FT_Bool existence; - FT_Bool apple_reserved; - FT_Bool exclusive; - FT_Byte nSettings; - - } GX_Feature_RegistryRec; - - -#define gxv_feat_registry_length \ - ( sizeof ( gxv_feat_registry ) / \ - sizeof ( GX_Feature_RegistryRec ) ) - - - static GX_Feature_RegistryRec gxv_feat_registry[] = - { - /* Generated from gxvfgen.c */ - {1, 0, 0, 1}, /* All Typographic Features */ - {1, 0, 0, 8}, /* Ligatures */ - {1, 0, 1, 3}, /* Cursive Connection */ - {1, 0, 1, 6}, /* Letter Case */ - {1, 0, 0, 1}, /* Vertical Substitution */ - {1, 0, 0, 1}, /* Linguistic Rearrangement */ - {1, 0, 1, 2}, /* Number Spacing */ - {1, 1, 0, 0}, /* Apple Reserved 1 */ - {1, 0, 0, 5}, /* Smart Swashes */ - {1, 0, 1, 3}, /* Diacritics */ - {1, 0, 1, 4}, /* Vertical Position */ - {1, 0, 1, 3}, /* Fractions */ - {1, 1, 0, 0}, /* Apple Reserved 2 */ - {1, 0, 0, 1}, /* Overlapping Characters */ - {1, 0, 0, 6}, /* Typographic Extras */ - {1, 0, 0, 5}, /* Mathematical Extras */ - {1, 0, 1, 7}, /* Ornament Sets */ - {1, 0, 1, 1}, /* Character Alternatives */ - {1, 0, 1, 5}, /* Design Complexity */ - {1, 0, 1, 6}, /* Style Options */ - {1, 0, 1, 11}, /* Character Shape */ - {1, 0, 1, 2}, /* Number Case */ - {1, 0, 1, 4}, /* Text Spacing */ - {1, 0, 1, 10}, /* Transliteration */ - {1, 0, 1, 9}, /* Annotation */ - {1, 0, 1, 2}, /* Kana Spacing */ - {1, 0, 1, 2}, /* Ideographic Spacing */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {0, 0, 0, 0}, /* __EMPTY__ */ - {1, 0, 1, 4}, /* Text Spacing */ - {1, 0, 1, 2}, /* Kana Spacing */ - {1, 0, 1, 2}, /* Ideographic Spacing */ - {1, 0, 1, 4}, /* CJK Roman Spacing */ - }; - - /*************************************************************************/ /*************************************************************************/ /***** *****/ diff --git a/src/gxvalid/gxvfeat.h b/src/gxvalid/gxvfeat.h new file mode 100644 index 000000000..049d23a0b --- /dev/null +++ b/src/gxvalid/gxvfeat.h @@ -0,0 +1,172 @@ +/***************************************************************************/ +/* */ +/* gxvfeat.h */ +/* */ +/* TrueTypeGX/AAT feat table validation (specification). */ +/* */ +/* Copyright 2004, 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ +/* David Turner, Robert Wilhelm, and Werner Lemberg. */ +/* */ +/* This file is part of the FreeType project, and may only be used, */ +/* modified, and distributed under the terms of the FreeType project */ +/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ +/* this file you indicate that you have read the license and */ +/* understand and accept it fully. */ +/* */ +/***************************************************************************/ + +/***************************************************************************/ +/* */ +/* gxvalid is derived from both gxlayout module and otvalid module. */ +/* Development of gxlayout is supported by the Information-technology */ +/* Promotion Agency(IPA), Japan. */ +/* */ +/***************************************************************************/ + + +#ifndef __GXVFEAT_H__ +#define __GXVFEAT_H__ + + +#include "gxvalid.h" +#include "gxvcommn.h" + + + /*************************************************************************/ + /*************************************************************************/ + /***** *****/ + /***** Registry predefined by Apple *****/ + /***** *****/ + /*************************************************************************/ + /*************************************************************************/ + + /* TODO: More compact format */ + typedef struct GXV_Feature_RegistryRec_ + { + FT_Bool existence; + FT_Bool apple_reserved; + FT_Bool exclusive; + FT_Byte nSettings; + + } GX_Feature_RegistryRec; + + +#define gxv_feat_registry_length \ + ( sizeof ( gxv_feat_registry ) / \ + sizeof ( GX_Feature_RegistryRec ) ) + + + static GX_Feature_RegistryRec gxv_feat_registry[] = + { + /* Generated from gxvfgen.c */ + {1, 0, 0, 1}, /* All Typographic Features */ + {1, 0, 0, 8}, /* Ligatures */ + {1, 0, 1, 3}, /* Cursive Connection */ + {1, 0, 1, 6}, /* Letter Case */ + {1, 0, 0, 1}, /* Vertical Substitution */ + {1, 0, 0, 1}, /* Linguistic Rearrangement */ + {1, 0, 1, 2}, /* Number Spacing */ + {1, 1, 0, 0}, /* Apple Reserved 1 */ + {1, 0, 0, 5}, /* Smart Swashes */ + {1, 0, 1, 3}, /* Diacritics */ + {1, 0, 1, 4}, /* Vertical Position */ + {1, 0, 1, 3}, /* Fractions */ + {1, 1, 0, 0}, /* Apple Reserved 2 */ + {1, 0, 0, 1}, /* Overlapping Characters */ + {1, 0, 0, 6}, /* Typographic Extras */ + {1, 0, 0, 5}, /* Mathematical Extras */ + {1, 0, 1, 7}, /* Ornament Sets */ + {1, 0, 1, 1}, /* Character Alternatives */ + {1, 0, 1, 5}, /* Design Complexity */ + {1, 0, 1, 6}, /* Style Options */ + {1, 0, 1, 11}, /* Character Shape */ + {1, 0, 1, 2}, /* Number Case */ + {1, 0, 1, 4}, /* Text Spacing */ + {1, 0, 1, 10}, /* Transliteration */ + {1, 0, 1, 9}, /* Annotation */ + {1, 0, 1, 2}, /* Kana Spacing */ + {1, 0, 1, 2}, /* Ideographic Spacing */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {0, 0, 0, 0}, /* __EMPTY__ */ + {1, 0, 1, 4}, /* Text Spacing */ + {1, 0, 1, 2}, /* Kana Spacing */ + {1, 0, 1, 2}, /* Ideographic Spacing */ + {1, 0, 1, 4}, /* CJK Roman Spacing */ + }; + + +#endif /* __GXVFEAT_H__ */ + + +/* END */ diff --git a/src/gxvalid/gxvjust.c b/src/gxvalid/gxvjust.c index a841b406f..ec092ebe2 100644 --- a/src/gxvalid/gxvjust.c +++ b/src/gxvalid/gxvjust.c @@ -108,7 +108,7 @@ count = FT_NEXT_ULONG( p ); for ( i = 0; i < count; i++ ) { - GXV_TRACE(( "validate wdc pair %d/%d\n", i + 1, count )); + GXV_TRACE(( "validating wdc pair %d/%d\n", i + 1, count )); gxv_just_wdp_entry_validate( p, limit, valid ); p += valid->subtable_length; } diff --git a/src/gxvalid/gxvkern.c b/src/gxvalid/gxvkern.c index 645c4ff4a..a17ba9c76 100644 --- a/src/gxvalid/gxvkern.c +++ b/src/gxvalid/gxvkern.c @@ -59,9 +59,10 @@ typedef enum GXV_kern_Dialect_ { - KERN_DIALECT_MS = FT_VALIDATE_MS, - KERN_DIALECT_APPLE = FT_VALIDATE_APPLE, - KERN_DIALECT_ANY = FT_VALIDATE_CKERN + KERN_DIALECT_UNKNOWN = 0, + KERN_DIALECT_MS = FT_VALIDATE_MS, + KERN_DIALECT_APPLE = FT_VALIDATE_APPLE, + KERN_DIALECT_ANY = FT_VALIDATE_CKERN } GXV_kern_Dialect; @@ -168,7 +169,8 @@ GXV_Validator valid ) { FT_Bytes p = table; - GXV_kern_fmt1_StateOptRecData optdata = valid->statetable.optdata; + GXV_kern_fmt1_StateOptRecData optdata = + (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata; GXV_LIMIT_CHECK( 2 ); @@ -193,7 +195,8 @@ FT_UShort *l[4]; FT_UShort buff[5]; - GXV_kern_fmt1_StateOptRecData optdata = valid->statetable.optdata; + GXV_kern_fmt1_StateOptRecData optdata = + (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata; o[0] = classTable; @@ -236,7 +239,8 @@ valueOffset = flags & 0x3FFF; { - GXV_kern_fmt1_StateOptRecData vt_rec = valid->statetable.optdata; + GXV_kern_fmt1_StateOptRecData vt_rec = + (GXV_kern_fmt1_StateOptRecData)valid->statetable.optdata; FT_Bytes p; @@ -612,10 +616,10 @@ FT_UShort* format, GXV_Validator valid ) { - FT_Int result = 0; + GXV_kern_Dialect result = KERN_DIALECT_UNKNOWN; - GXV_NAME_ENTER( "validate coverage" ); + GXV_NAME_ENTER( "validating coverage" ); GXV_TRACE(( "interprete coverage 0x%04x by Apple style\n", coverage )); @@ -767,7 +771,7 @@ KERN_DIALECT( valid ) = dialect_request; GXV_LIMIT_CHECK( 2 ); - GXV_KERN_DATA( version ) = FT_NEXT_USHORT( p ); + GXV_KERN_DATA( version ) = (GXV_kern_Version)FT_NEXT_USHORT( p ); GXV_TRACE(( "version 0x%04x (higher 16bit)\n", GXV_KERN_DATA( version ) )); @@ -792,7 +796,7 @@ for ( i = 0; i < nTables; i++ ) { - GXV_TRACE(( "validate subtable %d/%d\n", i, nTables )); + GXV_TRACE(( "validating subtable %d/%d\n", i, nTables )); /* p should be 32bit-aligned? */ gxv_kern_subtable_validate( p, 0, valid ); p += valid->subtable_length; @@ -820,7 +824,7 @@ GXV_kern_Dialect dialect_request; - dialect_request = dialect_flags; + dialect_request = (GXV_kern_Dialect)dialect_flags; gxv_kern_validate_generic( table, face, 1, dialect_request, ftvalid ); } diff --git a/src/gxvalid/gxvmort.c b/src/gxvalid/gxvmort.c index 376ca916f..4cb3a19e3 100644 --- a/src/gxvalid/gxvmort.c +++ b/src/gxvalid/gxvmort.c @@ -25,6 +25,7 @@ #include "gxvmort.h" +#include "gxvfeat.h" /*************************************************************************/ @@ -88,7 +89,7 @@ * nFeatureFlags is typed to FT_UInt to accept that in * mort (typed FT_UShort) and morx (typed FT_ULong). */ - static void + FT_LOCAL_DEF( void ) gxv_mort_featurearray_validate( FT_Bytes table, FT_Bytes limit, FT_UInt nFeatureFlags, @@ -120,7 +121,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_mort_coverage_validate( FT_UShort coverage, GXV_Validator valid ) { @@ -184,7 +185,7 @@ coverage = FT_NEXT_USHORT( p ); subFeatureFlags = FT_NEXT_ULONG( p ); - GXV_TRACE(( "validate chain subtable %d/%d (%d bytes)\n", + GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n", i + 1, nSubtables, length )); type = coverage & 0x0007; rest = length - ( 2 + 2 + 4 ); @@ -258,7 +259,7 @@ valid->face = face; limit = valid->root->limit; - FT_TRACE3(( "validation mort table\n" )); + FT_TRACE3(( "validating `mort' table\n" )); GXV_INIT; GXV_LIMIT_CHECK( 4 + 4 ); @@ -270,7 +271,7 @@ for ( i = 0; i < nChains; i++ ) { - GXV_TRACE(( "validate chain %d/%d\n", i + 1, nChains )); + GXV_TRACE(( "validating chain %d/%d\n", i + 1, nChains )); GXV_32BIT_ALIGNMENT_VALIDATE( p - table ); gxv_mort_chain_validate( p, limit, valid ); p += valid->subtable_length; diff --git a/src/gxvalid/gxvmort.h b/src/gxvalid/gxvmort.h index 009162e6c..1d64e69c4 100644 --- a/src/gxvalid/gxvmort.h +++ b/src/gxvalid/gxvmort.h @@ -51,10 +51,6 @@ (f).disableFlags == 0x00000000UL ) - FT_LOCAL( void ) - gxv_mort_feature_validate( GXV_mort_feature f, - GXV_Validator valid ); - FT_LOCAL( void ) gxv_mort_featurearray_validate( FT_Bytes table, FT_Bytes limit, diff --git a/src/gxvalid/gxvmort0.c b/src/gxvalid/gxvmort0.c index ddc37d29c..c93ee4d34 100644 --- a/src/gxvalid/gxvmort0.c +++ b/src/gxvalid/gxvmort0.c @@ -106,7 +106,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_mort_subtable_type0_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmort1.c b/src/gxvalid/gxvmort1.c index 5bdf2d3ce..86d667c64 100644 --- a/src/gxvalid/gxvmort1.c +++ b/src/gxvalid/gxvmort1.c @@ -58,7 +58,7 @@ FT_Bytes p = table; GXV_mort_subtable_type1_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type1_StateOptRecData)valid->statetable.optdata; GXV_LIMIT_CHECK( 2 ); @@ -81,7 +81,7 @@ FT_UShort buff[5]; GXV_mort_subtable_type1_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type1_StateOptRecData)valid->statetable.optdata; o[0] = classTable; @@ -183,7 +183,7 @@ FT_UShort i; - GXV_NAME_ENTER( "validate contents in substitionTable" ); + GXV_NAME_ENTER( "validating contents of substitionTable" ); for ( i = 0; i < num_gids ; i ++ ) { FT_UShort dst_gid; @@ -214,7 +214,7 @@ * In addition to classTable, stateArray, and entryTable, the field * `substitutionTable' is added. */ - static void + FT_LOCAL_DEF( void ) gxv_mort_subtable_type1_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmort2.c b/src/gxvalid/gxvmort2.c index 2d1a838b3..bfbe47372 100644 --- a/src/gxvalid/gxvmort2.c +++ b/src/gxvalid/gxvmort2.c @@ -61,7 +61,7 @@ { FT_Bytes p = table; GXV_mort_subtable_type2_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata; GXV_LIMIT_CHECK( 2 + 2 + 2 ); @@ -93,7 +93,7 @@ FT_UShort buff[7]; GXV_mort_subtable_type2_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata; GXV_NAME_ENTER( "subtable boundaries setup" ); @@ -141,7 +141,7 @@ { /* access ligActionTable */ GXV_mort_subtable_type2_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata; FT_Bytes lat_base = table + optdata->ligActionTable; FT_Bytes p = table + ligActionOffset; @@ -217,7 +217,7 @@ GXV_Validator valid ) { GXV_mort_subtable_type2_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type2_StateOptRecData)valid->statetable.optdata; FT_Bytes p = table + optdata->ligatureTable; FT_Bytes limit = table + optdata->ligatureTable @@ -241,7 +241,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_mort_subtable_type2_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmort4.c b/src/gxvalid/gxvmort4.c index b6f1f02a8..959220e10 100644 --- a/src/gxvalid/gxvmort4.c +++ b/src/gxvalid/gxvmort4.c @@ -100,7 +100,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_mort_subtable_type4_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmort5.c b/src/gxvalid/gxvmort5.c index 70529b86f..5c90ed73b 100644 --- a/src/gxvalid/gxvmort5.c +++ b/src/gxvalid/gxvmort5.c @@ -73,7 +73,7 @@ GXV_Validator valid ) { GXV_mort_subtable_type5_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type5_StateOptRecData)valid->statetable.optdata; gxv_StateTable_subtable_setup( table_size, @@ -109,7 +109,7 @@ FT_Bytes p = table + offset; GXV_mort_subtable_type5_StateOptRecData optdata = - valid->statetable.optdata; + (GXV_mort_subtable_type5_StateOptRecData)valid->statetable.optdata; if ( optdata->classTable < offset && offset < optdata->classTable + *(optdata->classTable_length_p) ) @@ -189,7 +189,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_mort_subtable_type5_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmorx.c b/src/gxvalid/gxvmorx.c index 8a0ea1a6f..5f894c770 100644 --- a/src/gxvalid/gxvmorx.c +++ b/src/gxvalid/gxvmorx.c @@ -77,7 +77,7 @@ coverage = FT_NEXT_ULONG( p ); subFeatureFlags = FT_NEXT_ULONG( p ); - GXV_TRACE(( "validate chain subtable %d/%d (%d bytes)\n", + GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n", i + 1, nSubtables, length )); type = coverage & 0x0007; @@ -152,7 +152,7 @@ valid->root = ftvalid; valid->face = face; - FT_TRACE3(( "validation morx table\n" )); + FT_TRACE3(( "validating `morx' table\n" )); GXV_INIT; GXV_LIMIT_CHECK( 4 + 4 ); @@ -164,7 +164,7 @@ for ( i = 0; i < nChains; i++ ) { - GXV_TRACE(( "validate chain %d/%d\n", i + 1, nChains )); + GXV_TRACE(( "validating chain %d/%d\n", i + 1, nChains )); GXV_32BIT_ALIGNMENT_VALIDATE( p - table ); gxv_morx_chain_validate( p, limit, valid ); p += valid->subtable_length; diff --git a/src/gxvalid/gxvmorx.h b/src/gxvalid/gxvmorx.h index a5f7bd3a5..28c1a44f6 100644 --- a/src/gxvalid/gxvmorx.h +++ b/src/gxvalid/gxvmorx.h @@ -24,8 +24,8 @@ /***************************************************************************/ -#ifndef __GXVMORX_H_ -#define __GXVMORX_H_ +#ifndef __GXVMORX_H__ +#define __GXVMORX_H__ #include "gxvalid.h" diff --git a/src/gxvalid/gxvmorx0.c b/src/gxvalid/gxvmorx0.c index 7ad78af74..a90294184 100644 --- a/src/gxvalid/gxvmorx0.c +++ b/src/gxvalid/gxvmorx0.c @@ -73,7 +73,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_morx_subtable_type0_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmorx1.c b/src/gxvalid/gxvmorx1.c index 5f6fe4439..689e4a78a 100644 --- a/src/gxvalid/gxvmorx1.c +++ b/src/gxvalid/gxvmorx1.c @@ -60,7 +60,7 @@ FT_Bytes p = table; GXV_morx_subtable_type1_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata; GXV_LIMIT_CHECK( 2 ); @@ -83,7 +83,7 @@ FT_ULong buff[5]; GXV_morx_subtable_type1_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata; o[0] = classTable; @@ -115,7 +115,7 @@ FT_Short currentIndex; GXV_morx_subtable_type1_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata; FT_UNUSED( state ); FT_UNUSED( table ); @@ -197,7 +197,7 @@ FT_UShort i; GXV_morx_subtable_type1_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type1_StateOptRecData)valid->xstatetable.optdata; /* TODO: calculate offset/length for each lookupTables */ @@ -225,7 +225,7 @@ * In addition to classTable, stateArray, entryTable, the field * `substitutionTable' is added. */ - static void + FT_LOCAL_DEF( void ) gxv_morx_subtable_type1_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmorx2.c b/src/gxvalid/gxvmorx2.c index 5c4fba601..93fe318e9 100644 --- a/src/gxvalid/gxvmorx2.c +++ b/src/gxvalid/gxvmorx2.c @@ -63,7 +63,7 @@ FT_Bytes p = table; GXV_morx_subtable_type2_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata; GXV_LIMIT_CHECK( 4 + 4 + 4 ); @@ -95,7 +95,7 @@ FT_ULong buff[7]; GXV_morx_subtable_type2_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata; GXV_NAME_ENTER( "subtable boundaries setup" ); @@ -146,7 +146,7 @@ { /* access ligActionTable */ GXV_morx_subtable_type2_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata; FT_Bytes lat_base = table + optdata->ligActionTable; FT_Bytes p = lat_base + @@ -220,7 +220,7 @@ GXV_Validator valid ) { GXV_morx_subtable_type2_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type2_StateOptRecData)valid->xstatetable.optdata; FT_Bytes p = table + optdata->ligatureTable; FT_Bytes limit = table + optdata->ligatureTable @@ -246,7 +246,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_morx_subtable_type2_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) @@ -258,7 +258,7 @@ GXV_NAME_ENTER( "morx chain subtable type2 (Ligature Substitution)" ); - GXV_LIMIT_CHECK( GXV_MORT_SUBTABLE_TYPE2_HEADER_SIZE ); + GXV_LIMIT_CHECK( GXV_MORX_SUBTABLE_TYPE2_HEADER_SIZE ); valid->xstatetable.optdata = &lig_rec; diff --git a/src/gxvalid/gxvmorx4.c b/src/gxvalid/gxvmorx4.c index 68ad746ff..c0d2f78e3 100644 --- a/src/gxvalid/gxvmorx4.c +++ b/src/gxvalid/gxvmorx4.c @@ -38,7 +38,7 @@ #define FT_COMPONENT trace_gxvmorx - static void + FT_LOCAL_DEF( void ) gxv_morx_subtable_type4_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvmorx5.c b/src/gxvalid/gxvmorx5.c index ef5536c2b..de9aebc41 100644 --- a/src/gxvalid/gxvmorx5.c +++ b/src/gxvalid/gxvmorx5.c @@ -69,7 +69,7 @@ FT_Bytes p = table; GXV_morx_subtable_type5_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata; GXV_LIMIT_CHECK( 4 ); @@ -92,7 +92,7 @@ FT_ULong buff[5]; GXV_morx_subtable_type5_StateOptRecData optdata = - valid->xstatetable.optdata; + (GXV_morx_subtable_type5_StateOptRecData)valid->xstatetable.optdata; o[0] = classTable; @@ -180,7 +180,7 @@ } - static void + FT_LOCAL_DEF( void ) gxv_morx_subtable_type5_validate( FT_Bytes table, FT_Bytes limit, GXV_Validator valid ) diff --git a/src/gxvalid/gxvopbd.c b/src/gxvalid/gxvopbd.c index eb2d26121..12a21d46f 100644 --- a/src/gxvalid/gxvopbd.c +++ b/src/gxvalid/gxvopbd.c @@ -15,6 +15,15 @@ /* */ /***************************************************************************/ +/***************************************************************************/ +/* */ +/* gxvalid is derived from both gxlayout module and otvalid module. */ +/* Development of gxlayout is supported by the Information-technology */ +/* Promotion Agency(IPA), Japan. */ +/* */ +/***************************************************************************/ + + #include "gxvalid.h" #include "gxvcommn.h" @@ -29,7 +38,6 @@ #define FT_COMPONENT trace_gxvopbd - /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -45,7 +53,8 @@ } GXV_opbd_DataRec, *GXV_opbd_Data; -#define GXV_OPBD_DATA(FIELD) GXV_TABLE_DATA( opbd, FIELD ) + +#define GXV_OPBD_DATA( FIELD ) GXV_TABLE_DATA( opbd, FIELD ) /*************************************************************************/ @@ -71,20 +80,19 @@ if ( value.u < GXV_OPBD_DATA( valueOffset_min ) ) GXV_OPBD_DATA( valueOffset_min ) = value.u; - for ( i = 0; i < 4; i++ ) { GXV_LIMIT_CHECK( 2 ); delta_value = FT_NEXT_SHORT( p ); - if ( GXV_OPBD_DATA( format ) ) /* format 1, value is ctrl pt. */ + if ( GXV_OPBD_DATA( format ) ) /* format 1, value is ctrl pt. */ { if ( delta_value == -1 ) continue; gxv_ctlPoint_validate( glyph, delta_value, valid ); } - else /* format 0, value is distance */ + else /* format 0, value is distance */ continue; } } @@ -130,12 +138,16 @@ { GXV_LookupValueDesc value; + FT_UNUSED( lookuptbl_limit ); + FT_UNUSED( valid ); + - value.u = base_value.u + ( relative_gindex * 4 * sizeof ( FT_Short ) ); + value.u = base_value.u + relative_gindex * 4 * sizeof ( FT_Short ); return value; } + /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -163,9 +175,9 @@ valid->table_data = opbd; valid->face = face; - FT_TRACE3(( "validation opbd table\n" )); + FT_TRACE3(( "validating `opbd' table\n" )); GXV_INIT; - GXV_OPBD_DATA( valueOffset_min ) = 0xFFFF; + GXV_OPBD_DATA( valueOffset_min ) = 0xFFFFU; GXV_LIMIT_CHECK( 4 + 2 ); @@ -173,31 +185,30 @@ GXV_OPBD_DATA( format ) = FT_NEXT_USHORT( p ); - /* 0x00010000 is only defined (1996) */ + /* only 0x00010000 is defined (1996) */ GXV_TRACE(( "(version=0x%08x)\n", version )); if ( 0x00010000UL != version ) FT_INVALID_FORMAT; - /* 0, 1 are only defined (1996) */ + /* only values 0 and 1 are defined (1996) */ GXV_TRACE(( "(format=0x%04x)\n", GXV_OPBD_DATA( format ) )); if ( 0x0001 < GXV_OPBD_DATA( format ) ) FT_INVALID_FORMAT; - valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED; valid->lookupval_func = gxv_opbd_LookupValue_validate; valid->lookupfmt4_trans = gxv_opbd_LookupFmt4_transit; + gxv_LookupTable_validate( p, limit, valid ); p += valid->subtable_length; - if ( p > table + GXV_OPBD_DATA( valueOffset_min ) ) { - GXV_TRACE(( "found overlap between LookupTable and opbd_value array\n" )); + GXV_TRACE(( + "found overlap between LookupTable and opbd_value array\n" )); FT_INVALID_OFFSET; } - FT_TRACE4(( "\n" )); } diff --git a/src/gxvalid/gxvprop.c b/src/gxvalid/gxvprop.c index 6c0c43dd1..b5211f16f 100644 --- a/src/gxvalid/gxvprop.c +++ b/src/gxvalid/gxvprop.c @@ -16,15 +16,18 @@ /***************************************************************************/ /***************************************************************************/ +/* */ /* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout was support of Information-technology Promotion */ -/* Agency(IPA), Japan. */ +/* Development of gxlayout is supported by the Information-technology */ +/* Promotion Agency(IPA), Japan. */ +/* */ /***************************************************************************/ #include "gxvalid.h" #include "gxvcommn.h" + /*************************************************************************/ /* */ /* The macro FT_COMPONENT is used in trace mode. It is an implicit */ @@ -35,7 +38,6 @@ #define FT_COMPONENT trace_gxvprop - /*************************************************************************/ /*************************************************************************/ /***** *****/ @@ -52,14 +54,15 @@ FT_Fixed version; } GXV_prop_DataRec, *GXV_prop_Data; -#define GXV_PROP_DATA(field) GXV_TABLE_DATA( prop, field ) -#define GXV_PROP_FLOATER 0x8000 -#define GXV_PROP_USE_COMPLEMENTARY_BRACKET 0x1000 -#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET 0x0F00 -#define GXV_PROP_ATTACHING_TO_RIGHT 0x0080 -#define GXV_PROP_RESERVED 0x0060 -#define GXV_PROP_DIRECTIONALITY_CLASS 0x001F +#define GXV_PROP_DATA( field ) GXV_TABLE_DATA( prop, field ) + +#define GXV_PROP_FLOATER 0x8000U +#define GXV_PROP_USE_COMPLEMENTARY_BRACKET 0x1000U +#define GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET 0x0F00U +#define GXV_PROP_ATTACHING_TO_RIGHT 0x0080U +#define GXV_PROP_RESERVED 0x0060U +#define GXV_PROP_DIRECTIONALITY_CLASS 0x001FU /*************************************************************************/ @@ -79,7 +82,7 @@ FT_GlyphSlot glyph; - GXV_NAME_ENTER(" zero advance " ); + GXV_NAME_ENTER( "zero advance" ); face = valid->face; @@ -98,6 +101,7 @@ GXV_EXIT; } + /* Pass 0 as GLYPH to check the default property */ static void gxv_prop_property_validate( FT_UShort property, @@ -105,15 +109,13 @@ GXV_Validator valid ) { if ( glyph != 0 && ( property & GXV_PROP_FLOATER ) ) - { gxv_prop_zero_advance_validate( glyph, valid ); - } - if ( property & GXV_PROP_USE_COMPLEMENTARY_BRACKET ) { - FT_UShort offset; - char complement; + FT_UShort offset; + char complement; + offset = property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET; if ( offset == 0 ) @@ -122,9 +124,9 @@ complement = offset >> 8; if ( complement & 0x08 ) { - /* Top bit is set: nagative */ + /* Top bit is set: negative */ - /* Calculated the absolute offset */ + /* Calculate the absolute offset */ complement = ( complement & 0x07 ) + 1; /* The gid for complement must be greater than 0 */ @@ -136,38 +138,34 @@ /* The gid for complement must be the face. */ gxv_glyphid_validate( glyph + complement, valid ); } - } else { - if ( ( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET ) ) + if ( property & GXV_PROP_COMPLEMENTARY_BRACKET_OFFSET ) GXV_TRACE(( "glyph %d cannot have complementary bracketing\n", - glyph )); + glyph )); } - - /* this is introduced in ver 2.0 */ + /* this is introduced in version 2.0 */ if ( property & GXV_PROP_ATTACHING_TO_RIGHT ) { - if ( GXV_PROP_DATA( version ) == 0x00010000 ) + if ( GXV_PROP_DATA( version ) == 0x00010000UL ) FT_INVALID_DATA; } - if ( property & GXV_PROP_RESERVED ) - { FT_INVALID_DATA; - } if ( ( property & GXV_PROP_DIRECTIONALITY_CLASS ) > 11 ) { /* TODO: Too restricted. Use the validation level. */ - if ( GXV_PROP_DATA( version ) == 0x00010000 || - GXV_PROP_DATA( version ) == 0x00020000 ) + if ( GXV_PROP_DATA( version ) == 0x00010000UL || + GXV_PROP_DATA( version ) == 0x00020000UL ) FT_INVALID_DATA; } } + static void gxv_prop_LookupValue_validate( FT_UShort glyph, GXV_LookupValueDesc value, @@ -216,7 +214,7 @@ GXV_LookupValueDesc value; - offset = base_value.u + ( relative_gindex * sizeof( FT_UShort ) ); + offset = base_value.u + relative_gindex * sizeof( FT_UShort ); p = valid->lookuptbl_head + offset; limit = lookuptbl_limit; @@ -253,11 +251,11 @@ FT_UShort defaultProp; - valid->root = ftvalid; + valid->root = ftvalid; valid->table_data = prop; - valid->face = face; + valid->face = face; - FT_TRACE3(( "validation prop table\n" )); + FT_TRACE3(( "validating `prop' table\n" )); GXV_INIT; GXV_LIMIT_CHECK( 4 + 2 + 2 ); @@ -265,15 +263,14 @@ format = FT_NEXT_USHORT( p ); defaultProp = FT_NEXT_USHORT( p ); - - /* version 1.0, 2.0, 3.0 are only defined (1996) */ - if ( version != 0x00010000 && - version != 0x00020000 && - version != 0x00030000 ) + /* only versions 1.0, 2.0, 3.0 are defined (1996) */ + if ( version != 0x00010000UL && + version != 0x00020000UL && + version != 0x00030000UL ) FT_INVALID_FORMAT; - /* format 0x0000, 0x0001 are only defined (1996) */ + /* only formats 0x0000, 0x0001 are defined (1996) */ if ( format > 1 ) FT_INVALID_FORMAT; @@ -282,7 +279,7 @@ if ( format == 0 ) { FT_TRACE3(( "(format 0, no per-glyph properties, " - "rest %d bytes are skipped)", limit - p )); + "remaining %d bytes are skipped)", limit - p )); goto Exit; } @@ -292,6 +289,7 @@ valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED; valid->lookupval_func = gxv_prop_LookupValue_validate; valid->lookupfmt4_trans = gxv_prop_LookupFmt4_transit; + gxv_LookupTable_validate( p, limit, valid ); Exit: diff --git a/src/gxvalid/gxvtrak.c b/src/gxvalid/gxvtrak.c index 0e91d58f2..432ee4e27 100644 --- a/src/gxvalid/gxvtrak.c +++ b/src/gxvalid/gxvtrak.c @@ -16,9 +16,11 @@ /***************************************************************************/ /***************************************************************************/ +/* */ /* gxvalid is derived from both gxlayout module and otvalid module. */ -/* Development of gxlayout was support of Information-technology Promotion */ -/* Agency(IPA), Japan. */ +/* Development of gxlayout is supported by the Information-technology */ +/* Promotion Agency(IPA), Japan. */ +/* */ /***************************************************************************/ @@ -45,9 +47,9 @@ /*************************************************************************/ /* - * refered track table format specification: + * referred track table format specification: * http://developer.apple.com/fonts/TTRefMan/RM06/Chap6trak.html - * last update is 1996. + * last update was 1996. * ---------------------------------------------- * [MINIMUM HEADER]: GXV_TRAK_SIZE_MIN * version (fixed: 32bit) = 0x00010000 @@ -75,7 +77,9 @@ } GXV_trak_DataRec, *GXV_trak_Data; -#define GXV_TRAK_DATA(FIELD) GXV_TABLE_DATA( trak, FIELD ) + +#define GXV_TRAK_DATA( FIELD ) GXV_TABLE_DATA( trak, FIELD ) + /*************************************************************************/ /*************************************************************************/ @@ -89,7 +93,6 @@ gxv_trak_trackTable_validate( FT_Bytes table, FT_Bytes limit, FT_UShort nTracks, - FT_UShort nSizes, GXV_Validator valid ) { FT_Bytes p = table; @@ -102,7 +105,7 @@ GXV_NAME_ENTER( "trackTable" ); - GXV_TRAK_DATA( trackValueOffset_min ) = 0xFFFF; + GXV_TRAK_DATA( trackValueOffset_min ) = 0xFFFFU; GXV_TRAK_DATA( trackValueOffset_max ) = 0x0000; for ( i = 0; i < nTracks; i ++ ) @@ -120,7 +123,7 @@ gxv_sfntName_validate( nameIndex, 256, 32767, valid ); } - valid->subtable_length = ( p - table ); + valid->subtable_length = p - table; GXV_EXIT; } @@ -149,22 +152,19 @@ gxv_odtect_add_range( table, p - table, "trackData header", odtect ); - /* validate trackTable */ - gxv_trak_trackTable_validate( p, limit, nTracks, nSizes, valid ); + gxv_trak_trackTable_validate( p, limit, nTracks, valid ); gxv_odtect_add_range( p, valid->subtable_length, "trackTable", odtect ); - /* sizeTable is array of FT_Fixed, don't check contents */ p = valid->root->base + sizeTableOffset; GXV_LIMIT_CHECK( nSizes * 4 ); - gxv_odtect_add_range( p, ( nSizes * 4 ), "sizeTable", odtect ); - + gxv_odtect_add_range( p, nSizes * 4, "sizeTable", odtect ); /* validate trackValueOffet */ p = valid->root->base + GXV_TRAK_DATA( trackValueOffset_min ); - if ( ( limit - p ) < ( nTracks * nSizes * 2 ) ) + if ( limit - p < nTracks * nSizes * 2 ) GXV_TRACE(( "too short trackValue array\n" )); p = valid->root->base + GXV_TRAK_DATA( trackValueOffset_max ); @@ -174,10 +174,9 @@ + GXV_TRAK_DATA( trackValueOffset_min ), GXV_TRAK_DATA( trackValueOffset_max ) - GXV_TRAK_DATA( trackValueOffset_min ) - + ( nSizes * 2 ), + + nSizes * 2, "trackValue array", odtect ); - gxv_odtect_validate( odtect, valid ); GXV_EXIT; @@ -215,17 +214,15 @@ GXV_ODTECT( 3, odtect ); - GXV_ODTECT_INIT( odtect ); valid->root = ftvalid; valid->table_data = trak; valid->face = face; - limit = valid->root->limit; table_size = limit - table; - FT_TRACE3(( "validation trak table\n" )); + FT_TRACE3(( "validating `trak' table\n" )); GXV_INIT; GXV_LIMIT_CHECK( 4 + 2 + 2 + 2 + 2 ); @@ -256,7 +253,6 @@ if ( reserved != 0x0000 ) FT_INVALID_DATA; - /* validate trackData */ if ( 0 < horizOffset ) { @@ -274,7 +270,6 @@ gxv_odtect_validate( odtect, valid ); - FT_TRACE4(( "\n" )); } diff --git a/src/gxvalid/rules.mk b/src/gxvalid/rules.mk index 07aae59e9..57bc0823d 100644 --- a/src/gxvalid/rules.mk +++ b/src/gxvalid/rules.mk @@ -33,28 +33,29 @@ GXV_DRV_SRC := $(GXV_DIR)/gxvcommn.c \ $(GXV_DIR)/gxvprop.c \ $(GXV_DIR)/gxvjust.c \ $(GXV_DIR)/gxvmort.c \ - $(GXV_DIR)/gxvmort0.c \ - $(GXV_DIR)/gxvmort1.c \ - $(GXV_DIR)/gxvmort2.c \ - $(GXV_DIR)/gxvmort4.c \ - $(GXV_DIR)/gxvmort5.c \ + $(GXV_DIR)/gxvmort0.c \ + $(GXV_DIR)/gxvmort1.c \ + $(GXV_DIR)/gxvmort2.c \ + $(GXV_DIR)/gxvmort4.c \ + $(GXV_DIR)/gxvmort5.c \ $(GXV_DIR)/gxvmorx.c \ - $(GXV_DIR)/gxvmorx0.c \ - $(GXV_DIR)/gxvmorx1.c \ - $(GXV_DIR)/gxvmorx2.c \ - $(GXV_DIR)/gxvmorx4.c \ - $(GXV_DIR)/gxvmorx5.c \ + $(GXV_DIR)/gxvmorx0.c \ + $(GXV_DIR)/gxvmorx1.c \ + $(GXV_DIR)/gxvmorx2.c \ + $(GXV_DIR)/gxvmorx4.c \ + $(GXV_DIR)/gxvmorx5.c \ $(GXV_DIR)/gxvlcar.c \ $(GXV_DIR)/gxvkern.c \ $(GXV_DIR)/gxvmod.c # GXV driver headers # -GXV_DRV_H := $(GXV_DIR)/gxvalid.h \ - $(GXV_DIR)/gxverror.h \ +GXV_DRV_H := $(GXV_DIR)/gxvalid.h \ + $(GXV_DIR)/gxverror.h \ $(GXV_DIR)/gxvcommn.h \ - $(GXV_DIR)/gxvmod.h \ - $(GXV_DIR)/gxvmort.h \ + $(GXV_DIR)/gxvfeat.h \ + $(GXV_DIR)/gxvmod.h \ + $(GXV_DIR)/gxvmort.h \ $(GXV_DIR)/gxvmorx.h