Skip to content

Commit 3934385

Browse files
authored
Merge pull request #3039 from apple/maxd/cf-types-wasi
Add support for CF data structures/utils on WASI
2 parents ec46464 + b0b5345 commit 3934385

File tree

17 files changed

+90
-36
lines changed

17 files changed

+90
-36
lines changed

CoreFoundation/Collections.subproj/CFData.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ CF_INLINE unsigned long __CFPageSize() {
4848
CF_INLINE unsigned long __CFPageSize() {
4949
return (unsigned long)getpagesize();
5050
}
51+
#elif TARGET_OS_WASI
52+
CF_INLINE unsigned long __CFPageSize() {
53+
// WebAssembly linear memory pages are always 64KiB in size
54+
return 65536;
55+
}
5156
#endif
5257

5358
#define INLINE_BYTES_THRESHOLD ((4 * __CFPageSize()) - sizeof(struct __CFData) - 15)

CoreFoundation/Locale.subproj/CFDateIntervalFormatter.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,15 @@
2121

2222
#include <unicode/udateintervalformat.h>
2323

24+
#if TARGET_OS_WASI
25+
#define LOCK() do {} while (0)
26+
#define UNLOCK() do {} while (0)
27+
#else
2428
#include <dispatch/dispatch.h>
2529

2630
#define LOCK() do { dispatch_semaphore_wait(formatter->_lock, DISPATCH_TIME_FOREVER); } while(0)
2731
#define UNLOCK() do { dispatch_semaphore_signal(formatter->_lock); } while(0)
32+
#endif
2833

2934
CF_INLINE void __CFReleaseIfNotNull(CFTypeRef object) {
3035
if (object) {
@@ -51,7 +56,9 @@ struct __CFDateIntervalFormatter {
5156
CFDateIntervalFormatterStyle _dateStyle;
5257
CFDateIntervalFormatterStyle _timeStyle;
5358
_CFDateIntervalFormatterBoundaryStyle _boundaryStyle;
59+
#if !TARGET_OS_WASI
5460
dispatch_semaphore_t _lock;
61+
#endif
5562
bool _modified:1;
5663
bool _useTemplate:1;
5764
};
@@ -141,14 +148,14 @@ static void updateFormatter(CFDateIntervalFormatterRef dif) {
141148
timeZone = CFTimeZoneCopyDefault();
142149
}
143150
CFStringRef unretainedTimeZoneName = CFTimeZoneGetName(timeZone);
144-
CFStringGetCharacters(unretainedTimeZoneName, CFRangeMake(0, MIN(CFStringGetLength(unretainedTimeZoneName), 100)), timeZoneID);
151+
CFStringGetCharacters(unretainedTimeZoneName, CFRangeMake(0, __CFMin(CFStringGetLength(unretainedTimeZoneName), 100)), timeZoneID);
145152

146153
CFStringRef unretainedTemplate = dif->_dateTemplateFromStyles;
147154
if (dif->_useTemplate) {
148155
unretainedTemplate = dif->_dateTemplate;
149156
}
150157
UniChar templateStr[100] = {0};
151-
CFStringGetCharacters(unretainedTemplate, CFRangeMake(0, MIN(CFStringGetLength(unretainedTemplate), 100)), templateStr);
158+
CFStringGetCharacters(unretainedTemplate, CFRangeMake(0, __CFMin(CFStringGetLength(unretainedTemplate), 100)), templateStr);
152159

153160
UErrorCode status = U_ZERO_ERROR;
154161
dif->_formatter = udtitvfmt_open(localeBuffer, templateStr, CFStringGetLength(unretainedTemplate), timeZoneID, CFStringGetLength(unretainedTimeZoneName), &status);
@@ -230,7 +237,9 @@ CFDateIntervalFormatterRef CFDateIntervalFormatterCreate(CFAllocatorRef allocato
230237
memory->_dateTemplate = CFRetain(CFSTR(""));
231238
memory->_formatter = NULL;
232239
memory->_boundaryStyle = kCFDateIntervalFormatterBoundaryStyleDefault;
240+
#if !TARGET_OS_WASI
233241
memory->_lock = dispatch_semaphore_create(1);
242+
#endif
234243
memory->_modified = false;
235244
memory->_useTemplate = false;
236245

@@ -337,7 +346,9 @@ static void __CFDateIntervalFormatterDeallocate(CFTypeRef object) {
337346
udtitvfmt_close(formatter->_formatter);
338347
}
339348

349+
#if !TARGET_OS_WASI
340350
dispatch_release(formatter->_lock);
351+
#endif
341352
}
342353

343354
CFLocaleRef CFDateIntervalFormatterCopyLocale(CFDateIntervalFormatterRef formatter) {

CoreFoundation/Locale.subproj/CFLocale.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@
1515
#include <CoreFoundation/CFString.h>
1616
#include <CoreFoundation/CFArray.h>
1717
#include <CoreFoundation/CFDictionary.h>
18-
#include <CoreFoundation/CFPreferences.h>
1918
#include <CoreFoundation/CFCalendar.h>
2019
#include <CoreFoundation/CFNumber.h>
2120
#include "CFInternal.h"
2221
#include "CFRuntime_Internal.h"
22+
#if !TARGET_OS_WASI
23+
#include <CoreFoundation/CFPreferences.h>
2324
#include "CFBundle_Internal.h"
25+
#else
26+
#include "CFBase.h"
27+
#endif
2428
#include "CFLocaleInternal.h"
2529
#include <stdatomic.h>
2630
#if TARGET_OS_MAC || TARGET_OS_WIN32 || TARGET_OS_LINUX || TARGET_OS_BSD

CoreFoundation/Locale.subproj/CFLocaleKeys.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ CONST_STRING_DECL(kCFCalendarIdentifierEthiopicAmeteMihret, "ethiopic");
132132
CONST_STRING_DECL(kCFCalendarIdentifierEthiopicAmeteAlem, "ethiopic-amete-alem");
133133

134134
// Aliases for other platforms.
135-
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WIN32
135+
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WIN32 || TARGET_OS_WASI
136136

137137
CF_EXPORT CFStringRef const kCFBuddhistCalendar __attribute__((alias ("kCFCalendarIdentifierBuddhist")));
138138
CF_EXPORT CFStringRef const kCFChineseCalendar __attribute__((alias ("kCFCalendarIdentifierChinese")));

CoreFoundation/NumberDate.subproj/CFNumber.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ static const Float64Bits doubleOneBits = {.floatValue = 1.0f};
178178
#define BITSFORDOUBLEZERO doubleZeroBits.bits
179179
#define BITSFORDOUBLEONE doubleOneBits.bits
180180

181-
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
181+
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
182182
#define FLOAT_POSITIVE_2_TO_THE_64 0x1.0p+64L
183183
#define FLOAT_NEGATIVE_2_TO_THE_127 -0x1.0p+127L
184184
#define FLOAT_POSITIVE_2_TO_THE_127 0x1.0p+127L

CoreFoundation/NumberDate.subproj/CFTimeZone.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@
2525
#include <unicode/udat.h>
2626
#include <unicode/ustring.h>
2727
#include <CoreFoundation/CFDateFormatter.h>
28-
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
28+
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
2929
#include <dirent.h>
3030
#include <unistd.h>
31-
#if !TARGET_OS_ANDROID
31+
#if !TARGET_OS_ANDROID && !TARGET_OS_WASI
3232
#include <sys/fcntl.h>
33+
#elif TARGET_OS_WASI
34+
#include <fcntl.h>
3335
#else
3436
#include <sys/endian.h>
3537
#endif
@@ -47,7 +49,7 @@
4749
#include <tzfile.h>
4850
#define MACOS_TZDIR1 "/usr/share/zoneinfo/" // 10.12 and earlier
4951
#define MACOS_TZDIR2 "/var/db/timezone/zoneinfo/" // 10.13 onwards
50-
#elif TARGET_OS_LINUX || TARGET_OS_BSD
52+
#elif TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
5153
#ifndef TZDIR
5254
#define TZDIR "/usr/share/zoneinfo/" /* Time zone object file directory */
5355
#endif /* !defined TZDIR */
@@ -57,7 +59,7 @@
5759
#endif /* !defined TZDEFAULT */
5860
#endif
5961

60-
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WIN32
62+
#if TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WIN32 || TARGET_OS_WASI
6163
struct tzhead {
6264
char tzh_magic[4]; /* TZ_MAGIC */
6365
char tzh_reserved[16]; /* reserved for future use */
@@ -351,7 +353,7 @@ static CFMutableArrayRef __CFCopyAndroidTimeZoneList() {
351353
return result;
352354
}
353355

354-
#elif TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
356+
#elif TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
355357
static CFMutableArrayRef __CFCopyRecursiveDirectoryList() {
356358
CFMutableArrayRef result = CFArrayCreateMutable(kCFAllocatorSystemDefault, 0, &kCFTypeArrayCallBacks);
357359
#if !TARGET_OS_ANDROID
@@ -810,7 +812,7 @@ static void __InitTZStrings(void) {
810812

811813
#elif TARGET_OS_ANDROID
812814
// Nothing
813-
#elif TARGET_OS_LINUX || TARGET_OS_BSD
815+
#elif TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
814816
static void __InitTZStrings(void) {
815817
__tzZoneInfo = CFSTR(TZDIR);
816818
__tzDir = TZDIR "zone.tab";
@@ -863,7 +865,7 @@ static CFTimeZoneRef __CFTimeZoneCreateSystem(void) {
863865
if (result) return result;
864866
}
865867

866-
#if !TARGET_OS_ANDROID
868+
#if !TARGET_OS_ANDROID && !TARGET_OS_WASI
867869
if (!__tzZoneInfo) __InitTZStrings();
868870
ret = readlink(TZDEFAULT, linkbuf, sizeof(linkbuf));
869871
// The link can be relative, we treat this the same as if there was no link
@@ -880,9 +882,11 @@ static CFTimeZoneRef __CFTimeZoneCreateSystem(void) {
880882
} else
881883
#endif
882884
{
885+
#if !TARGET_OS_WASI
883886
// TODO: This can still fail on Linux if the time zone is not recognized by ICU later
884887
// Try localtime
885888
tzset();
889+
#endif
886890
time_t t = time(NULL);
887891
struct tm lt = {0};
888892
localtime_r(&t, &lt);
@@ -1348,7 +1352,8 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
13481352

13491353
return FALSE;
13501354
#else
1351-
#if !TARGET_OS_ANDROID
1355+
#if !TARGET_OS_ANDROID && !TARGET_OS_WASI
1356+
13521357
if (!__tzZoneInfo) __InitTZStrings();
13531358
if (!__tzZoneInfo) return NULL;
13541359
baseURL = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, __tzZoneInfo, kCFURLPOSIXPathStyle, true);
@@ -1367,7 +1372,7 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
13671372
if (mapping) {
13681373
name = mapping;
13691374
}
1370-
#if !TARGET_OS_ANDROID
1375+
#if !TARGET_OS_ANDROID && !TARGET_OS_WASI
13711376
else if (CFStringHasPrefix(name, __tzZoneInfo)) {
13721377
CFMutableStringRef unprefixed = CFStringCreateMutableCopy(kCFAllocatorSystemDefault, CFStringGetLength(name), name);
13731378
CFStringDelete(unprefixed, CFRangeMake(0, CFStringGetLength(__tzZoneInfo)));
@@ -1383,7 +1388,7 @@ Boolean _CFTimeZoneInit(CFTimeZoneRef timeZone, CFStringRef name, CFDataRef data
13831388
return false;
13841389
}
13851390
}
1386-
if (NULL == data) {
1391+
if (NULL == data && NULL != baseURL) {
13871392
tzName = name;
13881393
data = _CFTimeZoneDataCreate(baseURL, tzName);
13891394
}

CoreFoundation/Parsing.subproj/CFBinaryPList.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@
2929
#include <string.h>
3030
#include "CFInternal.h"
3131
#include "CFRuntime_Internal.h"
32+
33+
#if !TARGET_OS_WASI
3234
#include <CoreFoundation/CFStream.h>
35+
#endif
3336

3437
enum {
3538
CF_NO_ERROR = 0,
@@ -130,6 +133,7 @@ uint32_t _CFKeyedArchiverUIDGetValue(CFKeyedArchiverUIDRef uid) {
130133

131134
CF_PRIVATE CFErrorRef __CFPropertyListCreateError(CFIndex code, CFStringRef debugString, ...);
132135

136+
#if !TARGET_OS_WASI
133137
typedef struct {
134138
CFTypeRef stream;
135139
void *databytes;
@@ -691,6 +695,7 @@ CF_PRIVATE CFDataRef __CFBinaryPlistCreateDataUsingExternalBufferAllocator(CFPro
691695
}
692696
return result;
693697
}
698+
#endif
694699

695700
#pragma mark -
696701
#pragma mark Reading

CoreFoundation/Parsing.subproj/CFPropertyList.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
#include "CFRuntime_Internal.h"
2424
#include <CoreFoundation/CFBurstTrie.h>
2525
#include <CoreFoundation/CFString.h>
26+
#if !TARGET_OS_WASI
2627
#include <CoreFoundation/CFStream.h>
28+
#endif
2729
#include <CoreFoundation/CFCalendar.h>
2830
#include "CFLocaleInternal.h"
2931
#include <limits.h>
@@ -2850,7 +2852,6 @@ CFSetRef _CFPropertyListCopyTopLevelKeys(CFAllocatorRef allocator, CFDataRef dat
28502852
}
28512853

28522854

2853-
28542855
// Legacy
28552856
CFTypeRef _CFPropertyListCreateFromXMLData(CFAllocatorRef allocator, CFDataRef xmlData, CFOptionFlags option, CFStringRef *errorString, Boolean allowNewTypes, CFPropertyListFormat *format) {
28562857
CFTypeRef out = NULL;
@@ -2883,6 +2884,7 @@ CFPropertyListRef CFPropertyListCreateFromXMLData(CFAllocatorRef allocator, CFDa
28832884
return result;
28842885
}
28852886

2887+
#if !TARGET_OS_WASI
28862888
CFDataRef CFPropertyListCreateData(CFAllocatorRef allocator, CFPropertyListRef propertyList, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef *error) {
28872889
CFAssert1(format != kCFPropertyListOpenStepFormat, __kCFLogAssertion, "%s(): kCFPropertyListOpenStepFormat not supported for writing", __PRETTY_FUNCTION__);
28882890
CFAssert2(format == kCFPropertyListXMLFormat_v1_0 || format == kCFPropertyListBinaryFormat_v1_0, __kCFLogAssertion, "%s(): Unrecognized option %ld", __PRETTY_FUNCTION__, format);
@@ -3136,6 +3138,7 @@ bool _CFPropertyListValidateData(CFDataRef data, CFTypeID *outTopLevelTypeID) {
31363138
return result;
31373139
}
31383140

3141+
#endif
31393142

31403143
#pragma mark -
31413144
#pragma mark Property List Copies

CoreFoundation/Parsing.subproj/CFPropertyList.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@
1414
#include <CoreFoundation/CFData.h>
1515
#include <CoreFoundation/CFString.h>
1616
#include <CoreFoundation/CFError.h>
17+
18+
#if !TARGET_OS_WASI
1719
#include <CoreFoundation/CFStream.h>
20+
#endif
1821

1922
CF_IMPLICIT_BRIDGING_ENABLED
2023
CF_EXTERN_C_BEGIN
@@ -82,6 +85,7 @@ Boolean CFPropertyListIsValid(CFPropertyListRef plist, CFPropertyListFormat form
8285

8386
CF_IMPLICIT_BRIDGING_DISABLED
8487

88+
#if !TARGET_OS_WASI
8589
/* Writes the bytes of a plist serialization out to the stream. The
8690
* stream must be opened and configured -- the function simply writes
8791
* a bunch of bytes to the stream. The output plist format can be chosen.
@@ -113,6 +117,7 @@ CFPropertyListRef CFPropertyListCreateFromStream(CFAllocatorRef allocator, CFRea
113117
CF_IMPLICIT_BRIDGING_ENABLED
114118

115119
CF_IMPLICIT_BRIDGING_DISABLED
120+
#endif
116121

117122
CF_ENUM(CFIndex) {
118123
kCFPropertyListReadCorruptError = 3840, // Error parsing a property list
@@ -126,6 +131,7 @@ CF_ENUM(CFIndex) {
126131
CF_EXPORT
127132
CFPropertyListRef CFPropertyListCreateWithData(CFAllocatorRef allocator, CFDataRef data, CFOptionFlags options, CFPropertyListFormat *format, CFErrorRef *error) API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
128133

134+
#if !TARGET_OS_WASI
129135
/* Create and return a property list with a CFReadStream input. If the format parameter is non-NULL, it will be set to the format of the data after parsing is complete. The options parameter is used to specify CFPropertyListMutabilityOptions. The streamLength parameter specifies the number of bytes to read from the stream. Set streamLength to 0 to read until the end of the stream is detected. If an error occurs while parsing the data, the return value will be NULL. Additionally, if an error occurs and the error parameter is non-NULL, the error parameter will be set to a CFError describing the problem, which the caller must release. If the parse succeeds, the returned value is a reference to the new property list. It is the responsibility of the caller to release this value.
130136
*/
131137
CF_EXPORT
@@ -135,6 +141,7 @@ CFPropertyListRef CFPropertyListCreateWithStream(CFAllocatorRef allocator, CFRea
135141
*/
136142
CF_EXPORT
137143
CFIndex CFPropertyListWrite(CFPropertyListRef propertyList, CFWriteStreamRef stream, CFPropertyListFormat format, CFOptionFlags options, CFErrorRef *error) API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0));
144+
#endif
138145

139146
/* Create a CFData with the bytes of a serialized property list. The format of the property list can be chosen with the format parameter. The options parameter is currently unused and should be set to 0. If an error occurs while parsing the data, the return value will be NULL. Additionally, if an error occurs and the error parameter is non-NULL, the error parameter will be set to a CFError describing the problem, which the caller must release. If the conversion succeeds, the returned value is a reference to the created data. It is the responsibility of the caller to release this value.
140147
*/
@@ -145,6 +152,5 @@ CF_IMPLICIT_BRIDGING_ENABLED
145152

146153
CF_EXTERN_C_END
147154
CF_IMPLICIT_BRIDGING_DISABLED
148-
149155
#endif /* ! __COREFOUNDATION_CFPROPERTYLIST__ */
150156

CoreFoundation/String.subproj/CFBurstTrie.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <fcntl.h>
1919
#include <sys/stat.h>
2020
#include <limits.h>
21-
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD
21+
#if TARGET_OS_MAC || TARGET_OS_LINUX || TARGET_OS_BSD || TARGET_OS_WASI
2222
#include <unistd.h>
2323
#include <sys/param.h>
2424
#include <sys/mman.h>

CoreFoundation/String.subproj/CFCharacterSet.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ static void __CFCSetAddNonBMPPlanesInRange(CFMutableCharacterSetRef cset, CFRang
731731
int firstChar = (range.location & 0xFFFF);
732732
int maxChar = range.location + range.length;
733733
int idx = range.location >> 16; // first plane
734-
int maxPlane = MIN((maxChar - 1) >> 16, MAX_ANNEX_PLANE); // last plane
734+
int maxPlane = __CFMin((maxChar - 1) >> 16, MAX_ANNEX_PLANE); // last plane
735735
CFRange planeRange;
736736
CFMutableCharacterSetRef annexPlane;
737737

@@ -775,7 +775,7 @@ static void __CFCSetRemoveNonBMPPlanesInRange(CFMutableCharacterSetRef cset, CFR
775775
int firstChar = (range.location & 0xFFFF);
776776
int maxChar = range.location + range.length;
777777
int idx = range.location >> 16; // first plane
778-
int maxPlane = MIN((maxChar - 1) >> 16, MAX_ANNEX_PLANE); // last plane
778+
int maxPlane = __CFMin((maxChar - 1) >> 16, MAX_ANNEX_PLANE); // last plane
779779
CFRange planeRange;
780780
CFMutableCharacterSetRef annexPlane;
781781

CoreFoundation/String.subproj/CFString.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ CFStringEncoding __CFDefaultEightBitStringEncoding = kCFStringEncodingInvalidId;
426426

427427
#if TARGET_OS_MAC
428428
#define __defaultEncoding kCFStringEncodingMacRoman
429-
#elif TARGET_OS_LINUX
429+
#elif TARGET_OS_LINUX || TARGET_OS_WASI
430430
#define __defaultEncoding kCFStringEncodingUTF8
431431
#elif TARGET_OS_WIN32
432432
#define __defaultEncoding kCFStringEncodingWindowsLatin1

CoreFoundation/String.subproj/CFStringEncodings.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ CFIndex __CFStringEncodeByteStream(CFStringRef string, CFIndex rangeLoc, CFIndex
656656
return numCharsProcessed;
657657
}
658658

659-
CFIndex uninterestingTailLen = buffer ? (rangeLen - MIN(max, rangeLen)) : 0;
659+
CFIndex uninterestingTailLen = buffer ? (rangeLen - __CFMin(max, rangeLen)) : 0;
660660
while (*ptr < 0x80 && rangeLen > uninterestingTailLen) {
661661
++ptr;
662662
--rangeLen;

CoreFoundation/String.subproj/CFStringUtilities.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer *
640640
} else
641641
#endif
642642
{
643-
compResult = ((memcmp(characters1, characters2, sizeof(UniChar) * MIN(range1.length, range2.length)) < 0) ? kCFCompareLessThan : kCFCompareGreaterThan);
643+
compResult = ((memcmp(characters1, characters2, sizeof(UniChar) * __CFMin(range1.length, range2.length)) < 0) ? kCFCompareLessThan : kCFCompareGreaterThan);
644644
}
645645
} else {
646646
UniChar *buffer1 = NULL;

0 commit comments

Comments
 (0)