* Looks like r24456 was a bit premature: with string attributes, it makes sense
to ignore a trailing null byte, which the code now didn't do anymore. * This caused bug #2054. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24888 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
875757adef
commit
cdde324d77
@ -2311,8 +2311,16 @@ compareKeys(type_code type, const void *key1, int keyLength1,
|
||||
case B_STRING_TYPE:
|
||||
{
|
||||
int result = memcmp(key1, key2, min_c(keyLength1, keyLength2));
|
||||
if (result == 0)
|
||||
if (result == 0) {
|
||||
// ignore trailing null bytes
|
||||
if ((keyLength1 == keyLength2 + 1
|
||||
&& ((uint8 *)key1)[keyLength2] == '\0')
|
||||
|| (keyLength2 == keyLength1 + 1
|
||||
&& ((uint8 *)key2)[keyLength1] == '\0'))
|
||||
return 0;
|
||||
|
||||
result = keyLength1 - keyLength2;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user