🚨 fix warnings
This commit is contained in:
parent
baaa706262
commit
52aa607c87
@ -138,8 +138,11 @@ class iter_impl
|
||||
*/
|
||||
iter_impl& operator=(const iter_impl<const BasicJsonType>& other) noexcept
|
||||
{
|
||||
m_object = other.m_object;
|
||||
m_it = other.m_it;
|
||||
if (&other != this)
|
||||
{
|
||||
m_object = other.m_object;
|
||||
m_it = other.m_it;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@ -8557,12 +8557,12 @@ class basic_json
|
||||
for (auto it = source.cbegin(); it != source.cend(); ++it)
|
||||
{
|
||||
// escape the key name to be used in a JSON patch
|
||||
const auto key = json_pointer::escape(it.key());
|
||||
const auto path_key = path + "/" + json_pointer::escape(it.key());
|
||||
|
||||
if (target.find(it.key()) != target.end())
|
||||
{
|
||||
// recursive call to compare object values at key it
|
||||
auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key);
|
||||
auto temp_diff = diff(it.value(), target[it.key()], path_key);
|
||||
result.insert(result.end(), temp_diff.begin(), temp_diff.end());
|
||||
}
|
||||
else
|
||||
@ -8570,7 +8570,7 @@ class basic_json
|
||||
// found a key that is not in o -> remove it
|
||||
result.push_back(object(
|
||||
{
|
||||
{"op", "remove"}, {"path", path + "/" + key}
|
||||
{"op", "remove"}, {"path", path_key}
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -8581,10 +8581,10 @@ class basic_json
|
||||
if (source.find(it.key()) == source.end())
|
||||
{
|
||||
// found a key that is not in this -> add it
|
||||
const auto key = json_pointer::escape(it.key());
|
||||
const auto path_key = path + "/" + json_pointer::escape(it.key());
|
||||
result.push_back(
|
||||
{
|
||||
{"op", "add"}, {"path", path + "/" + key},
|
||||
{"op", "add"}, {"path", path_key},
|
||||
{"value", it.value()}
|
||||
});
|
||||
}
|
||||
|
||||
@ -11021,8 +11021,11 @@ class iter_impl
|
||||
*/
|
||||
iter_impl& operator=(const iter_impl<const BasicJsonType>& other) noexcept
|
||||
{
|
||||
m_object = other.m_object;
|
||||
m_it = other.m_it;
|
||||
if (&other != this)
|
||||
{
|
||||
m_object = other.m_object;
|
||||
m_it = other.m_it;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -12714,11 +12717,12 @@ class json_ref
|
||||
|
||||
#include <algorithm> // reverse
|
||||
#include <array> // array
|
||||
#include <cmath> // isnan, isinf
|
||||
#include <cstdint> // uint8_t, uint16_t, uint32_t, uint64_t
|
||||
#include <cstring> // memcpy
|
||||
#include <limits> // numeric_limits
|
||||
#include <string> // string
|
||||
#include <cmath> // isnan, isinf
|
||||
#include <utility> // move
|
||||
|
||||
// #include <nlohmann/detail/input/binary_reader.hpp>
|
||||
|
||||
@ -25183,12 +25187,12 @@ class basic_json
|
||||
for (auto it = source.cbegin(); it != source.cend(); ++it)
|
||||
{
|
||||
// escape the key name to be used in a JSON patch
|
||||
const auto key = json_pointer::escape(it.key());
|
||||
const auto path_key = path + "/" + json_pointer::escape(it.key());
|
||||
|
||||
if (target.find(it.key()) != target.end())
|
||||
{
|
||||
// recursive call to compare object values at key it
|
||||
auto temp_diff = diff(it.value(), target[it.key()], path + "/" + key);
|
||||
auto temp_diff = diff(it.value(), target[it.key()], path_key);
|
||||
result.insert(result.end(), temp_diff.begin(), temp_diff.end());
|
||||
}
|
||||
else
|
||||
@ -25196,7 +25200,7 @@ class basic_json
|
||||
// found a key that is not in o -> remove it
|
||||
result.push_back(object(
|
||||
{
|
||||
{"op", "remove"}, {"path", path + "/" + key}
|
||||
{"op", "remove"}, {"path", path_key}
|
||||
}));
|
||||
}
|
||||
}
|
||||
@ -25207,10 +25211,10 @@ class basic_json
|
||||
if (source.find(it.key()) == source.end())
|
||||
{
|
||||
// found a key that is not in this -> add it
|
||||
const auto key = json_pointer::escape(it.key());
|
||||
const auto path_key = path + "/" + json_pointer::escape(it.key());
|
||||
result.push_back(
|
||||
{
|
||||
{"op", "add"}, {"path", path + "/" + key},
|
||||
{"op", "add"}, {"path", path_key},
|
||||
{"value", it.value()}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1647,23 +1647,21 @@ TEST_CASE("MessagePack roundtrips" * doctest::skip())
|
||||
SECTION("input from msgpack-python")
|
||||
{
|
||||
// most of these are excluded due to differences in key order (not a real problem)
|
||||
auto exclude_packed = std::set<std::string>
|
||||
{
|
||||
TEST_DATA_DIRECTORY "/json.org/1.json",
|
||||
TEST_DATA_DIRECTORY "/json.org/2.json",
|
||||
TEST_DATA_DIRECTORY "/json.org/3.json",
|
||||
TEST_DATA_DIRECTORY "/json.org/4.json",
|
||||
TEST_DATA_DIRECTORY "/json.org/5.json",
|
||||
TEST_DATA_DIRECTORY "/json_testsuite/sample.json", // kills AppVeyor
|
||||
TEST_DATA_DIRECTORY "/json_tests/pass1.json",
|
||||
TEST_DATA_DIRECTORY "/regression/working_file.json",
|
||||
TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object.json",
|
||||
TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_basic.json",
|
||||
TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key.json",
|
||||
TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_long_strings.json",
|
||||
TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_simple.json",
|
||||
TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_string_unicode.json",
|
||||
};
|
||||
std::set<std::string> exclude_packed;
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/1.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/2.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/3.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/4.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json.org/5.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json_testsuite/sample.json"); // kills AppVeyor
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/json_tests/pass1.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/regression/working_file.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_basic.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_duplicated_key.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_long_strings.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_simple.json");
|
||||
exclude_packed.insert(TEST_DATA_DIRECTORY "/nst_json_testsuite/test_parsing/y_object_string_unicode.json");
|
||||
|
||||
for (std::string filename :
|
||||
{
|
||||
|
||||
@ -73,7 +73,7 @@ inline bool operator== (NonDefaultFromJsonStruct const& /*unused*/, NonDefaultFr
|
||||
|
||||
enum class for_1647 { one, two };
|
||||
|
||||
// NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays): this is a false positive
|
||||
// NOLINTNEXTLINE(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays): this is a false positive
|
||||
NLOHMANN_JSON_SERIALIZE_ENUM(for_1647,
|
||||
{
|
||||
{for_1647::one, "one"},
|
||||
|
||||
@ -360,7 +360,7 @@ TEST_CASE("formatting")
|
||||
auto check_float = [](float number, const std::string & expected)
|
||||
{
|
||||
std::array<char, 33> buf{};
|
||||
char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number);
|
||||
char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
std::string actual(buf.data(), end);
|
||||
|
||||
CHECK(actual == expected);
|
||||
@ -420,7 +420,7 @@ TEST_CASE("formatting")
|
||||
auto check_double = [](double number, const std::string & expected)
|
||||
{
|
||||
std::array<char, 33> buf{};
|
||||
char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number);
|
||||
char* end = nlohmann::detail::to_chars(buf.data(), buf.data() + 32, number); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
|
||||
std::string actual(buf.data(), end);
|
||||
|
||||
CHECK(actual == expected);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user