src/hb-coretext.cc | 2 +- src/hb-open-type-private.hh | 2 ++ src/hb-ot-cmap-table.hh | 4 ++-- src/hb-ot-layout-common-private.hh | 13 +++---------- src/hb-private.hh | 13 +++++++++++++ src/hb-uniscribe.cc | 12 ++++++------ 6 files changed, 27 insertions(+), 19 deletions(-)
New commits: commit e99d75ea9c4fe1f64d7f8408093741a682ed5243 Author: Behdad Esfahbod <[email protected]> Date: Wed May 9 15:28:30 2018 -0700 Fix warning diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 196b2cb7..67d20f1f 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -191,7 +191,7 @@ struct CmapSubtableFormat4 } if (!segment - || cp != segment->end_code + 1) + || cp != segment->end_code + 1u) { segment = segments->push (); segment->start_code.set (cp); @@ -199,7 +199,7 @@ struct CmapSubtableFormat4 segment->use_delta = true; } else { segment->end_code.set (cp); - if (last_gid + 1 != new_gid) + if (last_gid + 1u != new_gid) // gid's are not consecutive in this segment so delta // cannot be used. segment->use_delta = false; commit 191c4edc5423017d9123d291462fbfa87a805218 Author: Behdad Esfahbod <[email protected]> Date: Wed May 9 15:27:17 2018 -0700 Reinstante DEFINE_NULL_DATA Seems like I messed up; buffer overrun got reported. diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index 0dfe0117..1c771b09 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -685,6 +685,7 @@ struct Tag : HBUINT32 public: DEFINE_SIZE_STATIC (4); }; +DEFINE_NULL_DATA (OT, Tag, " "); /* Glyph index number, same as uint16 (length = 16 bits) */ typedef HBUINT16 GlyphID; @@ -696,6 +697,7 @@ typedef HBUINT16 NameID; struct Index : HBUINT16 { static const unsigned int NOT_FOUND_INDEX = 0xFFFFu; }; +DEFINE_NULL_DATA (OT, Index, "\xff\xff"); /* Offset, Null offset = 0 */ template <typename Type> diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index 66e35110..763ea92f 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -165,6 +165,7 @@ struct RangeRecord public: DEFINE_SIZE_STATIC (6); }; +DEFINE_NULL_DATA (OT, RangeRecord, "\000\001"); struct IndexArray : ArrayOf<Index> @@ -224,6 +225,7 @@ struct LangSys public: DEFINE_SIZE_ARRAY (6, featureIndex); }; +DEFINE_NULL_DATA (OT, LangSys, "\0\0\xFF\xFF"); struct Script @@ -245,16 +247,7 @@ struct Script { return langSys.find_index (tag, index); } inline bool has_default_lang_sys (void) const { return defaultLangSys != 0; } - inline const LangSys& get_default_lang_sys (void) const - { - if (!defaultLangSys) - { - /* This is the ONLY place where our null data is not all zeros. - * So, return special data instead of using the null pool. */ - return *reinterpret_cast<const LangSys *> ("\0\0\xFF\xFF"); - } - return this+defaultLangSys; - } + inline const LangSys& get_default_lang_sys (void) const { return this+defaultLangSys; } inline bool sanitize (hb_sanitize_context_t *c, const Record<Script>::sanitize_closure_t * = nullptr) const diff --git a/src/hb-private.hh b/src/hb-private.hh index a31e4799..0dd9539f 100644 --- a/src/hb-private.hh +++ b/src/hb-private.hh @@ -1117,5 +1117,18 @@ static inline const Type& Null (void) { } #define Null(Type) Null<Type>() +/* Specializaiton for arbitrary-content arbitrary-sized Null objects. */ +#define DEFINE_NULL_DATA(Namespace, Type, data) \ +} /* Close namespace. */ \ +static const char _Null##Type[sizeof (Namespace::Type) + 1] = data; /* +1 is for nul-termination in data */ \ +template <> \ +/*static*/ inline const Namespace::Type& Null<Namespace::Type> (void) { \ + return *reinterpret_cast<const Namespace::Type *> (_Null##Type); \ +} \ +namespace Namespace { \ +/* The following line really exists such that we end in a place needing semicolon */ \ +static_assert (Namespace::Type::min_size + 1 <= sizeof (_Null##Type), "Null pool too small. Enlarge.") + + #endif /* HB_PRIVATE_HH */ commit 93bdf9b2dfe18af0f1aa93b890f0be260f31d90e Author: Ebrahim Byagowi <[email protected]> Date: Wed May 9 23:24:17 2018 +0430 Use arrayZ on hb-coretext and hb-uniscribe and fix macOS/Win bots (#1024) Following to 63f57f4 diff --git a/src/hb-coretext.cc b/src/hb-coretext.cc index 837b3fb7..3924c8eb 100644 --- a/src/hb-coretext.cc +++ b/src/hb-coretext.cc @@ -777,7 +777,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.array); + active_features.remove (feature - active_features.arrayZ); } } } diff --git a/src/hb-uniscribe.cc b/src/hb-uniscribe.cc index bc6667c3..3cd419e8 100644 --- a/src/hb-uniscribe.cc +++ b/src/hb-uniscribe.cc @@ -726,7 +726,7 @@ _hb_uniscribe_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.array); + active_features.remove (feature - active_features.arrayZ); } } @@ -737,7 +737,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.array + reinterpret_cast<uintptr_t> (range->props.potfRecords); + range->props.potfRecords = feature_records.arrayZ + reinterpret_cast<uintptr_t> (range->props.potfRecords); } } else @@ -916,8 +916,8 @@ retry: &items[i].a, script_tags[i], language_tag, - range_char_counts.array, - range_properties.array, + range_char_counts.arrayZ, + range_properties.arrayZ, range_properties.len, pchars + chars_offset, item_chars_len, @@ -957,8 +957,8 @@ retry: &items[i].a, script_tags[i], language_tag, - range_char_counts.array, - range_properties.array, + range_char_counts.arrayZ, + range_properties.arrayZ, range_properties.len, pchars + chars_offset, log_clusters + chars_offset, _______________________________________________ HarfBuzz mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/harfbuzz
