Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -435,12 +435,12 @@ public struct Data : ReferenceConvertible, CustomStringConvertible, Equatable, H
///
/// In some cases, (for example, a `Data` backed by a `dispatch_data_t`, the bytes may be stored discontiguously. In those cases, this function invokes the closure for each contiguous region of bytes.
/// - parameter block: The closure to invoke for each region of data. You may stop the enumeration by setting the `stop` parameter to `true`.
public func enumerateBytes(_ block: @noescape (buffer: UnsafeBufferPointer<UInt8>, byteIndex: Index, stop: inout Bool) -> Void) {
public func enumerateBytes(_ block: @noescape (_ buffer: UnsafeBufferPointer<UInt8>, _ byteIndex: Index, _ stop: inout Bool) -> Void) {
_mapUnmanaged {
$0.enumerateBytes { (ptr, range, stop) in
var stopv = false
let bytePtr = ptr.bindMemory(to: UInt8.self, capacity: range.length)
block(buffer: UnsafeBufferPointer(start: bytePtr, count: range.length), byteIndex: range.length, stop: &stopv)
block(UnsafeBufferPointer(start: bytePtr, count: range.length), range.length, &stopv)
if stopv {
stop.pointee = true
}
Expand Down
2 changes: 1 addition & 1 deletion Foundation/NSData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ extension NSData {
internal struct NSDataReadResult {
var bytes: UnsafeMutableRawPointer
var length: Int
var deallocator: ((buffer: UnsafeMutableRawPointer, length: Int) -> Void)?
var deallocator: ((_ buffer: UnsafeMutableRawPointer, _ length: Int) -> Void)?
}

internal static func readBytesFromFileWithExtendedAttributes(_ path: String, options: ReadingOptions) throws -> NSDataReadResult {
Expand Down
2 changes: 1 addition & 1 deletion Foundation/NSError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public class NSError : NSObject, NSCopying, NSSecureCoding, NSCoding {
return userInfo[NSHelpAnchorErrorKey] as? String
}

internal typealias NSErrorProvider = (error: NSError, key: String) -> AnyObject?
internal typealias NSErrorProvider = (_ error: NSError, _ key: String) -> AnyObject?
internal static var userInfoProviders = [String: NSErrorProvider]()

public class func setUserInfoValueProviderForDomain(_ errorDomain: String, provider: ((NSError, String) -> AnyObject?)?) {
Expand Down
18 changes: 9 additions & 9 deletions Foundation/String.swift
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,12 @@ extension String {
// enumerateLinesUsing:(void (^)(NSString *line, BOOL *stop))block

/// Enumerates all the lines in a string.
public func enumerateLines(_ body: (line: String, stop: inout Bool) -> ()) {
public func enumerateLines(_ body: (_ line: String, _ stop: inout Bool) -> ()) {
_ns.enumerateLines {
(line: String, stop: UnsafeMutablePointer<ObjCBool>)
in
var stop_ = false
body(line: line, stop: &stop_)
body(line, &stop_)
if stop_ {
UnsafeMutablePointer<ObjCBool>(stop).pointee = true
}
Expand All @@ -434,16 +434,16 @@ extension String {
in range: Range<Index>,
options opts: EnumerationOptions = [],
_ body: (
substring: String?, substringRange: Range<Index>,
enclosingRange: Range<Index>, inout Bool
_ substring: String?, _ substringRange: Range<Index>,
_ enclosingRange: Range<Index>, inout Bool
) -> ()
) {
_ns.enumerateSubstrings(in: _toNSRange(range), options: opts) {
var stop_ = false

body(substring: $0,
substringRange: self._range($1),
enclosingRange: self._range($2),
body($0,
self._range($1),
self._range($2),
&stop_)

if stop_ {
Expand Down Expand Up @@ -1554,8 +1554,8 @@ extension String {
_ range: Range<Index>,
options opts: EnumerationOptions = [],
_ body: (
substring: String?, substringRange: Range<Index>,
enclosingRange: Range<Index>, inout Bool
_ substring: String?, _ substringRange: Range<Index>,
_ enclosingRange: Range<Index>, inout Bool
) -> ()
) {
fatalError("unavailable function can't be called")
Expand Down