@@ -113,15 +113,15 @@ private class DecodeContext: Decoder {
113113 JamSingleValueDecodingContainer ( codingPath: codingPath, decoder: self )
114114 }
115115
116- fileprivate func decodeInt< T: FixedWidthInteger > ( codingPath _ : @autoclosure ( ) -> [ CodingKey ] ) throws -> T {
117- let data = try input. read ( length: MemoryLayout< T> . size)
116+ fileprivate func decodeInt< T: FixedWidthInteger > ( codingPath: @autoclosure ( ) -> [ CodingKey ] ) throws -> T {
117+ let data = try input. read ( length: MemoryLayout< T> . size, codingPath : codingPath ( ) )
118118 return data. withUnsafeBytes { ptr in
119119 ptr. loadUnaligned ( as: T . self)
120120 }
121121 }
122122
123123 fileprivate func decodeCompact< T: FixedWidthInteger > ( codingPath: @autoclosure ( ) -> [ CodingKey ] ) throws -> T {
124- let value = try input. decodeUInt64 ( )
124+ let value = try input. decodeUInt64 ( codingPath ( ) )
125125 guard let res = T ( exactly: value) else {
126126 throw DecodingError . dataCorrupted (
127127 DecodingError . Context (
@@ -138,7 +138,7 @@ private class DecodeContext: Decoder {
138138 if path. isEmpty {
139139 return try input. readAll ( )
140140 }
141- let length = try input. decodeUInt64 ( )
141+ let length = try input. decodeUInt64 ( path )
142142 // sanity check: length must be less than 4gb
143143 guard length < 0x1_0000_0000 else {
144144 throw DecodingError . dataCorrupted (
@@ -148,7 +148,7 @@ private class DecodeContext: Decoder {
148148 )
149149 )
150150 }
151- let res = try input. read ( length: Int ( length) )
151+ let res = try input. read ( length: Int ( length) , codingPath : path )
152152 return res
153153 }
154154
@@ -157,7 +157,7 @@ private class DecodeContext: Decoder {
157157 if path. isEmpty {
158158 return try [ UInt8] ( input. readAll ( ) )
159159 }
160- let length = try input. decodeUInt64 ( )
160+ let length = try input. decodeUInt64 ( path )
161161 // sanity check: length must be less than 4gb
162162 guard length < 0x1_0000_0000 else {
163163 throw DecodingError . dataCorrupted (
@@ -167,12 +167,12 @@ private class DecodeContext: Decoder {
167167 )
168168 )
169169 }
170- let res = try input. read ( length: Int ( length) )
170+ let res = try input. read ( length: Int ( length) , codingPath : path )
171171 return Array ( res)
172172 }
173173
174174 fileprivate func decodeArray< T: ArrayWrapper > ( _ type: T . Type , key: CodingKey ? ) throws -> T {
175- let length = try input. decodeUInt64 ( )
175+ let length = try input. decodeUInt64 ( codingPath )
176176 // sanity check: length can't be unreasonably large
177177 guard length < 0xFFFFFF else {
178178 throw DecodingError . dataCorrupted (
@@ -193,13 +193,13 @@ private class DecodeContext: Decoder {
193193 fileprivate func decodeFixedLengthData< T: FixedLengthData > ( _ type: T . Type , key: CodingKey ? ) throws -> T {
194194 try withExtendedLifetime ( PushCodingPath ( decoder: self , key: key) ) {
195195 let length = try type. length ( decoder: self )
196- let data = try input. read ( length: length)
196+ let data = try input. read ( length: length, codingPath : codingPath )
197197 return try type. init ( decoder: self , data: data)
198198 }
199199 }
200200
201201 fileprivate func decodeOptional< T: Decodable > ( _ type: T . Type , key: CodingKey ? ) throws -> T ? {
202- let byte = try input. read ( )
202+ let byte = try input. read ( codingPath )
203203 switch byte {
204204 case 0 :
205205 return nil
@@ -251,12 +251,12 @@ private struct JamKeyedDecodingContainer<K: CodingKey>: KeyedDecodingContainerPr
251251 }
252252
253253 func decodeNil( forKey _: K ) throws -> Bool {
254- let byte = try decoder. input. read ( )
254+ let byte = try decoder. input. read ( codingPath )
255255 return byte == 0
256256 }
257257
258258 func decode( _: Bool . Type , forKey _: K ) throws -> Bool {
259- let byte = try decoder. input. read ( )
259+ let byte = try decoder. input. read ( codingPath )
260260 return byte == 1
261261 }
262262
@@ -283,8 +283,8 @@ private struct JamKeyedDecodingContainer<K: CodingKey>: KeyedDecodingContainerPr
283283 return value
284284 }
285285
286- func decode( _: Int8 . Type , forKey _ : K ) throws -> Int8 {
287- let byte = try decoder. input. read ( )
286+ func decode( _: Int8 . Type ) throws -> Int8 {
287+ let byte = try decoder. input. read ( codingPath )
288288 return Int8 ( bitPattern: byte)
289289 }
290290
@@ -305,7 +305,7 @@ private struct JamKeyedDecodingContainer<K: CodingKey>: KeyedDecodingContainerPr
305305 }
306306
307307 func decode( _: UInt8 . Type , forKey _: K ) throws -> UInt8 {
308- let byte = try decoder. input. read ( )
308+ let byte = try decoder. input. read ( codingPath )
309309 return byte
310310 }
311311
@@ -326,7 +326,7 @@ private struct JamKeyedDecodingContainer<K: CodingKey>: KeyedDecodingContainerPr
326326 }
327327
328328 func decodeIfPresent< T: Decodable > ( _ type: T . Type , forKey key: K ) throws -> T ? {
329- let byte = try decoder. input. read ( )
329+ let byte = try decoder. input. read ( codingPath )
330330 switch byte {
331331 case 0 :
332332 return nil
@@ -373,13 +373,13 @@ private struct JamUnkeyedDecodingContainer: UnkeyedDecodingContainer {
373373 let decoder : DecodeContext
374374
375375 mutating func decodeNil( ) throws -> Bool {
376- let byte = try decoder. input. read ( )
376+ let byte = try decoder. input. read ( codingPath )
377377 currentIndex += 1
378378 return byte == 0
379379 }
380380
381381 mutating func decode( _: Bool . Type ) throws -> Bool {
382- let byte = try decoder. input. read ( )
382+ let byte = try decoder. input. read ( codingPath )
383383 currentIndex += 1
384384 return byte == 1
385385 }
@@ -410,7 +410,7 @@ private struct JamUnkeyedDecodingContainer: UnkeyedDecodingContainer {
410410 }
411411
412412 mutating func decode( _: Int8 . Type ) throws -> Int8 {
413- let byte = try decoder. input. read ( )
413+ let byte = try decoder. input. read ( codingPath )
414414 currentIndex += 1
415415 return Int8 ( bitPattern: byte)
416416 }
@@ -437,7 +437,7 @@ private struct JamUnkeyedDecodingContainer: UnkeyedDecodingContainer {
437437 }
438438
439439 mutating func decode( _: UInt8 . Type ) throws -> UInt8 {
440- let byte = try decoder. input. read ( )
440+ let byte = try decoder. input. read ( codingPath )
441441 currentIndex += 1
442442 return byte
443443 }
@@ -483,12 +483,12 @@ private struct JamSingleValueDecodingContainer: SingleValueDecodingContainer {
483483 let decoder : DecodeContext
484484
485485 func decodeNil( ) -> Bool {
486- let byte = try ? decoder. input. read ( )
486+ let byte = try ? decoder. input. read ( codingPath )
487487 return byte == 0
488488 }
489489
490490 func decode( _: Bool . Type ) throws -> Bool {
491- let byte = try decoder. input. read ( )
491+ let byte = try decoder. input. read ( codingPath )
492492 return byte == 1
493493 }
494494
@@ -516,7 +516,7 @@ private struct JamSingleValueDecodingContainer: SingleValueDecodingContainer {
516516 }
517517
518518 func decode( _: Int8 . Type ) throws -> Int8 {
519- let byte = try decoder. input. read ( )
519+ let byte = try decoder. input. read ( codingPath )
520520 return Int8 ( bitPattern: byte)
521521 }
522522
@@ -537,7 +537,7 @@ private struct JamSingleValueDecodingContainer: SingleValueDecodingContainer {
537537 }
538538
539539 func decode( _: UInt8 . Type ) throws -> UInt8 {
540- let byte = try decoder. input. read ( )
540+ let byte = try decoder. input. read ( codingPath )
541541 return byte
542542 }
543543
0 commit comments