summaryrefslogtreecommitdiffstats
path: root/stream/stream_file.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-06 20:40:02 +0200
committerwm4 <wm4@nowhere>2013-06-16 22:05:10 +0200
commit0d5e6084aed34a9e6f48a4a2cfaf095b17acb21b (patch)
tree8513c329707016173c6b482961cf721b81b5bfc7 /stream/stream_file.c
parent1c35794efd7d025457e527b61f7c23fe375c2f5a (diff)
downloadmpv-0d5e6084aed34a9e6f48a4a2cfaf095b17acb21b.tar.bz2
mpv-0d5e6084aed34a9e6f48a4a2cfaf095b17acb21b.tar.xz
stream: don't set EOF flag in stream implementations
EOF should be set when reading more data fails. The stream implementations have nothing to say here and should behave correctly when trying to read when EOF was actually read. Even when seeking, a correct EOF flag should be guaranteed. stream_seek() (or actually stream_seek_long()) calls stream_fill_buffer() at least once, which also updates the EOF flag.
Diffstat (limited to 'stream/stream_file.c')
-rw-r--r--stream/stream_file.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/stream/stream_file.c b/stream/stream_file.c
index 8b587e6048..5797aef59f 100644
--- a/stream/stream_file.c
+++ b/stream/stream_file.c
@@ -55,8 +55,6 @@ static const struct m_struct_st stream_opts = {
static int fill_buffer(stream_t *s, char* buffer, int max_len){
int r = read(s->fd,buffer,max_len);
- // We are certain this is EOF, do not retry
- if (max_len && r == 0) s->eof = 1;
return (r <= 0) ? -1 : r;
}
@@ -76,7 +74,6 @@ static int write_buffer(stream_t *s, char* buffer, int len) {
static int seek(stream_t *s,int64_t newpos) {
s->pos = newpos;
if(lseek(s->fd,s->pos,SEEK_SET)<0) {
- s->eof=1;
return 0;
}
return 1;
@@ -89,7 +86,7 @@ static int seek_forward(stream_t *s,int64_t newpos) {
}
while(s->pos<newpos){
int len=s->fill_buffer(s,s->buffer,STREAM_BUFFER_SIZE);
- if(len<=0){ s->eof=1; s->buf_pos=s->buf_len=0; break; } // EOF
+ if(len<=0){ s->buf_pos=s->buf_len=0; break; } // EOF
s->buf_pos=0;
s->buf_len=len;
s->pos+=len;