diff --git a/src/filesel.c b/src/filesel.c index e9094f03..2eab7827 100644 --- a/src/filesel.c +++ b/src/filesel.c @@ -827,7 +827,7 @@ void Read_list_of_drives(T_Fileselector *list, byte name_length) #else // case-sensitive #define FILENAME_COMPARE strcmp - #define FILENAME_COMPARE_UNICODE wcscmp + #define FILENAME_COMPARE_UNICODE Unicode_strcmp #endif diff --git a/src/unicode.c b/src/unicode.c index 453fb555..485b0454 100644 --- a/src/unicode.c +++ b/src/unicode.c @@ -73,6 +73,18 @@ void Unicode_strlcat(word * dst, const word * src, size_t len) Unicode_strlcpy(dst + dst_len, src, len - dst_len); } +/// Compare two unicode strings +int Unicode_strcmp(const word * s1, const word * s2) +{ + while (*s1 == *s2) + { + if (*s1 == 0) return 0; + s1++; + s2++; + } + return (*s1 > *s2) ? 1 : -1; +} + /// Compare an unicode string with a regular Latin1 string int Unicode_char_strcmp(const word * s1, const char * s2) { diff --git a/src/unicode.h b/src/unicode.h index 349a79de..47dd7794 100644 --- a/src/unicode.h +++ b/src/unicode.h @@ -46,6 +46,9 @@ void Unicode_strlcpy(word * dst, const word * src, size_t len); /// Append unicode string to another void Unicode_strlcat(word * dst, const word * src, size_t len); +/// Compare two unicode strings +int Unicode_strcmp(const word * s1, const word * s2); + /// Compare an unicode string with a regular Latin1 string int Unicode_char_strcmp(const word * s1, const char * s2);