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
8d6b3d44
Unverified
Commit
8d6b3d44
authored
Feb 25, 2018
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
👌
fixed some compiler warnings
parent
8c7f46f7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
18 deletions
+22
-18
include/nlohmann/detail/input/parser.hpp
include/nlohmann/detail/input/parser.hpp
+5
-3
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+5
-3
test/src/unit-class_parser.cpp
test/src/unit-class_parser.cpp
+5
-5
test/src/unit-deserialization.cpp
test/src/unit-deserialization.cpp
+7
-7
No files found.
include/nlohmann/detail/input/parser.hpp
View file @
8d6b3d44
...
...
@@ -96,7 +96,9 @@ class parser
/// a parse error occurred
/// the byte position and the last token are reported
virtual
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
~
SAX
()
=
default
;
};
using
parser_callback_t
=
...
...
@@ -585,7 +587,7 @@ class parser
{
case
token_type
:
:
begin_object
:
{
if
(
not
sax
->
start_object
(
-
1
))
if
(
not
sax
->
start_object
(
std
::
size_t
(
-
1
)
))
{
return
false
;
}
...
...
@@ -654,7 +656,7 @@ class parser
case
token_type
:
:
begin_array
:
{
if
(
not
sax
->
start_array
(
-
1
))
if
(
not
sax
->
start_array
(
std
::
size_t
(
-
1
)
))
{
return
false
;
}
...
...
single_include/nlohmann/json.hpp
View file @
8d6b3d44
...
...
@@ -3219,7 +3219,9 @@ class parser
/// a parse error occurred
/// the byte position and the last token are reported
virtual
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
last_token
)
=
0
;
virtual
~
SAX
()
=
default
;
};
using
parser_callback_t
=
...
...
@@ -3708,7 +3710,7 @@ class parser
{
case
token_type
:
:
begin_object
:
{
if
(
not
sax
->
start_object
(
-
1
))
if
(
not
sax
->
start_object
(
std
::
size_t
(
-
1
)
))
{
return
false
;
}
...
...
@@ -3777,7 +3779,7 @@ class parser
case
token_type
:
:
begin_array
:
{
if
(
not
sax
->
start_array
(
-
1
))
if
(
not
sax
->
start_array
(
std
::
size_t
(
-
1
)
))
{
return
false
;
}
...
...
test/src/unit-class_parser.cpp
View file @
8d6b3d44
...
...
@@ -61,7 +61,7 @@ class SaxEventLogger : public nlohmann::json::SAX
return
true
;
}
bool
number_float
(
json
::
number_float_t
val
,
const
std
::
string
&
s
)
override
bool
number_float
(
json
::
number_float_t
,
const
std
::
string
&
s
)
override
{
events
.
push_back
(
"number_float("
+
s
+
")"
);
return
true
;
...
...
@@ -75,7 +75,7 @@ class SaxEventLogger : public nlohmann::json::SAX
bool
start_object
(
std
::
size_t
elements
)
override
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
events
.
push_back
(
"start_object()"
);
}
...
...
@@ -100,7 +100,7 @@ class SaxEventLogger : public nlohmann::json::SAX
bool
start_array
(
std
::
size_t
elements
)
override
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
events
.
push_back
(
"start_array()"
);
}
...
...
@@ -117,13 +117,13 @@ class SaxEventLogger : public nlohmann::json::SAX
return
true
;
}
bool
binary
(
const
std
::
vector
<
uint8_t
>&
vec
)
override
bool
binary
(
const
std
::
vector
<
uint8_t
>&
)
override
{
events
.
push_back
(
"binary()"
);
return
true
;
}
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
override
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
)
override
{
errored
=
true
;
events
.
push_back
(
"parse_error("
+
std
::
to_string
(
position
)
+
")"
);
...
...
test/src/unit-deserialization.cpp
View file @
8d6b3d44
...
...
@@ -60,7 +60,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
return
true
;
}
bool
number_float
(
json
::
number_float_t
val
,
const
std
::
string
&
s
)
override
bool
number_float
(
json
::
number_float_t
,
const
std
::
string
&
s
)
override
{
events
.
push_back
(
"number_float("
+
s
+
")"
);
return
true
;
...
...
@@ -74,7 +74,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
bool
start_object
(
std
::
size_t
elements
)
override
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
events
.
push_back
(
"start_object()"
);
}
...
...
@@ -99,7 +99,7 @@ struct SaxEventLogger : public nlohmann::json::SAX
bool
start_array
(
std
::
size_t
elements
)
override
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
events
.
push_back
(
"start_array()"
);
}
...
...
@@ -116,13 +116,13 @@ struct SaxEventLogger : public nlohmann::json::SAX
return
true
;
}
bool
binary
(
const
std
::
vector
<
uint8_t
>&
vec
)
override
bool
binary
(
const
std
::
vector
<
uint8_t
>&
)
override
{
events
.
push_back
(
"binary()"
);
return
true
;
}
bool
parse_error
(
int
position
,
const
std
::
string
&
last_token
)
override
bool
parse_error
(
std
::
size_t
position
,
const
std
::
string
&
)
override
{
events
.
push_back
(
"parse_error("
+
std
::
to_string
(
position
)
+
")"
);
return
false
;
...
...
@@ -135,7 +135,7 @@ struct SaxEventLoggerExitAfterStartObject : public SaxEventLogger
{
bool
start_object
(
std
::
size_t
elements
)
override
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
events
.
push_back
(
"start_object()"
);
}
...
...
@@ -160,7 +160,7 @@ struct SaxEventLoggerExitAfterStartArray : public SaxEventLogger
{
bool
start_array
(
std
::
size_t
elements
)
override
{
if
(
elements
==
-
1
)
if
(
elements
==
std
::
size_t
(
-
1
)
)
{
events
.
push_back
(
"start_array()"
);
}
...
...
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