18
18
#include "CFString_Internal.h"
19
19
#include <limits.h>
20
20
#include <stdlib.h>
21
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
21
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
22
22
#include <unicode/ucol.h>
23
23
#include <unicode/ucoleitr.h>
24
24
#endif
@@ -111,7 +111,7 @@ CFStringEncoding CFStringConvertIANACharSetNameToEncoding(CFStringRef charsetNam
111
111
112
112
encoding = __CFStringEncodingGetFromCanonicalName (name );
113
113
114
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
114
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
115
115
if (kCFStringEncodingInvalidId == encoding ) encoding = __CFStringEncodingGetFromICUName (name );
116
116
#endif
117
117
@@ -262,7 +262,7 @@ CFStringEncoding CFStringGetMostCompatibleMacStringEncoding(CFStringEncoding enc
262
262
263
263
#define kCFStringCompareAllocationIncrement (128)
264
264
265
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
265
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
266
266
267
267
// -------------------------------------------------------------------------------------------------
268
268
// CompareSpecials - ignore case & diacritic differences
@@ -425,7 +425,7 @@ static UCollator *__CFStringCopyDefaultCollator(CFLocaleRef compareLocale) {
425
425
return collator ;
426
426
}
427
427
428
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
428
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
429
429
static void __collatorFinalize (UCollator * collator ) {
430
430
CFLocaleRef locale = _CFGetTSD (__CFTSDKeyCollatorLocale );
431
431
_CFSetTSD (__CFTSDKeyCollatorUCollator , NULL , NULL );
@@ -578,7 +578,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
578
578
CFRange range1 = str1Range ;
579
579
CFRange range2 = str2Range ;
580
580
SInt32 order ;
581
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
581
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
582
582
Boolean isEqual ;
583
583
bool forcedOrdering = ((options & kCFCompareForcedOrdering ) ? true : false);
584
584
@@ -611,7 +611,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
611
611
range2 .location = __extendLocationBackward (range2 .location - 1 , str2 , nonBaseBMP , punctBMP );
612
612
}
613
613
614
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
614
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
615
615
// First we try to use the last one used on this thread, if the locale is the same,
616
616
// otherwise we try to check out a default one, or then we create one.
617
617
UCollator * threadCollator = _CFGetTSD (__CFTSDKeyCollatorUCollator );
@@ -633,7 +633,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
633
633
range1 .length = (str1Range .location + str1Range .length ) - range1 .location ;
634
634
range2 .length = (str2Range .location + str2Range .length ) - range2 .location ;
635
635
636
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
636
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
637
637
if ((NULL != collator ) && (__CompareTextDefault (collator , options , characters1 , range1 .length , characters2 , range2 .length , & isEqual , & order ) == 0 /* noErr */ )) {
638
638
compResult = ((isEqual && !forcedOrdering ) ? kCFCompareEqualTo : ((order < 0 ) ? kCFCompareLessThan : kCFCompareGreaterThan ));
639
639
} else
@@ -709,7 +709,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
709
709
}
710
710
}
711
711
712
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
712
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
713
713
if ((NULL != collator ) && (__CompareTextDefault (collator , options , characters1 , range1 .length , characters2 , range2 .length , & isEqual , & order ) == 0 /* noErr */ )) {
714
714
if (isEqual ) {
715
715
if (forcedOrdering && (kCFCompareEqualTo == compResult ) && (0 != order )) compResult = ((order < 0 ) ? kCFCompareLessThan : kCFCompareGreaterThan );
@@ -753,7 +753,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
753
753
if (buffer2Len > 0 ) CFAllocatorDeallocate (kCFAllocatorSystemDefault , buffer2 );
754
754
}
755
755
756
- #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX
756
+ #if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_WASI
757
757
if (collator == threadCollator ) {
758
758
// do nothing, already cached
759
759
} else {
0 commit comments