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
8b3d2399
Unverified
Commit
8b3d2399
authored
Jun 22, 2020
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚨
remove warnings
parent
29ad2178
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
49 additions
and
59 deletions
+49
-59
.clang-tidy
.clang-tidy
+12
-15
binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+0
-0
input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+2
-2
json_sax.hpp
include/nlohmann/detail/input/json_sax.hpp
+10
-10
lexer.hpp
include/nlohmann/detail/input/lexer.hpp
+1
-1
internal_iterator.hpp
include/nlohmann/detail/iterators/internal_iterator.hpp
+0
-2
json_ref.hpp
include/nlohmann/detail/json_ref.hpp
+13
-6
binary_writer.hpp
include/nlohmann/detail/output/binary_writer.hpp
+7
-19
serializer.hpp
include/nlohmann/detail/output/serializer.hpp
+4
-4
json.hpp
single_include/nlohmann/json.hpp
+0
-0
No files found.
.clang-tidy
View file @
8b3d2399
Checks: '-*,
Checks: '*,
bugprone-*,
-cppcoreguidelines-avoid-goto,
cert-*,
-cppcoreguidelines-avoid-magic-numbers,
clang-analyzer-*,
-cppcoreguidelines-macro-usage,
google-*,
-fuchsia-default-arguments-calls,
-google-runtime-references,
-fuchsia-default-arguments-declarations,
-fuchsia-overloaded-operator,
-google-explicit-constructor,
-google-explicit-constructor,
hicpp-*,
-google-runtime-references,
-hicpp-avoid-goto,
-hicpp-explicit-conversions,
-hicpp-no-array-decay,
-hicpp-no-array-decay,
-hicpp-uppercase-literal-suffix,
-hicpp-uppercase-literal-suffix,
-hicpp-explicit-conversions,
misc-*,
-misc-non-private-member-variables-in-classes,
llvm-*,
-llvm-header-guard,
-llvm-header-guard,
modernize-*,
-llvm-include-order,
-misc-non-private-member-variables-in-classes,
-modernize-use-trailing-return-type,
-modernize-use-trailing-return-type,
performance-*,
portability-*,
readability-*,
-readability-magic-numbers,
-readability-magic-numbers,
-readability-uppercase-literal-suffix'
-readability-uppercase-literal-suffix'
...
...
include/nlohmann/detail/input/binary_reader.hpp
View file @
8b3d2399
This diff is collapsed.
Click to expand it.
include/nlohmann/detail/input/input_adapters.hpp
View file @
8b3d2399
...
@@ -76,7 +76,7 @@ class input_stream_adapter
...
@@ -76,7 +76,7 @@ class input_stream_adapter
{
{
// clear stream flags; we use underlying streambuf I/O, do not
// clear stream flags; we use underlying streambuf I/O, do not
// maintain ifstream flags, except eof
// maintain ifstream flags, except eof
if
(
is
)
if
(
is
!=
nullptr
)
{
{
is
->
clear
(
is
->
rdstate
()
&
std
::
ios
::
eofbit
);
is
->
clear
(
is
->
rdstate
()
&
std
::
ios
::
eofbit
);
}
}
...
@@ -411,7 +411,7 @@ template < typename CharT,
...
@@ -411,7 +411,7 @@ template < typename CharT,
contiguous_bytes_input_adapter
input_adapter
(
CharT
b
)
contiguous_bytes_input_adapter
input_adapter
(
CharT
b
)
{
{
auto
length
=
std
::
strlen
(
reinterpret_cast
<
const
char
*>
(
b
));
auto
length
=
std
::
strlen
(
reinterpret_cast
<
const
char
*>
(
b
));
auto
ptr
=
reinterpret_cast
<
const
char
*>
(
b
);
const
auto
*
ptr
=
reinterpret_cast
<
const
char
*>
(
b
);
return
input_adapter
(
ptr
,
ptr
+
length
);
return
input_adapter
(
ptr
,
ptr
+
length
);
}
}
...
...
include/nlohmann/detail/input/json_sax.hpp
View file @
8b3d2399
...
@@ -269,16 +269,16 @@ class json_sax_dom_parser
...
@@ -269,16 +269,16 @@ class json_sax_dom_parser
switch
((
ex
.
id
/
100
)
%
100
)
switch
((
ex
.
id
/
100
)
%
100
)
{
{
case
1
:
case
1
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
parse_error
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
parse_error
*>
(
&
ex
));
case
4
:
case
4
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
out_of_range
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
out_of_range
*>
(
&
ex
));
// LCOV_EXCL_START
// LCOV_EXCL_START
case
2
:
case
2
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
invalid_iterator
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
invalid_iterator
*>
(
&
ex
));
case
3
:
case
3
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
type_error
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
type_error
*>
(
&
ex
));
case
5
:
case
5
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
other_error
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
other_error
*>
(
&
ex
));
default:
default:
assert
(
false
);
assert
(
false
);
// LCOV_EXCL_STOP
// LCOV_EXCL_STOP
...
@@ -523,16 +523,16 @@ class json_sax_dom_callback_parser
...
@@ -523,16 +523,16 @@ class json_sax_dom_callback_parser
switch
((
ex
.
id
/
100
)
%
100
)
switch
((
ex
.
id
/
100
)
%
100
)
{
{
case
1
:
case
1
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
parse_error
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
parse_error
*>
(
&
ex
));
case
4
:
case
4
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
out_of_range
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
out_of_range
*>
(
&
ex
));
// LCOV_EXCL_START
// LCOV_EXCL_START
case
2
:
case
2
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
invalid_iterator
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
invalid_iterator
*>
(
&
ex
));
case
3
:
case
3
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
type_error
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
type_error
*>
(
&
ex
));
case
5
:
case
5
:
JSON_THROW
(
*
stat
ic_cast
<
const
detail
::
other_error
*>
(
&
ex
));
JSON_THROW
(
*
dynam
ic_cast
<
const
detail
::
other_error
*>
(
&
ex
));
default:
default:
assert
(
false
);
assert
(
false
);
// LCOV_EXCL_STOP
// LCOV_EXCL_STOP
...
...
include/nlohmann/detail/input/lexer.hpp
View file @
8b3d2399
...
@@ -131,7 +131,7 @@ class lexer : public lexer_base<BasicJsonType>
...
@@ -131,7 +131,7 @@ class lexer : public lexer_base<BasicJsonType>
JSON_HEDLEY_PURE
JSON_HEDLEY_PURE
static
char
get_decimal_point
()
noexcept
static
char
get_decimal_point
()
noexcept
{
{
const
auto
loc
=
localeconv
();
const
auto
*
loc
=
localeconv
();
assert
(
loc
!=
nullptr
);
assert
(
loc
!=
nullptr
);
return
(
loc
->
decimal_point
==
nullptr
)
?
'.'
:
*
(
loc
->
decimal_point
);
return
(
loc
->
decimal_point
==
nullptr
)
?
'.'
:
*
(
loc
->
decimal_point
);
}
}
...
...
include/nlohmann/detail/iterators/internal_iterator.hpp
View file @
8b3d2399
...
@@ -18,8 +18,6 @@ template<typename BasicJsonType> struct internal_iterator
...
@@ -18,8 +18,6 @@ template<typename BasicJsonType> struct internal_iterator
typename
BasicJsonType
::
object_t
::
iterator
object_iterator
{};
typename
BasicJsonType
::
object_t
::
iterator
object_iterator
{};
/// iterator for JSON arrays
/// iterator for JSON arrays
typename
BasicJsonType
::
array_t
::
iterator
array_iterator
{};
typename
BasicJsonType
::
array_t
::
iterator
array_iterator
{};
/// iterator for JSON binary arrays
typename
BasicJsonType
::
binary_t
::
container_type
::
iterator
binary_iterator
{};
/// generic iterator for all other types
/// generic iterator for all other types
primitive_iterator_t
primitive_iterator
{};
primitive_iterator_t
primitive_iterator
{};
};
};
...
...
include/nlohmann/detail/json_ref.hpp
View file @
8b3d2399
...
@@ -16,23 +16,30 @@ class json_ref
...
@@ -16,23 +16,30 @@ class json_ref
using
value_type
=
BasicJsonType
;
using
value_type
=
BasicJsonType
;
json_ref
(
value_type
&&
value
)
json_ref
(
value_type
&&
value
)
:
owned_value
(
std
::
move
(
value
)),
value_ref
(
&
owned_value
),
is_rvalue
(
true
)
:
owned_value
(
std
::
move
(
value
))
,
value_ref
(
&
owned_value
)
,
is_rvalue
(
true
)
{}
{}
json_ref
(
const
value_type
&
value
)
json_ref
(
const
value_type
&
value
)
:
value_ref
(
const_cast
<
value_type
*>
(
&
value
)),
is_rvalue
(
false
)
:
value_ref
(
const_cast
<
value_type
*>
(
&
value
))
,
is_rvalue
(
false
)
{}
{}
json_ref
(
std
::
initializer_list
<
json_ref
>
init
)
json_ref
(
std
::
initializer_list
<
json_ref
>
init
)
:
owned_value
(
init
),
value_ref
(
&
owned_value
),
is_rvalue
(
true
)
:
owned_value
(
init
)
,
value_ref
(
&
owned_value
)
,
is_rvalue
(
true
)
{}
{}
template
<
template
<
class
...
Args
,
class
...
Args
,
enable_if_t
<
std
::
is_constructible
<
value_type
,
Args
...
>::
value
,
int
>
=
0
>
enable_if_t
<
std
::
is_constructible
<
value_type
,
Args
...
>::
value
,
int
>
=
0
>
json_ref
(
Args
&&
...
args
)
json_ref
(
Args
&&
...
args
)
:
owned_value
(
std
::
forward
<
Args
>
(
args
)...),
value_ref
(
&
owned_value
),
:
owned_value
(
std
::
forward
<
Args
>
(
args
)...)
is_rvalue
(
true
)
{}
,
value_ref
(
&
owned_value
)
,
is_rvalue
(
true
)
{}
// class should be movable only
// class should be movable only
json_ref
(
json_ref
&&
)
=
default
;
json_ref
(
json_ref
&&
)
=
default
;
...
@@ -63,7 +70,7 @@ class json_ref
...
@@ -63,7 +70,7 @@ class json_ref
private
:
private
:
mutable
value_type
owned_value
=
nullptr
;
mutable
value_type
owned_value
=
nullptr
;
value_type
*
value_ref
=
nullptr
;
value_type
*
value_ref
=
nullptr
;
const
bool
is_rvalue
;
const
bool
is_rvalue
=
true
;
};
};
}
// namespace detail
}
// namespace detail
}
// namespace nlohmann
}
// namespace nlohmann
include/nlohmann/detail/output/binary_writer.hpp
View file @
8b3d2399
...
@@ -573,7 +573,7 @@ class binary_writer
...
@@ -573,7 +573,7 @@ class binary_writer
const
auto
N
=
j
.
m_value
.
binary
->
size
();
const
auto
N
=
j
.
m_value
.
binary
->
size
();
if
(
N
<=
(
std
::
numeric_limits
<
std
::
uint8_t
>::
max
)())
if
(
N
<=
(
std
::
numeric_limits
<
std
::
uint8_t
>::
max
)())
{
{
std
::
uint8_t
output_type
;
std
::
uint8_t
output_type
{}
;
bool
fixed
=
true
;
bool
fixed
=
true
;
if
(
use_ext
)
if
(
use_ext
)
{
{
...
@@ -615,30 +615,18 @@ class binary_writer
...
@@ -615,30 +615,18 @@ class binary_writer
}
}
else
if
(
N
<=
(
std
::
numeric_limits
<
std
::
uint16_t
>::
max
)())
else
if
(
N
<=
(
std
::
numeric_limits
<
std
::
uint16_t
>::
max
)())
{
{
std
::
uint8_t
output_type
;
std
::
uint8_t
output_type
=
use_ext
if
(
use_ext
)
?
0xC8
// ext 16
{
:
0xC5
;
// bin 16
output_type
=
0xC8
;
// ext 16
}
else
{
output_type
=
0xC5
;
// bin 16
}
oa
->
write_character
(
to_char_type
(
output_type
));
oa
->
write_character
(
to_char_type
(
output_type
));
write_number
(
static_cast
<
std
::
uint16_t
>
(
N
));
write_number
(
static_cast
<
std
::
uint16_t
>
(
N
));
}
}
else
if
(
N
<=
(
std
::
numeric_limits
<
std
::
uint32_t
>::
max
)())
else
if
(
N
<=
(
std
::
numeric_limits
<
std
::
uint32_t
>::
max
)())
{
{
std
::
uint8_t
output_type
;
std
::
uint8_t
output_type
=
use_ext
if
(
use_ext
)
?
0xC9
// ext 32
{
:
0xC6
;
// bin 32
output_type
=
0xC9
;
// ext 32
}
else
{
output_type
=
0xC6
;
// bin 32
}
oa
->
write_character
(
to_char_type
(
output_type
));
oa
->
write_character
(
to_char_type
(
output_type
));
write_number
(
static_cast
<
std
::
uint32_t
>
(
N
));
write_number
(
static_cast
<
std
::
uint32_t
>
(
N
));
...
...
include/nlohmann/detail/output/serializer.hpp
View file @
8b3d2399
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
#include <cstdint> // uint8_t
#include <cstdint> // uint8_t
#include <cstdio> // snprintf
#include <cstdio> // snprintf
#include <limits> // numeric_limits
#include <limits> // numeric_limits
#include <string> // string
#include <string> // string
, char_traits
#include <type_traits> // is_same
#include <type_traits> // is_same
#include <utility> // move
#include <utility> // move
...
@@ -59,8 +59,8 @@ class serializer
...
@@ -59,8 +59,8 @@ class serializer
error_handler_t
error_handler_
=
error_handler_t
::
strict
)
error_handler_t
error_handler_
=
error_handler_t
::
strict
)
:
o
(
std
::
move
(
s
))
:
o
(
std
::
move
(
s
))
,
loc
(
std
::
localeconv
())
,
loc
(
std
::
localeconv
())
,
thousands_sep
(
loc
->
thousands_sep
==
nullptr
?
'\0'
:
*
(
loc
->
thousands_sep
))
,
thousands_sep
(
loc
->
thousands_sep
==
nullptr
?
'\0'
:
std
::
char_traits
<
char
>::
to_char_type
(
*
(
loc
->
thousands_sep
)
))
,
decimal_point
(
loc
->
decimal_point
==
nullptr
?
'\0'
:
*
(
loc
->
decimal_point
))
,
decimal_point
(
loc
->
decimal_point
==
nullptr
?
'\0'
:
std
::
char_traits
<
char
>::
to_char_type
(
*
(
loc
->
decimal_point
)
))
,
indent_char
(
ichar
)
,
indent_char
(
ichar
)
,
indent_string
(
512
,
indent_char
)
,
indent_string
(
512
,
indent_char
)
,
error_handler
(
error_handler_
)
,
error_handler
(
error_handler_
)
...
@@ -701,7 +701,7 @@ class serializer
...
@@ -701,7 +701,7 @@ class serializer
}
}
// use a pointer to fill the buffer
// use a pointer to fill the buffer
auto
buffer_ptr
=
number_buffer
.
begin
();
auto
*
buffer_ptr
=
number_buffer
.
begin
();
const
bool
is_negative
=
std
::
is_same
<
NumberType
,
number_integer_t
>::
value
and
not
(
x
>=
0
);
// see issue #755
const
bool
is_negative
=
std
::
is_same
<
NumberType
,
number_integer_t
>::
value
and
not
(
x
>=
0
);
// see issue #755
number_unsigned_t
abs_value
;
number_unsigned_t
abs_value
;
...
...
single_include/nlohmann/json.hpp
View file @
8b3d2399
This diff is collapsed.
Click to expand it.
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