From 4e573715ae5f5ed486ad66382bb44c47a86591ff Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 28 Sep 2010 16:23:58 -0400 Subject: [PATCH] Improve cmp function parameter namings and casts No semantic change. --- src/hb-open-type-private.hh | 6 +++--- src/hb-ot-layout-common-private.hh | 6 +++--- src/hb-ot-shape.cc | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index ae01ef9..62a7c88 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -397,7 +397,7 @@ struct IntType inline operator Type(void) const { return v; } inline bool operator == (const IntType &o) const { return v == o.v; } inline bool operator != (const IntType &o) const { return v != o.v; } - inline int cmp (Type b) const { Type a = v; return b < a ? -1 : b == a ? 0 : +1; } + inline int cmp (Type a) const { Type b = v; return a < b ? -1 : a == b ? 0 : +1; } inline bool sanitize (hb_sanitize_context_t *c) { TRACE_SANITIZE (); return likely (c->check_struct (this)); @@ -719,8 +719,8 @@ struct SortedArrayOf : ArrayOf { inline int search (const SearchType &x) const { class Cmp { public: static int cmp (const void *p1, const void *p2) { - const SearchType *a = (const SearchType *) p1; - const Type *b = (const Type *) p2; + const SearchType *a = reinterpret_cast(p1); + const Type *b = reinterpret_cast(p2); return b->cmp (*a); } }; diff --git a/src/hb-ot-layout-common-private.hh b/src/hb-ot-layout-common-private.hh index ded683d..5db8f67 100644 --- a/src/hb-ot-layout-common-private.hh +++ b/src/hb-ot-layout-common-private.hh @@ -56,9 +56,9 @@ HB_END_DECLS template struct Record { - inline int cmp (hb_tag_t b) const { - hb_tag_t a = tag; - return b < a ? -1 : b == a ? 0 : +1; + inline int cmp (hb_tag_t a) const { + hb_tag_t b = tag; + return a < b ? -1 : a == b ? 0 : +1; } inline bool sanitize (hb_sanitize_context_t *c, void *base) { diff --git a/src/hb-ot-shape.cc b/src/hb-ot-shape.cc index 34ac89b..4173942 100644 --- a/src/hb-ot-shape.cc +++ b/src/hb-ot-shape.cc @@ -105,8 +105,8 @@ struct hb_mask_allocator_t { static int cmp (const void *p1, const void *p2) { - const feature_info_t *a = (const feature_info_t *) p1; - const feature_info_t *b = (const feature_info_t *) p2; + const feature_info_t *a = reinterpret_cast(p1); + const feature_info_t *b = reinterpret_cast(p2); if (a->tag != b->tag) return a->tag < b->tag ? -1 : 1; @@ -124,8 +124,8 @@ struct hb_mask_allocator_t { static int cmp (const void *p1, const void *p2) { - const feature_map_t *a = (const feature_map_t *) p1; - const feature_map_t *b = (const feature_map_t *) p2; + const feature_map_t *a = reinterpret_cast(p1); + const feature_map_t *b = reinterpret_cast(p2); return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0; } -- 2.7.4