changeset 17878:ab0a3e3d32ed

Fix a potential seek failure, fill_buffer doesn't have to fill the whole buffer.
author albeu
date Thu, 16 Mar 2006 14:24:22 +0000
parents 16cf7bfd99d9
children 0ca3fb62d2da
files libmpdemux/stream.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/stream.c	Wed Mar 15 23:20:27 2006 +0000
+++ b/libmpdemux/stream.c	Thu Mar 16 14:24:22 2006 +0000
@@ -324,11 +324,13 @@
 //   putchar('%');fflush(stdout);
 }
 
-  stream_fill_buffer(s);
-  if(pos>=0 && pos<=s->buf_len){
+while(stream_fill_buffer(s) > 0 && pos >= 0) {
+  if(pos<=s->buf_len){
     s->buf_pos=pos; // byte position in sector
     return 1;
   }
+  pos -= s->buf_len;
+}
   
 //  if(pos==s->buf_len) printf("XXX Seek to last byte of file -> EOF\n");