From f1b26e20c68c36a06fca750cfdd9a59779dd2920 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 13 Nov 2026 11:37:35 +0100 Subject: [PATCH] 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 --- tests/src/unit-ubjson.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/unit-ubjson.cpp b/tests/src/unit-ubjson.cpp index cabb6be96..61b5eae4a 100644 --- a/tests/src/unit-ubjson.cpp +++ b/tests/src/unit-ubjson.cpp @@ -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);