mirror of
https://github.com/nlohmann/json.git
synced 2026-07-03 09:14:18 +00:00
Add C++17 copies of the test binaries (#3101)
* ⚗️ add C++17 copies of the test binaries * ⚗️ use proper header for filesystem * 🚨 fix warnings * ⚗️ do not use too old compilers with C++17 * ✅ add test * 🔨 add more constraints #3097 * ⚗️ use fix from https://github.com/nlohmann/json/pull/3101#issuecomment-998788786 * ⚗️ use fix from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90050 * 👷 use published CI image
This commit is contained in:
@@ -161,7 +161,7 @@ class binary_reader
|
||||
std::int32_t document_size{};
|
||||
get_number<std::int32_t, true>(input_format_t::bson, document_size);
|
||||
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_object(std::size_t(-1))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_object(static_cast<std::size_t>(-1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ class binary_reader
|
||||
default: // anything else not supported (yet)
|
||||
{
|
||||
std::array<char, 3> cr{{}};
|
||||
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
static_cast<void>((std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(element_type))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
return sax->parse_error(element_type_parse_position, std::string(cr.data()), parse_error::create(114, element_type_parse_position, "Unsupported BSON record type 0x" + std::string(cr.data()), BasicJsonType()));
|
||||
}
|
||||
}
|
||||
@@ -379,7 +379,7 @@ class binary_reader
|
||||
std::int32_t document_size{};
|
||||
get_number<std::int32_t, true>(input_format_t::bson, document_size);
|
||||
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_array(std::size_t(-1))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_array(static_cast<std::size_t>(-1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -638,7 +638,7 @@ class binary_reader
|
||||
}
|
||||
|
||||
case 0x9F: // array (indefinite length)
|
||||
return get_cbor_array(std::size_t(-1), tag_handler);
|
||||
return get_cbor_array(static_cast<std::size_t>(-1), tag_handler);
|
||||
|
||||
// map (0x00..0x17 pairs of data items follow)
|
||||
case 0xA0:
|
||||
@@ -692,7 +692,7 @@ class binary_reader
|
||||
}
|
||||
|
||||
case 0xBF: // map (indefinite length)
|
||||
return get_cbor_object(std::size_t(-1), tag_handler);
|
||||
return get_cbor_object(static_cast<std::size_t>(-1), tag_handler);
|
||||
|
||||
case 0xC6: // tagged item
|
||||
case 0xC7:
|
||||
@@ -1076,7 +1076,7 @@ class binary_reader
|
||||
}
|
||||
|
||||
/*!
|
||||
@param[in] len the length of the array or std::size_t(-1) for an
|
||||
@param[in] len the length of the array or static_cast<std::size_t>(-1) for an
|
||||
array of indefinite size
|
||||
@param[in] tag_handler how CBOR tags should be treated
|
||||
@return whether array creation completed
|
||||
@@ -1089,7 +1089,7 @@ class binary_reader
|
||||
return false;
|
||||
}
|
||||
|
||||
if (len != std::size_t(-1))
|
||||
if (len != static_cast<std::size_t>(-1))
|
||||
{
|
||||
for (std::size_t i = 0; i < len; ++i)
|
||||
{
|
||||
@@ -1114,7 +1114,7 @@ class binary_reader
|
||||
}
|
||||
|
||||
/*!
|
||||
@param[in] len the length of the object or std::size_t(-1) for an
|
||||
@param[in] len the length of the object or static_cast<std::size_t>(-1) for an
|
||||
object of indefinite size
|
||||
@param[in] tag_handler how CBOR tags should be treated
|
||||
@return whether object creation completed
|
||||
@@ -1130,7 +1130,7 @@ class binary_reader
|
||||
if (len != 0)
|
||||
{
|
||||
string_t key;
|
||||
if (len != std::size_t(-1))
|
||||
if (len != static_cast<std::size_t>(-1))
|
||||
{
|
||||
for (std::size_t i = 0; i < len; ++i)
|
||||
{
|
||||
@@ -2140,7 +2140,7 @@ class binary_reader
|
||||
}
|
||||
else
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_array(std::size_t(-1))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_array(static_cast<std::size_t>(-1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -2210,7 +2210,7 @@ class binary_reader
|
||||
}
|
||||
else
|
||||
{
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_object(std::size_t(-1))))
|
||||
if (JSON_HEDLEY_UNLIKELY(!sax->start_object(static_cast<std::size_t>(-1))))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -2462,7 +2462,7 @@ class binary_reader
|
||||
std::string get_token_string() const
|
||||
{
|
||||
std::array<char, 3> cr{{}};
|
||||
(std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
static_cast<void>((std::snprintf)(cr.data(), cr.size(), "%.2hhX", static_cast<unsigned char>(current))); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
return std::string{cr.data()};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user