summaryrefslogtreecommitdiff
path: root/libavutil/fifo.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-01-17 19:30:23 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-01-17 19:30:23 +0000
commit870a12d1c23b8b1f902c5fec22ec6edd0885154a (patch)
tree64e6e48a6204da74d048f360f756ed0a9533ba9a /libavutil/fifo.c
parentf81b99b82b807e6a7716cf47e4d1748b32ca4b39 (diff)
simplify
Originally committed as revision 7569 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavutil/fifo.c')
-rw-r--r--libavutil/fifo.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/libavutil/fifo.c b/libavutil/fifo.c
index 6a73b3f0d6..d334c363a0 100644
--- a/libavutil/fifo.c
+++ b/libavutil/fifo.c
@@ -90,10 +90,8 @@ void av_fifo_realloc(AVFifoBuffer *f, unsigned int new_size) {
void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size)
{
- int len;
-
while (size > 0) {
- len = FFMIN(f->end - f->wptr, size);
+ int len = FFMIN(f->end - f->wptr, size);
memcpy(f->wptr, buf, len);
f->wptr += len;
if (f->wptr >= f->end)
@@ -107,15 +105,12 @@ void av_fifo_write(AVFifoBuffer *f, const uint8_t *buf, int size)
/* get data from the fifo (return -1 if not enough data) */
int av_fifo_generic_read(AVFifoBuffer *f, int buf_size, void (*func)(void*, void*, int), void* dest)
{
- 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);
func(dest, f->rptr, len);
f->rptr += len;
if (f->rptr >= f->end)