Improve cmp function parameter namings and casts

No semantic change.
This commit is contained in:
Behdad Esfahbod 2010-09-28 16:23:58 -04:00
parent dca8aff246
commit 4e573715ae
3 changed files with 10 additions and 10 deletions

View File

@ -397,7 +397,7 @@ struct IntType
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 @@ struct SortedArrayOf : ArrayOf<Type> {
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);
}
};

View File

@ -56,9 +56,9 @@ HB_END_DECLS
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) {

View File

@ -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<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 @@ 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<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;
}