aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive/plugins/ZzipArchivePlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2014-05-11 16:02:57 +0200
committerMax Kellermann <max@duempel.org>2014-05-11 17:12:50 +0200
commitf1d07002521a4a98acf130127cf42aef20a5e258 (patch)
tree9eb3b7c5d2aefc47a6ae30055f5257f0a9a55bea /src/archive/plugins/ZzipArchivePlugin.cxx
parente1383a2d8e31bdbe4c0472006d7be5c22cc8345f (diff)
downloadmpd-f1d07002521a4a98acf130127cf42aef20a5e258.tar.gz
mpd-f1d07002521a4a98acf130127cf42aef20a5e258.tar.xz
mpd-f1d07002521a4a98acf130127cf42aef20a5e258.zip
input/plugins: make InputStream the base class
Prepare for adding virtual methods.
Diffstat (limited to '')
-rw-r--r--src/archive/plugins/ZzipArchivePlugin.cxx25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/archive/plugins/ZzipArchivePlugin.cxx b/src/archive/plugins/ZzipArchivePlugin.cxx
index 716b56160..69f984e5e 100644
--- a/src/archive/plugins/ZzipArchivePlugin.cxx
+++ b/src/archive/plugins/ZzipArchivePlugin.cxx
@@ -97,25 +97,24 @@ ZzipArchiveFile::Visit(ArchiveVisitor &visitor)
/* single archive handling */
-struct ZzipInputStream {
- InputStream base;
-
+struct ZzipInputStream final : public InputStream {
ZzipArchiveFile *archive;
ZZIP_FILE *file;
- ZzipInputStream(ZzipArchiveFile &_archive, const char *uri,
- Mutex &mutex, Cond &cond,
+ ZzipInputStream(ZzipArchiveFile &_archive, const char *_uri,
+ Mutex &_mutex, Cond &_cond,
ZZIP_FILE *_file)
- :base(zzip_input_plugin, uri, mutex, cond),
+ :InputStream(zzip_input_plugin, _uri, _mutex, _cond),
archive(&_archive), file(_file) {
- base.ready = true;
//we are seekable (but its not recommendent to do so)
- base.seekable = true;
+ seekable = true;
ZZIP_STAT z_stat;
zzip_file_stat(file, &z_stat);
- base.size = z_stat.st_size;
+ size = z_stat.st_size;
+
+ SetReady();
archive->ref.Increment();
}
@@ -138,11 +137,9 @@ ZzipArchiveFile::OpenStream(const char *pathname,
return nullptr;
}
- ZzipInputStream *zis =
- new ZzipInputStream(*this, pathname,
- mutex, cond,
- _file);
- return &zis->base;
+ return new ZzipInputStream(*this, pathname,
+ mutex, cond,
+ _file);
}
static void