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
e678c075
Commit
e678c075
authored
Jan 09, 2017
by
Théo DELRIEU
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check for is_number_unsigned before is_number_integer
parent
cb3d455b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
src/json.hpp
src/json.hpp
+7
-6
No files found.
src/json.hpp
View file @
e678c075
...
...
@@ -493,10 +493,11 @@ template <typename Json, typename ArithmeticType,
int
>
=
0
>
void
get_arithmetic_value
(
Json
const
&
j
,
ArithmeticType
&
val
)
{
if
(
j
.
is_number_integer
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_integer_t
*
>();
else
if
(
j
.
is_number_unsigned
())
// unsigned must be checked first, since is_number_integer() == true for unsigned
if
(
j
.
is_number_unsigned
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_unsigned_t
*
>();
else
if
(
j
.
is_number_integer
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_integer_t
*
>();
else
if
(
j
.
is_number_float
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_float_t
*
>();
else
...
...
@@ -702,10 +703,10 @@ template <
int
>
=
0
>
void
from_json
(
Json
const
&
j
,
ArithmeticType
&
val
)
{
if
(
j
.
is_number_integer
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_integer_t
*
>();
else
if
(
j
.
is_number_unsigned
())
if
(
j
.
is_number_unsigned
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_unsigned_t
*
>();
else
if
(
j
.
is_number_integer
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_integer_t
*
>();
else
if
(
j
.
is_number_float
())
val
=
*
j
.
template
get_ptr
<
const
typename
Json
::
number_float_t
*
>();
else
if
(
j
.
is_boolean
())
...
...
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