Remove hb_compare_func_t
This commit is contained in:
parent
538da7496d
commit
0712e915b4
|
@ -63,8 +63,12 @@ struct hb_ot_map_t
|
|||
unsigned short auto_zwj : 1;
|
||||
hb_mask_t mask;
|
||||
|
||||
static int cmp (const lookup_map_t *a, const lookup_map_t *b)
|
||||
{ return a->index < b->index ? -1 : a->index > b->index ? 1 : 0; }
|
||||
static int cmp (const void *pa, const void *pb)
|
||||
{
|
||||
const lookup_map_t *a = (const lookup_map_t *) pa;
|
||||
const lookup_map_t *b = (const lookup_map_t *) pb;
|
||||
return a->index < b->index ? -1 : a->index > b->index ? 1 : 0;
|
||||
}
|
||||
};
|
||||
|
||||
typedef void (*pause_func_t) (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer);
|
||||
|
@ -210,9 +214,13 @@ struct hb_ot_map_builder_t
|
|||
unsigned int default_value; /* for non-global features, what should the unset glyphs take */
|
||||
unsigned int stage[2]; /* GSUB/GPOS */
|
||||
|
||||
static int cmp (const feature_info_t *a, const feature_info_t *b)
|
||||
{ return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) :
|
||||
(a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); }
|
||||
static int cmp (const void *pa, const void *pb)
|
||||
{
|
||||
const feature_info_t *a = (const feature_info_t *) pa;
|
||||
const feature_info_t *b = (const feature_info_t *) pb;
|
||||
return (a->tag != b->tag) ? (a->tag < b->tag ? -1 : 1) :
|
||||
(a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0);
|
||||
}
|
||||
};
|
||||
|
||||
struct stage_info_t {
|
||||
|
|
|
@ -89,7 +89,7 @@ struct name
|
|||
key.encodingID.set (encoding_id);
|
||||
key.languageID.set (language_id);
|
||||
key.nameID.set (name_id);
|
||||
NameRecord *match = (NameRecord *) bsearch (&key, nameRecord, count, sizeof (nameRecord[0]), (hb_compare_func_t) NameRecord::cmp);
|
||||
NameRecord *match = (NameRecord *) bsearch (&key, nameRecord, count, sizeof (nameRecord[0]), NameRecord::cmp);
|
||||
|
||||
if (!match)
|
||||
return 0;
|
||||
|
|
|
@ -879,9 +879,11 @@ static const LangTagLong ot_languages_zh[] = {
|
|||
};
|
||||
|
||||
static int
|
||||
lang_compare_first_component (const char *a,
|
||||
const char *b)
|
||||
lang_compare_first_component (const void *pa,
|
||||
const void *pb)
|
||||
{
|
||||
const char *a = (const char *) pa;
|
||||
const char *b = (const char *) pb;
|
||||
unsigned int da, db;
|
||||
const char *p;
|
||||
|
||||
|
@ -972,7 +974,7 @@ hb_ot_tag_from_language (hb_language_t language)
|
|||
const LangTag *lang_tag;
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ struct MVAR
|
|||
const VariationValueRecord *record;
|
||||
record = (VariationValueRecord *) bsearch (&tag, values,
|
||||
valueRecordCount, valueRecordSize,
|
||||
(hb_compare_func_t) tag_compare);
|
||||
tag_compare);
|
||||
if (!record)
|
||||
return 0.;
|
||||
|
||||
|
@ -85,8 +85,12 @@ struct MVAR
|
|||
}
|
||||
|
||||
protected:
|
||||
static inline int tag_compare (const hb_tag_t *a, const Tag *b)
|
||||
{ return b->cmp (*a); }
|
||||
static inline int tag_compare (const void *pa, const void *pb)
|
||||
{
|
||||
const hb_tag_t *a = (const hb_tag_t *) pa;
|
||||
const Tag *b = (const Tag *) pb;
|
||||
return b->cmp (*a);
|
||||
}
|
||||
|
||||
protected:
|
||||
FixedVersion<>version; /* Version of the metrics variation table
|
||||
|
|
|
@ -372,11 +372,6 @@ _hb_unsigned_int_mul_overflows (unsigned int count, unsigned int size)
|
|||
}
|
||||
|
||||
|
||||
/* Type of bsearch() / qsort() compare function */
|
||||
typedef int (*hb_compare_func_t) (const void *, const void *);
|
||||
|
||||
|
||||
|
||||
|
||||
/* arrays and maps */
|
||||
|
||||
|
@ -480,12 +475,12 @@ struct hb_prealloced_array_t
|
|||
|
||||
inline void qsort (void)
|
||||
{
|
||||
::qsort (array, len, sizeof (Type), (hb_compare_func_t) Type::cmp);
|
||||
::qsort (array, len, sizeof (Type), Type::cmp);
|
||||
}
|
||||
|
||||
inline void qsort (unsigned int start, unsigned int end)
|
||||
{
|
||||
::qsort (array + start, end - start, sizeof (Type), (hb_compare_func_t) Type::cmp);
|
||||
::qsort (array + start, end - start, sizeof (Type), Type::cmp);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
Loading…
Reference in New Issue