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
3716a2fb
Commit
3716a2fb
authored
Nov 02, 2016
by
Niels
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into feature/jsontestsuite
parents
59c83438
737d4372
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
src/json.hpp
src/json.hpp
+7
-0
src/json.hpp.re2c
src/json.hpp.re2c
+7
-0
test/src/unit-regression.cpp
test/src/unit-regression.cpp
+6
-0
No files found.
src/json.hpp
View file @
3716a2fb
...
...
@@ -9121,6 +9121,13 @@ basic_json_parser_66:
{
// 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 @
3716a2fb
...
...
@@ -8270,6 +8270,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 @
3716a2fb
...
...
@@ -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