Bug fix: Joliet name comparison was done as signed bytes and thus produced

a peculiar sorting order. Thanks to Vladimir Serbinenko. (For previous commit
too.)
This commit is contained in:
Thomas Schmitt 2012-05-23 20:59:14 +02:00
parent fae423fb54
commit e5a4e33ebd

View File

@ -1225,12 +1225,13 @@ uint16_t *ucsdup(const uint16_t *str)
/** /**
* Although each character is 2 bytes, we actually compare byte-by-byte * Although each character is 2 bytes, we actually compare byte-by-byte
* (thats what the spec says). * because the words are big-endian. Comparing possibly swapped words
* would make the sorting order depend on the machine byte order.
*/ */
int ucscmp(const uint16_t *s1, const uint16_t *s2) int ucscmp(const uint16_t *s1, const uint16_t *s2)
{ {
const char *s = (const char*)s1; const uint8_t *s = (const uint8_t*)s1;
const char *t = (const char*)s2; const uint8_t *t = (const uint8_t*)s2;
size_t len1 = ucslen(s1); size_t len1 = ucslen(s1);
size_t len2 = ucslen(s2); size_t len2 = ucslen(s2);
size_t i, len = MIN(len1, len2) * 2; size_t i, len = MIN(len1, len2) * 2;