mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
Merge pull request #109 from gnustep/numerical_locale
* Source/NSString.m: Attempt to make calls to GSICUCollatorOpen()
This commit is contained in:
commit
6af944b1d1
2 changed files with 44 additions and 45 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,12 +1,17 @@
|
|||
2020-03-29 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Source/NSString.m: Attempt to make calls to GSICUCollatorOpen()
|
||||
more consistent and correct for ICU 65.
|
||||
|
||||
2020-03-26 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
||||
* Headers/Foundation/NSError.h,
|
||||
* Source/NSError.m: Added NSErrorDomain typedef.
|
||||
* Headers/Foundation/NSError.h:
|
||||
* Source/NSError.m: Added NSErrorDomain typedef.
|
||||
|
||||
2020-03-12 Fred Kiefer <fredkiefer@gmx.de>
|
||||
|
||||
* Source/NSURL.m: Fix compiler warnigns.
|
||||
* Headers/Foundation/NSLocale.h,
|
||||
* Source/NSURL.m: Fix compiler warnings.
|
||||
* Headers/Foundation/NSLocale.h:
|
||||
* Source/NSLocale.m: Add a few convenience methods from MacOS 10.12.
|
||||
|
||||
2020-03-10 Frederik Seiffert <frederik@algoriddim.com>
|
||||
|
|
|
@ -663,28 +663,43 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *locale)
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (locale == nil)
|
||||
{
|
||||
/* A nil locale should trigger POSIX collation (i.e. 'A'-'Z' sort
|
||||
* before 'a'), and support for this was added in ICU 4.6 under the
|
||||
* locale name en_US_POSIX, but it doesn't fit our requirements
|
||||
* (e.g. 'e' and 'E' don't compare as equal with case insensitive
|
||||
* comparison.) - so return NULL to indicate that the GNUstep
|
||||
* comparison code should be used.
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
localeCString = [[locale localeIdentifier] UTF8String];
|
||||
|
||||
if (localeCString == NULL || strcmp("", localeCString) == 0)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
if (NO == [locale isKindOfClass: [NSLocale class]])
|
||||
{
|
||||
if (nil == locale)
|
||||
{
|
||||
/* See comments below about the posix locale.
|
||||
* It's bad for case insensitive search, but needed for numeric
|
||||
*/
|
||||
if (mask & NSNumericSearch)
|
||||
{
|
||||
locale = [NSLocale systemLocale];
|
||||
}
|
||||
else
|
||||
{
|
||||
/* A nil locale should trigger POSIX collation (i.e. 'A'-'Z' sort
|
||||
* before 'a'), and support for this was added in ICU 4.6 under the
|
||||
* locale name en_US_POSIX, but it doesn't fit our requirements
|
||||
* (e.g. 'e' and 'E' don't compare as equal with case insensitive
|
||||
* comparison.) - so return NULL to indicate that the GNUstep
|
||||
* comparison code should be used.
|
||||
*/
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
locale = [NSLocale currentLocale];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
localeCString = [[locale localeIdentifier] UTF8String];
|
||||
|
||||
if (localeCString != NULL && strcmp("", localeCString) == 0)
|
||||
{
|
||||
localeCString = NULL;
|
||||
}
|
||||
|
||||
coll = ucol_open(localeCString, &status);
|
||||
|
||||
if (U_SUCCESS(status))
|
||||
|
@ -2804,10 +2819,6 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *locale)
|
|||
}
|
||||
|
||||
#if GS_USE_ICU == 1
|
||||
if (nil != locale && NO == [locale isKindOfClass: [NSLocale class]])
|
||||
{
|
||||
locale = [NSLocale currentLocale];
|
||||
}
|
||||
{
|
||||
UCollator *coll = GSICUCollatorOpen(mask, locale);
|
||||
|
||||
|
@ -5784,23 +5795,6 @@ static NSFileManager *fm = nil;
|
|||
[NSException raise: NSInvalidArgumentException format: @"compare with nil"];
|
||||
|
||||
#if GS_USE_ICU == 1
|
||||
if (NO == [locale isKindOfClass: [NSLocale class]])
|
||||
{
|
||||
if (nil == locale)
|
||||
{
|
||||
/* See comments in GSICUCollatorOpen about the posix locale.
|
||||
* It's bad for case insensitive search, but needed for numeric
|
||||
*/
|
||||
if (mask & NSNumericSearch)
|
||||
{
|
||||
locale = [NSLocale systemLocale];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
locale = [NSLocale currentLocale];
|
||||
}
|
||||
}
|
||||
{
|
||||
UCollator *coll = GSICUCollatorOpen(mask, locale);
|
||||
|
||||
|
|
Loading…
Reference in a new issue