🚨 fixed some clang-tidy warnings
This commit is contained in:
parent
fa722d5ac3
commit
858e75c4df
29 changed files with 214 additions and 204 deletions
|
@ -403,8 +403,8 @@ class binary_reader
|
|||
return false;
|
||||
}
|
||||
|
||||
const unsigned char byte1 = static_cast<unsigned char>(byte1_raw);
|
||||
const unsigned char byte2 = static_cast<unsigned char>(byte2_raw);
|
||||
const auto byte1 = static_cast<unsigned char>(byte1_raw);
|
||||
const auto byte2 = static_cast<unsigned char>(byte2_raw);
|
||||
|
||||
// code from RFC 7049, Appendix D, Figure 3:
|
||||
// As half-precision floating-point numbers were only added
|
||||
|
@ -1039,6 +1039,7 @@ class binary_reader
|
|||
}
|
||||
|
||||
if (len != std::size_t(-1))
|
||||
{
|
||||
for (std::size_t i = 0; i < len; ++i)
|
||||
{
|
||||
if (JSON_UNLIKELY(not parse_cbor_internal()))
|
||||
|
@ -1046,6 +1047,7 @@ class binary_reader
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
while (get() != 0xFF)
|
||||
|
@ -1696,5 +1698,5 @@ class binary_reader
|
|||
/// the SAX parser
|
||||
json_sax_t* sax = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace detail
|
||||
} // namespace nlohmann
|
||||
|
|
|
@ -71,6 +71,8 @@ class input_stream_adapter : public input_adapter_protocol
|
|||
// delete because of pointer members
|
||||
input_stream_adapter(const input_stream_adapter&) = delete;
|
||||
input_stream_adapter& operator=(input_stream_adapter&) = delete;
|
||||
input_stream_adapter(input_stream_adapter&&) = delete;
|
||||
input_stream_adapter& operator=(input_stream_adapter&&) = delete;
|
||||
|
||||
// std::istream/std::streambuf use std::char_traits<char>::to_int_type, to
|
||||
// ensure that std::char_traits<char>::eof() and the character 0xFF do not
|
||||
|
@ -97,6 +99,9 @@ class input_buffer_adapter : public input_adapter_protocol
|
|||
// delete because of pointer members
|
||||
input_buffer_adapter(const input_buffer_adapter&) = delete;
|
||||
input_buffer_adapter& operator=(input_buffer_adapter&) = delete;
|
||||
input_buffer_adapter(input_buffer_adapter&&) = delete;
|
||||
input_buffer_adapter& operator=(input_buffer_adapter&&) = delete;
|
||||
~input_buffer_adapter() override = default;
|
||||
|
||||
std::char_traits<char>::int_type get_character() noexcept override
|
||||
{
|
||||
|
@ -131,7 +136,7 @@ struct wide_string_input_helper
|
|||
else
|
||||
{
|
||||
// get the current character
|
||||
const int wc = static_cast<int>(str[current_wchar++]);
|
||||
const auto wc = static_cast<int>(str[current_wchar++]);
|
||||
|
||||
// UTF-32 to UTF-8 encoding
|
||||
if (wc < 0x80)
|
||||
|
@ -186,7 +191,7 @@ struct wide_string_input_helper<WideStringType, 2>
|
|||
else
|
||||
{
|
||||
// get the current character
|
||||
const int wc = static_cast<int>(str[current_wchar++]);
|
||||
const auto wc = static_cast<int>(str[current_wchar++]);
|
||||
|
||||
// UTF-16 to UTF-8 encoding
|
||||
if (wc < 0x80)
|
||||
|
@ -211,7 +216,7 @@ struct wide_string_input_helper<WideStringType, 2>
|
|||
{
|
||||
if (current_wchar < str.size())
|
||||
{
|
||||
const int wc2 = static_cast<int>(str[current_wchar++]);
|
||||
const auto wc2 = static_cast<int>(str[current_wchar++]);
|
||||
const int charcode = 0x10000 + (((wc & 0x3FF) << 10) | (wc2 & 0x3FF));
|
||||
utf8_bytes[0] = 0xf0 | (charcode >> 18);
|
||||
utf8_bytes[1] = 0x80 | ((charcode >> 12) & 0x3F);
|
||||
|
@ -381,5 +386,5 @@ class input_adapter
|
|||
/// the actual adapter
|
||||
input_adapter_t ia = nullptr;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace detail
|
||||
} // namespace nlohmann
|
||||
|
|
|
@ -181,7 +181,7 @@ class json_sax_dom_parser
|
|||
return true;
|
||||
}
|
||||
|
||||
bool number_float(number_float_t val, const string_t&)
|
||||
bool number_float(number_float_t val, const string_t& /*unused*/)
|
||||
{
|
||||
handle_value(val);
|
||||
return true;
|
||||
|
@ -238,7 +238,7 @@ class json_sax_dom_parser
|
|||
return true;
|
||||
}
|
||||
|
||||
bool parse_error(std::size_t, const std::string&,
|
||||
bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
|
||||
const detail::exception& ex)
|
||||
{
|
||||
errored = true;
|
||||
|
@ -358,7 +358,7 @@ class json_sax_dom_callback_parser
|
|||
return true;
|
||||
}
|
||||
|
||||
bool number_float(number_float_t val, const string_t&)
|
||||
bool number_float(number_float_t val, const string_t& /*unused*/)
|
||||
{
|
||||
handle_value(val);
|
||||
return true;
|
||||
|
@ -496,7 +496,7 @@ class json_sax_dom_callback_parser
|
|||
return true;
|
||||
}
|
||||
|
||||
bool parse_error(std::size_t, const std::string&,
|
||||
bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/,
|
||||
const detail::exception& ex)
|
||||
{
|
||||
errored = true;
|
||||
|
@ -642,37 +642,37 @@ class json_sax_acceptor
|
|||
return true;
|
||||
}
|
||||
|
||||
bool boolean(bool)
|
||||
bool boolean(bool /*unused*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool number_integer(number_integer_t)
|
||||
bool number_integer(number_integer_t /*unused*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool number_unsigned(number_unsigned_t)
|
||||
bool number_unsigned(number_unsigned_t /*unused*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool number_float(number_float_t, const string_t&)
|
||||
bool number_float(number_float_t /*unused*/, const string_t& /*unused*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool string(string_t&)
|
||||
bool string(string_t& /*unused*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool start_object(std::size_t = std::size_t(-1))
|
||||
bool start_object(std::size_t /*unused*/ = std::size_t(-1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool key(string_t&)
|
||||
bool key(string_t& /*unused*/)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -682,7 +682,7 @@ class json_sax_acceptor
|
|||
return true;
|
||||
}
|
||||
|
||||
bool start_array(std::size_t = std::size_t(-1))
|
||||
bool start_array(std::size_t /*unused*/ = std::size_t(-1))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
@ -692,11 +692,11 @@ class json_sax_acceptor
|
|||
return true;
|
||||
}
|
||||
|
||||
bool parse_error(std::size_t, const std::string&, const detail::exception&)
|
||||
bool parse_error(std::size_t /*unused*/, const std::string& /*unused*/, const detail::exception& /*unused*/)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
} // namespace detail
|
||||
|
||||
}
|
||||
} // namespace nlohmann
|
||||
|
|
|
@ -104,7 +104,10 @@ class lexer
|
|||
|
||||
// delete because of pointer members
|
||||
lexer(const lexer&) = delete;
|
||||
lexer(lexer&&) noexcept = default;
|
||||
lexer& operator=(lexer&) = delete;
|
||||
lexer& operator=(lexer&&) noexcept = default;
|
||||
~lexer() = default;
|
||||
|
||||
private:
|
||||
/////////////////////
|
||||
|
@ -1208,16 +1211,8 @@ scan_number_done:
|
|||
{
|
||||
if (get() == 0xEF)
|
||||
{
|
||||
if (get() == 0xBB and get() == 0xBF)
|
||||
{
|
||||
// we completely parsed the BOM
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// after reading 0xEF, an unexpected character followed
|
||||
return false;
|
||||
}
|
||||
// check if we completely parse the BOM
|
||||
return get() == 0xBB and get() == 0xBF;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1329,5 +1324,5 @@ scan_number_done:
|
|||
/// the decimal point
|
||||
const char decimal_point_char = '.';
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace detail
|
||||
} // namespace nlohmann
|
||||
|
|
|
@ -484,5 +484,5 @@ class parser
|
|||
/// whether to throw exceptions in case of errors
|
||||
const bool allow_exceptions = true;
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace detail
|
||||
} // namespace nlohmann
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue