Fix GCC and clang-tidy warnings in the JSON pointer speedups

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-17 08:29:05 +02:00
1 parent 8c2857d974
commit 65fbbc5588
2 files changed
+9 -6

No files matched your search

+5 -3
View File
@@ -20995,6 +20995,8 @@ NLOHMANN_JSON_NAMESPACE_END
// #include <nlohmann/detail/meta/cpp_future.hpp>
// #include <nlohmann/detail/meta/type_traits.hpp>
// #include <nlohmann/detail/string_concat.hpp>
// #include <nlohmann/detail/string_escape.hpp>
@@ -21571,7 +21573,7 @@ class json_pointer
std::memcpy(&w, data + i, size - i);
}
h = (h ^ w) * 0x9E3779B97F4A7C15ULL;
return static_cast<std::size_t>(h ^ (h >> 29u));
return detail::conditional_static_cast<std::size_t>(h ^ (h >> 29u));
}
void grow()
@@ -22247,7 +22249,7 @@ class json_pointer
std::size_t pos = buf.size();
do
{
buf[--pos] = static_cast<char>('0' + i % 10);
buf[--pos] = static_cast<char>('0' + (i % 10));
i /= 10;
}
while (i != 0);
@@ -22299,7 +22301,7 @@ class json_pointer
// flatten `v`, whose path is `path`: primitives and empty containers
// are added to the result right away; other containers get a frame
auto& object = *result.m_data.m_value.object;
typename BasicJsonType::object_t::iterator hint = object.end();
auto hint = object.end();
const auto enter = [&stack, &path, &object, &hint](const BasicJsonType & v)
{
switch (v.type())