[HarfBuzz] harfbuzz: Branch 'master' - 3 commits
Behdad Esfahbod
behdad at kemper.freedesktop.org
Sat Nov 10 21:36:01 UTC 2018
src/hb-dsalgs.hh | 5 ++++-
src/hb-open-type.hh | 12 ++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
New commits:
commit b4c61130324455bfd42095b01fa14ac901e441f1
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Nov 10 16:35:39 2018 -0500
Try fixing MSVC 2008 build
Fixes https://github.com/harfbuzz/harfbuzz/issues/1374
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 6d6dd7b2..56fa4334 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -337,8 +337,16 @@ struct UnsizedArrayOf
{
HB_NO_CREATE_COPY_ASSIGN_TEMPLATE (UnsizedArrayOf, Type);
- inline const Type& operator [] (unsigned int i) const { return arrayZ[i]; }
- inline Type& operator [] (unsigned int i) { return arrayZ[i]; }
+ /* Unlikely other places, use "int i" instead of "unsigned int i" for our
+ * indexing operator. For two reasons:
+ * 1. For UnsizedArrayOf, it's not totally unimaginable to want to look
+ * at items before the start of current array.
+ * 2. Fixes MSVC 2008 "overloads have similar conversions" issue with the
+ * built-in operator [] that takes int, in expressions like sizeof(array[0])).
+ * I suppose I could fix that by replacing 0 with 0u, but like this fix
+ * more now. */
+ inline const Type& operator [] (int i) const { return arrayZ[i]; }
+ inline Type& operator [] (int i) { return arrayZ[i]; }
template <typename T> inline operator T * (void) { return arrayZ; }
template <typename T> inline operator const T * (void) const { return arrayZ; }
commit f2e942f3023e3c5cb3e732ee7b4782b3df170a85
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Nov 10 16:11:14 2018 -0500
Fix hb_bytes_t's unused template array constructor
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index 9b9cb5f4..2540d438 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -524,7 +524,7 @@ struct hb_bytes_t
inline hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {}
inline hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {}
template <typename T>
- inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len) {}
+ inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len * sizeof (array.arrayZ[0])) {}
inline operator const void * (void) const { return arrayZ; }
inline operator const char * (void) const { return arrayZ; }
commit 6213a75b68825037fbaf6f5ad4eef66e8bad4b3c
Author: Behdad Esfahbod <behdad at behdad.org>
Date: Sat Nov 10 16:09:21 2018 -0500
Add trivial casts to hb_bytes_t
diff --git a/src/hb-dsalgs.hh b/src/hb-dsalgs.hh
index ce134260..9b9cb5f4 100644
--- a/src/hb-dsalgs.hh
+++ b/src/hb-dsalgs.hh
@@ -526,6 +526,9 @@ struct hb_bytes_t
template <typename T>
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len) {}
+ inline operator const void * (void) const { return arrayZ; }
+ inline operator const char * (void) const { return arrayZ; }
+
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
inline int cmp (const hb_bytes_t &a) const
More information about the HarfBuzz
mailing list