mirror of
https://github.com/nlohmann/json.git
synced 2026-10-16 03:07:12 +00:00
Avoid implicit unsigned char to char conversion in stream tests
Building a std::string from the iterators of a CBOR byte vector narrows each byte, which -fsanitize=implicit-conversion reports for bytes above 0x7F. Construct the string from the raw bytes instead. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
2 files changed
+2
-2
No files matched your search
@@ -371,7 +371,7 @@ TEST_CASE("parsing from a std::istream scans the get area in bulk")
|
||||
{
|
||||
const json j = {{"string", std::string(300, 'x')}, {"array", {1, 2, 3}}, {"number", 1.5}};
|
||||
const std::vector<std::uint8_t> cbor = json::to_cbor(j);
|
||||
const std::string bytes(cbor.begin(), cbor.end());
|
||||
const std::string bytes(reinterpret_cast<const char*>(cbor.data()), cbor.size());
|
||||
for (const std::size_t chunk_size : chunk_sizes())
|
||||
{
|
||||
CAPTURE(chunk_size)
|
||||
|
||||
Reference in new issue
Block a user