src/hb-open-type-private.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
New commits: commit 4a27c17ea0234dfe33e62f5830d9f92c26d48d30 Author: Behdad Esfahbod <beh...@behdad.org> Date: Fri Oct 27 14:29:12 2017 -0600 Fix IntType.cmp() to avoid narrowing down integer types Fixes https://github.com/behdad/harfbuzz/issues/571 diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh index f25341a8..f0ff2ff5 100644 --- a/src/hb-open-type-private.hh +++ b/src/hb-open-type-private.hh @@ -632,10 +632,11 @@ struct IntType inline bool operator == (const IntType<Type,Size> &o) const { return (Type) v == (Type) o.v; } inline bool operator != (const IntType<Type,Size> &o) const { return !(*this == o); } static inline int cmp (const IntType<Type,Size> *a, const IntType<Type,Size> *b) { return b->cmp (*a); } - inline int cmp (Type a) const + template <typename Type2> + inline int cmp (Type2 a) const { Type b = v; - if (sizeof (Type) < sizeof (int)) + if (sizeof (Type) < sizeof (int) && sizeof (Type2) < sizeof (int)) return (int) a - (int) b; else return a < b ? -1 : a == b ? 0 : +1; _______________________________________________ HarfBuzz mailing list HarfBuzz@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/harfbuzz