mirror of
https://github.com/nlohmann/json.git
synced 2025-11-23 19:34:10 +08:00
Enable modernize-use-integer-sign-comparison check (#4581)
Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -53,7 +53,6 @@ Checks: '*,
|
||||
-modernize-type-traits,
|
||||
-modernize-use-constraints,
|
||||
-modernize-use-designated-initializers,
|
||||
-modernize-use-integer-sign-comparison,
|
||||
-modernize-use-nodiscard,
|
||||
-modernize-use-ranges,
|
||||
-modernize-use-std-numbers,
|
||||
|
||||
@@ -28,7 +28,7 @@ class alt_string
|
||||
public:
|
||||
using value_type = std::string::value_type;
|
||||
|
||||
static constexpr auto npos = static_cast<std::size_t>(-1);
|
||||
static constexpr auto npos = (std::numeric_limits<std::size_t>::max)();
|
||||
|
||||
alt_string(const char* str): str_impl(str) {}
|
||||
alt_string(const char* str, std::size_t count): str_impl(str, count) {}
|
||||
|
||||
@@ -75,7 +75,7 @@ class SaxEventLogger
|
||||
|
||||
bool start_object(std::size_t elements)
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_object()");
|
||||
}
|
||||
@@ -100,7 +100,7 @@ class SaxEventLogger
|
||||
|
||||
bool start_array(std::size_t elements)
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_array()");
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class SaxEventLogger
|
||||
|
||||
bool start_object(std::size_t elements)
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_object()");
|
||||
}
|
||||
@@ -105,7 +105,7 @@ class SaxEventLogger
|
||||
|
||||
bool start_array(std::size_t elements)
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_array()");
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ struct SaxEventLogger : public nlohmann::json_sax<json>
|
||||
|
||||
bool start_object(std::size_t elements) override
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_object()");
|
||||
}
|
||||
@@ -101,7 +101,7 @@ struct SaxEventLogger : public nlohmann::json_sax<json>
|
||||
|
||||
bool start_array(std::size_t elements) override
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_array()");
|
||||
}
|
||||
@@ -131,7 +131,7 @@ struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
|
||||
{
|
||||
bool start_object(std::size_t elements) override
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_object()");
|
||||
}
|
||||
@@ -156,7 +156,7 @@ struct SaxEventLoggerExitAfterStartArray : public SaxEventLogger
|
||||
{
|
||||
bool start_array(std::size_t elements) override
|
||||
{
|
||||
if (elements == static_cast<std::size_t>(-1))
|
||||
if (elements == (std::numeric_limits<std::size_t>::max)())
|
||||
{
|
||||
events.emplace_back("start_array()");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user