From 22e1857b01c71714245ddca05cb3fa0127bf7da2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 24 Nov 2018 00:53:19 -0500 Subject: [PATCH] [arrays] Change argument type of cmp called by hb_vector_t.bsearch() Towards consolidating all array bsearch/... --- src/hb-aat-map.hh | 4 ++-- src/hb-ot-map.hh | 4 ++-- src/hb-set.hh | 2 +- src/hb-vector.hh | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/hb-aat-map.hh b/src/hb-aat-map.hh index 07454b2c1..7d85c7c38 100644 --- a/src/hb-aat-map.hh +++ b/src/hb-aat-map.hh @@ -77,9 +77,9 @@ struct hb_aat_map_builder_t (a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0); } - int cmp (const short unsigned int *ty) const + int cmp (unsigned int ty) const { - return (type != *ty) ? (type < *ty ? -1 : 1) : 0; + return (type != ty) ? (type < ty ? -1 : 1) : 0; } }; diff --git a/src/hb-ot-map.hh b/src/hb-ot-map.hh index 8e1f5aa8c..0a5a4fbcb 100644 --- a/src/hb-ot-map.hh +++ b/src/hb-ot-map.hh @@ -57,8 +57,8 @@ struct hb_ot_map_t unsigned int auto_zwj : 1; unsigned int random : 1; - inline int cmp (const hb_tag_t *tag_) const - { return *tag_ < tag ? -1 : *tag_ > tag ? 1 : 0; } + inline int cmp (const hb_tag_t tag_) const + { return tag_ < tag ? -1 : tag_ > tag ? 1 : 0; } }; struct lookup_map_t { diff --git a/src/hb-set.hh b/src/hb-set.hh index cc061a7c8..a464131d4 100644 --- a/src/hb-set.hh +++ b/src/hb-set.hh @@ -45,7 +45,7 @@ struct hb_set_t struct page_map_t { - inline int cmp (const page_map_t *o) const { return (int) o->major - (int) major; } + inline int cmp (const page_map_t &o) const { return (int) o.major - (int) major; } uint32_t major; uint32_t index; diff --git a/src/hb-vector.hh b/src/hb-vector.hh index b30511d8e..436b92bbc 100644 --- a/src/hb-vector.hh +++ b/src/hb-vector.hh @@ -267,7 +267,7 @@ struct hb_vector_t while (min <= max) { int mid = ((unsigned int) min + (unsigned int) max) / 2; - int c = array[mid].cmp (&x); + int c = array[mid].cmp (x); if (c < 0) max = mid - 1; else if (c > 0) @@ -281,7 +281,7 @@ struct hb_vector_t } if (i) { - if (max < 0 || (max < (int) this->len && array[max].cmp (&x) > 0)) + if (max < 0 || (max < (int) this->len && array[max].cmp (x) > 0)) max++; *i = max; }