From acea183e986dd378c6f95120fe0feb0586a8ef36 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 11 May 2012 02:33:11 +0200 Subject: [PATCH] Add return annotation for APPLY --- src/hb-ot-layout-gpos-table.hh | 163 +++++++++++++++-------------------- src/hb-ot-layout-gsub-table.hh | 114 +++++++++++------------- src/hb-ot-layout-gsubgpos-private.hh | 83 ++++++++---------- 3 files changed, 151 insertions(+), 209 deletions(-) diff --git a/src/hb-ot-layout-gpos-table.hh b/src/hb-ot-layout-gpos-table.hh index 1b3677e..4bd8708 100644 --- a/src/hb-ot-layout-gpos-table.hh +++ b/src/hb-ot-layout-gpos-table.hh @@ -412,7 +412,7 @@ struct MarkArray : ArrayOf /* Array of MarkRecords--in Coverage orde o.attach_lookback() = c->buffer->idx - glyph_pos; c->buffer->idx++; - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -433,14 +433,13 @@ struct SinglePosFormat1 { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); valueFormat.apply_value (c->font, c->direction, this, values, c->buffer->pos[c->buffer->idx]); c->buffer->idx++; - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -471,18 +470,16 @@ struct SinglePosFormat2 { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); - if (likely (index >= valueCount)) - return false; + if (likely (index >= valueCount)) return TRACE_RETURN (false); valueFormat.apply_value (c->font, c->direction, this, &values[index * valueFormat.get_len ()], c->buffer->pos[c->buffer->idx]); c->buffer->idx++; - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -513,9 +510,9 @@ struct SinglePos { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - case 2: return u.format2.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + case 2: return TRACE_RETURN (u.format2.apply (c)); + default:return TRACE_RETURN (false); } } @@ -578,12 +575,12 @@ struct PairSet if (len2) pos++; c->buffer->idx = pos; - return true; + return TRACE_RETURN (true); } record = &StructAtOffset (record, record_size); } - return false; + return TRACE_RETURN (false); } struct sanitize_closure_t { @@ -621,17 +618,14 @@ struct PairPosFormat1 { TRACE_APPLY (); hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (skippy_iter.has_no_chance ()) - return false; + if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); - if (!skippy_iter.next ()) - return false; + if (!skippy_iter.next ()) return TRACE_RETURN (false); - return (this+pairSet[index]).apply (c, &valueFormat1, skippy_iter.idx); + return TRACE_RETURN ((this+pairSet[index]).apply (c, &valueFormat1, skippy_iter.idx)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -676,15 +670,12 @@ struct PairPosFormat2 { TRACE_APPLY (); hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (skippy_iter.has_no_chance ()) - return false; + if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); - if (!skippy_iter.next ()) - return false; + if (!skippy_iter.next ()) return TRACE_RETURN (false); unsigned int len1 = valueFormat1.get_len (); unsigned int len2 = valueFormat2.get_len (); @@ -692,8 +683,7 @@ struct PairPosFormat2 unsigned int klass1 = (this+classDef1) (c->buffer->info[c->buffer->idx].codepoint); unsigned int klass2 = (this+classDef2) (c->buffer->info[skippy_iter.idx].codepoint); - if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) - return false; + if (unlikely (klass1 >= class1Count || klass2 >= class2Count)) return TRACE_RETURN (false); const Value *v = &values[record_len * (klass1 * class2Count + klass2)]; valueFormat1.apply_value (c->font, c->direction, this, @@ -705,7 +695,7 @@ struct PairPosFormat2 if (len2) c->buffer->idx++; - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -764,9 +754,9 @@ struct PairPos { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - case 2: return u.format2.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + case 2: return TRACE_RETURN (u.format2.apply (c)); + default:return TRACE_RETURN (false); } } @@ -821,23 +811,18 @@ struct CursivePosFormat1 TRACE_APPLY (); /* We don't handle mark glyphs here. */ - if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) - return false; + if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK) return TRACE_RETURN (false); hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (skippy_iter.has_no_chance ()) - return false; + if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); const EntryExitRecord &this_record = entryExitRecord[(this+coverage) (c->buffer->info[c->buffer->idx].codepoint)]; - if (!this_record.exitAnchor) - return false; + if (!this_record.exitAnchor) return TRACE_RETURN (false); - if (!skippy_iter.next ()) - return false; + if (!skippy_iter.next ()) return TRACE_RETURN (false); const EntryExitRecord &next_record = entryExitRecord[(this+coverage) (c->buffer->info[skippy_iter.idx].codepoint)]; - if (!next_record.entryAnchor) - return false; + if (!next_record.entryAnchor) return TRACE_RETURN (false); unsigned int i = c->buffer->idx; unsigned int j = skippy_iter.idx; @@ -900,7 +885,7 @@ struct CursivePosFormat1 } c->buffer->idx = j; - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -929,8 +914,8 @@ struct CursivePos { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -965,24 +950,20 @@ struct MarkBasePosFormat1 { TRACE_APPLY (); unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (mark_index == NOT_COVERED)) - return false; + if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false); /* now we search backwards for a non-mark glyph */ unsigned int property; hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) - return false; + if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false); /* The following assertion is too strong, so we've disabled it. */ - if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) - {/*return false;*/} + if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH)) {/*return TRACE_RETURN (false);*/} unsigned int base_index = (this+baseCoverage) (c->buffer->info[skippy_iter.idx].codepoint); - if (base_index == NOT_COVERED) - return false; + if (base_index == NOT_COVERED) return TRACE_RETURN (false); - return (this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx); + return TRACE_RETURN ((this+markArray).apply (c, mark_index, base_index, this+baseArray, classCount, skippy_iter.idx)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1019,8 +1000,8 @@ struct MarkBasePos { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -1060,31 +1041,27 @@ struct MarkLigPosFormat1 { TRACE_APPLY (); unsigned int mark_index = (this+markCoverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (mark_index == NOT_COVERED)) - return false; + if (likely (mark_index == NOT_COVERED)) return TRACE_RETURN (false); /* now we search backwards for a non-mark glyph */ unsigned int property; hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) - return false; + if (!skippy_iter.prev (&property, LookupFlag::IgnoreMarks)) return TRACE_RETURN (false); /* The following assertion is too strong, so we've disabled it. */ - if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)) - {/*return false;*/} + if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE)) {/*return TRACE_RETURN (false);*/} unsigned int j = skippy_iter.idx; unsigned int lig_index = (this+ligatureCoverage) (c->buffer->info[j].codepoint); - if (lig_index == NOT_COVERED) - return false; + if (lig_index == NOT_COVERED) return TRACE_RETURN (false); const LigatureArray& lig_array = this+ligatureArray; const LigatureAttach& lig_attach = lig_array[lig_index]; /* Find component to attach to */ unsigned int comp_count = lig_attach.rows; - if (unlikely (!comp_count)) - return false; + if (unlikely (!comp_count)) return TRACE_RETURN (false); + unsigned int comp_index; /* We must now check whether the ligature ID of the current mark glyph * is identical to the ligature ID of the found ligature. If yes, we @@ -1101,7 +1078,7 @@ struct MarkLigPosFormat1 else comp_index = comp_count - 1; - return (this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, j); + return TRACE_RETURN ((this+markArray).apply (c, mark_index, comp_index, lig_attach, classCount, j)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1139,8 +1116,8 @@ struct MarkLigPos { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -1175,17 +1152,14 @@ struct MarkMarkPosFormat1 { TRACE_APPLY (); unsigned int mark1_index = (this+mark1Coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (mark1_index == NOT_COVERED)) - return false; + if (likely (mark1_index == NOT_COVERED)) return TRACE_RETURN (false); /* now we search backwards for a suitable mark glyph until a non-mark glyph */ unsigned int property; hb_apply_context_t::mark_skipping_backward_iterator_t skippy_iter (c, c->buffer->idx, 1); - if (!skippy_iter.prev (&property)) - return false; + if (!skippy_iter.prev (&property)) return TRACE_RETURN (false); - if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) - return false; + if (!(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK)) return TRACE_RETURN (false); unsigned int j = skippy_iter.idx; @@ -1195,13 +1169,12 @@ struct MarkMarkPosFormat1 if ((get_lig_comp (c->buffer->info[j]) != get_lig_comp (c->buffer->info[c->buffer->idx])) || (get_lig_comp (c->buffer->info[j]) > 0 && get_lig_id (c->buffer->info[j]) != get_lig_id (c->buffer->info[c->buffer->idx]))) - return false; + return TRACE_RETURN (false); unsigned int mark2_index = (this+mark2Coverage) (c->buffer->info[j].codepoint); - if (mark2_index == NOT_COVERED) - return false; + if (mark2_index == NOT_COVERED) return TRACE_RETURN (false); - return (this+mark1Array).apply (c, mark1_index, mark2_index, this+mark2Array, classCount, j); + return TRACE_RETURN ((this+mark1Array).apply (c, mark1_index, mark2_index, this+mark2Array, classCount, j)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1241,8 +1214,8 @@ struct MarkMarkPos { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -1273,7 +1246,7 @@ struct ContextPos : Context inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - return Context::apply (c, position_lookup); + return TRACE_RETURN (Context::apply (c, position_lookup)); } }; @@ -1285,7 +1258,7 @@ struct ChainContextPos : ChainContext inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - return ChainContext::apply (c, position_lookup); + return TRACE_RETURN (ChainContext::apply (c, position_lookup)); } }; @@ -1334,16 +1307,16 @@ struct PosLookupSubTable { TRACE_APPLY (); switch (lookup_type) { - case Single: return u.single.apply (c); - case Pair: return u.pair.apply (c); - case Cursive: return u.cursive.apply (c); - case MarkBase: return u.markBase.apply (c); - case MarkLig: return u.markLig.apply (c); - case MarkMark: return u.markMark.apply (c); - case Context: return u.c.apply (c); - case ChainContext: return u.chainContext.apply (c); - case Extension: return u.extension.apply (c); - default: return false; + case Single: return TRACE_RETURN (u.single.apply (c)); + case Pair: return TRACE_RETURN (u.pair.apply (c)); + case Cursive: return TRACE_RETURN (u.cursive.apply (c)); + case MarkBase: return TRACE_RETURN (u.markBase.apply (c)); + case MarkLig: return TRACE_RETURN (u.markLig.apply (c)); + case MarkMark: return TRACE_RETURN (u.markMark.apply (c)); + case Context: return TRACE_RETURN (u.c.apply (c)); + case ChainContext: return TRACE_RETURN (u.chainContext.apply (c)); + case Extension: return TRACE_RETURN (u.extension.apply (c)); + default: return TRACE_RETURN (false); } } @@ -1538,7 +1511,7 @@ GPOS::position_finish (hb_buffer_t *buffer) inline bool ExtensionPos::apply (hb_apply_context_t *c) const { TRACE_APPLY (); - return get_subtable ().apply (c, get_type ()); + return TRACE_RETURN (get_subtable ().apply (c, get_type ())); } inline bool ExtensionPos::sanitize (hb_sanitize_context_t *c) diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 7bbf82a..682303a 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -60,15 +60,14 @@ struct SingleSubstFormat1 TRACE_APPLY (); hb_codepoint_t glyph_id = c->buffer->info[c->buffer->idx].codepoint; unsigned int index = (this+coverage) (glyph_id); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); /* According to the Adobe Annotated OpenType Suite, result is always * limited to 16bit. */ glyph_id = (glyph_id + deltaGlyphID) & 0xFFFF; c->replace_glyph (glyph_id); - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -113,16 +112,14 @@ struct SingleSubstFormat2 TRACE_APPLY (); hb_codepoint_t glyph_id = c->buffer->info[c->buffer->idx].codepoint; unsigned int index = (this+coverage) (glyph_id); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); - if (unlikely (index >= substitute.len)) - return false; + if (unlikely (index >= substitute.len)) return TRACE_RETURN (false); glyph_id = substitute[index]; c->replace_glyph (glyph_id); - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -171,9 +168,9 @@ struct SingleSubst { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - case 2: return u.format2.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + case 2: return TRACE_RETURN (u.format2.apply (c)); + default:return TRACE_RETURN (false); } } @@ -213,14 +210,13 @@ struct Sequence inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - if (unlikely (!substitute.len)) - return false; + if (unlikely (!substitute.len)) return TRACE_RETURN (false); if (c->property & HB_OT_LAYOUT_GLYPH_CLASS_LIGATURE) c->guess_glyph_class (HB_OT_LAYOUT_GLYPH_CLASS_BASE_GLYPH); c->replace_glyphs_be16 (1, substitute.len, (const uint16_t *) substitute.array); - return true; + return TRACE_RETURN (true); } public: @@ -262,10 +258,9 @@ struct MultipleSubstFormat1 TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); - return (this+sequence[index]).apply (c); + return TRACE_RETURN ((this+sequence[index]).apply (c)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -312,8 +307,8 @@ struct MultipleSubst { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -368,13 +363,11 @@ struct AlternateSubstFormat1 hb_codepoint_t glyph_id = c->buffer->info[c->buffer->idx].codepoint; unsigned int index = (this+coverage) (glyph_id); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const AlternateSet &alt_set = this+alternateSet[index]; - if (unlikely (!alt_set.len)) - return false; + if (unlikely (!alt_set.len)) return TRACE_RETURN (false); hb_mask_t glyph_mask = c->buffer->info[c->buffer->idx].mask; hb_mask_t lookup_mask = c->lookup_mask; @@ -383,14 +376,13 @@ struct AlternateSubstFormat1 unsigned int shift = _hb_ctz (lookup_mask); unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift); - if (unlikely (alt_index > alt_set.len || alt_index == 0)) - return false; + if (unlikely (alt_index > alt_set.len || alt_index == 0)) return TRACE_RETURN (false); glyph_id = alt_set[alt_index - 1]; c->replace_glyph (glyph_id); - return true; + return TRACE_RETURN (true); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -437,8 +429,8 @@ struct AlternateSubst { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -484,12 +476,10 @@ struct Ligature { TRACE_APPLY (); unsigned int count = component.len; - if (unlikely (count < 2)) - return false; + if (unlikely (count < 2)) return TRACE_RETURN (false); hb_apply_context_t::mark_skipping_forward_iterator_t skippy_iter (c, c->buffer->idx, count - 1); - if (skippy_iter.has_no_chance ()) - return false; + if (skippy_iter.has_no_chance ()) return TRACE_RETURN (false); bool first_was_mark = (c->property & HB_OT_LAYOUT_GLYPH_CLASS_MARK); bool found_non_mark = false; @@ -498,13 +488,11 @@ struct Ligature { unsigned int property; - if (!skippy_iter.next (&property)) - return false; + if (!skippy_iter.next (&property)) return TRACE_RETURN (false); found_non_mark |= !(property & HB_OT_LAYOUT_GLYPH_CLASS_MARK); - if (likely (c->buffer->info[skippy_iter.idx].codepoint != component[i])) - return false; + if (likely (c->buffer->info[skippy_iter.idx].codepoint != component[i])) return TRACE_RETURN (false); } if (first_was_mark && found_non_mark) @@ -542,7 +530,7 @@ struct Ligature } } - return true; + return TRACE_RETURN (true); } public: @@ -594,11 +582,10 @@ struct LigatureSet for (unsigned int i = 0; i < num_ligs; i++) { const Ligature &lig = this+ligature[i]; - if (lig.apply (c)) - return true; + if (lig.apply (c)) return TRACE_RETURN (true); } - return false; + return TRACE_RETURN (false); } public: @@ -644,11 +631,10 @@ struct LigatureSubstFormat1 hb_codepoint_t glyph_id = c->buffer->info[c->buffer->idx].codepoint; unsigned int index = (this+coverage) (glyph_id); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const LigatureSet &lig_set = this+ligatureSet[index]; - return lig_set.apply (c); + return TRACE_RETURN (lig_set.apply (c)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -695,8 +681,8 @@ struct LigatureSubst { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -735,7 +721,7 @@ struct ContextSubst : Context inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - return Context::apply (c, substitute_lookup); + return TRACE_RETURN (Context::apply (c, substitute_lookup)); } }; @@ -754,7 +740,7 @@ struct ChainContextSubst : ChainContext inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - return ChainContext::apply (c, substitute_lookup); + return TRACE_RETURN (ChainContext::apply (c, substitute_lookup)); } }; @@ -818,12 +804,10 @@ struct ReverseChainSingleSubstFormat1 inline bool apply (hb_apply_context_t *c) const { TRACE_APPLY (); - if (unlikely (c->context_length != NO_CONTEXT)) - return false; /* No chaining to this type */ + if (unlikely (c->context_length != NO_CONTEXT)) return TRACE_RETURN (false); /* No chaining to this type */ unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const OffsetArrayOf &lookahead = StructAfter > (backtrack); const ArrayOf &substitute = StructAfter > (lookahead); @@ -838,10 +822,10 @@ struct ReverseChainSingleSubstFormat1 { c->buffer->info[c->buffer->idx].codepoint = substitute[index]; c->buffer->idx--; /* Reverse! */ - return true; + return TRACE_RETURN (true); } - return false; + return TRACE_RETURN (false); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -894,8 +878,8 @@ struct ReverseChainSingleSubst { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c)); + default:return TRACE_RETURN (false); } } @@ -979,15 +963,15 @@ struct SubstLookupSubTable { TRACE_APPLY (); switch (lookup_type) { - case Single: return u.single.apply (c); - case Multiple: return u.multiple.apply (c); - case Alternate: return u.alternate.apply (c); - case Ligature: return u.ligature.apply (c); - case Context: return u.c.apply (c); - case ChainContext: return u.chainContext.apply (c); - case Extension: return u.extension.apply (c); - case ReverseChainSingle: return u.reverseChainContextSingle.apply (c); - default: return false; + case Single: return TRACE_RETURN (u.single.apply (c)); + case Multiple: return TRACE_RETURN (u.multiple.apply (c)); + case Alternate: return TRACE_RETURN (u.alternate.apply (c)); + case Ligature: return TRACE_RETURN (u.ligature.apply (c)); + case Context: return TRACE_RETURN (u.c.apply (c)); + case ChainContext: return TRACE_RETURN (u.chainContext.apply (c)); + case Extension: return TRACE_RETURN (u.extension.apply (c)); + case ReverseChainSingle: return TRACE_RETURN (u.reverseChainContextSingle.apply (c)); + default: return TRACE_RETURN (false); } } @@ -1217,7 +1201,7 @@ inline bool ExtensionSubst::would_apply (hb_codepoint_t first, hb_codepoint_t se inline bool ExtensionSubst::apply (hb_apply_context_t *c) const { TRACE_APPLY (); - return get_subtable ().apply (c, get_type ()); + return TRACE_RETURN (get_subtable ().apply (c, get_type ())); } inline bool ExtensionSubst::sanitize (hb_sanitize_context_t *c) diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 136fff2..c9abd51 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -530,10 +530,7 @@ struct Rule { TRACE_APPLY (); const LookupRecord *lookupRecord = &StructAtOffset (input, input[0].static_size * (inputCount ? inputCount - 1 : 0)); - return context_apply_lookup (c, - inputCount, input, - lookupCount, lookupRecord, - lookup_context); + return TRACE_RETURN (context_apply_lookup (c, inputCount, input, lookupCount, lookupRecord, lookup_context)); } public: @@ -576,9 +573,9 @@ struct RuleSet for (unsigned int i = 0; i < num_rules; i++) { if ((this+rule[i]).apply (c, lookup_context)) - return true; + return TRACE_RETURN (true); } - return false; + return TRACE_RETURN (false); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -625,14 +622,14 @@ struct ContextFormat1 TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); if (likely (index == NOT_COVERED)) - return false; + return TRACE_RETURN (false); const RuleSet &rule_set = this+ruleSet[index]; struct ContextApplyLookupContext lookup_context = { {match_glyph, apply_func}, NULL }; - return rule_set.apply (c, lookup_context); + return TRACE_RETURN (rule_set.apply (c, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -684,8 +681,7 @@ struct ContextFormat2 { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const ClassDef &class_def = this+classDef; index = class_def (c->buffer->info[c->buffer->idx].codepoint); @@ -694,7 +690,7 @@ struct ContextFormat2 {match_class, apply_func}, &class_def }; - return rule_set.apply (c, lookup_context); + return TRACE_RETURN (rule_set.apply (c, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -745,18 +741,14 @@ struct ContextFormat3 { TRACE_APPLY (); unsigned int index = (this+coverage[0]) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const LookupRecord *lookupRecord = &StructAtOffset (coverage, coverage[0].static_size * glyphCount); struct ContextApplyLookupContext lookup_context = { {match_coverage, apply_func}, this }; - return context_apply_lookup (c, - glyphCount, (const USHORT *) (coverage + 1), - lookupCount, lookupRecord, - lookup_context); + return TRACE_RETURN (context_apply_lookup (c, glyphCount, (const USHORT *) (coverage + 1), lookupCount, lookupRecord, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -803,10 +795,10 @@ struct Context { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c, apply_func); - case 2: return u.format2.apply (c, apply_func); - case 3: return u.format3.apply (c, apply_func); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c, apply_func)); + case 2: return TRACE_RETURN (u.format2.apply (c, apply_func)); + case 3: return TRACE_RETURN (u.format3.apply (c, apply_func)); + default:return TRACE_RETURN (false); } } @@ -931,12 +923,11 @@ struct ChainRule const HeadlessArrayOf &input = StructAfter > (backtrack); const ArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); - return chain_context_apply_lookup (c, - backtrack.len, backtrack.array, - input.len, input.array, - lookahead.len, lookahead.array, - lookup.len, lookup.array, - lookup_context); + return TRACE_RETURN (chain_context_apply_lookup (c, + backtrack.len, backtrack.array, + input.len, input.array, + lookahead.len, lookahead.array, lookup.len, + lookup.array, lookup_context)); } public: @@ -984,12 +975,10 @@ struct ChainRuleSet TRACE_APPLY (); unsigned int num_rules = rule.len; for (unsigned int i = 0; i < num_rules; i++) - { if ((this+rule[i]).apply (c, lookup_context)) - return true; - } + return TRACE_RETURN (true); - return false; + return TRACE_RETURN (false); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1033,15 +1022,14 @@ struct ChainContextFormat1 { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const ChainRuleSet &rule_set = this+ruleSet[index]; struct ChainContextApplyLookupContext lookup_context = { {match_glyph, apply_func}, {NULL, NULL, NULL} }; - return rule_set.apply (c, lookup_context); + return TRACE_RETURN (rule_set.apply (c, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1096,8 +1084,7 @@ struct ChainContextFormat2 { TRACE_APPLY (); unsigned int index = (this+coverage) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const ClassDef &backtrack_class_def = this+backtrackClassDef; const ClassDef &input_class_def = this+inputClassDef; @@ -1111,7 +1098,7 @@ struct ChainContextFormat2 &input_class_def, &lookahead_class_def} }; - return rule_set.apply (c, lookup_context); + return TRACE_RETURN (rule_set.apply (c, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1179,8 +1166,7 @@ struct ChainContextFormat3 const OffsetArrayOf &input = StructAfter > (backtrack); unsigned int index = (this+input[0]) (c->buffer->info[c->buffer->idx].codepoint); - if (likely (index == NOT_COVERED)) - return false; + if (likely (index == NOT_COVERED)) return TRACE_RETURN (false); const OffsetArrayOf &lookahead = StructAfter > (input); const ArrayOf &lookup = StructAfter > (lookahead); @@ -1188,12 +1174,11 @@ struct ChainContextFormat3 {match_coverage, apply_func}, {this, this, this} }; - return chain_context_apply_lookup (c, - backtrack.len, (const USHORT *) backtrack.array, - input.len, (const USHORT *) input.array + 1, - lookahead.len, (const USHORT *) lookahead.array, - lookup.len, lookup.array, - lookup_context); + return TRACE_RETURN (chain_context_apply_lookup (c, + backtrack.len, (const USHORT *) backtrack.array, + input.len, (const USHORT *) input.array + 1, + lookahead.len, (const USHORT *) lookahead.array, + lookup.len, lookup.array, lookup_context)); } inline bool sanitize (hb_sanitize_context_t *c) { @@ -1247,10 +1232,10 @@ struct ChainContext { TRACE_APPLY (); switch (u.format) { - case 1: return u.format1.apply (c, apply_func); - case 2: return u.format2.apply (c, apply_func); - case 3: return u.format3.apply (c, apply_func); - default:return false; + case 1: return TRACE_RETURN (u.format1.apply (c, apply_func)); + case 2: return TRACE_RETURN (u.format2.apply (c, apply_func)); + case 3: return TRACE_RETURN (u.format3.apply (c, apply_func)); + default:return TRACE_RETURN (false); } } -- 2.7.4