Skip to content

Commit 07d8312

Browse files
committed
Bring in new refcount representation.
1 parent 1ddccfd commit 07d8312

File tree

14 files changed

+18
-40
lines changed

14 files changed

+18
-40
lines changed

CoreFoundation/Base.subproj/CFBase.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -448,12 +448,6 @@ CF_EXPORT double kCFCoreFoundationVersionNumber;
448448
#define kCFCoreFoundationVersionNumber_iOS_9_x_Max 1299
449449
#endif
450450

451-
#ifdef __ANDROID__
452-
typedef uint16_t _CFSwiftRCCount;
453-
#else
454-
typedef uint32_t _CFSwiftRCCount;
455-
#endif
456-
457451
#if __LLP64__
458452
typedef unsigned long long CFTypeID;
459453
typedef unsigned long long CFOptionFlags;

CoreFoundation/Base.subproj/CFRuntime.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -384,11 +384,7 @@ 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
390387
CFRuntimeBase *memory = (CFRuntimeBase *)swift_allocObject(isa, size, align - 1);
391-
#endif
392388

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

CoreFoundation/NumberDate.subproj/CFTimeZone.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,14 @@ static CFTimeZoneRef __CFTimeZoneCreateSystem(void) {
813813
CFRelease(name);
814814
if (result) return result;
815815
}
816+
#if DEPLOYMENT_TARGET_ANDROID
817+
// Timezone database by name not available on Android.
818+
// Approximate with gmtoff - could be general default.
819+
struct tm info;
820+
time_t now = time(NULL);
821+
if (NULL != localtime_r(&now, &info))
822+
return CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorSystemDefault, info.tm_gmtoff);
823+
#endif
816824
return CFTimeZoneCreateWithTimeIntervalFromGMT(kCFAllocatorSystemDefault, 0.0);
817825
}
818826

Foundation/FileManager.swift

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -375,10 +375,13 @@ open class FileManager : NSObject {
375375

376376
This method replaces fileSystemAttributesAtPath:.
377377
*/
378+
#if os(Android)
379+
@available(*, unavailable, message: "Unsuppported on this platform")
380+
open func attributesOfFileSystem(forPath path: String) throws -> [FileAttributeKey : Any] {
381+
NSUnsupported()
382+
}
383+
#else
378384
open func attributesOfFileSystem(forPath path: String) throws -> [FileAttributeKey : Any] {
379-
#if os(Android)
380-
NSUnimplemented()
381-
#else
382385
// statvfs(2) doesn't support 64bit inode on Darwin (apfs), fallback to statfs(2)
383386
#if os(macOS) || os(iOS)
384387
var s = statfs()
@@ -407,8 +410,8 @@ open class FileManager : NSObject {
407410
result[.systemFreeNodes] = NSNumber(value: UInt64(s.f_ffree))
408411

409412
return result
410-
#endif
411413
}
414+
#endif
412415

413416
/* createSymbolicLinkAtPath:withDestination:error: returns YES if the symbolic link that point at 'destPath' was able to be created at the location specified by 'path'. If this method returns NO, the link was unable to be created and an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink.
414417

Foundation/NSCFString.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ internal final class _NSCFConstantString : _NSCFString {
7171
// FIXME: Split expression as a work-around for slow type
7272
// checking (tracked by SR-5322).
7373
let offTemp1 = MemoryLayout<OpaquePointer>.size + MemoryLayout<uintptr_t>.size
74-
let offTemp2 = MemoryLayout<_CFInfo>.size
75-
return offTemp1 + offTemp2 + MemoryLayout<UnsafePointer<UInt8>>.size
74+
let offset = offTemp1 + MemoryLayout<_CFInfo>.size
75+
return offset + MemoryLayout<UnsafePointer<UInt8>>.size
7676
}
7777

7878
private var _lenPtr : UnsafeMutableRawPointer {

Foundation/NSCalendar.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ open class NSCalendar : NSObject, NSCopying, NSSecureCoding {
130130
private var _localeID: UnsafeMutableRawPointer? = nil
131131
private var _tz: UnsafeMutableRawPointer? = nil
132132
private var _cal: UnsafeMutableRawPointer? = nil
133-
private let __sizeofAdjustment = _CFPad()
134133

135134
internal var _cfObject: CFType {
136135
return unsafeBitCast(self, to: CFCalendar.self)

Foundation/NSCharacterSet.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ open class NSCharacterSet : NSObject, NSCopying, NSMutableCopying, NSCoding {
3636
private var _buffer: UnsafeMutableRawPointer? = nil
3737
private var _length = CFIndex(0)
3838
private var _annex: UnsafeMutableRawPointer? = nil
39-
private let __sizeofAdjustment = _CFPad()
4039

4140
internal var _cfObject: CFType {
4241
return unsafeBitCast(self, to: CFType.self)

Foundation/NSData.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ open class NSData : NSObject, NSCopying, NSMutableCopying, NSSecureCoding {
8383
private var _deallocator: UnsafeMutableRawPointer? = nil // for CF only
8484
private var _deallocHandler: _NSDataDeallocator? = _NSDataDeallocator() // for Swift
8585
private var _bytes: UnsafeMutablePointer<UInt8>? = nil
86-
private let __sizeofAdjustment = _CFPad()
8786

8887
internal var _cfObject: CFType {
8988
if type(of: self) === NSData.self || type(of: self) === NSMutableData.self {

Foundation/NSDate.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ open class NSDate : NSObject, NSCopying, NSSecureCoding, NSCoding {
4949

5050
internal let _base = _CFInfo(typeID: CFDateGetTypeID())
5151
internal let _timeIntervalSinceReferenceDate: TimeInterval
52-
private let __sizeofAdjustment = _CFPad()
5352

5453
open var timeIntervalSinceReferenceDate: TimeInterval {
5554
return _timeIntervalSinceReferenceDate

Foundation/NSKeyedArchiverHelpers.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ internal class _NSKeyedArchiverUID : NSObject {
1919
typealias CFType = CFKeyedArchiverUID
2020
internal var _base = _CFInfo(typeID: _CFKeyedArchiverUIDGetTypeID())
2121
internal var value : UInt32 = 0
22-
private let __sizeofAdjustment = _CFPad()
2322

2423
internal var _cfObject : CFType {
2524
return unsafeBitCast(self, to: CFType.self)

0 commit comments

Comments
 (0)