projects
/
platform
/
upstream
/
libHarfBuzzSharp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5547bfa
)
Fix hb_bytes_t.cmp()
author
Behdad Esfahbod
<behdad@behdad.org>
Sat, 10 Nov 2018 20:38:48 +0000
(15:38 -0500)
committer
Behdad Esfahbod
<behdad@behdad.org>
Sat, 10 Nov 2018 20:39:07 +0000
(15:39 -0500)
Ouch!
src/hb-dsalgs.hh
patch
|
blob
|
history
diff --git
a/src/hb-dsalgs.hh
b/src/hb-dsalgs.hh
index
ffa4387
..
e98566e
100644
(file)
--- a/
src/hb-dsalgs.hh
+++ b/
src/hb-dsalgs.hh
@@
-530,10
+530,12
@@
struct hb_bytes_t
inline int cmp (const hb_bytes_t &a) const
{
- if (len != a.len)
- return (int) a.len - (int) len;
+ if (!len) return 0; /* glibc's memcmp() args are declared nonnull. Meh. */
- return memcmp (a.arrayZ, arrayZ, len);
+ int r = memcmp (a.arrayZ, arrayZ, len);
+ if (r) return r;
+
+ return a.len < len ? -1 : a.len > len ? +1 : 0;
}
static inline int cmp (const void *pa, const void *pb)
{