Tweaked check for preserved sign; added LCOV_EXCL_LINE

This commit is contained in:
Alex Astashyn 2016-12-12 20:15:57 -05:00
parent 0f8de48ddb
commit 5cad2006eb

View file

@ -8252,7 +8252,7 @@ class basic_json
if (!p)
{
return false;
return false; // LCOV_EXCL_LINE
}
if (*p == '-' or *p == '+')
@ -8262,7 +8262,7 @@ class basic_json
if (p == m_end)
{
return false;
return false; // LCOV_EXCL_LINE
}
while (p < m_end and *p >= '0'
@ -8401,11 +8401,11 @@ class basic_json
value = static_cast<T>(x);
return x == static_cast<decltype(x)>(value) // x fits into destination T
and (x < 0) == (value < 0) // preserved sign
and (x != 0 or is_integral()) // strto[u]ll did nto fail
and errno == 0 // strto[u]ll did not overflow
and m_start < m_end // token was not empty
and endptr == m_end // parsed entire token exactly
and (x < 0) == (*m_start == '-'); // input was sign-compatible
and endptr == m_end; // parsed entire token exactly
}
#else // parsing integral types manually