Simplify unions
authorBehdad Esfahbod <behdad@behdad.org>
Mon, 10 May 2010 23:45:41 +0000 (19:45 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Mon, 10 May 2010 23:45:41 +0000 (19:45 -0400)
src/hb-open-file-private.hh
src/hb-ot-layout-common-private.hh
src/hb-ot-layout-gdef-private.hh
src/hb-ot-layout-gpos-private.hh
src/hb-ot-layout-gsub-private.hh
src/hb-ot-layout-gsubgpos-private.hh

index f9fede3..066c3b2 100644 (file)
@@ -153,7 +153,7 @@ struct TTCHeader
   {
     switch (u.header.version) {
     case 2: /* version 2 is compatible with version 1 */
-    case 1: return u.version1->get_face_count ();
+    case 1: return u.version1.get_face_count ();
     default:return 0;
     }
   }
@@ -161,7 +161,7 @@ struct TTCHeader
   {
     switch (u.header.version) {
     case 2: /* version 2 is compatible with version 1 */
-    case 1: return u.version1->get_face (i);
+    case 1: return u.version1.get_face (i);
     default:return Null(OpenTypeFontFace);
     }
   }
@@ -171,7 +171,7 @@ struct TTCHeader
     if (!u.header.version.sanitize (context)) return false;
     switch (u.header.version) {
     case 2: /* version 2 is compatible with version 1 */
-    case 1: return u.version1->sanitize (context);
+    case 1: return u.version1.sanitize (context);
     default:return true;
     }
   }
@@ -183,7 +183,7 @@ struct TTCHeader
   FixedVersion version;        /* Version of the TTC Header (1.0 or 2.0),
                                 * 0x00010000 or 0x00020000 */
   }                    header;
-  TTCHeaderVersion1    version1[VAR];
+  TTCHeaderVersion1    version1;
   } u;
 };
 
@@ -209,7 +209,7 @@ struct OpenTypeFontFile
     case TrueTag:
     case Typ1Tag:
     case TrueTypeTag:  return 1;
-    case TTCTag:       return u.ttcHeader->get_face_count ();
+    case TTCTag:       return u.ttcHeader.get_face_count ();
     default:           return 0;
     }
   }
@@ -222,8 +222,8 @@ struct OpenTypeFontFile
     case CFFTag:       /* All the non-collection tags */
     case TrueTag:
     case Typ1Tag:
-    case TrueTypeTag:  return u.fontFace[0];
-    case TTCTag:       return u.ttcHeader->get_face (i);
+    case TrueTypeTag:  return u.fontFace;
+    case TTCTag:       return u.ttcHeader.get_face (i);
     default:           return Null(OpenTypeFontFace);
     }
   }
@@ -235,8 +235,8 @@ struct OpenTypeFontFile
     case CFFTag:       /* All the non-collection tags */
     case TrueTag:
     case Typ1Tag:
-    case TrueTypeTag:  return u.fontFace->sanitize (context);
-    case TTCTag:       return u.ttcHeader->sanitize (context);
+    case TrueTypeTag:  return u.fontFace.sanitize (context);
+    case TTCTag:       return u.ttcHeader.sanitize (context);
     default:           return true;
     }
   }
@@ -244,9 +244,11 @@ struct OpenTypeFontFile
   private:
   union {
   Tag                  tag;            /* 4-byte identifier. */
-  OpenTypeFontFace     fontFace[VAR];
-  TTCHeader            ttcHeader[VAR];
+  OpenTypeFontFace     fontFace;
+  TTCHeader            ttcHeader;
   } u;
+  public:
+  DEFINE_SIZE_UNION (4, tag);
 };
 
 
index 7fadc2d..e5ecc8f 100644 (file)
@@ -420,8 +420,8 @@ struct Coverage
   inline unsigned int get_coverage (hb_codepoint_t glyph_id) const
   {
     switch (u.format) {
-    case 1: return u.format1->get_coverage(glyph_id);
-    case 2: return u.format2->get_coverage(glyph_id);
+    case 1: return u.format1.get_coverage(glyph_id);
+    case 2: return u.format2.get_coverage(glyph_id);
     default:return NOT_COVERED;
     }
   }
@@ -430,8 +430,8 @@ struct Coverage
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
     default:return true;
     }
   }
@@ -439,8 +439,8 @@ struct Coverage
   private:
   union {
   USHORT               format;         /* Format identifier */
-  CoverageFormat1      format1[VAR];
-  CoverageFormat2      format2[VAR];
+  CoverageFormat1      format1;
+  CoverageFormat2      format2;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
@@ -542,8 +542,8 @@ struct ClassDef
   inline hb_ot_layout_class_t get_class (hb_codepoint_t glyph_id) const
   {
     switch (u.format) {
-    case 1: return u.format1->get_class(glyph_id);
-    case 2: return u.format2->get_class(glyph_id);
+    case 1: return u.format1.get_class(glyph_id);
+    case 2: return u.format2.get_class(glyph_id);
     default:return 0;
     }
   }
@@ -552,8 +552,8 @@ struct ClassDef
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
     default:return true;
     }
   }
@@ -561,8 +561,8 @@ struct ClassDef
   private:
   union {
   USHORT               format;         /* Format identifier */
-  ClassDefFormat1      format1[VAR];
-  ClassDefFormat2      format2[VAR];
+  ClassDefFormat1      format1;
+  ClassDefFormat2      format2;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
index cfad57a..517f9ef 100644 (file)
@@ -170,9 +170,9 @@ struct CaretValue
   inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
   {
     switch (u.format) {
-    case 1: return u.format1->get_caret_value (context, glyph_id);
-    case 2: return u.format2->get_caret_value (context, glyph_id);
-    case 3: return u.format3->get_caret_value (context, glyph_id);
+    case 1: return u.format1.get_caret_value (context, glyph_id);
+    case 2: return u.format2.get_caret_value (context, glyph_id);
+    case 3: return u.format3.get_caret_value (context, glyph_id);
     default:return 0;
     }
   }
@@ -181,9 +181,9 @@ struct CaretValue
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
-    case 3: return u.format3->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
+    case 3: return u.format3.sanitize (context);
     default:return true;
     }
   }
@@ -191,9 +191,9 @@ struct CaretValue
   private:
   union {
   USHORT               format;         /* Format identifier */
-  CaretValueFormat1    format1[VAR];
-  CaretValueFormat2    format2[VAR];
-  CaretValueFormat3    format3[VAR];
+  CaretValueFormat1    format1;
+  CaretValueFormat2    format2;
+  CaretValueFormat3    format3;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
@@ -292,7 +292,7 @@ struct MarkGlyphSets
   inline bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
   {
     switch (u.format) {
-    case 1: return u.format1->covers (set_index, glyph_id);
+    case 1: return u.format1.covers (set_index, glyph_id);
     default:return false;
     }
   }
@@ -301,7 +301,7 @@ struct MarkGlyphSets
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -309,7 +309,7 @@ struct MarkGlyphSets
   private:
   union {
   USHORT               format;         /* Format identifier */
-  MarkGlyphSetsFormat1 format1[VAR];
+  MarkGlyphSetsFormat1 format1;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
index fbbcea2..bbb0dca 100644 (file)
@@ -310,9 +310,9 @@ struct Anchor
   {
     *x = *y = 0;
     switch (u.format) {
-    case 1: u.format1->get_anchor (layout, glyph_id, x, y); return;
-    case 2: u.format2->get_anchor (layout, glyph_id, x, y); return;
-    case 3: u.format3->get_anchor (layout, glyph_id, x, y); return;
+    case 1: u.format1.get_anchor (layout, glyph_id, x, y); return;
+    case 2: u.format2.get_anchor (layout, glyph_id, x, y); return;
+    case 3: u.format3.get_anchor (layout, glyph_id, x, y); return;
     default:                                               return;
     }
   }
@@ -321,9 +321,9 @@ struct Anchor
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
-    case 3: return u.format3->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
+    case 3: return u.format3.sanitize (context);
     default:return true;
     }
   }
@@ -331,9 +331,9 @@ struct Anchor
   private:
   union {
   USHORT               format;         /* Format identifier */
-  AnchorFormat1                format1[VAR];
-  AnchorFormat2                format2[VAR];
-  AnchorFormat3                format3[VAR];
+  AnchorFormat1                format1;
+  AnchorFormat2                format2;
+  AnchorFormat3                format3;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
@@ -518,8 +518,8 @@ struct SinglePos
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
-    case 2: return u.format2->apply (context);
+    case 1: return u.format1.apply (context);
+    case 2: return u.format2.apply (context);
     default:return false;
     }
   }
@@ -528,8 +528,8 @@ struct SinglePos
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
     default:return true;
     }
   }
@@ -537,8 +537,8 @@ struct SinglePos
   private:
   union {
   USHORT               format;         /* Format identifier */
-  SinglePosFormat1     format1[VAR];
-  SinglePosFormat2     format2[VAR];
+  SinglePosFormat1     format1;
+  SinglePosFormat2     format2;
   } u;
 };
 
@@ -771,8 +771,8 @@ struct PairPos
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
-    case 2: return u.format2->apply (context);
+    case 1: return u.format1.apply (context);
+    case 2: return u.format2.apply (context);
     default:return false;
     }
   }
@@ -781,8 +781,8 @@ struct PairPos
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
     default:return true;
     }
   }
@@ -790,8 +790,8 @@ struct PairPos
   private:
   union {
   USHORT               format;         /* Format identifier */
-  PairPosFormat1       format1[VAR];
-  PairPosFormat2       format2[VAR];
+  PairPosFormat1       format1;
+  PairPosFormat2       format2;
   } u;
 };
 
@@ -1026,7 +1026,7 @@ struct CursivePos
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -1035,7 +1035,7 @@ struct CursivePos
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -1043,7 +1043,7 @@ struct CursivePos
   private:
   union {
   USHORT               format;         /* Format identifier */
-  CursivePosFormat1    format1[VAR];
+  CursivePosFormat1    format1;
   } u;
 };
 
@@ -1123,7 +1123,7 @@ struct MarkBasePos
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -1132,7 +1132,7 @@ struct MarkBasePos
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -1140,7 +1140,7 @@ struct MarkBasePos
   private:
   union {
   USHORT               format;         /* Format identifier */
-  MarkBasePosFormat1   format1[VAR];
+  MarkBasePosFormat1   format1;
   } u;
 };
 
@@ -1247,7 +1247,7 @@ struct MarkLigPos
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -1256,7 +1256,7 @@ struct MarkLigPos
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -1264,7 +1264,7 @@ struct MarkLigPos
   private:
   union {
   USHORT               format;         /* Format identifier */
-  MarkLigPosFormat1    format1[VAR];
+  MarkLigPosFormat1    format1;
   } u;
 };
 
@@ -1352,7 +1352,7 @@ struct MarkMarkPos
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -1361,7 +1361,7 @@ struct MarkMarkPos
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -1369,7 +1369,7 @@ struct MarkMarkPos
   private:
   union {
   USHORT               format;         /* Format identifier */
-  MarkMarkPosFormat1   format1[VAR];
+  MarkMarkPosFormat1   format1;
   } u;
 };
 
@@ -1445,15 +1445,15 @@ struct PosLookupSubTable
   {
     TRACE_APPLY ();
     switch (lookup_type) {
-    case Single:               return u.single->apply (context);
-    case Pair:                 return u.pair->apply (context);
-    case Cursive:              return u.cursive->apply (context);
-    case MarkBase:             return u.markBase->apply (context);
-    case MarkLig:              return u.markLig->apply (context);
-    case MarkMark:             return u.markMark->apply (context);
-    case Context:              return u.context->apply (context);
-    case ChainContext:         return u.chainContext->apply (context);
-    case Extension:            return u.extension->apply (context);
+    case Single:               return u.single.apply (context);
+    case Pair:                 return u.pair.apply (context);
+    case Cursive:              return u.cursive.apply (context);
+    case MarkBase:             return u.markBase.apply (context);
+    case MarkLig:              return u.markLig.apply (context);
+    case MarkMark:             return u.markMark.apply (context);
+    case Context:              return u.context.apply (context);
+    case ChainContext:         return u.chainContext.apply (context);
+    case Extension:            return u.extension.apply (context);
     default:return false;
     }
   }
@@ -1462,15 +1462,15 @@ struct PosLookupSubTable
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case Single:               return u.single->sanitize (context);
-    case Pair:                 return u.pair->sanitize (context);
-    case Cursive:              return u.cursive->sanitize (context);
-    case MarkBase:             return u.markBase->sanitize (context);
-    case MarkLig:              return u.markLig->sanitize (context);
-    case MarkMark:             return u.markMark->sanitize (context);
-    case Context:              return u.context->sanitize (context);
-    case ChainContext:         return u.chainContext->sanitize (context);
-    case Extension:            return u.extension->sanitize (context);
+    case Single:               return u.single.sanitize (context);
+    case Pair:                 return u.pair.sanitize (context);
+    case Cursive:              return u.cursive.sanitize (context);
+    case MarkBase:             return u.markBase.sanitize (context);
+    case MarkLig:              return u.markLig.sanitize (context);
+    case MarkMark:             return u.markMark.sanitize (context);
+    case Context:              return u.context.sanitize (context);
+    case ChainContext:         return u.chainContext.sanitize (context);
+    case Extension:            return u.extension.sanitize (context);
     default:return true;
     }
   }
@@ -1478,15 +1478,15 @@ struct PosLookupSubTable
   private:
   union {
   USHORT               format;
-  SinglePos            single[VAR];
-  PairPos              pair[VAR];
-  CursivePos           cursive[VAR];
-  MarkBasePos          markBase[VAR];
-  MarkLigPos           markLig[VAR];
-  MarkMarkPos          markMark[VAR];
-  ContextPos           context[VAR];
-  ChainContextPos      chainContext[VAR];
-  ExtensionPos         extension[VAR];
+  SinglePos            single;
+  PairPos              pair;
+  CursivePos           cursive;
+  MarkBasePos          markBase;
+  MarkLigPos           markLig;
+  MarkMarkPos          markMark;
+  ContextPos           context;
+  ChainContextPos      chainContext;
+  ExtensionPos         extension;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
index 868503c..513913e 100644 (file)
@@ -130,8 +130,8 @@ struct SingleSubst
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
-    case 2: return u.format2->apply (context);
+    case 1: return u.format1.apply (context);
+    case 2: return u.format2.apply (context);
     default:return false;
     }
   }
@@ -140,8 +140,8 @@ struct SingleSubst
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
     default:return true;
     }
   }
@@ -149,8 +149,8 @@ struct SingleSubst
   private:
   union {
   USHORT               format;         /* Format identifier */
-  SingleSubstFormat1   format1[VAR];
-  SingleSubstFormat2   format2[VAR];
+  SingleSubstFormat1   format1;
+  SingleSubstFormat2   format2;
   } u;
 };
 
@@ -243,7 +243,7 @@ struct MultipleSubst
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -252,7 +252,7 @@ struct MultipleSubst
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -260,7 +260,7 @@ struct MultipleSubst
   private:
   union {
   USHORT               format;         /* Format identifier */
-  MultipleSubstFormat1 format1[VAR];
+  MultipleSubstFormat1 format1;
   } u;
 };
 
@@ -339,7 +339,7 @@ struct AlternateSubst
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -348,7 +348,7 @@ struct AlternateSubst
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -356,7 +356,7 @@ struct AlternateSubst
   private:
   union {
   USHORT               format;         /* Format identifier */
-  AlternateSubstFormat1        format1[VAR];
+  AlternateSubstFormat1        format1;
   } u;
 };
 
@@ -526,7 +526,7 @@ struct LigatureSubst
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -535,7 +535,7 @@ struct LigatureSubst
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -543,7 +543,7 @@ struct LigatureSubst
   private:
   union {
   USHORT               format;         /* Format identifier */
-  LigatureSubstFormat1 format1[VAR];
+  LigatureSubstFormat1 format1;
   } u;
 };
 
@@ -672,7 +672,7 @@ struct ReverseChainSingleSubst
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context);
+    case 1: return u.format1.apply (context);
     default:return false;
     }
   }
@@ -681,7 +681,7 @@ struct ReverseChainSingleSubst
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -689,7 +689,7 @@ struct ReverseChainSingleSubst
   private:
   union {
   USHORT                               format;         /* Format identifier */
-  ReverseChainSingleSubstFormat1       format1[VAR];
+  ReverseChainSingleSubstFormat1       format1;
   } u;
 };
 
@@ -718,14 +718,14 @@ struct SubstLookupSubTable
   {
     TRACE_APPLY ();
     switch (lookup_type) {
-    case Single:               return u.single->apply (context);
-    case Multiple:             return u.multiple->apply (context);
-    case Alternate:            return u.alternate->apply (context);
-    case Ligature:             return u.ligature->apply (context);
-    case Context:              return u.context->apply (context);
-    case ChainContext:         return u.chainContext->apply (context);
-    case Extension:            return u.extension->apply (context);
-    case ReverseChainSingle:   return u.reverseChainContextSingle->apply (context);
+    case Single:               return u.single.apply (context);
+    case Multiple:             return u.multiple.apply (context);
+    case Alternate:            return u.alternate.apply (context);
+    case Ligature:             return u.ligature.apply (context);
+    case Context:              return u.context.apply (context);
+    case ChainContext:         return u.chainContext.apply (context);
+    case Extension:            return u.extension.apply (context);
+    case ReverseChainSingle:   return u.reverseChainContextSingle.apply (context);
     default:return false;
     }
   }
@@ -734,14 +734,14 @@ struct SubstLookupSubTable
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case Single:               return u.single->sanitize (context);
-    case Multiple:             return u.multiple->sanitize (context);
-    case Alternate:            return u.alternate->sanitize (context);
-    case Ligature:             return u.ligature->sanitize (context);
-    case Context:              return u.context->sanitize (context);
-    case ChainContext:         return u.chainContext->sanitize (context);
-    case Extension:            return u.extension->sanitize (context);
-    case ReverseChainSingle:   return u.reverseChainContextSingle->sanitize (context);
+    case Single:               return u.single.sanitize (context);
+    case Multiple:             return u.multiple.sanitize (context);
+    case Alternate:            return u.alternate.sanitize (context);
+    case Ligature:             return u.ligature.sanitize (context);
+    case Context:              return u.context.sanitize (context);
+    case ChainContext:         return u.chainContext.sanitize (context);
+    case Extension:            return u.extension.sanitize (context);
+    case ReverseChainSingle:   return u.reverseChainContextSingle.sanitize (context);
     default:return true;
     }
   }
@@ -749,14 +749,14 @@ struct SubstLookupSubTable
   private:
   union {
   USHORT                       format;
-  SingleSubst                  single[VAR];
-  MultipleSubst                        multiple[VAR];
-  AlternateSubst               alternate[VAR];
-  LigatureSubst                        ligature[VAR];
-  ContextSubst                 context[VAR];
-  ChainContextSubst            chainContext[VAR];
-  ExtensionSubst               extension[VAR];
-  ReverseChainSingleSubst      reverseChainContextSingle[VAR];
+  SingleSubst                  single;
+  MultipleSubst                        multiple;
+  AlternateSubst               alternate;
+  LigatureSubst                        ligature;
+  ContextSubst                 context;
+  ChainContextSubst            chainContext;
+  ExtensionSubst               extension;
+  ReverseChainSingleSubst      reverseChainContextSingle;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
@@ -805,9 +805,9 @@ struct SubstLookup : Lookup
        * This is rather slow to do this here for every glyph,
        * but it's easiest, and who uses extension lookups anyway?!*/
       unsigned int count = get_subtable_count ();
-      unsigned int type = get_subtable(0).u.extension->get_type ();
+      unsigned int type = get_subtable(0).u.extension.get_type ();
       for (unsigned int i = 1; i < count; i++)
-        if (get_subtable(i).u.extension->get_type () != type)
+        if (get_subtable(i).u.extension.get_type () != type)
          return false;
     }
 
index 521d682..488ab1d 100644 (file)
@@ -477,9 +477,9 @@ struct Context
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context, apply_func);
-    case 2: return u.format2->apply (context, apply_func);
-    case 3: return u.format3->apply (context, apply_func);
+    case 1: return u.format1.apply (context, apply_func);
+    case 2: return u.format2.apply (context, apply_func);
+    case 3: return u.format3.apply (context, apply_func);
     default:return false;
     }
   }
@@ -488,9 +488,9 @@ struct Context
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
-    case 3: return u.format3->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
+    case 3: return u.format3.sanitize (context);
     default:return true;
     }
   }
@@ -498,9 +498,9 @@ struct Context
   private:
   union {
   USHORT               format;         /* Format identifier */
-  ContextFormat1       format1[VAR];
-  ContextFormat2       format2[VAR];
-  ContextFormat3       format3[VAR];
+  ContextFormat1       format1;
+  ContextFormat2       format2;
+  ContextFormat3       format3;
   } u;
 };
 
@@ -796,9 +796,9 @@ struct ChainContext
   {
     TRACE_APPLY ();
     switch (u.format) {
-    case 1: return u.format1->apply (context, apply_func);
-    case 2: return u.format2->apply (context, apply_func);
-    case 3: return u.format3->apply (context, apply_func);
+    case 1: return u.format1.apply (context, apply_func);
+    case 2: return u.format2.apply (context, apply_func);
+    case 3: return u.format3.apply (context, apply_func);
     default:return false;
     }
   }
@@ -807,9 +807,9 @@ struct ChainContext
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
-    case 2: return u.format2->sanitize (context);
-    case 3: return u.format3->sanitize (context);
+    case 1: return u.format1.sanitize (context);
+    case 2: return u.format2.sanitize (context);
+    case 3: return u.format3.sanitize (context);
     default:return true;
     }
   }
@@ -817,9 +817,9 @@ struct ChainContext
   private:
   union {
   USHORT               format; /* Format identifier */
-  ChainContextFormat1  format1[VAR];
-  ChainContextFormat2  format2[VAR];
-  ChainContextFormat3  format3[VAR];
+  ChainContextFormat1  format1;
+  ChainContextFormat2  format2;
+  ChainContextFormat3  format3;
   } u;
 };
 
@@ -853,14 +853,14 @@ struct Extension
   inline unsigned int get_type (void) const
   {
     switch (u.format) {
-    case 1: return u.format1->get_type ();
+    case 1: return u.format1.get_type ();
     default:return 0;
     }
   }
   inline unsigned int get_offset (void) const
   {
     switch (u.format) {
-    case 1: return u.format1->get_offset ();
+    case 1: return u.format1.get_offset ();
     default:return 0;
     }
   }
@@ -869,7 +869,7 @@ struct Extension
     TRACE_SANITIZE ();
     if (!u.format.sanitize (context)) return false;
     switch (u.format) {
-    case 1: return u.format1->sanitize (context);
+    case 1: return u.format1.sanitize (context);
     default:return true;
     }
   }
@@ -877,7 +877,7 @@ struct Extension
   private:
   union {
   USHORT               format;         /* Format identifier */
-  ExtensionFormat1     format1[VAR];
+  ExtensionFormat1     format1;
   } u;
 };