提交 534e1d76 编写于 作者: B Behdad Esfahbod

Fix hb_bytes_t.cmp() for realz this time

上级 929f07db
...@@ -530,10 +530,12 @@ struct hb_bytes_t ...@@ -530,10 +530,12 @@ struct hb_bytes_t
inline int cmp (const hb_bytes_t &a) const inline int cmp (const hb_bytes_t &a) const
{ {
if (!len) return 0; /* glibc's memcmp() args are declared nonnull. Meh. */ unsigned int l = MIN(a.len, len);
if (l) /* glibc's memcmp() args are declared nonnull. Meh. */
int r = memcmp (a.arrayZ, arrayZ, len); {
int r = memcmp (a.arrayZ, arrayZ, l);
if (r) return r; if (r) return r;
}
return a.len < len ? -1 : a.len > len ? +1 : 0; return a.len < len ? -1 : a.len > len ? +1 : 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册