🚨 fix Clang-Tidy warnings
This commit is contained in:
parent
eb27d70518
commit
1fb18d6e10
@ -661,18 +661,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 = use_ext
|
const std::uint8_t output_type = use_ext
|
||||||
? 0xC8 // ext 16
|
? 0xC8 // ext 16
|
||||||
: 0xC5; // bin 16
|
: 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 = use_ext
|
const std::uint8_t output_type = use_ext
|
||||||
? 0xC9 // ext 32
|
? 0xC9 // ext 32
|
||||||
: 0xC6; // bin 32
|
: 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));
|
||||||
@ -1258,8 +1258,8 @@ class binary_writer
|
|||||||
*/
|
*/
|
||||||
static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
|
static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
|
||||||
{
|
{
|
||||||
std::size_t document_size = std::accumulate(value.begin(), value.end(), static_cast<std::size_t>(0),
|
const std::size_t document_size = std::accumulate(value.begin(), value.end(), static_cast<std::size_t>(0),
|
||||||
[](size_t result, const typename BasicJsonType::object_t::value_type & el)
|
[](size_t result, const typename BasicJsonType::object_t::value_type & el)
|
||||||
{
|
{
|
||||||
return result += calc_bson_element_size(el.first, el.second);
|
return result += calc_bson_element_size(el.first, el.second);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -15614,18 +15614,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 = use_ext
|
const std::uint8_t output_type = use_ext
|
||||||
? 0xC8 // ext 16
|
? 0xC8 // ext 16
|
||||||
: 0xC5; // bin 16
|
: 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 = use_ext
|
const std::uint8_t output_type = use_ext
|
||||||
? 0xC9 // ext 32
|
? 0xC9 // ext 32
|
||||||
: 0xC6; // bin 32
|
: 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));
|
||||||
@ -16211,8 +16211,8 @@ class binary_writer
|
|||||||
*/
|
*/
|
||||||
static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
|
static std::size_t calc_bson_object_size(const typename BasicJsonType::object_t& value)
|
||||||
{
|
{
|
||||||
std::size_t document_size = std::accumulate(value.begin(), value.end(), static_cast<std::size_t>(0),
|
const std::size_t document_size = std::accumulate(value.begin(), value.end(), static_cast<std::size_t>(0),
|
||||||
[](size_t result, const typename BasicJsonType::object_t::value_type & el)
|
[](size_t result, const typename BasicJsonType::object_t::value_type & el)
|
||||||
{
|
{
|
||||||
return result += calc_bson_element_size(el.first, el.second);
|
return result += calc_bson_element_size(el.first, el.second);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace utils
|
|||||||
|
|
||||||
inline bool check_testsuite_downloaded()
|
inline bool check_testsuite_downloaded()
|
||||||
{
|
{
|
||||||
std::unique_ptr<std::FILE, decltype(&std::fclose)> file(std::fopen(TEST_DATA_DIRECTORY "/README.md", "r"), &std::fclose);
|
const std::unique_ptr<std::FILE, decltype(&std::fclose)> file(std::fopen(TEST_DATA_DIRECTORY "/README.md", "r"), &std::fclose);
|
||||||
return file != nullptr;
|
return file != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,7 +32,7 @@ TEST_CASE("JSON_ASSERT(x)")
|
|||||||
assert_counter = 0;
|
assert_counter = 0;
|
||||||
CHECK(assert_counter == 0);
|
CHECK(assert_counter == 0);
|
||||||
|
|
||||||
json::iterator it;
|
const json::iterator it;
|
||||||
json j;
|
json j;
|
||||||
|
|
||||||
// in case assertions do not abort execution, an exception is thrown
|
// in case assertions do not abort execution, an exception is thrown
|
||||||
|
|||||||
@ -19,7 +19,7 @@ TEST_CASE("Binary Formats" * doctest::skip())
|
|||||||
SECTION("canada.json")
|
SECTION("canada.json")
|
||||||
{
|
{
|
||||||
const auto* filename = TEST_DATA_DIRECTORY "/nativejson-benchmark/canada.json";
|
const auto* filename = TEST_DATA_DIRECTORY "/nativejson-benchmark/canada.json";
|
||||||
json j = json::parse(std::ifstream(filename));
|
const json j = json::parse(std::ifstream(filename));
|
||||||
|
|
||||||
const auto json_size = j.dump().size();
|
const auto json_size = j.dump().size();
|
||||||
const auto bjdata_1_size = json::to_bjdata(j).size();
|
const auto bjdata_1_size = json::to_bjdata(j).size();
|
||||||
@ -58,7 +58,7 @@ TEST_CASE("Binary Formats" * doctest::skip())
|
|||||||
SECTION("twitter.json")
|
SECTION("twitter.json")
|
||||||
{
|
{
|
||||||
const auto* filename = TEST_DATA_DIRECTORY "/nativejson-benchmark/twitter.json";
|
const auto* filename = TEST_DATA_DIRECTORY "/nativejson-benchmark/twitter.json";
|
||||||
json j = json::parse(std::ifstream(filename));
|
const json j = json::parse(std::ifstream(filename));
|
||||||
|
|
||||||
const auto json_size = j.dump().size();
|
const auto json_size = j.dump().size();
|
||||||
const auto bjdata_1_size = json::to_bjdata(j).size();
|
const auto bjdata_1_size = json::to_bjdata(j).size();
|
||||||
@ -97,7 +97,7 @@ TEST_CASE("Binary Formats" * doctest::skip())
|
|||||||
SECTION("citm_catalog.json")
|
SECTION("citm_catalog.json")
|
||||||
{
|
{
|
||||||
const auto* filename = TEST_DATA_DIRECTORY "/nativejson-benchmark/citm_catalog.json";
|
const auto* filename = TEST_DATA_DIRECTORY "/nativejson-benchmark/citm_catalog.json";
|
||||||
json j = json::parse(std::ifstream(filename));
|
const json j = json::parse(std::ifstream(filename));
|
||||||
|
|
||||||
const auto json_size = j.dump().size();
|
const auto json_size = j.dump().size();
|
||||||
const auto bjdata_1_size = json::to_bjdata(j).size();
|
const auto bjdata_1_size = json::to_bjdata(j).size();
|
||||||
@ -175,7 +175,7 @@ TEST_CASE("Binary Formats" * doctest::skip())
|
|||||||
SECTION("sample.json")
|
SECTION("sample.json")
|
||||||
{
|
{
|
||||||
const auto* filename = TEST_DATA_DIRECTORY "/json_testsuite/sample.json";
|
const auto* filename = TEST_DATA_DIRECTORY "/json_testsuite/sample.json";
|
||||||
json j = json::parse(std::ifstream(filename));
|
const json j = json::parse(std::ifstream(filename));
|
||||||
|
|
||||||
const auto json_size = j.dump().size();
|
const auto json_size = j.dump().size();
|
||||||
const auto bjdata_1_size = json::to_bjdata(j).size();
|
const auto bjdata_1_size = json::to_bjdata(j).size();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user