diff --git a/CMakeLists.txt b/CMakeLists.txt index fa842040f1..62a9c6a225 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,7 +74,7 @@ option(FOUNDATION_BUILD_NETWORKING "build FoundationNetworking" set(CMAKE_POSITION_INDEPENDENT_CODE YES) -# Fetchable dependcies +# Fetchable dependencies include(FetchContent) if (_SwiftFoundationICU_SourceDIR) FetchContent_Declare(SwiftFoundationICU diff --git a/README.md b/README.md index b760fea76d..e7d6551e3d 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It is designed with these goals in mind: There is more information on the Foundation framework [here](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/ObjC_classic/). -This project, `swift-corelibs-foundation`, provides an compatibility implementation of the Foundation API for platforms where there is no Objective-C runtime. On macOS, iOS, and other Apple platforms, apps should use the Foundation that comes with the operating system. +This project, `swift-corelibs-foundation`, provides a compatibility implementation of the Foundation API for platforms where there is no Objective-C runtime. On macOS, iOS, and other Apple platforms, apps should use the Foundation that comes with the operating system. ## Project Navigator diff --git a/Sources/CoreFoundation/CFBundle.c b/Sources/CoreFoundation/CFBundle.c index 607c7bd925..cbd5b1ddfb 100644 --- a/Sources/CoreFoundation/CFBundle.c +++ b/Sources/CoreFoundation/CFBundle.c @@ -784,7 +784,7 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL, } - // This section of _CFBundleCreate touches the disk, so it should be done outside the lock. This avoids blocking threads which are just attempting to get an existing bundle on file system access, potentially from a lower-piority thread. + // This section of _CFBundleCreate touches the disk, so it should be done outside the lock. This avoids blocking threads which are just attempting to get an existing bundle on file system access, potentially from a lower-priority thread. _CFBundleVersion localVersion = _CFBundleGetBundleVersionForURL(newURL); if (_CFBundleVersionFlat == localVersion) { Boolean exists = false; @@ -1741,7 +1741,7 @@ CFBundleRef _CFBundleGetBundleWithIdentifierAndLibraryName(CFStringRef bundleID, } static void _CFBundleEnsureAllBundlesUpToDate(void) { - // This method returns all the statically linked bundles. This includes the main bundle as well as any frameworks that the process was linked against at launch time. It does not include frameworks or opther bundles that were loaded dynamically. + // This method returns all the statically linked bundles. This includes the main bundle as well as any frameworks that the process was linked against at launch time. It does not include frameworks or other bundles that were loaded dynamically. CFArrayRef imagePaths = NULL; // Tickle the main bundle into existence (void)CFBundleGetMainBundle(); diff --git a/Sources/CoreFoundation/CFBundle_InfoPlist.c b/Sources/CoreFoundation/CFBundle_InfoPlist.c index bf818a2ff9..0c84913324 100644 --- a/Sources/CoreFoundation/CFBundle_InfoPlist.c +++ b/Sources/CoreFoundation/CFBundle_InfoPlist.c @@ -1017,7 +1017,7 @@ CF_PRIVATE void _CFBundleRefreshInfoDictionaryAlreadyLocked(CFBundleRef bundle) if (bundle->_infoPlistUrl) { CFRelease(bundle->_infoPlistUrl); } - bundle->_infoPlistUrl = infoPlistUrl; // transfered as retained + bundle->_infoPlistUrl = infoPlistUrl; // transferred as retained // Add or fixup any keys that will be expected later if (bundle->_infoDict) _CFBundleInfoPlistFixupInfoDictionary(bundle, (CFMutableDictionaryRef)bundle->_infoDict); diff --git a/Sources/CoreFoundation/CFBundle_Tables.c b/Sources/CoreFoundation/CFBundle_Tables.c index a0c1b9ea2e..f36399a2fe 100644 --- a/Sources/CoreFoundation/CFBundle_Tables.c +++ b/Sources/CoreFoundation/CFBundle_Tables.c @@ -91,7 +91,7 @@ static void _CFBundleRemoveFromTables(CFBundleRef bundle, CFURLRef bundleURL, CF // Since we no longer allow bundles to be removed from tables, this method does nothing. Modifying the tables during deallocation is risky because if the caller has over-released the bundle object then we will deadlock on the global lock. #if TARGET_OS_OSX if (_useUnsafeUnretainedTables()) { - // Except for special cases of unsafe-unretained, where we must clean up the table or risk handing out a zombie object. There may still be outstanding pointers to these bundes (e.g. the result of CFBundleGetBundleWithIdentifier) but there is nothing we can do about that after this point. + // Except for special cases of unsafe-unretained, where we must clean up the table or risk handing out a zombie object. There may still be outstanding pointers to these bundles (e.g. the result of CFBundleGetBundleWithIdentifier) but there is nothing we can do about that after this point. // Unique bundles aren't in the tables anyway if (bundle->_isUnique) return; diff --git a/Sources/CoreFoundation/CFCalendar.c b/Sources/CoreFoundation/CFCalendar.c index f4342411bb..54bb2bf10d 100644 --- a/Sources/CoreFoundation/CFCalendar.c +++ b/Sources/CoreFoundation/CFCalendar.c @@ -129,7 +129,7 @@ static void __CFCalendarSetToFirstInstant(CFCalendarRef calendar, CFCalendarUnit int32_t qmonth[] = {0, 0, 0, 3, 3, 3, 6, 6, 6, 9, 9, 9, 9}; month = qmonth[month]; } - // #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_MONTH, month); __cficu_ucal_set(calendar->_cal, UCAL_IS_LEAP_MONTH, 0); diff --git a/Sources/CoreFoundation/CFCalendar_Enumerate.c b/Sources/CoreFoundation/CFCalendar_Enumerate.c index d60bf7f39d..733ce9d776 100644 --- a/Sources/CoreFoundation/CFCalendar_Enumerate.c +++ b/Sources/CoreFoundation/CFCalendar_Enumerate.c @@ -1755,13 +1755,13 @@ static CFDateRef _Nullable _CFCalendarCreateAdjustedDateForMismatchedLeapMonthOr if (!foundGregLeap || !foundGregLeapMatchesComps) { if (strictMatching) { if (isGregorianCalendar) { - *exactMatch = false; // We couldn't find what we needed but we found sumthin. Step C will decide whether or not to NULL the date out. + *exactMatch = false; // We couldn't find what we needed but we found something. Step C will decide whether or not to NULL the date out. } else { // For other calendars (besides Chinese which is already being handled), go to the top of the next period for the next highest unit of the one that bailed. Boolean eraMatch = false; CFDateRef tempDate = _CFCalendarCreateMatchingDateAfterStartDateMatchingComponentsInNextHighestUnitRange(calendar, &eraMatch, matchingComponents, nextHighestUnit, searchingDate, goBackwards, findLast, opts); if (!eraMatch) { - *exactMatch = false; // We couldn't find what we needed but we found sumthin. Step C will decide whether or not to NULL the date out. + *exactMatch = false; // We couldn't find what we needed but we found something. Step C will decide whether or not to NULL the date out. CFRelease(tempDate); } else { CFRelease(result); diff --git a/Sources/CoreFoundation/CFData.c b/Sources/CoreFoundation/CFData.c index ba159e14ee..44864a8a42 100644 --- a/Sources/CoreFoundation/CFData.c +++ b/Sources/CoreFoundation/CFData.c @@ -105,7 +105,7 @@ enum { }; typedef enum { - kCFImmutable = 0x0, /* unchangable and fixed capacity; default */ + kCFImmutable = 0x0, /* unchangeable and fixed capacity; default */ kCFFixedMutable = 0x1, /* changeable and fixed capacity */ kCFMutable = 0x3 /* changeable and variable capacity */ } _CFDataMutableVariety; diff --git a/Sources/CoreFoundation/CFDateFormatter.c b/Sources/CoreFoundation/CFDateFormatter.c index 5c1e4d3324..ad938a4337 100644 --- a/Sources/CoreFoundation/CFDateFormatter.c +++ b/Sources/CoreFoundation/CFDateFormatter.c @@ -155,12 +155,12 @@ CFStringRef CFDateFormatterCreateDateFormatFromTemplate(CFAllocatorRef allocator } UChar pattern[BUFFER_SIZE] = {0}, skel[BUFFER_SIZE] = {0}, bpat[BUFFER_SIZE] = {0}; - CFIndex tmpltLen = CFStringGetLength(tmplateString); - if (BUFFER_SIZE < tmpltLen) tmpltLen = BUFFER_SIZE; - CFStringGetCharacters(tmplateString, CFRangeMake(0, tmpltLen), (UniChar *)pattern); + CFIndex tmplateLen = CFStringGetLength(tmplateString); + if (BUFFER_SIZE < tmplateLen) tmplateLen = BUFFER_SIZE; + CFStringGetCharacters(tmplateString, CFRangeMake(0, tmplateLen), (UniChar *)pattern); CFRelease(tmplateString); - int32_t patlen = tmpltLen; + int32_t patlen = tmplateLen; UErrorCode status = U_ZERO_ERROR; int32_t skellen = __cficu_udatpg_getSkeleton(ptg, pattern, patlen, skel, sizeof(skel) / sizeof(skel[0]), &status); if (!U_FAILURE(status)) { @@ -872,7 +872,7 @@ static CFMutableStringRef __createISO8601FormatString(CFISO8601DateFormatOptions CFStringAppendCString(resultStr, "HH:mm:ss", kCFStringEncodingUTF8); } - // Add support for fracional seconds + // Add support for fractional seconds if (includeFractionalSecs) { CFStringAppendCString(resultStr, ".SSS", kCFStringEncodingUTF8); } @@ -2174,8 +2174,8 @@ CFTypeRef CFDateFormatterCopyProperty(CFDateFormatterRef formatter, CFStringRef } CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef tmplateString, CFLocaleRef locale, UErrorCode *outErrorCode) { - CFIndex const tmpltLen = CFStringGetLength(tmplateString); - if (tmpltLen == 0) { + CFIndex const tmplateLen = CFStringGetLength(tmplateString); + if (tmplateLen == 0) { if (outErrorCode) { *outErrorCode = U_ILLEGAL_ARGUMENT_ERROR; } @@ -2186,15 +2186,15 @@ CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef tmplateString Boolean success = useTemplatePatternGenerator(locale, ^(UDateTimePatternGenerator *ptg) { #define BUFFER_SIZE 768 - SAFE_STACK_BUFFER_DECL(UChar, ubuffer, tmpltLen, BUFFER_SIZE); + SAFE_STACK_BUFFER_DECL(UChar, ubuffer, tmplateLen, BUFFER_SIZE); UChar const *ustr = (UChar *)CFStringGetCharactersPtr(tmplateString); if (ustr == NULL) { - CFStringGetCharacters(tmplateString, CFRangeMake(0, tmpltLen), (UniChar *)ubuffer); + CFStringGetCharacters(tmplateString, CFRangeMake(0, tmplateLen), (UniChar *)ubuffer); ustr = ubuffer; } UChar skel[BUFFER_SIZE] = {0}; - int32_t patlen = tmpltLen; + int32_t patlen = tmplateLen; UErrorCode status = U_ZERO_ERROR; int32_t skelLen = __cficu_udatpg_getSkeleton(ptg, ustr, patlen, skel, sizeof(skel) / sizeof(skel[0]), &status); if (U_SUCCESS(status)) { diff --git a/Sources/CoreFoundation/CFICUConverters.c b/Sources/CoreFoundation/CFICUConverters.c index 78b60b3fc7..06d8f1a3a2 100644 --- a/Sources/CoreFoundation/CFICUConverters.c +++ b/Sources/CoreFoundation/CFICUConverters.c @@ -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 Intrestingly, 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 Interestingly, this issue doesn't apply to ucnv_toUnicode. The asynmmetric nature makes this more dangerous */ if (U_BUFFER_OVERFLOW_ERROR == errorCode) { const uint8_t *bitmap = CFUniCharGetBitmapPtrForPlane(kCFUniCharNonBaseCharacterSet, 0); const uint8_t *nonBase; diff --git a/Sources/CoreFoundation/CFLocale.c b/Sources/CoreFoundation/CFLocale.c index 243a78980d..06f8617f60 100644 --- a/Sources/CoreFoundation/CFLocale.c +++ b/Sources/CoreFoundation/CFLocale.c @@ -507,7 +507,7 @@ CFArrayRef _CFLocaleCopyValidNumberingSystemsForLocaleIdentifier(CFStringRef loc return numberingSystemIDs; } -CFStringRef _CFLocaleCreateLocaleIdentiferByReplacingLanguageCodeAndScriptCode(CFStringRef localeIDWithDesiredLangCode, CFStringRef localeIDWithDesiredComponents) { +CFStringRef _CFLocaleCreateLocaleIdentifierByReplacingLanguageCodeAndScriptCode(CFStringRef localeIDWithDesiredLangCode, CFStringRef localeIDWithDesiredComponents) { CFStringRef localeID = NULL; if (localeIDWithDesiredLangCode && localeIDWithDesiredComponents) { CFStringRef langIDToUse = _CFLocaleCopyLanguageIdentifierWithScriptCodeForLocaleIdentifier(localeIDWithDesiredLangCode); @@ -540,7 +540,7 @@ CFStringRef _CFLocaleCreateLocaleIdentiferByReplacingLanguageCodeAndScriptCode(C if (indexOfNumberingSystem == kCFNotFound || indexOfNumberingSystem == 0) { CFDictionaryRemoveValue(mutableComps, CFSTR("numbers")); } - // If the numbering system for `localeIDWithDesiredComponents` is compatible with the constructed locale’s language and is not already the default numbering system (index 0), then set it on the new locale, e.g. `hi_IN@numbers=latn` + `ar` shoudl get `ar_IN@numbers=latn`, since `latn` is valid for `ar`. + // If the numbering system for `localeIDWithDesiredComponents` is compatible with the constructed locale’s language and is not already the default numbering system (index 0), then set it on the new locale, e.g. `hi_IN@numbers=latn` + `ar` should get `ar_IN@numbers=latn`, since `latn` is valid for `ar`. else if (indexOfNumberingSystem > 0) { CFDictionarySetValue(mutableComps, CFSTR("numbers"), numberingSystem); } @@ -601,7 +601,7 @@ static CFStringRef _CFLocaleCreateLocaleIdentifierForAvailableLocalizations(CFAr if (CFEqual(preferredLocaleLanguageID, preferredLocalizationLanguageID)) { result = CFRetain(preferredLocaleID); } else { - result = _CFLocaleCreateLocaleIdentiferByReplacingLanguageCodeAndScriptCode(preferredLocalization, preferredLocaleID); + result = _CFLocaleCreateLocaleIdentifierByReplacingLanguageCodeAndScriptCode(preferredLocalization, preferredLocaleID); } } if (preferredLocaleLanguageID) { CFRelease(preferredLocaleLanguageID); } @@ -723,7 +723,7 @@ static CFLocaleRef _CFLocaleCopyCurrentGuts(CFStringRef name, Boolean useCache, if (!ident) { ident = (CFStringRef)CFRetain(FALLBACK_LOCALE_NAME); - // CFLocaleCopyCurrent() failed to look up current locale -- gpsd dameon is not localized, does not interact directly with users + // CFLocaleCopyCurrent() failed to look up current locale -- gpsd daemon is not localized, does not interact directly with users // This log was added to try to catch scenarios in which apps fail to look up the current locale thanks to sandboxing issues or CFPreferences issues. It turns out that in its current formulation, this log has a high false positive rate and is very confusing. // Disabled for now. /* diff --git a/Sources/CoreFoundation/CFLocaleIdentifier.c b/Sources/CoreFoundation/CFLocaleIdentifier.c index a1058783ed..f797ae0c01 100644 --- a/Sources/CoreFoundation/CFLocaleIdentifier.c +++ b/Sources/CoreFoundation/CFLocaleIdentifier.c @@ -1950,7 +1950,7 @@ SPI: CFLocaleGetLanguageRegionEncodingForLocaleIdentifier gets the appropriate otherwise may set *langCode and/or *regCode to -1 if there is no appropriate legacy value for the locale. This is a replacement for the CFBundle SPI CFBundleGetLocalizationInfoForLocalization (which was intended to be temporary and transitional); this function is more up-to-date in its handling of locale strings, and is in CFLocale where this functionality should belong. Compared - to CFBundleGetLocalizationInfoForLocalization, this function does not spcially interpret a NULL localeIdentifier to mean use the single most + to CFBundleGetLocalizationInfoForLocalization, this function does not specially interpret a NULL localeIdentifier to mean use the single most preferred localization in the current context (this function returns NO for a NULL localeIdentifier); and in this function langCode, regCode, and scriptCode are all SInt16* (not SInt32* like the equivalent parameters in CFBundleGetLocalizationInfoForLocalization). */ @@ -1966,18 +1966,18 @@ Boolean CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeI char localeCString[kLocaleIdentifierCStringMax]; if ( CFStringGetCString(canonicalIdentifier, localeCString, sizeof(localeCString), kCFStringEncodingASCII) ) { UErrorCode icuStatus = U_ZERO_ERROR; - int32_t languagelength; + int32_t languageLength; char searchString[ULOC_LANG_CAPACITY + ULOC_FULLNAME_CAPACITY]; - languagelength = uloc_getLanguage( localeCString, searchString, ULOC_LANG_CAPACITY, &icuStatus ); - if ( U_SUCCESS(icuStatus) && languagelength > 0 ) { + languageLength = uloc_getLanguage( localeCString, searchString, ULOC_LANG_CAPACITY, &icuStatus ); + if ( U_SUCCESS(icuStatus) && languageLength > 0 ) { // OK, here we have at least a language code, check for other components in order LocaleToLegacyCodes searchEntry = { (const char *)searchString, 0, 0, 0 }; const LocaleToLegacyCodes * foundEntryPtr; int32_t componentLength; char componentString[ULOC_FULLNAME_CAPACITY]; - languagelength = strlen(searchString); // in case it got truncated + languageLength = strlen(searchString); // in case it got truncated icuStatus = U_ZERO_ERROR; componentLength = uloc_getScript( localeCString, componentString, sizeof(componentString), &icuStatus ); Boolean foundScript = false; @@ -2006,9 +2006,9 @@ Boolean CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeI // Do not try fallback if string encoding is requested AND a script is present in the passed-in locale since the script might affect the string encoding: BOOL lookingForScript = foundScript && stringEncoding != NULL; - if (foundEntryPtr == NULL && (int32_t) strlen(searchString) > languagelength && !lookingForScript) { + if (foundEntryPtr == NULL && (int32_t) strlen(searchString) > languageLength && !lookingForScript) { // Otherwise truncate to language alone and try again - searchString[languagelength] = 0; + searchString[languageLength] = 0; foundEntryPtr = (const LocaleToLegacyCodes *)bsearch( &searchEntry, localeToLegacyCodes, kNumLocaleToLegacyCodes, sizeof(LocaleToLegacyCodes), CompareLocaleToLegacyCodesEntries ); } diff --git a/Sources/CoreFoundation/CFStream.c b/Sources/CoreFoundation/CFStream.c index 5d3786df21..9079192ebd 100644 --- a/Sources/CoreFoundation/CFStream.c +++ b/Sources/CoreFoundation/CFStream.c @@ -561,7 +561,7 @@ static void _signalEventSync(struct _CFStream* stream) /* What happens if the callback sets the client to NULL? We're in a loop here... Hmm. */ /* After writing that comment, I see: CFReadStreamSetClient(..., NULL) unsafely releases info pointer immediately */ - /* Of note, when the stream callbacks are set to to NULL, we're re-initalized so as not to receive more events, so we + /* Of note, when the stream callbacks are set to to NULL, we're re-initialized so as not to receive more events, so we * should break pout of this loop */ } } diff --git a/Sources/CoreFoundation/CFString.c b/Sources/CoreFoundation/CFString.c index fccec8f880..d2b88aa6d3 100644 --- a/Sources/CoreFoundation/CFString.c +++ b/Sources/CoreFoundation/CFString.c @@ -852,7 +852,7 @@ void __CFStringHandleOutOfMemory(CFTypeRef _Nullable obj) CLANG_ANALYZER_NORETUR CFStringRef msg = CFSTR("Out of memory. We suggest restarting the application. If you have an unsaved document, create a backup copy in Finder, then try to save."); } -/* Reallocates the backing store of the string to accomodate the new length. Space is reserved or characters are deleted as indicated by insertLength and the ranges in deleteRanges. The length is updated to reflect the new state. Will also maintain a length byte and a null byte in 8-bit strings. If length cannot fit in length byte, the space will still be reserved, but will be 0. (Hence the reason the length byte should never be looked at as length unless there is no explicit length.) +/* Reallocates the backing store of the string to accommodate the new length. Space is reserved or characters are deleted as indicated by insertLength and the ranges in deleteRanges. The length is updated to reflect the new state. Will also maintain a length byte and a null byte in 8-bit strings. If length cannot fit in length byte, the space will still be reserved, but will be 0. (Hence the reason the length byte should never be looked at as length unless there is no explicit length.) */ static void __CFStringChangeSizeMultiple(CFMutableStringRef str, const CFRange *deleteRanges, CFIndex numDeleteRanges, CFIndex insertLength, Boolean makeUnicode) { const uint8_t *curContents = (uint8_t *)__CFStrContents(str); @@ -2434,7 +2434,7 @@ CF_INLINE bool _CFCanUseLocale(CFLocaleRef locale) { #define HANGUL_SYLLABLE_END (0xD7AF) -// Returns the length of characters filled into outCharacters. If no change, returns 0. maxBufLen shoule be at least 8 +// Returns the length of characters filled into outCharacters. If no change, returns 0. maxBufLen should be at least 8 static CFIndex __CFStringFoldCharacterClusterAtIndex(UTF32Char character, CFStringInlineBuffer *buffer, CFIndex index, CFOptionFlags flags, const uint8_t *langCode, UTF32Char *outCharacters, CFIndex maxBufferLength, CFIndex *consumedLength, bool *insufficientBufferSpace) { CFIndex filledLength = 0, currentIndex = index; @@ -4579,9 +4579,8 @@ CFRange CFStringGetRangeOfComposedCharactersAtIndex(CFStringRef theString, CFInd (length 0), in which case no search is performed. @param searchOptions The bitwise-or'ed option flags to control the search behavior. The supported options are - kCFCompareBackwards andkCFCompareAnchored. - If other option flags are specified, the behavior - is undefined. + kCFCompareBackwards and kCFCompareAnchored. + If other option flags are specified, the behavior is undefined. @param result The pointer to a CFRange supplied by the caller in which the search result is stored. If a pointer to an invalid memory is specified, the behavior is undefined. diff --git a/Sources/CoreFoundation/CFStringEncodingDatabase.c b/Sources/CoreFoundation/CFStringEncodingDatabase.c index 3f25102a7f..94ea7a145f 100644 --- a/Sources/CoreFoundation/CFStringEncodingDatabase.c +++ b/Sources/CoreFoundation/CFStringEncodingDatabase.c @@ -209,7 +209,7 @@ static const uint16_t __CFWindowsCPList[] = { 0, 54936, - 50221, // we prefere this over 50220/50221 since that's what CF coverter generates + 50221, // we prefer this over 50220/50221 since that's what CF converter generates 0, 0, 0, diff --git a/Sources/CoreFoundation/CFStringEncodings.c b/Sources/CoreFoundation/CFStringEncodings.c index 9c2d500c07..bd20a0fe3b 100644 --- a/Sources/CoreFoundation/CFStringEncodings.c +++ b/Sources/CoreFoundation/CFStringEncodings.c @@ -683,7 +683,7 @@ CFIndex __CFStringEncodeByteStream(CFStringRef string, CFIndex rangeLoc, CFIndex static dispatch_once_t onceToken; static CFStringEncodingToBytesProc __CFToUTF8 = NULL; dispatch_once(&onceToken, ^{ - // Thiis encoder is built-in, no need to check it more than once + // This encoder is built-in, no need to check it more than once __CFToUTF8 = CFStringEncodingGetConverter(kCFStringEncodingUTF8)->toBytes.standard; }); diff --git a/Sources/CoreFoundation/CFStringUtilities.c b/Sources/CoreFoundation/CFStringUtilities.c index 8f48bf3d34..ff6a73cbf2 100644 --- a/Sources/CoreFoundation/CFStringUtilities.c +++ b/Sources/CoreFoundation/CFStringUtilities.c @@ -651,7 +651,7 @@ CF_PRIVATE CFComparisonResult _CFCompareStringsWithLocale(CFStringInlineBuffer * CFIndex str2Max = str2Range.location + str2Range.length; CFIndex bufferSize; - // Extend forward and compare until the result is deterministic. The result is indeterministic if the differences are weak and can be resolved by character folding. For example, comparision between "abc" and "ABC" is considered to be indeterministic. + // Extend forward and compare until the result is deterministic. The result is indeterministic if the differences are weak and can be resolved by character folding. For example, comparison between "abc" and "ABC" is considered to be indeterministic. do { if (str1Range.location < str1Max) { str1Range.location = __extendLocationForward(str1Range.location, str1, alnumBMP, punctBMP, controlBMP, str1Max); diff --git a/Sources/CoreFoundation/CFURLComponents_URIParser.c b/Sources/CoreFoundation/CFURLComponents_URIParser.c index 76242fe823..e6045a4eaf 100644 --- a/Sources/CoreFoundation/CFURLComponents_URIParser.c +++ b/Sources/CoreFoundation/CFURLComponents_URIParser.c @@ -716,7 +716,7 @@ CF_PRIVATE Boolean _CFURIParserParseURIReference(CFStringRef urlString, struct _ // clear the parseInfo bzero(parseInfo, sizeof(*parseInfo)); - // Make sure the URL string isn't too long. We're limiting it to 2GB for backwards compatibility with 32-bit excutables using NS/CFURL + // Make sure the URL string isn't too long. We're limiting it to 2GB for backwards compatibility with 32-bit executables using NS/CFURL if ( (urlStringLength > 0) && (urlStringLength <= INT_MAX) ) { CFStringInitInlineBuffer(urlString, &buf, CFRangeMake(0, urlStringLength)); diff --git a/Sources/CoreFoundation/CFXMLPreferencesDomain.c b/Sources/CoreFoundation/CFXMLPreferencesDomain.c index 28af3673d9..4b02b1c126 100644 --- a/Sources/CoreFoundation/CFXMLPreferencesDomain.c +++ b/Sources/CoreFoundation/CFXMLPreferencesDomain.c @@ -83,7 +83,7 @@ CF_INLINE void URLPropertyDictRelease(void) { __CFUnlock(&_propDictLock); } -// Asssumes caller already knows the directory doesn't exist. +// Assumes caller already knows the directory doesn't exist. static Boolean _createDirectory(CFURLRef dirURL, Boolean worldReadable) { CFAllocatorRef alloc = __CFPreferencesAllocator(); CFURLRef parentURL = CFURLCreateCopyDeletingLastPathComponent(alloc, dirURL); diff --git a/Sources/CoreFoundation/include/CFBundle.h b/Sources/CoreFoundation/include/CFBundle.h index 36d6d061f9..c0769b24c7 100644 --- a/Sources/CoreFoundation/include/CFBundle.h +++ b/Sources/CoreFoundation/include/CFBundle.h @@ -64,7 +64,7 @@ CFBundleRef CFBundleGetBundleWithIdentifier(CFStringRef bundleID); CF_EXPORT CFArrayRef CFBundleGetAllBundles(void); /* This is potentially expensive, and not thread-safe. Use with care. */ - /* Best used for debuggging or other diagnostic purposes. */ + /* Best used for debugging or other diagnostic purposes. */ /* ===================== Creating Bundles ===================== */ diff --git a/Sources/CoreFoundation/include/CFBundlePriv.h b/Sources/CoreFoundation/include/CFBundlePriv.h index 1a823b3183..9f1cb73ea7 100644 --- a/Sources/CoreFoundation/include/CFBundlePriv.h +++ b/Sources/CoreFoundation/include/CFBundlePriv.h @@ -269,7 +269,7 @@ CF_EXPORT cpu_type_t _CFBundleGetPreferredExecutableArchitectureForURL(CFURLRef url) API_AVAILABLE(macos(10.16)) API_UNAVAILABLE(ios, watchos, tvos); #endif -/* SPI for AppKit usage only, they should be only used in limited secnarios of the application load lifecycle */ +/* SPI for AppKit usage only, they should be only used in limited scenarios of the application load lifecycle */ CF_EXPORT Boolean _CFBundleAddResourceURL(CFBundleRef bundle, CFURLRef url) API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)); diff --git a/Sources/CoreFoundation/include/CFCharacterSet.h b/Sources/CoreFoundation/include/CFCharacterSet.h index 9e316afc35..bb1697db2a 100644 --- a/Sources/CoreFoundation/include/CFCharacterSet.h +++ b/Sources/CoreFoundation/include/CFCharacterSet.h @@ -27,7 +27,7 @@ bitmap representation rarely has 136K byte. For detailed discussion of the external bitmap representation, refer to the comments for CFCharacterSetCreateWithBitmapRepresentation below. - Note that the existance of non-BMP characters in a character set + Note that the existence of non-BMP characters in a character set does not imply the membership of the corresponding surrogate characters. For example, a character set with U+10000 does not match with U+D800. @@ -135,7 +135,7 @@ CFCharacterSetRef CFCharacterSetCreateWithCharactersInString(CFAllocatorRef allo /*! @function CFCharacterSetCreateWithBitmapRepresentation - Creates a new immutable character set with the bitmap representtion in the given data. + Creates a new immutable character set with the bitmap representation in the given data. @param alloc The CFAllocator which should be used to allocate memory for the array and its storage for values. This parameter may be NULL in which case the current default @@ -181,10 +181,10 @@ CF_EXPORT CFCharacterSetRef CFCharacterSetCreateInvertedSet(CFAllocatorRef alloc Reports whether or not the character set is a superset of the character set specified as the second parameter. @param theSet The character set to be checked for the membership of theOtherSet. If this parameter is not a valid CFCharacterSet, the behavior is undefined. - @param theOtherset The character set to be checked whether or not it is a subset of theSet. + @param theOtherSet The character set to be checked whether or not it is a subset of theSet. If this parameter is not a valid CFCharacterSet, the behavior is undefined. */ -CF_EXPORT Boolean CFCharacterSetIsSupersetOfSet(CFCharacterSetRef theSet, CFCharacterSetRef theOtherset); +CF_EXPORT Boolean CFCharacterSetIsSupersetOfSet(CFCharacterSetRef theSet, CFCharacterSetRef theOtherSet); /*! @function CFCharacterSetHasMemberInPlane @@ -288,7 +288,7 @@ CFDataRef CFCharacterSetCreateBitmapRepresentation(CFAllocatorRef alloc, CFChara /*! @function CFCharacterSetAddCharactersInRange - Adds the given range to the charaacter set. + Adds the given range to the character set. @param theSet The character set to which the range is to be added. If this parameter is not a valid mutable CFCharacterSet, the behavior is undefined. diff --git a/Sources/CoreFoundation/include/CFCharacterSetPriv.h b/Sources/CoreFoundation/include/CFCharacterSetPriv.h index 73f12b3a07..23ac2de5c3 100644 --- a/Sources/CoreFoundation/include/CFCharacterSetPriv.h +++ b/Sources/CoreFoundation/include/CFCharacterSetPriv.h @@ -47,7 +47,7 @@ CF_INLINE UTF32Char CFCharacterSetGetLongCharacterForSurrogatePair(UniChar surro return (UTF32Char)(((surrogateHigh - 0xD800UL) << 10) + (surrogateLow - 0xDC00UL) + 0x0010000UL); } -/* Check to see if the character represented by the surrogate pair surrogateHigh & surrogateLow is in the chraracter set */ +/* Check to see if the character represented by the surrogate pair surrogateHigh & surrogateLow is in the character set */ CF_EXPORT Boolean CFCharacterSetIsSurrogatePairMember(CFCharacterSetRef theSet, UniChar surrogateHigh, UniChar surrogateLow) ; /* Keyed-coding support diff --git a/Sources/CoreFoundation/include/CFPriv.h b/Sources/CoreFoundation/include/CFPriv.h index b9a025d06f..b403db102f 100644 --- a/Sources/CoreFoundation/include/CFPriv.h +++ b/Sources/CoreFoundation/include/CFPriv.h @@ -562,7 +562,7 @@ CF_EXPORT CFHashCode _CFNonObjCHash(CFTypeRef cf); *langCode and/or *regCode to -1 if there is no appropriate legacy value for the locale. This is a replacement for the CFBundle SPI CFBundleGetLocalizationInfoForLocalization (which was intended to be temporary and transitional); this function is more up-to-date in its handling of locale strings, and is in CFLocale where this functionality should belong. Compared - to CFBundleGetLocalizationInfoForLocalization, this function does not spcially interpret a NULL localeIdentifier to mean use the single most + to CFBundleGetLocalizationInfoForLocalization, this function does not specially interpret a NULL localeIdentifier to mean use the single most preferred localization in the current context (this function returns NO for a NULL localeIdentifier); and in this function langCode, regCode, and scriptCode are all SInt16* (not SInt32* like the equivalent parameters in CFBundleGetLocalizationInfoForLocalization). */ @@ -664,7 +664,7 @@ CF_EXPORT void _CFRunLoopSetWindowsMessageQueueHandler(CFRunLoopRef rl, CFString #endif -CF_EXPORT CFArrayRef CFDateFormatterCreateDateFormatsFromTemplates(CFAllocatorRef allocator, CFArrayRef tmplates, CFOptionFlags options, CFLocaleRef locale); +CF_EXPORT CFArrayRef CFDateFormatterCreateDateFormatsFromTemplates(CFAllocatorRef allocator, CFArrayRef templates, CFOptionFlags options, CFLocaleRef locale); #if TARGET_OS_IPHONE // Available for internal use on embedded diff --git a/Sources/CoreFoundation/include/CFStream.h b/Sources/CoreFoundation/include/CFStream.h index 097b3243ff..6108fedf83 100644 --- a/Sources/CoreFoundation/include/CFStream.h +++ b/Sources/CoreFoundation/include/CFStream.h @@ -187,7 +187,7 @@ CF_EXPORT const CFStringRef _Nonnull kCFStreamPropertySOCKSVersion CF_AVAILABLE( * kCFStreamSocketSOCKSVersion4 * * Discussion: - * CFDictionary value for SOCKS proxy information. Indcates that + * CFDictionary value for SOCKS proxy information. Indicates that * SOCKS will or is using version 4 of the SOCKS protocol. * */ @@ -437,7 +437,7 @@ Boolean CFWriteStreamSetProperty(CFWriteStreamRef _Null_unspecified stream, CFSt or on one or more run loops. If scheduled on a run loop, it is the caller's responsibility to ensure that at least one of the scheduled run loops is being run. - NOTE: Unlike other CoreFoundation APIs, pasing a NULL clientContext here will remove + NOTE: Unlike other CoreFoundation APIs, passing a NULL clientContext here will remove the client. If you do not care about the client context (i.e. your only concern is that your callback be called), you should pass in a valid context where every entry is 0 or NULL. diff --git a/Sources/CoreFoundation/include/CFStreamPriv.h b/Sources/CoreFoundation/include/CFStreamPriv.h index 78763f81ce..1c9e9d180d 100644 --- a/Sources/CoreFoundation/include/CFStreamPriv.h +++ b/Sources/CoreFoundation/include/CFStreamPriv.h @@ -38,10 +38,10 @@ struct _CFStreamCallBacks { Boolean (*open)(struct _CFStream *stream, CFErrorRef *error, Boolean *openComplete, void *info); Boolean (*openCompleted)(struct _CFStream *stream, CFErrorRef *error, void *info); CFIndex (*read)(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFErrorRef *error, Boolean *atEOF, void *info); - const UInt8 *(*getBuffer)(CFReadStreamRef sream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFErrorRef *error, Boolean *atEOF, void *info); - Boolean (*canRead)(CFReadStreamRef, CFErrorRef *error, void *info); - CFIndex (*write)(CFWriteStreamRef, const UInt8 *buffer, CFIndex bufferLength, CFErrorRef *error, void *info); - Boolean (*canWrite)(CFWriteStreamRef, CFErrorRef *error, void *info); + const UInt8 *(*getBuffer)(CFReadStreamRef stream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFErrorRef *error, Boolean *atEOF, void *info); + Boolean (*canRead)(CFReadStreamRef stream, CFErrorRef *error, void *info); + CFIndex (*write)(CFWriteStreamRef stream, const UInt8 *buffer, CFIndex bufferLength, CFErrorRef *error, void *info); + Boolean (*canWrite)(CFWriteStreamRef stream, CFErrorRef *error, void *info); void (*close)(struct _CFStream *stream, void *info); CFTypeRef (*copyProperty)(struct _CFStream *stream, CFStringRef propertyName, void *info); diff --git a/Sources/CoreFoundation/include/CFStringEncodingConverter.h b/Sources/CoreFoundation/include/CFStringEncodingConverter.h index 0447727cb6..948af6bcb4 100644 --- a/Sources/CoreFoundation/include/CFStringEncodingConverter.h +++ b/Sources/CoreFoundation/include/CFStringEncodingConverter.h @@ -17,7 +17,7 @@ CF_EXTERN_C_BEGIN /* Values for flags argument for the conversion functions below. These can be combined, but the three NonSpacing behavior flags are exclusive. */ -// kCFStringEncodingBasicDirectionLeftToRight ~ kCFStringEncodingPrependBOM will probably be deprecated and superceded by kCFStringEncodingPartialInput flag +// kCFStringEncodingBasicDirectionLeftToRight ~ kCFStringEncodingPrependBOM will probably be deprecated and superseded by kCFStringEncodingPartialInput flag enum { kCFStringEncodingAllowLossyConversion = (1UL << 0), // Uses fallback functions to substitutes non mappable chars kCFStringEncodingBasicDirectionLeftToRight = (1UL << 1), // Converted with original direction left-to-right. @@ -29,7 +29,7 @@ enum { kCFStringEncodingUseHFSPlusCanonical = (1UL << 7), // Always use canonical form but leaves 0x2000 ranges kCFStringEncodingPrependBOM = (1UL << 8), // Prepend BOM sequence (i.e. ISO2022KR) kCFStringEncodingDisableCorporateArea = (1UL << 9), // Disable the usage of 0xF8xx area for Apple proprietary chars in converting to UniChar, resulting loosely mapping. - kCFStringEncodingASCIICompatibleConversion = (1UL << 10), // This flag forces strict ASCII compatible converion. i.e. MacJapanese 0x5C maps to Unicode 0x5C. + kCFStringEncodingASCIICompatibleConversion = (1UL << 10), // This flag forces strict ASCII compatible conversion. i.e. MacJapanese 0x5C maps to Unicode 0x5C. kCFStringEncodingLenientUTF8Conversion = (1UL << 11), // 10.1 (Puma) compatible lenient UTF-8 conversion. kCFStringEncodingPartialInput = (1UL << 12), // input buffer is a part of stream kCFStringEncodingPartialOutput = (1UL << 13) // output buffer streaming diff --git a/Sources/CoreFoundation/include/CFStringEncodingDatabase.h b/Sources/CoreFoundation/include/CFStringEncodingDatabase.h index 3700cd2e52..e0b195135f 100644 --- a/Sources/CoreFoundation/include/CFStringEncodingDatabase.h +++ b/Sources/CoreFoundation/include/CFStringEncodingDatabase.h @@ -20,4 +20,4 @@ CF_PRIVATE CFStringEncoding __CFStringEncodingGetFromCanonicalName(const char *c CF_PRIVATE CFStringEncoding __CFStringEncodingGetMostCompatibleMacScript(CFStringEncoding encoding); -CF_PRIVATE const char *__CFStringEncodingGetName(CFStringEncoding encoding); // Returns simple non-localizd name +CF_PRIVATE const char *__CFStringEncodingGetName(CFStringEncoding encoding); // Returns simple non-localized name diff --git a/Sources/CoreFoundation/include/CFTree.h b/Sources/CoreFoundation/include/CFTree.h index 7d76e34868..0ff7041ec9 100644 --- a/Sources/CoreFoundation/include/CFTree.h +++ b/Sources/CoreFoundation/include/CFTree.h @@ -199,7 +199,7 @@ void CFTreeGetChildren(CFTreeRef tree, CFTreeRef *children); /*! @function CFTreeApplyFunctionToChildren Calls a function once for each child of the tree. Note that the applier - only operates one level deep, and does not operate on descendents further + only operates one level deep, and does not operate on descendants further removed than the immediate children of the tree. @param tree The tree to be operated upon. If this parameter is not a valid CFTree, the behavior is undefined. @@ -219,7 +219,7 @@ void CFTreeApplyFunctionToChildren(CFTreeRef tree, CFTreeApplierFunction CF_NOES /*! @function CFTreeFindRoot - Returns the root tree of which the specified tree is a descendent. + Returns the root tree of which the specified tree is a descendant. @param tree The tree to be queried. If this parameter is not a valid CFTree, the behavior is undefined. @result A reference to the root of the tree. diff --git a/Sources/CoreFoundation/include/CFURL.h b/Sources/CoreFoundation/include/CFURL.h index 0ff668e1ce..e475d936c7 100644 --- a/Sources/CoreFoundation/include/CFURL.h +++ b/Sources/CoreFoundation/include/CFURL.h @@ -152,7 +152,7 @@ a relative URL against its base). The full URL is therefore If a given CFURL can be decomposed (that is, conforms to RFC 1808), you can ask for each of the four basic pieces (scheme, net location, path, -and resource specifer) separately, as well as for its base URL. The +and resource specifier) separately, as well as for its base URL. The basic pieces are returned with any percent-escape sequences still in place (although note that the scheme may not legally include any percent-escapes); this is to allow the caller to distinguish between @@ -1209,7 +1209,7 @@ CFDataRef CFURLCreateBookmarkData ( CFAllocatorRef allocator, CFURLRef url, CFUR CF_EXPORT CFURLRef CFURLCreateByResolvingBookmarkData ( CFAllocatorRef allocator, CFDataRef bookmark, CFURLBookmarkResolutionOptions options, CFURLRef relativeToURL, CFArrayRef resourcePropertiesToInclude, Boolean* isStale, CFErrorRef* error ) API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)); -/* Returns the resource propertyies identified by a specified array of keys contained in specified bookmark data. If the result dictionary does not contain a resource value for one or more of the requested resource keys, it means those resource properties are not available in the bookmark data. +/* Returns the resource properties identified by a specified array of keys contained in specified bookmark data. If the result dictionary does not contain a resource value for one or more of the requested resource keys, it means those resource properties are not available in the bookmark data. */ CF_EXPORT CFDictionaryRef CFURLCreateResourcePropertiesForKeysFromBookmarkData ( CFAllocatorRef allocator, CFArrayRef resourcePropertiesToReturn, CFDataRef bookmark ) API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)); diff --git a/Sources/CoreFoundation/include/CFURLPriv.h b/Sources/CoreFoundation/include/CFURLPriv.h index 4e2c004ea4..53e659ca4c 100644 --- a/Sources/CoreFoundation/include/CFURLPriv.h +++ b/Sources/CoreFoundation/include/CFURLPriv.h @@ -178,7 +178,7 @@ CF_EXPORT const CFStringRef _kCFURLCustomIconImageDataKey API_AVAILABLE(macos(10 /* Icon image data of the item's custom icon, if any (CFData) */ CF_EXPORT const CFStringRef _kCFURLEffectiveIconFlattenedReferenceDataKey API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)); - /* Icon flattened reference, suitable for cheaply sharing the effective icon reference across processess (CFData) */ + /* Icon flattened reference, suitable for cheaply sharing the effective icon reference across processes (CFData) */ CF_EXPORT const CFStringRef _kCFURLBundleIdentifierKey API_AVAILABLE(macos(10.6), ios(4.0), watchos(2.0), tvos(9.0)); /* If resource is a bundle, the bundle identifier (CFString) */ @@ -201,13 +201,13 @@ CF_EXPORT const CFStringRef _kCFURLStatModeKey API_AVAILABLE(macos(10.6), ios(4. /* To determine which dictionary to request from _kCFURLLocalizedNameDictionaryKey or _kCFURLLocalizedNameWithExtensionsHiddenDictionaryKey, you can consult _LSGetShowAllExtensionsPreference() on macOS. On iOS, extensions are always hidden. */ CF_EXPORT const CFStringRef _kCFURLLocalizedNameDictionaryKey API_AVAILABLE(macos(10.7), ios(9.0), watchos(2.0), tvos(9.0)); - /* For items with localized display names, the dictionary of all available localizations. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */ + /* For items with localized display names, the dictionary of all available localizations. The keys are the canonical locale strings for the available localizations. (CFDictionary) */ CF_EXPORT const CFStringRef _kCFURLLocalizedNameWithExtensionsHiddenDictionaryKey API_AVAILABLE(macosx(10.13), ios(11.0), watchos(4.0), tvos(11.0)); /* For items with localized display names, the dictionary of all available localizations with extensions hidden if safe. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */ CF_EXPORT const CFStringRef _kCFURLLocalizedTypeDescriptionDictionaryKey API_AVAILABLE(macos(10.7), ios(9.0), watchos(2.0), tvos(9.0)); - /* The dictionary of all available localizations of the item kind string. The keys are the cannonical locale strings for the available localizations. (CFDictionary) */ + /* The dictionary of all available localizations of the item kind string. The keys are the canonical locale strings for the available localizations. (CFDictionary) */ CF_EXPORT const CFStringRef _kCFURLApplicationCategoriesKey API_AVAILABLE(macos(10.7)) API_UNAVAILABLE(ios, watchos, tvos); /* The array of category UTI strings associated with the url. (CFArray) */ @@ -421,7 +421,7 @@ CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemRoleOwner API_AVAILABLE(ma CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemRoleParticipant API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)); // the current user is a participant of this shared item. CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemOwnerNameComponentsKey API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)); // returns a NSPersonNameComponents, or nil if the current user. (Read-only, value type NSPersonNameComponents) -CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemMostRecentEditorNameComponentsKey API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); // returns a NSPersonNameComponents for the most recent editro fo the file, or nil if the current user. (Read-only, value type NSPersonNameComponents) +CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemMostRecentEditorNameComponentsKey API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); // returns a NSPersonNameComponents for the most recent editor of the file, or nil if the current user. (Read-only, value type NSPersonNameComponents) CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemCurrentUserPermissionsKey API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); // returns the permissions for a participant of this shared item, or nil if not shared. (Read-only, value type NSString). Possible values below. CF_EXPORT const CFStringRef kCFURLUbiquitousSharedItemPermissionsReadOnly API_AVAILABLE(macosx(10.12), ios(10.0), watchos(3.0), tvos(10.0)); // participants are only allowed to read this item @@ -867,7 +867,7 @@ CF_EXPORT CFArrayRef _CFURLRevocableBookmarksCopyClientBundleIdentifiers(Boolean /** Set the active state of the app with the given bundle identifier. This does not delete the security token for the app, thus is less secure than revoking the bundle identifier. */ CF_EXPORT Boolean _CFURLRevocableBookmarksSetActiveStatusForBundleIdentifier(CFStringRef identifier, Boolean active) API_AVAILABLE(macos(10.16)) API_UNAVAILABLE(ios, watchos, tvos); -/** Securely revokes all bookmarks for the bundie identifier. This is not reversable. */ +/** Securely revokes all bookmarks for the bundle identifier. This is not reversable. */ CF_EXPORT Boolean _CFURLRevocableBookmarksRevokeForBundleIdentifier(CFStringRef identifier) API_AVAILABLE(macos(10.16)) API_UNAVAILABLE(ios, watchos, tvos); /** Notification sent when the set of active clients changes. */ diff --git a/Sources/CoreFoundation/include/ForFoundationOnly.h b/Sources/CoreFoundation/include/ForFoundationOnly.h index e5f96e9fed..5bfea27735 100644 --- a/Sources/CoreFoundation/include/ForFoundationOnly.h +++ b/Sources/CoreFoundation/include/ForFoundationOnly.h @@ -108,7 +108,7 @@ _CF_EXPORT_SCOPE_END _CF_EXPORT_SCOPE_BEGIN /// Compares UUID bytes using a secure constant-time comparison rdar://47657832. -/// Ensure that `lhs` and `rhs` are 128-bytes (`CFUUIDBytes` or `uuid_t`) for the comparision to be valid. +/// Ensure that `lhs` and `rhs` are 128-bytes (`CFUUIDBytes` or `uuid_t`) for the comparison to be valid. CF_INLINE Boolean __CFisEqualUUIDBytes(const void * const lhs, const void * const rhs) { uint64_t lhsBytes[2]; memcpy(lhsBytes, lhs, sizeof(lhsBytes)); diff --git a/Sources/CoreFoundation/internalInclude/CFInternal.h b/Sources/CoreFoundation/internalInclude/CFInternal.h index cc13eb7253..a348793120 100644 --- a/Sources/CoreFoundation/internalInclude/CFInternal.h +++ b/Sources/CoreFoundation/internalInclude/CFInternal.h @@ -1250,7 +1250,7 @@ CF_EXTERN_C_END // Load 16,32,64 bit values from unaligned memory addresses. These need to be done bytewise otherwise // it is undefined behaviour in C. On some architectures, eg x86, unaligned loads are allowed by the -// processor and the compiler will convert these byte accesses into the appropiate DWORD/QWORD memory +// processor and the compiler will convert these byte accesses into the appropriate DWORD/QWORD memory // access. CF_INLINE uint32_t _CFUnalignedLoad32(const void *ptr) { diff --git a/Sources/CoreFoundation/internalInclude/CFPropertyList_Internal.h b/Sources/CoreFoundation/internalInclude/CFPropertyList_Internal.h index 76f247c672..e2893bbb4e 100644 --- a/Sources/CoreFoundation/internalInclude/CFPropertyList_Internal.h +++ b/Sources/CoreFoundation/internalInclude/CFPropertyList_Internal.h @@ -14,7 +14,7 @@ /// Limit for the max recursion depth to avoid unbounded stack explosion when /// parsing a crafted plist during validation of an object graph and during reading. -/// For macOS use maximum recusrion limit of `512` is used. +/// For macOS use maximum recursion limit of `512` is used. /// For iPhone, tvOS, and Watches use `128` due to the memory limitations. /// /// rdar://61207578 ([Ward CFPropertyList audit, Low] unbounded recursion (binary and plain plists)) @@ -32,7 +32,7 @@ CF_INLINE size_t _CFPropertyListMaxRecursionDepth() { /// /// rdar://61529878 ([Ward CFPropertyList audit, Medium] Plist exponential growth DoS) CF_INLINE size_t _CFPropertyListMaxRecursionWidth() { - // For now let's start with a resonable value that during testing allows many common cases but prevents very "wide" references to the same collections + // For now let's start with a reasonable value that during testing allows many common cases but prevents very "wide" references to the same collections return _CFPropertyListMaxRecursionDepth() * 3; } diff --git a/Sources/CoreFoundation/internalInclude/CFRuntime_Internal.h b/Sources/CoreFoundation/internalInclude/CFRuntime_Internal.h index 06a5d50de0..5c9c53252f 100644 --- a/Sources/CoreFoundation/internalInclude/CFRuntime_Internal.h +++ b/Sources/CoreFoundation/internalInclude/CFRuntime_Internal.h @@ -180,7 +180,7 @@ CF_PRIVATE const CFRuntimeClass __CFRelativeDateTimeFormatterClass; CF_PRIVATE const CFRuntimeClass __CFListFormatterClass; CF_PRIVATE const CFRuntimeClass __CFDateIntervalFormatterClass; -#pragma mark - Private initialiers to run at process start time +#pragma mark - Private initializers to run at process start time CF_PRIVATE void __CFDateInitialize(void); CF_PRIVATE void __CFCharacterSetInitialize(void); diff --git a/Sources/CoreFoundation/internalInclude/CFStreamInternal.h b/Sources/CoreFoundation/internalInclude/CFStreamInternal.h index dfc8464a96..0dba0c8074 100644 --- a/Sources/CoreFoundation/internalInclude/CFStreamInternal.h +++ b/Sources/CoreFoundation/internalInclude/CFStreamInternal.h @@ -41,10 +41,10 @@ struct _CFStream { typedef Boolean (*_CFStreamCBOpenV1)(struct _CFStream *stream, CFStreamError *error, Boolean *openComplete, void *info); typedef Boolean (*_CFStreamCBOpenCompletedV1)(struct _CFStream *stream, CFStreamError *error, void *info); typedef CFIndex (*_CFStreamCBReadV1)(CFReadStreamRef stream, UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, Boolean *atEOF, void *info); -typedef const UInt8 *(*_CFStreamCBGetBufferV1)(CFReadStreamRef sream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFStreamError *error, Boolean *atEOF, void *info); -typedef Boolean (*_CFStreamCBCanReadV1)(CFReadStreamRef, void *info); -typedef CFIndex (*_CFStreamCBWriteV1)(CFWriteStreamRef, const UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, void *info); -typedef Boolean (*_CFStreamCBCanWriteV1)(CFWriteStreamRef, void *info); +typedef const UInt8 *(*_CFStreamCBGetBufferV1)(CFReadStreamRef stream, CFIndex maxBytesToRead, CFIndex *numBytesRead, CFStreamError *error, Boolean *atEOF, void *info); +typedef Boolean (*_CFStreamCBCanReadV1)(CFReadStreamRef stream, void *info); +typedef CFIndex (*_CFStreamCBWriteV1)(CFWriteStreamRef stream, const UInt8 *buffer, CFIndex bufferLength, CFStreamError *error, void *info); +typedef Boolean (*_CFStreamCBCanWriteV1)(CFWriteStreamRef stream, void *info); struct _CFStreamCallBacksV1 { CFIndex version; diff --git a/Sources/CoreFoundation/internalInclude/CFURL.inc.h b/Sources/CoreFoundation/internalInclude/CFURL.inc.h index cee0c97c88..41d0753f6c 100644 --- a/Sources/CoreFoundation/internalInclude/CFURL.inc.h +++ b/Sources/CoreFoundation/internalInclude/CFURL.inc.h @@ -15,7 +15,7 @@ CFURL's URL string parser needs to be able to parse either an array of char or an array of UniChar. - The code in CFURL.c used to use this macro "#define STRING_CHAR(x) (useCString ? cstring[(x)] : ustring[(x)])" to determine which array to get a character from for every character looked at in the URL string. That macro added one or more compare and branch instructins to the parser's execution for *every* character in the URL string. Those extra compares and branches added up to 10% of the time (for long URL strings) it takes to create a URL object. + The code in CFURL.c used to use this macro "#define STRING_CHAR(x) (useCString ? cstring[(x)] : ustring[(x)])" to determine which array to get a character from for every character looked at in the URL string. That macro added one or more compare and branch instructions to the parser's execution for *every* character in the URL string. Those extra compares and branches added up to 10% of the time (for long URL strings) it takes to create a URL object. To ensure the exact same parser code is run over a char or a UniChar string, the source code was move to this .h file and is included multiple times by CFURL.c as needed. "STRING_CHAR(x)" was replaced by "characterArray[x]", and characterArray is defined as either an "const char *" or a "const UniChar *" for the two sets of function headers that are either parsing an array of char or an array of UniChar. @@ -344,7 +344,7 @@ surrogatePair[0] = ch; surrogatePair[1] = characterArray[idx + 1]; if ( _appendPercentEscapesForCharacter(surrogatePair, true, encoding, *escapedString) ) { - // we consumed 2 chararacters instead of 1 + // we consumed 2 characters instead of 1 *mark = idx + 2; ++idx; } diff --git a/Sources/CoreFoundation/internalInclude/CFURLComponents_Internal.h b/Sources/CoreFoundation/internalInclude/CFURLComponents_Internal.h index 3f9e67ba62..1541cdd0c8 100644 --- a/Sources/CoreFoundation/internalInclude/CFURLComponents_Internal.h +++ b/Sources/CoreFoundation/internalInclude/CFURLComponents_Internal.h @@ -33,7 +33,7 @@ struct _URIParseInfo { unsigned long hostExists : 1; unsigned long portExists : 1; // pathExists is not needed because there's always a path... it just might be zero length. - unsigned long semicolonInPathExists : 1; // param is obsolete, but we still percent-encode the ';' for backwards compatiblity with NSURL/CFURL. + unsigned long semicolonInPathExists : 1; // param is obsolete, but we still percent-encode the ';' for backwards compatibility with NSURL/CFURL. unsigned long queryExists : 1; unsigned long fragmentExists : 1; }; diff --git a/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h b/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h index 804396d2a4..6dea303681 100644 --- a/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h +++ b/Sources/CoreFoundation/internalInclude/CoreFoundation_Prefix.h @@ -164,14 +164,14 @@ static dispatch_queue_t __ ## PREFIX ## Queue(void) { \ #endif -// hint to the analyzer that the caller is no longer responsable for the object and that it will be transfered to the reciver that is opaque to the caller +// hint to the analyzer that the caller is no longer responsible for the object and that it will be transferred to the receiver that is opaque to the caller #if __clang_analyzer__ #define CF_TRANSFER_OWNERSHIP(obj) (__typeof(obj))[(id)obj autorelease] #else #define CF_TRANSFER_OWNERSHIP(obj) obj #endif -// hint to the analyzer that the retain/releases are balanced in other locations; the string should be searchable to identify the coorisponding location for the retain/release. These macros should be used with great caution in that they distort the actual retain/release nature of what is happening to the analyzer. Reasonable locations would be in the cases where a value needs to be retained over the lifespan of an external event like a remote machine/process etc. +// hint to the analyzer that the retain/releases are balanced in other locations; the string should be searchable to identify the corresponding location for the retain/release. These macros should be used with great caution in that they distort the actual retain/release nature of what is happening to the analyzer. Reasonable locations would be in the cases where a value needs to be retained over the lifespan of an external event like a remote machine/process etc. // NOTE: these seem like they may be backwards - however they are intended to be promises to the analyzer of what will come to pass #if __clang_analyzer__ #define CF_RELEASE_BALANCED_ELSEWHERE(obj, identified_location) if (obj) CFRetain(obj) diff --git a/Sources/Foundation/DateFormatter.swift b/Sources/Foundation/DateFormatter.swift index 760e776dae..91d5527ee6 100644 --- a/Sources/Foundation/DateFormatter.swift +++ b/Sources/Foundation/DateFormatter.swift @@ -564,7 +564,7 @@ open class DateFormatter : Formatter, @unchecked Sendable { } // Apple DateFormatter implementation returns nil - // if non-whitespace sharacters are left after parsed content. + // if non-whitespace characters are left after parsed content. let remainder = String(string[swiftRange.upperBound...]) let characterSet = CharacterSet(charactersIn: remainder) guard CharacterSet.whitespaces.isSuperset(of: characterSet) else { @@ -594,8 +594,8 @@ open class DateFormatter : Formatter, @unchecked Sendable { return df.string(for: date._nsObject)! } - open class func dateFormat(fromTemplate tmplate: String, options opts: Int, locale: Locale?) -> String? { - guard let res = CFDateFormatterCreateDateFormatFromTemplate(kCFAllocatorSystemDefault, tmplate._cfObject, CFOptionFlags(opts), locale?._cfObject) else { + open class func dateFormat(fromTemplate template: String, options opts: Int, locale: Locale?) -> String? { + guard let res = CFDateFormatterCreateDateFormatFromTemplate(kCFAllocatorSystemDefault, template._cfObject, CFOptionFlags(opts), locale?._cfObject) else { return nil } return res._swiftObject diff --git a/Sources/Foundation/FileManager+POSIX.swift b/Sources/Foundation/FileManager+POSIX.swift index e89b3bf633..845ca89221 100644 --- a/Sources/Foundation/FileManager+POSIX.swift +++ b/Sources/Foundation/FileManager+POSIX.swift @@ -270,8 +270,8 @@ extension FileManager { guard statxErrno == 0 else { switch statxErrno { case EPERM, ENOSYS: - // statx() may be blocked by a security mechanism (eg libseccomp or Docker) even if the kernel verison is new enough. EPERM or ENONSYS may be reported. - // Dont try to use it in future and fallthough to a normal lstat() call. + // statx() may be blocked by a security mechanism (eg libseccomp or Docker) even if the kernel version is new enough. EPERM or ENONSYS may be reported. + // Dont try to use it in future and fallthrough to a normal lstat() call. previousStatxFailed.withLock { $0 = true } return try _statxFallback(atPath: path, withFileSystemRepresentation: fsRep) diff --git a/Sources/Foundation/FileManager+Win32.swift b/Sources/Foundation/FileManager+Win32.swift index c4d2ceaff9..3f8c7f9cac 100644 --- a/Sources/Foundation/FileManager+Win32.swift +++ b/Sources/Foundation/FileManager+Win32.swift @@ -52,8 +52,8 @@ internal func withNTPathRepresentation(of path: String, _ body: (UnsafeP // the path. path = path.replacing("/", with: "\\") - // Droop trailing slashes unless it follows a drive specification. The - // trailing arc separator after a drive specifier iindicates the root as + // Drop trailing slashes unless it follows a drive specification. The + // trailing arc separator after a drive specifier indicates the root as // opposed to a drive relative path. while path.count > 1, path[path.index(before: path.endIndex)] == "\\", !(path.count == 3 && diff --git a/Sources/Foundation/JSONSerialization+Parser.swift b/Sources/Foundation/JSONSerialization+Parser.swift index a7448666f9..a364bf4406 100644 --- a/Sources/Foundation/JSONSerialization+Parser.swift +++ b/Sources/Foundation/JSONSerialization+Parser.swift @@ -96,7 +96,7 @@ internal struct JSONParser { self.depth += 1 defer { depth -= 1 } - // parse first value or end immediatly + // parse first value or end immediately switch try reader.consumeWhitespace() { case ._space, ._return, ._newline, ._tab: preconditionFailure("Expected that all white space is consumed") diff --git a/Sources/Foundation/JSONSerialization.swift b/Sources/Foundation/JSONSerialization.swift index dd9e73d1bb..7e2674cc1e 100644 --- a/Sources/Foundation/JSONSerialization.swift +++ b/Sources/Foundation/JSONSerialization.swift @@ -339,7 +339,7 @@ private extension JSONSerialization { } // If there is no BOM present, we might be able to determine the encoding based on - // occurences of null bytes. + // occurrences of null bytes. if bytes.count >= 4 { switch (bytes[0], bytes[1], bytes[2], bytes[3]) { case (0, 0, 0, _): diff --git a/Sources/Foundation/NSKeyedUnarchiver.swift b/Sources/Foundation/NSKeyedUnarchiver.swift index 7f6509b8fc..cf7f0fe345 100644 --- a/Sources/Foundation/NSKeyedUnarchiver.swift +++ b/Sources/Foundation/NSKeyedUnarchiver.swift @@ -892,7 +892,7 @@ open class NSKeyedUnarchiver : NSCoder { } } - // Enables secure coding support on this keyed unarchiver. When enabled, anarchiving a disallowed class throws an exception. Once enabled, attempting to set requiresSecureCoding to NO will throw an exception. This is to prevent classes from selectively turning secure coding off. This is designed to be set once at the top level and remain on. Note that the getter is on the superclass, NSCoder. See NSCoder for more information about secure coding. + // Enables secure coding support on this keyed unarchiver. When enabled, unarchiving a disallowed class throws an exception. Once enabled, attempting to set requiresSecureCoding to NO will throw an exception. This is to prevent classes from selectively turning secure coding off. This is designed to be set once at the top level and remain on. Note that the getter is on the superclass, NSCoder. See NSCoder for more information about secure coding. open override var requiresSecureCoding: Bool { get { return _flags.contains(.requiresSecureCoding) diff --git a/Sources/Foundation/NSObject.swift b/Sources/Foundation/NSObject.swift index c7856bf655..e96564cb04 100644 --- a/Sources/Foundation/NSObject.swift +++ b/Sources/Foundation/NSObject.swift @@ -249,7 +249,7 @@ open class NSObject : NSObjectProtocol, Equatable, Hashable { return 0 } - // TODO: move these back into extensions once extension methods can be overriden + // TODO: move these back into extensions once extension methods can be overridden /// Overridden by subclasses to substitute a class other than its own during coding. /// diff --git a/Sources/Foundation/NSPathUtilities.swift b/Sources/Foundation/NSPathUtilities.swift index 8043ef00c0..e9c300096c 100644 --- a/Sources/Foundation/NSPathUtilities.swift +++ b/Sources/Foundation/NSPathUtilities.swift @@ -549,7 +549,7 @@ extension NSString { // If we have a RFC8089 style path, e.g. `/[drive-letter]:/...`, drop // the leading '/', otherwise, a leading slash indicates a rooted path - // on the drive for the current working directoyr. + // on the drive for the current working directory. if fsr.count >= 3 { let index0 = fsr.startIndex let index1 = fsr.index(after: index0) diff --git a/Sources/Foundation/NSURL.swift b/Sources/Foundation/NSURL.swift index 6af73f16ea..fc22292b7e 100644 --- a/Sources/Foundation/NSURL.swift +++ b/Sources/Foundation/NSURL.swift @@ -861,7 +861,7 @@ extension NSURL { // File URLs can't be handled on WASI without file system access #if !os(WASI) - // Since we are appending to a URL, path seperators should + // Since we are appending to a URL, path separators should // always be '/', even if we're on Windows if !pathComponent.hasSuffix("/") && isFileURL { if let urlWithoutDirectory = result { diff --git a/Sources/Foundation/Operation.swift b/Sources/Foundation/Operation.swift index f70f41b940..f5f1871c47 100644 --- a/Sources/Foundation/Operation.swift +++ b/Sources/Foundation/Operation.swift @@ -878,7 +878,7 @@ open class OperationQueue : NSObject, ProgressReporting, @unchecked Sendable { // There are only three cases where an operation might have a nil queue // A) The operation was never added to a queue and we got here by a normal KVO change // B) The operation was somehow already finished - // C) the operation was attempted to be added to a queue but an exception occured and was ignored... + // C) the operation was attempted to be added to a queue but an exception occurred and was ignored... // Option C is NOT supported! let isBarrier = op is _BarrierOperation _lock() diff --git a/Sources/Foundation/Port.swift b/Sources/Foundation/Port.swift index c4ed8282bf..acef3c9960 100644 --- a/Sources/Foundation/Port.swift +++ b/Sources/Foundation/Port.swift @@ -156,7 +156,7 @@ fileprivate let FOUNDATION_IPPROTO_TCP = Int32(WinSDK.IPPROTO_TCP.rawValue) SocketPort transmits ports by sending _Darwin_ sockaddr values serialized over the wire. (Yeah.) This means that whatever the platform, we need to be able to send Darwin sockaddrs and figure them out on the other side of the wire. - Now, the vast majority of the intreresting ports that may be sent is AF_INET and AF_INET6 — other sockets aren't uncommon, but they are generally local to their host (eg. AF_UNIX). So, we make the following tactical choice: + Now, the vast majority of the interesting ports that may be sent is AF_INET and AF_INET6 — other sockets aren't uncommon, but they are generally local to their host (eg. AF_UNIX). So, we make the following tactical choice: - swift-corelibs-foundation clients across all platforms can interoperate between themselves and with Darwin as long as all the ports that are sent through SocketPort are AF_INET or AF_INET6; - otherwise, it is the implementor and deployer's responsibility to make sure all the clients are on the same platform. For sockets that do not leave the machine, like AF_UNIX, this is trivial. diff --git a/Sources/FoundationNetworking/DataURLProtocol.swift b/Sources/FoundationNetworking/DataURLProtocol.swift index c4783b2dc4..652b2565f8 100644 --- a/Sources/FoundationNetworking/DataURLProtocol.swift +++ b/Sources/FoundationNetworking/DataURLProtocol.swift @@ -139,7 +139,7 @@ internal class _DataURLProtocol: URLProtocol { while let element = iterator.next() { switch element { case .asciiCharacter(let ch) where ch == Character(","): - // ";base64 must be the last part just before the ',' that seperates the header from the data + // ";base64 must be the last part just before the ',' that separates the header from the data if foundCharsetKey { charSet = part } else { diff --git a/Sources/FoundationNetworking/URLSession/URLSessionConfiguration.swift b/Sources/FoundationNetworking/URLSession/URLSessionConfiguration.swift index 4c787ad501..9236854f4c 100644 --- a/Sources/FoundationNetworking/URLSession/URLSessionConfiguration.swift +++ b/Sources/FoundationNetworking/URLSession/URLSessionConfiguration.swift @@ -36,7 +36,7 @@ import Foundation /// A background session can be used to perform networking operations /// on behalf of a suspended application, within certain constraints. open class URLSessionConfiguration : NSObject, NSCopying, @unchecked Sendable { - // -init is silently incorrect in URLSessionCofiguration on the desktop. Ensure code that relied on swift-corelibs-foundation's init() being functional is redirected to the appropriate cross-platform class property. + // -init is silently incorrect in URLSessionConfiguration on the desktop. Ensure code that relied on swift-corelibs-foundation's init() being functional is redirected to the appropriate cross-platform class property. @available(*, deprecated, message: "Use .default instead.", renamed: "URLSessionConfiguration.default") public override init() { self.requestCachePolicy = URLSessionConfiguration.default.requestCachePolicy diff --git a/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift b/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift index 8c4437cac1..cdf8875fce 100644 --- a/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift +++ b/Sources/FoundationNetworking/URLSession/libcurl/EasyHandle.swift @@ -56,7 +56,7 @@ internal func xferInfoFunctionSupported() -> Bool { /// TCP streams and HTTP transfers / easy handles. A single TCP stream and /// its socket may be shared by multiple easy handles. /// -/// A single HTTP request-response exchange (refered to here as a +/// A single HTTP request-response exchange (referred to here as a /// *transfer*) corresponds directly to an easy handle. Hence anything that /// needs to be configured for a specific transfer (e.g. the URL) will be /// configured on an easy handle. diff --git a/Tests/Foundation/HTTPServer.swift b/Tests/Foundation/HTTPServer.swift index ec0fd78c1b..b1a18a61de 100644 --- a/Tests/Foundation/HTTPServer.swift +++ b/Tests/Foundation/HTTPServer.swift @@ -185,13 +185,13 @@ class _TCPSocket: CustomStringConvertible { var buffer = [CChar](repeating: 0, count: 4096) #if os(Windows) - var dwNumberOfBytesRecieved: DWORD = 0; + var dwNumberOfBytesReceived: DWORD = 0 try buffer.withUnsafeMutableBufferPointer { var wsaBuffer: WSABUF = WSABUF(len: ULONG($0.count), buf: $0.baseAddress) var flags: DWORD = 0 - _ = try attempt("WSARecv", valid: { $0 != SOCKET_ERROR }, WSARecv(connectionSocket, &wsaBuffer, 1, &dwNumberOfBytesRecieved, &flags, nil, nil)) + _ = try attempt("WSARecv", valid: { $0 != SOCKET_ERROR }, WSARecv(connectionSocket, &wsaBuffer, 1, &dwNumberOfBytesReceived, &flags, nil, nil)) } - let length = Int(dwNumberOfBytesRecieved) + let length = Int(dwNumberOfBytesReceived) #else let length = try attempt("read", valid: { $0 >= 0 }, read(connectionSocket, &buffer, buffer.count)) #endif diff --git a/Tests/Foundation/TestJSONSerialization.swift b/Tests/Foundation/TestJSONSerialization.swift index b155deb982..79f2d97a01 100644 --- a/Tests/Foundation/TestJSONSerialization.swift +++ b/Tests/Foundation/TestJSONSerialization.swift @@ -994,7 +994,7 @@ extension TestJSONSerialization { func test_serialize_dictionaryWithDecimal() { //test serialize values less than 1 with maxFractionDigits = 15 - func excecute_testSetLessThanOne() { + func execute_testSetLessThanOne() { //expected : input to be serialized let params = [ ("0.1",0.1), @@ -1026,7 +1026,7 @@ extension TestJSONSerialization { } } //test serialize values grater than 1 with maxFractionDigits = 15 - func excecute_testSetGraterThanOne() { + func execute_testSetGraterThanOne() { let paramsBove1 = [ ("1.1",1.1), ("1.2",1.2), @@ -1043,7 +1043,7 @@ extension TestJSONSerialization { } //test serialize values for whole integer where the input is in Double format - func excecute_testWholeNumbersWithDoubleAsInput() { + func execute_testWholeNumbersWithDoubleAsInput() { let paramsWholeNumbers = [ ("-1" ,-1.0), @@ -1057,7 +1057,7 @@ extension TestJSONSerialization { } } - func excecute_testWholeNumbersWithIntInput() { + func execute_testWholeNumbersWithIntInput() { for i in -10..<10 { let iStr = "\(i)" let testDict = [iStr : i] @@ -1065,10 +1065,10 @@ extension TestJSONSerialization { XCTAssertEqual(str!, "{\"\(iStr)\":\(i)}", "expect that serialized value should not contain trailing zero or decimal as they are whole numbers ") } } - excecute_testSetLessThanOne() - excecute_testSetGraterThanOne() - excecute_testWholeNumbersWithDoubleAsInput() - excecute_testWholeNumbersWithIntInput() + execute_testSetLessThanOne() + execute_testSetGraterThanOne() + execute_testWholeNumbersWithDoubleAsInput() + execute_testWholeNumbersWithIntInput() } func test_serialize_null() { diff --git a/Tests/Foundation/TestNSError.swift b/Tests/Foundation/TestNSError.swift index 5521895d3a..584da06c38 100644 --- a/Tests/Foundation/TestNSError.swift +++ b/Tests/Foundation/TestNSError.swift @@ -128,7 +128,7 @@ class TestNSError : XCTestCase { XCTAssertEqual((SwiftError.fortyTwo as NSError).code, 42) } - func test_ConvertErrorToNSError_errorCodeWithAssosiatedValue() { + func test_ConvertErrorToNSError_errorCodeWithAssociatedValue() { // Default error code for enum case is based on EnumImplStrategy::getTagIndex enum SwiftError: Error { case one // 2 diff --git a/Tests/Foundation/TestNSTextCheckingResult.swift b/Tests/Foundation/TestNSTextCheckingResult.swift index 725790276a..0a8f2eda9b 100644 --- a/Tests/Foundation/TestNSTextCheckingResult.swift +++ b/Tests/Foundation/TestNSTextCheckingResult.swift @@ -126,7 +126,7 @@ class TestNSTextCheckingResult: XCTestCase { } } - func test_loadedVauesMatch() throws { + func test_loadedValuesMatch() throws { for fixture in fixtures { try fixture.assertLoadedValuesMatch(areEqual(_:_:)) } diff --git a/Tests/Foundation/TestNotificationQueue.swift b/Tests/Foundation/TestNotificationQueue.swift index 85f3f76010..eb9f45d718 100644 --- a/Tests/Foundation/TestNotificationQueue.swift +++ b/Tests/Foundation/TestNotificationQueue.swift @@ -218,7 +218,7 @@ class TestNotificationQueue : XCTestCase { waitForExpectations(timeout: 0.2) // There is a small time gap between "e.fulfill()" - // and actuall thread termination. + // and actual thread termination. // We need a little delay to allow bgThread actually die. // Callers of this function are assuming thread is // deallocated after call. diff --git a/Tests/Foundation/TestNumberFormatter.swift b/Tests/Foundation/TestNumberFormatter.swift index 5560d643d5..bcd1b775b3 100644 --- a/Tests/Foundation/TestNumberFormatter.swift +++ b/Tests/Foundation/TestNumberFormatter.swift @@ -232,7 +232,7 @@ class TestNumberFormatter: XCTestCase { XCTAssertEqual(numberFormatter.secondaryGroupingSize, 0) } - func test_defaultCurrenyAccountingPropertyValues() { + func test_defaultCurrencyAccountingPropertyValues() { let numberFormatter = NumberFormatter() numberFormatter.numberStyle = .currencyAccounting numberFormatter.locale = Locale(identifier: "en_US") diff --git a/Tests/Foundation/TestScanner.swift b/Tests/Foundation/TestScanner.swift index f2b471e208..e5ef7a6741 100644 --- a/Tests/Foundation/TestScanner.swift +++ b/Tests/Foundation/TestScanner.swift @@ -81,7 +81,7 @@ class TestScanner : XCTestCase { expectEqual($0.scanDouble(), 0, "Parse '0.' as a Double") expectEqual($0.scanDouble(), 0.1, "Parse '.1' as a Double") expectEqual($0.scanDouble(), nil, "Dont parse '.' as a Double") - expectEqual($0.scanString("."), ".", "Consue '.'") + expectEqual($0.scanString("."), ".", "Consume '.'") expectEqual($0.scanDouble(), 100, "Parse '1e2' as a Double") expectEqual($0.scanDouble(), nil, "Dont parse 'e+3' as a Double") // "e+3" doesnt parse as Double expectEqual($0.scanString("e+3"), "e+3", "Consume the 'e+3'") @@ -174,7 +174,7 @@ class TestScanner : XCTestCase { expectEqual($0.scanInt64(), -1 as Int64, "Minus one") expectEqual($0.scanInt64(), -1 as Int64, "Minus one after whitespace") expectEqual($0.scanInt64(), Int64.min, "Min") - expectEqual($0.scanInt64(), Int64.max, "Max again after min (no joining it with preceding min even with ignroed whitespace)") + expectEqual($0.scanInt64(), Int64.max, "Max again after min (no joining it with preceding min even with ignored whitespace)") } // Overflow: diff --git a/Tests/Foundation/TestURLProtectionSpace.swift b/Tests/Foundation/TestURLProtectionSpace.swift index 83c5f22afa..c17de76a42 100644 --- a/Tests/Foundation/TestURLProtectionSpace.swift +++ b/Tests/Foundation/TestURLProtectionSpace.swift @@ -42,7 +42,7 @@ class TestURLProtectionSpace : XCTestCase { #if NS_FOUNDATION_ALLOWS_TESTABLE_IMPORT func test_createWithHTTPURLresponse() throws { - // Real responce from outlook.office365.com + // Real response from outlook.office365.com let headerFields1 = [ "Server": "Microsoft-IIS/10.0", "request-id": "c71c2202-4013-4d64-9319-d40aba6bbe5c",