From e5a9b792ecf08ddbcf3b674de3a00f7a919d1858 Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 7 Nov 2019 15:54:34 +0100 Subject: stream: replace STREAM_CTRL_GET_SIZE with a proper entrypoint This is overlay convoluted as a stream control, and important enough to warrant "first class" functionality. --- stream/stream_libarchive.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'stream/stream_libarchive.c') diff --git a/stream/stream_libarchive.c b/stream/stream_libarchive.c index 0e136c175d..ab8fda0f34 100644 --- a/stream/stream_libarchive.c +++ b/stream/stream_libarchive.c @@ -468,17 +468,10 @@ static void archive_entry_close(stream_t *s) free_stream(p->src); } -static int archive_entry_control(stream_t *s, int cmd, void *arg) +static int64_t archive_entry_get_size(stream_t *s) { struct priv *p = s->priv; - switch (cmd) { - case STREAM_CTRL_GET_SIZE: - if (p->entry_size < 0) - break; - *(int64_t *)arg = p->entry_size; - return STREAM_OK; - } - return STREAM_UNSUPPORTED; + return p->entry_size; } static int archive_entry_open(stream_t *stream) @@ -514,7 +507,7 @@ static int archive_entry_open(stream_t *stream) stream->seekable = true; } stream->close = archive_entry_close; - stream->control = archive_entry_control; + stream->get_size = archive_entry_get_size; stream->streaming = true; return STREAM_OK; -- cgit v1.2.3