From 1c8226ed14c1ac7d82ea5482bdf2a7d019dd38a2 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 17 May 2022 15:28:50 -0600 Subject: [PATCH] Fix compiler warning On Mac compiler: FAILED: src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o c++ -Isrc/libharfbuzz.0.dylib.p -Isrc -I../src -I. -I.. -I/usr/local/opt/freetype/include/freetype2 -I/usr/local/Cellar/graphite2/1.3.14/include -I/usr/local/Cellar/glib/2.72.1/include/glib-2.0 -I/usr/local/Cellar/glib/2.72.1/lib/glib-2.0/include -I/usr/local/opt/gettext/include -I/usr/local/Cellar/pcre/8.45/include -Xclang -fcolor-diagnostics --coverage -pipe -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -fno-rtti -O2 -g -fno-exceptions -fno-rtti -fno-threadsafe-statics -fvisibility-inlines-hidden -DHAVE_CONFIG_H -Wno-non-virtual-dtor -MD -MQ src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o -MF src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o.d -o src/libharfbuzz.0.dylib.p/hb-ot-tag.cc.o -c ../src/hb-ot-tag.cc In file included from ../src/hb-ot-tag.cc:29: In file included from ../src/hb.hh:481: ../src/hb-array.hh:359:14: error: missing default argument on parameter 'ds' Ts... ds) const ^ ../src/hb-ot-tag.cc:292:58: note: in instantiation of function template specialization 'hb_sorted_array_t::bfind' requested here if (hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_str, &tag_idx, ^ 1 error generated. --- src/hb-array.hh | 9 ++++----- src/hb-ot-tag.cc | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/hb-array.hh b/src/hb-array.hh index fc6e52b1d..417ffd5be 100644 --- a/src/hb-array.hh +++ b/src/hb-array.hh @@ -346,21 +346,20 @@ struct hb_sorted_array_t : unsigned int i; return bfind (x, &i) ? &this->arrayZ[i] : not_found; } - template + template const Type *bsearch (const T &x, const Type *not_found = nullptr) const { unsigned int i; return bfind (x, &i) ? &this->arrayZ[i] : not_found; } - template + template bool bfind (const T &x, unsigned int *i = nullptr, hb_not_found_t not_found = HB_NOT_FOUND_DONT_STORE, - unsigned int to_store = (unsigned int) -1, - Ts... ds) const + unsigned int to_store = (unsigned int) -1) const { unsigned pos; - if (bsearch_impl (x, &pos, ds...)) + if (bsearch_impl (x, &pos)) { if (i) *i = pos; diff --git a/src/hb-ot-tag.cc b/src/hb-ot-tag.cc index 31dd7c544..980a88583 100644 --- a/src/hb-ot-tag.cc +++ b/src/hb-ot-tag.cc @@ -289,9 +289,7 @@ hb_ot_tags_from_language (const char *lang_str, ot_languages = ot_languages3; ot_languages_len = ARRAY_LENGTH (ot_languages3); } - if (hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_str, &tag_idx, - HB_NOT_FOUND_DONT_STORE, (unsigned) -1, - first_len)) + if (hb_sorted_array (ot_languages, ot_languages_len).bsearch_impl (lang_str, &tag_idx, first_len)) { unsigned int i; while (tag_idx != 0 &&