summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-array.hh
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-08-20 10:31:40 +0200
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-08-23 07:37:04 +0200
commitd8f815db7f5eb2bdfb911dbf6d28da17c0a47025 (patch)
tree61c296bd8e694ef8e6d238d93fb9835ff5bea939 /src/3rdparty/harfbuzz-ng/src/hb-array.hh
parentd07742f333df89dc399fc5d9cabf2bdef0b346c5 (diff)
Update Harfbuzz to version 2.9.0
[ChangeLog][Text] Updated bundled Harfbuzz to version 2.9.0. Pick-to: 6.2 Change-Id: Ib8fed753b99a127d5a4cc793c5c1d55a0090f902 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-array.hh')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-array.hh51
1 files changed, 35 insertions, 16 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-array.hh b/src/3rdparty/harfbuzz-ng/src/hb-array.hh
index 02bd8d81c2..ab0dd6ebe3 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-array.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-array.hh
@@ -36,6 +36,14 @@
template <typename Type>
struct hb_sorted_array_t;
+enum hb_not_found_t
+{
+ HB_NOT_FOUND_DONT_STORE,
+ HB_NOT_FOUND_STORE,
+ HB_NOT_FOUND_STORE_CLOSEST,
+};
+
+
template <typename Type>
struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
{
@@ -139,7 +147,9 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
return lfind (x, &i) ? &this->arrayZ[i] : not_found;
}
template <typename T>
- bool lfind (const T &x, unsigned *pos = nullptr) const
+ bool lfind (const T &x, unsigned *pos = nullptr,
+ hb_not_found_t not_found = HB_NOT_FOUND_DONT_STORE,
+ unsigned int to_store = (unsigned int) -1) const
{
for (unsigned i = 0; i < length; ++i)
if (hb_equal (x, this->arrayZ[i]))
@@ -149,6 +159,22 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
return true;
}
+ if (pos)
+ {
+ switch (not_found)
+ {
+ case HB_NOT_FOUND_DONT_STORE:
+ break;
+
+ case HB_NOT_FOUND_STORE:
+ *pos = to_store;
+ break;
+
+ case HB_NOT_FOUND_STORE_CLOSEST:
+ *pos = length;
+ break;
+ }
+ }
return false;
}
@@ -219,7 +245,7 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
unsigned P = sizeof (Type),
hb_enable_if (P == 1)>
const T *as () const
- { return length < hb_null_size (T) ? &Null (T) : reinterpret_cast<const T *> (arrayZ); }
+ { return length < hb_min_size (T) ? &Null (T) : reinterpret_cast<const T *> (arrayZ); }
template <typename T,
unsigned P = sizeof (Type),
@@ -231,9 +257,9 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
&& (unsigned int) (arrayZ + length - (const char *) p) >= size;
}
- /* Only call if you allocated the underlying array using malloc() or similar. */
- void free ()
- { ::free ((void *) arrayZ); arrayZ = nullptr; length = 0; }
+ /* Only call if you allocated the underlying array using hb_malloc() or similar. */
+ void fini ()
+ { hb_free ((void *) arrayZ); arrayZ = nullptr; length = 0; }
template <typename hb_serialize_context_t>
hb_array_t copy (hb_serialize_context_t *c) const
@@ -266,13 +292,6 @@ template <typename T, unsigned int length_> inline hb_array_t<T>
hb_array (T (&array_)[length_])
{ return hb_array_t<T> (array_); }
-enum hb_bfind_not_found_t
-{
- HB_BFIND_NOT_FOUND_DONT_STORE,
- HB_BFIND_NOT_FOUND_STORE,
- HB_BFIND_NOT_FOUND_STORE_CLOSEST,
-};
-
template <typename Type>
struct hb_sorted_array_t :
hb_iter_t<hb_sorted_array_t<Type>, Type&>,
@@ -323,7 +342,7 @@ struct hb_sorted_array_t :
}
template <typename T>
bool bfind (const T &x, unsigned int *i = nullptr,
- hb_bfind_not_found_t not_found = HB_BFIND_NOT_FOUND_DONT_STORE,
+ hb_not_found_t not_found = HB_NOT_FOUND_DONT_STORE,
unsigned int to_store = (unsigned int) -1) const
{
unsigned pos;
@@ -339,14 +358,14 @@ struct hb_sorted_array_t :
{
switch (not_found)
{
- case HB_BFIND_NOT_FOUND_DONT_STORE:
+ case HB_NOT_FOUND_DONT_STORE:
break;
- case HB_BFIND_NOT_FOUND_STORE:
+ case HB_NOT_FOUND_STORE:
*i = to_store;
break;
- case HB_BFIND_NOT_FOUND_STORE_CLOSEST:
+ case HB_NOT_FOUND_STORE_CLOSEST:
*i = pos;
break;
}