From d4b625b48e6bbac61b4128aeeaf44911b2e3e03b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 May 2014 17:14:49 +0200 Subject: InputStream: make various methods abstract Replace InputPlugin attributes. --- src/input/ThreadInputStream.cxx | 41 ++++++----------------------------------- 1 file changed, 6 insertions(+), 35 deletions(-) (limited to 'src/input/ThreadInputStream.cxx') diff --git a/src/input/ThreadInputStream.cxx b/src/input/ThreadInputStream.cxx index 408b757f9..efbb8c9f9 100644 --- a/src/input/ThreadInputStream.cxx +++ b/src/input/ThreadInputStream.cxx @@ -116,8 +116,8 @@ ThreadInputStream::ThreadFunc(void *ctx) tis.ThreadFunc(); } -inline bool -ThreadInputStream::Check2(Error &error) +bool +ThreadInputStream::Check(Error &error) { if (postponed_error.IsDefined()) { error = std::move(postponed_error); @@ -128,27 +128,13 @@ ThreadInputStream::Check2(Error &error) } bool -ThreadInputStream::Check(InputStream *is, Error &error) -{ - ThreadInputStream &tis = *(ThreadInputStream *)is; - return tis.Check2(error); -} - -inline bool -ThreadInputStream::Available2() +ThreadInputStream::IsAvailable() { return !buffer->IsEmpty() || eof || postponed_error.IsDefined(); } -bool -ThreadInputStream::Available(InputStream *is) -{ - ThreadInputStream &tis = *(ThreadInputStream *)is; - return tis.Available2(); -} - inline size_t -ThreadInputStream::Read2(void *ptr, size_t read_size, Error &error) +ThreadInputStream::Read(void *ptr, size_t read_size, Error &error) { while (true) { if (postponed_error.IsDefined()) { @@ -173,23 +159,8 @@ ThreadInputStream::Read2(void *ptr, size_t read_size, Error &error) } } -size_t -ThreadInputStream::Read(InputStream *is, void *ptr, size_t size, - Error &error) -{ - ThreadInputStream &tis = *(ThreadInputStream *)is; - return tis.Read2(ptr, size, error); -} - -inline bool -ThreadInputStream::IsEOF2() -{ - return eof; -} - bool -ThreadInputStream::IsEOF(InputStream *is) +ThreadInputStream::IsEOF() { - ThreadInputStream &tis = *(ThreadInputStream *)is; - return tis.IsEOF2(); + return eof; } -- cgit v1.2.3