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

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri May 4 00:47:38 UTC 2018


 src/hb-aat-layout-morx-table.hh |    4 ++--
 src/hb-open-type-private.hh     |   16 ++++++++--------
 src/hb-ot-cmap-table.hh         |   28 ++++++++++++++--------------
 src/hb-ot-glyf-table.hh         |   14 +++++++-------
 src/hb-ot-var-avar-table.hh     |    6 +++---
 src/hb-set-private.hh           |   14 ++++++++++++--
 src/hb-set.cc                   |    4 ++--
 7 files changed, 48 insertions(+), 38 deletions(-)

New commits:
commit 5b93f6916958e6096044372c1195501ea9f37436
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 2 14:59:14 2018 -0400

    Rename some X-terminated members to Z-terminated
    
    X-terminated means don't access this, it's not located correctly.
    Z-terminated means this is a C array with no bound checking.

diff --git a/src/hb-aat-layout-morx-table.hh b/src/hb-aat-layout-morx-table.hh
index 8b27d670..fce1878d 100644
--- a/src/hb-aat-layout-morx-table.hh
+++ b/src/hb-aat-layout-morx-table.hh
@@ -670,8 +670,8 @@ struct Chain
   HBUINT32	subtableCount;	/* The number of subtables in the chain. */
 
   Feature	featureZ[VAR];	/* Features. */
-  ChainSubtable	subtableX[VAR];	/* Subtables. */
-  // subtableGlyphCoverageArray if major == 3
+/*ChainSubtable	subtableX[VAR];*//* Subtables. */
+/*subtableGlyphCoverageArray*/	/* Only if major == 3. */
 
   public:
   DEFINE_SIZE_MIN (16);
diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index efbaa7ad..1f22b182 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -1201,18 +1201,18 @@ struct BinSearchHeader
   {
     len.set (v);
     assert (len == v);
-    entrySelectorZ.set (MAX (1u, _hb_bit_storage (v)) - 1);
-    searchRangeZ.set (16 * (1u << entrySelectorZ));
-    rangeShiftZ.set (v * 16 > searchRangeZ
-                     ? 16 * v - searchRangeZ
-                     : 0);
+    entrySelector.set (MAX (1u, _hb_bit_storage (v)) - 1);
+    searchRange.set (16 * (1u << entrySelector));
+    rangeShift.set (v * 16 > searchRange
+		    ? 16 * v - searchRange
+		    : 0);
   }
 
   protected:
   HBUINT16	len;
-  HBUINT16	searchRangeZ;
-  HBUINT16	entrySelectorZ;
-  HBUINT16	rangeShiftZ;
+  HBUINT16	searchRange;
+  HBUINT16	entrySelector;
+  HBUINT16	rangeShift;
 
   public:
   DEFINE_SIZE_STATIC (8);
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 9155b7c0..83a0b519 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -59,8 +59,8 @@ struct CmapSubtableFormat0
 
   protected:
   HBUINT16	format;		/* Format number is set to 0. */
-  HBUINT16	lengthZ;	/* Byte length of this subtable. */
-  HBUINT16	languageZ;	/* Ignore. */
+  HBUINT16	length;		/* Byte length of this subtable. */
+  HBUINT16	language;	/* Ignore. */
   HBUINT8	glyphIdArray[256];/* An array that maps character
 				 * code to glyph index values. */
   public:
@@ -179,11 +179,11 @@ struct CmapSubtableFormat4
   HBUINT16	format;		/* Format number is set to 4. */
   HBUINT16	length;		/* This is the length in bytes of the
 				 * subtable. */
-  HBUINT16	languageZ;	/* Ignore. */
+  HBUINT16	language;	/* Ignore. */
   HBUINT16	segCountX2;	/* 2 x segCount. */
-  HBUINT16	searchRangeZ;	/* 2 * (2**floor(log2(segCount))) */
-  HBUINT16	entrySelectorZ;	/* log2(searchRange/2) */
-  HBUINT16	rangeShiftZ;	/* 2 x segCount - searchRange */
+  HBUINT16	searchRange;	/* 2 * (2**floor(log2(segCount))) */
+  HBUINT16	entrySelector;	/* log2(searchRange/2) */
+  HBUINT16	rangeShift;	/* 2 x segCount - searchRange */
 
   HBUINT16	values[VAR];
 #if 0
@@ -251,8 +251,8 @@ struct CmapSubtableTrimmed
 
   protected:
   UINT		formatReserved;	/* Subtable format and (maybe) padding. */
-  UINT		lengthZ;	/* Byte length of this subtable. */
-  UINT		languageZ;	/* Ignore. */
+  UINT		length;		/* Byte length of this subtable. */
+  UINT		language;	/* Ignore. */
   UINT		startCharCode;	/* First character code covered. */
   ArrayOf<GlyphID, UINT>
 		glyphIdArray;	/* Array of glyph index values for character
@@ -305,9 +305,9 @@ struct CmapSubtableLongSegmented
 
   protected:
   HBUINT16	format;		/* Subtable format; set to 12. */
-  HBUINT16	reservedZ;	/* Reserved; set to 0. */
-  HBUINT32	lengthZ;	/* Byte length of this subtable. */
-  HBUINT32	languageZ;	/* Ignore. */
+  HBUINT16	reserved;	/* Reserved; set to 0. */
+  HBUINT32	length;		/* Byte length of this subtable. */
+  HBUINT32	language;	/* Ignore. */
   SortedArrayOf<CmapSubtableLongGroup, HBUINT32>
 		groups;		/* Groupings. */
   public:
@@ -441,7 +441,7 @@ struct CmapSubtableFormat14
 
   protected:
   HBUINT16	format;		/* Format number is set to 14. */
-  HBUINT32		lengthZ;	/* Byte length of this subtable. */
+  HBUINT32	length;		/* Byte length of this subtable. */
   SortedArrayOf<VariationSelectorRecord, HBUINT32>
 		record;		/* Variation selector records; sorted
 				 * in increasing order of `varSelector'. */
@@ -611,8 +611,8 @@ struct cmap
     if (unlikely (!c.extend_min (format12))) return false;
 
     format12.format.set (12);
-    format12.reservedZ.set (0);
-    format12.lengthZ.set (16 + 12 * groups.len);
+    format12.reserved.set (0);
+    format12.length.set (16 + 12 * groups.len);
 
     if (unlikely (!format12.serialize (&c, groups))) return false;
 
diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh
index 85cb3a37..4b02153c 100644
--- a/src/hb-ot-glyf-table.hh
+++ b/src/hb-ot-glyf-table.hh
@@ -56,8 +56,8 @@ struct loca
   }
 
   protected:
-  HBUINT8		dataX[VAR];		/* Location data. */
-  DEFINE_SIZE_ARRAY (0, dataX);
+  HBUINT8		dataZ[VAR];		/* Location data. */
+  DEFINE_SIZE_ARRAY (0, dataZ);
 };
 
 
@@ -377,13 +377,13 @@ struct glyf
 
       if (short_offset)
       {
-        const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataX;
+        const HBUINT16 *offsets = (const HBUINT16 *) loca_table->dataZ;
 	*start_offset = 2 * offsets[glyph];
 	*end_offset   = 2 * offsets[glyph + 1];
       }
       else
       {
-        const HBUINT32 *offsets = (const HBUINT32 *) loca_table->dataX;
+        const HBUINT32 *offsets = (const HBUINT32 *) loca_table->dataZ;
 
 	*start_offset = offsets[glyph];
 	*end_offset   = offsets[glyph + 1];
@@ -420,7 +420,7 @@ struct glyf
         } while (composite_it.move_to_next());
 
         if ( (uint16_t) last->flags & CompositeGlyphHeader::WE_HAVE_INSTRUCTIONS)
-          *instruction_start = ((char *) last - (char *) glyf_table->dataX) + last->get_size();
+          *instruction_start = ((char *) last - (char *) glyf_table->dataZ) + last->get_size();
         else
           *instruction_start = end_offset;
         *instruction_end = end_offset;
@@ -485,9 +485,9 @@ struct glyf
   };
 
   protected:
-  HBUINT8		dataX[VAR];		/* Glyphs data. */
+  HBUINT8		dataZ[VAR];		/* Glyphs data. */
 
-  DEFINE_SIZE_ARRAY (0, dataX);
+  DEFINE_SIZE_ARRAY (0, dataZ);
 };
 
 } /* namespace OT */
diff --git a/src/hb-ot-var-avar-table.hh b/src/hb-ot-var-avar-table.hh
index feaa525e..fc73527e 100644
--- a/src/hb-ot-var-avar-table.hh
+++ b/src/hb-ot-var-avar-table.hh
@@ -108,7 +108,7 @@ struct avar
 		    c->check_struct (this))))
       return_trace (false);
 
-    const SegmentMaps *map = &axisSegmentMapsZ;
+    const SegmentMaps *map = axisSegmentMapsZ;
     unsigned int count = axisCount;
     for (unsigned int i = 0; i < count; i++)
     {
@@ -124,7 +124,7 @@ struct avar
   {
     unsigned int count = MIN<unsigned int> (coords_length, axisCount);
 
-    const SegmentMaps *map = &axisSegmentMapsZ;
+    const SegmentMaps *map = axisSegmentMapsZ;
     for (unsigned int i = 0; i < count; i++)
     {
       coords[i] = map->map (coords[i]);
@@ -139,7 +139,7 @@ struct avar
   HBUINT16	axisCount;	/* The number of variation axes in the font. This
 				 * must be the same number as axisCount in the
 				 * 'fvar' table. */
-  SegmentMaps	axisSegmentMapsZ;
+  SegmentMaps	axisSegmentMapsZ[VAR];
 
   public:
   DEFINE_SIZE_MIN (8);
commit f1f6bc0a6f28a6611a247f37b8a83e6f782d7227
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed May 2 12:56:21 2018 -0400

    [set] Fix init/fini of set on the stack to call object init/fini
    
    Part of https://github.com/harfbuzz/harfbuzz/issues/1017

diff --git a/src/hb-set-private.hh b/src/hb-set-private.hh
index 4288b15b..149b89e2 100644
--- a/src/hb-set-private.hh
+++ b/src/hb-set-private.hh
@@ -193,18 +193,28 @@ struct hb_set_t
   hb_vector_t<page_map_t, 8> page_map;
   hb_vector_t<page_t, 1> pages;
 
-  inline void init (void)
+  inline void init_shallow (void)
   {
     in_error = false;
     population = 0;
     page_map.init ();
     pages.init ();
   }
-  inline void fini (void)
+  inline void init (void)
+  {
+    hb_object_init (this);
+    init_shallow ();
+  }
+  inline void fini_shallow (void)
   {
     page_map.fini ();
     pages.fini ();
   }
+  inline void fini (void)
+  {
+    hb_object_fini (this);
+    fini_shallow ();
+  }
 
   inline bool resize (unsigned int count)
   {
diff --git a/src/hb-set.cc b/src/hb-set.cc
index d5163c78..2bad1889 100644
--- a/src/hb-set.cc
+++ b/src/hb-set.cc
@@ -45,7 +45,7 @@ hb_set_create (void)
   if (!(set = hb_object_create<hb_set_t> ()))
     return hb_set_get_empty ();
 
-  set->init ();
+  set->init_shallow ();
 
   return set;
 }
@@ -96,7 +96,7 @@ hb_set_destroy (hb_set_t *set)
 {
   if (!hb_object_destroy (set)) return;
 
-  set->fini ();
+  set->fini_shallow ();
 
   free (set);
 }


More information about the HarfBuzz mailing list