mirror of
https://github.com/nlohmann/json.git
synced 2026-11-13 15:35:23 +00:00
Use fseek instead of rewind in the UBJSON FILE* test
clang-tidy (bugprone-unsafe-functions) rejects rewind() because it has no error detection. Check the result of fseek() instead. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
1 file changed
+1
-1
@@ -2591,7 +2591,7 @@ TEST_CASE("UBJSON the valueless elements of a whole input are bounded")
|
||||
FILE* const file = std::tmpfile(); // NOLINT(cppcoreguidelines-owning-memory)
|
||||
REQUIRE(file != nullptr);
|
||||
CHECK(std::fwrite(input.data(), 1, input.size(), file) == input.size());
|
||||
std::rewind(file);
|
||||
CHECK(std::fseek(file, 0, SEEK_SET) == 0);
|
||||
ValuelessEventCounter from_file;
|
||||
CHECK(!json::sax_parse(file, &from_file, json::input_format_t::ubjson));
|
||||
CHECK(from_file.error_id == 408);
|
||||
|
||||
Reference in new issue
Block a user