🚨 fix warnings

This commit is contained in:
Niels Lohmann 2021-01-28 21:53:18 +01:00
parent 8b362b52cb
commit 3393ce0478
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
5 changed files with 9 additions and 9 deletions

View File

@ -1447,7 +1447,7 @@ scan_number_done:
{
// escape control characters
std::array<char, 9> cs{{}};
(std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-varar)
(std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
result += cs.data();
}
else

View File

@ -1509,7 +1509,7 @@ class binary_writer
void write_number(const NumberType n)
{
// step 1: write number to array of length NumberType
std::array<CharType, sizeof(NumberType)> vec;
std::array<CharType, sizeof(NumberType)> vec{};
std::memcpy(vec.data(), &n, sizeof(NumberType));
// step 2: write array to output (with possible reordering)

View File

@ -5936,7 +5936,7 @@ class basic_json
@since version 1.0.0
*/
void swap(array_t& other)
void swap(array_t& other) // NOLINT(bugprone-exception-escape)
{
// swap only works for arrays
if (JSON_HEDLEY_LIKELY(is_array()))
@ -5969,7 +5969,7 @@ class basic_json
@since version 1.0.0
*/
void swap(object_t& other)
void swap(object_t& other) // NOLINT(bugprone-exception-escape)
{
// swap only works for objects
if (JSON_HEDLEY_LIKELY(is_object()))
@ -6002,7 +6002,7 @@ class basic_json
@since version 1.0.0
*/
void swap(string_t& other)
void swap(string_t& other) // NOLINT(bugprone-exception-escape)
{
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_string()))
@ -6035,7 +6035,7 @@ class basic_json
@since version 3.8.0
*/
void swap(binary_t& other)
void swap(binary_t& other) // NOLINT(bugprone-exception-escape)
{
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_binary()))
@ -6049,7 +6049,7 @@ class basic_json
}
/// @copydoc swap(binary_t&)
void swap(typename binary_t::container_type& other)
void swap(typename binary_t::container_type& other) // NOLINT(bugprone-exception-escape)
{
// swap only works for strings
if (JSON_HEDLEY_LIKELY(is_binary()))

View File

@ -7436,7 +7436,7 @@ scan_number_done:
{
// escape control characters
std::array<char, 9> cs{{}};
(std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-varar)
(std::snprintf)(cs.data(), cs.size(), "<U+%.4X>", static_cast<unsigned char>(c)); // NOLINT(cppcoreguidelines-pro-type-vararg,hicpp-vararg)
result += cs.data();
}
else

View File

@ -611,7 +611,7 @@ TEST_CASE("CBOR")
SECTION("-32768..-129 (int 16)")
{
for (int16_t i = -32768; i <= -129; ++i)
for (int16_t i = -32768; i <= int16_t(-129); ++i)
{
CAPTURE(i)