From 7b3851e9473e74043342d414c056c2ef87c2f261 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 26 Jul 2020 22:28:56 +0300 Subject: refactor: Drop unused CBufferedFile::Seek() --- src/streams.h | 12 ------------ src/test/fuzz/buffered_file.cpp | 12 ++++-------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/src/streams.h b/src/streams.h index e1d1b0eab2..6ce8065da8 100644 --- a/src/streams.h +++ b/src/streams.h @@ -814,18 +814,6 @@ public: return true; } - bool Seek(uint64_t nPos) { - long nLongPos = nPos; - if (nPos != (uint64_t)nLongPos) - return false; - if (fseek(src, nLongPos, SEEK_SET)) - return false; - nLongPos = ftell(src); - nSrcPos = nLongPos; - nReadPos = nLongPos; - return true; - } - //! prevent reading beyond a certain position //! no argument removes the limit bool SetLimit(uint64_t nPos = std::numeric_limits::max()) { diff --git a/src/test/fuzz/buffered_file.cpp b/src/test/fuzz/buffered_file.cpp index 6bbd13eb5c..e575640be5 100644 --- a/src/test/fuzz/buffered_file.cpp +++ b/src/test/fuzz/buffered_file.cpp @@ -31,7 +31,7 @@ void test_one_input(const std::vector& buffer) if (opt_buffered_file && fuzzed_file != nullptr) { bool setpos_fail = false; while (fuzzed_data_provider.ConsumeBool()) { - switch (fuzzed_data_provider.ConsumeIntegralInRange(0, 5)) { + switch (fuzzed_data_provider.ConsumeIntegralInRange(0, 4)) { case 0: { std::array arr{}; try { @@ -41,20 +41,16 @@ void test_one_input(const std::vector& buffer) break; } case 1: { - opt_buffered_file->Seek(fuzzed_data_provider.ConsumeIntegralInRange(0, 4096)); - break; - } - case 2: { opt_buffered_file->SetLimit(fuzzed_data_provider.ConsumeIntegralInRange(0, 4096)); break; } - case 3: { + case 2: { if (!opt_buffered_file->SetPos(fuzzed_data_provider.ConsumeIntegralInRange(0, 4096))) { setpos_fail = true; } break; } - case 4: { + case 3: { if (setpos_fail) { // Calling FindByte(...) after a failed SetPos(...) call may result in an infinite loop. break; @@ -65,7 +61,7 @@ void test_one_input(const std::vector& buffer) } break; } - case 5: { + case 4: { ReadFromStream(fuzzed_data_provider, *opt_buffered_file); break; } -- cgit v1.2.3