projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f7d1689
)
translate: Fix translate_key_compare().
author
Michal Krol
<michal@vmware.com>
Tue, 29 Dec 2009 21:49:31 +0000
(22:49 +0100)
committer
Michal Krol
<michal@vmware.com>
Tue, 29 Dec 2009 21:49:31 +0000
(22:49 +0100)
Sizes of translate keys must also match.
src/gallium/auxiliary/translate/translate.h
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/translate/translate.h
b/src/gallium/auxiliary/translate/translate.h
index 34526eb0617ae6a366c87fb2e8915fb9c1ca5692..1afdf194b319e3fbe9f21852039949bcf987623c 100644
(file)
--- a/
src/gallium/auxiliary/translate/translate.h
+++ b/
src/gallium/auxiliary/translate/translate.h
@@
-103,8
+103,13
@@
static INLINE int translate_keysize( const struct translate_key *key )
static INLINE int translate_key_compare( const struct translate_key *a,
const struct translate_key *b )
{
- int keysize = translate_keysize(a);
- return memcmp(a, b, keysize);
+ int keysize_a = translate_keysize(a);
+ int keysize_b = translate_keysize(b);
+
+ if (keysize_a != keysize_b) {
+ return keysize_a - keysize_b;
+ }
+ return memcmp(a, b, keysize_a);
}