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:
Niels Lohmann committed 2026-11-13 11:37:35 +01:00
1 parent a2cc727dd5
commit f1b26e20c6
1 file changed
+1 -1
+1 -1
View File
@@ -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);