aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive/Iso9660ArchivePlugin.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-01-29 23:36:58 +0100
committerMax Kellermann <max@duempel.org>2013-01-30 15:30:19 +0100
commit16afdfd8747a1bd5af2d1acb4e0845bf9d0b89e7 (patch)
tree39afbcabd53af0000a8b200301bbfc1178fdadd5 /src/archive/Iso9660ArchivePlugin.cxx
parent701fff03d27be629f416534744217eadbde11da4 (diff)
downloadmpd-16afdfd8747a1bd5af2d1acb4e0845bf9d0b89e7.tar.gz
mpd-16afdfd8747a1bd5af2d1acb4e0845bf9d0b89e7.tar.xz
mpd-16afdfd8747a1bd5af2d1acb4e0845bf9d0b89e7.zip
ArchivePlugin: move instance methods to class ArchiveFile
Diffstat (limited to 'src/archive/Iso9660ArchivePlugin.cxx')
-rw-r--r--src/archive/Iso9660ArchivePlugin.cxx48
1 files changed, 20 insertions, 28 deletions
diff --git a/src/archive/Iso9660ArchivePlugin.cxx b/src/archive/Iso9660ArchivePlugin.cxx
index 21e2fa41c..97fd8bd52 100644
--- a/src/archive/Iso9660ArchivePlugin.cxx
+++ b/src/archive/Iso9660ArchivePlugin.cxx
@@ -41,7 +41,7 @@
#define CEILING(x, y) ((x+(y-1))/y)
-class Iso9660ArchiveFile : public ArchiveFile {
+class Iso9660ArchiveFile final : public ArchiveFile {
public:
RefCount ref;
@@ -60,6 +60,16 @@ public:
}
void Visit(const char *path, ArchiveVisitor &visitor);
+
+ virtual void Close() override {
+ Unref();
+ }
+
+ virtual void Visit(ArchiveVisitor &visitor) override;
+
+ virtual input_stream *OpenStream(const char *path,
+ Mutex &mutex, Cond &cond,
+ GError **error_r) override;
};
extern const struct input_plugin iso9660_input_plugin;
@@ -118,22 +128,10 @@ iso9660_archive_open(const char *pathname, GError **error_r)
return new Iso9660ArchiveFile(iso);
}
-static void
-iso9660_archive_visit(ArchiveFile *file, ArchiveVisitor &visitor)
-{
- Iso9660ArchiveFile *context =
- (Iso9660ArchiveFile *)file;
-
- context->Visit("/", visitor);
-}
-
-static void
-iso9660_archive_close(ArchiveFile *file)
+void
+Iso9660ArchiveFile::Visit(ArchiveVisitor &visitor)
{
- Iso9660ArchiveFile *context =
- (Iso9660ArchiveFile *)file;
-
- context->Unref();
+ Visit("/", visitor);
}
/* single archive handling */
@@ -165,15 +163,12 @@ struct Iso9660InputStream {
}
};
-static struct input_stream *
-iso9660_archive_open_stream(ArchiveFile *file, const char *pathname,
- Mutex &mutex, Cond &cond,
- GError **error_r)
+input_stream *
+Iso9660ArchiveFile::OpenStream(const char *pathname,
+ Mutex &mutex, Cond &cond,
+ GError **error_r)
{
- Iso9660ArchiveFile *context =
- (Iso9660ArchiveFile *)file;
-
- auto statbuf = iso9660_ifs_stat_translate(context->iso, pathname);
+ auto statbuf = iso9660_ifs_stat_translate(iso, pathname);
if (statbuf == nullptr) {
g_set_error(error_r, iso9660_quark(), 0,
"not found in the ISO file: %s", pathname);
@@ -181,7 +176,7 @@ iso9660_archive_open_stream(ArchiveFile *file, const char *pathname,
}
Iso9660InputStream *iis =
- new Iso9660InputStream(*context, pathname, mutex, cond,
+ new Iso9660InputStream(*this, pathname, mutex, cond,
statbuf);
return &iis->base;
}
@@ -267,8 +262,5 @@ const struct archive_plugin iso9660_archive_plugin = {
nullptr,
nullptr,
iso9660_archive_open,
- iso9660_archive_visit,
- iso9660_archive_open_stream,
- iso9660_archive_close,
iso9660_archive_extensions,
};