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

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Oct 25 23:51:33 UTC 2018


 src/hb-coretext.cc      |    2 +-
 src/hb-machinery.hh     |    2 +-
 src/hb-ot-cmap-table.hh |    2 +-
 src/hb-set.hh           |    8 +++++---
 src/hb-subset.cc        |    2 +-
 src/hb-uniscribe.cc     |   12 ++++++------
 src/hb-vector.hh        |    6 ++++++
 7 files changed, 21 insertions(+), 13 deletions(-)

New commits:
commit 955aa56b11e4fa14bc6d5b1b56cb810e28fab6cd
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 16:50:38 2018 -0700

    [vector] Make it act more like pointer
    
    Add pointer cast operator and plus operator.

diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc
index 9f7745db..54e3f9cc 100644
--- a/src/hb-coretext.cc
+++ b/src/hb-coretext.cc
@@ -586,7 +586,7 @@ _hb_coretext_shape (hb_shape_plan_t    *shape_plan,
       } else {
         active_feature_t *feature = active_features.find (&event->feature);
 	if (feature)
-	  active_features.remove (feature - active_features.arrayZ());
+	  active_features.remove (feature - active_features);
       }
     }
   }
diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh
index 19245e89..35cbc155 100644
--- a/src/hb-machinery.hh
+++ b/src/hb-machinery.hh
@@ -612,7 +612,7 @@ struct Supplier
   }
   inline Supplier (const hb_vector_t<Type> *v)
   {
-    head = v->arrayZ();
+    head = *v;
     len = v->len;
     stride = sizeof (Type);
   }
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 9978d1b0..d5b4fde3 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -495,7 +495,7 @@ struct CmapSubtableLongSegmented
   {
     TRACE_SERIALIZE (this);
     if (unlikely (!c->extend_min (*this))) return_trace (false);
-    Supplier<CmapSubtableLongGroup> supplier (group_data.arrayZ(), group_data.len);
+    Supplier<CmapSubtableLongGroup> supplier (group_data, group_data.len);
     if (unlikely (!groups.serialize (c, supplier, group_data.len))) return_trace (false);
     return true;
   }
diff --git a/src/hb-set.hh b/src/hb-set.hh
index 4a7e74b6..2071196b 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -368,8 +368,8 @@ struct hb_set_t
     if (!resize (count))
       return;
     population = other->population;
-    memcpy (pages.arrayZ(), other->pages.arrayZ(), count * sizeof (pages[0]));
-    memcpy (page_map.arrayZ(), other->page_map.arrayZ(), count * sizeof (page_map[0]));
+    memcpy (pages, other->pages, count * sizeof (pages[0]));
+    memcpy (page_map, other->page_map, count * sizeof (page_map[0]));
   }
 
   inline bool is_equal (const hb_set_t *other) const
@@ -669,8 +669,8 @@ struct hb_set_t
 	return nullptr;
 
       pages[map.index].init0 ();
-      memmove (page_map.arrayZ() + i + 1,
-	       page_map.arrayZ() + i,
+      memmove (page_map + i + 1,
+	       page_map + i,
 	       (page_map.len - 1 - i) * sizeof (page_map[0]));
       page_map[i] = map;
     }
diff --git a/src/hb-subset.cc b/src/hb-subset.cc
index 9f14b89b..294fd846 100644
--- a/src/hb-subset.cc
+++ b/src/hb-subset.cc
@@ -77,7 +77,7 @@ _subset2 (hb_subset_plan_t *plan)
       return false;
     }
   retry:
-    hb_serialize_context_t serializer (buf.arrayZ(), buf_size);
+    hb_serialize_context_t serializer (buf, buf_size);
     hb_subset_context_t c (plan, &serializer);
     result = table->subset (&c);
     if (serializer.ran_out_of_room)
diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc
index 44a67ae4..c3949c98 100644
--- a/src/hb-uniscribe.cc
+++ b/src/hb-uniscribe.cc
@@ -717,7 +717,7 @@ _hb_uniscribe_shape (hb_shape_plan_t    *shape_plan,
       {
         active_feature_t *feature = active_features.find (&event->feature);
 	if (feature)
-	  active_features.remove (feature - active_features.arrayZ());
+	  active_features.remove (feature - active_features);
       }
     }
 
@@ -728,7 +728,7 @@ _hb_uniscribe_shape (hb_shape_plan_t    *shape_plan,
     for (unsigned int i = 0; i < range_records.len; i++)
     {
       range_record_t *range = &range_records[i];
-      range->props.potfRecords = feature_records.arrayZ() + reinterpret_cast<uintptr_t> (range->props.potfRecords);
+      range->props.potfRecords = feature_records + reinterpret_cast<uintptr_t> (range->props.potfRecords);
     }
   }
 
@@ -902,8 +902,8 @@ retry:
 				     &items[i].a,
 				     script_tags[i],
 				     language_tag,
-				     range_char_counts.arrayZ(),
-				     range_properties.arrayZ(),
+				     range_char_counts,
+				     range_properties,
 				     range_properties.len,
 				     pchars + chars_offset,
 				     item_chars_len,
@@ -943,8 +943,8 @@ retry:
 				     &items[i].a,
 				     script_tags[i],
 				     language_tag,
-				     range_char_counts.arrayZ(),
-				     range_properties.arrayZ(),
+				     range_char_counts,
+				     range_properties,
 				     range_properties.len,
 				     pchars + chars_offset,
 				     log_clusters + chars_offset,
diff --git a/src/hb-vector.hh b/src/hb-vector.hh
index eed4507f..8995ae10 100644
--- a/src/hb-vector.hh
+++ b/src/hb-vector.hh
@@ -66,6 +66,12 @@ struct hb_vector_t
     return arrayZ()[i];
   }
 
+  template <typename T> inline operator  T * (void) { return arrayZ(); }
+  template <typename T> inline operator const T * (void) const { return arrayZ(); }
+
+  inline Type * operator  + (unsigned int i) { return arrayZ() + i; }
+  inline const Type * operator  + (unsigned int i) const { return arrayZ() + i; }
+
   inline Type *push (void)
   {
     if (unlikely (!resize (len + 1)))
commit 8d55e2adef9a376a5cf83c20aff2dba27dd64da8
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 16:37:53 2018 -0700

    [set] Minor

diff --git a/src/hb-set.hh b/src/hb-set.hh
index 7ba4c04d..4a7e74b6 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -368,8 +368,8 @@ struct hb_set_t
     if (!resize (count))
       return;
     population = other->population;
-    memcpy (pages.arrayZ(), other->pages.arrayZ(), count * sizeof (pages.arrayZ()[0]));
-    memcpy (page_map.arrayZ(), other->page_map.arrayZ(), count * sizeof (page_map.arrayZ()[0]));
+    memcpy (pages.arrayZ(), other->pages.arrayZ(), count * sizeof (pages[0]));
+    memcpy (page_map.arrayZ(), other->page_map.arrayZ(), count * sizeof (page_map[0]));
   }
 
   inline bool is_equal (const hb_set_t *other) const
commit 64c32edfe18f5ef3b348e5c84077ee1f6faf4f48
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Oct 25 16:35:36 2018 -0700

    [set] Make array access more explicit
    
    Follow up on 94e421abbfc7ede9aaf3c8d86bb0ff9992ea3123

diff --git a/src/hb-set.hh b/src/hb-set.hh
index 5fdad2b7..7ba4c04d 100644
--- a/src/hb-set.hh
+++ b/src/hb-set.hh
@@ -669,7 +669,9 @@ struct hb_set_t
 	return nullptr;
 
       pages[map.index].init0 ();
-      memmove (&page_map[i] + 1, &page_map[i], (page_map.len - 1 - i) * sizeof (page_map[0]));
+      memmove (page_map.arrayZ() + i + 1,
+	       page_map.arrayZ() + i,
+	       (page_map.len - 1 - i) * sizeof (page_map[0]));
       page_map[i] = map;
     }
     return &pages[page_map[i].index];


More information about the HarfBuzz mailing list