Cygwin: __wscollate_range_cmp: workaround wcscoll's case-insensitivity
Most locales using latin characters ignore case while sorting. This is what wcscoll does (correctly so). However, there's an internal order of collating sequences compared to the base character, which is case-sensitive, at least in GLibc. There's no way to express this in Windows, because CompareString and LCMapString *always* use case-insensitivity in those locales, even if none of the *IGNORECASE sorting flags are used. We want to follow glibc's behaviour more closely, so we add an extra check for the case and make sure upper and lower cased letters don't comapre as identical. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
parent
a51147467e
commit
2229f42400
|
@ -1206,6 +1206,12 @@ __wscollate_range_cmp (wint_t *c1, wint_t *c2,
|
|||
wchar_t s1[c1len * 2 + 1] = { 0 }; /* # of chars if all are surrogates */
|
||||
wchar_t s2[c2len * 2 + 1] = { 0 };
|
||||
|
||||
/* wcscoll() ignores case in many locales. but we don't want that
|
||||
for filenames... */
|
||||
if ((iswupper (*c1) && !iswupper (*c2))
|
||||
|| (iswlower (*c1) && !iswlower (*c2)))
|
||||
return *c1 - *c2;
|
||||
|
||||
wcintowcs (s1, c1, c1len);
|
||||
wcintowcs (s2, c2, c2len);
|
||||
return wcscoll_l (s1, s2, __get_current_locale ());
|
||||
|
|
Loading…
Reference in New Issue