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
b7cc4708
Unverified
Commit
b7cc4708
authored
4 years ago
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid string in case of empty objects
parent
c89e23c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
44 deletions
+50
-44
include/nlohmann/detail/input/binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+25
-22
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+25
-22
No files found.
include/nlohmann/detail/input/binary_reader.hpp
View file @
b7cc4708
...
@@ -1082,38 +1082,41 @@ class binary_reader
...
@@ -1082,38 +1082,41 @@ class binary_reader
return
false
;
return
false
;
}
}
string_t
key
;
if
(
len
!=
0
)
if
(
len
!=
std
::
size_t
(
-
1
))
{
{
for
(
std
::
size_t
i
=
0
;
i
<
len
;
++
i
)
string_t
key
;
if
(
len
!=
std
::
size_t
(
-
1
))
{
{
get
();
for
(
std
::
size_t
i
=
0
;
i
<
len
;
++
i
)
if
(
JSON_HEDLEY_UNLIKELY
(
!
get_cbor_string
(
key
)
||
!
sax
->
key
(
key
)))
{
{
return
false
;
get
();
}
if
(
JSON_HEDLEY_UNLIKELY
(
!
get_cbor_string
(
key
)
||
!
sax
->
key
(
key
)))
{
return
false
;
}
if
(
JSON_HEDLEY_UNLIKELY
(
!
parse_cbor_internal
(
true
,
tag_handler
)))
if
(
JSON_HEDLEY_UNLIKELY
(
!
parse_cbor_internal
(
true
,
tag_handler
)))
{
{
return
false
;
return
false
;
}
key
.
clear
();
}
}
key
.
clear
();
}
}
}
else
else
{
while
(
get
()
!=
0xFF
)
{
{
if
(
JSON_HEDLEY_UNLIKELY
(
!
get_cbor_string
(
key
)
||
!
sax
->
key
(
key
))
)
while
(
get
()
!=
0xFF
)
{
{
return
false
;
if
(
JSON_HEDLEY_UNLIKELY
(
!
get_cbor_string
(
key
)
||
!
sax
->
key
(
key
)))
}
{
return
false
;
}
if
(
JSON_HEDLEY_UNLIKELY
(
!
parse_cbor_internal
(
true
,
tag_handler
)))
if
(
JSON_HEDLEY_UNLIKELY
(
!
parse_cbor_internal
(
true
,
tag_handler
)))
{
{
return
false
;
return
false
;
}
key
.
clear
();
}
}
key
.
clear
();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
b7cc4708
...
@@ -9298,38 +9298,41 @@ class binary_reader
...
@@ -9298,38 +9298,41 @@ class binary_reader
return false;
return false;
}
}
string_t key;
if (len != 0)
if (len != std::size_t(-1))
{
{
for (std::size_t i = 0; i < len; ++i)
string_t key;
if (len != std::size_t(-1))
{
{
get();
for (std::size_t i = 0; i < len; ++i)
if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))
{
{
return false;
get();
}
if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))
{
return false;
}
if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))
if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))
{
{
return false;
return false;
}
key.clear();
}
}
key.clear();
}
}
}
else
else
{
while (get() != 0xFF)
{
{
if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key))
)
while (get() != 0xFF
)
{
{
return false;
if (JSON_HEDLEY_UNLIKELY(!get_cbor_string(key) || !sax->key(key)))
}
{
return false;
}
if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))
if (JSON_HEDLEY_UNLIKELY(!parse_cbor_internal(true, tag_handler)))
{
{
return false;
return false;
}
key.clear();
}
}
key.clear();
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
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