From fe9bc070e1d545b0df2ea548eebf5a1fc4c92ddc Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 10 May 2010 21:39:24 -0400 Subject: [PATCH] Fix awful confusion between lookup format and subtable format As reported by John Daggett. --- src/hb-ot-layout-gpos-private.hh | 14 +++++++------- src/hb-ot-layout-gsub-private.hh | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh index bbb0dca6c..c8148937a 100644 --- a/src/hb-ot-layout-gpos-private.hh +++ b/src/hb-ot-layout-gpos-private.hh @@ -1458,10 +1458,10 @@ struct PosLookupSubTable } } - inline bool sanitize (hb_sanitize_context_t *context) { + inline bool sanitize (hb_sanitize_context_t *context, unsigned int lookup_type) { TRACE_SANITIZE (); - if (!u.format.sanitize (context)) return false; - switch (u.format) { + if (!u.sub_format.sanitize (context)) return false; + switch (lookup_type) { case Single: return u.single.sanitize (context); case Pair: return u.pair.sanitize (context); case Cursive: return u.cursive.sanitize (context); @@ -1477,7 +1477,7 @@ struct PosLookupSubTable private: union { - USHORT format; + USHORT sub_format; SinglePos single; PairPos pair; CursivePos cursive; @@ -1489,7 +1489,7 @@ struct PosLookupSubTable ExtensionPos extension; } u; public: - DEFINE_SIZE_UNION (2, format); + DEFINE_SIZE_UNION (2, sub_format); }; @@ -1563,7 +1563,7 @@ struct PosLookup : Lookup TRACE_SANITIZE (); if (unlikely (!Lookup::sanitize (context))) return false; OffsetArrayOf &list = CastR > (subTable); - return list.sanitize (context, this); + return list.sanitize (context, this, get_type ()); } }; @@ -1611,7 +1611,7 @@ inline bool ExtensionPos::sanitize (hb_sanitize_context_t *context) if (unlikely (!Extension::sanitize (context))) return false; unsigned int offset = get_offset (); if (unlikely (!offset)) return true; - return StructAtOffset (this, offset).sanitize (context); + return StructAtOffset (this, offset).sanitize (context, get_type ()); } static inline bool position_lookup (hb_apply_context_t *context, unsigned int lookup_index) diff --git a/src/hb-ot-layout-gsub-private.hh b/src/hb-ot-layout-gsub-private.hh index 513913e93..494e2deab 100644 --- a/src/hb-ot-layout-gsub-private.hh +++ b/src/hb-ot-layout-gsub-private.hh @@ -730,10 +730,10 @@ struct SubstLookupSubTable } } - inline bool sanitize (hb_sanitize_context_t *context) { + inline bool sanitize (hb_sanitize_context_t *context, unsigned int lookup_type) { TRACE_SANITIZE (); - if (!u.format.sanitize (context)) return false; - switch (u.format) { + if (!u.sub_format.sanitize (context)) return false; + switch (lookup_type) { case Single: return u.single.sanitize (context); case Multiple: return u.multiple.sanitize (context); case Alternate: return u.alternate.sanitize (context); @@ -748,7 +748,7 @@ struct SubstLookupSubTable private: union { - USHORT format; + USHORT sub_format; SingleSubst single; MultipleSubst multiple; AlternateSubst alternate; @@ -759,7 +759,7 @@ struct SubstLookupSubTable ReverseChainSingleSubst reverseChainContextSingle; } u; public: - DEFINE_SIZE_UNION (2, format); + DEFINE_SIZE_UNION (2, sub_format); }; @@ -870,7 +870,7 @@ struct SubstLookup : Lookup TRACE_SANITIZE (); if (unlikely (!Lookup::sanitize (context))) return false; OffsetArrayOf &list = CastR > (subTable); - return list.sanitize (context, this); + return list.sanitize (context, this, get_type ()); } }; @@ -918,7 +918,7 @@ inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *context) if (unlikely (!Extension::sanitize (context))) return false; unsigned int offset = get_offset (); if (unlikely (!offset)) return true; - return StructAtOffset (this, offset).sanitize (context); + return StructAtOffset (this, offset).sanitize (context, get_type ()); } inline bool ExtensionSubst::is_reverse (void) const