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
2f73a4d1
Unverified
Commit
2f73a4d1
authored
6 years ago
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a linter warning
parent
e3c28afb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
2 deletions
+30
-2
include/nlohmann/detail/input/binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+4
-1
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+4
-1
test/src/unit-bson.cpp
test/src/unit-bson.cpp
+22
-0
No files found.
include/nlohmann/detail/input/binary_reader.hpp
View file @
2f73a4d1
...
@@ -300,7 +300,10 @@ class binary_reader
...
@@ -300,7 +300,10 @@ class binary_reader
if
(
not
is_array
)
if
(
not
is_array
)
{
{
sax
->
key
(
key
);
if
(
not
sax
->
key
(
key
))
{
return
false
;
}
}
}
if
(
JSON_UNLIKELY
(
not
parse_bson_element_internal
(
element_type
,
element_type_parse_position
)))
if
(
JSON_UNLIKELY
(
not
parse_bson_element_internal
(
element_type
,
element_type_parse_position
)))
...
...
This diff is collapsed.
Click to expand it.
single_include/nlohmann/json.hpp
View file @
2f73a4d1
...
@@ -6635,7 +6635,10 @@ class binary_reader
...
@@ -6635,7 +6635,10 @@ class binary_reader
if
(
not
is_array
)
if
(
not
is_array
)
{
{
sax
->
key
(
key
);
if
(
not
sax
->
key
(
key
))
{
return
false
;
}
}
}
if
(
JSON_UNLIKELY
(
not
parse_bson_element_internal
(
element_type
,
element_type_parse_position
)))
if
(
JSON_UNLIKELY
(
not
parse_bson_element_internal
(
element_type
,
element_type_parse_position
)))
...
...
This diff is collapsed.
Click to expand it.
test/src/unit-bson.cpp
View file @
2f73a4d1
...
@@ -752,6 +752,28 @@ TEST_CASE("Incomplete BSON Input")
...
@@ -752,6 +752,28 @@ TEST_CASE("Incomplete BSON Input")
SaxCountdown
scp
(
0
);
SaxCountdown
scp
(
0
);
CHECK
(
not
json
::
sax_parse
(
incomplete_bson
,
&
scp
,
json
::
input_format_t
::
bson
));
CHECK
(
not
json
::
sax_parse
(
incomplete_bson
,
&
scp
,
json
::
input_format_t
::
bson
));
}
}
SECTION
(
"Improve coverage"
)
{
SECTION
(
"key"
)
{
json
j
=
{{
"key"
,
"value"
}};
auto
bson_vec
=
json
::
to_bson
(
j
);
SaxCountdown
scp
(
2
);
CHECK
(
not
json
::
sax_parse
(
bson_vec
,
&
scp
,
json
::
input_format_t
::
bson
));
}
SECTION
(
"array"
)
{
json
j
=
{
{
"entry"
,
json
::
array
()
}
};
auto
bson_vec
=
json
::
to_bson
(
j
);
SaxCountdown
scp
(
2
);
CHECK
(
not
json
::
sax_parse
(
bson_vec
,
&
scp
,
json
::
input_format_t
::
bson
));
}
}
}
}
TEST_CASE
(
"Unsupported BSON input"
)
TEST_CASE
(
"Unsupported BSON input"
)
...
...
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