simplify
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Jan 2007 19:19:03 +0000 (19:19 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 17 Jan 2007 19:19:03 +0000 (19:19 +0000)
Originally committed as revision 7568 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavutil/fifo.c

index 550f13de58feb0421e3d1c73be204396b53bab14..6a73b3f0d69a3f4cd34434b695300c7c308a6ba1 100644 (file)
@@ -50,15 +50,12 @@ int av_fifo_size(AVFifoBuffer *f)
  */
 int av_fifo_read(AVFifoBuffer *f, uint8_t *buf, int buf_size)
 {
-    int len;
-    int size = f->wptr - f->rptr;
-    if (size < 0)
-        size += f->end - f->buffer;
+    int size = av_fifo_size(f);
 
     if (size < buf_size)
         return -1;
     while (buf_size > 0) {
-        len = FFMIN(f->end - f->rptr, buf_size);
+        int len = FFMIN(f->end - f->rptr, buf_size);
         memcpy(buf, f->rptr, len);
         buf += len;
         f->rptr += len;