From ced5198c8a8ccee7fc05b3d8e8f183eceeb981d2 Mon Sep 17 00:00:00 2001 From: Fabian Fett Date: Thu, 19 Mar 2020 14:52:59 +0100 Subject: [PATCH] Fix typo decodeFixedWithInteger() -> decodeFixedWidthInteger() (#22) - Fix issue #18 --- .../JSONSingleValueDecodingContainer.swift | 22 +++++++++---------- .../JSONUnkeyedDecodingContainer.swift | 22 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/Sources/PureSwiftJSONCoding/Decoding/JSONSingleValueDecodingContainer.swift b/Sources/PureSwiftJSONCoding/Decoding/JSONSingleValueDecodingContainer.swift index 35d2b64..385d8da 100644 --- a/Sources/PureSwiftJSONCoding/Decoding/JSONSingleValueDecodingContainer.swift +++ b/Sources/PureSwiftJSONCoding/Decoding/JSONSingleValueDecodingContainer.swift @@ -41,43 +41,43 @@ struct JSONSingleValueDecodingContainter: SingleValueDecodingContainer { } func decode(_ type: Int.Type) throws -> Int { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: Int8.Type) throws -> Int8 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: Int16.Type) throws -> Int16 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: Int32.Type) throws -> Int32 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: Int64.Type) throws -> Int64 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: UInt.Type) throws -> UInt { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: UInt8.Type) throws -> UInt8 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: UInt16.Type) throws -> UInt16 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: UInt32.Type) throws -> UInt32 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: UInt64.Type) throws -> UInt64 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } func decode(_ type: T.Type) throws -> T where T : Decodable { @@ -93,7 +93,7 @@ extension JSONSingleValueDecodingContainter { debugDescription: "Expected to decode \(type) but found \(value.debugDataTypeDescription) instead.")) } - @inline(__always) private func decodeFixedWithInteger() throws + @inline(__always) private func decodeFixedWidthInteger() throws -> T { guard case .number(let number) = value else { diff --git a/Sources/PureSwiftJSONCoding/Decoding/JSONUnkeyedDecodingContainer.swift b/Sources/PureSwiftJSONCoding/Decoding/JSONUnkeyedDecodingContainer.swift index 1195d38..2d0d1bb 100644 --- a/Sources/PureSwiftJSONCoding/Decoding/JSONUnkeyedDecodingContainer.swift +++ b/Sources/PureSwiftJSONCoding/Decoding/JSONUnkeyedDecodingContainer.swift @@ -72,43 +72,43 @@ struct JSONUnkeyedDecodingContainer: UnkeyedDecodingContainer { } mutating func decode(_ type: Int.Type) throws -> Int { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: Int8.Type) throws -> Int8 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: Int16.Type) throws -> Int16 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: Int32.Type) throws -> Int32 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: Int64.Type) throws -> Int64 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: UInt.Type) throws -> UInt { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: UInt8.Type) throws -> UInt8 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: UInt16.Type) throws -> UInt16 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: UInt32.Type) throws -> UInt32 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: UInt64.Type) throws -> UInt64 { - return try self.decodeFixedWithInteger() + return try self.decodeFixedWidthInteger() } mutating func decode(_ type: T.Type) throws -> T where T : Decodable { @@ -149,7 +149,7 @@ extension JSONUnkeyedDecodingContainer { } - @inline(__always) private mutating func decodeFixedWithInteger() throws + @inline(__always) private mutating func decodeFixedWidthInteger() throws -> T { defer {