[HarfBuzz] harfbuzz-ng: Branch 'master' - 2 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Mon May 10 18:42:54 PDT 2010


 src/hb-open-type-private.hh          |   14 +++++---------
 src/hb-ot-layout-gpos-private.hh     |   14 +++++++-------
 src/hb-ot-layout-gsub-private.hh     |   14 +++++++-------
 src/hb-ot-layout-gsubgpos-private.hh |    3 +--
 4 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit fe9bc070e1d545b0df2ea548eebf5a1fc4c92ddc
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon May 10 21:39:24 2010 -0400

    Fix awful confusion between lookup format and subtable format
    
    As reported by John Daggett.

diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index bbb0dca..c814893 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<PosLookupSubTable> &list = CastR<OffsetArrayOf<PosLookupSubTable> > (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<PosLookupSubTable> (this, offset).sanitize (context);
+  return StructAtOffset<PosLookupSubTable> (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 513913e..494e2de 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<SubstLookupSubTable> &list = CastR<OffsetArrayOf<SubstLookupSubTable> > (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<SubstLookupSubTable> (this, offset).sanitize (context);
+  return StructAtOffset<SubstLookupSubTable> (this, offset).sanitize (context, get_type ());
 }
 
 inline bool ExtensionSubst::is_reverse (void) const
commit 458ecbb60bb7e8e32aca62a562586d921d5396aa
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Mon May 10 21:11:35 2010 -0400

    Fix tracing order

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index c7b087e..eabe1b8 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -146,22 +146,19 @@ ASSERT_STATIC (Type::min_size + 1 <= sizeof (_Null##Type))
 
 template <int max_depth>
 struct hb_trace_t {
-  explicit hb_trace_t (unsigned int *pdepth) : pdepth(pdepth) { if (max_depth) ++*pdepth; }
-  ~hb_trace_t (void) { if (max_depth) --*pdepth; }
-
-  inline void log (const char *what, const char *function, const void *obj)
-  {
+  explicit hb_trace_t (unsigned int *pdepth, const char *what, const char *function, const void *obj) : pdepth(pdepth) {
     if (*pdepth < max_depth)
       fprintf (stderr, "%s(%p) %-*d-> %s\n", what, obj, *pdepth, *pdepth, function);
+    if (max_depth) ++*pdepth;
   }
+  ~hb_trace_t (void) { if (max_depth) --*pdepth; }
 
   private:
   unsigned int *pdepth;
 };
 template <> /* Optimize when tracing is disabled */
 struct hb_trace_t<0> {
-  explicit hb_trace_t (unsigned int *p) {}
-  inline void log (const char *what, const char *function, const void *obj) {};
+  explicit hb_trace_t (unsigned int *pdepth, const char *what, const char *function, const void *obj) {}
 };
 
 
@@ -176,8 +173,7 @@ struct hb_trace_t<0> {
 
 
 #define TRACE_SANITIZE() \
-	hb_trace_t<HB_DEBUG_SANITIZE> trace (&context->debug_depth); \
-	trace.log ("SANITIZE", HB_FUNC, this);
+	hb_trace_t<HB_DEBUG_SANITIZE> trace (&context->debug_depth, "SANITIZE", HB_FUNC, this); \
 
 
 struct hb_sanitize_context_t
diff --git a/src/hb-ot-layout-gsubgpos-private.hh b/src/hb-ot-layout-gsubgpos-private.hh
index 488ab1d..09c817d 100644
--- a/src/hb-ot-layout-gsubgpos-private.hh
+++ b/src/hb-ot-layout-gsubgpos-private.hh
@@ -36,8 +36,7 @@
 #endif
 
 #define TRACE_APPLY() \
-	hb_trace_t<HB_DEBUG_APPLY> trace (&context->debug_depth); \
-	trace.log ("APPLY", HB_FUNC, this);
+	hb_trace_t<HB_DEBUG_APPLY> trace (&context->debug_depth, "APPLY", HB_FUNC, this); \
 
 
 struct hb_apply_context_t



More information about the HarfBuzz mailing list