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
737d4372
Commit
737d4372
authored
Nov 02, 2016
by
Niels
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/issue329' into develop
parents
a29fcae4
d9106722
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
README.md
README.md
+1
-1
json.hpp
src/json.hpp
+7
-0
json.hpp.re2c
src/json.hpp.re2c
+7
-0
unit-regression.cpp
test/src/unit-regression.cpp
+6
-0
No files found.
README.md
View file @
737d4372
...
...
@@ -517,7 +517,7 @@ To compile and run the tests, you need to execute
$ make check
===============================================================================
All tests passed (890516
8
assertions in 35 test cases)
All tests passed (890516
9
assertions in 35 test cases)
```
Alternatively, you can use [CMake](https://cmake.org) and run
...
...
src/json.hpp
View file @
737d4372
...
...
@@ -8960,6 +8960,13 @@ basic_json_parser_63:
{
// parse with strtod
result
.
m_value
.
number_float
=
str_to_float_t
(
static_cast
<
number_float_t
*>
(
nullptr
),
NULL
);
// replace infinity and NAN by null
if
(
not
std
::
isfinite
(
result
.
m_value
.
number_float
))
{
type
=
value_t
::
null
;
result
.
m_value
=
basic_json
::
json_value
();
}
}
// save the type
...
...
src/json.hpp.re2c
View file @
737d4372
...
...
@@ -8257,6 +8257,13 @@ class basic_json
{
// parse with strtod
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
// replace infinity and NAN by null
if (not std::isfinite(result.m_value.number_float))
{
type = value_t::null;
result.m_value = basic_json::json_value();
}
}
// save the type
...
...
test/src/unit-regression.cpp
View file @
737d4372
...
...
@@ -489,4 +489,10 @@ TEST_CASE("regression tests")
j
[
"/this/that/2"
_json_pointer
]
=
27
;
CHECK
(
j
==
json
({{
"this"
,
{{
"that"
,
{
nullptr
,
nullptr
,
27
}}}}}));
}
SECTION
(
"issue #329 - serialized value not always can be parsed"
)
{
json
j
=
json
::
parse
(
"22e2222"
);
CHECK
(
j
==
json
());
}
}
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