mirror of
https://github.com/nlohmann/json.git
synced 2026-11-03 19:29:22 +00:00
Fix the MSVC and GCC builds of develop (C4127, -Weffc++) (#6016)
json_view number(): #6006 folded the check of the digit after a minus sign into `else if (!negative || ...)`, which MSVC 19.44 reports as C4127 (conditional expression is constant) and /WX turns into an error in every MSVC and clang-cl job. The check now sits in the `if (negative)` block, right after the sign is skipped; the error and its position are unchanged. unit-locale-cpp.cpp: the locale_switching_token added in #5997 held a `const char*`, so GCC's -Weffc++ asked for a copy constructor and copy assignment. The locale name is now a std::string. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 parent
07876e2292
commit
baba5db36f
3 files changed
+16
-16
No files matched your search
Generated
+6
-6
@@ -2473,20 +2473,20 @@ indent_done:
|
||||
if (negative)
|
||||
{
|
||||
++p;
|
||||
if (NLOHMANN_VIEW_UNLIKELY(cur() < '0' || cur() > '9'))
|
||||
{
|
||||
return fail(error_code::number_after_minus);
|
||||
}
|
||||
}
|
||||
const unsigned char* const int_start = p;
|
||||
if (cur() == '0')
|
||||
{
|
||||
++p;
|
||||
}
|
||||
else if (!negative || NLOHMANN_VIEW_LIKELY(cur() >= '1' && cur() <= '9'))
|
||||
{
|
||||
// (without a sign, the dispatch saw a digit)
|
||||
p = skip_digits(p + 1, e);
|
||||
}
|
||||
else
|
||||
{
|
||||
return fail(error_code::number_after_minus);
|
||||
// (a digit: the dispatch or the check after the sign saw it)
|
||||
p = skip_digits(p + 1, e);
|
||||
}
|
||||
const auto int_digits = static_cast<std::size_t>(p - int_start);
|
||||
std::size_t frac_digits = 0;
|
||||
|
||||
Reference in new issue
Block a user