changeset 24826:ac881f93b661

demuxer.c: Remove useless code Remove "while(1) { }" around two instances of code that always do "return" in the loop body. No functionality changes.
author uau
date Thu, 25 Oct 2007 19:21:24 +0000
parents cf1aba04bb85
children 4ec67a66ef54
files libmpdemux/demuxer.c
diffstat 1 files changed, 17 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demuxer.c	Thu Oct 25 17:38:54 2007 +0000
+++ b/libmpdemux/demuxer.c	Thu Oct 25 19:21:24 2007 +0000
@@ -526,20 +526,18 @@
 }
 
 int ds_get_packet(demux_stream_t *ds,unsigned char **start){
-    while(1){
-        int len;
-        if(ds->buffer_pos>=ds->buffer_size){
-          if(!ds_fill_buffer(ds)){
+    int len;
+    if(ds->buffer_pos>=ds->buffer_size){
+	if(!ds_fill_buffer(ds)){
             // EOF
             *start = NULL;
             return -1;
-          }
-        }
-        len=ds->buffer_size-ds->buffer_pos;
-        *start = &ds->buffer[ds->buffer_pos];
-        ds->buffer_pos+=len;
-        return len;
+	}
     }
+    len=ds->buffer_size-ds->buffer_pos;
+    *start = &ds->buffer[ds->buffer_pos];
+    ds->buffer_pos+=len;
+    return len;
 }
 
 int ds_get_packet_pts(demux_stream_t *ds,unsigned char **start, double *pts)
@@ -564,18 +562,16 @@
 }
 
 int ds_get_packet_sub(demux_stream_t *ds,unsigned char **start){
-    while(1){
-        int len;
-        if(ds->buffer_pos>=ds->buffer_size){
-          *start = NULL;
-          if(!ds->packs) return -1; // no sub
-          if(!ds_fill_buffer(ds)) return -1; // EOF
-        }
-        len=ds->buffer_size-ds->buffer_pos;
-        *start = &ds->buffer[ds->buffer_pos];
-        ds->buffer_pos+=len;
-        return len;
+    int len;
+    if(ds->buffer_pos>=ds->buffer_size){
+	*start = NULL;
+	if(!ds->packs) return -1; // no sub
+	if(!ds_fill_buffer(ds)) return -1; // EOF
     }
+    len=ds->buffer_size-ds->buffer_pos;
+    *start = &ds->buffer[ds->buffer_pos];
+    ds->buffer_pos+=len;
+    return len;
 }
 
 double ds_get_next_pts(demux_stream_t *ds)