Skip to content

Commit 21b3196

Browse files
authored
Fix various typos (#5075)
* Fix various typos * code review: avoid using reserved C++ keywords
1 parent cb8377e commit 21b3196

Some content is hidden

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

61 files changed

+120
-121
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ option(FOUNDATION_BUILD_NETWORKING "build FoundationNetworking"
7474

7575
set(CMAKE_POSITION_INDEPENDENT_CODE YES)
7676

77-
# Fetchable dependcies
77+
# Fetchable dependencies
7878
include(FetchContent)
7979
if (_SwiftFoundationICU_SourceDIR)
8080
FetchContent_Declare(SwiftFoundationICU

README.md

Lines changed: 1 addition & 1 deletion
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

Sources/CoreFoundation/CFBundle.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,7 +784,7 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL,
784784
}
785785

786786

787-
// 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.
787+
// 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.
788788
_CFBundleVersion localVersion = _CFBundleGetBundleVersionForURL(newURL);
789789
if (_CFBundleVersionFlat == localVersion) {
790790
Boolean exists = false;
@@ -1741,7 +1741,7 @@ CFBundleRef _CFBundleGetBundleWithIdentifierAndLibraryName(CFStringRef bundleID,
17411741
}
17421742

17431743
static void _CFBundleEnsureAllBundlesUpToDate(void) {
1744-
// 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.
1744+
// 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.
17451745
CFArrayRef imagePaths = NULL;
17461746
// Tickle the main bundle into existence
17471747
(void)CFBundleGetMainBundle();

Sources/CoreFoundation/CFBundle_InfoPlist.c

Lines changed: 1 addition & 1 deletion
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);

Sources/CoreFoundation/CFBundle_Tables.c

Lines changed: 1 addition & 1 deletion
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;

Sources/CoreFoundation/CFCalendar.c

Lines changed: 1 addition & 1 deletion
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);

Sources/CoreFoundation/CFCalendar_Enumerate.c

Lines changed: 2 additions & 2 deletions
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);

Sources/CoreFoundation/CFData.c

Lines changed: 1 addition & 1 deletion
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;

Sources/CoreFoundation/CFDateFormatter.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,12 @@ CFStringRef CFDateFormatterCreateDateFormatFromTemplate(CFAllocatorRef allocator
155155
}
156156

157157
UChar pattern[BUFFER_SIZE] = {0}, skel[BUFFER_SIZE] = {0}, bpat[BUFFER_SIZE] = {0};
158-
CFIndex tmpltLen = CFStringGetLength(tmplateString);
159-
if (BUFFER_SIZE < tmpltLen) tmpltLen = BUFFER_SIZE;
160-
CFStringGetCharacters(tmplateString, CFRangeMake(0, tmpltLen), (UniChar *)pattern);
158+
CFIndex tmplateLen = CFStringGetLength(tmplateString);
159+
if (BUFFER_SIZE < tmplateLen) tmplateLen = BUFFER_SIZE;
160+
CFStringGetCharacters(tmplateString, CFRangeMake(0, tmplateLen), (UniChar *)pattern);
161161
CFRelease(tmplateString);
162162

163-
int32_t patlen = tmpltLen;
163+
int32_t patlen = tmplateLen;
164164
UErrorCode status = U_ZERO_ERROR;
165165
int32_t skellen = __cficu_udatpg_getSkeleton(ptg, pattern, patlen, skel, sizeof(skel) / sizeof(skel[0]), &status);
166166
if (!U_FAILURE(status)) {
@@ -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
}
@@ -2174,8 +2174,8 @@ CFTypeRef CFDateFormatterCopyProperty(CFDateFormatterRef formatter, CFStringRef
21742174
}
21752175

21762176
CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef tmplateString, CFLocaleRef locale, UErrorCode *outErrorCode) {
2177-
CFIndex const tmpltLen = CFStringGetLength(tmplateString);
2178-
if (tmpltLen == 0) {
2177+
CFIndex const tmplateLen = CFStringGetLength(tmplateString);
2178+
if (tmplateLen == 0) {
21792179
if (outErrorCode) {
21802180
*outErrorCode = U_ILLEGAL_ARGUMENT_ERROR;
21812181
}
@@ -2186,15 +2186,15 @@ CFStringRef _CFDateFormatterCreateSkeletonFromTemplate(CFStringRef tmplateString
21862186
Boolean success = useTemplatePatternGenerator(locale, ^(UDateTimePatternGenerator *ptg) {
21872187
#define BUFFER_SIZE 768
21882188

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

21962196
UChar skel[BUFFER_SIZE] = {0};
2197-
int32_t patlen = tmpltLen;
2197+
int32_t patlen = tmplateLen;
21982198
UErrorCode status = U_ZERO_ERROR;
21992199
int32_t skelLen = __cficu_udatpg_getSkeleton(ptg, ustr, patlen, skel, sizeof(skel) / sizeof(skel[0]), &status);
22002200
if (U_SUCCESS(status)) {

Sources/CoreFoundation/CFICUConverters.c

Lines changed: 1 addition & 1 deletion
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;

0 commit comments

Comments
 (0)