aboutsummaryrefslogtreecommitdiffstats
path: root/src/archive/iso_plugin.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-30 00:53:32 +0100
committerMax Kellermann <max@duempel.org>2009-01-30 00:53:32 +0100
commit82cfce76eb5787f1a24151f6a3840a999ed82659 (patch)
tree05c8ee19ff9bd9cc69e6f50c1aeeacc77efbde44 /src/archive/iso_plugin.c
parentdc1cc7e7e52960cceea5514397ec33f7ffc0dd6d (diff)
downloadmpd-82cfce76eb5787f1a24151f6a3840a999ed82659.tar.gz
mpd-82cfce76eb5787f1a24151f6a3840a999ed82659.tar.xz
mpd-82cfce76eb5787f1a24151f6a3840a999ed82659.zip
archive: replaced setup_stream() with open_stream()
The open_stream() method opens the input_stream. This allows the archive plugin to do its own initialization, and it also allows it to use input_stream.data. We can remove input_stream.archive now, which was unnatural to have in the first place.
Diffstat (limited to '')
-rw-r--r--src/archive/iso_plugin.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/src/archive/iso_plugin.c b/src/archive/iso_plugin.c
index d74d69577..de5582e2c 100644
--- a/src/archive/iso_plugin.c
+++ b/src/archive/iso_plugin.c
@@ -136,23 +136,17 @@ iso_close(struct archive_file *file)
/* single archive handling */
-static void
-iso_setup_stream(struct archive_file *file, struct input_stream *is)
+static bool
+iso_open_stream(struct archive_file *file, struct input_stream *is,
+ const char *pathname)
{
iso_context *context = (iso_context *) file;
//setup file ops
is->plugin = &iso_inputplugin;
//insert back reference
- is->archive = context;
+ is->data = context;
//we are not seekable
is->seekable = false;
-}
-
-
-static bool
-iso_is_open(struct input_stream *is, const char *pathname)
-{
- iso_context *context = (iso_context *) is->archive;
context->statbuf = iso9660_ifs_stat_translate (context->iso, pathname);
@@ -168,7 +162,7 @@ iso_is_open(struct input_stream *is, const char *pathname)
static void
iso_is_close(struct input_stream *is)
{
- iso_context *context = (iso_context *) is->archive;
+ iso_context *context = (iso_context *) is->data;
g_free(context->statbuf);
}
@@ -176,7 +170,7 @@ iso_is_close(struct input_stream *is)
static size_t
iso_is_read(struct input_stream *is, void *ptr, size_t size)
{
- iso_context *context = (iso_context *) is->archive;
+ iso_context *context = (iso_context *) is->data;
int toread, readed = 0;
int no_blocks, cur_block;
size_t left_bytes = context->statbuf->size - context->cur_ofs;
@@ -213,7 +207,7 @@ iso_is_read(struct input_stream *is, void *ptr, size_t size)
static bool
iso_is_eof(struct input_stream *is)
{
- iso_context *context = (iso_context *) is->archive;
+ iso_context *context = (iso_context *) is->data;
return (context->cur_ofs == context->statbuf->size);
}
@@ -238,7 +232,6 @@ static const char *const iso_extensions[] = {
};
static const struct input_plugin iso_inputplugin = {
- .open = iso_is_open,
.close = iso_is_close,
.read = iso_is_read,
.eof = iso_is_eof,
@@ -251,7 +244,7 @@ const struct archive_plugin iso_plugin = {
.open = iso_open,
.scan_reset = iso_scan_reset,
.scan_next = iso_scan_next,
- .setup_stream = iso_setup_stream,
+ .open_stream = iso_open_stream,
.close = iso_close,
.suffixes = iso_extensions
};