Skip to content

Commit 3844ddf

Browse files
committed
Fix various typos
1 parent 20967d3 commit 3844ddf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+125
-126
lines changed

Diff for: CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ endif()
5555

5656
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
5757

58-
# Fetchable dependcies
58+
# Fetchable dependencies
5959
include(FetchContent)
6060
if (_SwiftFoundationICU_SourceDIR)
6161
FetchContent_Declare(SwiftFoundationICU

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It is designed with these goals in mind:
1111

1212
There is more information on the Foundation framework [here](https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/ObjC_classic/).
1313

14-
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.
14+
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.
1515

1616
## Project Navigator
1717

Diff for: Sources/CoreFoundation/CFBundle.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL,
778778
}
779779

780780

781-
// 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.
781+
// 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.
782782
_CFBundleVersion localVersion = _CFBundleGetBundleVersionForURL(newURL);
783783
if (_CFBundleVersionFlat == localVersion) {
784784
Boolean exists = false;
@@ -1735,7 +1735,7 @@ CFBundleRef _CFBundleGetBundleWithIdentifierAndLibraryName(CFStringRef bundleID,
17351735
}
17361736

17371737
static void _CFBundleEnsureAllBundlesUpToDate(void) {
1738-
// 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.
1738+
// 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.
17391739
CFArrayRef imagePaths = NULL;
17401740
// Tickle the main bundle into existence
17411741
(void)CFBundleGetMainBundle();

Diff for: Sources/CoreFoundation/CFBundle_InfoPlist.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ CF_PRIVATE void _CFBundleRefreshInfoDictionaryAlreadyLocked(CFBundleRef bundle)
10171017
if (bundle->_infoPlistUrl) {
10181018
CFRelease(bundle->_infoPlistUrl);
10191019
}
1020-
bundle->_infoPlistUrl = infoPlistUrl; // transfered as retained
1020+
bundle->_infoPlistUrl = infoPlistUrl; // transferred as retained
10211021

10221022
// Add or fixup any keys that will be expected later
10231023
if (bundle->_infoDict) _CFBundleInfoPlistFixupInfoDictionary(bundle, (CFMutableDictionaryRef)bundle->_infoDict);

Diff for: Sources/CoreFoundation/CFBundle_Tables.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void _CFBundleRemoveFromTables(CFBundleRef bundle, CFURLRef bundleURL, CF
9191
// 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.
9292
#if TARGET_OS_OSX
9393
if (_useUnsafeUnretainedTables()) {
94-
// 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.
94+
// 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.
9595

9696
// Unique bundles aren't in the tables anyway
9797
if (bundle->_isUnique) return;

Diff for: Sources/CoreFoundation/CFCalendar.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void __CFCalendarSetToFirstInstant(CFCalendarRef calendar, CFCalendarUnit
129129
int32_t qmonth[] = {0, 0, 0, 3, 3, 3, 6, 6, 6, 9, 9, 9, 9};
130130
month = qmonth[month];
131131
}
132-
// #warning if there is a lunar leap month of the same number *preceeding* month N,
132+
// #warning if there is a lunar leap month of the same number *preceding* month N,
133133
// then we should set the calendar to the leap month, not the regular month.
134134
__cficu_ucal_set(calendar->_cal, UCAL_MONTH, month);
135135
__cficu_ucal_set(calendar->_cal, UCAL_IS_LEAP_MONTH, 0);

Diff for: Sources/CoreFoundation/CFCalendar_Enumerate.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1755,13 +1755,13 @@ static CFDateRef _Nullable _CFCalendarCreateAdjustedDateForMismatchedLeapMonthOr
17551755
if (!foundGregLeap || !foundGregLeapMatchesComps) {
17561756
if (strictMatching) {
17571757
if (isGregorianCalendar) {
1758-
*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.
1758+
*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.
17591759
} else {
17601760
// 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.
17611761
Boolean eraMatch = false;
17621762
CFDateRef tempDate = _CFCalendarCreateMatchingDateAfterStartDateMatchingComponentsInNextHighestUnitRange(calendar, &eraMatch, matchingComponents, nextHighestUnit, searchingDate, goBackwards, findLast, opts);
17631763
if (!eraMatch) {
1764-
*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.
1764+
*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.
17651765
CFRelease(tempDate);
17661766
} else {
17671767
CFRelease(result);

Diff for: Sources/CoreFoundation/CFData.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ enum {
105105
};
106106

107107
typedef enum {
108-
kCFImmutable = 0x0, /* unchangable and fixed capacity; default */
108+
kCFImmutable = 0x0, /* unchangeable and fixed capacity; default */
109109
kCFFixedMutable = 0x1, /* changeable and fixed capacity */
110110
kCFMutable = 0x3 /* changeable and variable capacity */
111111
} _CFDataMutableVariety;

Diff for: Sources/CoreFoundation/CFDateFormatter.c

+14-14
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ CF_EXPORT const CFStringRef kCFDateFormatterCalendarIdentifierKey;
4949

5050
static CFStringRef __CFDateFormatterCreateForcedTemplate(CFLocaleRef locale, CFStringRef inString, Boolean stripAMPM);
5151

52-
// If you pass in a string in tmplate, you get back NULL (failure) or a CFStringRef.
53-
// If you pass in an array in tmplate, you get back NULL (global failure) or a CFArrayRef with CFStringRefs or kCFNulls (per-template failure) at each corresponding index.
52+
// If you pass in a string in template, you get back NULL (failure) or a CFStringRef.
53+
// If you pass in an array in template, you get back NULL (global failure) or a CFArrayRef with CFStringRefs or kCFNulls (per-template failure) at each corresponding index.
5454

55-
CFArrayRef CFDateFormatterCreateDateFormatsFromTemplates(CFAllocatorRef allocator, CFArrayRef tmplates, CFOptionFlags options, CFLocaleRef locale) {
56-
return (CFArrayRef)CFDateFormatterCreateDateFormatFromTemplate(allocator, (CFStringRef)tmplates, options, locale);
55+
CFArrayRef CFDateFormatterCreateDateFormatsFromTemplates(CFAllocatorRef allocator, CFArrayRef templates, CFOptionFlags options, CFLocaleRef locale) {
56+
return (CFArrayRef)CFDateFormatterCreateDateFormatFromTemplate(allocator, (CFStringRef)templates, options, locale);
5757
}
5858

5959
static Boolean useTemplatePatternGenerator(CFLocaleRef locale, void(^work)(UDateTimePatternGenerator *ptg)) {
@@ -122,21 +122,21 @@ static void _CFDateFormatterStripAMPMIndicators(UniChar **bpat, int32_t *bpatlen
122122
}
123123
}
124124

125-
CFStringRef CFDateFormatterCreateDateFormatFromTemplate(CFAllocatorRef allocator, CFStringRef tmplate, CFOptionFlags options, CFLocaleRef locale) {
125+
CFStringRef CFDateFormatterCreateDateFormatFromTemplate(CFAllocatorRef allocator, CFStringRef template, CFOptionFlags options, CFLocaleRef locale) {
126126
if (allocator) __CFGenericValidateType(allocator, CFAllocatorGetTypeID());
127127
if (locale) __CFGenericValidateType(locale, CFLocaleGetTypeID());
128-
Boolean tmplateIsString = (CFStringGetTypeID() == CFGetTypeID(tmplate));
128+
Boolean tmplateIsString = (CFStringGetTypeID() == CFGetTypeID(template));
129129
if (!tmplateIsString) {
130-
__CFGenericValidateType(tmplate, CFArrayGetTypeID());
130+
__CFGenericValidateType(template, CFArrayGetTypeID());
131131
}
132132

133133
__block CFTypeRef result = tmplateIsString ? NULL : (CFTypeRef)CFArrayCreateMutable(allocator, 0, &kCFTypeArrayCallBacks);
134134

135135
Boolean success = useTemplatePatternGenerator(locale, ^(UDateTimePatternGenerator *ptg) {
136136

137137

138-
for (CFIndex idx = 0, cnt = tmplateIsString ? 1 : CFArrayGetCount((CFArrayRef)tmplate); idx < cnt; idx++) {
139-
CFStringRef tmplateString = tmplateIsString ? (CFStringRef)tmplate : (CFStringRef)CFArrayGetValueAtIndex((CFArrayRef)tmplate, idx);
138+
for (CFIndex idx = 0, cnt = tmplateIsString ? 1 : CFArrayGetCount((CFArrayRef)template); idx < cnt; idx++) {
139+
CFStringRef tmplateString = tmplateIsString ? (CFStringRef)template : (CFStringRef)CFArrayGetValueAtIndex((CFArrayRef)template, idx);
140140
CFStringRef resultString = NULL;
141141

142142
Boolean stripAMPM = CFStringFind(tmplateString, CFSTR("J"), 0).location != kCFNotFound;
@@ -872,7 +872,7 @@ static CFMutableStringRef __createISO8601FormatString(CFISO8601DateFormatOptions
872872
CFStringAppendCString(resultStr, "HH:mm:ss", kCFStringEncodingUTF8);
873873
}
874874

875-
// Add support for fracional seconds
875+
// Add support for fractional seconds
876876
if (includeFractionalSecs) {
877877
CFStringAppendCString(resultStr, ".SSS", kCFStringEncodingUTF8);
878878
}
@@ -2173,8 +2173,8 @@ CFTypeRef CFDateFormatterCopyProperty(CFDateFormatterRef formatter, CFStringRef
21732173
return NULL;
21742174
}
21752175

2176-
CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef tmplateString, CFLocaleRef locale, UErrorCode *outErrorCode) {
2177-
CFIndex const tmpltLen = CFStringGetLength(tmplateString);
2176+
CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef templateString, CFLocaleRef locale, UErrorCode *outErrorCode) {
2177+
CFIndex const tmpltLen = CFStringGetLength(templateString);
21782178
if (tmpltLen == 0) {
21792179
if (outErrorCode) {
21802180
*outErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
@@ -2187,9 +2187,9 @@ CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef tmplateString
21872187
#define BUFFER_SIZE 768
21882188

21892189
SAFE_STACK_BUFFER_DECL(UChar, ubuffer, tmpltLen, BUFFER_SIZE);
2190-
UChar const *ustr = (UChar *)CFStringGetCharactersPtr(tmplateString);
2190+
UChar const *ustr = (UChar *)CFStringGetCharactersPtr(templateString);
21912191
if (ustr == NULL) {
2192-
CFStringGetCharacters(tmplateString, CFRangeMake(0, tmpltLen), (UniChar *)ubuffer);
2192+
CFStringGetCharacters(templateString, CFRangeMake(0, tmpltLen), (UniChar *)ubuffer);
21932193
ustr = ubuffer;
21942194
}
21952195

Diff for: Sources/CoreFoundation/CFICUConverters.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ CF_PRIVATE CFIndex __CFStringEncodingICUToBytes(const char *icuName, uint32_t fl
263263
ucnv_fromUnicode(converter, &destination, destinationLimit, (const UChar **)&source, (const UChar *)sourceLimit, NULL, flush, &errorCode);
264264

265265
#if HAS_ICU_BUG_6024743
266-
/* 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> Intrestingly, this issue doesn't apply to ucnv_toUnicode. The asynmmetric nature makes this more dangerous */
266+
/* 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 */
267267
if (U_BUFFER_OVERFLOW_ERROR == errorCode) {
268268
const uint8_t *bitmap = CFUniCharGetBitmapPtrForPlane(kCFUniCharNonBaseCharacterSet, 0);
269269
const uint8_t *nonBase;

Diff for: Sources/CoreFoundation/CFLocale.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ CFArrayRef _CFLocaleCopyValidNumberingSystemsForLocaleIdentifier(CFStringRef loc
507507
return numberingSystemIDs;
508508
}
509509

510-
CFStringRef _CFLocaleCreateLocaleIdentiferByReplacingLanguageCodeAndScriptCode(CFStringRef localeIDWithDesiredLangCode, CFStringRef localeIDWithDesiredComponents) {
510+
CFStringRef _CFLocaleCreateLocaleIdentifierByReplacingLanguageCodeAndScriptCode(CFStringRef localeIDWithDesiredLangCode, CFStringRef localeIDWithDesiredComponents) {
511511
CFStringRef localeID = NULL;
512512
if (localeIDWithDesiredLangCode && localeIDWithDesiredComponents) {
513513
CFStringRef langIDToUse = _CFLocaleCopyLanguageIdentifierWithScriptCodeForLocaleIdentifier(localeIDWithDesiredLangCode);
@@ -540,7 +540,7 @@ CFStringRef _CFLocaleCreateLocaleIdentiferByReplacingLanguageCodeAndScriptCode(C
540540
if (indexOfNumberingSystem == kCFNotFound || indexOfNumberingSystem == 0) {
541541
CFDictionaryRemoveValue(mutableComps, CFSTR("numbers"));
542542
}
543-
// 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`.
543+
// 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`.
544544
else if (indexOfNumberingSystem > 0) {
545545
CFDictionarySetValue(mutableComps, CFSTR("numbers"), numberingSystem);
546546
}
@@ -601,7 +601,7 @@ static CFStringRef _CFLocaleCreateLocaleIdentifierForAvailableLocalizations(CFAr
601601
if (CFEqual(preferredLocaleLanguageID, preferredLocalizationLanguageID)) {
602602
result = CFRetain(preferredLocaleID);
603603
} else {
604-
result = _CFLocaleCreateLocaleIdentiferByReplacingLanguageCodeAndScriptCode(preferredLocalization, preferredLocaleID);
604+
result = _CFLocaleCreateLocaleIdentifierByReplacingLanguageCodeAndScriptCode(preferredLocalization, preferredLocaleID);
605605
}
606606
}
607607
if (preferredLocaleLanguageID) { CFRelease(preferredLocaleLanguageID); }
@@ -723,7 +723,7 @@ static CFLocaleRef _CFLocaleCopyCurrentGuts(CFStringRef name, Boolean useCache,
723723
if (!ident) {
724724
ident = (CFStringRef)CFRetain(FALLBACK_LOCALE_NAME);
725725

726-
// <rdar://problem/51409572> CFLocaleCopyCurrent() failed to look up current locale -- gpsd dameon is not localized, does not interact directly with users
726+
// <rdar://problem/51409572> CFLocaleCopyCurrent() failed to look up current locale -- gpsd daemon is not localized, does not interact directly with users
727727
// 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.
728728
// Disabled for now.
729729
/*

Diff for: Sources/CoreFoundation/CFLocaleIdentifier.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -1950,7 +1950,7 @@ SPI: CFLocaleGetLanguageRegionEncodingForLocaleIdentifier gets the appropriate
19501950
otherwise may set *langCode and/or *regCode to -1 if there is no appropriate legacy value for the locale.
19511951
This is a replacement for the CFBundle SPI CFBundleGetLocalizationInfoForLocalization (which was intended to be temporary and transitional);
19521952
this function is more up-to-date in its handling of locale strings, and is in CFLocale where this functionality should belong. Compared
1953-
to CFBundleGetLocalizationInfoForLocalization, this function does not spcially interpret a NULL localeIdentifier to mean use the single most
1953+
to CFBundleGetLocalizationInfoForLocalization, this function does not specially interpret a NULL localeIdentifier to mean use the single most
19541954
preferred localization in the current context (this function returns NO for a NULL localeIdentifier); and in this function
19551955
langCode, regCode, and scriptCode are all SInt16* (not SInt32* like the equivalent parameters in CFBundleGetLocalizationInfoForLocalization).
19561956
*/
@@ -1966,18 +1966,18 @@ Boolean CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeI
19661966
char localeCString[kLocaleIdentifierCStringMax];
19671967
if ( CFStringGetCString(canonicalIdentifier, localeCString, sizeof(localeCString), kCFStringEncodingASCII) ) {
19681968
UErrorCode icuStatus = U_ZERO_ERROR;
1969-
int32_t languagelength;
1969+
int32_t languageLength;
19701970
char searchString[ULOC_LANG_CAPACITY + ULOC_FULLNAME_CAPACITY];
19711971

1972-
languagelength = uloc_getLanguage( localeCString, searchString, ULOC_LANG_CAPACITY, &icuStatus );
1973-
if ( U_SUCCESS(icuStatus) && languagelength > 0 ) {
1972+
languageLength = uloc_getLanguage( localeCString, searchString, ULOC_LANG_CAPACITY, &icuStatus );
1973+
if ( U_SUCCESS(icuStatus) && languageLength > 0 ) {
19741974
// OK, here we have at least a language code, check for other components in order
19751975
LocaleToLegacyCodes searchEntry = { (const char *)searchString, 0, 0, 0 };
19761976
const LocaleToLegacyCodes * foundEntryPtr;
19771977
int32_t componentLength;
19781978
char componentString[ULOC_FULLNAME_CAPACITY];
19791979

1980-
languagelength = strlen(searchString); // in case it got truncated
1980+
languageLength = strlen(searchString); // in case it got truncated
19811981
icuStatus = U_ZERO_ERROR;
19821982
componentLength = uloc_getScript( localeCString, componentString, sizeof(componentString), &icuStatus );
19831983
Boolean foundScript = false;
@@ -2006,9 +2006,9 @@ Boolean CFLocaleGetLanguageRegionEncodingForLocaleIdentifier(CFStringRef localeI
20062006

20072007
// 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: <rdar://problem/54531339>
20082008
BOOL lookingForScript = foundScript && stringEncoding != NULL;
2009-
if (foundEntryPtr == NULL && (int32_t) strlen(searchString) > languagelength && !lookingForScript) {
2009+
if (foundEntryPtr == NULL && (int32_t) strlen(searchString) > languageLength && !lookingForScript) {
20102010
// Otherwise truncate to language alone and try again
2011-
searchString[languagelength] = 0;
2011+
searchString[languageLength] = 0;
20122012
foundEntryPtr = (const LocaleToLegacyCodes *)bsearch( &searchEntry, localeToLegacyCodes, kNumLocaleToLegacyCodes, sizeof(LocaleToLegacyCodes), CompareLocaleToLegacyCodesEntries );
20132013
}
20142014

0 commit comments

Comments
 (0)