@@ -146,7 +146,7 @@ class BasicJsonDecoder : public AllocatorHolder<ALLOC>
146
146
DecoderResult decodeString (StringView input);
147
147
static bool decodeUnicodeEscape (
148
148
StringView input, StringView::const_iterator& inputIt, string<ALLOC>& value);
149
- static char decodeHex (char character);
149
+ static int32_t decodeHex (char character);
150
150
size_t checkNumber (StringView input, bool & isDouble, bool & isSigned);
151
151
DecoderResult decodeNumber (StringView input);
152
152
DecoderResult decodeSigned (StringView input);
@@ -277,8 +277,9 @@ bool BasicJsonDecoder<ALLOC>::decodeUnicodeEscape(
277
277
{
278
278
return false ;
279
279
}
280
- const char char1 = decodeHex (*inputIt++);
281
- if (char1 == -1 )
280
+
281
+ const int32_t hex1 = decodeHex (*inputIt++);
282
+ if (hex1 < 0 )
282
283
{
283
284
return false ;
284
285
}
@@ -287,30 +288,31 @@ bool BasicJsonDecoder<ALLOC>::decodeUnicodeEscape(
287
288
{
288
289
return false ;
289
290
}
290
- const char char2 = decodeHex (*inputIt++);
291
- if (char2 == -1 )
291
+
292
+ const int32_t hex2 = decodeHex (*inputIt++);
293
+ if (hex2 < 0 )
292
294
{
293
295
return false ;
294
296
}
295
297
296
- value.push_back (static_cast <char >((static_cast <uint32_t >(char1 ) << 4U ) | static_cast <uint32_t >(char2 )));
298
+ value.push_back (static_cast <char >((static_cast <uint32_t >(hex1 ) << 4U ) | static_cast <uint32_t >(hex2 )));
297
299
return true ;
298
300
}
299
301
300
302
template <typename ALLOC>
301
- char BasicJsonDecoder<ALLOC>::decodeHex(char character)
303
+ int32_t BasicJsonDecoder<ALLOC>::decodeHex(char character)
302
304
{
303
305
if (character >= ' 0' && character <= ' 9' )
304
306
{
305
- return static_cast <char >(character - ' 0' );
307
+ return static_cast <int32_t >(character - ' 0' );
306
308
}
307
309
else if (character >= ' a' && character <= ' f' )
308
310
{
309
- return static_cast <char >(character - ' a' + 10 );
311
+ return static_cast <int32_t >(character - ' a' + 10 );
310
312
}
311
313
else if (character >= ' A' && character <= ' F' )
312
314
{
313
- return static_cast <char >(character - ' A' + 10 );
315
+ return static_cast <int32_t >(character - ' A' + 10 );
314
316
}
315
317
316
318
return -1 ;
0 commit comments