From e5a4e33ebde195240222eb74959d1bd5f51cca4f Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Wed, 23 May 2012 20:59:14 +0200 Subject: [PATCH] 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.) --- libisofs/util.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libisofs/util.c b/libisofs/util.c index 6f06cba..e4b1379 100644 --- a/libisofs/util.c +++ b/libisofs/util.c @@ -1225,12 +1225,13 @@ uint16_t *ucsdup(const uint16_t *str) /** * 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) { - const char *s = (const char*)s1; - const char *t = (const char*)s2; + const uint8_t *s = (const uint8_t*)s1; + const uint8_t *t = (const uint8_t*)s2; size_t len1 = ucslen(s1); size_t len2 = ucslen(s2); size_t i, len = MIN(len1, len2) * 2;