Skip to content

CFString: pass comparison operands to the collator in order - #80

Merged
fredkiefer merged 2 commits into
gnustep:masterfrom
DTW-Thalion:fix/cfstring-compare
Aug 31, 2026
Merged

fredkiefer merged 2 commits into
gnustep:masterfrom
DTW-Thalion:fix/cfstring-compare

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

CFStringCompareWithOptionsAndLocale passed the second string to ucol_strcoll as
the source and the first as the target, so every ordered comparison came back
inverted: CFStringCompare(CFSTR("abc"), CFSTR("abd"), 0) returned
kCFCompareGreaterThan, and kCFCompareNumerically ordered "file10" before "file9".
Passing the operands in order restores the documented result. Verified against
Apple CoreFoundation.

CFStringCompareWithOptionsAndLocale handed the second string to the collator as
the source and the first as the target, which inverted every ordered result.
@DTW-Thalion
DTW-Thalion force-pushed the fix/cfstring-compare branch from 055e51a to 349e368 Compare July 24, 2026 15:12
@DTW-Thalion DTW-Thalion reopened this Jul 24, 2026
@DTW-Thalion DTW-Thalion reopened this Jul 27, 2026
@HendrikHuebner

Copy link
Copy Markdown
Contributor

A check failed here.

With the collator operands passed in order, CFStringCompare now sorts
dictionary keys correctly, so the OpenStep writer emits them
alphabetically.  Update the expected output to match.
@fredkiefer
fredkiefer merged commit e0fe2c9 into gnustep:master Aug 31, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants