Skip to content

Instantly share code, notes, and snippets.

diff --git a/Tests/Foundation/Tests/TestXMLDocument.swift b/Tests/Foundation/Tests/TestXMLDocument.swift
index e513052f..37d0e325 100644
--- a/Tests/Foundation/Tests/TestXMLDocument.swift
+++ b/Tests/Foundation/Tests/TestXMLDocument.swift
@@ -732,7 +732,7 @@ class TestXMLDocument : LoopbackServerTest {
("test_stringValue", test_stringValue),
("test_objectValue", test_objectValue),
("test_attributes", test_attributes),
- ("test_attributesWithNamespace", test_attributesWithNamespace),
+ /* ⚠️ */ ("test_attributesWithNamespace", testExpectedToFail(test_attributesWithNamespace, "Exposes underlying memory issues")),
diff --git a/Sources/Foundation/NSTimeZone.swift b/Sources/Foundation/NSTimeZone.swift
index 8f710d62..67eeed3e 100644
--- a/Sources/Foundation/NSTimeZone.swift
+++ b/Sources/Foundation/NSTimeZone.swift
@@ -95,10 +95,13 @@ open class NSTimeZone : NSObject, NSCopying, NSSecureCoding, NSCoding {
public convenience init?(abbreviation: String) {
let abbr = abbreviation._cfObject
- guard let name = unsafeBitCast(CFDictionaryGetValue(CFTimeZoneCopyAbbreviationDictionary(), unsafeBitCast(abbr, to: UnsafeRawPointer.self)), to: NSString?.self) else {
- return nil
diff --git a/Sources/Foundation/NSAttributedString.swift b/Sources/Foundation/NSAttributedString.swift
index dce57a25..4f7523f1 100644
--- a/Sources/Foundation/NSAttributedString.swift
+++ b/Sources/Foundation/NSAttributedString.swift
@@ -559,7 +559,7 @@ internal func _NSReadIntFromMutableAttributedStringCoding(_ data: NSData, _ star
var value = 0
- withExtendedLifetime(data) {
+ return withExtendedLifetime(data) { _ -> (Int, Int)? in
@spevans
spevans / urlsession_proposal.md
Last active February 7, 2021 16:57
Proposal: swift-corelibs-foundation: Replace libcurl with SwiftNIO and AsyncHttpClient

Proposal: swift-corelibs-foundation: Replace libcurl with SwiftNIO and AsyncHttpClient

[cc millenomi Tony_Parker]

Motivation

The swift-corelibs-foundation's (scl-f) URLSession implementation for protocols http and ftp currently uses libcurl, provided by the host's package system or built separately as part of the toolchain build (Windows). At the current time these 2 protocols still have bugs and require more work to fix up authentication, cookies, session metrics and some concurrency bugs in the general URLSession

@spevans
spevans / gist:b2c6f736107df65719dd79f3979c7dfd
Created September 16, 2017 19:59
TestFoundation changes on run under macOS
diff --git a/TestFoundation/HTTPServer.swift b/TestFoundation/HTTPServer.swift
index f52b7712..47d993ab 100644
--- a/TestFoundation/HTTPServer.swift
+++ b/TestFoundation/HTTPServer.swift
@@ -16,15 +16,18 @@ import Dispatch
#if DEPLOYMENT_RUNTIME_OBJC || os(Linux)
import Foundation
- import Glibc
import XCTest
@spevans
spevans / gist:acddf957dd2ed30de5b2ea033af29340
Created September 16, 2017 19:59
TestFoundation changes on run under macOS
diff --git a/TestFoundation/HTTPServer.swift b/TestFoundation/HTTPServer.swift
index f52b7712..47d993ab 100644
--- a/TestFoundation/HTTPServer.swift
+++ b/TestFoundation/HTTPServer.swift
@@ -16,15 +16,18 @@ import Dispatch
#if DEPLOYMENT_RUNTIME_OBJC || os(Linux)
import Foundation
- import Glibc
import XCTest
@spevans
spevans / gist:8eeda038a9c44c9a337aaa2833627c3b
Created September 16, 2017 19:58
Changes to Foundation to compile sclf on macOS
diff --git a/Foundation/JSONSerialization.swift b/Foundation/JSONSerialization.swift
index c624e7a7..3eda7b4d 100644
--- a/Foundation/JSONSerialization.swift
+++ b/Foundation/JSONSerialization.swift
@@ -15,6 +15,8 @@ import CoreFoundation
import Glibc
#endif
+public typealias NSErrorPointer = AutoreleasingUnsafeMutablePointer<NSError?>?
+
@spevans
spevans / fatalTest.swift
Created August 6, 2017 09:20
Attempts to catch fatalError() in swift for use in XCTestCase, not robust at all
//
// fatalTest.swift
// fatalTest
//
// Created by Simon Evans on 04/08/2017.
// Copyright © 2017 Simon Evans. All rights reserved.
//
import Foundation
import Darwin