Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ include(CheckSymbolExists)
check_linker_flag(C "LINKER:--build-id=sha1" LINKER_SUPPORTS_BUILD_ID)

# Detect if the system libc defines symbols for these functions.
# If it is not availble, swift-corelibs-foundation has its own implementations
# If it is not available, swift-corelibs-foundation has its own implementations
# that will be used. If it is available, it should not redefine them.
# Note: SwiftPM does not have the ability to introspect the contents of the SDK
# and therefore will always include these functions in the build and will
Expand Down
4 changes: 2 additions & 2 deletions Sources/CoreFoundation/BlockRuntime/runtime.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ static void *_Block_copy_internal(const void *arg, const bool wantsOne) {
return aBlock;
}

// Its a stack block. Make a copy.
// It's a stack block. Make a copy.
if (!isGC) {
struct Block_layout *result = malloc(aBlock->descriptor->size);
if (!result) return NULL;
Expand Down Expand Up @@ -433,7 +433,7 @@ static void _Block_byref_assign_copy(void *dest, const void *arg, const int flag
else if ((src->forwarding->flags & BLOCK_REFCOUNT_MASK) == 0) {
// src points to stack
bool isWeak = ((flags & (BLOCK_FIELD_IS_BYREF|BLOCK_FIELD_IS_WEAK)) == (BLOCK_FIELD_IS_BYREF|BLOCK_FIELD_IS_WEAK));
// if its weak ask for an object (only matters under GC)
// if it's weak ask for an object (only matters under GC)
struct Block_byref *copy = (struct Block_byref *)_Block_allocator(src->size, false, isWeak);
copy->flags = src->flags | _Byref_flag_initial_value; // non-GC one for caller, one for stack
copy->forwarding = copy; // patch heap copy to point to itself (skip write-barrier)
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFBase.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ CFAllocatorRef CFAllocatorGetDefault(void) {

void CFAllocatorSetDefault(CFAllocatorRef allocator) {
#ifndef __clang_analyzer__
// clang doesn't like complexity of staticly laid out instances like the black magic we do here and __CFGetDefaultAllocator
// clang doesn't like complexity of statically laid out instances like the black magic we do here and __CFGetDefaultAllocator
CFAllocatorRef current = __CFGetDefaultAllocator();
#if defined(DEBUG)
if (NULL != allocator) {
Expand Down
4 changes: 2 additions & 2 deletions Sources/CoreFoundation/CFBundle_Binary.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ static char *_cleanedPathForPath(const char *curName) {
}

CF_PRIVATE CFArrayRef _CFBundleDYLDCopyLoadedImagePathsIfChanged(void) {
// This returns an array of the paths of all the dyld images in the process. These paths may not be absolute, they may point at things that are not bundles, they may be staticly linked bundles or dynamically loaded bundles, they may be NULL.
// This returns an array of the paths of all the dyld images in the process. These paths may not be absolute, they may point at things that are not bundles, they may be statically linked bundles or dynamically loaded bundles, they may be NULL.
uint32_t i, numImages = _dyld_image_count();
CFMutableArrayRef result = NULL;
static uint32_t _cachedDYLDImageCount = -1;
Expand Down Expand Up @@ -442,7 +442,7 @@ static void *_CFBundleDYLDGetSymbolByNameWithSearch(CFBundleRef bundle, CFString
if (!CFStringGetCString(executableName, hintBuff, 1024, kCFStringEncodingUTF8)) hintBuff[0] = '\0';
CFRelease(executableName);
}
// Nowdays, NSIsSymbolNameDefinedWithHint() and NSLookupAndBindSymbolWithHint()
// Nowadays, NSIsSymbolNameDefinedWithHint() and NSLookupAndBindSymbolWithHint()
// are identical, except the first just returns a bool, so checking with the
// Is function first just causes a redundant lookup.
// This returns NULL on failure.
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFCalendar.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void __CFCalendarSetToFirstInstant(CFCalendarRef calendar, CFCalendarUnit
__cficu_ucal_set(calendar->_cal, UCAL_YEAR, __cficu_ucal_getLimit(calendar->_cal, UCAL_YEAR, UCAL_ACTUAL_MINIMUM, &status));
case kCFCalendarUnitYear:
__cficu_ucal_set(calendar->_cal, UCAL_MONTH, __cficu_ucal_getLimit(calendar->_cal, UCAL_MONTH, UCAL_ACTUAL_MINIMUM, &status));
// #warning if there is a lunar leap month of the same number *preceeding* month N,
// #warning if there is a lunar leap month of the same number *preceding* month N,
// then we should set the calendar to the leap month, not the regular month.
__cficu_ucal_set(calendar->_cal, UCAL_IS_LEAP_MONTH, 0);
case kCFCalendarUnitMonth:
Expand Down
18 changes: 9 additions & 9 deletions Sources/CoreFoundation/CFCharacterSet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1360,13 +1360,13 @@ const CFRuntimeClass __CFCharacterSetClass = {
__CFCharacterSetCopyDescription
};

static bool __CFCheckForExapendedSet = false;
static bool __CFDebugExpandedSet = false;

CF_PRIVATE void __CFCharacterSetInitialize(void) {
static dispatch_once_t initOnce;
dispatch_once(&initOnce, ^{
const char *checkForExpandedSet = getenv("__CF_DEBUG_EXPANDED_SET");
if (checkForExpandedSet && (*checkForExpandedSet == 'Y')) __CFCheckForExapendedSet = true;
if (checkForExpandedSet && (*checkForExpandedSet == 'Y')) __CFDebugExpandedSet = true;
});
}

Expand All @@ -1378,7 +1378,7 @@ CFTypeID CFCharacterSetGetTypeID(void) {
}

/*** CharacterSet creation ***/
/* Functions to create basic immutable characterset.
/* Functions to create basic immutable character set.
*/
CFCharacterSetRef CFCharacterSetGetPredefined(CFCharacterSetPredefinedSet theSetIdentifier) {
CFCharacterSetRef cset;
Expand Down Expand Up @@ -2362,7 +2362,7 @@ void CFCharacterSetAddCharactersInRange(CFMutableCharacterSetRef theSet, CFRange
}
__CFCSetPutHasHashValue(theSet, false);

if (__CFCheckForExapendedSet) __CFCheckForExpandedSet(theSet);
if (__CFDebugExpandedSet) __CFCheckForExpandedSet(theSet);
}

void CFCharacterSetRemoveCharactersInRange(CFMutableCharacterSetRef theSet, CFRange theRange) {
Expand Down Expand Up @@ -2436,7 +2436,7 @@ void CFCharacterSetRemoveCharactersInRange(CFMutableCharacterSetRef theSet, CFRa
}

__CFCSetPutHasHashValue(theSet, false);
if (__CFCheckForExapendedSet) __CFCheckForExpandedSet(theSet);
if (__CFDebugExpandedSet) __CFCheckForExpandedSet(theSet);
}

void CFCharacterSetAddCharactersInString(CFMutableCharacterSetRef theSet, CFStringRef theString) {
Expand Down Expand Up @@ -2527,7 +2527,7 @@ void CFCharacterSetAddCharactersInString(CFMutableCharacterSetRef theSet, CFStr

__CFCSetPutHasHashValue(theSet, false);

if (__CFCheckForExapendedSet) __CFCheckForExpandedSet(theSet);
if (__CFDebugExpandedSet) __CFCheckForExpandedSet(theSet);

if (hasSurrogate) __CFApplySurrogatesInString(theSet, theString, &CFCharacterSetAddCharactersInRange);
}
Expand Down Expand Up @@ -2614,7 +2614,7 @@ void CFCharacterSetRemoveCharactersInString(CFMutableCharacterSetRef theSet, CFS
}

__CFCSetPutHasHashValue(theSet, false);
if (__CFCheckForExapendedSet) __CFCheckForExpandedSet(theSet);
if (__CFDebugExpandedSet) __CFCheckForExpandedSet(theSet);

if (hasSurrogate) __CFApplySurrogatesInString(theSet, theString, &CFCharacterSetRemoveCharactersInRange);
}
Expand Down Expand Up @@ -2740,7 +2740,7 @@ void CFCharacterSetUnion(CFMutableCharacterSetRef theSet, CFCharacterSetRef theO
}
}
}
if (__CFCheckForExapendedSet) __CFCheckForExpandedSet(theSet);
if (__CFDebugExpandedSet) __CFCheckForExpandedSet(theSet);
} else { // It's NSCharacterSet
CFDataRef bitmapRep = CFCharacterSetCreateBitmapRepresentation(kCFAllocatorSystemDefault, theOtherSet);
const UInt32 *bitmap2 = (bitmapRep && CFDataGetLength(bitmapRep) ? (const UInt32 *)CFDataGetBytePtr(bitmapRep) : NULL);
Expand Down Expand Up @@ -2984,7 +2984,7 @@ void CFCharacterSetIntersect(CFMutableCharacterSetRef theSet, CFCharacterSetRef
__CFCSetDeallocateAnnexPlane(theSet);
}
}
if (__CFCheckForExapendedSet) __CFCheckForExpandedSet(theSet);
if (__CFDebugExpandedSet) __CFCheckForExpandedSet(theSet);
} else { // It's NSCharacterSet
CFDataRef bitmapRep = CFCharacterSetCreateBitmapRepresentation(kCFAllocatorSystemDefault, theOtherSet);
const UInt32 *bitmap2 = (bitmapRep && CFDataGetLength(bitmapRep) ? (const UInt32 *)CFDataGetBytePtr(bitmapRep) : NULL);
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFDateFormatter.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ static CFMutableStringRef __createISO8601FormatString(CFISO8601DateFormatOptions
} else {
CFStringAppendCString(resultStr, "HH:mm:ss", kCFStringEncodingUTF8);
}
// Add support for fracional seconds
// Add support for fractional seconds
if (includeFractionalSecs) {
CFStringAppendCString(resultStr, ".SSS", kCFStringEncodingUTF8);
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFICUConverters.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ CF_PRIVATE CFIndex __CFStringEncodingICUToBytes(const char *icuName, uint32_t fl
ucnv_fromUnicode(converter, &destination, destinationLimit, (const UChar **)&source, (const UChar *)sourceLimit, NULL, flush, &errorCode);

#if HAS_ICU_BUG_6024743
/* Another critical ICU design issue. Similar to conversion error, source pointer returned from U_BUFFER_OVERFLOW_ERROR is already beyond the last valid character position. It renders the returned value from source entirely unusable. We have to manually back up until succeeding <rdar://problem/7183045> Interestingly, this issue doesn't apply to ucnv_toUnicode. The asynmmetric nature makes this more dangerous */
/* Another critical ICU design issue. Similar to conversion error, source pointer returned from U_BUFFER_OVERFLOW_ERROR is already beyond the last valid character position. It renders the returned value from source entirely unusable. We have to manually back up until succeeding <rdar://problem/7183045> Interestingly, this issue doesn't apply to ucnv_toUnicode. The asymmetric nature makes this more dangerous */
if (U_BUFFER_OVERFLOW_ERROR == errorCode) {
const uint8_t *bitmap = CFUniCharGetBitmapPtrForPlane(kCFUniCharNonBaseCharacterSet, 0);
const uint8_t *nonBase;
Expand Down
4 changes: 2 additions & 2 deletions Sources/CoreFoundation/CFLocaleIdentifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -2195,9 +2195,9 @@ CFStringRef CFLocaleCreateLocaleIdentifierFromComponents(CFAllocatorRef allocato
CFCalendarRef cal = (CFCalendarRef)values[idx];
CFStringRef ident = CFCalendarGetIdentifier(cal);
value = __CStringFromString(ident);
char *oldkey = key;
char *oldKey = key;
key = strdup("calendar");
free(oldkey);
free(oldKey);
} else {
value = __CStringFromString(values[idx]);
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFOldStylePList.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ static Boolean advanceToNonSpace(_CFStringsFileParseInfo *pInfo) {
if (ch2 == ' ' || ch2 == 0x2028 || ch2 == 0x2029) continue; // space and Unicode line sep, para sep
if (ch2 == '/') {
if (pInfo->curr >= pInfo->end) {
// TODO: this could possibly be made more robust (imagine if pInfo->curr is stomped; pInfo->end - 1 might be safer. Unless its smashed too :-/
// TODO: this could possibly be made more robust (imagine if pInfo->curr is stomped; pInfo->end - 1 might be safer. Unless it's smashed too :-/
// whoops; back up and return
pInfo->curr --;
return true;
Expand Down
4 changes: 2 additions & 2 deletions Sources/CoreFoundation/CFPlatform.c
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ static void __CFTSDFinalize(void *arg) {
__CFMainThreadHasExited = true;
#else
if (_CFIsMainThread()) {
// Important: we need to be sure that the only time we set this flag to true is when we actually can guarentee we ARE the main thread.
// Important: we need to be sure that the only time we set this flag to true is when we actually can guarantee we ARE the main thread.
__CFMainThreadHasExited = true;
}
#endif
Expand Down Expand Up @@ -960,7 +960,7 @@ static void __CFTSDFinalize(void *arg) {
free(table);

// FreeBSD libthr emits debug message to stderr if there are leftover nonnull TSD after PTHREAD_DESTRUCTOR_ITERATIONS
// On this platform, the destructor will never be called again, therefore it is unneccessary to set the TSD to CF_TSD_BAD_PTR
// On this platform, the destructor will never be called again, therefore it is unnecessary to set the TSD to CF_TSD_BAD_PTR
#if defined(__FreeBSD__)
__CFTSDSetSpecific(NULL);
#else
Expand Down
2 changes: 1 addition & 1 deletion Sources/CoreFoundation/CFPropertyList.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ static void _appendEscapedString(CFStringRef origStr, CFMutableDataRef mStr) {
/* Base-64 encoding/decoding */

/* The base-64 encoding packs three 8-bit bytes into four 7-bit ASCII
* characters. If the number of bytes in the original data isn't divisable
* characters. If the number of bytes in the original data isn't divisible
* by three, "=" characters are used to pad the encoded data. The complete
* set of characters used in base-64 are:
*
Expand Down
4 changes: 2 additions & 2 deletions Sources/CoreFoundation/CFStorage.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ static void __CFStorageDeallocateNode(CFStorageRef storage, CFStorageNode *node)

The only acceptable time to directly call the Unfrozen variant is for the root node of a CFStorage, because root nodes may never be frozen. The isRootNode parameter determines whether we are in this case.

The Insertion functions return two nodes. As an awful performance hack, if the first node returned from __CFStorageInsert* is the same as the node passed in, that node is *not* retained, so should not be relased. If it is a different node, it is retained.
The Insertion functions return two nodes. As an awful performance hack, if the first node returned from __CFStorageInsert* is the same as the node passed in, that node is *not* retained, so should not be released. If it is a different node, it is retained.
*/
static CFStorageDoubleNodeReturn __CFStorageInsert(CFAllocatorRef allocator, CFStorageRef storage, CFStorageNode * _Nonnull node, CFIndex byteNum, CFIndex size, CFIndex absoluteByteNum);
static CFStorageNode *__CFStorageDelete(CFAllocatorRef allocator, CFStorageRef storage, CFStorageNode * _Nonnull node, CFRange range, bool compact);
Expand Down Expand Up @@ -1253,7 +1253,7 @@ void CFStorageDeleteValues(CFStorageRef storage, CFRange range) {
CFRange byteRange = __CFStorageConvertValuesToByteRange(storage, range.location, range.length);
const CFIndex expectedByteCount = storage->rootNode.numBytes - byteRange.length;

/* We don't try to mantain the cache across deletion */
/* We don't try to maintain the cache across deletion */
__CFStorageSetCache(storage, NULL, 0);

/* The root node can never be frozen, so it's always OK to modify it */
Expand Down
Loading