🚨 fixed warnings
This commit is contained in:
parent
8d6c033f80
commit
b02ee16721
5 changed files with 100 additions and 100 deletions
|
@ -522,7 +522,7 @@ class binary_reader
|
||||||
case 0x95:
|
case 0x95:
|
||||||
case 0x96:
|
case 0x96:
|
||||||
case 0x97:
|
case 0x97:
|
||||||
return get_cbor_array(static_cast<std::size_t>(current & 0x1F));
|
return get_cbor_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
|
||||||
|
|
||||||
case 0x98: // array (one-byte uint8_t for n follows)
|
case 0x98: // array (one-byte uint8_t for n follows)
|
||||||
{
|
{
|
||||||
|
@ -576,7 +576,7 @@ class binary_reader
|
||||||
case 0xB5:
|
case 0xB5:
|
||||||
case 0xB6:
|
case 0xB6:
|
||||||
case 0xB7:
|
case 0xB7:
|
||||||
return get_cbor_object(static_cast<std::size_t>(current & 0x1F));
|
return get_cbor_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
|
||||||
|
|
||||||
case 0xB8: // map (one-byte uint8_t for n follows)
|
case 0xB8: // map (one-byte uint8_t for n follows)
|
||||||
{
|
{
|
||||||
|
@ -638,11 +638,11 @@ class binary_reader
|
||||||
// without such support. An example of a small decoder for
|
// without such support. An example of a small decoder for
|
||||||
// half-precision floating-point numbers in the C language
|
// half-precision floating-point numbers in the C language
|
||||||
// is shown in Fig. 3.
|
// is shown in Fig. 3.
|
||||||
const int half = (byte1 << 8) + byte2;
|
const unsigned int half = (byte1 << 8u) + byte2;
|
||||||
const double val = [&half]
|
const double val = [&half]
|
||||||
{
|
{
|
||||||
const int exp = (half >> 10) & 0x1F;
|
const unsigned int exp = (half >> 10u) & 0x1Fu;
|
||||||
const int mant = half & 0x3FF;
|
const unsigned int mant = half & 0x3FFu;
|
||||||
assert(0 <= exp and exp <= 32);
|
assert(0 <= exp and exp <= 32);
|
||||||
assert(0 <= mant and mant <= 1024);
|
assert(0 <= mant and mant <= 1024);
|
||||||
switch (exp)
|
switch (exp)
|
||||||
|
@ -657,7 +657,7 @@ class binary_reader
|
||||||
return std::ldexp(mant + 1024, exp - 25);
|
return std::ldexp(mant + 1024, exp - 25);
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
return sax->number_float((half & 0x8000) != 0
|
return sax->number_float((half & 0x8000u) != 0
|
||||||
? static_cast<number_float_t>(-val)
|
? static_cast<number_float_t>(-val)
|
||||||
: static_cast<number_float_t>(val), "");
|
: static_cast<number_float_t>(val), "");
|
||||||
}
|
}
|
||||||
|
@ -728,7 +728,7 @@ class binary_reader
|
||||||
case 0x76:
|
case 0x76:
|
||||||
case 0x77:
|
case 0x77:
|
||||||
{
|
{
|
||||||
return get_string(input_format_t::cbor, current & 0x1F, result);
|
return get_string(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
|
case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
|
||||||
|
@ -1026,7 +1026,7 @@ class binary_reader
|
||||||
case 0x8D:
|
case 0x8D:
|
||||||
case 0x8E:
|
case 0x8E:
|
||||||
case 0x8F:
|
case 0x8F:
|
||||||
return get_msgpack_object(static_cast<std::size_t>(current & 0x0F));
|
return get_msgpack_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
|
||||||
|
|
||||||
// fixarray
|
// fixarray
|
||||||
case 0x90:
|
case 0x90:
|
||||||
|
@ -1045,7 +1045,7 @@ class binary_reader
|
||||||
case 0x9D:
|
case 0x9D:
|
||||||
case 0x9E:
|
case 0x9E:
|
||||||
case 0x9F:
|
case 0x9F:
|
||||||
return get_msgpack_array(static_cast<std::size_t>(current & 0x0F));
|
return get_msgpack_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
|
||||||
|
|
||||||
// fixstr
|
// fixstr
|
||||||
case 0xA0:
|
case 0xA0:
|
||||||
|
@ -1282,7 +1282,7 @@ class binary_reader
|
||||||
case 0xBE:
|
case 0xBE:
|
||||||
case 0xBF:
|
case 0xBF:
|
||||||
{
|
{
|
||||||
return get_string(input_format_t::msgpack, current & 0x1F, result);
|
return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0xD9: // str 8
|
case 0xD9: // str 8
|
||||||
|
|
|
@ -165,7 +165,7 @@ struct wide_string_input_helper
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get the current character
|
// get the current character
|
||||||
const auto wc = static_cast<int>(str[current_wchar++]);
|
const auto wc = static_cast<unsigned int>(str[current_wchar++]);
|
||||||
|
|
||||||
// UTF-32 to UTF-8 encoding
|
// UTF-32 to UTF-8 encoding
|
||||||
if (wc < 0x80)
|
if (wc < 0x80)
|
||||||
|
@ -175,23 +175,23 @@ struct wide_string_input_helper
|
||||||
}
|
}
|
||||||
else if (wc <= 0x7FF)
|
else if (wc <= 0x7FF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xC0 | ((wc >> 6) & 0x1F);
|
utf8_bytes[0] = 0xC0u | ((wc >> 6u) & 0x1Fu);
|
||||||
utf8_bytes[1] = 0x80 | (wc & 0x3F);
|
utf8_bytes[1] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 2;
|
utf8_bytes_filled = 2;
|
||||||
}
|
}
|
||||||
else if (wc <= 0xFFFF)
|
else if (wc <= 0xFFFF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xE0 | ((wc >> 12) & 0x0F);
|
utf8_bytes[0] = 0xE0u | ((wc >> 12u) & 0x0Fu);
|
||||||
utf8_bytes[1] = 0x80 | ((wc >> 6) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((wc >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | (wc & 0x3F);
|
utf8_bytes[2] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 3;
|
utf8_bytes_filled = 3;
|
||||||
}
|
}
|
||||||
else if (wc <= 0x10FFFF)
|
else if (wc <= 0x10FFFF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xF0 | ((wc >> 18) & 0x07);
|
utf8_bytes[0] = 0xF0u | ((wc >> 18u) & 0x07u);
|
||||||
utf8_bytes[1] = 0x80 | ((wc >> 12) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((wc >> 12u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | ((wc >> 6) & 0x3F);
|
utf8_bytes[2] = 0x80u | ((wc >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[3] = 0x80 | (wc & 0x3F);
|
utf8_bytes[3] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 4;
|
utf8_bytes_filled = 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -220,7 +220,7 @@ struct wide_string_input_helper<WideStringType, 2>
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get the current character
|
// get the current character
|
||||||
const auto wc = static_cast<int>(str[current_wchar++]);
|
const auto wc = static_cast<unsigned int>(str[current_wchar++]);
|
||||||
|
|
||||||
// UTF-16 to UTF-8 encoding
|
// UTF-16 to UTF-8 encoding
|
||||||
if (wc < 0x80)
|
if (wc < 0x80)
|
||||||
|
@ -230,27 +230,27 @@ struct wide_string_input_helper<WideStringType, 2>
|
||||||
}
|
}
|
||||||
else if (wc <= 0x7FF)
|
else if (wc <= 0x7FF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xC0 | ((wc >> 6));
|
utf8_bytes[0] = 0xC0u | ((wc >> 6u));
|
||||||
utf8_bytes[1] = 0x80 | (wc & 0x3F);
|
utf8_bytes[1] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 2;
|
utf8_bytes_filled = 2;
|
||||||
}
|
}
|
||||||
else if (0xD800 > wc or wc >= 0xE000)
|
else if (0xD800 > wc or wc >= 0xE000)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xE0 | ((wc >> 12));
|
utf8_bytes[0] = 0xE0u | ((wc >> 12u));
|
||||||
utf8_bytes[1] = 0x80 | ((wc >> 6) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((wc >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | (wc & 0x3F);
|
utf8_bytes[2] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 3;
|
utf8_bytes_filled = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (current_wchar < str.size())
|
if (current_wchar < str.size())
|
||||||
{
|
{
|
||||||
const auto wc2 = static_cast<int>(str[current_wchar++]);
|
const auto wc2 = static_cast<unsigned int>(str[current_wchar++]);
|
||||||
const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF));
|
const auto charcode = 0x10000u + (((wc & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
|
||||||
utf8_bytes[0] = 0xf0 | (charcode >> 18);
|
utf8_bytes[0] = 0xF0u | (charcode >> 18u);
|
||||||
utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((charcode >> 12u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | ((charcode >> 6) & 0x3F);
|
utf8_bytes[2] = 0x80u | ((charcode >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[3] = 0x80 | (charcode & 0x3F);
|
utf8_bytes[3] = 0x80u | (charcode & 0x3Fu);
|
||||||
utf8_bytes_filled = 4;
|
utf8_bytes_filled = 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -149,22 +149,22 @@ class lexer
|
||||||
assert(current == 'u');
|
assert(current == 'u');
|
||||||
int codepoint = 0;
|
int codepoint = 0;
|
||||||
|
|
||||||
const auto factors = { 12, 8, 4, 0 };
|
const auto factors = { 12u, 8u, 4u, 0u };
|
||||||
for (const auto factor : factors)
|
for (const auto factor : factors)
|
||||||
{
|
{
|
||||||
get();
|
get();
|
||||||
|
|
||||||
if (current >= '0' and current <= '9')
|
if (current >= '0' and current <= '9')
|
||||||
{
|
{
|
||||||
codepoint += ((current - 0x30) << factor);
|
codepoint += ((static_cast<unsigned int>(current) - 0x30u) << factor);
|
||||||
}
|
}
|
||||||
else if (current >= 'A' and current <= 'F')
|
else if (current >= 'A' and current <= 'F')
|
||||||
{
|
{
|
||||||
codepoint += ((current - 0x37) << factor);
|
codepoint += ((static_cast<unsigned int>(current) - 0x37u) << factor);
|
||||||
}
|
}
|
||||||
else if (current >= 'a' and current <= 'f')
|
else if (current >= 'a' and current <= 'f')
|
||||||
{
|
{
|
||||||
codepoint += ((current - 0x57) << factor);
|
codepoint += ((static_cast<unsigned int>(current) - 0x57u) << factor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -324,13 +324,13 @@ class lexer
|
||||||
// overwrite codepoint
|
// overwrite codepoint
|
||||||
codepoint =
|
codepoint =
|
||||||
// high surrogate occupies the most significant 22 bits
|
// high surrogate occupies the most significant 22 bits
|
||||||
(codepoint1 << 10)
|
(static_cast<unsigned int>(codepoint1) << 10u)
|
||||||
// low surrogate occupies the least significant 15 bits
|
// low surrogate occupies the least significant 15 bits
|
||||||
+ codepoint2
|
+ static_cast<unsigned int>(codepoint2)
|
||||||
// there is still the 0xD800, 0xDC00 and 0x10000 noise
|
// there is still the 0xD800, 0xDC00 and 0x10000 noise
|
||||||
// in the result so we have to subtract with:
|
// in the result so we have to subtract with:
|
||||||
// (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
|
// (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
|
||||||
- 0x35FDC00;
|
- 0x35FDC00u;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -365,23 +365,23 @@ class lexer
|
||||||
else if (codepoint <= 0x7FF)
|
else if (codepoint <= 0x7FF)
|
||||||
{
|
{
|
||||||
// 2-byte characters: 110xxxxx 10xxxxxx
|
// 2-byte characters: 110xxxxx 10xxxxxx
|
||||||
add(0xC0 | (codepoint >> 6));
|
add(0xC0u | (static_cast<unsigned int>(codepoint) >> 6u));
|
||||||
add(0x80 | (codepoint & 0x3F));
|
add(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu));
|
||||||
}
|
}
|
||||||
else if (codepoint <= 0xFFFF)
|
else if (codepoint <= 0xFFFF)
|
||||||
{
|
{
|
||||||
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
|
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
|
||||||
add(0xE0 | (codepoint >> 12));
|
add(0xE0u | (static_cast<unsigned int>(codepoint) >> 12u));
|
||||||
add(0x80 | ((codepoint >> 6) & 0x3F));
|
add(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu));
|
||||||
add(0x80 | (codepoint & 0x3F));
|
add(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||||
add(0xF0 | (codepoint >> 18));
|
add(0xF0u | (static_cast<unsigned int>(codepoint) >> 18u));
|
||||||
add(0x80 | ((codepoint >> 12) & 0x3F));
|
add(0x80u | ((static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu));
|
||||||
add(0x80 | ((codepoint >> 6) & 0x3F));
|
add(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu));
|
||||||
add(0x80 | (codepoint & 0x3F));
|
add(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -1298,7 +1298,7 @@ scan_number_done:
|
||||||
|
|
||||||
if (JSON_LIKELY(current != std::char_traits<char>::eof()))
|
if (JSON_LIKELY(current != std::char_traits<char>::eof()))
|
||||||
{
|
{
|
||||||
assert(token_string.size() != 0);
|
assert(not token_string.empty());
|
||||||
token_string.pop_back();
|
token_string.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ class json_ref
|
||||||
is_rvalue(true) {}
|
is_rvalue(true) {}
|
||||||
|
|
||||||
// class should be movable only
|
// class should be movable only
|
||||||
json_ref(json_ref&&) = default;
|
json_ref(json_ref&&) noexcept = default;
|
||||||
json_ref(const json_ref&) = delete;
|
json_ref(const json_ref&) = delete;
|
||||||
json_ref& operator=(const json_ref&) = delete;
|
json_ref& operator=(const json_ref&) = delete;
|
||||||
json_ref& operator=(json_ref&&) = delete;
|
json_ref& operator=(json_ref&&) = delete;
|
||||||
|
|
|
@ -2337,7 +2337,7 @@ struct wide_string_input_helper
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get the current character
|
// get the current character
|
||||||
const auto wc = static_cast<int>(str[current_wchar++]);
|
const auto wc = static_cast<unsigned int>(str[current_wchar++]);
|
||||||
|
|
||||||
// UTF-32 to UTF-8 encoding
|
// UTF-32 to UTF-8 encoding
|
||||||
if (wc < 0x80)
|
if (wc < 0x80)
|
||||||
|
@ -2347,23 +2347,23 @@ struct wide_string_input_helper
|
||||||
}
|
}
|
||||||
else if (wc <= 0x7FF)
|
else if (wc <= 0x7FF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xC0 | ((wc >> 6) & 0x1F);
|
utf8_bytes[0] = 0xC0u | ((wc >> 6u) & 0x1Fu);
|
||||||
utf8_bytes[1] = 0x80 | (wc & 0x3F);
|
utf8_bytes[1] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 2;
|
utf8_bytes_filled = 2;
|
||||||
}
|
}
|
||||||
else if (wc <= 0xFFFF)
|
else if (wc <= 0xFFFF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xE0 | ((wc >> 12) & 0x0F);
|
utf8_bytes[0] = 0xE0u | ((wc >> 12u) & 0x0Fu);
|
||||||
utf8_bytes[1] = 0x80 | ((wc >> 6) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((wc >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | (wc & 0x3F);
|
utf8_bytes[2] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 3;
|
utf8_bytes_filled = 3;
|
||||||
}
|
}
|
||||||
else if (wc <= 0x10FFFF)
|
else if (wc <= 0x10FFFF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xF0 | ((wc >> 18) & 0x07);
|
utf8_bytes[0] = 0xF0u | ((wc >> 18u) & 0x07u);
|
||||||
utf8_bytes[1] = 0x80 | ((wc >> 12) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((wc >> 12u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | ((wc >> 6) & 0x3F);
|
utf8_bytes[2] = 0x80u | ((wc >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[3] = 0x80 | (wc & 0x3F);
|
utf8_bytes[3] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 4;
|
utf8_bytes_filled = 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2392,7 +2392,7 @@ struct wide_string_input_helper<WideStringType, 2>
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// get the current character
|
// get the current character
|
||||||
const auto wc = static_cast<int>(str[current_wchar++]);
|
const auto wc = static_cast<unsigned int>(str[current_wchar++]);
|
||||||
|
|
||||||
// UTF-16 to UTF-8 encoding
|
// UTF-16 to UTF-8 encoding
|
||||||
if (wc < 0x80)
|
if (wc < 0x80)
|
||||||
|
@ -2402,27 +2402,27 @@ struct wide_string_input_helper<WideStringType, 2>
|
||||||
}
|
}
|
||||||
else if (wc <= 0x7FF)
|
else if (wc <= 0x7FF)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xC0 | ((wc >> 6));
|
utf8_bytes[0] = 0xC0u | ((wc >> 6u));
|
||||||
utf8_bytes[1] = 0x80 | (wc & 0x3F);
|
utf8_bytes[1] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 2;
|
utf8_bytes_filled = 2;
|
||||||
}
|
}
|
||||||
else if (0xD800 > wc or wc >= 0xE000)
|
else if (0xD800 > wc or wc >= 0xE000)
|
||||||
{
|
{
|
||||||
utf8_bytes[0] = 0xE0 | ((wc >> 12));
|
utf8_bytes[0] = 0xE0u | ((wc >> 12u));
|
||||||
utf8_bytes[1] = 0x80 | ((wc >> 6) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((wc >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | (wc & 0x3F);
|
utf8_bytes[2] = 0x80u | (wc & 0x3Fu);
|
||||||
utf8_bytes_filled = 3;
|
utf8_bytes_filled = 3;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (current_wchar < str.size())
|
if (current_wchar < str.size())
|
||||||
{
|
{
|
||||||
const auto wc2 = static_cast<int>(str[current_wchar++]);
|
const auto wc2 = static_cast<unsigned int>(str[current_wchar++]);
|
||||||
const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF));
|
const auto charcode = 0x10000u + (((wc & 0x3FFu) << 10u) | (wc2 & 0x3FFu));
|
||||||
utf8_bytes[0] = 0xf0 | (charcode >> 18);
|
utf8_bytes[0] = 0xF0u | (charcode >> 18u);
|
||||||
utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F);
|
utf8_bytes[1] = 0x80u | ((charcode >> 12u) & 0x3Fu);
|
||||||
utf8_bytes[2] = 0x80 | ((charcode >> 6) & 0x3F);
|
utf8_bytes[2] = 0x80u | ((charcode >> 6u) & 0x3Fu);
|
||||||
utf8_bytes[3] = 0x80 | (charcode & 0x3F);
|
utf8_bytes[3] = 0x80u | (charcode & 0x3Fu);
|
||||||
utf8_bytes_filled = 4;
|
utf8_bytes_filled = 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2748,22 +2748,22 @@ class lexer
|
||||||
assert(current == 'u');
|
assert(current == 'u');
|
||||||
int codepoint = 0;
|
int codepoint = 0;
|
||||||
|
|
||||||
const auto factors = { 12, 8, 4, 0 };
|
const auto factors = { 12u, 8u, 4u, 0u };
|
||||||
for (const auto factor : factors)
|
for (const auto factor : factors)
|
||||||
{
|
{
|
||||||
get();
|
get();
|
||||||
|
|
||||||
if (current >= '0' and current <= '9')
|
if (current >= '0' and current <= '9')
|
||||||
{
|
{
|
||||||
codepoint += ((current - 0x30) << factor);
|
codepoint += ((static_cast<unsigned int>(current) - 0x30u) << factor);
|
||||||
}
|
}
|
||||||
else if (current >= 'A' and current <= 'F')
|
else if (current >= 'A' and current <= 'F')
|
||||||
{
|
{
|
||||||
codepoint += ((current - 0x37) << factor);
|
codepoint += ((static_cast<unsigned int>(current) - 0x37u) << factor);
|
||||||
}
|
}
|
||||||
else if (current >= 'a' and current <= 'f')
|
else if (current >= 'a' and current <= 'f')
|
||||||
{
|
{
|
||||||
codepoint += ((current - 0x57) << factor);
|
codepoint += ((static_cast<unsigned int>(current) - 0x57u) << factor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2923,13 +2923,13 @@ class lexer
|
||||||
// overwrite codepoint
|
// overwrite codepoint
|
||||||
codepoint =
|
codepoint =
|
||||||
// high surrogate occupies the most significant 22 bits
|
// high surrogate occupies the most significant 22 bits
|
||||||
(codepoint1 << 10)
|
(static_cast<unsigned int>(codepoint1) << 10u)
|
||||||
// low surrogate occupies the least significant 15 bits
|
// low surrogate occupies the least significant 15 bits
|
||||||
+ codepoint2
|
+ static_cast<unsigned int>(codepoint2)
|
||||||
// there is still the 0xD800, 0xDC00 and 0x10000 noise
|
// there is still the 0xD800, 0xDC00 and 0x10000 noise
|
||||||
// in the result so we have to subtract with:
|
// in the result so we have to subtract with:
|
||||||
// (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
|
// (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
|
||||||
- 0x35FDC00;
|
- 0x35FDC00u;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2964,23 +2964,23 @@ class lexer
|
||||||
else if (codepoint <= 0x7FF)
|
else if (codepoint <= 0x7FF)
|
||||||
{
|
{
|
||||||
// 2-byte characters: 110xxxxx 10xxxxxx
|
// 2-byte characters: 110xxxxx 10xxxxxx
|
||||||
add(0xC0 | (codepoint >> 6));
|
add(0xC0u | (static_cast<unsigned int>(codepoint) >> 6u));
|
||||||
add(0x80 | (codepoint & 0x3F));
|
add(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu));
|
||||||
}
|
}
|
||||||
else if (codepoint <= 0xFFFF)
|
else if (codepoint <= 0xFFFF)
|
||||||
{
|
{
|
||||||
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
|
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
|
||||||
add(0xE0 | (codepoint >> 12));
|
add(0xE0u | (static_cast<unsigned int>(codepoint) >> 12u));
|
||||||
add(0x80 | ((codepoint >> 6) & 0x3F));
|
add(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu));
|
||||||
add(0x80 | (codepoint & 0x3F));
|
add(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
|
||||||
add(0xF0 | (codepoint >> 18));
|
add(0xF0u | (static_cast<unsigned int>(codepoint) >> 18u));
|
||||||
add(0x80 | ((codepoint >> 12) & 0x3F));
|
add(0x80u | ((static_cast<unsigned int>(codepoint) >> 12u) & 0x3Fu));
|
||||||
add(0x80 | ((codepoint >> 6) & 0x3F));
|
add(0x80u | ((static_cast<unsigned int>(codepoint) >> 6u) & 0x3Fu));
|
||||||
add(0x80 | (codepoint & 0x3F));
|
add(0x80u | (static_cast<unsigned int>(codepoint) & 0x3Fu));
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -3897,7 +3897,7 @@ scan_number_done:
|
||||||
|
|
||||||
if (JSON_LIKELY(current != std::char_traits<char>::eof()))
|
if (JSON_LIKELY(current != std::char_traits<char>::eof()))
|
||||||
{
|
{
|
||||||
assert(token_string.size() != 0);
|
assert(not token_string.empty());
|
||||||
token_string.pop_back();
|
token_string.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7014,7 +7014,7 @@ class binary_reader
|
||||||
case 0x95:
|
case 0x95:
|
||||||
case 0x96:
|
case 0x96:
|
||||||
case 0x97:
|
case 0x97:
|
||||||
return get_cbor_array(static_cast<std::size_t>(current & 0x1F));
|
return get_cbor_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
|
||||||
|
|
||||||
case 0x98: // array (one-byte uint8_t for n follows)
|
case 0x98: // array (one-byte uint8_t for n follows)
|
||||||
{
|
{
|
||||||
|
@ -7068,7 +7068,7 @@ class binary_reader
|
||||||
case 0xB5:
|
case 0xB5:
|
||||||
case 0xB6:
|
case 0xB6:
|
||||||
case 0xB7:
|
case 0xB7:
|
||||||
return get_cbor_object(static_cast<std::size_t>(current & 0x1F));
|
return get_cbor_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x1Fu));
|
||||||
|
|
||||||
case 0xB8: // map (one-byte uint8_t for n follows)
|
case 0xB8: // map (one-byte uint8_t for n follows)
|
||||||
{
|
{
|
||||||
|
@ -7130,11 +7130,11 @@ class binary_reader
|
||||||
// without such support. An example of a small decoder for
|
// without such support. An example of a small decoder for
|
||||||
// half-precision floating-point numbers in the C language
|
// half-precision floating-point numbers in the C language
|
||||||
// is shown in Fig. 3.
|
// is shown in Fig. 3.
|
||||||
const int half = (byte1 << 8) + byte2;
|
const unsigned int half = (byte1 << 8u) + byte2;
|
||||||
const double val = [&half]
|
const double val = [&half]
|
||||||
{
|
{
|
||||||
const int exp = (half >> 10) & 0x1F;
|
const unsigned int exp = (half >> 10u) & 0x1Fu;
|
||||||
const int mant = half & 0x3FF;
|
const unsigned int mant = half & 0x3FFu;
|
||||||
assert(0 <= exp and exp <= 32);
|
assert(0 <= exp and exp <= 32);
|
||||||
assert(0 <= mant and mant <= 1024);
|
assert(0 <= mant and mant <= 1024);
|
||||||
switch (exp)
|
switch (exp)
|
||||||
|
@ -7149,7 +7149,7 @@ class binary_reader
|
||||||
return std::ldexp(mant + 1024, exp - 25);
|
return std::ldexp(mant + 1024, exp - 25);
|
||||||
}
|
}
|
||||||
}();
|
}();
|
||||||
return sax->number_float((half & 0x8000) != 0
|
return sax->number_float((half & 0x8000u) != 0
|
||||||
? static_cast<number_float_t>(-val)
|
? static_cast<number_float_t>(-val)
|
||||||
: static_cast<number_float_t>(val), "");
|
: static_cast<number_float_t>(val), "");
|
||||||
}
|
}
|
||||||
|
@ -7220,7 +7220,7 @@ class binary_reader
|
||||||
case 0x76:
|
case 0x76:
|
||||||
case 0x77:
|
case 0x77:
|
||||||
{
|
{
|
||||||
return get_string(input_format_t::cbor, current & 0x1F, result);
|
return get_string(input_format_t::cbor, static_cast<unsigned int>(current) & 0x1Fu, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
|
case 0x78: // UTF-8 string (one-byte uint8_t for n follows)
|
||||||
|
@ -7518,7 +7518,7 @@ class binary_reader
|
||||||
case 0x8D:
|
case 0x8D:
|
||||||
case 0x8E:
|
case 0x8E:
|
||||||
case 0x8F:
|
case 0x8F:
|
||||||
return get_msgpack_object(static_cast<std::size_t>(current & 0x0F));
|
return get_msgpack_object(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
|
||||||
|
|
||||||
// fixarray
|
// fixarray
|
||||||
case 0x90:
|
case 0x90:
|
||||||
|
@ -7537,7 +7537,7 @@ class binary_reader
|
||||||
case 0x9D:
|
case 0x9D:
|
||||||
case 0x9E:
|
case 0x9E:
|
||||||
case 0x9F:
|
case 0x9F:
|
||||||
return get_msgpack_array(static_cast<std::size_t>(current & 0x0F));
|
return get_msgpack_array(static_cast<std::size_t>(static_cast<unsigned int>(current) & 0x0Fu));
|
||||||
|
|
||||||
// fixstr
|
// fixstr
|
||||||
case 0xA0:
|
case 0xA0:
|
||||||
|
@ -7774,7 +7774,7 @@ class binary_reader
|
||||||
case 0xBE:
|
case 0xBE:
|
||||||
case 0xBF:
|
case 0xBF:
|
||||||
{
|
{
|
||||||
return get_string(input_format_t::msgpack, current & 0x1F, result);
|
return get_string(input_format_t::msgpack, static_cast<unsigned int>(current) & 0x1Fu, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 0xD9: // str 8
|
case 0xD9: // str 8
|
||||||
|
@ -11794,7 +11794,7 @@ class json_ref
|
||||||
is_rvalue(true) {}
|
is_rvalue(true) {}
|
||||||
|
|
||||||
// class should be movable only
|
// class should be movable only
|
||||||
json_ref(json_ref&&) = default;
|
json_ref(json_ref&&) noexcept = default;
|
||||||
json_ref(const json_ref&) = delete;
|
json_ref(const json_ref&) = delete;
|
||||||
json_ref& operator=(const json_ref&) = delete;
|
json_ref& operator=(const json_ref&) = delete;
|
||||||
json_ref& operator=(json_ref&&) = delete;
|
json_ref& operator=(json_ref&&) = delete;
|
||||||
|
|
Loading…
Reference in a new issue