Skip to content

Commit 14427c0

Browse files
committed
[SE-0127] Update to avoid use of withUnsafeMutablePointers.
We're removing the 2- and 3-argument versions of this API, so this change uses nested withUnsafeMutablePointer (with one argument each) instead.
1 parent 03543f6 commit 14427c0

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Foundation/NSPropertyList.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ public class PropertyListSerialization : NSObject {
9090
internal class func propertyListWithStream(_ stream: CFReadStream, length streamLength: Int, options opt: ReadOptions, format: UnsafeMutablePointer <PropertyListFormat>?) throws -> Any {
9191
var fmt = kCFPropertyListBinaryFormat_v1_0
9292
var error: Unmanaged<CFError>? = nil
93-
let decoded = withUnsafeMutablePointers(&fmt, &error) { (outFmt: UnsafeMutablePointer<CFPropertyListFormat>, outErr: UnsafeMutablePointer<Unmanaged<CFError>?>) -> NSObject? in
94-
return unsafeBitCast(CFPropertyListCreateWithStream(kCFAllocatorSystemDefault, stream, streamLength, CFOptionFlags(CFIndex(opt.rawValue)), outFmt, outErr), to: NSObject.self)
93+
let decoded = withUnsafeMutablePointer(&fmt) { (outFmt: UnsafeMutablePointer<CFPropertyListFormat>) -> NSObject? in
94+
withUnsafeMutablePointer(&error) { (outErr: UnsafeMutablePointer<Unmanaged<CFError>?>) -> NSObject? in
95+
return unsafeBitCast(CFPropertyListCreateWithStream(kCFAllocatorSystemDefault, stream, streamLength, CFOptionFlags(CFIndex(opt.rawValue)), outFmt, outErr), to: NSObject.self)
96+
}
9597
}
9698
#if os(OSX) || os(iOS)
9799
format?.pointee = PropertyListFormat(rawValue: UInt(fmt.rawValue))!

0 commit comments

Comments
 (0)