mirror of
https://github.com/nlohmann/json.git
synced 2026-10-11 17:07:15 +00:00
Fix clang-tidy 22 findings in unit-json_view_image.cpp and image.hpp
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
(cherry picked from commit 611faf2c88)
This commit is contained in:
2 files changed
+12
-4
No files matched your search
@@ -437,7 +437,15 @@ inline bool check_float_ranges(std::vector<float_range>& ranges, const unsigned
|
|||||||
{
|
{
|
||||||
std::sort(ranges.begin(), ranges.end(), [](const float_range & a, const float_range & b)
|
std::sort(ranges.begin(), ranges.end(), [](const float_range & a, const float_range & b)
|
||||||
{
|
{
|
||||||
return a.off != b.off ? a.off < b.off : (a.len != b.len ? a.len < b.len : a.extra < b.extra);
|
if (a.off != b.off)
|
||||||
|
{
|
||||||
|
return a.off < b.off;
|
||||||
|
}
|
||||||
|
if (a.len != b.len)
|
||||||
|
{
|
||||||
|
return a.len < b.len;
|
||||||
|
}
|
||||||
|
return a.extra < b.extra;
|
||||||
});
|
});
|
||||||
std::size_t end = 0;
|
std::size_t end = 0;
|
||||||
std::size_t i = 0;
|
std::size_t i = 0;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ const char* const check_failed = "[json.exception.parse_error.116] parse error:
|
|||||||
|
|
||||||
std::string read_file(const std::string& name)
|
std::string read_file(const std::string& name)
|
||||||
{
|
{
|
||||||
std::ifstream f(std::string(TEST_DATA_DIRECTORY) + name, std::ios::binary);
|
const std::ifstream f(std::string(TEST_DATA_DIRECTORY) + name, std::ios::binary);
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << f.rdbuf();
|
ss << f.rdbuf();
|
||||||
return ss.str();
|
return ss.str();
|
||||||
@@ -325,7 +325,7 @@ TEST_CASE("json_view images: round trips")
|
|||||||
// exceed the probe limit, so the object has none and is searched
|
// exceed the probe limit, so the object has none and is searched
|
||||||
// linearly; 40 of 200 keys in one slot (512 slots): a table with a
|
// linearly; 40 of 200 keys in one slot (512 slots): a table with a
|
||||||
// long chain
|
// long chain
|
||||||
const struct
|
const struct // NOLINT(cppcoreguidelines-avoid-c-arrays,hicpp-avoid-c-arrays,modernize-avoid-c-arrays): an unnamed type
|
||||||
{
|
{
|
||||||
std::size_t slots;
|
std::size_t slots;
|
||||||
std::size_t colliding;
|
std::size_t colliding;
|
||||||
@@ -342,7 +342,7 @@ TEST_CASE("json_view images: round trips")
|
|||||||
text.pop_back();
|
text.pop_back();
|
||||||
for (const std::string& key : duplicated)
|
for (const std::string& key : duplicated)
|
||||||
{
|
{
|
||||||
text += ",\"" + key + "\":\"last\"";
|
text += ",\"" + key + R"(":"last")";
|
||||||
}
|
}
|
||||||
text += "}";
|
text += "}";
|
||||||
const json_document d = json_document::parse(text);
|
const json_document d = json_document::parse(text);
|
||||||
|
|||||||
Reference in new issue
Block a user