diff options
author | Max Kellermann <max@duempel.org> | 2013-01-29 21:21:07 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-29 21:21:07 +0100 |
commit | 9f0fb8f6a8f58ff9a760d40bccfadd010b9ddef9 (patch) | |
tree | e8f5dc8f9e19cfb0873b2f761e26b8a9da7b5e36 /src/archive/Bzip2ArchivePlugin.cxx | |
parent | a42f9fd4e2ccb164c0634571da9903e6a2aa507a (diff) | |
download | mpd-9f0fb8f6a8f58ff9a760d40bccfadd010b9ddef9.tar.gz mpd-9f0fb8f6a8f58ff9a760d40bccfadd010b9ddef9.tar.xz mpd-9f0fb8f6a8f58ff9a760d40bccfadd010b9ddef9.zip |
ArchivePlugin: replace scan_reset(), scan_next() with visit()
Add the interface ArchiveVisitor.
Diffstat (limited to 'src/archive/Bzip2ArchivePlugin.cxx')
-rw-r--r-- | src/archive/Bzip2ArchivePlugin.cxx | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/archive/Bzip2ArchivePlugin.cxx b/src/archive/Bzip2ArchivePlugin.cxx index 4b0d5223e..be7388d5b 100644 --- a/src/archive/Bzip2ArchivePlugin.cxx +++ b/src/archive/Bzip2ArchivePlugin.cxx @@ -25,6 +25,7 @@ #include "Bzip2ArchivePlugin.hxx" #include "ArchiveInternal.hxx" #include "ArchivePlugin.hxx" +#include "ArchiveVisitor.hxx" #include "InputInternal.hxx" #include "InputStream.hxx" #include "InputPlugin.hxx" @@ -47,7 +48,6 @@ struct Bzip2ArchiveFile { struct refcount ref; char *name; - bool reset; struct input_stream *istream; Bzip2ArchiveFile() { @@ -152,24 +152,11 @@ bz2_open(const char *pathname, GError **error_r) } static void -bz2_scan_reset(struct archive_file *file) +bz2_visit(archive_file *file, ArchiveVisitor &visitor) { Bzip2ArchiveFile *context = (Bzip2ArchiveFile *) file; - context->reset = true; -} - -static const char * -bz2_scan_next(struct archive_file *file) -{ - Bzip2ArchiveFile *context = (Bzip2ArchiveFile *) file; - const char *name = NULL; - - if (context->reset) { - name = context->name; - context->reset = false; - } - return name; + visitor.VisitArchiveEntry(context->name); } static void @@ -318,8 +305,7 @@ const struct archive_plugin bz2_archive_plugin = { nullptr, nullptr, bz2_open, - bz2_scan_reset, - bz2_scan_next, + bz2_visit, bz2_open_stream, bz2_close, bz2_extensions, |