Skip to content

Commit

Permalink
🐛 fix for CBOR (small integers)
Browse files Browse the repository at this point in the history
  • Loading branch information
nlohmann committed Dec 7, 2016
1 parent de289ea commit aab9bbb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6514,7 +6514,7 @@ class basic_json
// CBOR does not differentiate between positive signed
// integers and unsigned integers. Therefore, we used the
// 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);
}
Expand Down Expand Up @@ -6582,7 +6582,7 @@ class basic_json

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));
}
Expand Down
4 changes: 2 additions & 2 deletions src/json.hpp.re2c
Original file line number Diff line number Diff line change
Expand Up @@ -6514,7 +6514,7 @@ class basic_json
// CBOR does not differentiate between positive signed
// integers and unsigned integers. Therefore, we used the
// 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);
}
Expand Down Expand Up @@ -6582,7 +6582,7 @@ class basic_json

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));
}
Expand Down

0 comments on commit aab9bbb

Please sign in to comment.