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

Behdad Esfahbod behdad at kemper.freedesktop.org
Sun Nov 11 20:51:49 UTC 2018


 src/hb-machinery.hh     |   14 ++++----------
 src/hb-null.hh          |    2 +-
 src/hb-ot-hdmx-table.hh |   46 +++++++++++++++++++++++-----------------------
 3 files changed, 28 insertions(+), 34 deletions(-)

New commits:
commit 442a72d95ab1fb3a47b486d8d1eb68e909d0ffb8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Nov 11 15:51:23 2018 -0500

    Declare Null() constexpr

diff --git a/src/hb-null.hh b/src/hb-null.hh
index 25a24f05..5b9c7db7 100644
--- a/src/hb-null.hh
+++ b/src/hb-null.hh
@@ -43,7 +43,7 @@ hb_vector_size_impl_t const _hb_NullPool[(HB_NULL_POOL_SIZE + sizeof (hb_vector_
 
 /* Generic nul-content Null objects. */
 template <typename Type>
-static inline Type const & Null (void) {
+static inline constexpr Type const & Null (void) {
   static_assert (sizeof (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
   return *reinterpret_cast<Type const *> (_hb_NullPool);
 }
commit eecccc919ce15f60ae7ef9da5cfb311b4aa05c63
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Nov 11 15:48:47 2018 -0500

    Don't store to null object
    
    Ouch :).

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index c85c69d7..160e99a5 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -782,10 +782,6 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
 
   inline Stored * do_create (void) const
   {
-    Stored *p = this->template call_create<Stored, Funcs> ();
-    if (unlikely (!p))
-      p = const_cast<Stored *> (Funcs::get_null ());
-    return p;
   }
   static inline void do_destroy (Stored *p)
   {
@@ -803,7 +799,10 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
     Stored *p = this->instance.get ();
     if (unlikely (!p))
     {
-      p = do_create ();
+      p = this->template call_create<Stored, Funcs> ();
+      if (unlikely (!p))
+	return const_cast<Stored *> (Funcs::get_null ());
+
       if (unlikely (!this->instance.cmpexch (nullptr, p)))
       {
         do_destroy (p);
commit 903856ab505cbc6b756d7b904650df72e90f67a7
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Nov 11 15:45:58 2018 -0500

    Remove unused function

diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index d0e1271c..c85c69d7 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -797,11 +797,6 @@ struct hb_lazy_loader_t : hb_data_wrapper_t<Data, WheresData>
   inline const Returned & operator * (void) const { return *get (); }
   template <typename C> inline operator const C * (void) const { return get (); }
 
-  inline Data * get_data (void) const
-  {
-    return *(((Data **) this) - WheresData);
-  }
-
   inline Stored * get_stored (void) const
   {
   retry:
commit 0e0af11c62c6a55248a5d3c8868da91ef36384c5
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Sun Nov 11 12:54:16 2018 -0500

    [hdmx] Renames

diff --git a/src/hb-ot-hdmx-table.hh b/src/hb-ot-hdmx-table.hh
index 04511b5d..9a5f9453 100644
--- a/src/hb-ot-hdmx-table.hh
+++ b/src/hb-ot-hdmx-table.hh
@@ -44,15 +44,15 @@ struct DeviceRecord
   struct SubsetView
   {
     const DeviceRecord *source_device_record;
-    unsigned int size_device_record;
+    unsigned int sizeDeviceRecord;
     hb_subset_plan_t *subset_plan;
 
     inline void init(const DeviceRecord *source_device_record,
-		     unsigned int size_device_record,
+		     unsigned int sizeDeviceRecord,
 		     hb_subset_plan_t   *subset_plan)
     {
       this->source_device_record = source_device_record;
-      this->size_device_record = size_device_record;
+      this->sizeDeviceRecord = sizeDeviceRecord;
       this->subset_plan = subset_plan;
     }
 
@@ -68,7 +68,7 @@ struct DeviceRecord
 
       const HBUINT8* width = &(this->source_device_record->widthsZ[gid]);
 
-      if (width < ((const HBUINT8 *) this->source_device_record) + size_device_record)
+      if (width < ((const HBUINT8 *) this->source_device_record) + sizeDeviceRecord)
 	return width;
       else
 	return nullptr;
@@ -92,8 +92,8 @@ struct DeviceRecord
       return_trace (false);
     }
 
-    this->pixel_size.set (subset_view.source_device_record->pixel_size);
-    this->max_width.set (subset_view.source_device_record->max_width);
+    this->pixelSize.set (subset_view.source_device_record->pixelSize);
+    this->maxWidth.set (subset_view.source_device_record->maxWidth);
 
     for (unsigned int i = 0; i < subset_view.len(); i++)
     {
@@ -109,16 +109,16 @@ struct DeviceRecord
     return_trace (true);
   }
 
-  inline bool sanitize (hb_sanitize_context_t *c, unsigned int size_device_record) const
+  inline bool sanitize (hb_sanitize_context_t *c, unsigned int sizeDeviceRecord) const
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
-			  c->check_range (this, size_device_record)));
+			  c->check_range (this, sizeDeviceRecord)));
   }
 
-  HBUINT8			pixel_size;   /* Pixel size for following widths (as ppem). */
-  HBUINT8			max_width;    /* Maximum width. */
-  UnsizedArrayOf<HBUINT8>	widthsZ;  /* Array of widths (numGlyphs is from the 'maxp' table). */
+  HBUINT8			pixelSize;	/* Pixel size for following widths (as ppem). */
+  HBUINT8			maxWidth;	/* Maximum width. */
+  UnsizedArrayOf<HBUINT8>	widthsZ;	/* Array of widths (numGlyphs is from the 'maxp' table). */
   public:
   DEFINE_SIZE_ARRAY (2, widthsZ);
 };
@@ -130,13 +130,13 @@ struct hdmx
 
   inline unsigned int get_size (void) const
   {
-    return min_size + num_records * size_device_record;
+    return min_size + numRecords * sizeDeviceRecord;
   }
 
   inline const DeviceRecord& operator [] (unsigned int i) const
   {
-    if (unlikely (i >= num_records)) return Null(DeviceRecord);
-    return StructAtOffset<DeviceRecord> (&this->dataZ, i * size_device_record);
+    if (unlikely (i >= numRecords)) return Null(DeviceRecord);
+    return StructAtOffset<DeviceRecord> (&this->dataZ, i * sizeDeviceRecord);
   }
 
   inline bool serialize (hb_serialize_context_t *c, const hdmx *source_hdmx, hb_subset_plan_t *plan)
@@ -146,13 +146,13 @@ struct hdmx
     if (unlikely (!c->extend_min ((*this))))  return_trace (false);
 
     this->version.set (source_hdmx->version);
-    this->num_records.set (source_hdmx->num_records);
-    this->size_device_record.set (DeviceRecord::get_size (plan->glyphs.len));
+    this->numRecords.set (source_hdmx->numRecords);
+    this->sizeDeviceRecord.set (DeviceRecord::get_size (plan->glyphs.len));
 
-    for (unsigned int i = 0; i < source_hdmx->num_records; i++)
+    for (unsigned int i = 0; i < source_hdmx->numRecords; i++)
     {
       DeviceRecord::SubsetView subset_view;
-      subset_view.init (&(*source_hdmx)[i], source_hdmx->size_device_record, plan);
+      subset_view.init (&(*source_hdmx)[i], source_hdmx->sizeDeviceRecord, plan);
 
       if (!c->start_embed<DeviceRecord> ()->serialize (c, subset_view))
 	return_trace (false);
@@ -163,7 +163,7 @@ struct hdmx
 
   static inline size_t get_subsetted_size (const hdmx *source_hdmx, hb_subset_plan_t *plan)
   {
-    return min_size + source_hdmx->num_records * DeviceRecord::get_size (plan->glyphs.len);
+    return min_size + source_hdmx->numRecords * DeviceRecord::get_size (plan->glyphs.len);
   }
 
   inline bool subset (hb_subset_plan_t *plan) const
@@ -201,15 +201,15 @@ struct hdmx
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) && version == 0 &&
-		  !hb_unsigned_mul_overflows (num_records, size_device_record) &&
-		  size_device_record >= DeviceRecord::min_size &&
+		  !hb_unsigned_mul_overflows (numRecords, sizeDeviceRecord) &&
+		  sizeDeviceRecord >= DeviceRecord::min_size &&
 		  c->check_range (this, get_size()));
   }
 
   protected:
   HBUINT16			version;		/* Table version number (0) */
-  HBUINT16			num_records;		/* Number of device records. */
-  HBUINT32			size_device_record;	/* Size of a device record, 32-bit aligned. */
+  HBUINT16			numRecords;		/* Number of device records. */
+  HBUINT32			sizeDeviceRecord;	/* Size of a device record, 32-bit aligned. */
   UnsizedArrayOf<HBUINT8>	dataZ;			/* Array of device records. */
   public:
   DEFINE_SIZE_ARRAY (8, dataZ);


More information about the HarfBuzz mailing list