changeset 9656:ef5ae9f9c6e6

fixed trivial seeking bugs, patch by Krister Lagerstrom <krister@kmlager.com>
author alex
date Sat, 22 Mar 2003 21:14:51 +0000
parents 8809e2be5cea
children 4916d09a52a7
files libmpdemux/cdda.c
diffstat 1 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/cdda.c	Sat Mar 22 20:15:03 2003 +0000
+++ b/libmpdemux/cdda.c	Sat Mar 22 21:14:51 2003 +0000
@@ -182,8 +182,10 @@
   s->pos = p->sector*CD_FRAMESIZE_RAW;
   memcpy(s->buffer,buf,CD_FRAMESIZE_RAW);
 
-  if(p->sector == p->end_sector)
+  if((p->sector < p->start_sector) || (p->sector >= p->end_sector)) {
     s->eof = 1;
+    return 0;
+  }
 
   for(i=0;i<p->cd->tracks;i++){
 	  if(p->cd->disc_toc[i].dwStartSector==p->sector-1) {
@@ -206,6 +208,11 @@
   int sec;
   int current_track=0, seeked_track=0;
   int i;
+  
+  if(s->pos < 0) {
+    s->eof = 1;
+    return;
+  }
 
   sec = s->pos/CD_FRAMESIZE_RAW;
 //printf("pos: %d, sec: %d ## %d\n", (int)s->pos, (int)sec, CD_FRAMESIZE_RAW);