Improve cmp function parameter namings and casts
No semantic change.
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 @@
inline operator Type(void) const { return v; }
inline bool operator == (const IntType<Type> &o) const { return v == o.v; }
inline bool operator != (const IntType<Type> &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 @@
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<const SearchType *>(p1);
+ const Type *b = reinterpret_cast<const Type *>(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 @@
template <typename Type>
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 @@
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<const feature_info_t *>(p1);
+ const feature_info_t *b = reinterpret_cast<const feature_info_t *>(p2);
if (a->tag != b->tag)
return a->tag < b->tag ? -1 : 1;
@@ -124,8 +124,8 @@
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<const feature_map_t *>(p1);
+ const feature_map_t *b = reinterpret_cast<const feature_map_t *>(p2);
return a->tag < b->tag ? -1 : a->tag > b->tag ? 1 : 0;
}