From f1d07002521a4a98acf130127cf42aef20a5e258 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 May 2014 16:02:57 +0200 Subject: input/plugins: make InputStream the base class Prepare for adding virtual methods. --- src/input/plugins/FileInputPlugin.cxx | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src/input/plugins/FileInputPlugin.cxx') diff --git a/src/input/plugins/FileInputPlugin.cxx b/src/input/plugins/FileInputPlugin.cxx index 49dc3df7e..932db2150 100644 --- a/src/input/plugins/FileInputPlugin.cxx +++ b/src/input/plugins/FileInputPlugin.cxx @@ -33,18 +33,16 @@ static constexpr Domain file_domain("file"); -struct FileInputStream { - InputStream base; - +struct FileInputStream final : public InputStream { int fd; - FileInputStream(const char *path, int _fd, off_t size, - Mutex &mutex, Cond &cond) - :base(input_plugin_file, path, mutex, cond), + FileInputStream(const char *path, int _fd, off_t _size, + Mutex &_mutex, Cond &_cond) + :InputStream(input_plugin_file, path, _mutex, _cond), fd(_fd) { - base.size = size; - base.seekable = true; - base.SetReady(); + size = _size; + seekable = true; + SetReady(); } ~FileInputStream() { @@ -88,9 +86,7 @@ input_file_open(const char *filename, posix_fadvise(fd, (off_t)0, st.st_size, POSIX_FADV_SEQUENTIAL); #endif - FileInputStream *fis = new FileInputStream(filename, fd, st.st_size, - mutex, cond); - return &fis->base; + return new FileInputStream(filename, fd, st.st_size, mutex, cond); } static bool -- cgit v1.2.3