1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

util:charset:codepoints: codepoint_cmpi warning about non-transitivity

BUG: https://bugzilla.samba.org/show_bug.cgi?id=15625

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2024-04-04 14:56:16 +13:00 committed by Andrew Bartlett
parent 675fdeee3d
commit f07ae69907

View File

@ -16480,6 +16480,18 @@ _PUBLIC_ bool isupper_m(codepoint_t val)
*/
_PUBLIC_ int codepoint_cmpi(codepoint_t c1, codepoint_t c2)
{
/*
* FIXME: this is unsuitable for use in a sort, as the
* comparison is intransitive.
*
* The problem is toupper_m() is only called on equality case,
* which has strange effects.
*
* Consider {'a', 'A', 'B'}.
* 'a' == 'A'
* 'a' > 'B' (lowercase letters come after upper)
* 'A' < 'B'
*/
if (c1 == c2 ||
toupper_m(c1) == toupper_m(c2)) {
return 0;