Browse Source

'where' clause next to generic parameters is deprecated

Marcin Krzyżanowski 9 years ago
parent
commit
19b9dd0c9e

+ 2 - 2
Sources/CryptoSwift/AES.swift

@@ -403,7 +403,7 @@ extension AES {
             self.paddingRequired = aes.blockMode.options.contains(.PaddingRequired)
         }
 
-        mutating public func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool = false) throws -> Array<UInt8> {
+        mutating public func update<T: Sequence>(withBytes bytes:T, isLast: Bool = false) throws -> Array<UInt8> where T.Iterator.Element == UInt8 {
             self.accumulated += bytes
 
             if isLast {
@@ -448,7 +448,7 @@ extension AES {
             self.paddingRequired = aes.blockMode.options.contains(.PaddingRequired);
         }
 
-        mutating public func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool = false) throws -> Array<UInt8> {
+        mutating public func update<T: Sequence>(withBytes bytes:T, isLast: Bool = false) throws -> Array<UInt8> where T.Iterator.Element == UInt8 {
             // prepend "offset" number of bytes at the begining
             if self.offset > 0 {
                 self.accumulated += Array<UInt8>(repeating: 0, count: offset) + bytes

+ 2 - 2
Sources/CryptoSwift/ChaCha20.swift

@@ -150,7 +150,7 @@ extension ChaCha20 {
             self.chacha = chacha
         }
 
-        mutating public func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool = false) throws -> Array<UInt8> {
+        mutating public func update<T: Sequence>(withBytes bytes:T, isLast: Bool = false) throws -> Array<UInt8> where T.Iterator.Element == UInt8 {
             self.accumulated += bytes
 
             var encrypted = Array<UInt8>()
@@ -179,7 +179,7 @@ extension ChaCha20 {
             self.chacha = chacha
         }
 
-        mutating public func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool = true) throws -> Array<UInt8> {
+        mutating public func update<T: Sequence>(withBytes bytes:T, isLast: Bool = true) throws -> Array<UInt8> where T.Iterator.Element == UInt8 {
             // prepend "offset" number of bytes at the begining
             if self.offset > 0 {
                 self.accumulated += Array<UInt8>(repeating: 0, count: offset) + bytes

+ 7 - 7
Sources/CryptoSwift/Updatable.swift

@@ -12,7 +12,7 @@ public protocol Updatable {
     /// - parameter bytes: Bytes to process
     /// - parameter isLast: (Optional) Given chunk is the last one. No more updates after this call.
     /// - returns: Processed data or empty array.
-    mutating func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool) throws -> Array<UInt8>
+    mutating func update<T: Sequence>(withBytes bytes:T, isLast: Bool) throws -> Array<UInt8> where T.Iterator.Element == UInt8
 
     /// Update given bytes in chunks.
     ///
@@ -20,29 +20,29 @@ public protocol Updatable {
     /// - parameter isLast: (Optional) Given chunk is the last one. No more updates after this call.
     /// - parameter output: Resulting data
     /// - returns: Processed data or empty array.
-    mutating func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool, output: (Array<UInt8>) -> Void) throws
+    mutating func update<T: Sequence>(withBytes bytes:T, isLast: Bool, output: (Array<UInt8>) -> Void) throws where T.Iterator.Element == UInt8
 
     /// Finish updates. This may apply padding.
     /// - parameter bytes: Bytes to process
     /// - returns: Processed data.
-    mutating func finish<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T) throws -> Array<UInt8>
+    mutating func finish<T: Sequence>(withBytes bytes:T) throws -> Array<UInt8> where T.Iterator.Element == UInt8
 
     /// Finish updates. This may apply padding.
     /// - parameter bytes: Bytes to process
     /// - parameter output: Resulting data
     /// - returns: Processed data.
-    mutating func finish<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, output: (Array<UInt8>) -> Void) throws
+    mutating func finish<T: Sequence>(withBytes bytes:T, output: (Array<UInt8>) -> Void) throws where T.Iterator.Element == UInt8
 }
 
 extension Updatable {
-    mutating public func update<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, isLast: Bool = false, output: (Array<UInt8>) -> Void) throws {
+    mutating public func update<T: Sequence>(withBytes bytes:T, isLast: Bool = false, output: (Array<UInt8>) -> Void) throws where T.Iterator.Element == UInt8 {
         let processed = try self.update(withBytes: bytes, isLast: isLast)
         if (!processed.isEmpty) {
             output(processed)
         }
     }
 
-    mutating public func finish<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T) throws -> Array<UInt8> {
+    mutating public func finish<T: Sequence>(withBytes bytes:T) throws -> Array<UInt8> where T.Iterator.Element == UInt8 {
         return try self.update(withBytes: bytes, isLast: true)
     }
     
@@ -50,7 +50,7 @@ extension Updatable {
         return try self.update(withBytes: [], isLast: true)
     }
 
-    mutating public func finish<T: Sequence where T.Iterator.Element == UInt8>(withBytes bytes:T, output: (Array<UInt8>) -> Void) throws {
+    mutating public func finish<T: Sequence>(withBytes bytes:T, output: (Array<UInt8>) -> Void) throws where T.Iterator.Element == UInt8 {
         let processed = try self.update(withBytes: bytes, isLast: true)
         if (!processed.isEmpty) {
             output(processed)