mirror of
https://github.com/nlohmann/json.git
synced 2026-11-02 19:05:35 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b44aeaac0a |
No files matched your search
@@ -1168,20 +1168,20 @@ indent_done:
|
|||||||
if (negative)
|
if (negative)
|
||||||
{
|
{
|
||||||
++p;
|
++p;
|
||||||
|
if (NLOHMANN_VIEW_UNLIKELY(cur() < '0' || cur() > '9'))
|
||||||
|
{
|
||||||
|
return fail(error_code::number_after_minus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const unsigned char* const int_start = p;
|
const unsigned char* const int_start = p;
|
||||||
if (cur() == '0')
|
if (cur() == '0')
|
||||||
{
|
{
|
||||||
++p;
|
++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
|
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);
|
const auto int_digits = static_cast<std::size_t>(p - int_start);
|
||||||
std::size_t frac_digits = 0;
|
std::size_t frac_digits = 0;
|
||||||
|
|||||||
Generated
+6
-6
@@ -2473,20 +2473,20 @@ indent_done:
|
|||||||
if (negative)
|
if (negative)
|
||||||
{
|
{
|
||||||
++p;
|
++p;
|
||||||
|
if (NLOHMANN_VIEW_UNLIKELY(cur() < '0' || cur() > '9'))
|
||||||
|
{
|
||||||
|
return fail(error_code::number_after_minus);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const unsigned char* const int_start = p;
|
const unsigned char* const int_start = p;
|
||||||
if (cur() == '0')
|
if (cur() == '0')
|
||||||
{
|
{
|
||||||
++p;
|
++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
|
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);
|
const auto int_digits = static_cast<std::size_t>(p - int_start);
|
||||||
std::size_t frac_digits = 0;
|
std::size_t frac_digits = 0;
|
||||||
|
|||||||
@@ -505,8 +505,8 @@ struct locale_switching_token
|
|||||||
{
|
{
|
||||||
using value_type = char;
|
using value_type = char;
|
||||||
|
|
||||||
locale_switching_token(std::string text_, const char* switch_to_)
|
locale_switching_token(std::string text_, std::string switch_to_)
|
||||||
: text(std::move(text_)), switch_to(switch_to_)
|
: text(std::move(text_)), switch_to(std::move(switch_to_))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
std::size_t size() const
|
std::size_t size() const
|
||||||
@@ -523,13 +523,13 @@ struct locale_switching_token
|
|||||||
{
|
{
|
||||||
if (!switched)
|
if (!switched)
|
||||||
{
|
{
|
||||||
switched = std::setlocale(LC_NUMERIC, switch_to) != nullptr;
|
switched = std::setlocale(LC_NUMERIC, switch_to.c_str()) != nullptr;
|
||||||
}
|
}
|
||||||
return &text[0];
|
return &text[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string text;
|
std::string text;
|
||||||
const char* switch_to;
|
std::string switch_to;
|
||||||
bool switched = false;
|
bool switched = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user