From 1c35794efd7d025457e527b61f7c23fe375c2f5a Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 6 Jun 2013 20:39:58 +0200 Subject: stream: remove stream_reset() This function was called in various places. Most time, it was used before a seek. In other cases, the purpose was apparently resetting the EOF flag. As far as I can see, this makes no sense anymore. At least the stream_reset() calls paired with stream_seek() are completely pointless. A seek will either seek inside the buffer (and reset the EOF flag), or do an actual seek and reset all state. --- stream/stream.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'stream/stream.c') diff --git a/stream/stream.c b/stream/stream.c index d77ecfae6e..d27b3f5f3f 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -304,7 +304,8 @@ static int stream_reconnect(stream_t *s) return 0; s->eof = 1; - stream_reset(s); + s->pos = 0; + s->buf_pos = s->buf_len = 0; // Some streams (internal http.c) don't support STREAM_CTRL_RECONNECT, // but do it when trying to seek. @@ -523,6 +524,7 @@ static int stream_seek_unbuffered(stream_t *s, int64_t newpos) } } } + s->eof = 0; // EOF reset when seek succeeds. return -1; } @@ -561,7 +563,6 @@ static int stream_seek_long(stream_t *s, int64_t pos) break; // EOF } - s->eof = 0; // EOF reset when seek succeeds. while (stream_fill_buffer(s) > 0) { if (pos <= s->buf_len) { s->buf_pos = pos; // byte position in sector @@ -623,15 +624,6 @@ int stream_skip(stream_t *s, int64_t len) return 1; } -void stream_reset(stream_t *s) -{ - if (s->eof) { - s->pos = 0; - s->buf_pos = s->buf_len = 0; - s->eof = 0; - } -} - int stream_control(stream_t *s, int cmd, void *arg) { if (!s->control) -- cgit v1.2.3