Browse code

simplify

Originally committed as revision 7569 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2007/01/18 04:30:23
Showing 1 changed files
... ...
@@ -90,10 +90,8 @@ void av_fifo_realloc(AVFifoBuffer *f, unsigned int new_size) {
90 90
 
91 91
 void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size)
92 92
 {
93
-    int len;
94
-
95 93
     while (size > 0) {
96
-        len = FFMIN(f->end - f->wptr, size);
94
+        int len = FFMIN(f->end - f->wptr, size);
97 95
         memcpy(f->wptr, buf, len);
98 96
         f->wptr += len;
99 97
         if (f->wptr >= f->end)
... ...
@@ -107,15 +105,12 @@ void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size)
107 107
 /* get data from the fifo (return -1 if not enough data) */
108 108
 int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest)
109 109
 {
110
-    int len;
111
-    int size = f->wptr - f->rptr;
112
-    if (size < 0)
113
-        size += f->end - f->buffer;
110
+    int size = av_fifo_size(f);
114 111
 
115 112
     if (size < buf_size)
116 113
         return -1;
117 114
     while (buf_size > 0) {
118
-        len = FFMIN(f->end - f->rptr, buf_size);
115
+        int len = FFMIN(f->end - f->rptr, buf_size);
119 116
         func(dest, f->rptr, len);
120 117
         f->rptr += len;
121 118
         if (f->rptr >= f->end)