Skip to content

Commit 1ddccfd

Browse files
committed
In response to review comments
1 parent 6781308 commit 1ddccfd

File tree

12 files changed

+16
-20
lines changed

12 files changed

+16
-20
lines changed

CoreFoundation/Base.subproj/CFBase.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,9 @@ CF_EXPORT double kCFCoreFoundationVersionNumber;
449449
#endif
450450

451451
#ifdef __ANDROID__
452-
typedef uint16_t _swift_rc_type;
452+
typedef uint16_t _CFSwiftRCCount;
453453
#else
454-
typedef uint32_t _swift_rc_type;
454+
typedef uint32_t _CFSwiftRCCount;
455455
#endif
456456

457457
#if __LLP64__

CoreFoundation/Base.subproj/CFInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ extern void __CFGenericValidateType_(CFTypeRef cf, CFTypeID type, const char *fu
216216
#define __CFBitfield64GetValue(V, N1, N2) (((V) & __CFBitfield64Mask(N1, N2)) >> (N2))
217217
#define __CFBitfield64SetValue(V, N1, N2, X) ((V) = ((V) & ~__CFBitfield64Mask(N1, N2)) | ((((uint64_t)X) << (N2)) & __CFBitfield64Mask(N1, N2)))
218218

219-
#if __LP64__ || defined(__ANDROID__)
219+
#if __LP64__ || DEPLOYMENT_TARGET_ANDROID
220220
typedef uint64_t __CFInfoType;
221221
#define __CFInfoMask(N1, N2) __CFBitfield64Mask(N1, N2)
222222
#else

CoreFoundation/Base.subproj/CFPlatform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ CF_EXPORT CFStringRef CFCopyFullUserName(void) {
297297
uid_t euid;
298298
__CFGetUGIDs(&euid, NULL);
299299
struct passwd *upwd = getpwuid(euid ? euid : getuid());
300-
#ifdef __ANDROID__
300+
#if DEPLOYMENT_TARGET_ANDROID
301301
#define pw_gecos pw_name
302302
#endif
303303
if (upwd && upwd->pw_gecos) {

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,11 @@ CFTypeRef _CFRuntimeCreateInstance(CFAllocatorRef allocator, CFTypeID typeID, CF
384384
CFRuntimeClass *cls = __CFRuntimeClassTable[typeID];
385385
size_t align = (cls->version & _kCFRuntimeRequiresAlignment) ? cls->requiredAlignment : 16;
386386

387+
#if DEPLOYMENT_TARGET_ANDROID
388+
CFRuntimeBase *memory = (CFRuntimeBase *)swift_allocObject(isa, size + 4, align - 1);
389+
#else
387390
CFRuntimeBase *memory = (CFRuntimeBase *)swift_allocObject(isa, size, align - 1);
391+
#endif
388392

389393
// Zero the rest of the memory, starting at cfinfo
390394
memset(&memory->_cfinfoa, 0, size - (sizeof(memory->_cfisa) + sizeof(memory->_swift_rc)));

CoreFoundation/Base.subproj/ForSwiftFoundationOnly.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ static inline _Bool _withStackOrHeapBuffer(size_t amount, void (__attribute__((n
403403
static inline int _direntNameLength(struct dirent *entry) {
404404
#ifdef _D_EXACT_NAMLEN // defined on Linux
405405
return _D_EXACT_NAMLEN(entry);
406-
#elseif defined(__ANDROID__)
406+
#elseif DEPLOYMENT_TARGET_ANDROID
407407
return strlen(entry->d_name);
408408
#else
409409
return entry->d_namlen;

CoreFoundation/PlugIn.subproj/CFBundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ static CFBundleRef _CFBundleCreate(CFAllocatorRef allocator, CFURLRef bundleURL,
714714

715715
bundle->_url = newURL;
716716

717-
#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !defined(__ANDROID__)
717+
#if !DEPLOYMENT_RUNTIME_OBJC && !DEPLOYMENT_TARGET_WINDOWS && !DEPLOYMENT_TARGET_ANDROID
718718
bundle->_isFHSInstalledBundle = _CFBundleURLIsForFHSInstalledBundle(newURL);
719719
#endif
720720

CoreFoundation/PlugIn.subproj/CFBundle_Main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static CFBundleRef _CFBundleGetMainBundleAlreadyLocked(void) {
7979
CFStringRef str = NULL;
8080
CFURLRef executableURL = NULL, bundleURL = NULL;
8181
_initedMainBundle = true;
82-
#ifdef __ANDROID__
82+
#if DEPLOYMENT_TARGET_ANDROID
8383
const char *bundlePath = getenv("CFFIXED_USER_HOME") ?: getenv("TMPDIR") ?: "/data/local/tmp";
8484
CFStringRef bundleRef = CFStringCreateWithFileSystemRepresentation(kCFAllocatorNull, bundlePath);
8585
bundleURL = CFRetain(CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault, bundleRef,

CoreFoundation/Preferences.subproj/CFPreferences.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ static CFURLRef _CFPreferencesURLForStandardDomainWithSafetyLevel(CFStringRef do
440440
CFURLRef theURL = NULL;
441441
CFAllocatorRef prefAlloc = __CFPreferencesAllocator();
442442
#if DEPLOYMENT_TARGET_MACOSX || DEPLOYMENT_TARGET_LINUX || DEPLOYMENT_TARGET_WINDOWS
443-
#ifdef __ANDROID__
443+
#if DEPLOYMENT_TARGET_ANDROID
444444
CFURLRef prefDir = CFBundleCopyBundleURL(CFBundleGetMainBundle());
445445
#else
446446
CFURLRef prefDir = _preferencesDirectoryForUserHostSafetyLevel(userName, hostName, safeLevel);

CoreFoundation/URL.subproj/CFURL.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
#include <unistd.h>
2626
#include <sys/stat.h>
2727
#include <sys/types.h>
28-
#if __has_include(<sys/syslog.h>)
29-
#include <sys/syslog.h>
30-
#elif __has_include(<syslog.h>)
28+
#if __has_include(<syslog.h>)
3129
#include <syslog.h>
30+
#else
31+
#include <sys/syslog.h>
3232
#endif
3333
#include <CoreFoundation/CFURLPriv.h>
3434
#endif

Foundation/NSCFArray.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ import CoreFoundation
1212

1313
internal final class _NSCFArray : NSMutableArray {
1414
deinit {
15-
#if !os(Android)
1615
_CFDeinit(self)
17-
#endif
1816
_CFZeroUnsafeIvars(&_storage)
1917
}
2018

0 commit comments

Comments
 (0)