From 2c53bd3c3ec4f81eff126c5bf84b7f2ddf2f0fef Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Fri, 23 Nov 2012 17:29:05 -0500 Subject: [PATCH] [OTLayout] Start porting sanitize() to process() --- src/hb-open-type-private.hh | 12 +++++++++++- src/hb-ot-layout-gsubgpos-private.hh | 8 ++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 541927b86..2372235a5 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -168,12 +168,22 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type)) #define TRACE_SANITIZE(this) \ hb_auto_trace_t trace \ - (&c->debug_depth, "SANITIZE", this, HB_FUNC, \ + (&c->debug_depth, c->get_name (), this, HB_FUNC, \ ""); struct hb_sanitize_context_t { + inline const char *get_name (void) { return "SANITIZE"; } + static const unsigned int max_debug_depth = HB_DEBUG_SANITIZE; + typedef bool return_t; + template + inline return_t process (const T &obj) { return obj.sanitize (this); } + static return_t default_return_value (void) { return true; } + bool stop_sublookup_iteration (const return_t r) const { return false; } + return_t recurse (unsigned int lookup_index) + { return default_return_value (); } + inline void init (hb_blob_t *b) { this->blob = hb_blob_reference (b); diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh index 6be9238ca..f47f80be2 100644 --- a/src/hb-ot-layout-gsubgpos-private.hh +++ b/src/hb-ot-layout-gsubgpos-private.hh @@ -50,7 +50,7 @@ namespace OT { #define TRACE_CLOSURE(this) \ hb_auto_trace_t trace \ - (&c->debug_depth, "CLOSURE", this, HB_FUNC, \ + (&c->debug_depth, c->get_name (), this, HB_FUNC, \ ""); struct hb_closure_context_t @@ -99,7 +99,7 @@ struct hb_closure_context_t #define TRACE_WOULD_APPLY(this) \ hb_auto_trace_t trace \ - (&c->debug_depth, "WOULD_APPLY", this, HB_FUNC, \ + (&c->debug_depth, c->get_name (), this, HB_FUNC, \ "%d glyphs", c->len); struct hb_would_apply_context_t @@ -138,7 +138,7 @@ struct hb_would_apply_context_t #define TRACE_COLLECT_GLYPHS(this) \ hb_auto_trace_t trace \ - (&c->debug_depth, "COLLECT_GLYPHS", this, HB_FUNC, \ + (&c->debug_depth, c->get_name (), this, HB_FUNC, \ ""); struct hb_collect_glyphs_context_t @@ -206,7 +206,7 @@ struct hb_get_coverage_context_t #define TRACE_APPLY(this) \ hb_auto_trace_t trace \ - (&c->debug_depth, "APPLY", this, HB_FUNC, \ + (&c->debug_depth, c->get_name (), this, HB_FUNC, \ "idx %d codepoint %u", c->buffer->idx, c->buffer->cur().codepoint); struct hb_apply_context_t