Unverified Commit 27b44cb1 authored by Niels Lohmann's avatar Niels Lohmann

Merge branch 'issue2615' of https://github.com/nlohmann/json into develop

parents 9f6b78ee ffdeb774
......@@ -490,51 +490,49 @@ inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10)
return 10;
}
// LCOV_EXCL_STOP
else if (n >= 100000000)
if (n >= 100000000)
{
pow10 = 100000000;
return 9;
}
else if (n >= 10000000)
if (n >= 10000000)
{
pow10 = 10000000;
return 8;
}
else if (n >= 1000000)
if (n >= 1000000)
{
pow10 = 1000000;
return 7;
}
else if (n >= 100000)
if (n >= 100000)
{
pow10 = 100000;
return 6;
}
else if (n >= 10000)
if (n >= 10000)
{
pow10 = 10000;
return 5;
}
else if (n >= 1000)
if (n >= 1000)
{
pow10 = 1000;
return 4;
}
else if (n >= 100)
if (n >= 100)
{
pow10 = 100;
return 3;
}
else if (n >= 10)
if (n >= 10)
{
pow10 = 10;
return 2;
}
else
{
pow10 = 1;
return 1;
}
}
inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,
......
......@@ -135,11 +135,9 @@ class iterator_input_adapter
std::advance(current, 1);
return result;
}
else
{
return std::char_traits<char_type>::eof();
}
}
private:
IteratorType current;
......
......@@ -393,8 +393,9 @@ class parser
parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::end_array, "array")));
}
else // object
{
// states.back() is false -> object
// comma -> next value
if (get_token() == token_type::value_separator)
{
......@@ -450,7 +451,6 @@ class parser
exception_message(token_type::end_object, "object")));
}
}
}
/// get next token from lexer
token_type get_token()
......
......@@ -39,7 +39,7 @@ template<typename IteratorType> class iteration_proxy_value
/// a string representation of the array index
mutable string_type array_index_str = "0";
/// an empty string (to return a reference for primitive values)
const string_type empty_str = "";
const string_type empty_str;
public:
explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {}
......
......@@ -3944,7 +3944,7 @@ template<typename IteratorType> class iteration_proxy_value
/// a string representation of the array index
mutable string_type array_index_str = "0";
/// an empty string (to return a reference for primitive values)
const string_type empty_str = "";
const string_type empty_str;
public:
explicit iteration_proxy_value(IteratorType it) noexcept : anchor(it) {}
......@@ -4947,11 +4947,9 @@ class iterator_input_adapter
std::advance(current, 1);
return result;
}
else
{
return std::char_traits<char_type>::eof();
}
}
private:
IteratorType current;
......@@ -10618,8 +10616,9 @@ class parser
parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::end_array, "array")));
}
else // object
{
// states.back() is false -> object
// comma -> next value
if (get_token() == token_type::value_separator)
{
......@@ -10675,7 +10674,6 @@ class parser
exception_message(token_type::end_object, "object")));
}
}
}
/// get next token from lexer
token_type get_token()
......@@ -14948,51 +14946,49 @@ inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10)
return 10;
}
// LCOV_EXCL_STOP
else if (n >= 100000000)
if (n >= 100000000)
{
pow10 = 100000000;
return 9;
}
else if (n >= 10000000)
if (n >= 10000000)
{
pow10 = 10000000;
return 8;
}
else if (n >= 1000000)
if (n >= 1000000)
{
pow10 = 1000000;
return 7;
}
else if (n >= 100000)
if (n >= 100000)
{
pow10 = 100000;
return 6;
}
else if (n >= 10000)
if (n >= 10000)
{
pow10 = 10000;
return 5;
}
else if (n >= 1000)
if (n >= 1000)
{
pow10 = 1000;
return 4;
}
else if (n >= 100)
if (n >= 100)
{
pow10 = 100;
return 3;
}
else if (n >= 10)
if (n >= 10)
{
pow10 = 10;
return 2;
}
else
{
pow10 = 1;
return 1;
}
}
inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment