the less/greater conparisons were not case-sensitive, which made the whole
function non-transitive.
I think codepoint_cmpi() is currently only used for equality tests, so
nothing will change.
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
*/
_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;
- }
+ c1 = toupper_m(c1);
+ c2 = toupper_m(c2);
return NUMERIC_CMP(c1, c2);
}
+++ /dev/null
-^samba4.local.charset.codepoint_cmpi