# HG changeset patch # User arpi # Date 1003688028 0 # Node ID f6a10f4b61197f2c34ae259fd5cc919e3e6be9cf # Parent 7d702c3ef0adf25b6972b244aa503ddd0070222b stream_read() now returns no. of bytes readed diff -r 7d702c3ef0ad -r f6a10f4b6119 libmpdemux/stream.h --- a/libmpdemux/stream.h Sun Oct 21 17:34:40 2001 +0000 +++ b/libmpdemux/stream.h Sun Oct 21 18:13:48 2001 +0000 @@ -86,12 +86,13 @@ return y; } -inline static void stream_read(stream_t *s,char* mem,int len){ +inline static int stream_read(stream_t *s,char* mem,int total){ + int len=total; while(len>0){ int x; x=s->buf_len-s->buf_pos; if(x==0){ - if(!cache_stream_fill_buffer(s)) return; // EOF + if(!cache_stream_fill_buffer(s)) return total-len; // EOF x=s->buf_len-s->buf_pos; } if(s->buf_pos>s->buf_len) printf("stream_read: WARNING! s->buf_pos>s->buf_len\n"); @@ -99,6 +100,7 @@ memcpy(mem,&s->buffer[s->buf_pos],x); s->buf_pos+=x; mem+=x; len-=x; } + return total; } inline static int stream_eof(stream_t *s){