From 78b4dc6509aa179a9b222e1a48e9b1939f59c1f1 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Fri, 24 Mar 2023 18:12:55 +0100 Subject: [PATCH] Remove unused Stream#Peek() --- lib/base/fifo.cpp | 13 ------------- lib/base/fifo.hpp | 1 - lib/base/stream.cpp | 5 ----- lib/base/stream.hpp | 11 ----------- 4 files changed, 30 deletions(-) diff --git a/lib/base/fifo.cpp b/lib/base/fifo.cpp index 8653f5176..df5fce509 100644 --- a/lib/base/fifo.cpp +++ b/lib/base/fifo.cpp @@ -54,19 +54,6 @@ void FIFO::Optimize() } } -size_t FIFO::Peek(void *buffer, size_t count, bool allow_partial) -{ - ASSERT(allow_partial); - - if (count > m_DataSize) - count = m_DataSize; - - if (buffer) - std::memcpy(buffer, m_Buffer + m_Offset, count); - - return count; -} - /** * Implements IOQueue::Read. */ diff --git a/lib/base/fifo.hpp b/lib/base/fifo.hpp index a8273c1ba..dbb37b570 100644 --- a/lib/base/fifo.hpp +++ b/lib/base/fifo.hpp @@ -23,7 +23,6 @@ public: ~FIFO() override; - size_t Peek(void *buffer, size_t count, bool allow_partial = false) override; size_t Read(void *buffer, size_t count, bool allow_partial = false) override; void Write(const void *buffer, size_t count) override; void Close() override; diff --git a/lib/base/stream.cpp b/lib/base/stream.cpp index e55838523..e4a66586e 100644 --- a/lib/base/stream.cpp +++ b/lib/base/stream.cpp @@ -29,11 +29,6 @@ void Stream::Shutdown() BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support Shutdown().")); } -size_t Stream::Peek(void *buffer, size_t count, bool allow_partial) -{ - BOOST_THROW_EXCEPTION(std::runtime_error("Stream does not support Peek().")); -} - void Stream::SignalDataAvailable() { OnDataAvailable(this); diff --git a/lib/base/stream.hpp b/lib/base/stream.hpp index 6bc8fed72..69bdff872 100644 --- a/lib/base/stream.hpp +++ b/lib/base/stream.hpp @@ -54,17 +54,6 @@ class Stream : public Object public: DECLARE_PTR_TYPEDEFS(Stream); - /** - * Reads data from the stream without removing it from the stream buffer. - * - * @param buffer The buffer where data should be stored. May be nullptr if you're - * not actually interested in the data. - * @param count The number of bytes to read from the queue. - * @param allow_partial Whether to allow partial reads. - * @returns The number of bytes actually read. - */ - virtual size_t Peek(void *buffer, size_t count, bool allow_partial = false); - /** * Reads data from the stream. *