Skip to content

Commit b206861

Browse files
committed
fixes for linux
1 parent 7f4ced3 commit b206861

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Sources/ScaleCodec/Custom.swift

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@ extension Encoder {
3939
}
4040
}
4141

42-
public func encode<T>(_ value: T, _ custom: CustomEncoderFactory<T, DataEncoder>, reservedCapacity count: Int = 4096) throws -> Data {
43-
var encoder = encoder(reservedCapacity: count)
44-
try encoder.encode(value, custom)
45-
return encoder.output
42+
public func encode<T>(_ value: T, _ custom: CustomEncoderFactory<T, DataEncoder>,
43+
reservedCapacity count: Int = 4096) throws -> Data
44+
{
45+
var _encoder = encoder(reservedCapacity: count)
46+
try _encoder.encode(value, custom)
47+
return _encoder.output
4648
}
4749

4850
public func decode<T>(_ type: T.Type, _ custom: CustomDecoderFactory<T, DataDecoder>, from data: Data) throws -> T {
4951
return try decode(custom, from: data)
5052
}
5153

5254
public func decode<T>(_ custom: CustomDecoderFactory<T, DataDecoder>, from data: Data) throws -> T {
53-
var decoder = decoder(from: data)
54-
return try decoder.decode(custom)
55+
var _decoder = decoder(from: data)
56+
return try _decoder.decode(custom)
5557
}

Sources/ScaleCodec/Scale.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public func decoder(from data: Data) -> DataDecoder { DataDecoder(data: data) }
1919

2020
@inlinable
2121
public func encode<T: Encodable>(_ value: T, reservedCapacity count: Int = 4096) throws -> Data {
22-
var encoder = encoder(reservedCapacity: count)
23-
try encoder.encode(value)
24-
return encoder.output
22+
var _encoder = encoder(reservedCapacity: count)
23+
try _encoder.encode(value)
24+
return _encoder.output
2525
}
2626

2727
@inlinable
2828
public func decode<T: Decodable>(from data: Data) throws -> T {
29-
var decoder = decoder(from: data)
30-
return try decoder.decode()
29+
var _decoder = decoder(from: data)
30+
return try _decoder.decode()
3131
}
3232

3333
@inlinable

0 commit comments

Comments
 (0)