Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
5c045f7d
Commit
5c045f7d
authored
Nov 19, 2019
by
Michael Balszun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use correct accumulator type in binary_writer if size_t != ul
- Also fixes warning in msvc about possible loss of data in that size computation.
parent
e7b3b40b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
binary_writer.hpp
include/nlohmann/detail/output/binary_writer.hpp
+2
-2
json.hpp
single_include/nlohmann/json.hpp
+2
-2
No files found.
include/nlohmann/detail/output/binary_writer.hpp
View file @
5c045f7d
...
...
@@ -863,7 +863,7 @@ class binary_writer
{
std
::
size_t
array_index
=
0ul
;
const
std
::
size_t
embedded_document_size
=
std
::
accumulate
(
std
::
begin
(
value
),
std
::
end
(
value
),
0ul
,
[
&
array_index
](
std
::
size_t
result
,
const
typename
BasicJsonType
::
array_t
::
value_type
&
el
)
const
std
::
size_t
embedded_document_size
=
std
::
accumulate
(
std
::
begin
(
value
),
std
::
end
(
value
),
std
::
size_t
(
0
)
,
[
&
array_index
](
std
::
size_t
result
,
const
typename
BasicJsonType
::
array_t
::
value_type
&
el
)
{
return
result
+
calc_bson_element_size
(
std
::
to_string
(
array_index
++
),
el
);
});
...
...
@@ -984,7 +984,7 @@ class binary_writer
*/
static
std
::
size_t
calc_bson_object_size
(
const
typename
BasicJsonType
::
object_t
&
value
)
{
std
::
size_t
document_size
=
std
::
accumulate
(
value
.
begin
(),
value
.
end
(),
0ul
,
std
::
size_t
document_size
=
std
::
accumulate
(
value
.
begin
(),
value
.
end
(),
std
::
size_t
(
0
)
,
[](
size_t
result
,
const
typename
BasicJsonType
::
object_t
::
value_type
&
el
)
{
return
result
+=
calc_bson_element_size
(
el
.
first
,
el
.
second
);
...
...
single_include/nlohmann/json.hpp
View file @
5c045f7d
...
...
@@ -12155,7 +12155,7 @@ class binary_writer
{
std
::
size_t
array_index
=
0ul
;
const
std
::
size_t
embedded_document_size
=
std
::
accumulate
(
std
::
begin
(
value
),
std
::
end
(
value
),
0ul
,
[
&
array_index
](
std
::
size_t
result
,
const
typename
BasicJsonType
::
array_t
::
value_type
&
el
)
const
std
::
size_t
embedded_document_size
=
std
::
accumulate
(
std
::
begin
(
value
),
std
::
end
(
value
),
std
::
size_t
(
0
)
,
[
&
array_index
](
std
::
size_t
result
,
const
typename
BasicJsonType
::
array_t
::
value_type
&
el
)
{
return
result
+
calc_bson_element_size
(
std
::
to_string
(
array_index
++
),
el
);
});
...
...
@@ -12276,7 +12276,7 @@ class binary_writer
*/
static
std
::
size_t
calc_bson_object_size
(
const
typename
BasicJsonType
::
object_t
&
value
)
{
std
::
size_t
document_size
=
std
::
accumulate
(
value
.
begin
(),
value
.
end
(),
0ul
,
std
::
size_t
document_size
=
std
::
accumulate
(
value
.
begin
(),
value
.
end
(),
std
::
size_t
(
0
)
,
[](
size_t
result
,
const
typename
BasicJsonType
::
object_t
::
value_type
&
el
)
{
return
result
+=
calc_bson_element_size
(
el
.
first
,
el
.
second
);
...
...
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