11//
22// Cornucopia – (C) Dr. Lauer Information Technology
33//
4+ private let logger = Cornucopia . Core. Logger ( )
5+
46public extension Cornucopia . Core {
57
68 private static let Prefix = " 0x "
@@ -101,6 +103,7 @@ public extension Cornucopia.Core {
101103 throw DecodingError . dataCorruptedError ( in: container, debugDescription: " @HexEncodedBytes STRING contains an invalid character " )
102104 }
103105 if string. count % 2 == 1 {
106+ logger. notice ( " HexEncodedBytes STRING \( string) has an odd length, inserting leading zero. This will be hard ERROR in future versions " )
104107 string. insert ( " 0 " , at: string. startIndex)
105108 }
106109 let chars = Array ( string. utf8)
@@ -126,6 +129,7 @@ public extension Cornucopia.Core {
126129 throw DecodingError . dataCorruptedError ( in: container, debugDescription: " @HexEncodedBytes STRING contains an invalid character " )
127130 }
128131 if string. count % 2 == 1 {
132+ logger. notice ( " HexEncodedBytes STRING \( string) has an odd length, inserting leading zero. This will be hard ERROR in future versions " )
129133 string. insert ( " 0 " , at: string. startIndex)
130134 }
131135 let chars = Array ( string. utf8)
@@ -179,6 +183,7 @@ public extension Cornucopia.Core {
179183 throw DecodingError . dataCorruptedError ( in: container, debugDescription: " @HexEncodedBytes STRING contains an invalid character " )
180184 }
181185 if string. count % 2 == 1 {
186+ logger. notice ( " HexEncodedBytes STRING \( string) has an odd length, inserting leading zero. This will be hard ERROR in future versions " )
182187 string. insert ( " 0 " , at: string. startIndex)
183188 }
184189 let uint32 = UInt32 ( string, radix: 16 ) ?? 0
@@ -221,6 +226,7 @@ public extension Cornucopia.Core {
221226 throw DecodingError . dataCorruptedError ( in: container, debugDescription: " @HexEncodedBytes STRING contains an invalid character " )
222227 }
223228 if string. count % 2 == 1 {
229+ logger. notice ( " HexEncodedBytes STRING \( string) has an odd length, inserting leading zero. This will be hard ERROR in future versions " )
224230 string. insert ( " 0 " , at: string. startIndex)
225231 }
226232 let value = T ( string, radix: 16 ) ?? 0
@@ -264,6 +270,7 @@ public extension Cornucopia.Core {
264270 throw DecodingError . dataCorruptedError ( in: container, debugDescription: " @HexEncodedBytes STRING contains an invalid character " )
265271 }
266272 if string. count % 2 == 1 {
273+ logger. notice ( " HexEncodedBytes STRING \( string) has an odd length, inserting leading zero. This will be hard ERROR in future versions " )
267274 string. insert ( " 0 " , at: string. startIndex)
268275 }
269276 let value = T ( string, radix: 16 ) ?? 0
0 commit comments