diff --git a/ChangeLog b/ChangeLog index 9abd65e00..95ddae7e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +2014-12-09 suzuki toshiya + + [otvalid] Fix a naming convention conflicting with ftvalid. + + Some prototypes in ftvalid.h use `valid' for the variables + typed as FT_Validator. Their implementations in src/base/ + ftobjs.c and utilizations in src/sfnt/ttcmap.c do similar. + + Some macros in otvcommn.h assume the exist of the variable + `valid' typed as OTV_Validator in the caller. + + Mixing these two conventions cause invalid pointer conversion + and unexpected SEGV in longjmp. To prevent it, all variables + typed as OTV_Validator are renamed to `otvalid'. + + * src/otvalid/otvcommn.h: Replace `valid' by `otvalid'. + * src/otvalid/{otvcommn.c, otvbase.c, otvgdef.c, otvgpos.c, + otvgsub.c, otvjstf.c, otvmath.c}: Replace `valid' by `otvalid' + if it is typed as OTV_Validator. + 2014-12-09 suzuki toshiya [ftvalid] Introduce FT_THROW() in FT_INVALID_XXX macros. diff --git a/src/otvalid/otvbase.c b/src/otvalid/otvbase.c index d742d2dc9..4f9d2fa25 100644 --- a/src/otvalid/otvbase.c +++ b/src/otvalid/otvbase.c @@ -32,7 +32,7 @@ static void otv_BaseCoord_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt BaseCoordFormat; @@ -58,7 +58,7 @@ case 3: /* BaseCoordFormat3 */ OTV_LIMIT_CHECK( 2 ); /* DeviceTable */ - otv_Device_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_Device_validate( table + FT_NEXT_USHORT( p ), otvalid ); break; default: @@ -71,7 +71,7 @@ static void otv_BaseTagList_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt BaseTagCount; @@ -93,7 +93,7 @@ static void otv_BaseValues_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt BaseCoordCount; @@ -112,7 +112,7 @@ /* BaseCoord */ for ( ; BaseCoordCount > 0; BaseCoordCount-- ) - otv_BaseCoord_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_BaseCoord_validate( table + FT_NEXT_USHORT( p ), otvalid ); OTV_EXIT; } @@ -120,7 +120,7 @@ static void otv_MinMax_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt table_size; @@ -144,11 +144,11 @@ OTV_SIZE_CHECK( MinCoord ); if ( MinCoord ) - otv_BaseCoord_validate( table + MinCoord, valid ); + otv_BaseCoord_validate( table + MinCoord, otvalid ); OTV_SIZE_CHECK( MaxCoord ); if ( MaxCoord ) - otv_BaseCoord_validate( table + MaxCoord, valid ); + otv_BaseCoord_validate( table + MaxCoord, otvalid ); OTV_LIMIT_CHECK( FeatMinMaxCount * 8 ); @@ -162,11 +162,11 @@ OTV_SIZE_CHECK( MinCoord ); if ( MinCoord ) - otv_BaseCoord_validate( table + MinCoord, valid ); + otv_BaseCoord_validate( table + MinCoord, otvalid ); OTV_SIZE_CHECK( MaxCoord ); if ( MaxCoord ) - otv_BaseCoord_validate( table + MaxCoord, valid ); + otv_BaseCoord_validate( table + MaxCoord, otvalid ); } OTV_EXIT; @@ -175,7 +175,7 @@ static void otv_BaseScript_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt table_size; @@ -198,11 +198,11 @@ OTV_SIZE_CHECK( BaseValues ); if ( BaseValues ) - otv_BaseValues_validate( table + BaseValues, valid ); + otv_BaseValues_validate( table + BaseValues, otvalid ); OTV_SIZE_CHECK( DefaultMinMax ); if ( DefaultMinMax ) - otv_MinMax_validate( table + DefaultMinMax, valid ); + otv_MinMax_validate( table + DefaultMinMax, otvalid ); OTV_LIMIT_CHECK( BaseLangSysCount * 6 ); @@ -211,7 +211,7 @@ { p += 4; /* skip BaseLangSysTag */ - otv_MinMax_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_MinMax_validate( table + FT_NEXT_USHORT( p ), otvalid ); } OTV_EXIT; @@ -220,7 +220,7 @@ static void otv_BaseScriptList_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt BaseScriptCount; @@ -241,7 +241,7 @@ p += 4; /* skip BaseScriptTag */ /* BaseScript */ - otv_BaseScript_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_BaseScript_validate( table + FT_NEXT_USHORT( p ), otvalid ); } OTV_EXIT; @@ -250,7 +250,7 @@ static void otv_Axis_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt table_size; @@ -267,10 +267,10 @@ OTV_SIZE_CHECK( BaseTagList ); if ( BaseTagList ) - otv_BaseTagList_validate( table + BaseTagList, valid ); + otv_BaseTagList_validate( table + BaseTagList, otvalid ); /* BaseScriptList */ - otv_BaseScriptList_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_BaseScriptList_validate( table + FT_NEXT_USHORT( p ), otvalid ); OTV_EXIT; } @@ -280,16 +280,16 @@ otv_BASE_validate( FT_Bytes table, FT_Validator ftvalid ) { - OTV_ValidatorRec validrec; - OTV_Validator valid = &validrec; - FT_Bytes p = table; + OTV_ValidatorRec otvalidrec; + OTV_Validator otvalid = &otvalidrec; + FT_Bytes p = table; FT_UInt table_size; OTV_OPTIONAL_TABLE( HorizAxis ); OTV_OPTIONAL_TABLE( VertAxis ); - valid->root = ftvalid; + otvalid->root = ftvalid; FT_TRACE3(( "validating BASE table\n" )); OTV_INIT; @@ -304,12 +304,12 @@ OTV_OPTIONAL_OFFSET( HorizAxis ); OTV_SIZE_CHECK( HorizAxis ); if ( HorizAxis ) - otv_Axis_validate( table + HorizAxis, valid ); + otv_Axis_validate( table + HorizAxis, otvalid ); OTV_OPTIONAL_OFFSET( VertAxis ); OTV_SIZE_CHECK( VertAxis ); if ( VertAxis ) - otv_Axis_validate( table + VertAxis, valid ); + otv_Axis_validate( table + VertAxis, otvalid ); FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvcommn.c b/src/otvalid/otvcommn.c index a4f885b51..3c3de63ca 100644 --- a/src/otvalid/otvcommn.c +++ b/src/otvalid/otvcommn.c @@ -39,7 +39,7 @@ FT_LOCAL_DEF( void ) otv_Coverage_validate( FT_Bytes table, - OTV_Validator valid, + OTV_Validator otvalid, FT_Int expected_count ) { FT_Bytes p = table; @@ -74,7 +74,7 @@ gid = FT_NEXT_USHORT( p ); - if ( gid >= valid->glyph_count ) + if ( gid >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; } @@ -104,7 +104,7 @@ if ( Start > End || StartCoverageIndex != total ) FT_INVALID_DATA; - if ( End >= valid->glyph_count ) + if ( End >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; if ( n > 0 && Start <= last ) @@ -219,7 +219,7 @@ FT_LOCAL_DEF( void ) otv_ClassDef_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt ClassFormat; @@ -249,7 +249,7 @@ OTV_LIMIT_CHECK( GlyphCount * 2 ); /* ClassValueArray */ - if ( StartGlyph + GlyphCount - 1 >= valid->glyph_count ) + if ( StartGlyph + GlyphCount - 1 >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; } break; @@ -276,7 +276,7 @@ if ( Start > End || ( n > 0 && Start <= last ) ) FT_INVALID_DATA; - if ( End >= valid->glyph_count ) + if ( End >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; last = End; @@ -305,7 +305,7 @@ FT_LOCAL_DEF( void ) otv_Device_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt StartSize, EndSize, DeltaFormat, count; @@ -339,12 +339,12 @@ /*************************************************************************/ /*************************************************************************/ - /* uses valid->type_count */ - /* uses valid->type_funcs */ + /* uses otvalid->type_count */ + /* uses otvalid->type_funcs */ FT_LOCAL_DEF( void ) otv_Lookup_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt LookupType, SubTableCount; @@ -360,10 +360,10 @@ OTV_TRACE(( " (type %d)\n", LookupType )); - if ( LookupType == 0 || LookupType > valid->type_count ) + if ( LookupType == 0 || LookupType > otvalid->type_count ) FT_INVALID_DATA; - validate = valid->type_funcs[LookupType - 1]; + validate = otvalid->type_funcs[LookupType - 1]; OTV_TRACE(( " (SubTableCount = %d)\n", SubTableCount )); @@ -371,7 +371,7 @@ /* SubTable */ for ( ; SubTableCount > 0; SubTableCount-- ) - validate( table + FT_NEXT_USHORT( p ), valid ); + validate( table + FT_NEXT_USHORT( p ), otvalid ); OTV_EXIT; } @@ -381,7 +381,7 @@ FT_LOCAL_DEF( void ) otv_LookupList_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt LookupCount; @@ -396,11 +396,11 @@ OTV_LIMIT_CHECK( LookupCount * 2 ); - valid->lookup_count = LookupCount; + otvalid->lookup_count = LookupCount; /* Lookup */ for ( ; LookupCount > 0; LookupCount-- ) - otv_Lookup_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_Lookup_validate( table + FT_NEXT_USHORT( p ), otvalid ); OTV_EXIT; } @@ -421,11 +421,11 @@ /*************************************************************************/ /*************************************************************************/ - /* uses valid->lookup_count */ + /* uses otvalid->lookup_count */ FT_LOCAL_DEF( void ) otv_Feature_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt LookupCount; @@ -443,7 +443,7 @@ /* LookupListIndex */ for ( ; LookupCount > 0; LookupCount-- ) - if ( FT_NEXT_USHORT( p ) >= valid->lookup_count ) + if ( FT_NEXT_USHORT( p ) >= otvalid->lookup_count ) FT_INVALID_DATA; OTV_EXIT; @@ -457,12 +457,12 @@ } - /* sets valid->lookup_count */ + /* sets otvalid->lookup_count */ FT_LOCAL_DEF( void ) otv_FeatureList_validate( FT_Bytes table, FT_Bytes lookups, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt FeatureCount; @@ -477,7 +477,7 @@ OTV_LIMIT_CHECK( FeatureCount * 2 ); - valid->lookup_count = otv_LookupList_get_count( lookups ); + otvalid->lookup_count = otv_LookupList_get_count( lookups ); /* FeatureRecord */ for ( ; FeatureCount > 0; FeatureCount-- ) @@ -485,7 +485,7 @@ p += 4; /* skip FeatureTag */ /* Feature */ - otv_Feature_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_Feature_validate( table + FT_NEXT_USHORT( p ), otvalid ); } OTV_EXIT; @@ -501,11 +501,11 @@ /*************************************************************************/ - /* uses valid->extra1 (number of features) */ + /* uses otvalid->extra1 (number of features) */ FT_LOCAL_DEF( void ) otv_LangSys_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt ReqFeatureIndex; @@ -522,14 +522,14 @@ OTV_TRACE(( " (ReqFeatureIndex = %d)\n", ReqFeatureIndex )); OTV_TRACE(( " (FeatureCount = %d)\n", FeatureCount )); - if ( ReqFeatureIndex != 0xFFFFU && ReqFeatureIndex >= valid->extra1 ) + if ( ReqFeatureIndex != 0xFFFFU && ReqFeatureIndex >= otvalid->extra1 ) FT_INVALID_DATA; OTV_LIMIT_CHECK( FeatureCount * 2 ); /* FeatureIndex */ for ( ; FeatureCount > 0; FeatureCount-- ) - if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 ) FT_INVALID_DATA; OTV_EXIT; @@ -546,7 +546,7 @@ FT_LOCAL_DEF( void ) otv_Script_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_UInt DefaultLangSys, LangSysCount; FT_Bytes p = table; @@ -561,7 +561,7 @@ OTV_TRACE(( " (LangSysCount = %d)\n", LangSysCount )); if ( DefaultLangSys != 0 ) - otv_LangSys_validate( table + DefaultLangSys, valid ); + otv_LangSys_validate( table + DefaultLangSys, otvalid ); OTV_LIMIT_CHECK( LangSysCount * 6 ); @@ -571,19 +571,19 @@ p += 4; /* skip LangSysTag */ /* LangSys */ - otv_LangSys_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_LangSys_validate( table + FT_NEXT_USHORT( p ), otvalid ); } OTV_EXIT; } - /* sets valid->extra1 (number of features) */ + /* sets otvalid->extra1 (number of features) */ FT_LOCAL_DEF( void ) otv_ScriptList_validate( FT_Bytes table, FT_Bytes features, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_UInt ScriptCount; FT_Bytes p = table; @@ -598,14 +598,14 @@ OTV_LIMIT_CHECK( ScriptCount * 6 ); - valid->extra1 = otv_Feature_get_count( features ); + otvalid->extra1 = otv_Feature_get_count( features ); /* ScriptRecord */ for ( ; ScriptCount > 0; ScriptCount-- ) { p += 4; /* skip ScriptTag */ - otv_Script_validate( table + FT_NEXT_USHORT( p ), valid ); /* Script */ + otv_Script_validate( table + FT_NEXT_USHORT( p ), otvalid ); /* Script */ } OTV_EXIT; @@ -640,7 +640,7 @@ FT_LOCAL_DEF( void ) otv_x_Ox( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Count; @@ -656,13 +656,13 @@ OTV_LIMIT_CHECK( Count * 2 ); - valid->nesting_level++; - func = valid->func[valid->nesting_level]; + otvalid->nesting_level++; + func = otvalid->func[otvalid->nesting_level]; for ( ; Count > 0; Count-- ) - func( table + FT_NEXT_USHORT( p ), valid ); + func( table + FT_NEXT_USHORT( p ), otvalid ); - valid->nesting_level--; + otvalid->nesting_level--; OTV_EXIT; } @@ -670,7 +670,7 @@ FT_LOCAL_DEF( void ) otv_u_C_x_Ox( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Count, Coverage; @@ -687,27 +687,27 @@ OTV_TRACE(( " (Count = %d)\n", Count )); - otv_Coverage_validate( table + Coverage, valid, Count ); + otv_Coverage_validate( table + Coverage, otvalid, Count ); OTV_LIMIT_CHECK( Count * 2 ); - valid->nesting_level++; - func = valid->func[valid->nesting_level]; + otvalid->nesting_level++; + func = otvalid->func[otvalid->nesting_level]; for ( ; Count > 0; Count-- ) - func( table + FT_NEXT_USHORT( p ), valid ); + func( table + FT_NEXT_USHORT( p ), otvalid ); - valid->nesting_level--; + otvalid->nesting_level--; OTV_EXIT; } - /* uses valid->extra1 (if > 0: array value limit) */ + /* uses otvalid->extra1 (if > 0: array value limit) */ FT_LOCAL_DEF( void ) otv_x_ux( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Count; @@ -722,10 +722,10 @@ OTV_LIMIT_CHECK( Count * 2 ); - if ( valid->extra1 ) + if ( otvalid->extra1 ) { for ( ; Count > 0; Count-- ) - if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 ) FT_INVALID_DATA; } @@ -736,11 +736,11 @@ /* `ux' in the function's name is not really correct since only x-1 */ /* elements are tested */ - /* uses valid->extra1 (array value limit) */ + /* uses otvalid->extra1 (array value limit) */ FT_LOCAL_DEF( void ) otv_x_y_ux_sy( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Count1, Count2; @@ -766,7 +766,7 @@ if ( FT_NEXT_USHORT( p ) >= Count1 ) FT_INVALID_DATA; - if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 ) FT_INVALID_DATA; } @@ -777,11 +777,11 @@ /* `uy' in the function's name is not really correct since only y-1 */ /* elements are tested */ - /* uses valid->extra1 (array value limit) */ + /* uses otvalid->extra1 (array value limit) */ FT_LOCAL_DEF( void ) otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt BacktrackCount, InputCount, LookaheadCount; @@ -825,7 +825,7 @@ if ( FT_NEXT_USHORT( p ) >= InputCount ) FT_INVALID_DATA; - if ( FT_NEXT_USHORT( p ) >= valid->extra1 ) + if ( FT_NEXT_USHORT( p ) >= otvalid->extra1 ) FT_INVALID_DATA; } @@ -833,11 +833,11 @@ } - /* sets valid->extra1 (valid->lookup_count) */ + /* sets otvalid->extra1 (valid->lookup_count) */ FT_LOCAL_DEF( void ) otv_u_O_O_x_Onx( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Coverage, ClassDef, ClassSetCount; @@ -855,14 +855,14 @@ OTV_TRACE(( " (ClassSetCount = %d)\n", ClassSetCount )); - otv_Coverage_validate( table + Coverage, valid, -1 ); - otv_ClassDef_validate( table + ClassDef, valid ); + otv_Coverage_validate( table + Coverage, otvalid, -1 ); + otv_ClassDef_validate( table + ClassDef, otvalid ); OTV_LIMIT_CHECK( ClassSetCount * 2 ); - valid->nesting_level++; - func = valid->func[valid->nesting_level]; - valid->extra1 = valid->lookup_count; + otvalid->nesting_level++; + func = otvalid->func[otvalid->nesting_level]; + otvalid->extra1 = otvalid->lookup_count; for ( ; ClassSetCount > 0; ClassSetCount-- ) { @@ -870,20 +870,20 @@ if ( offset ) - func( table + offset, valid ); + func( table + offset, otvalid ); } - valid->nesting_level--; + otvalid->nesting_level--; OTV_EXIT; } - /* uses valid->lookup_count */ + /* uses otvalid->lookup_count */ FT_LOCAL_DEF( void ) otv_u_x_y_Ox_sy( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt GlyphCount, Count, count1; @@ -903,14 +903,14 @@ OTV_LIMIT_CHECK( GlyphCount * 2 + Count * 4 ); for ( count1 = GlyphCount; count1 > 0; count1-- ) - otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 ); for ( ; Count > 0; Count-- ) { if ( FT_NEXT_USHORT( p ) >= GlyphCount ) FT_INVALID_DATA; - if ( FT_NEXT_USHORT( p ) >= valid->lookup_count ) + if ( FT_NEXT_USHORT( p ) >= otvalid->lookup_count ) FT_INVALID_DATA; } @@ -918,11 +918,11 @@ } - /* sets valid->extra1 (valid->lookup_count) */ + /* sets otvalid->extra1 (valid->lookup_count) */ FT_LOCAL_DEF( void ) otv_u_O_O_O_O_x_Onx( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Coverage; @@ -944,17 +944,17 @@ OTV_TRACE(( " (ChainClassSetCount = %d)\n", ChainClassSetCount )); - otv_Coverage_validate( table + Coverage, valid, -1 ); + otv_Coverage_validate( table + Coverage, otvalid, -1 ); - otv_ClassDef_validate( table + BacktrackClassDef, valid ); - otv_ClassDef_validate( table + InputClassDef, valid ); - otv_ClassDef_validate( table + LookaheadClassDef, valid ); + otv_ClassDef_validate( table + BacktrackClassDef, otvalid ); + otv_ClassDef_validate( table + InputClassDef, otvalid ); + otv_ClassDef_validate( table + LookaheadClassDef, otvalid ); OTV_LIMIT_CHECK( ChainClassSetCount * 2 ); - valid->nesting_level++; - func = valid->func[valid->nesting_level]; - valid->extra1 = valid->lookup_count; + otvalid->nesting_level++; + func = otvalid->func[otvalid->nesting_level]; + otvalid->extra1 = otvalid->lookup_count; for ( ; ChainClassSetCount > 0; ChainClassSetCount-- ) { @@ -962,20 +962,20 @@ if ( offset ) - func( table + offset, valid ); + func( table + offset, otvalid ); } - valid->nesting_level--; + otvalid->nesting_level--; OTV_EXIT; } - /* uses valid->lookup_count */ + /* uses otvalid->lookup_count */ FT_LOCAL_DEF( void ) otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt BacktrackGlyphCount, InputGlyphCount, LookaheadGlyphCount; @@ -994,7 +994,7 @@ OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 ); for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- ) - otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 ); InputGlyphCount = FT_NEXT_USHORT( p ); @@ -1003,7 +1003,7 @@ OTV_LIMIT_CHECK( InputGlyphCount * 2 + 2 ); for ( count1 = InputGlyphCount; count1 > 0; count1-- ) - otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 ); LookaheadGlyphCount = FT_NEXT_USHORT( p ); @@ -1012,7 +1012,7 @@ OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 ); for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- ) - otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 ); count2 = FT_NEXT_USHORT( p ); @@ -1025,7 +1025,7 @@ if ( FT_NEXT_USHORT( p ) >= InputGlyphCount ) FT_INVALID_DATA; - if ( FT_NEXT_USHORT( p ) >= valid->lookup_count ) + if ( FT_NEXT_USHORT( p ) >= otvalid->lookup_count ) FT_INVALID_DATA; } diff --git a/src/otvalid/otvcommn.h b/src/otvalid/otvcommn.h index 4ec7674d7..5c93ba7ef 100644 --- a/src/otvalid/otvcommn.h +++ b/src/otvalid/otvcommn.h @@ -39,7 +39,7 @@ FT_BEGIN_HEADER typedef struct OTV_ValidatorRec_* OTV_Validator; typedef void (*OTV_Validate_Func)( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); typedef struct OTV_ValidatorRec_ { @@ -68,7 +68,7 @@ FT_BEGIN_HEADER #undef FT_INVALID_ #define FT_INVALID_( _error ) \ - ft_validator_error( valid->root, FT_THROW( _error ) ) + ft_validator_error( otvalid->root, FT_THROW( _error ) ) #define OTV_OPTIONAL_TABLE( _table ) FT_UShort _table; \ FT_Bytes _table ## _p @@ -81,7 +81,7 @@ FT_BEGIN_HEADER #define OTV_LIMIT_CHECK( _count ) \ FT_BEGIN_STMNT \ - if ( p + (_count) > valid->root->limit ) \ + if ( p + (_count) > otvalid->root->limit ) \ FT_INVALID_TOO_SHORT; \ FT_END_STMNT @@ -89,7 +89,7 @@ FT_BEGIN_HEADER FT_BEGIN_STMNT \ if ( _size > 0 && _size < table_size ) \ { \ - if ( valid->root->level == FT_VALIDATE_PARANOID ) \ + if ( otvalid->root->level == FT_VALIDATE_PARANOID ) \ FT_INVALID_OFFSET; \ else \ { \ @@ -117,79 +117,79 @@ FT_BEGIN_HEADER #ifdef FT_DEBUG_LEVEL_TRACE -#define OTV_NEST1( x ) \ - FT_BEGIN_STMNT \ - valid->nesting_level = 0; \ - valid->func[0] = OTV_FUNC( x ); \ - valid->debug_function_name[0] = OTV_NAME( x ); \ +#define OTV_NEST1( x ) \ + FT_BEGIN_STMNT \ + otvalid->nesting_level = 0; \ + otvalid->func[0] = OTV_FUNC( x ); \ + otvalid->debug_function_name[0] = OTV_NAME( x ); \ FT_END_STMNT -#define OTV_NEST2( x, y ) \ - FT_BEGIN_STMNT \ - valid->nesting_level = 0; \ - valid->func[0] = OTV_FUNC( x ); \ - valid->func[1] = OTV_FUNC( y ); \ - valid->debug_function_name[0] = OTV_NAME( x ); \ - valid->debug_function_name[1] = OTV_NAME( y ); \ +#define OTV_NEST2( x, y ) \ + FT_BEGIN_STMNT \ + otvalid->nesting_level = 0; \ + otvalid->func[0] = OTV_FUNC( x ); \ + otvalid->func[1] = OTV_FUNC( y ); \ + otvalid->debug_function_name[0] = OTV_NAME( x ); \ + otvalid->debug_function_name[1] = OTV_NAME( y ); \ FT_END_STMNT -#define OTV_NEST3( x, y, z ) \ - FT_BEGIN_STMNT \ - valid->nesting_level = 0; \ - valid->func[0] = OTV_FUNC( x ); \ - valid->func[1] = OTV_FUNC( y ); \ - valid->func[2] = OTV_FUNC( z ); \ - valid->debug_function_name[0] = OTV_NAME( x ); \ - valid->debug_function_name[1] = OTV_NAME( y ); \ - valid->debug_function_name[2] = OTV_NAME( z ); \ +#define OTV_NEST3( x, y, z ) \ + FT_BEGIN_STMNT \ + otvalid->nesting_level = 0; \ + otvalid->func[0] = OTV_FUNC( x ); \ + otvalid->func[1] = OTV_FUNC( y ); \ + otvalid->func[2] = OTV_FUNC( z ); \ + otvalid->debug_function_name[0] = OTV_NAME( x ); \ + otvalid->debug_function_name[1] = OTV_NAME( y ); \ + otvalid->debug_function_name[2] = OTV_NAME( z ); \ FT_END_STMNT -#define OTV_INIT valid->debug_indent = 0 +#define OTV_INIT otvalid->debug_indent = 0 -#define OTV_ENTER \ - FT_BEGIN_STMNT \ - valid->debug_indent += 2; \ - FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \ - FT_TRACE4(( "%s table\n", \ - valid->debug_function_name[valid->nesting_level] )); \ +#define OTV_ENTER \ + FT_BEGIN_STMNT \ + otvalid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", \ + otvalid->debug_function_name[otvalid->nesting_level] )); \ FT_END_STMNT -#define OTV_NAME_ENTER( name ) \ - FT_BEGIN_STMNT \ - valid->debug_indent += 2; \ - FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \ - FT_TRACE4(( "%s table\n", name )); \ +#define OTV_NAME_ENTER( name ) \ + FT_BEGIN_STMNT \ + otvalid->debug_indent += 2; \ + FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ + FT_TRACE4(( "%s table\n", name )); \ FT_END_STMNT -#define OTV_EXIT valid->debug_indent -= 2 +#define OTV_EXIT otvalid->debug_indent -= 2 -#define OTV_TRACE( s ) \ - FT_BEGIN_STMNT \ - FT_TRACE4(( "%*.s", valid->debug_indent, 0 )); \ - FT_TRACE4( s ); \ +#define OTV_TRACE( s ) \ + FT_BEGIN_STMNT \ + FT_TRACE4(( "%*.s", otvalid->debug_indent, 0 )); \ + FT_TRACE4( s ); \ FT_END_STMNT #else /* !FT_DEBUG_LEVEL_TRACE */ -#define OTV_NEST1( x ) \ - FT_BEGIN_STMNT \ - valid->nesting_level = 0; \ - valid->func[0] = OTV_FUNC( x ); \ +#define OTV_NEST1( x ) \ + FT_BEGIN_STMNT \ + otvalid->nesting_level = 0; \ + otvalid->func[0] = OTV_FUNC( x ); \ FT_END_STMNT -#define OTV_NEST2( x, y ) \ - FT_BEGIN_STMNT \ - valid->nesting_level = 0; \ - valid->func[0] = OTV_FUNC( x ); \ - valid->func[1] = OTV_FUNC( y ); \ +#define OTV_NEST2( x, y ) \ + FT_BEGIN_STMNT \ + otvalid->nesting_level = 0; \ + otvalid->func[0] = OTV_FUNC( x ); \ + otvalid->func[1] = OTV_FUNC( y ); \ FT_END_STMNT -#define OTV_NEST3( x, y, z ) \ - FT_BEGIN_STMNT \ - valid->nesting_level = 0; \ - valid->func[0] = OTV_FUNC( x ); \ - valid->func[1] = OTV_FUNC( y ); \ - valid->func[2] = OTV_FUNC( z ); \ +#define OTV_NEST3( x, y, z ) \ + FT_BEGIN_STMNT \ + otvalid->nesting_level = 0; \ + otvalid->func[0] = OTV_FUNC( x ); \ + otvalid->func[1] = OTV_FUNC( y ); \ + otvalid->func[2] = OTV_FUNC( z ); \ FT_END_STMNT #define OTV_INIT do { } while ( 0 ) @@ -202,7 +202,7 @@ FT_BEGIN_HEADER #endif /* !FT_DEBUG_LEVEL_TRACE */ -#define OTV_RUN valid->func[0] +#define OTV_RUN otvalid->func[0] /*************************************************************************/ @@ -215,7 +215,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_Coverage_validate( FT_Bytes table, - OTV_Validator valid, + OTV_Validator otvalid, FT_Int expected_count ); /* return first covered glyph */ @@ -241,7 +241,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_ClassDef_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); /*************************************************************************/ @@ -254,7 +254,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_Device_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); /*************************************************************************/ @@ -267,11 +267,11 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_Lookup_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); FT_LOCAL( void ) otv_LookupList_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); /*************************************************************************/ @@ -284,13 +284,13 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_Feature_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); /* lookups must already be validated */ FT_LOCAL( void ) otv_FeatureList_validate( FT_Bytes table, FT_Bytes lookups, - OTV_Validator valid ); + OTV_Validator otvalid ); /*************************************************************************/ @@ -303,7 +303,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_LangSys_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); /*************************************************************************/ @@ -316,13 +316,13 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_Script_validate( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); /* features must already be validated */ FT_LOCAL( void ) otv_ScriptList_validate( FT_Bytes table, FT_Bytes features, - OTV_Validator valid ); + OTV_Validator otvalid ); /*************************************************************************/ @@ -349,7 +349,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_x_Ox ( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define AlternateSubstFormat1Func otv_u_C_x_Ox #define ChainContextPosFormat1Func otv_u_C_x_Ox @@ -361,7 +361,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_u_C_x_Ox( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define AlternateSetFunc otv_x_ux #define AttachPointFunc otv_x_ux @@ -372,7 +372,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_x_ux( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define PosClassRuleFunc otv_x_y_ux_sy #define PosRuleFunc otv_x_y_ux_sy @@ -381,7 +381,7 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_x_y_ux_sy( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define ChainPosClassRuleFunc otv_x_ux_y_uy_z_uz_p_sp #define ChainPosRuleFunc otv_x_ux_y_uy_z_uz_p_sp @@ -390,35 +390,35 @@ FT_BEGIN_HEADER FT_LOCAL( void ) otv_x_ux_y_uy_z_uz_p_sp( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define ContextPosFormat2Func otv_u_O_O_x_Onx #define ContextSubstFormat2Func otv_u_O_O_x_Onx FT_LOCAL( void ) otv_u_O_O_x_Onx( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define ContextPosFormat3Func otv_u_x_y_Ox_sy #define ContextSubstFormat3Func otv_u_x_y_Ox_sy FT_LOCAL( void ) otv_u_x_y_Ox_sy( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define ChainContextPosFormat2Func otv_u_O_O_O_O_x_Onx #define ChainContextSubstFormat2Func otv_u_O_O_O_O_x_Onx FT_LOCAL( void ) otv_u_O_O_O_O_x_Onx( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); #define ChainContextPosFormat3Func otv_u_x_Ox_y_Oy_z_Oz_p_sp #define ChainContextSubstFormat3Func otv_u_x_Ox_y_Oy_z_Oz_p_sp FT_LOCAL( void ) otv_u_x_Ox_y_Oy_z_Oz_p_sp( FT_Bytes table, - OTV_Validator valid ); + OTV_Validator otvalid ); FT_LOCAL( FT_UInt ) diff --git a/src/otvalid/otvgdef.c b/src/otvalid/otvgdef.c index 3633ad0de..e60ef363d 100644 --- a/src/otvalid/otvgdef.c +++ b/src/otvalid/otvgdef.c @@ -45,7 +45,7 @@ static void otv_O_x_Ox( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_Bytes Coverage; @@ -61,20 +61,20 @@ OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); - otv_Coverage_validate( Coverage, valid, GlyphCount ); + otv_Coverage_validate( Coverage, otvalid, GlyphCount ); if ( GlyphCount != otv_Coverage_get_count( Coverage ) ) FT_INVALID_DATA; OTV_LIMIT_CHECK( GlyphCount * 2 ); - valid->nesting_level++; - func = valid->func[valid->nesting_level]; - valid->extra1 = 0; + otvalid->nesting_level++; + func = otvalid->func[otvalid->nesting_level]; + otvalid->extra1 = 0; for ( ; GlyphCount > 0; GlyphCount-- ) - func( table + FT_NEXT_USHORT( p ), valid ); + func( table + FT_NEXT_USHORT( p ), otvalid ); - valid->nesting_level--; + otvalid->nesting_level--; OTV_EXIT; } @@ -92,7 +92,7 @@ static void otv_CaretValue_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt CaretValueFormat; @@ -122,7 +122,7 @@ OTV_LIMIT_CHECK( 2 ); /* DeviceTable */ - otv_Device_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_Device_validate( table + FT_NEXT_USHORT( p ), otvalid ); break; default: @@ -141,7 +141,7 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->glyph_count */ + /* sets otvalid->glyph_count */ FT_LOCAL_DEF( void ) otv_GDEF_validate( FT_Bytes table, @@ -150,8 +150,8 @@ FT_UInt glyph_count, FT_Validator ftvalid ) { - OTV_ValidatorRec validrec; - OTV_Validator valid = &validrec; + OTV_ValidatorRec otvalidrec; + OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; FT_UInt table_size; FT_Bool need_MarkAttachClassDef; @@ -162,7 +162,7 @@ OTV_OPTIONAL_TABLE( MarkAttachClassDef ); - valid->root = ftvalid; + otvalid->root = ftvalid; FT_TRACE3(( "validating GDEF table\n" )); OTV_INIT; @@ -186,19 +186,19 @@ else table_size = 10; /* OpenType < 1.2 */ - valid->glyph_count = glyph_count; + otvalid->glyph_count = glyph_count; OTV_OPTIONAL_OFFSET( GlyphClassDef ); OTV_SIZE_CHECK( GlyphClassDef ); if ( GlyphClassDef ) - otv_ClassDef_validate( table + GlyphClassDef, valid ); + otv_ClassDef_validate( table + GlyphClassDef, otvalid ); OTV_OPTIONAL_OFFSET( AttachListOffset ); OTV_SIZE_CHECK( AttachListOffset ); if ( AttachListOffset ) { OTV_NEST2( AttachList, AttachPoint ); - OTV_RUN( table + AttachListOffset, valid ); + OTV_RUN( table + AttachListOffset, otvalid ); } OTV_OPTIONAL_OFFSET( LigCaretListOffset ); @@ -206,7 +206,7 @@ if ( LigCaretListOffset ) { OTV_NEST3( LigCaretList, LigGlyph, CaretValue ); - OTV_RUN( table + LigCaretListOffset, valid ); + OTV_RUN( table + LigCaretListOffset, otvalid ); } if ( need_MarkAttachClassDef ) @@ -214,7 +214,7 @@ OTV_OPTIONAL_OFFSET( MarkAttachClassDef ); OTV_SIZE_CHECK( MarkAttachClassDef ); if ( MarkAttachClassDef ) - otv_ClassDef_validate( table + MarkAttachClassDef, valid ); + otv_ClassDef_validate( table + MarkAttachClassDef, otvalid ); } FT_TRACE4(( "\n" )); diff --git a/src/otvalid/otvgpos.c b/src/otvalid/otvgpos.c index 49b46183a..1a9dbaaa0 100644 --- a/src/otvalid/otvgpos.c +++ b/src/otvalid/otvgpos.c @@ -57,7 +57,7 @@ static void otv_x_sxy( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Count, count1, table_size; @@ -71,26 +71,26 @@ OTV_TRACE(( " (Count = %d)\n", Count )); - OTV_LIMIT_CHECK( Count * valid->extra1 * 2 ); + OTV_LIMIT_CHECK( Count * otvalid->extra1 * 2 ); - table_size = Count * valid->extra1 * 2 + 2; + table_size = Count * otvalid->extra1 * 2 + 2; for ( ; Count > 0; Count-- ) - for ( count1 = valid->extra1; count1 > 0; count1-- ) + for ( count1 = otvalid->extra1; count1 > 0; count1-- ) { OTV_OPTIONAL_TABLE( anchor_offset ); OTV_OPTIONAL_OFFSET( anchor_offset ); - if ( valid->extra2 ) + if ( otvalid->extra2 ) { OTV_SIZE_CHECK( anchor_offset ); if ( anchor_offset ) - otv_Anchor_validate( table + anchor_offset, valid ); + otv_Anchor_validate( table + anchor_offset, otvalid ); } else - otv_Anchor_validate( table + anchor_offset, valid ); + otv_Anchor_validate( table + anchor_offset, otvalid ); } OTV_EXIT; @@ -101,11 +101,11 @@ #define MarkLigPosFormat1Func otv_u_O_O_u_O_O #define MarkMarkPosFormat1Func otv_u_O_O_u_O_O - /* sets valid->extra1 (class count) */ + /* sets otvalid->extra1 (class count) */ static void otv_u_O_O_u_O_O( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt Coverage1, Coverage2, ClassCount; @@ -124,18 +124,18 @@ Array1 = FT_NEXT_USHORT( p ); Array2 = FT_NEXT_USHORT( p ); - otv_Coverage_validate( table + Coverage1, valid, -1 ); - otv_Coverage_validate( table + Coverage2, valid, -1 ); + otv_Coverage_validate( table + Coverage1, otvalid, -1 ); + otv_Coverage_validate( table + Coverage2, otvalid, -1 ); - otv_MarkArray_validate( table + Array1, valid ); + otv_MarkArray_validate( table + Array1, otvalid ); - valid->nesting_level++; - func = valid->func[valid->nesting_level]; - valid->extra1 = ClassCount; + otvalid->nesting_level++; + func = otvalid->func[otvalid->nesting_level]; + otvalid->extra1 = ClassCount; - func( table + Array2, valid ); + func( table + Array2, otvalid ); - valid->nesting_level--; + otvalid->nesting_level--; OTV_EXIT; } @@ -163,12 +163,12 @@ } - /* uses valid->extra3 (pointer to base table) */ + /* uses otvalid->extra3 (pointer to base table) */ static void otv_ValueRecord_validate( FT_Bytes table, FT_UInt format, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt count; @@ -222,11 +222,11 @@ /* ValueRecord is part of an array -- getting the correct table */ /* size is probably not worth the trouble */ - table_size = p - valid->extra3; + table_size = p - otvalid->extra3; OTV_SIZE_CHECK( device ); if ( device ) - otv_Device_validate( valid->extra3 + device, valid ); + otv_Device_validate( otvalid->extra3 + device, otvalid ); } format >>= 1; } @@ -245,7 +245,7 @@ static void otv_Anchor_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt AnchorFormat; @@ -285,11 +285,11 @@ OTV_SIZE_CHECK( XDeviceTable ); if ( XDeviceTable ) - otv_Device_validate( table + XDeviceTable, valid ); + otv_Device_validate( table + XDeviceTable, otvalid ); OTV_SIZE_CHECK( YDeviceTable ); if ( YDeviceTable ) - otv_Device_validate( table + YDeviceTable, valid ); + otv_Device_validate( table + YDeviceTable, otvalid ); } break; @@ -311,7 +311,7 @@ static void otv_MarkArray_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt MarkCount; @@ -331,7 +331,7 @@ { p += 2; /* skip Class */ /* MarkAnchor */ - otv_Anchor_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_Anchor_validate( table + FT_NEXT_USHORT( p ), otvalid ); } OTV_EXIT; @@ -346,11 +346,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra3 (pointer to base table) */ + /* sets otvalid->extra3 (pointer to base table) */ static void otv_SinglePos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -363,7 +363,7 @@ OTV_TRACE(( " (format %d)\n", PosFormat )); - valid->extra3 = table; + otvalid->extra3 = table; switch ( PosFormat ) { @@ -376,8 +376,8 @@ Coverage = FT_NEXT_USHORT( p ); ValueFormat = FT_NEXT_USHORT( p ); - otv_Coverage_validate( table + Coverage, valid, -1 ); - otv_ValueRecord_validate( p, ValueFormat, valid ); /* Value */ + otv_Coverage_validate( table + Coverage, otvalid, -1 ); + otv_ValueRecord_validate( p, ValueFormat, otvalid ); /* Value */ } break; @@ -395,14 +395,14 @@ len_value = otv_value_length( ValueFormat ); - otv_Coverage_validate( table + Coverage, valid, ValueCount ); + otv_Coverage_validate( table + Coverage, otvalid, ValueCount ); OTV_LIMIT_CHECK( ValueCount * len_value ); /* Value */ for ( ; ValueCount > 0; ValueCount-- ) { - otv_ValueRecord_validate( p, ValueFormat, valid ); + otv_ValueRecord_validate( p, ValueFormat, otvalid ); p += len_value; } } @@ -428,7 +428,7 @@ otv_PairSet_validate( FT_Bytes table, FT_UInt format1, FT_UInt format2, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt value_len1, value_len2, PairValueCount; @@ -452,11 +452,11 @@ p += 2; /* skip SecondGlyph */ if ( format1 ) - otv_ValueRecord_validate( p, format1, valid ); /* Value1 */ + otv_ValueRecord_validate( p, format1, otvalid ); /* Value1 */ p += value_len1; if ( format2 ) - otv_ValueRecord_validate( p, format2, valid ); /* Value2 */ + otv_ValueRecord_validate( p, format2, otvalid ); /* Value2 */ p += value_len2; } @@ -464,11 +464,11 @@ } - /* sets valid->extra3 (pointer to base table) */ + /* sets otvalid->extra3 (pointer to base table) */ static void otv_PairPos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -481,7 +481,7 @@ OTV_TRACE(( " (format %d)\n", PosFormat )); - valid->extra3 = table; + otvalid->extra3 = table; switch ( PosFormat ) { @@ -498,14 +498,14 @@ OTV_TRACE(( " (PairSetCount = %d)\n", PairSetCount )); - otv_Coverage_validate( table + Coverage, valid, -1 ); + otv_Coverage_validate( table + Coverage, otvalid, -1 ); OTV_LIMIT_CHECK( PairSetCount * 2 ); /* PairSetOffset */ for ( ; PairSetCount > 0; PairSetCount-- ) otv_PairSet_validate( table + FT_NEXT_USHORT( p ), - ValueFormat1, ValueFormat2, valid ); + ValueFormat1, ValueFormat2, otvalid ); } break; @@ -530,9 +530,9 @@ len_value1 = otv_value_length( ValueFormat1 ); len_value2 = otv_value_length( ValueFormat2 ); - otv_Coverage_validate( table + Coverage, valid, -1 ); - otv_ClassDef_validate( table + ClassDef1, valid ); - otv_ClassDef_validate( table + ClassDef2, valid ); + otv_Coverage_validate( table + Coverage, otvalid, -1 ); + otv_ClassDef_validate( table + ClassDef1, otvalid ); + otv_ClassDef_validate( table + ClassDef2, otvalid ); OTV_LIMIT_CHECK( ClassCount1 * ClassCount2 * ( len_value1 + len_value2 ) ); @@ -545,12 +545,12 @@ { if ( ValueFormat1 ) /* Value1 */ - otv_ValueRecord_validate( p, ValueFormat1, valid ); + otv_ValueRecord_validate( p, ValueFormat1, otvalid ); p += len_value1; if ( ValueFormat2 ) /* Value2 */ - otv_ValueRecord_validate( p, ValueFormat2, valid ); + otv_ValueRecord_validate( p, ValueFormat2, otvalid ); p += len_value2; } } @@ -575,7 +575,7 @@ static void otv_CursivePos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -605,7 +605,7 @@ OTV_TRACE(( " (EntryExitCount = %d)\n", EntryExitCount )); - otv_Coverage_validate( table + Coverage, valid, EntryExitCount ); + otv_Coverage_validate( table + Coverage, otvalid, EntryExitCount ); OTV_LIMIT_CHECK( EntryExitCount * 4 ); @@ -619,11 +619,11 @@ OTV_SIZE_CHECK( EntryAnchor ); if ( EntryAnchor ) - otv_Anchor_validate( table + EntryAnchor, valid ); + otv_Anchor_validate( table + EntryAnchor, otvalid ); OTV_SIZE_CHECK( ExitAnchor ); if ( ExitAnchor ) - otv_Anchor_validate( table + ExitAnchor, valid ); + otv_Anchor_validate( table + ExitAnchor, otvalid ); } } break; @@ -647,11 +647,11 @@ /* UNDOCUMENTED (in OpenType 1.5): */ /* BaseRecord tables can contain NULL pointers. */ - /* sets valid->extra2 (1) */ + /* sets otvalid->extra2 (1) */ static void otv_MarkBasePos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -667,9 +667,9 @@ switch ( PosFormat ) { case 1: - valid->extra2 = 1; + otvalid->extra2 = 1; OTV_NEST2( MarkBasePosFormat1, BaseArray ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -688,11 +688,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra2 (1) */ + /* sets otvalid->extra2 (1) */ static void otv_MarkLigPos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -708,9 +708,9 @@ switch ( PosFormat ) { case 1: - valid->extra2 = 1; + otvalid->extra2 = 1; OTV_NEST3( MarkLigPosFormat1, LigatureArray, LigatureAttach ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -729,11 +729,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra2 (0) */ + /* sets otvalid->extra2 (0) */ static void otv_MarkMarkPos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -749,9 +749,9 @@ switch ( PosFormat ) { case 1: - valid->extra2 = 0; + otvalid->extra2 = 0; OTV_NEST2( MarkMarkPosFormat1, Mark2Array ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -770,11 +770,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra1 (lookup count) */ + /* sets otvalid->extra1 (lookup count) */ static void otv_ContextPos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -794,9 +794,9 @@ /* context rules since even invalid glyph indices/classes return */ /* meaningful results */ - valid->extra1 = valid->lookup_count; + otvalid->extra1 = otvalid->lookup_count; OTV_NEST3( ContextPosFormat1, PosRuleSet, PosRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 2: @@ -805,12 +805,12 @@ /* meaningful results */ OTV_NEST3( ContextPosFormat2, PosClassSet, PosClassRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 3: OTV_NEST1( ContextPosFormat3 ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -829,11 +829,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra1 (lookup count) */ + /* sets otvalid->extra1 (lookup count) */ static void otv_ChainContextPos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -853,10 +853,10 @@ /* context rules since even invalid glyph indices/classes return */ /* meaningful results */ - valid->extra1 = valid->lookup_count; + otvalid->extra1 = otvalid->lookup_count; OTV_NEST3( ChainContextPosFormat1, ChainPosRuleSet, ChainPosRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 2: @@ -866,12 +866,12 @@ OTV_NEST3( ChainContextPosFormat2, ChainPosClassSet, ChainPosClassRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 3: OTV_NEST1( ChainContextPosFormat3 ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -890,11 +890,11 @@ /*************************************************************************/ /*************************************************************************/ - /* uses valid->type_funcs */ + /* uses otvalid->type_funcs */ static void otv_ExtensionPos_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt PosFormat; @@ -923,8 +923,8 @@ if ( ExtensionLookupType == 0 || ExtensionLookupType >= 9 ) FT_INVALID_DATA; - validate = valid->type_funcs[ExtensionLookupType - 1]; - validate( table + ExtensionOffset, valid ); + validate = otvalid->type_funcs[ExtensionLookupType - 1]; + validate( table + ExtensionOffset, otvalid ); } break; @@ -950,17 +950,17 @@ }; - /* sets valid->type_count */ - /* sets valid->type_funcs */ + /* sets otvalid->type_count */ + /* sets otvalid->type_funcs */ FT_LOCAL_DEF( void ) otv_GPOS_subtable_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { - valid->type_count = 9; - valid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs; + otvalid->type_count = 9; + otvalid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs; - otv_Lookup_validate( table, valid ); + otv_Lookup_validate( table, otvalid ); } @@ -972,7 +972,7 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->glyph_count */ + /* sets otvalid->glyph_count */ FT_LOCAL_DEF( void ) otv_GPOS_validate( FT_Bytes table, @@ -980,12 +980,12 @@ FT_Validator ftvalid ) { OTV_ValidatorRec validrec; - OTV_Validator valid = &validrec; + OTV_Validator otvalid = &validrec; FT_Bytes p = table; FT_UInt ScriptList, FeatureList, LookupList; - valid->root = ftvalid; + otvalid->root = ftvalid; FT_TRACE3(( "validating GPOS table\n" )); OTV_INIT; @@ -999,16 +999,16 @@ FeatureList = FT_NEXT_USHORT( p ); LookupList = FT_NEXT_USHORT( p ); - valid->type_count = 9; - valid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs; - valid->glyph_count = glyph_count; + otvalid->type_count = 9; + otvalid->type_funcs = (OTV_Validate_Func*)otv_gpos_validate_funcs; + otvalid->glyph_count = glyph_count; otv_LookupList_validate( table + LookupList, - valid ); + otvalid ); otv_FeatureList_validate( table + FeatureList, table + LookupList, - valid ); + otvalid ); otv_ScriptList_validate( table + ScriptList, table + FeatureList, - valid ); + otvalid ); FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvgsub.c b/src/otvalid/otvgsub.c index ed499d1e9..024b8ca68 100644 --- a/src/otvalid/otvgsub.c +++ b/src/otvalid/otvgsub.c @@ -38,11 +38,11 @@ /*************************************************************************/ /*************************************************************************/ - /* uses valid->glyph_count */ + /* uses otvalid->glyph_count */ static void otv_SingleSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -68,14 +68,14 @@ Coverage = table + FT_NEXT_USHORT( p ); DeltaGlyphID = FT_NEXT_SHORT( p ); - otv_Coverage_validate( Coverage, valid, -1 ); + otv_Coverage_validate( Coverage, otvalid, -1 ); idx = otv_Coverage_get_first( Coverage ) + DeltaGlyphID; if ( idx < 0 ) FT_INVALID_DATA; idx = otv_Coverage_get_last( Coverage ) + DeltaGlyphID; - if ( (FT_UInt)idx >= valid->glyph_count ) + if ( (FT_UInt)idx >= otvalid->glyph_count ) FT_INVALID_DATA; } break; @@ -91,13 +91,13 @@ OTV_TRACE(( " (GlyphCount = %d)\n", GlyphCount )); - otv_Coverage_validate( table + Coverage, valid, GlyphCount ); + otv_Coverage_validate( table + Coverage, otvalid, GlyphCount ); OTV_LIMIT_CHECK( GlyphCount * 2 ); /* Substitute */ for ( ; GlyphCount > 0; GlyphCount-- ) - if ( FT_NEXT_USHORT( p ) >= valid->glyph_count ) + if ( FT_NEXT_USHORT( p ) >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; } break; @@ -118,11 +118,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra1 (glyph count) */ + /* sets otvalid->extra1 (glyph count) */ static void otv_MultipleSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -138,9 +138,9 @@ switch ( SubstFormat ) { case 1: - valid->extra1 = valid->glyph_count; + otvalid->extra1 = otvalid->glyph_count; OTV_NEST2( MultipleSubstFormat1, Sequence ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -159,11 +159,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra1 (glyph count) */ + /* sets otvalid->extra1 (glyph count) */ static void otv_AlternateSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -179,9 +179,9 @@ switch ( SubstFormat ) { case 1: - valid->extra1 = valid->glyph_count; + otvalid->extra1 = otvalid->glyph_count; OTV_NEST2( AlternateSubstFormat1, AlternateSet ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -202,11 +202,11 @@ #define LigatureFunc otv_Ligature_validate - /* uses valid->glyph_count */ + /* uses otvalid->glyph_count */ static void otv_Ligature_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt LigatureGlyph, CompCount; @@ -216,7 +216,7 @@ OTV_LIMIT_CHECK( 4 ); LigatureGlyph = FT_NEXT_USHORT( p ); - if ( LigatureGlyph >= valid->glyph_count ) + if ( LigatureGlyph >= otvalid->glyph_count ) FT_INVALID_DATA; CompCount = FT_NEXT_USHORT( p ); @@ -238,7 +238,7 @@ static void otv_LigatureSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -255,7 +255,7 @@ { case 1: OTV_NEST3( LigatureSubstFormat1, LigatureSet, Ligature ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -274,11 +274,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra1 (lookup count) */ + /* sets otvalid->extra1 (lookup count) */ static void otv_ContextSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -298,9 +298,9 @@ /* context rules since even invalid glyph indices/classes return */ /* meaningful results */ - valid->extra1 = valid->lookup_count; + otvalid->extra1 = otvalid->lookup_count; OTV_NEST3( ContextSubstFormat1, SubRuleSet, SubRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 2: @@ -309,12 +309,12 @@ /* meaningful results */ OTV_NEST3( ContextSubstFormat2, SubClassSet, SubClassRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 3: OTV_NEST1( ContextSubstFormat3 ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -333,11 +333,11 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->extra1 (lookup count) */ + /* sets otvalid->extra1 (lookup count) */ static void otv_ChainContextSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -357,10 +357,10 @@ /* context rules since even invalid glyph indices/classes return */ /* meaningful results */ - valid->extra1 = valid->lookup_count; + otvalid->extra1 = otvalid->lookup_count; OTV_NEST3( ChainContextSubstFormat1, ChainSubRuleSet, ChainSubRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 2: @@ -370,12 +370,12 @@ OTV_NEST3( ChainContextSubstFormat2, ChainSubClassSet, ChainSubClassRule ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; case 3: OTV_NEST1( ChainContextSubstFormat3 ); - OTV_RUN( table, valid ); + OTV_RUN( table, otvalid ); break; default: @@ -394,11 +394,11 @@ /*************************************************************************/ /*************************************************************************/ - /* uses valid->type_funcs */ + /* uses otvalid->type_funcs */ static void otv_ExtensionSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt SubstFormat; @@ -429,8 +429,8 @@ ExtensionLookupType > 8 ) FT_INVALID_DATA; - validate = valid->type_funcs[ExtensionLookupType - 1]; - validate( table + ExtensionOffset, valid ); + validate = otvalid->type_funcs[ExtensionLookupType - 1]; + validate( table + ExtensionOffset, otvalid ); } break; @@ -450,11 +450,11 @@ /*************************************************************************/ /*************************************************************************/ - /* uses valid->glyph_count */ + /* uses otvalid->glyph_count */ static void otv_ReverseChainSingleSubst_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table, Coverage; FT_UInt SubstFormat; @@ -477,12 +477,12 @@ OTV_TRACE(( " (BacktrackGlyphCount = %d)\n", BacktrackGlyphCount )); - otv_Coverage_validate( Coverage, valid, -1 ); + otv_Coverage_validate( Coverage, otvalid, -1 ); OTV_LIMIT_CHECK( BacktrackGlyphCount * 2 + 2 ); for ( ; BacktrackGlyphCount > 0; BacktrackGlyphCount-- ) - otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 ); LookaheadGlyphCount = FT_NEXT_USHORT( p ); @@ -491,7 +491,7 @@ OTV_LIMIT_CHECK( LookaheadGlyphCount * 2 + 2 ); for ( ; LookaheadGlyphCount > 0; LookaheadGlyphCount-- ) - otv_Coverage_validate( table + FT_NEXT_USHORT( p ), valid, -1 ); + otv_Coverage_validate( table + FT_NEXT_USHORT( p ), otvalid, -1 ); GlyphCount = FT_NEXT_USHORT( p ); @@ -504,7 +504,7 @@ /* Substitute */ for ( ; GlyphCount > 0; GlyphCount-- ) - if ( FT_NEXT_USHORT( p ) >= valid->glyph_count ) + if ( FT_NEXT_USHORT( p ) >= otvalid->glyph_count ) FT_INVALID_DATA; break; @@ -538,22 +538,22 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->type_count */ - /* sets valid->type_funcs */ - /* sets valid->glyph_count */ + /* sets otvalid->type_count */ + /* sets otvalid->type_funcs */ + /* sets otvalid->glyph_count */ FT_LOCAL_DEF( void ) otv_GSUB_validate( FT_Bytes table, FT_UInt glyph_count, FT_Validator ftvalid ) { - OTV_ValidatorRec validrec; - OTV_Validator valid = &validrec; - FT_Bytes p = table; + OTV_ValidatorRec otvalidrec; + OTV_Validator otvalid = &otvalidrec; + FT_Bytes p = table; FT_UInt ScriptList, FeatureList, LookupList; - valid->root = ftvalid; + otvalid->root = ftvalid; FT_TRACE3(( "validating GSUB table\n" )); OTV_INIT; @@ -567,16 +567,16 @@ FeatureList = FT_NEXT_USHORT( p ); LookupList = FT_NEXT_USHORT( p ); - valid->type_count = 8; - valid->type_funcs = (OTV_Validate_Func*)otv_gsub_validate_funcs; - valid->glyph_count = glyph_count; + otvalid->type_count = 8; + otvalid->type_funcs = (OTV_Validate_Func*)otv_gsub_validate_funcs; + otvalid->glyph_count = glyph_count; otv_LookupList_validate( table + LookupList, - valid ); + otvalid ); otv_FeatureList_validate( table + FeatureList, table + LookupList, - valid ); + otvalid ); otv_ScriptList_validate( table + ScriptList, table + FeatureList, - valid ); + otvalid ); FT_TRACE4(( "\n" )); } diff --git a/src/otvalid/otvjstf.c b/src/otvalid/otvjstf.c index a616a2343..f273be8bb 100644 --- a/src/otvalid/otvjstf.c +++ b/src/otvalid/otvjstf.c @@ -34,13 +34,13 @@ #define JstfPriorityFunc otv_JstfPriority_validate #define JstfLookupFunc otv_GPOS_subtable_validate - /* uses valid->extra1 (GSUB lookup count) */ - /* uses valid->extra2 (GPOS lookup count) */ - /* sets valid->extra1 (counter) */ + /* uses otvalid->extra1 (GSUB lookup count) */ + /* uses otvalid->extra2 (GPOS lookup count) */ + /* sets otvalid->extra1 (counter) */ static void otv_JstfPriority_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt table_size; @@ -63,34 +63,34 @@ OTV_LIMIT_CHECK( 20 ); - gsub_lookup_count = valid->extra1; - gpos_lookup_count = valid->extra2; + gsub_lookup_count = otvalid->extra1; + gpos_lookup_count = otvalid->extra2; table_size = 20; - valid->extra1 = gsub_lookup_count; + otvalid->extra1 = gsub_lookup_count; OTV_OPTIONAL_OFFSET( ShrinkageEnableGSUB ); OTV_SIZE_CHECK( ShrinkageEnableGSUB ); if ( ShrinkageEnableGSUB ) - otv_x_ux( table + ShrinkageEnableGSUB, valid ); + otv_x_ux( table + ShrinkageEnableGSUB, otvalid ); OTV_OPTIONAL_OFFSET( ShrinkageDisableGSUB ); OTV_SIZE_CHECK( ShrinkageDisableGSUB ); if ( ShrinkageDisableGSUB ) - otv_x_ux( table + ShrinkageDisableGSUB, valid ); + otv_x_ux( table + ShrinkageDisableGSUB, otvalid ); - valid->extra1 = gpos_lookup_count; + otvalid->extra1 = gpos_lookup_count; OTV_OPTIONAL_OFFSET( ShrinkageEnableGPOS ); OTV_SIZE_CHECK( ShrinkageEnableGPOS ); if ( ShrinkageEnableGPOS ) - otv_x_ux( table + ShrinkageEnableGPOS, valid ); + otv_x_ux( table + ShrinkageEnableGPOS, otvalid ); OTV_OPTIONAL_OFFSET( ShrinkageDisableGPOS ); OTV_SIZE_CHECK( ShrinkageDisableGPOS ); if ( ShrinkageDisableGPOS ) - otv_x_ux( table + ShrinkageDisableGPOS, valid ); + otv_x_ux( table + ShrinkageDisableGPOS, otvalid ); OTV_OPTIONAL_OFFSET( ShrinkageJstfMax ); OTV_SIZE_CHECK( ShrinkageJstfMax ); @@ -98,32 +98,32 @@ { /* XXX: check lookup types? */ OTV_NEST2( JstfMax, JstfLookup ); - OTV_RUN( table + ShrinkageJstfMax, valid ); + OTV_RUN( table + ShrinkageJstfMax, otvalid ); } - valid->extra1 = gsub_lookup_count; + otvalid->extra1 = gsub_lookup_count; OTV_OPTIONAL_OFFSET( ExtensionEnableGSUB ); OTV_SIZE_CHECK( ExtensionEnableGSUB ); if ( ExtensionEnableGSUB ) - otv_x_ux( table + ExtensionEnableGSUB, valid ); + otv_x_ux( table + ExtensionEnableGSUB, otvalid ); OTV_OPTIONAL_OFFSET( ExtensionDisableGSUB ); OTV_SIZE_CHECK( ExtensionDisableGSUB ); if ( ExtensionDisableGSUB ) - otv_x_ux( table + ExtensionDisableGSUB, valid ); + otv_x_ux( table + ExtensionDisableGSUB, otvalid ); - valid->extra1 = gpos_lookup_count; + otvalid->extra1 = gpos_lookup_count; OTV_OPTIONAL_OFFSET( ExtensionEnableGPOS ); OTV_SIZE_CHECK( ExtensionEnableGPOS ); if ( ExtensionEnableGPOS ) - otv_x_ux( table + ExtensionEnableGPOS, valid ); + otv_x_ux( table + ExtensionEnableGPOS, otvalid ); OTV_OPTIONAL_OFFSET( ExtensionDisableGPOS ); OTV_SIZE_CHECK( ExtensionDisableGPOS ); if ( ExtensionDisableGPOS ) - otv_x_ux( table + ExtensionDisableGPOS, valid ); + otv_x_ux( table + ExtensionDisableGPOS, otvalid ); OTV_OPTIONAL_OFFSET( ExtensionJstfMax ); OTV_SIZE_CHECK( ExtensionJstfMax ); @@ -131,22 +131,22 @@ { /* XXX: check lookup types? */ OTV_NEST2( JstfMax, JstfLookup ); - OTV_RUN( table + ExtensionJstfMax, valid ); + OTV_RUN( table + ExtensionJstfMax, otvalid ); } - valid->extra1 = gsub_lookup_count; - valid->extra2 = gpos_lookup_count; + otvalid->extra1 = gsub_lookup_count; + otvalid->extra2 = gpos_lookup_count; OTV_EXIT; } - /* sets valid->extra (glyph count) */ - /* sets valid->func1 (otv_JstfPriority_validate) */ + /* sets otvalid->extra (glyph count) */ + /* sets otvalid->func1 (otv_JstfPriority_validate) */ static void otv_JstfScript_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt table_size; @@ -170,16 +170,16 @@ OTV_SIZE_CHECK( ExtGlyph ); if ( ExtGlyph ) { - valid->extra1 = valid->glyph_count; + otvalid->extra1 = otvalid->glyph_count; OTV_NEST1( ExtenderGlyph ); - OTV_RUN( table + ExtGlyph, valid ); + OTV_RUN( table + ExtGlyph, otvalid ); } OTV_SIZE_CHECK( DefJstfLangSys ); if ( DefJstfLangSys ) { OTV_NEST2( JstfLangSys, JstfPriority ); - OTV_RUN( table + DefJstfLangSys, valid ); + OTV_RUN( table + DefJstfLangSys, otvalid ); } OTV_LIMIT_CHECK( 6 * JstfLangSysCount ); @@ -190,16 +190,16 @@ { p += 4; /* skip JstfLangSysTag */ - OTV_RUN( table + FT_NEXT_USHORT( p ), valid ); + OTV_RUN( table + FT_NEXT_USHORT( p ), otvalid ); } OTV_EXIT; } - /* sets valid->extra1 (GSUB lookup count) */ - /* sets valid->extra2 (GPOS lookup count) */ - /* sets valid->glyph_count */ + /* sets otvalid->extra1 (GSUB lookup count) */ + /* sets otvalid->extra2 (GPOS lookup count) */ + /* sets otvalid->glyph_count */ FT_LOCAL_DEF( void ) otv_JSTF_validate( FT_Bytes table, @@ -208,13 +208,14 @@ FT_UInt glyph_count, FT_Validator ftvalid ) { - OTV_ValidatorRec validrec; - OTV_Validator valid = &validrec; + OTV_ValidatorRec otvalidrec; + OTV_Validator otvalid = &otvalidrec; FT_Bytes p = table; FT_UInt JstfScriptCount; - valid->root = ftvalid; + otvalid->root = ftvalid; + FT_TRACE3(( "validating JSTF table\n" )); OTV_INIT; @@ -231,16 +232,16 @@ OTV_LIMIT_CHECK( JstfScriptCount * 6 ); if ( gsub ) - valid->extra1 = otv_GSUBGPOS_get_Lookup_count( gsub ); + otvalid->extra1 = otv_GSUBGPOS_get_Lookup_count( gsub ); else - valid->extra1 = 0; + otvalid->extra1 = 0; if ( gpos ) - valid->extra2 = otv_GSUBGPOS_get_Lookup_count( gpos ); + otvalid->extra2 = otv_GSUBGPOS_get_Lookup_count( gpos ); else - valid->extra2 = 0; + otvalid->extra2 = 0; - valid->glyph_count = glyph_count; + otvalid->glyph_count = glyph_count; /* JstfScriptRecord */ for ( ; JstfScriptCount > 0; JstfScriptCount-- ) @@ -248,7 +249,7 @@ p += 4; /* skip JstfScriptTag */ /* JstfScript */ - otv_JstfScript_validate( table + FT_NEXT_USHORT( p ), valid ); + otv_JstfScript_validate( table + FT_NEXT_USHORT( p ), otvalid ); } FT_TRACE4(( "\n" )); diff --git a/src/otvalid/otvmath.c b/src/otvalid/otvmath.c index 96f841f2a..d1791f8de 100644 --- a/src/otvalid/otvmath.c +++ b/src/otvalid/otvmath.c @@ -44,7 +44,7 @@ static void otv_MathConstants_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt i; @@ -66,7 +66,7 @@ OTV_OPTIONAL_OFFSET( DeviceTableOffset ); OTV_SIZE_CHECK( DeviceTableOffset ); if ( DeviceTableOffset ) - otv_Device_validate( table + DeviceTableOffset, valid ); + otv_Device_validate( table + DeviceTableOffset, otvalid ); } OTV_EXIT; @@ -84,7 +84,7 @@ static void otv_MathItalicsCorrectionInfo_validate( FT_Bytes table, - OTV_Validator valid, + OTV_Validator otvalid, FT_Int isItalic ) { FT_Bytes p = table; @@ -108,7 +108,7 @@ table_size = 4 + 4 * cnt; OTV_SIZE_CHECK( Coverage ); - otv_Coverage_validate( table + Coverage, valid, cnt ); + otv_Coverage_validate( table + Coverage, otvalid, cnt ); for ( i = 0; i < cnt; ++i ) { @@ -116,7 +116,7 @@ OTV_OPTIONAL_OFFSET( DeviceTableOffset ); OTV_SIZE_CHECK( DeviceTableOffset ); if ( DeviceTableOffset ) - otv_Device_validate( table + DeviceTableOffset, valid ); + otv_Device_validate( table + DeviceTableOffset, otvalid ); } OTV_EXIT; @@ -133,7 +133,7 @@ static void otv_MathKern_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt i, cnt, table_size; @@ -157,7 +157,7 @@ OTV_OPTIONAL_OFFSET( DeviceTableOffset ); OTV_SIZE_CHECK( DeviceTableOffset ); if ( DeviceTableOffset ) - otv_Device_validate( table + DeviceTableOffset, valid ); + otv_Device_validate( table + DeviceTableOffset, otvalid ); } /* One more Kerning value */ @@ -167,7 +167,7 @@ OTV_OPTIONAL_OFFSET( DeviceTableOffset ); OTV_SIZE_CHECK( DeviceTableOffset ); if ( DeviceTableOffset ) - otv_Device_validate( table + DeviceTableOffset, valid ); + otv_Device_validate( table + DeviceTableOffset, otvalid ); } OTV_EXIT; @@ -176,7 +176,7 @@ static void otv_MathKernInfo_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt i, j, cnt, table_size; @@ -196,7 +196,7 @@ table_size = 4 + 8 * cnt; OTV_SIZE_CHECK( Coverage ); - otv_Coverage_validate( table + Coverage, valid, cnt ); + otv_Coverage_validate( table + Coverage, otvalid, cnt ); for ( i = 0; i < cnt; ++i ) { @@ -205,7 +205,7 @@ OTV_OPTIONAL_OFFSET( MKRecordOffset ); OTV_SIZE_CHECK( MKRecordOffset ); if ( MKRecordOffset ) - otv_MathKern_validate( table + MKRecordOffset, valid ); + otv_MathKern_validate( table + MKRecordOffset, otvalid ); } } @@ -223,7 +223,7 @@ static void otv_MathGlyphInfo_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt MathItalicsCorrectionInfo, MathTopAccentAttachment; @@ -241,22 +241,22 @@ if ( MathItalicsCorrectionInfo ) otv_MathItalicsCorrectionInfo_validate( - table + MathItalicsCorrectionInfo, valid, TRUE ); + table + MathItalicsCorrectionInfo, otvalid, TRUE ); /* Italic correction and Top Accent Attachment have the same format */ if ( MathTopAccentAttachment ) otv_MathItalicsCorrectionInfo_validate( - table + MathTopAccentAttachment, valid, FALSE ); + table + MathTopAccentAttachment, otvalid, FALSE ); if ( ExtendedShapeCoverage ) { OTV_NAME_ENTER( "ExtendedShapeCoverage" ); - otv_Coverage_validate( table + ExtendedShapeCoverage, valid, -1 ); + otv_Coverage_validate( table + ExtendedShapeCoverage, otvalid, -1 ); OTV_EXIT; } if ( MathKernInfo ) - otv_MathKernInfo_validate( table + MathKernInfo, valid ); + otv_MathKernInfo_validate( table + MathKernInfo, otvalid ); OTV_EXIT; } @@ -272,7 +272,7 @@ static void otv_GlyphAssembly_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt pcnt, table_size; @@ -294,7 +294,7 @@ OTV_SIZE_CHECK( DeviceTableOffset ); if ( DeviceTableOffset ) - otv_Device_validate( table + DeviceTableOffset, valid ); + otv_Device_validate( table + DeviceTableOffset, otvalid ); for ( i = 0; i < pcnt; ++i ) { @@ -302,7 +302,7 @@ gid = FT_NEXT_USHORT( p ); - if ( gid >= valid->glyph_count ) + if ( gid >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; p += 2*4; /* skip the Start, End, Full, and Flags fields */ } @@ -313,7 +313,7 @@ static void otv_MathGlyphConstruction_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt vcnt, table_size; @@ -338,14 +338,14 @@ gid = FT_NEXT_USHORT( p ); - if ( gid >= valid->glyph_count ) + if ( gid >= otvalid->glyph_count ) FT_INVALID_GLYPH_ID; p += 2; /* skip the size */ } OTV_SIZE_CHECK( GlyphAssembly ); if ( GlyphAssembly ) - otv_GlyphAssembly_validate( table+GlyphAssembly, valid ); + otv_GlyphAssembly_validate( table+GlyphAssembly, otvalid ); /* OTV_EXIT; */ } @@ -353,7 +353,7 @@ static void otv_MathVariants_validate( FT_Bytes table, - OTV_Validator valid ) + OTV_Validator otvalid ) { FT_Bytes p = table; FT_UInt vcnt, hcnt, i, table_size; @@ -378,24 +378,24 @@ OTV_SIZE_CHECK( VCoverage ); if ( VCoverage ) - otv_Coverage_validate( table + VCoverage, valid, vcnt ); + otv_Coverage_validate( table + VCoverage, otvalid, vcnt ); OTV_SIZE_CHECK( HCoverage ); if ( HCoverage ) - otv_Coverage_validate( table + HCoverage, valid, hcnt ); + otv_Coverage_validate( table + HCoverage, otvalid, hcnt ); for ( i = 0; i < vcnt; ++i ) { OTV_OPTIONAL_OFFSET( Offset ); OTV_SIZE_CHECK( Offset ); - otv_MathGlyphConstruction_validate( table + Offset, valid ); + otv_MathGlyphConstruction_validate( table + Offset, otvalid ); } for ( i = 0; i < hcnt; ++i ) { OTV_OPTIONAL_OFFSET( Offset ); OTV_SIZE_CHECK( Offset ); - otv_MathGlyphConstruction_validate( table + Offset, valid ); + otv_MathGlyphConstruction_validate( table + Offset, otvalid ); } OTV_EXIT; @@ -410,20 +410,20 @@ /*************************************************************************/ /*************************************************************************/ - /* sets valid->glyph_count */ + /* sets otvalid->glyph_count */ FT_LOCAL_DEF( void ) otv_MATH_validate( FT_Bytes table, FT_UInt glyph_count, FT_Validator ftvalid ) { - OTV_ValidatorRec validrec; - OTV_Validator valid = &validrec; - FT_Bytes p = table; + OTV_ValidatorRec otvalidrec; + OTV_Validator otvalid = &otvalidrec; + FT_Bytes p = table; FT_UInt MathConstants, MathGlyphInfo, MathVariants; - valid->root = ftvalid; + otvalid->root = ftvalid; FT_TRACE3(( "validating MATH table\n" )); OTV_INIT; @@ -437,14 +437,14 @@ MathGlyphInfo = FT_NEXT_USHORT( p ); MathVariants = FT_NEXT_USHORT( p ); - valid->glyph_count = glyph_count; + otvalid->glyph_count = glyph_count; otv_MathConstants_validate( table + MathConstants, - valid ); + otvalid ); otv_MathGlyphInfo_validate( table + MathGlyphInfo, - valid ); + otvalid ); otv_MathVariants_validate ( table + MathVariants, - valid ); + otvalid ); FT_TRACE4(( "\n" )); }