From 47898a0f6bbfe56600c75077ab4ddfbc59b01be2 Mon Sep 17 00:00:00 2001 From: antonmes Date: Wed, 3 Aug 2016 04:08:10 +0300 Subject: [PATCH 1/2] Updating to 07-28 snapshot --- Sources/Data.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Sources/Data.swift b/Sources/Data.swift index 4f09d04..ed6a324 100644 --- a/Sources/Data.swift +++ b/Sources/Data.swift @@ -34,7 +34,7 @@ extension Data: RangeReplaceableCollection, MutableCollection { } #if swift(>=3.0) - public init(_ elements: S) { + public init(_ elements: S) where S.Iterator.Element == Byte { self.init(Array(elements)) } #else @@ -44,7 +44,7 @@ extension Data: RangeReplaceableCollection, MutableCollection { #endif #if swift(>=3.0) - public mutating func replaceSubrange(_ subRange: Range, with newElements: C) { + public mutating func replaceSubrange(_ subRange: Range, with newElements: C) where C.Iterator.Element == Byte { self.bytes.replaceSubrange(subRange, with: newElements) } #else @@ -123,7 +123,7 @@ public func == (lhs: Data, rhs: Data) -> Bool { } #if swift(>=3.0) - public func += (lhs: inout Data, rhs: S) { + public func += (lhs: inout Data, rhs: S) where S.Iterator.Element == Byte { return lhs.bytes += rhs } #else @@ -174,9 +174,9 @@ extension String: DataConvertible { loop: while true { switch decoder.decode(&generator) { - case .scalarValue(let char): string.append(char) + case .scalarValue(let char): string.unicodeScalars.append(char) case .emptyInput: break loop - case .error: throw StringError() + case .error: return nil } } From 3179f540844784f68122f7fa6a76d86b3f10d571 Mon Sep 17 00:00:00 2001 From: antonmes Date: Wed, 3 Aug 2016 04:14:05 +0300 Subject: [PATCH 2/2] Reverse line --- Sources/Data.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Data.swift b/Sources/Data.swift index ed6a324..693e7e4 100644 --- a/Sources/Data.swift +++ b/Sources/Data.swift @@ -176,7 +176,7 @@ extension String: DataConvertible { switch decoder.decode(&generator) { case .scalarValue(let char): string.unicodeScalars.append(char) case .emptyInput: break loop - case .error: return nil + case .error: throw StringError() } }