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<const LangTag>::bfind<const char *, unsigned int>' requested here
    if (hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_str, &tag_idx,
                                                         ^
1 error generated.
This commit is contained in:
Behdad Esfahbod 2022-05-17 15:28:50 -06:00
parent c1f4b57c06
commit 1c8226ed14
2 changed files with 5 additions and 8 deletions

View File

@ -346,21 +346,20 @@ struct hb_sorted_array_t :
unsigned int i; unsigned int i;
return bfind (x, &i) ? &this->arrayZ[i] : not_found; return bfind (x, &i) ? &this->arrayZ[i] : not_found;
} }
template <typename T> template <typename T, typename ...Ts>
const Type *bsearch (const T &x, const Type *not_found = nullptr) const const Type *bsearch (const T &x, const Type *not_found = nullptr) const
{ {
unsigned int i; unsigned int i;
return bfind (x, &i) ? &this->arrayZ[i] : not_found; return bfind (x, &i) ? &this->arrayZ[i] : not_found;
} }
template <typename T, typename ...Ts> template <typename T>
bool bfind (const T &x, unsigned int *i = nullptr, bool bfind (const T &x, unsigned int *i = nullptr,
hb_not_found_t not_found = HB_NOT_FOUND_DONT_STORE, hb_not_found_t not_found = HB_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1, unsigned int to_store = (unsigned int) -1) const
Ts... ds) const
{ {
unsigned pos; unsigned pos;
if (bsearch_impl (x, &pos, ds...)) if (bsearch_impl (x, &pos))
{ {
if (i) if (i)
*i = pos; *i = pos;

View File

@ -289,9 +289,7 @@ hb_ot_tags_from_language (const char *lang_str,
ot_languages = ot_languages3; ot_languages = ot_languages3;
ot_languages_len = ARRAY_LENGTH (ot_languages3); ot_languages_len = ARRAY_LENGTH (ot_languages3);
} }
if (hb_sorted_array (ot_languages, ot_languages_len).bfind (lang_str, &tag_idx, if (hb_sorted_array (ot_languages, ot_languages_len).bsearch_impl (lang_str, &tag_idx, first_len))
HB_NOT_FOUND_DONT_STORE, (unsigned) -1,
first_len))
{ {
unsigned int i; unsigned int i;
while (tag_idx != 0 && while (tag_idx != 0 &&