From ec8d2494694275dfbbac2dd0d33ca2894b0463d6 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 24 Jul 2012 15:40:37 -0400 Subject: [PATCH] Make data members of various OpenType structs protected instead of private Should fix warnings generated when building with -Wunused-private-field. Based on patch from Jonathan Kew. --- src/hb-open-file-private.hh | 8 ++--- src/hb-ot-head-table.hh | 2 +- src/hb-ot-hhea-table.hh | 2 +- src/hb-ot-hmtx-table.hh | 2 +- src/hb-ot-layout-common-private.hh | 14 ++++---- src/hb-ot-layout-gdef-table.hh | 20 ++++++------ src/hb-ot-layout-gpos-table.hh | 48 ++++++++++++++-------------- src/hb-ot-layout-gsub-table.hh | 30 ++++++++--------- src/hb-ot-layout-gsubgpos-private.hh | 32 +++++++++---------- src/hb-ot-maxp-table.hh | 2 +- src/hb-ot-name-table.hh | 2 +- 11 files changed, 82 insertions(+), 80 deletions(-) diff --git a/src/hb-open-file-private.hh b/src/hb-open-file-private.hh index ce18580f0..e2d4a2c23 100644 --- a/src/hb-open-file-private.hh +++ b/src/hb-open-file-private.hh @@ -105,7 +105,7 @@ typedef struct OffsetTable return TRACE_RETURN (c->check_struct (this) && c->check_array (tables, TableRecord::static_size, numTables)); } - private: + protected: Tag sfnt_version; /* '\0\001\0\00' if TrueType / 'OTTO' if CFF */ USHORT numTables; /* Number of tables. */ USHORT searchRange; /* (Maximum power of 2 <= numTables) x 16 */ @@ -133,7 +133,7 @@ struct TTCHeaderVersion1 return TRACE_RETURN (table.sanitize (c, this)); } - private: + protected: Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ FixedVersion version; /* Version of the TTC Header (1.0), * 0x00010000 */ @@ -177,7 +177,7 @@ struct TTCHeader } } - private: + protected: union { struct { Tag ttcTag; /* TrueType Collection ID string: 'ttcf' */ @@ -242,7 +242,7 @@ struct OpenTypeFontFile } } - private: + protected: union { Tag tag; /* 4-byte identifier. */ OpenTypeFontFace fontFace; diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh index 32d64ca96..bf2d2452b 100644 --- a/src/hb-ot-head-table.hh +++ b/src/hb-ot-head-table.hh @@ -54,7 +54,7 @@ struct head return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); } - private: + protected: FixedVersion version; /* Version of the head table--currently * 0x00010000 for version 1.0. */ FixedVersion fontRevision; /* Set by font manufacturer. */ diff --git a/src/hb-ot-hhea-table.hh b/src/hb-ot-hhea-table.hh index 2eea05ac6..24f8bdcfd 100644 --- a/src/hb-ot-hhea-table.hh +++ b/src/hb-ot-hhea-table.hh @@ -47,7 +47,7 @@ struct hhea return TRACE_RETURN (c->check_struct (this) && likely (version.major == 1)); } - private: + protected: FixedVersion version; /* 0x00010000 for version 1.0. */ FWORD ascender; /* Typographic ascent. diff --git a/src/hb-ot-hmtx-table.hh b/src/hb-ot-hmtx-table.hh index 35cfb48c7..cc7cfbb96 100644 --- a/src/hb-ot-hmtx-table.hh +++ b/src/hb-ot-hmtx-table.hh @@ -57,7 +57,7 @@ struct hmtx return TRACE_RETURN (true); } - private: + protected: LongHorMetric longHorMetric[VAR]; /* Paired advance width and left side * bearing values for each glyph. The * value numOfHMetrics comes from diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index a990b1556..c7e458f2c 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -231,7 +231,7 @@ struct Script return TRACE_RETURN (defaultLangSys.sanitize (c, this) && langSys.sanitize (c, this)); } - private: + protected: OffsetTo defaultLangSys; /* Offset to DefaultLangSys table--from * beginning of Script table--may be Null */ @@ -379,7 +379,7 @@ struct CoverageFormat1 unsigned int i; }; - private: + protected: USHORT coverageFormat; /* Format identifier--format = 1 */ SortedArrayOf glyphArray; /* Array of GlyphIDs--in numerical order */ @@ -454,7 +454,7 @@ struct CoverageFormat2 unsigned int i, j, coverage; }; - private: + protected: USHORT coverageFormat; /* Format identifier--format = 2 */ SortedArrayOf rangeRecord; /* Array of glyph ranges--ordered by @@ -560,7 +560,7 @@ struct Coverage } u; }; - private: + protected: union { USHORT format; /* Format identifier */ CoverageFormat1 format1; @@ -600,6 +600,7 @@ struct ClassDefFormat1 return false; } + protected: USHORT classFormat; /* Format identifier--format = 1 */ GlyphID startGlyph; /* First GlyphID of the classValueArray */ ArrayOf @@ -634,6 +635,7 @@ struct ClassDefFormat2 return false; } + protected: USHORT classFormat; /* Format identifier--format = 2 */ SortedArrayOf rangeRecord; /* Array of glyph ranges--ordered by @@ -673,7 +675,7 @@ struct ClassDef } } - private: + protected: union { USHORT format; /* Format identifier */ ClassDefFormat1 format1; @@ -744,7 +746,7 @@ struct Device return TRACE_RETURN (c->check_struct (this) && c->check_range (this, this->get_size ())); } - private: + protected: USHORT startSize; /* Smallest size to correct--in ppem */ USHORT endSize; /* Largest size to correct--in ppem */ USHORT deltaFormat; /* Format of DeltaValue array data: 1, 2, or 3 diff --git a/src/hb-ot-layout-gdef-table.hh b/src/hb-ot-layout-gdef-table.hh index f29fc14d8..54149d794 100644 --- a/src/hb-ot-layout-gdef-table.hh +++ b/src/hb-ot-layout-gdef-table.hh @@ -74,7 +74,7 @@ struct AttachList return TRACE_RETURN (coverage.sanitize (c, this) && attachPoint.sanitize (c, this)); } - private: + protected: OffsetTo coverage; /* Offset to Coverage table -- from * beginning of AttachList table */ @@ -104,7 +104,7 @@ struct CaretValueFormat1 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT caretValueFormat; /* Format identifier--format = 1 */ SHORT coordinate; /* X or Y value, in design units */ public: @@ -130,7 +130,7 @@ struct CaretValueFormat2 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT caretValueFormat; /* Format identifier--format = 2 */ USHORT caretValuePoint; /* Contour point index on glyph */ public: @@ -153,7 +153,7 @@ struct CaretValueFormat3 return TRACE_RETURN (c->check_struct (this) && deviceTable.sanitize (c, this)); } - private: + protected: USHORT caretValueFormat; /* Format identifier--format = 3 */ SHORT coordinate; /* X or Y value, in design units */ OffsetTo @@ -187,7 +187,7 @@ struct CaretValue } } - private: + protected: union { USHORT format; /* Format identifier */ CaretValueFormat1 format1; @@ -222,7 +222,7 @@ struct LigGlyph return TRACE_RETURN (carets.sanitize (c, this)); } - private: + protected: OffsetArrayOf carets; /* Offset array of CaretValue tables * --from beginning of LigGlyph table @@ -256,7 +256,7 @@ struct LigCaretList return TRACE_RETURN (coverage.sanitize (c, this) && ligGlyph.sanitize (c, this)); } - private: + protected: OffsetTo coverage; /* Offset to Coverage table--from * beginning of LigCaretList table */ @@ -278,7 +278,7 @@ struct MarkGlyphSetsFormat1 return TRACE_RETURN (coverage.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ LongOffsetArrayOf coverage; /* Array of long offsets to mark set @@ -306,7 +306,7 @@ struct MarkGlyphSets } } - private: + protected: union { USHORT format; /* Format identifier */ MarkGlyphSetsFormat1 format1; @@ -392,7 +392,7 @@ struct GDEF } - private: + protected: FixedVersion version; /* Version of the GDEF table--currently * 0x00010002 */ OffsetTo diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 9eadbd63a..e95aa3ebb 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -225,7 +225,7 @@ struct AnchorFormat1 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ SHORT xCoordinate; /* Horizontal value--in design units */ SHORT yCoordinate; /* Vertical value--in design units */ @@ -257,7 +257,7 @@ struct AnchorFormat2 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ SHORT xCoordinate; /* Horizontal value--in design units */ SHORT yCoordinate; /* Vertical value--in design units */ @@ -288,7 +288,7 @@ struct AnchorFormat3 return TRACE_RETURN (c->check_struct (this) && xDeviceTable.sanitize (c, this) && yDeviceTable.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 3 */ SHORT xCoordinate; /* Horizontal value--in design units */ SHORT yCoordinate; /* Vertical value--in design units */ @@ -329,7 +329,7 @@ struct Anchor } } - private: + protected: union { USHORT format; /* Format identifier */ AnchorFormat1 format1; @@ -360,7 +360,7 @@ struct AnchorMatrix } USHORT rows; /* Number of rows */ - private: + protected: OffsetTo matrix[VAR]; /* Matrix of offsets to Anchor tables-- * from beginning of AnchorMatrix table */ @@ -378,7 +378,7 @@ struct MarkRecord return TRACE_RETURN (c->check_struct (this) && markAnchor.sanitize (c, base)); } - private: + protected: USHORT klass; /* Class defined for this mark */ OffsetTo markAnchor; /* Offset to Anchor table--from @@ -447,7 +447,7 @@ struct SinglePosFormat1 return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && valueFormat.sanitize_value (c, this, values)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -487,7 +487,7 @@ struct SinglePosFormat2 return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && valueFormat.sanitize_values (c, this, values, valueCount)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -526,7 +526,7 @@ struct SinglePos } } - private: + protected: union { USHORT format; /* Format identifier */ SinglePosFormat1 format1; @@ -539,7 +539,7 @@ struct PairValueRecord { friend struct PairSet; - private: + protected: GlyphID secondGlyph; /* GlyphID of second glyph in the * pair--first glyph is listed in the * Coverage table */ @@ -601,7 +601,7 @@ struct PairSet && closure->valueFormats[1].sanitize_values_stride_unsafe (c, closure->base, &record->values[closure->len1], count, closure->stride)); } - private: + protected: USHORT len; /* Number of PairValueRecords */ USHORT array[VAR]; /* Array of PairValueRecords--ordered * by GlyphID of the second glyph */ @@ -643,7 +643,7 @@ struct PairPosFormat1 return TRACE_RETURN (c->check_struct (this) && coverage.sanitize (c, this) && pairSet.sanitize (c, this, &closure)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -715,7 +715,7 @@ struct PairPosFormat2 valueFormat2.sanitize_values_stride_unsafe (c, this, &values[len1], count, stride)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -770,7 +770,7 @@ struct PairPos } } - private: + protected: union { USHORT format; /* Format identifier */ PairPosFormat1 format1; @@ -788,7 +788,7 @@ struct EntryExitRecord return TRACE_RETURN (entryAnchor.sanitize (c, base) && exitAnchor.sanitize (c, base)); } - private: + protected: OffsetTo entryAnchor; /* Offset to EntryAnchor table--from * beginning of CursivePos @@ -893,7 +893,7 @@ struct CursivePosFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && entryExitRecord.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -928,7 +928,7 @@ struct CursivePos } } - private: + protected: union { USHORT format; /* Format identifier */ CursivePosFormat1 format1; @@ -977,7 +977,7 @@ struct MarkBasePosFormat1 markArray.sanitize (c, this) && baseArray.sanitize (c, this, (unsigned int) classCount)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo markCoverage; /* Offset to MarkCoverage table--from @@ -1019,7 +1019,7 @@ struct MarkBasePos } } - private: + protected: union { USHORT format; /* Format identifier */ MarkBasePosFormat1 format1; @@ -1092,7 +1092,7 @@ struct MarkLigPosFormat1 markArray.sanitize (c, this) && ligatureArray.sanitize (c, this, (unsigned int) classCount)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo markCoverage; /* Offset to Mark Coverage table--from @@ -1135,7 +1135,7 @@ struct MarkLigPos } } - private: + protected: union { USHORT format; /* Format identifier */ MarkLigPosFormat1 format1; @@ -1189,7 +1189,7 @@ struct MarkMarkPosFormat1 && mark2Array.sanitize (c, this, (unsigned int) classCount)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo mark1Coverage; /* Offset to Combining Mark1 Coverage @@ -1233,7 +1233,7 @@ struct MarkMarkPos } } - private: + protected: union { USHORT format; /* Format identifier */ MarkMarkPosFormat1 format1; @@ -1359,7 +1359,7 @@ struct PosLookupSubTable } } - private: + protected: union { struct { USHORT sub_format; diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 007d21cda..600a92a5e 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -75,7 +75,7 @@ struct SingleSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && deltaGlyphID.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -127,7 +127,7 @@ struct SingleSubstFormat2 return TRACE_RETURN (coverage.sanitize (c, this) && substitute.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -184,7 +184,7 @@ struct SingleSubst } } - private: + protected: union { USHORT format; /* Format identifier */ SingleSubstFormat1 format1; @@ -229,7 +229,7 @@ struct Sequence return TRACE_RETURN (substitute.sanitize (c)); } - private: + protected: ArrayOf substitute; /* String of GlyphIDs to substitute */ public: @@ -272,7 +272,7 @@ struct MultipleSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && sequence.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -325,7 +325,7 @@ struct MultipleSubst } } - private: + protected: union { USHORT format; /* Format identifier */ MultipleSubstFormat1 format1; @@ -394,7 +394,7 @@ struct AlternateSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && alternateSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -447,7 +447,7 @@ struct AlternateSubst } } - private: + protected: union { USHORT format; /* Format identifier */ AlternateSubstFormat1 format1; @@ -544,7 +544,7 @@ struct Ligature return TRACE_RETURN (ligGlyph.sanitize (c) && component.sanitize (c)); } - private: + protected: GlyphID ligGlyph; /* GlyphID of ligature to substitute */ HeadlessArrayOf component; /* Array of component GlyphIDs--start @@ -599,7 +599,7 @@ struct LigatureSet return TRACE_RETURN (ligature.sanitize (c, this)); } - private: + protected: OffsetArrayOf ligature; /* Array LigatureSet tables * ordered by preference */ @@ -647,7 +647,7 @@ struct LigatureSubstFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && ligatureSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -700,7 +700,7 @@ struct LigatureSubst } } - private: + protected: union { USHORT format; /* Format identifier */ LigatureSubstFormat1 format1; @@ -844,7 +844,7 @@ struct ReverseChainSingleSubstFormat1 return TRACE_RETURN (substitute.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -897,7 +897,7 @@ struct ReverseChainSingleSubst } } - private: + protected: union { USHORT format; /* Format identifier */ ReverseChainSingleSubstFormat1 format1; @@ -1013,7 +1013,7 @@ struct SubstLookupSubTable } } - private: + protected: union { struct { USHORT sub_format; diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index d50c65366..14d36b083 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -167,7 +167,7 @@ struct hb_apply_context_t } unsigned int idx; - private: + protected: hb_apply_context_t *c; unsigned int num_items; hb_mask_t mask; @@ -216,7 +216,7 @@ struct hb_apply_context_t } unsigned int idx; - private: + protected: hb_apply_context_t *c; unsigned int num_items; hb_mask_t mask; @@ -588,7 +588,7 @@ struct Rule + lookupRecordX[0].static_size * lookupCount); } - private: + protected: USHORT inputCount; /* Total number of glyphs in input * glyph sequence--includes the first * glyph */ @@ -640,7 +640,7 @@ struct RuleSet return TRACE_RETURN (rule.sanitize (c, this)); } - private: + protected: OffsetArrayOf rule; /* Array of Rule tables * ordered by preference */ @@ -709,7 +709,7 @@ struct ContextFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -786,7 +786,7 @@ struct ContextFormat2 return TRACE_RETURN (coverage.sanitize (c, this) && classDef.sanitize (c, this) && ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -864,7 +864,7 @@ struct ContextFormat3 return TRACE_RETURN (c->check_array (lookupRecord, lookupRecord[0].static_size, lookupCount)); } - private: + protected: USHORT format; /* Format identifier--format = 3 */ USHORT glyphCount; /* Number of glyphs in the input glyph * sequence */ @@ -925,7 +925,7 @@ struct Context } } - private: + protected: union { USHORT format; /* Format identifier */ ContextFormat1 format1; @@ -1079,7 +1079,7 @@ struct ChainRule return TRACE_RETURN (lookup.sanitize (c)); } - private: + protected: ArrayOf backtrack; /* Array of backtracking values * (to be matched before the input @@ -1134,7 +1134,7 @@ struct ChainRuleSet return TRACE_RETURN (rule.sanitize (c, this)); } - private: + protected: OffsetArrayOf rule; /* Array of ChainRule tables * ordered by preference */ @@ -1199,7 +1199,7 @@ struct ChainContextFormat1 return TRACE_RETURN (coverage.sanitize (c, this) && ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 1 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -1287,7 +1287,7 @@ struct ChainContextFormat2 ruleSet.sanitize (c, this)); } - private: + protected: USHORT format; /* Format identifier--format = 2 */ OffsetTo coverage; /* Offset to Coverage table--from @@ -1392,7 +1392,7 @@ struct ChainContextFormat3 return TRACE_RETURN (lookup.sanitize (c)); } - private: + protected: USHORT format; /* Format identifier--format = 3 */ OffsetArrayOf backtrack; /* Array of coverage tables @@ -1460,7 +1460,7 @@ struct ChainContext } } - private: + protected: union { USHORT format; /* Format identifier */ ChainContextFormat1 format1; @@ -1483,7 +1483,7 @@ struct ExtensionFormat1 return TRACE_RETURN (c->check_struct (this)); } - private: + protected: USHORT format; /* Format identifier. Set to 1. */ USHORT extensionLookupType; /* Lookup type of subtable referenced * by ExtensionOffset (i.e. the @@ -1520,7 +1520,7 @@ struct Extension } } - private: + protected: union { USHORT format; /* Format identifier */ ExtensionFormat1 format1; diff --git a/src/hb-ot-maxp-table.hh b/src/hb-ot-maxp-table.hh index e27049001..c2c90d1ff 100644 --- a/src/hb-ot-maxp-table.hh +++ b/src/hb-ot-maxp-table.hh @@ -52,7 +52,7 @@ struct maxp } /* We only implement version 0.5 as none of the extra fields in version 1.0 are useful. */ - private: + protected: FixedVersion version; /* Version of the maxp table (0.5 or 1.0), * 0x00005000 or 0x00010000. */ USHORT numGlyphs; /* The number of glyphs in the font. */ diff --git a/src/hb-ot-name-table.hh b/src/hb-ot-name-table.hh index 9077c8c67..e0d2e8997 100644 --- a/src/hb-ot-name-table.hh +++ b/src/hb-ot-name-table.hh @@ -114,7 +114,7 @@ struct name } /* We only implement format 0 for now. */ - private: + protected: USHORT format; /* Format selector (=0/1). */ USHORT count; /* Number of name records. */ Offset stringOffset; /* Offset to start of string storage (from start of table). */