changeset 2347:f6a10f4b6119

stream_read() now returns no. of bytes readed
author arpi
date Sun, 21 Oct 2001 18:13:48 +0000
parents 7d702c3ef0ad
children 76778e307ddc
files libmpdemux/stream.h
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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){