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
7c8f0a41
Commit
7c8f0a41
authored
Oct 16, 2017
by
Niels Lohmann
Committed by
GitHub
Oct 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #785 from jseward/develop
Fix warning C4706 on Visual Studio 2017 - fixes #784
parents
b27a142e
af990907
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
9 deletions
+38
-9
src/json.hpp
src/json.hpp
+24
-8
test/CMakeLists.txt
test/CMakeLists.txt
+13
-0
test/src/unit-udt.cpp
test/src/unit-udt.cpp
+1
-1
No files found.
src/json.hpp
View file @
7c8f0a41
...
...
@@ -3034,12 +3034,20 @@ class parser
{
case
token_type
:
:
begin_object
:
{
if
(
keep
and
(
not
callback
or
((
keep
=
callback
(
depth
++
,
parse_event_t
::
object_start
,
result
)))))
if
(
keep
)
{
if
(
callback
)
{
keep
=
callback
(
depth
++
,
parse_event_t
::
object_start
,
result
);
}
if
(
not
callback
or
keep
)
{
// explicitly set result to object to cope with {}
result
.
m_type
=
value_t
::
object
;
result
.
m_value
=
value_t
::
object
;
}
}
// read next token
get_token
();
...
...
@@ -3130,12 +3138,20 @@ class parser
case
token_type
:
:
begin_array
:
{
if
(
keep
and
(
not
callback
or
((
keep
=
callback
(
depth
++
,
parse_event_t
::
array_start
,
result
)))))
if
(
keep
)
{
if
(
callback
)
{
// explicitly set result to object to cope with []
keep
=
callback
(
depth
++
,
parse_event_t
::
array_start
,
result
);
}
if
(
not
callback
or
keep
)
{
// explicitly set result to array to cope with []
result
.
m_type
=
value_t
::
array
;
result
.
m_value
=
value_t
::
array
;
}
}
// read next token
get_token
();
...
...
test/CMakeLists.txt
View file @
7c8f0a41
...
...
@@ -66,6 +66,19 @@ set_target_properties(catch_main PROPERTIES
)
target_include_directories
(
catch_main PRIVATE
"thirdparty/catch"
)
# https://stackoverflow.com/questions/2368811/how-to-set-warning-level-in-cmake
if
(
MSVC
)
# Force to always compile with W4
if
(
CMAKE_CXX_FLAGS MATCHES
"/W[0-4]"
)
string
(
REGEX REPLACE
"/W[0-4]"
"/W4"
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
"
)
else
()
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/W4"
)
endif
()
# Disable warning C4389: '==': signed/unsigned mismatch
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
/wd4389"
)
endif
()
#############################################################################
# one executable for each unit test file
#############################################################################
...
...
test/src/unit-udt.cpp
View file @
7c8f0a41
...
...
@@ -201,7 +201,7 @@ void from_json(const BasicJsonType& j, country& c)
{
{
u8"中华人民共和国"
,
country
::
china
},
{
"France"
,
country
::
france
},
{
"Российская Федерация"
,
country
::
russia
}
{
u8
"Российская Федерация"
,
country
::
russia
}
};
const
auto
it
=
m
.
find
(
str
);
...
...
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