Simplify unions
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index fbbcea2..bbb0dca 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -310,9 +310,9 @@
{
*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 @@
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 @@
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 @@
{
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 @@
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 @@
private:
union {
USHORT format; /* Format identifier */
- SinglePosFormat1 format1[VAR];
- SinglePosFormat2 format2[VAR];
+ SinglePosFormat1 format1;
+ SinglePosFormat2 format2;
} u;
};
@@ -771,8 +771,8 @@
{
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 @@
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 @@
private:
union {
USHORT format; /* Format identifier */
- PairPosFormat1 format1[VAR];
- PairPosFormat2 format2[VAR];
+ PairPosFormat1 format1;
+ PairPosFormat2 format2;
} u;
};
@@ -1026,7 +1026,7 @@
{
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 @@
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 @@
private:
union {
USHORT format; /* Format identifier */
- CursivePosFormat1 format1[VAR];
+ CursivePosFormat1 format1;
} u;
};
@@ -1123,7 +1123,7 @@
{
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 @@
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 @@
private:
union {
USHORT format; /* Format identifier */
- MarkBasePosFormat1 format1[VAR];
+ MarkBasePosFormat1 format1;
} u;
};
@@ -1247,7 +1247,7 @@
{
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 @@
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 @@
private:
union {
USHORT format; /* Format identifier */
- MarkLigPosFormat1 format1[VAR];
+ MarkLigPosFormat1 format1;
} u;
};
@@ -1352,7 +1352,7 @@
{
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 @@
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 @@
private:
union {
USHORT format; /* Format identifier */
- MarkMarkPosFormat1 format1[VAR];
+ MarkMarkPosFormat1 format1;
} u;
};
@@ -1445,15 +1445,15 @@
{
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 @@
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 @@
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);