From ed2e13594479c6ed7909401509962ea2f03f9a6e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 23 Nov 2012 17:10:40 -0500 Subject: [PATCH] [OTLayout] More Extension templatizing --- src/hb-ot-layout-gpos-table.hh | 11 ----------- src/hb-ot-layout-gsub-table.hh | 11 ----------- src/hb-ot-layout-gsubgpos-private.hh | 12 ++++++++++-- 3 files changed, 10 insertions(+), 24 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 1a75880f0..29faa18db 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -1249,8 +1249,6 @@ struct ChainContextPos : ChainContext {}; struct ExtensionPos : Extension { typedef struct PosLookupSubTable LookupSubTable; - - inline bool sanitize (hb_sanitize_context_t *c); }; @@ -1517,15 +1515,6 @@ GPOS::position_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer, hb_bool_t /* Out-of-class implementation for methods recursing */ -inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c) -{ - TRACE_SANITIZE (this); - if (unlikely (!Extension::sanitize (c))) return TRACE_RETURN (false); - unsigned int offset = get_offset (); - if (unlikely (!offset)) return TRACE_RETURN (true); - return TRACE_RETURN (StructAtOffset (this, offset).sanitize (c, get_type ())); -} - inline bool PosLookup::apply_recurse_func (hb_apply_context_t *c, unsigned int lookup_index) { const GPOS &gpos = *(hb_ot_layout_from_face (c->face)->gpos); diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 997187504..1a2119df7 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -882,8 +882,6 @@ struct ExtensionSubst : Extension { typedef struct SubstLookupSubTable LookupSubTable; - inline bool sanitize (hb_sanitize_context_t *c); - inline bool is_reverse (void) const; }; @@ -1372,15 +1370,6 @@ GSUB::substitute_finish (hb_font_t *font HB_UNUSED, hb_buffer_t *buffer HB_UNUSE /* Out-of-class implementation for methods recursing */ -inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c) -{ - TRACE_SANITIZE (this); - if (unlikely (!Extension::sanitize (c))) return TRACE_RETURN (false); - unsigned int offset = get_offset (); - if (unlikely (!offset)) return TRACE_RETURN (true); - return TRACE_RETURN (StructAtOffset (this, offset).sanitize (c, get_type ())); -} - inline bool ExtensionSubst::is_reverse (void) const { unsigned int type = get_type (); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 4ff894031..1fbfabd8d 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -1794,10 +1794,10 @@ struct Extension template inline typename context_t::return_t process (context_t *c) const { - return CastP(this)->get_subtable ().process (c, get_type ()); + return get_subtable ().process (c, get_type ()); } - inline bool sanitize (hb_sanitize_context_t *c) { + inline bool sanitize_self (hb_sanitize_context_t *c) { TRACE_SANITIZE (this); if (!u.format.sanitize (c)) return TRACE_RETURN (false); switch (u.format) { @@ -1806,6 +1806,14 @@ struct Extension } } + inline bool sanitize (hb_sanitize_context_t *c) { + TRACE_SANITIZE (this); + if (!sanitize_self (c)) return TRACE_RETURN (false); + unsigned int offset = get_offset (); + if (unlikely (!offset)) return TRACE_RETURN (true); + return TRACE_RETURN (StructAtOffset (this, offset).sanitize (c, get_type ())); + } + protected: union { USHORT format; /* Format identifier */