--- src/hb-object-private.hh +++ src/hb-object-private.hh @@ -131,7 +131,7 @@ } inline bool destroy (void) { - if (unlikely (!this || this->is_inert ())) + if (unlikely (is_inert ())) return false; if (ref_count.dec () != 1) return false; @@ -160,13 +160,12 @@ } inline void trace (const char *function) const { - if (unlikely (!this)) return; /* TODO We cannot use DEBUG_MSG_FUNC here since that one currently only * prints the class name and throws away the template info. */ DEBUG_MSG (OBJECT, (void *) this, "%s refcount=%d", function, - this ? ref_count.ref_count : 0); + ref_count.ref_count); } private: @@ -179,7 +179,7 @@ template static inline void hb_object_trace (const Type *obj, const char *function) { - obj->header.trace (function); + if (likely (obj)) obj->header.trace (function); } template static inline Type *hb_object_create (void) @@ -204,7 +204,7 @@ static inline bool hb_object_destroy (Type *obj) { hb_object_trace (obj, HB_FUNC); - return obj->header.destroy (); + return likely (obj) && obj->header.destroy (); } template static inline bool hb_object_set_user_data (Type *obj, --- src/hb-ot-map-private.hh +++ src/hb-ot-map-private.hh @@ -52,8 +52,12 @@ unsigned int needs_fallback : 1; unsigned int auto_zwj : 1; - static int cmp (const feature_map_t *a, const feature_map_t *b) - { return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; } + static int cmp (const void *va, const void *vb) + { + const feature_map_t *a = static_cast(va); + const feature_map_t *b = static_cast(vb); + return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; + } }; struct lookup_map_t { --- src/hb-ot-tag.cc +++ src/hb-ot-tag.cc @@ -591,9 +591,11 @@ }; static int -lang_compare_first_component (const char *a, - const char *b) +lang_compare_first_component (const void *va, + const void *vb) { + const char *a = static_cast(va); + const char *b = static_cast(vb); unsigned int da, db; const char *p; @@ -641,7 +643,7 @@ /* Find a language matching in the first component */ lang_tag = (LangTag *) bsearch (lang_str, ot_languages, ARRAY_LENGTH (ot_languages), sizeof (LangTag), - (hb_compare_func_t) lang_compare_first_component); + lang_compare_first_component); if (lang_tag) return lang_tag->tag;