@@ -122,7 +122,7 @@ internal extension TLVDecoder {
122122
123123 func container < Key: CodingKey > ( keyedBy type: Key . Type ) throws -> KeyedDecodingContainer < Key > {
124124
125- log ? ( " Requested container keyed by \( String ( reflecting : type) ) for path \" \( codingPath. path) \" " )
125+ log ? ( " Requested container keyed by \( type. sanitizedName ) for path \" \( codingPath. path) \" " )
126126
127127 let container = self . stack. top
128128
@@ -530,8 +530,7 @@ internal struct TLVSingleValueDecodingContainer: SingleValueDecodingContainer {
530530
531531 func decode( _ type: Int . Type ) throws -> Int {
532532
533- let value = try self . decoder. unbox ( container. value, as: Int32 . self)
534-
533+ let value = try self . decoder. unboxNumeric ( container. value, as: Int32 . self)
535534 return Int ( value)
536535 }
537536
@@ -542,23 +541,22 @@ internal struct TLVSingleValueDecodingContainer: SingleValueDecodingContainer {
542541
543542 func decode( _ type: Int16 . Type ) throws -> Int16 {
544543
545- return try self . decoder. unbox ( container. value, as: type)
544+ return try self . decoder. unboxNumeric ( container. value, as: type)
546545 }
547546
548547 func decode( _ type: Int32 . Type ) throws -> Int32 {
549548
550- return try self . decoder. unbox ( container. value, as: type)
549+ return try self . decoder. unboxNumeric ( container. value, as: type)
551550 }
552551
553552 func decode( _ type: Int64 . Type ) throws -> Int64 {
554553
555- return try self . decoder. unbox ( container. value, as: type)
554+ return try self . decoder. unboxNumeric ( container. value, as: type)
556555 }
557556
558557 func decode( _ type: UInt . Type ) throws -> UInt {
559558
560- let value = try self . decoder. unbox ( container. value, as: UInt32 . self)
561-
559+ let value = try self . decoder. unboxNumeric ( container. value, as: UInt32 . self)
562560 return UInt ( value)
563561 }
564562
@@ -569,27 +567,29 @@ internal struct TLVSingleValueDecodingContainer: SingleValueDecodingContainer {
569567
570568 func decode( _ type: UInt16 . Type ) throws -> UInt16 {
571569
572- return try self . decoder. unbox ( container. value, as: type)
570+ return try self . decoder. unboxNumeric ( container. value, as: type)
573571 }
574572
575573 func decode( _ type: UInt32 . Type ) throws -> UInt32 {
576574
577- return try self . decoder. unbox ( container. value, as: type)
575+ return try self . decoder. unboxNumeric ( container. value, as: type)
578576 }
579577
580578 func decode( _ type: UInt64 . Type ) throws -> UInt64 {
581579
582- return try self . decoder. unbox ( container. value, as: type)
580+ return try self . decoder. unboxNumeric ( container. value, as: type)
583581 }
584582
585583 func decode( _ type: Float . Type ) throws -> Float {
586584
587- fatalError ( )
585+ let value = try self . decoder. unboxNumeric ( container. value, as: UInt32 . self)
586+ return Float ( bitPattern: value)
588587 }
589588
590589 func decode( _ type: Double . Type ) throws -> Double {
591590
592- fatalError ( )
591+ let value = try self . decoder. unboxNumeric ( container. value, as: UInt64 . self)
592+ return Double ( bitPattern: value)
593593 }
594594
595595 func decode( _ type: String . Type ) throws -> String {
@@ -636,7 +636,7 @@ internal struct TLVUnkeyedDecodingContainer: UnkeyedDecodingContainer {
636636 return _count
637637 }
638638
639- var _count : Int {
639+ private var _count : Int {
640640 return container. count
641641 }
642642
0 commit comments