From 5de29b860b25bb4ba8b1e02d9b3aee7a81009be0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 6 Feb 2015 21:32:44 +0100 Subject: stream: get rid of remaining uses of the end_pos field Most things stopped using this field for better support of growing files. Go through the trouble to repalce the remaining uses, so it can be removed. Also move the "streaming" field; saves 4 bytes (wow!). --- stream/stream.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'stream/stream.c') diff --git a/stream/stream.c b/stream/stream.c index d4f0fbc320..fd545da7e7 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -676,7 +676,7 @@ bool stream_seek(stream_t *s, int64_t pos) } if (s->mode == STREAM_WRITE) - return s->seekable && s->seek(s, pos)); + return s->seekable && s->seek(s, pos); int64_t newpos = pos; if (s->sector_size) @@ -717,21 +717,7 @@ bool stream_skip(stream_t *s, int64_t len) int stream_control(stream_t *s, int cmd, void *arg) { - if (!s->control) - return STREAM_UNSUPPORTED; - int r = s->control(s, cmd, arg); - if (r == STREAM_UNSUPPORTED) { - // Fallbacks - switch (cmd) { - case STREAM_CTRL_GET_SIZE: - if (s->end_pos > 0) { - *(int64_t *)arg = s->end_pos; - return STREAM_OK; - } - break; - } - } - return r; + return s->control ? s->control(s, cmd, arg) : STREAM_UNSUPPORTED; } void free_stream(stream_t *s) -- cgit v1.2.3