aboutsummaryrefslogtreecommitdiffstats
path: root/src/input/plugins/CurlInputPlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-05-11 17:14:49 +0200
committerMax Kellermann <max@duempel.org>2014-05-11 17:14:49 +0200
commitd4b625b48e6bbac61b4128aeeaf44911b2e3e03b (patch)
tree67389c99a559c1b65bf6465c2361a4e3c01d4287 /src/input/plugins/CurlInputPlugin.cxx
parent82337dec44347017ca04fe975e85e6d9e4edb635 (diff)
downloadmpd-d4b625b48e6bbac61b4128aeeaf44911b2e3e03b.tar.gz
mpd-d4b625b48e6bbac61b4128aeeaf44911b2e3e03b.tar.xz
mpd-d4b625b48e6bbac61b4128aeeaf44911b2e3e03b.zip
InputStream: make various methods abstract
Replace InputPlugin attributes.
Diffstat (limited to '')
-rw-r--r--src/input/plugins/CurlInputPlugin.cxx90
1 files changed, 19 insertions, 71 deletions
diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx
index fa93a1d7e..bb7ddcfdb 100644
--- a/src/input/plugins/CurlInputPlugin.cxx
+++ b/src/input/plugins/CurlInputPlugin.cxx
@@ -120,23 +120,6 @@ struct CurlInputStream final : public InputStream {
static InputStream *Open(const char *url, Mutex &mutex, Cond &cond,
Error &error);
- bool Check(Error &error);
-
- bool IsEOF() const {
- return easy == nullptr && buffer.IsEmpty();
- }
-
- bool Seek(InputPlugin::offset_type offset, int whence, Error &error);
-
- Tag *ReadTag();
-
- bool IsAvailable() const {
- return postponed_error.IsDefined() || easy == nullptr ||
- !buffer.IsEmpty();
- }
-
- size_t Read(void *ptr, size_t size, Error &error);
-
bool InitEasy(Error &error);
/**
@@ -180,6 +163,23 @@ struct CurlInputStream final : public InputStream {
* Runs in the I/O thread. The caller must not hold locks.
*/
void RequestDone(CURLcode result, long status);
+
+ /* virtual methods from InputStream */
+ bool Check(Error &error) override;
+
+ bool IsEOF() override {
+ return easy == nullptr && buffer.IsEmpty();
+ }
+
+ Tag *ReadTag() override;
+
+ bool IsAvailable() override {
+ return postponed_error.IsDefined() || easy == nullptr ||
+ !buffer.IsEmpty();
+ }
+
+ size_t Read(void *ptr, size_t size, Error &error) override;
+ bool Seek(offset_type offset, int whence, Error &error) override;
};
class CurlMulti;
@@ -660,14 +660,7 @@ CurlInputStream::Check(Error &error)
return success;
}
-static bool
-input_curl_check(InputStream *is, Error &error)
-{
- CurlInputStream &c = *(CurlInputStream *)is;
- return c.Check(error);
-}
-
-inline Tag *
+Tag *
CurlInputStream::ReadTag()
{
Tag *result = tag;
@@ -675,13 +668,6 @@ CurlInputStream::ReadTag()
return result;
}
-static Tag *
-input_curl_tag(InputStream *is)
-{
- CurlInputStream &c = *(CurlInputStream *)is;
- return c.ReadTag();
-}
-
inline bool
CurlInputStream::FillBuffer(Error &error)
{
@@ -758,14 +744,7 @@ CurlInputStream::CopyIcyTag()
tag = new_tag;
}
-static bool
-input_curl_available(InputStream *is)
-{
- const CurlInputStream &c = *(const CurlInputStream *)is;
- return c.IsAvailable();
-}
-
-inline size_t
+size_t
CurlInputStream::Read(void *ptr, size_t read_size, Error &error)
{
size_t nbytes;
@@ -797,21 +776,6 @@ CurlInputStream::Read(void *ptr, size_t read_size, Error &error)
return nbytes;
}
-static size_t
-input_curl_read(InputStream *is, void *ptr, size_t size,
- Error &error)
-{
- CurlInputStream &c = *(CurlInputStream *)is;
- return c.Read(ptr, size, error);
-}
-
-static bool
-input_curl_eof(gcc_unused InputStream *is)
-{
- const CurlInputStream &c = *(const CurlInputStream *)is;
- return c.IsEOF();
-}
-
inline void
CurlInputStream::HeaderReceived(const char *name, std::string &&value)
{
@@ -1091,15 +1055,6 @@ CurlInputStream::Seek(InputPlugin::offset_type new_offset, int whence,
return true;
}
-static bool
-input_curl_seek(InputStream *is, InputPlugin::offset_type offset,
- int whence,
- Error &error)
-{
- CurlInputStream &c = *(CurlInputStream *)is;
- return c.Seek(offset, whence, error);
-}
-
inline InputStream *
CurlInputStream::Open(const char *url, Mutex &mutex, Cond &cond,
Error &error)
@@ -1136,11 +1091,4 @@ const struct InputPlugin input_plugin_curl = {
input_curl_init,
input_curl_finish,
input_curl_open,
- input_curl_check,
- nullptr,
- input_curl_tag,
- input_curl_available,
- input_curl_read,
- input_curl_eof,
- input_curl_seek,
};