Merge pull request #1171 from spevans/pr_characters_deprecate
diff --git a/CoreFoundation/Parsing.subproj/CFXMLInterface.c b/CoreFoundation/Parsing.subproj/CFXMLInterface.c
index 0c1dbae..5be8bff 100644
--- a/CoreFoundation/Parsing.subproj/CFXMLInterface.c
+++ b/CoreFoundation/Parsing.subproj/CFXMLInterface.c
@@ -893,8 +893,8 @@
CFArrayAppendValue(results, nodes->nodeTab[i]);
}
- xmlFree(context);
- xmlFree(evalResult);
+ xmlXPathFreeContext(context);
+ xmlXPathFreeObject(evalResult);
return results;
}
diff --git a/Foundation/NSNotification.swift b/Foundation/NSNotification.swift
index 688b86a..3926ee8 100644
--- a/Foundation/NSNotification.swift
+++ b/Foundation/NSNotification.swift
@@ -187,8 +187,13 @@
self._observers = _observers.filterOutObserver(observer, name: aName, object: object)
})
}
-
+
+ @available(*,obsoleted:4.0,renamed:"addObserver(forName:object:queue:using:)")
open func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, usingBlock block: @escaping (Notification) -> Void) -> NSObjectProtocol {
+ return addObserver(forName: name, object: obj, queue: queue, using: block)
+ }
+
+ open func addObserver(forName name: Notification.Name?, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) -> NSObjectProtocol {
let object = NSObject()
let newObserver = NSNotificationReceiver()
diff --git a/Foundation/NSURL.swift b/Foundation/NSURL.swift
index 3b6248e..697c488 100644
--- a/Foundation/NSURL.swift
+++ b/Foundation/NSURL.swift
@@ -405,7 +405,7 @@
let buffer = malloc(bytesNeeded)!.bindMemory(to: UInt8.self, capacity: bytesNeeded)
let bytesFilled = CFURLGetBytes(_cfObject, buffer, bytesNeeded)
if bytesFilled == bytesNeeded {
- return Data(bytesNoCopy: buffer, count: bytesNeeded, deallocator: .none)
+ return Data(bytesNoCopy: buffer, count: bytesNeeded, deallocator: .free)
} else {
fatalError()
}
diff --git a/TestFoundation/TestURL.swift b/TestFoundation/TestURL.swift
index b0977b1..1ce0bf9 100644
--- a/TestFoundation/TestURL.swift
+++ b/TestFoundation/TestURL.swift
@@ -64,6 +64,7 @@
("test_reachable", test_reachable),
("test_copy", test_copy),
("test_itemNSCoding", test_itemNSCoding),
+ ("test_dataRepresentation", test_dataRepresentation),
]
}
@@ -491,6 +492,13 @@
let queryItemB = NSKeyedUnarchiver.unarchiveObject(with: NSKeyedArchiver.archivedData(withRootObject: queryItemA)) as! NSURLQueryItem
XCTAssertEqual(queryItemA, queryItemB, "Archived then unarchived query item must be equal.")
}
+
+ func test_dataRepresentation() {
+ let url = NSURL(fileURLWithPath: "/tmp/foo")
+ let url2 = NSURL(dataRepresentation: url.dataRepresentation,
+ relativeTo: nil)
+ XCTAssertEqual(url, url2)
+ }
}
class TestURLComponents : XCTestCase {