diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-19 17:34:42 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-03-20 13:42:29 +0000 |
commit | 2eaf0cf8fd6e7c290497fedb08134a89e7b49b1d (patch) | |
tree | 0a4f7bf528e87d0b0a71ce7fccf702b87f4cdec1 /src/3rdparty/freetype/src/gxvalid/gxvmort.c | |
parent | 77c518a50334d4dcf2476a4f39edc1e3990c7f0b (diff) |
Update bundled FreeType to 2.5.5
Removed everything, imported with help of import_from_tarball.sh script,
and then added a pre-generated builds/unix/ftconfig.h
Task-number: QTBUG-44648
Change-Id: Iea948e41f7761f1580382b3763d04c7a61383382
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/3rdparty/freetype/src/gxvalid/gxvmort.c')
-rw-r--r-- | src/3rdparty/freetype/src/gxvalid/gxvmort.c | 76 |
1 files changed, 45 insertions, 31 deletions
diff --git a/src/3rdparty/freetype/src/gxvalid/gxvmort.c b/src/3rdparty/freetype/src/gxvalid/gxvmort.c index 0aa066339d..55ff5a851e 100644 --- a/src/3rdparty/freetype/src/gxvalid/gxvmort.c +++ b/src/3rdparty/freetype/src/gxvalid/gxvmort.c @@ -4,7 +4,7 @@ /* */ /* TrueTypeGX/AAT mort table validation (body). */ /* */ -/* Copyright 2005 by suzuki toshiya, Masatake YAMATO, Red Hat K.K., */ +/* Copyright 2005, 2013 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, */ @@ -40,23 +40,21 @@ static void gxv_mort_feature_validate( GXV_mort_feature f, - GXV_Validator valid ) + GXV_Validator gxvalid ) { if ( f->featureType >= gxv_feat_registry_length ) { GXV_TRACE(( "featureType %d is out of registered range, " "setting %d is unchecked\n", f->featureType, f->featureSetting )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else if ( !gxv_feat_registry[f->featureType].existence ) { GXV_TRACE(( "featureType %d is within registered area " "but undefined, setting %d is unchecked\n", f->featureType, f->featureSetting )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } else { @@ -74,8 +72,7 @@ if ( f->featureSetting > nSettings_max ) { GXV_TRACE(( "out of defined range %d", nSettings_max )); - if ( valid->root->level >= FT_VALIDATE_PARANOID ) - FT_INVALID_DATA; + GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); } GXV_TRACE(( "\n" )); } @@ -92,7 +89,7 @@ gxv_mort_featurearray_validate( FT_Bytes table, FT_Bytes limit, FT_ULong nFeatureFlags, - GXV_Validator valid ) + GXV_Validator gxvalid ) { FT_Bytes p = table; FT_ULong i; @@ -109,23 +106,24 @@ f.enableFlags = FT_NEXT_ULONG( p ); f.disableFlags = FT_NEXT_ULONG( p ); - gxv_mort_feature_validate( &f, valid ); + gxv_mort_feature_validate( &f, gxvalid ); } if ( !IS_GXV_MORT_FEATURE_OFF( f ) ) FT_INVALID_DATA; - valid->subtable_length = p - table; + gxvalid->subtable_length = p - table; GXV_EXIT; } FT_LOCAL_DEF( void ) gxv_mort_coverage_validate( FT_UShort coverage, - GXV_Validator valid ) + GXV_Validator gxvalid ) { - FT_UNUSED( valid ); + FT_UNUSED( gxvalid ); +#ifdef FT_DEBUG_LEVEL_TRACE if ( coverage & 0x8000U ) GXV_TRACE(( " this subtable is for vertical text only\n" )); else @@ -144,6 +142,7 @@ if ( coverage & 0x1FF8 ) GXV_TRACE(( " coverage has non-zero bits in reserved area\n" )); +#endif } @@ -151,7 +150,7 @@ gxv_mort_subtables_validate( FT_Bytes table, FT_Bytes limit, FT_UShort nSubtables, - GXV_Validator valid ) + GXV_Validator gxvalid ) { FT_Bytes p = table; @@ -166,17 +165,20 @@ }; - GXV_Validate_Func func; - FT_UShort i; + FT_UShort i; GXV_NAME_ENTER( "subtables in a chain" ); for ( i = 0; i < nSubtables; i++ ) { + GXV_Validate_Func func; + FT_UShort length; FT_UShort coverage; +#ifdef GXV_LOAD_UNUSED_VARS FT_ULong subFeatureFlags; +#endif FT_UInt type; FT_UInt rest; @@ -184,7 +186,11 @@ GXV_LIMIT_CHECK( 2 + 2 + 4 ); length = FT_NEXT_USHORT( p ); coverage = FT_NEXT_USHORT( p ); +#ifdef GXV_LOAD_UNUSED_VARS subFeatureFlags = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif GXV_TRACE(( "validating chain subtable %d/%d (%d bytes)\n", i + 1, nSubtables, length )); @@ -192,7 +198,7 @@ rest = length - ( 2 + 2 + 4 ); GXV_LIMIT_CHECK( rest ); - gxv_mort_coverage_validate( coverage, valid ); + gxv_mort_coverage_validate( coverage, gxvalid ); if ( type > 5 ) FT_INVALID_FORMAT; @@ -201,12 +207,13 @@ if ( func == NULL ) GXV_TRACE(( "morx type %d is reserved\n", type )); - func( p, p + rest, valid ); + func( p, p + rest, gxvalid ); p += rest; + /* TODO: validate subFeatureFlags */ } - valid->subtable_length = p - table; + gxvalid->subtable_length = p - table; GXV_EXIT; } @@ -215,10 +222,12 @@ static void gxv_mort_chain_validate( FT_Bytes table, FT_Bytes limit, - GXV_Validator valid ) + GXV_Validator gxvalid ) { FT_Bytes p = table; +#ifdef GXV_LOAD_UNUSED_VARS FT_ULong defaultFlags; +#endif FT_ULong chainLength; FT_UShort nFeatureFlags; FT_UShort nSubtables; @@ -227,17 +236,22 @@ GXV_NAME_ENTER( "mort chain header" ); GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 ); +#ifdef GXV_LOAD_UNUSED_VARS defaultFlags = FT_NEXT_ULONG( p ); +#else + p += 4; +#endif chainLength = FT_NEXT_ULONG( p ); nFeatureFlags = FT_NEXT_USHORT( p ); nSubtables = FT_NEXT_USHORT( p ); gxv_mort_featurearray_validate( p, table + chainLength, - nFeatureFlags, valid ); - p += valid->subtable_length; - gxv_mort_subtables_validate( p, table + chainLength, nSubtables, valid ); - valid->subtable_length = chainLength; + nFeatureFlags, gxvalid ); + p += gxvalid->subtable_length; + gxv_mort_subtables_validate( p, table + chainLength, nSubtables, gxvalid ); + gxvalid->subtable_length = chainLength; + /* TODO: validate defaultFlags */ GXV_EXIT; } @@ -247,8 +261,8 @@ FT_Face face, FT_Validator ftvalid ) { - GXV_ValidatorRec validrec; - GXV_Validator valid = &validrec; + GXV_ValidatorRec gxvalidrec; + GXV_Validator gxvalid = &gxvalidrec; FT_Bytes p = table; FT_Bytes limit = 0; FT_ULong version; @@ -256,9 +270,9 @@ FT_ULong i; - valid->root = ftvalid; - valid->face = face; - limit = valid->root->limit; + gxvalid->root = ftvalid; + gxvalid->face = face; + limit = gxvalid->root->limit; FT_TRACE3(( "validating `mort' table\n" )); GXV_INIT; @@ -274,8 +288,8 @@ { 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; + gxv_mort_chain_validate( p, limit, gxvalid ); + p += gxvalid->subtable_length; } FT_TRACE4(( "\n" )); |