stream: don't adjust stream position if seek succeeds, but read fails

This was probably done this way to ensure that after a successful seek,
the reported stream position is the same as the requested seek position.
But it doesn't make too much sense, since both stream->pos and the
stream implementation's internal position will go out of sync.
This commit is contained in:
wm4 2013-06-06 17:51:43 +02:00
parent 5999efb964
commit df09c1aa63
1 changed files with 2 additions and 3 deletions

View File

@ -570,8 +570,7 @@ static int stream_seek_long(stream_t *s, int64_t pos)
}
pos -= s->buf_len;
}
// Fill failed, but seek still is a success.
s->pos += pos;
// Fill failed, but seek still is a success (partially).
s->buf_pos = 0;
s->buf_len = 0;
s->eof = 0; // eof should be set only on read
@ -615,7 +614,7 @@ int stream_skip(stream_t *s, int64_t len)
int r = stream_seek(s, target - 1);
if (r) {
stream_read_char(s);
return !stream_eof(s);
return !stream_eof(s) && stream_tell(s) == target;
}
return r;
}