/* */
/* TrueTypeGX/AAT common tables validation (body). */
/* */
-/* Copyright 2004, 2005, 2009, 2010 */
+/* Copyright 2004, 2005, 2009, 2010, 2013 */
/* by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
FT_UShort* buff,
FT_UInt nmemb,
FT_UShort limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_UInt i;
FT_ULong* buff,
FT_UInt nmemb,
FT_ULong limit,
- GXV_Validator valid)
+ GXV_Validator gxvalid)
{
FT_UInt i;
FT_Bytes limit,
FT_Byte* min,
FT_Byte* max,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
*max = (FT_Byte)FT_MAX( *max, val );
}
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
}
FT_Bytes limit,
FT_UShort* min,
FT_UShort* max,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
*max = (FT_Byte)FT_MAX( *max, val );
}
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
}
static void
gxv_BinSrchHeader_check_consistency( GXV_BinSrchHeader* binSrchHeader,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_UShort searchRange;
FT_UShort entrySelector;
binSrchHeader->unitSize, binSrchHeader->nUnits,
searchRange, entrySelector, rangeShift ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_DATA;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
}
}
FT_Bytes limit,
FT_UShort* unitSize_p,
FT_UShort* nUnits_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
GXV_BinSrchHeader binSrchHeader;
binSrchHeader.rangeShift = FT_NEXT_USHORT( p );
GXV_TRACE(( "nUnits %d\n", binSrchHeader.nUnits ));
- gxv_BinSrchHeader_check_consistency( &binSrchHeader, valid );
+ gxv_BinSrchHeader_check_consistency( &binSrchHeader, gxvalid );
if ( *unitSize_p == 0 )
*unitSize_p = binSrchHeader.unitSize;
if ( *nUnits_p == 0 )
*nUnits_p = binSrchHeader.nUnits;
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
static void
gxv_LookupTable_fmt0_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_UShort i;
GXV_NAME_ENTER( "LookupTable format 0" );
- GXV_LIMIT_CHECK( 2 * valid->face->num_glyphs );
+ GXV_LIMIT_CHECK( 2 * gxvalid->face->num_glyphs );
- for ( i = 0; i < valid->face->num_glyphs; i++ )
+ for ( i = 0; i < gxvalid->face->num_glyphs; i++ )
{
GXV_LIMIT_CHECK( 2 );
if ( p + 2 >= limit ) /* some fonts have too-short fmt0 array */
{
GXV_TRACE(( "too short, glyphs %d - %d are missing\n",
- i, valid->face->num_glyphs ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ i, gxvalid->face->num_glyphs ));
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
break;
}
- value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
- valid->lookupval_func( i, &value, valid );
+ value = GXV_LOOKUP_VALUE_LOAD( p, gxvalid->lookupval_sign );
+ gxvalid->lookupval_func( i, &value, gxvalid );
}
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
static void
gxv_LookupTable_fmt2_skip_endmarkers( FT_Bytes table,
FT_UShort unitSize,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
- while ( ( p + 4 ) < valid->root->limit )
+ while ( ( p + 4 ) < gxvalid->root->limit )
{
if ( p[0] != 0xFF || p[1] != 0xFF || /* lastGlyph */
p[2] != 0xFF || p[3] != 0xFF ) /* firstGlyph */
p += unitSize;
}
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
}
static void
gxv_LookupTable_fmt2_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_UShort gid;
GXV_NAME_ENTER( "LookupTable format 2" );
unitSize = nUnits = 0;
- gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid );
- p += valid->subtable_length;
+ gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, gxvalid );
+ p += gxvalid->subtable_length;
GXV_UNITSIZE_VALIDATE( "format2", unitSize, nUnits, 6 );
GXV_LIMIT_CHECK( 2 + 2 + 2 );
lastGlyph = FT_NEXT_USHORT( p );
firstGlyph = FT_NEXT_USHORT( p );
- value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
+ value = GXV_LOOKUP_VALUE_LOAD( p, gxvalid->lookupval_sign );
- gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( lastGlyph, valid );
+ gxv_glyphid_validate( firstGlyph, gxvalid );
+ gxv_glyphid_validate( lastGlyph, gxvalid );
if ( lastGlyph < gid )
{
GXV_TRACE(( "reverse ordered segment specification:"
" lastGlyph[%d]=%d < lastGlyph[%d]=%d\n",
unit, lastGlyph, unit - 1 , gid ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
if ( lastGlyph < firstGlyph )
GXV_TRACE(( "reverse ordered range specification at unit %d:",
" lastGlyph %d < firstGlyph %d ",
unit, lastGlyph, firstGlyph ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
- if ( valid->root->level == FT_VALIDATE_TIGHT )
+ if ( gxvalid->root->level == FT_VALIDATE_TIGHT )
continue; /* ftxvalidator silently skips such an entry */
FT_TRACE4(( "continuing with exchanged values\n" ));
}
for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
- valid->lookupval_func( gid, &value, valid );
+ gxvalid->lookupval_func( gid, &value, gxvalid );
}
- gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );
- p += valid->subtable_length;
+ gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, gxvalid );
+ p += gxvalid->subtable_length;
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
static void
gxv_LookupTable_fmt4_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_UShort unit;
GXV_NAME_ENTER( "LookupTable format 4" );
unitSize = nUnits = 0;
- gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid );
- p += valid->subtable_length;
+ gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, gxvalid );
+ p += gxvalid->subtable_length;
GXV_UNITSIZE_VALIDATE( "format4", unitSize, nUnits, 6 );
lastGlyph = FT_NEXT_USHORT( p );
firstGlyph = FT_NEXT_USHORT( p );
- gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( lastGlyph, valid );
+ gxv_glyphid_validate( firstGlyph, gxvalid );
+ gxv_glyphid_validate( lastGlyph, gxvalid );
if ( lastGlyph < gid )
{
GXV_TRACE(( "reverse ordered segment specification:"
" lastGlyph[%d]=%d < lastGlyph[%d]=%d\n",
unit, lastGlyph, unit - 1 , gid ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
if ( lastGlyph < firstGlyph )
GXV_TRACE(( "reverse ordered range specification at unit %d:",
" lastGlyph %d < firstGlyph %d ",
unit, lastGlyph, firstGlyph ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
- if ( valid->root->level == FT_VALIDATE_TIGHT )
+ if ( gxvalid->root->level == FT_VALIDATE_TIGHT )
continue; /* ftxvalidator silently skips such an entry */
FT_TRACE4(( "continuing with exchanged values\n" ));
for ( gid = firstGlyph; gid <= lastGlyph; gid++ )
{
- value = valid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ),
+ value = gxvalid->lookupfmt4_trans( (FT_UShort)( gid - firstGlyph ),
&base_value,
limit,
- valid );
+ gxvalid );
- valid->lookupval_func( gid, &value, valid );
+ gxvalid->lookupval_func( gid, &value, gxvalid );
}
}
- gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, valid );
- p += valid->subtable_length;
+ gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, gxvalid );
+ p += gxvalid->subtable_length;
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
static void
gxv_LookupTable_fmt6_skip_endmarkers( FT_Bytes table,
FT_UShort unitSize,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
- while ( p < valid->root->limit )
+ while ( p < gxvalid->root->limit )
{
if ( p[0] != 0xFF || p[1] != 0xFF )
break;
p += unitSize;
}
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
}
static void
gxv_LookupTable_fmt6_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_UShort unit;
GXV_NAME_ENTER( "LookupTable format 6" );
unitSize = nUnits = 0;
- gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, valid );
- p += valid->subtable_length;
+ gxv_BinSrchHeader_validate( p, limit, &unitSize, &nUnits, gxvalid );
+ p += gxvalid->subtable_length;
GXV_UNITSIZE_VALIDATE( "format6", unitSize, nUnits, 4 );
{
GXV_LIMIT_CHECK( 2 + 2 );
glyph = FT_NEXT_USHORT( p );
- value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
+ value = GXV_LOOKUP_VALUE_LOAD( p, gxvalid->lookupval_sign );
- if ( gxv_glyphid_validate( glyph, valid ) )
+ if ( gxv_glyphid_validate( glyph, gxvalid ) )
GXV_TRACE(( " endmarker found within defined range"
" (entry %d < nUnits=%d)\n",
unit, nUnits ));
{
GXV_TRACE(( "current gid 0x%04x < previous gid 0x%04x\n",
glyph, prev_glyph ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
prev_glyph = glyph;
- valid->lookupval_func( glyph, &value, valid );
+ gxvalid->lookupval_func( glyph, &value, gxvalid );
}
- gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, valid );
- p += valid->subtable_length;
+ gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, gxvalid );
+ p += gxvalid->subtable_length;
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
static void
gxv_LookupTable_fmt8_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_UShort i;
firstGlyph = FT_NEXT_USHORT( p );
glyphCount = FT_NEXT_USHORT( p );
- gxv_glyphid_validate( firstGlyph, valid );
- gxv_glyphid_validate( (FT_UShort)( firstGlyph + glyphCount ), valid );
+ gxv_glyphid_validate( firstGlyph, gxvalid );
+ gxv_glyphid_validate( (FT_UShort)( firstGlyph + glyphCount ), gxvalid );
/* valueArray */
for ( i = 0; i < glyphCount; i++ )
{
GXV_LIMIT_CHECK( 2 );
- value = GXV_LOOKUP_VALUE_LOAD( p, valid->lookupval_sign );
- valid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, valid );
+ value = GXV_LOOKUP_VALUE_LOAD( p, gxvalid->lookupval_sign );
+ gxvalid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, gxvalid );
}
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
FT_LOCAL_DEF( void )
gxv_LookupTable_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_UShort format;
GXV_NAME_ENTER( "LookupTable" );
/* lookuptbl_head may be used in fmt4 transit function. */
- valid->lookuptbl_head = table;
+ gxvalid->lookuptbl_head = table;
/* format */
GXV_LIMIT_CHECK( 2 );
if ( func == NULL )
FT_INVALID_FORMAT;
- func( p, limit, valid );
- p += valid->subtable_length;
+ func( p, limit, gxvalid );
+ p += gxvalid->subtable_length;
- valid->subtable_length = p - table;
+ gxvalid->subtable_length = p - table;
GXV_EXIT;
}
FT_LOCAL_DEF( FT_Int )
gxv_glyphid_validate( FT_UShort gid,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Face face;
return 1;
}
- face = valid->face;
+ face = gxvalid->face;
if ( face->num_glyphs < gid )
{
GXV_TRACE(( " gxv_glyphid_check() gid overflow: num_glyphs %d < %d\n",
face->num_glyphs, gid ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_GLYPH_ID;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_GLYPH_ID );
}
return 0;
FT_LOCAL_DEF( void )
gxv_ctlPoint_validate( FT_UShort gid,
FT_Short ctl_point,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Face face;
FT_Error error;
short n_points;
- face = valid->face;
+ face = gxvalid->face;
error = FT_Load_Glyph( face,
gid,
gxv_sfntName_validate( FT_UShort name_index,
FT_UShort min_index,
FT_UShort max_index,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_SfntName name;
FT_UInt i;
if ( name_index < min_index || max_index < name_index )
FT_INVALID_FORMAT;
- nnames = FT_Get_Sfnt_Name_Count( valid->face );
+ nnames = FT_Get_Sfnt_Name_Count( gxvalid->face );
for ( i = 0; i < nnames; i++ )
{
- if ( FT_Get_Sfnt_Name( valid->face, i, &name ) != GXV_Err_Ok )
+ if ( FT_Get_Sfnt_Name( gxvalid->face, i, &name ) != FT_Err_Ok )
continue ;
if ( name.name_id == name_index )
FT_UShort* length_p,
FT_UShort stateSize,
FT_Byte* maxClassID_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_Bytes limit = table + *length_p;
if ( !nGlyphs )
goto Out;
- gxv_glyphid_validate( (FT_UShort)( firstGlyph + nGlyphs ), valid );
+ gxv_glyphid_validate( (FT_UShort)( firstGlyph + nGlyphs ), gxvalid );
{
FT_Byte nGlyphInClass[256];
FT_UShort stateSize,
FT_Byte* maxState_p,
FT_Byte* maxEntry_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
- FT_Bytes p = table;
+ FT_Bytes p = table;
FT_Bytes limit = table + *length_p;
FT_Byte clazz;
FT_Byte entry;
FT_Byte maxClassID,
FT_Bytes statetable_table,
FT_Bytes statetable_limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_Bytes limit = table + *length_p;
if ( ( maxEntry + 1 ) * entrySize > *length_p )
{
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_TOO_SHORT;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_TOO_SHORT );
/* ftxvalidator and FontValidator both warn and continue */
maxEntry = (FT_Byte)( *length_p / entrySize - 1 );
{
GXV_TRACE(( " newState offset 0x%04x is out of stateArray\n",
newState ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_OFFSET;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
continue;
}
{
GXV_TRACE(( " newState offset 0x%04x is not aligned to %d-classes\n",
newState, 1 + maxClassID ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_OFFSET;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
continue;
}
break;
default:
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_FORMAT;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT );
goto Exit;
}
- if ( NULL != valid->statetable.entry_validate_func )
- valid->statetable.entry_validate_func( state,
- flags,
- &glyphOffset,
- statetable_table,
- statetable_limit,
- valid );
+ if ( NULL != gxvalid->statetable.entry_validate_func )
+ gxvalid->statetable.entry_validate_func( state,
+ flags,
+ &glyphOffset,
+ statetable_table,
+ statetable_limit,
+ gxvalid );
}
Exit:
FT_UShort* classTable_length_p,
FT_UShort* stateArray_length_p,
FT_UShort* entryTable_length_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_UShort o[3];
FT_UShort* l[3];
l[1] = stateArray_length_p;
l[2] = entryTable_length_p;
- gxv_set_length_by_ushort_offset( o, l, buff, 3, table_size, valid );
+ gxv_set_length_by_ushort_offset( o, l, buff, 3, table_size, gxvalid );
}
FT_LOCAL_DEF( void )
gxv_StateTable_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_UShort stateSize;
FT_UShort classTable; /* offset to Class(Sub)Table */
if ( stateSize > 0xFF )
FT_INVALID_DATA;
- if ( valid->statetable.optdata_load_func != NULL )
- valid->statetable.optdata_load_func( p, limit, valid );
+ if ( gxvalid->statetable.optdata_load_func != NULL )
+ gxvalid->statetable.optdata_load_func( p, limit, gxvalid );
- if ( valid->statetable.subtable_setup_func != NULL)
- setup_func = valid->statetable.subtable_setup_func;
+ if ( gxvalid->statetable.subtable_setup_func != NULL)
+ setup_func = gxvalid->statetable.subtable_setup_func;
else
setup_func = gxv_StateTable_subtable_setup;
&classTable_length,
&stateArray_length,
&entryTable_length,
- valid );
+ gxvalid );
GXV_TRACE(( "StateTable Subtables\n" ));
&classTable_length,
stateSize,
&maxClassID,
- valid );
+ gxvalid );
else
maxClassID = (FT_Byte)( stateSize - 1 );
stateSize,
&maxState,
&maxEntry,
- valid );
+ gxvalid );
else
{
+#if 0
maxState = 1; /* 0:start of text, 1:start of line are predefined */
+#endif
maxEntry = 0;
}
maxClassID,
table,
limit,
- valid );
+ gxvalid );
GXV_EXIT;
}
FT_ULong* classTable_length_p,
FT_ULong* stateArray_length_p,
FT_ULong* entryTable_length_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_ULong o[3];
FT_ULong* l[3];
l[1] = stateArray_length_p;
l[2] = entryTable_length_p;
- gxv_set_length_by_ulong_offset( o, l, buff, 4, table_size, valid );
+ gxv_set_length_by_ulong_offset( o, l, buff, 3, table_size, gxvalid );
}
static void
gxv_XClassTable_lookupval_validate( FT_UShort glyph,
GXV_LookupValueCPtr value_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_UNUSED( glyph );
- if ( value_p->u >= valid->xstatetable.nClasses )
+ if ( value_p->u >= gxvalid->xstatetable.nClasses )
FT_INVALID_DATA;
- if ( value_p->u > valid->xstatetable.maxClassID )
- valid->xstatetable.maxClassID = value_p->u;
+ if ( value_p->u > gxvalid->xstatetable.maxClassID )
+ gxvalid->xstatetable.maxClassID = value_p->u;
}
gxv_XClassTable_lookupfmt4_transit( FT_UShort relative_gindex,
GXV_LookupValueCPtr base_value_p,
FT_Bytes lookuptbl_limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p;
FT_Bytes limit;
offset = (FT_UShort)( base_value_p->u +
relative_gindex * sizeof ( FT_UShort ) );
- p = valid->lookuptbl_head + offset;
+ p = gxvalid->lookuptbl_head + offset;
limit = lookuptbl_limit;
GXV_LIMIT_CHECK ( 2 );
FT_ULong stateSize,
FT_UShort* maxState_p,
FT_UShort* maxEntry_p,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_Bytes limit = table + *length_p;
FT_UShort maxClassID,
FT_Bytes xstatetable_table,
FT_Bytes xstatetable_limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_Bytes p = table;
FT_Bytes limit = table + *length_p;
{
GXV_TRACE(( " newState index 0x%04x points out of stateArray\n",
newState_idx ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_OFFSET;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
}
state = (FT_UShort)( newState_idx / ( 1 + maxClassID ) );
FT_TRACE4(( "-> new state = %d (supposed)\n"
"but newState index 0x%04x is not aligned to %d-classes\n",
state, newState_idx, 1 + maxClassID ));
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_OFFSET;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_OFFSET );
}
switch ( GXV_GLYPHOFFSET_FMT( xstatetable ) )
break;
default:
- if ( valid->root->level >= FT_VALIDATE_PARANOID )
- FT_INVALID_FORMAT;
+ GXV_SET_ERR_IF_PARANOID( FT_INVALID_FORMAT );
goto Exit;
}
- if ( NULL != valid->xstatetable.entry_validate_func )
- valid->xstatetable.entry_validate_func( state,
- flags,
- &glyphOffset,
- xstatetable_table,
- xstatetable_limit,
- valid );
+ if ( NULL != gxvalid->xstatetable.entry_validate_func )
+ gxvalid->xstatetable.entry_validate_func( state,
+ flags,
+ &glyphOffset,
+ xstatetable_table,
+ xstatetable_limit,
+ gxvalid );
}
Exit:
FT_LOCAL_DEF( void )
gxv_XStateTable_validate( FT_Bytes table,
FT_Bytes limit,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
/* StateHeader members */
FT_ULong classTable; /* offset to Class(Sub)Table */
GXV_TRACE(( "XStateTable header\n" ));
GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 );
- valid->xstatetable.nClasses = FT_NEXT_ULONG( p );
+ gxvalid->xstatetable.nClasses = FT_NEXT_ULONG( p );
classTable = FT_NEXT_ULONG( p );
stateArray = FT_NEXT_ULONG( p );
entryTable = FT_NEXT_ULONG( p );
- GXV_TRACE(( "nClasses =0x%08x\n", valid->xstatetable.nClasses ));
+ GXV_TRACE(( "nClasses =0x%08x\n", gxvalid->xstatetable.nClasses ));
GXV_TRACE(( "offset to classTable=0x%08x\n", classTable ));
GXV_TRACE(( "offset to stateArray=0x%08x\n", stateArray ));
GXV_TRACE(( "offset to entryTable=0x%08x\n", entryTable ));
- if ( valid->xstatetable.nClasses > 0xFFFFU )
+ if ( gxvalid->xstatetable.nClasses > 0xFFFFU )
FT_INVALID_DATA;
GXV_TRACE(( "StateTable Subtables\n" ));
- if ( valid->xstatetable.optdata_load_func != NULL )
- valid->xstatetable.optdata_load_func( p, limit, valid );
+ if ( gxvalid->xstatetable.optdata_load_func != NULL )
+ gxvalid->xstatetable.optdata_load_func( p, limit, gxvalid );
- if ( valid->xstatetable.subtable_setup_func != NULL )
- setup_func = valid->xstatetable.subtable_setup_func;
+ if ( gxvalid->xstatetable.subtable_setup_func != NULL )
+ setup_func = gxvalid->xstatetable.subtable_setup_func;
else
setup_func = gxv_XStateTable_subtable_setup;
&classTable_length,
&stateArray_length,
&entryTable_length,
- valid );
+ gxvalid );
if ( classTable != 0 )
{
- valid->xstatetable.maxClassID = 0;
- valid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;
- valid->lookupval_func = gxv_XClassTable_lookupval_validate;
- valid->lookupfmt4_trans = gxv_XClassTable_lookupfmt4_transit;
+ gxvalid->xstatetable.maxClassID = 0;
+ gxvalid->lookupval_sign = GXV_LOOKUPVALUE_UNSIGNED;
+ gxvalid->lookupval_func = gxv_XClassTable_lookupval_validate;
+ gxvalid->lookupfmt4_trans = gxv_XClassTable_lookupfmt4_transit;
gxv_LookupTable_validate( table + classTable,
table + classTable + classTable_length,
- valid );
- if ( valid->subtable_length < classTable_length )
- classTable_length = valid->subtable_length;
+ gxvalid );
+#if 0
+ if ( gxvalid->subtable_length < classTable_length )
+ classTable_length = gxvalid->subtable_length;
+#endif
}
else
{
/* XXX: check range? */
- valid->xstatetable.maxClassID =
- (FT_UShort)( valid->xstatetable.nClasses - 1 );
+ gxvalid->xstatetable.maxClassID =
+ (FT_UShort)( gxvalid->xstatetable.nClasses - 1 );
}
if ( stateArray != 0 )
gxv_XStateArray_validate( table + stateArray,
&stateArray_length,
- valid->xstatetable.maxClassID,
- valid->xstatetable.nClasses,
+ gxvalid->xstatetable.maxClassID,
+ gxvalid->xstatetable.nClasses,
&maxState,
&maxEntry,
- valid );
+ gxvalid );
else
{
+#if 0
maxState = 1; /* 0:start of text, 1:start of line are predefined */
+#endif
maxEntry = 0;
}
&entryTable_length,
maxEntry,
stateArray_length,
- valid->xstatetable.maxClassID,
+ gxvalid->xstatetable.maxClassID,
table,
limit,
- valid );
+ gxvalid );
GXV_EXIT;
}
const FT_String* name,
GXV_odtect_Range odtect )
{
- odtect->range[ odtect->nRanges ].start = start;
- odtect->range[ odtect->nRanges ].length = length;
- odtect->range[ odtect->nRanges ].name = (FT_String*)name;
+ odtect->range[odtect->nRanges].start = start;
+ odtect->range[odtect->nRanges].length = length;
+ odtect->range[odtect->nRanges].name = (FT_String*)name;
odtect->nRanges++;
}
FT_LOCAL_DEF( void )
gxv_odtect_validate( GXV_odtect_Range odtect,
- GXV_Validator valid )
+ GXV_Validator gxvalid )
{
FT_UInt i, j;
odtect->range[j].start,
odtect->range[j].length ) )
{
+#ifdef FT_DEBUG_LEVEL_TRACE
if ( odtect->range[i].name || odtect->range[j].name )
GXV_TRACE(( "found overlap between range %d and range %d\n",
i, j ));
GXV_TRACE(( "found overlap between `%s' and `%s\'\n",
odtect->range[i].name,
odtect->range[j].name ));
+#endif
FT_INVALID_OFFSET;
}