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
b02ee167
Unverified
Commit
b02ee167
authored
Mar 15, 2019
by
Niels Lohmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚨
fixed warnings
parent
8d6c033f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
100 additions
and
100 deletions
+100
-100
include/nlohmann/detail/input/binary_reader.hpp
include/nlohmann/detail/input/binary_reader.hpp
+10
-10
include/nlohmann/detail/input/input_adapters.hpp
include/nlohmann/detail/input/input_adapters.hpp
+22
-22
include/nlohmann/detail/input/lexer.hpp
include/nlohmann/detail/input/lexer.hpp
+17
-17
include/nlohmann/detail/json_ref.hpp
include/nlohmann/detail/json_ref.hpp
+1
-1
single_include/nlohmann/json.hpp
single_include/nlohmann/json.hpp
+50
-50
No files found.
include/nlohmann/detail/input/binary_reader.hpp
View file @
b02ee167
...
...
@@ -522,7 +522,7 @@ class binary_reader
case
0x95
:
case
0x96
:
case
0x97
:
return
get_cbor_array
(
static_cast
<
std
::
size_t
>
(
current
&
0x1F
));
return
get_cbor_array
(
static_cast
<
std
::
size_t
>
(
static_cast
<
unsigned
int
>
(
current
)
&
0x1Fu
));
case
0x98
:
// array (one-byte uint8_t for n follows)
{
...
...
@@ -576,7 +576,7 @@ class binary_reader
case
0xB5
:
case
0xB6
:
case
0xB7
:
return
get_cbor_object
(
static_cast
<
std
::
size_t
>
(
current
&
0x1F
));
return
get_cbor_object
(
static_cast
<
std
::
size_t
>
(
static_cast
<
unsigned
int
>
(
current
)
&
0x1Fu
));
case
0xB8
:
// map (one-byte uint8_t for n follows)
{
...
...
@@ -638,11 +638,11 @@ class binary_reader
// without such support. An example of a small decoder for
// half-precision floating-point numbers in the C language
// is shown in Fig. 3.
const
int
half
=
(
byte1
<<
8
)
+
byte2
;
const
unsigned
int
half
=
(
byte1
<<
8u
)
+
byte2
;
const
double
val
=
[
&
half
]
{
const
int
exp
=
(
half
>>
10
)
&
0x1F
;
const
int
mant
=
half
&
0x3FF
;
const
unsigned
int
exp
=
(
half
>>
10u
)
&
0x1Fu
;
const
unsigned
int
mant
=
half
&
0x3FFu
;
assert
(
0
<=
exp
and
exp
<=
32
);
assert
(
0
<=
mant
and
mant
<=
1024
);
switch
(
exp
)
...
...
@@ -657,7 +657,7 @@ class binary_reader
return
std
::
ldexp
(
mant
+
1024
,
exp
-
25
);
}
}();
return
sax
->
number_float
((
half
&
0x8000
)
!=
0
return
sax
->
number_float
((
half
&
0x8000
u
)
!=
0
?
static_cast
<
number_float_t
>
(
-
val
)
:
static_cast
<
number_float_t
>
(
val
),
""
);
}
...
...
@@ -728,7 +728,7 @@ class binary_reader
case
0x76
:
case
0x77
:
{
return
get_string
(
input_format_t
::
cbor
,
current
&
0x1F
,
result
);
return
get_string
(
input_format_t
::
cbor
,
static_cast
<
unsigned
int
>
(
current
)
&
0x1Fu
,
result
);
}
case
0x78
:
// UTF-8 string (one-byte uint8_t for n follows)
...
...
@@ -1026,7 +1026,7 @@ class binary_reader
case
0x8D
:
case
0x8E
:
case
0x8F
:
return
get_msgpack_object
(
static_cast
<
std
::
size_t
>
(
current
&
0x0F
));
return
get_msgpack_object
(
static_cast
<
std
::
size_t
>
(
static_cast
<
unsigned
int
>
(
current
)
&
0x0Fu
));
// fixarray
case
0x90
:
...
...
@@ -1045,7 +1045,7 @@ class binary_reader
case
0x9D
:
case
0x9E
:
case
0x9F
:
return
get_msgpack_array
(
static_cast
<
std
::
size_t
>
(
current
&
0x0F
));
return
get_msgpack_array
(
static_cast
<
std
::
size_t
>
(
static_cast
<
unsigned
int
>
(
current
)
&
0x0Fu
));
// fixstr
case
0xA0
:
...
...
@@ -1282,7 +1282,7 @@ class binary_reader
case
0xBE
:
case
0xBF
:
{
return
get_string
(
input_format_t
::
msgpack
,
current
&
0x1F
,
result
);
return
get_string
(
input_format_t
::
msgpack
,
static_cast
<
unsigned
int
>
(
current
)
&
0x1Fu
,
result
);
}
case
0xD9
:
// str 8
...
...
include/nlohmann/detail/input/input_adapters.hpp
View file @
b02ee167
...
...
@@ -165,7 +165,7 @@ struct wide_string_input_helper
else
{
// get the current character
const
auto
wc
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
auto
wc
=
static_cast
<
unsigned
int
>
(
str
[
current_wchar
++
]);
// UTF-32 to UTF-8 encoding
if
(
wc
<
0x80
)
...
...
@@ -175,23 +175,23 @@ struct wide_string_input_helper
}
else
if
(
wc
<=
0x7FF
)
{
utf8_bytes
[
0
]
=
0xC0
|
((
wc
>>
6
)
&
0x1F
);
utf8_bytes
[
1
]
=
0x80
|
(
wc
&
0x3F
);
utf8_bytes
[
0
]
=
0xC0
u
|
((
wc
>>
6u
)
&
0x1Fu
);
utf8_bytes
[
1
]
=
0x80
u
|
(
wc
&
0x3Fu
);
utf8_bytes_filled
=
2
;
}
else
if
(
wc
<=
0xFFFF
)
{
utf8_bytes
[
0
]
=
0xE0
|
((
wc
>>
12
)
&
0x0F
);
utf8_bytes
[
1
]
=
0x80
|
((
wc
>>
6
)
&
0x3F
);
utf8_bytes
[
2
]
=
0x80
|
(
wc
&
0x3F
);
utf8_bytes
[
0
]
=
0xE0
u
|
((
wc
>>
12u
)
&
0x0Fu
);
utf8_bytes
[
1
]
=
0x80
u
|
((
wc
>>
6u
)
&
0x3Fu
);
utf8_bytes
[
2
]
=
0x80
u
|
(
wc
&
0x3Fu
);
utf8_bytes_filled
=
3
;
}
else
if
(
wc
<=
0x10FFFF
)
{
utf8_bytes
[
0
]
=
0xF0
|
((
wc
>>
18
)
&
0x07
);
utf8_bytes
[
1
]
=
0x80
|
((
wc
>>
12
)
&
0x3F
);
utf8_bytes
[
2
]
=
0x80
|
((
wc
>>
6
)
&
0x3F
);
utf8_bytes
[
3
]
=
0x80
|
(
wc
&
0x3F
);
utf8_bytes
[
0
]
=
0xF0
u
|
((
wc
>>
18u
)
&
0x07u
);
utf8_bytes
[
1
]
=
0x80
u
|
((
wc
>>
12u
)
&
0x3Fu
);
utf8_bytes
[
2
]
=
0x80
u
|
((
wc
>>
6u
)
&
0x3Fu
);
utf8_bytes
[
3
]
=
0x80
u
|
(
wc
&
0x3Fu
);
utf8_bytes_filled
=
4
;
}
else
...
...
@@ -220,7 +220,7 @@ struct wide_string_input_helper<WideStringType, 2>
else
{
// get the current character
const
auto
wc
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
auto
wc
=
static_cast
<
unsigned
int
>
(
str
[
current_wchar
++
]);
// UTF-16 to UTF-8 encoding
if
(
wc
<
0x80
)
...
...
@@ -230,27 +230,27 @@ struct wide_string_input_helper<WideStringType, 2>
}
else
if
(
wc
<=
0x7FF
)
{
utf8_bytes
[
0
]
=
0xC0
|
((
wc
>>
6
));
utf8_bytes
[
1
]
=
0x80
|
(
wc
&
0x3F
);
utf8_bytes
[
0
]
=
0xC0
u
|
((
wc
>>
6u
));
utf8_bytes
[
1
]
=
0x80
u
|
(
wc
&
0x3Fu
);
utf8_bytes_filled
=
2
;
}
else
if
(
0xD800
>
wc
or
wc
>=
0xE000
)
{
utf8_bytes
[
0
]
=
0xE0
|
((
wc
>>
12
));
utf8_bytes
[
1
]
=
0x80
|
((
wc
>>
6
)
&
0x3F
);
utf8_bytes
[
2
]
=
0x80
|
(
wc
&
0x3F
);
utf8_bytes
[
0
]
=
0xE0
u
|
((
wc
>>
12u
));
utf8_bytes
[
1
]
=
0x80
u
|
((
wc
>>
6u
)
&
0x3Fu
);
utf8_bytes
[
2
]
=
0x80
u
|
(
wc
&
0x3Fu
);
utf8_bytes_filled
=
3
;
}
else
{
if
(
current_wchar
<
str
.
size
())
{
const
auto
wc2
=
static_cast
<
int
>
(
str
[
current_wchar
++
]);
const
int
charcode
=
0x10000
+
(((
wc
&
0x3FF
)
<<
10
)
|
(
wc2
&
0x3FF
));
utf8_bytes
[
0
]
=
0x
f0
|
(
charcode
>>
18
);
utf8_bytes
[
1
]
=
0x80
|
((
charcode
>>
12
)
&
0x3F
);
utf8_bytes
[
2
]
=
0x80
|
((
charcode
>>
6
)
&
0x3F
);
utf8_bytes
[
3
]
=
0x80
|
(
charcode
&
0x3F
);
const
auto
wc2
=
static_cast
<
unsigned
int
>
(
str
[
current_wchar
++
]);
const
auto
charcode
=
0x10000u
+
(((
wc
&
0x3FFu
)
<<
10u
)
|
(
wc2
&
0x3FFu
));
utf8_bytes
[
0
]
=
0x
F0u
|
(
charcode
>>
18u
);
utf8_bytes
[
1
]
=
0x80
u
|
((
charcode
>>
12u
)
&
0x3Fu
);
utf8_bytes
[
2
]
=
0x80
u
|
((
charcode
>>
6u
)
&
0x3Fu
);
utf8_bytes
[
3
]
=
0x80
u
|
(
charcode
&
0x3Fu
);
utf8_bytes_filled
=
4
;
}
else
...
...
include/nlohmann/detail/input/lexer.hpp
View file @
b02ee167
...
...
@@ -149,22 +149,22 @@ class lexer
assert
(
current
==
'u'
);
int
codepoint
=
0
;
const
auto
factors
=
{
12
,
8
,
4
,
0
};
const
auto
factors
=
{
12
u
,
8u
,
4u
,
0u
};
for
(
const
auto
factor
:
factors
)
{
get
();
if
(
current
>=
'0'
and
current
<=
'9'
)
{
codepoint
+=
((
current
-
0x30
)
<<
factor
);
codepoint
+=
((
static_cast
<
unsigned
int
>
(
current
)
-
0x30u
)
<<
factor
);
}
else
if
(
current
>=
'A'
and
current
<=
'F'
)
{
codepoint
+=
((
current
-
0x37
)
<<
factor
);
codepoint
+=
((
static_cast
<
unsigned
int
>
(
current
)
-
0x37u
)
<<
factor
);
}
else
if
(
current
>=
'a'
and
current
<=
'f'
)
{
codepoint
+=
((
current
-
0x57
)
<<
factor
);
codepoint
+=
((
static_cast
<
unsigned
int
>
(
current
)
-
0x57u
)
<<
factor
);
}
else
{
...
...
@@ -324,13 +324,13 @@ class lexer
// overwrite codepoint
codepoint
=
// high surrogate occupies the most significant 22 bits
(
codepoint1
<<
10
)
(
static_cast
<
unsigned
int
>
(
codepoint1
)
<<
10u
)
// low surrogate occupies the least significant 15 bits
+
codepoint2
+
static_cast
<
unsigned
int
>
(
codepoint2
)
// there is still the 0xD800, 0xDC00 and 0x10000 noise
// in the result so we have to subtract with:
// (0xD800 << 10) + DC00 - 0x10000 = 0x35FDC00
-
0x35FDC00
;
-
0x35FDC00
u
;
}
else
{
...
...
@@ -365,23 +365,23 @@ class lexer
else
if
(
codepoint
<=
0x7FF
)
{
// 2-byte characters: 110xxxxx 10xxxxxx
add
(
0xC0
|
(
codepoint
>>
6
));
add
(
0x80
|
(
codepoint
&
0x3F
));
add
(
0xC0
u
|
(
static_cast
<
unsigned
int
>
(
codepoint
)
>>
6u
));
add
(
0x80
u
|
(
static_cast
<
unsigned
int
>
(
codepoint
)
&
0x3Fu
));
}
else
if
(
codepoint
<=
0xFFFF
)
{
// 3-byte characters: 1110xxxx 10xxxxxx 10xxxxxx
add
(
0xE0
|
(
codepoint
>>
12
));
add
(
0x80
|
((
codepoint
>>
6
)
&
0x3F
));
add
(
0x80
|
(
codepoint
&
0x3F
));
add
(
0xE0
u
|
(
static_cast
<
unsigned
int
>
(
codepoint
)
>>
12u
));
add
(
0x80
u
|
((
static_cast
<
unsigned
int
>
(
codepoint
)
>>
6u
)
&
0x3Fu
));
add
(
0x80
u
|
(
static_cast
<
unsigned
int
>
(
codepoint
)
&
0x3Fu
));
}
else
{
// 4-byte characters: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
add
(
0xF0
|
(
codepoint
>>
18
));
add
(
0x80
|
((
codepoint
>>
12
)
&
0x3F
));
add
(
0x80
|
((
codepoint
>>
6
)
&
0x3F
));
add
(
0x80
|
(
codepoint
&
0x3F
));
add
(
0xF0
u
|
(
static_cast
<
unsigned
int
>
(
codepoint
)
>>
18u
));
add
(
0x80
u
|
((
static_cast
<
unsigned
int
>
(
codepoint
)
>>
12u
)
&
0x3Fu
));
add
(
0x80
u
|
((
static_cast
<
unsigned
int
>
(
codepoint
)
>>
6u
)
&
0x3Fu
));
add
(
0x80
u
|
(
static_cast
<
unsigned
int
>
(
codepoint
)
&
0x3Fu
));
}
break
;
...
...
@@ -1298,7 +1298,7 @@ scan_number_done:
if
(
JSON_LIKELY
(
current
!=
std
::
char_traits
<
char
>::
eof
()))
{
assert
(
token_string
.
size
()
!=
0
);
assert
(
not
token_string
.
empty
()
);
token_string
.
pop_back
();
}
}
...
...
include/nlohmann/detail/json_ref.hpp
View file @
b02ee167
...
...
@@ -35,7 +35,7 @@ class json_ref
is_rvalue
(
true
)
{}
// class should be movable only
json_ref
(
json_ref
&&
)
=
default
;
json_ref
(
json_ref
&&
)
noexcept
=
default
;
json_ref
(
const
json_ref
&
)
=
delete
;
json_ref
&
operator
=
(
const
json_ref
&
)
=
delete
;
json_ref
&
operator
=
(
json_ref
&&
)
=
delete
;
...
...
single_include/nlohmann/json.hpp
View file @
b02ee167
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