🐛 fix for CBOR (small integers)

This commit is contained in:
Niels Lohmann 2016-12-07 21:24:42 +01:00
parent de289ea336
commit aab9bbbb93
2 changed files with 4 additions and 4 deletions

View file

@ -6514,7 +6514,7 @@ class basic_json
// CBOR does not differentiate between positive signed // CBOR does not differentiate between positive signed
// integers and unsigned integers. Therefore, we used the // integers and unsigned integers. Therefore, we used the
// code from the value_t::number_unsigned case here. // code from the value_t::number_unsigned case here.
if (j.m_value.number_integer < 0x17) if (j.m_value.number_integer <= 0x17)
{ {
add_to_vector(v, 1, j.m_value.number_integer); add_to_vector(v, 1, j.m_value.number_integer);
} }
@ -6582,7 +6582,7 @@ class basic_json
case value_t::number_unsigned: case value_t::number_unsigned:
{ {
if (j.m_value.number_unsigned < 0x17) if (j.m_value.number_unsigned <= 0x17)
{ {
v.push_back(static_cast<uint8_t>(j.m_value.number_unsigned)); v.push_back(static_cast<uint8_t>(j.m_value.number_unsigned));
} }

View file

@ -6514,7 +6514,7 @@ class basic_json
// CBOR does not differentiate between positive signed // CBOR does not differentiate between positive signed
// integers and unsigned integers. Therefore, we used the // integers and unsigned integers. Therefore, we used the
// code from the value_t::number_unsigned case here. // code from the value_t::number_unsigned case here.
if (j.m_value.number_integer < 0x17) if (j.m_value.number_integer <= 0x17)
{ {
add_to_vector(v, 1, j.m_value.number_integer); add_to_vector(v, 1, j.m_value.number_integer);
} }
@ -6582,7 +6582,7 @@ class basic_json
case value_t::number_unsigned: case value_t::number_unsigned:
{ {
if (j.m_value.number_unsigned < 0x17) if (j.m_value.number_unsigned <= 0x17)
{ {
v.push_back(static_cast<uint8_t>(j.m_value.number_unsigned)); v.push_back(static_cast<uint8_t>(j.m_value.number_unsigned));
} }