Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
ffdeb774
Unverified
Commit
ffdeb774
authored
Jan 27, 2021
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚨
fix warnings #2615
parent
b83fe5db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
120 additions
and
128 deletions
+120
-128
include/nlohmann/detail/conversions/to_chars.hpp
include/nlohmann/detail/conversions/to_chars.hpp
+11
-13
include/nlohmann/detail/input/input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+2
-4
include/nlohmann/detail/input/parser.hpp
include/nlohmann/detail/input/parser.hpp
+46
-46
include/nlohmann/detail/iterators/iteration_proxy.hpp
include/nlohmann/detail/iterators/iteration_proxy.hpp
+1
-1
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+60
-64
No files found.
include/nlohmann/detail/conversions/to_chars.hpp
View file @
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
;
}
pow10
=
1
;
return
1
;
}
inline
void
grisu2_round
(
char
*
buf
,
int
len
,
std
::
uint64_t
dist
,
std
::
uint64_t
delta
,
...
...
include/nlohmann/detail/input/input_adapters.hpp
View file @
ffdeb774
...
...
@@ -135,10 +135,8 @@ class iterator_input_adapter
std
::
advance
(
current
,
1
);
return
result
;
}
else
{
return
std
::
char_traits
<
char_type
>::
eof
();
}
return
std
::
char_traits
<
char_type
>::
eof
();
}
private:
...
...
include/nlohmann/detail/input/parser.hpp
View file @
ffdeb774
...
...
@@ -393,62 +393,62 @@ class parser
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
end_array
,
"array"
)));
}
else
// object
{
// comma -> next value
if
(
get_token
()
==
token_type
::
value_separator
)
{
// parse key
if
(
JSON_HEDLEY_UNLIKELY
(
get_token
()
!=
token_type
::
value_string
))
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
value_string
,
"object key"
)));
}
if
(
JSON_HEDLEY_UNLIKELY
(
!
sax
->
key
(
m_lexer
.
get_string
())))
{
return
false
;
}
// states.back() is false -> object
// parse separator (:)
if
(
JSON_HEDLEY_UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
name_separator
,
"object separator"
)));
}
// comma -> next value
if
(
get_token
()
==
token_type
::
value_separator
)
{
// parse key
if
(
JSON_HEDLEY_UNLIKELY
(
get_token
()
!=
token_type
::
value_string
))
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
value_string
,
"object key"
)));
}
// parse values
get_token
();
continu
e
;
if
(
JSON_HEDLEY_UNLIKELY
(
!
sax
->
key
(
m_lexer
.
get_string
())))
{
return
fals
e
;
}
//
closing }
if
(
JSON_HEDLEY_
LIKELY
(
last_token
==
token_type
::
end_object
))
//
parse separator (:)
if
(
JSON_HEDLEY_
UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
{
if
(
JSON_HEDLEY_UNLIKELY
(
!
sax
->
end_object
()))
{
return
false
;
}
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
name_separator
,
"object separator"
)));
}
// We are done with this object. Before we can parse a
// new value, we need to evaluate the new state first.
// By setting skip_to_state_evaluation to false, we
// are effectively jumping to the beginning of this if.
JSON_ASSERT
(
!
states
.
empty
());
states
.
pop_back
();
skip_to_state_evaluation
=
true
;
continue
;
// parse values
get_token
();
continue
;
}
// closing }
if
(
JSON_HEDLEY_LIKELY
(
last_token
==
token_type
::
end_object
))
{
if
(
JSON_HEDLEY_UNLIKELY
(
!
sax
->
end_object
()))
{
return
false
;
}
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
end_object
,
"object"
)));
// We are done with this object. Before we can parse a
// new value, we need to evaluate the new state first.
// By setting skip_to_state_evaluation to false, we
// are effectively jumping to the beginning of this if.
JSON_ASSERT
(
!
states
.
empty
());
states
.
pop_back
();
skip_to_state_evaluation
=
true
;
continue
;
}
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
end_object
,
"object"
)));
}
}
...
...
include/nlohmann/detail/iterators/iteration_proxy.hpp
View file @
ffdeb774
...
...
@@ -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
)
{}
...
...
single_include/nlohmann/json.hpp
View file @
ffdeb774
...
...
@@ -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,10 +4947,8 @@ class iterator_input_adapter
std::advance(current, 1);
return result;
}
else
{
return
std
::
char_traits
<
char_type
>::
eof
();
}
return std::char_traits<char_type>::eof();
}
private:
...
...
@@ -10618,62 +10616,62 @@ class parser
parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::end_array, "array")));
}
else
// object
{
// comma -> next value
if
(
get_token
()
==
token_type
::
value_separator
)
{
// parse key
if
(
JSON_HEDLEY_UNLIKELY
(
get_token
()
!=
token_type
::
value_string
))
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
value_string
,
"object key"
)));
}
if
(
JSON_HEDLEY_UNLIKELY
(
!
sax
->
key
(
m_lexer
.
get_string
())))
{
return
false
;
}
// states.back() is false -> object
// parse separator (:)
if
(
JSON_HEDLEY_UNLIKELY
(
get_token
()
!=
token_type
::
name_separator
))
{
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
name_separator
,
"object separator"
)));
}
// comma -> next value
if (get_token() == token_type::value_separator)
{
// parse key
if (JSON_HEDLEY_UNLIKELY(get_token() != token_type::value_string))
{
return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(),
parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::value_string, "object key")));
}
// parse values
get_token
();
continu
e
;
if (JSON_HEDLEY_UNLIKELY(!sax->key(m_lexer.get_string())))
{
return fals
e;
}
//
closing }
if
(
JSON_HEDLEY_
LIKELY
(
last_token
==
token_type
::
end_object
))
//
parse separator (:)
if (JSON_HEDLEY_
UNLIKELY(get_token() != token_type::name_separator
))
{
if
(
JSON_HEDLEY_UNLIKELY
(
!
sax
->
end_object
()))
{
return
false
;
}
return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(),
parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::name_separator, "object separator")));
}
// We are done with this object. Before we can parse a
// new value, we need to evaluate the new state first.
// By setting skip_to_state_evaluation to false, we
// are effectively jumping to the beginning of this if.
JSON_ASSERT
(
!
states
.
empty
());
states
.
pop_back
();
skip_to_state_evaluation
=
true
;
continue
;
// parse values
get_token();
continue;
}
// closing }
if (JSON_HEDLEY_LIKELY(last_token == token_type::end_object))
{
if (JSON_HEDLEY_UNLIKELY(!sax->end_object()))
{
return false;
}
return
sax
->
parse_error
(
m_lexer
.
get_position
(),
m_lexer
.
get_token_string
(),
parse_error
::
create
(
101
,
m_lexer
.
get_position
(),
exception_message
(
token_type
::
end_object
,
"object"
)));
// We are done with this object. Before we can parse a
// new value, we need to evaluate the new state first.
// By setting skip_to_state_evaluation to false, we
// are effectively jumping to the beginning of this if.
JSON_ASSERT(!states.empty());
states.pop_back();
skip_to_state_evaluation = true;
continue;
}
return sax->parse_error(m_lexer.get_position(),
m_lexer.get_token_string(),
parse_error::create(101, m_lexer.get_position(),
exception_message(token_type::end_object, "object")));
}
}
...
...
@@ -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
;
}
pow10 = 1;
return 1;
}
inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment