Fix ci_clang_tidy and ci_test_noexceptions for the BSON writer

ci_clang_tidy (modernize-use-auto) flagged the cast initialization in
bson_entry_fits(); ci_test_noexceptions aborted in the "errors at every
position" section of unit-bson.cpp, whose entries all throw, so that section
now needs exceptions like the rest of the error checks.

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann committed 2026-10-31 20:22:33 +01:00
1 parent a624682c1d
commit d746f871c0
3 files changed
+5 -2

No files matched your search

+1 -1
View File
@@ -29649,7 +29649,7 @@ class binary_writer
/// the 32-bit size of BSON
bool bson_entry_fits(const std::size_t start, const std::size_t entry_size, const std::size_t open_containers) const noexcept
{
const std::size_t limit = static_cast<std::size_t>((std::numeric_limits<std::int32_t>::max)());
const auto limit = static_cast<std::size_t>((std::numeric_limits<std::int32_t>::max)());
const std::size_t written = oa.written() - start;
return written <= limit && entry_size <= limit - written && open_containers <= limit - written - entry_size;
}