mirror of
https://github.com/nlohmann/json.git
synced 2026-10-05 06:00:29 +00:00
Fix CI: useless cast in the array index check of the view's JSON pointers
GCC -Werror=useless-cast on Linux x86-64 rejected static_cast<std::uint64_t>((std::numeric_limits<std::size_t>::max)()), as both are the same type there. Compare without the cast: std::size_t converts to std::uint64_t implicitly on every platform. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -69,7 +69,7 @@ index_status array_index(const StringType& s, std::size_t& idx) noexcept
|
|||||||
}
|
}
|
||||||
v = (v * 10) + d;
|
v = (v * 10) + d;
|
||||||
}
|
}
|
||||||
if (v >= static_cast<std::uint64_t>((std::numeric_limits<std::size_t>::max)()))
|
if (v >= (std::numeric_limits<std::size_t>::max)()) // (std::size_t converts to std::uint64_t implicitly)
|
||||||
{
|
{
|
||||||
return index_status::too_large;
|
return index_status::too_large;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2464,7 +2464,7 @@ index_status array_index(const StringType& s, std::size_t& idx) noexcept
|
|||||||
}
|
}
|
||||||
v = (v * 10) + d;
|
v = (v * 10) + d;
|
||||||
}
|
}
|
||||||
if (v >= static_cast<std::uint64_t>((std::numeric_limits<std::size_t>::max)()))
|
if (v >= (std::numeric_limits<std::size_t>::max)()) // (std::size_t converts to std::uint64_t implicitly)
|
||||||
{
|
{
|
||||||
return index_status::too_large;
|
return index_status::too_large;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user