From 861bc75349257f74c12b261abfcd5ab9e2f04863 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 29 Nov 2018 14:34:44 -0500 Subject: [PATCH] [vector] Make pointer cast explicit Too bad this doesn't help MSVC 2008 build, as explicit operators are C++11. --- src/hb-machinery.hh | 2 +- src/hb-ot-cmap-table.hh | 3 ++- src/hb-set.hh | 4 ++-- src/hb-subset.cc | 2 +- src/hb-vector.hh | 4 ++-- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 39e962936..5f3d153e9 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -658,7 +658,7 @@ struct Supplier } inline Supplier (const hb_vector_t *v) { - head = *v; + head = (const Type *) *v; len = v->len; stride = sizeof (Type); } diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index cdc610be3..a2e611c95 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -495,7 +495,8 @@ struct CmapSubtableLongSegmented { TRACE_SERIALIZE (this); if (unlikely (!c->extend_min (*this))) return_trace (false); - Supplier supplier (group_data, group_data.len); + Supplier supplier ((const OT::CmapSubtableLongGroup*) 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 100bdb2ac..a3beeef1a 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -375,8 +375,8 @@ struct hb_set_t if (!resize (count)) return; population = other->population; - memcpy (pages, other->pages, count * pages.item_size); - memcpy (page_map, other->page_map, count * page_map.item_size); + memcpy ((void *) pages, (const void *) other->pages, count * pages.item_size); + memcpy ((void *) page_map, (const void *) other->page_map, count * page_map.item_size); } inline bool is_equal (const hb_set_t *other) const diff --git a/src/hb-subset.cc b/src/hb-subset.cc index a3917b862..14d4774c3 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, buf_size); + hb_serialize_context_t serializer ((void *) 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-vector.hh b/src/hb-vector.hh index 787512f92..313c24c41 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -101,8 +101,8 @@ struct hb_vector_t inline hb_sorted_array_t as_sorted_array (void) const { return hb_sorted_array (arrayZ(), len); } - template inline operator T * (void) { return arrayZ(); } - template inline operator const T * (void) const { return arrayZ(); } + template explicit_operator inline operator T * (void) { return arrayZ(); } + template explicit_operator 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; }