From 3aa13da97000ec921fb9a7eeb65fde143f3b482b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reimar=20D=C3=B6ffinger?= Date: Sun, 25 Jul 2010 14:33:40 +0000 Subject: [PATCH] Simplify get_byte and url_fgetc. Originally committed as revision 24494 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavformat/aviobuf.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 941691adb6..0ee04b0c64 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -390,28 +390,22 @@ void init_checksum(ByteIOContext *s, /* XXX: put an inline version */ int get_byte(ByteIOContext *s) { - if (s->buf_ptr < s->buf_end) { - return *s->buf_ptr++; - } else { + if (s->buf_ptr >= s->buf_end) fill_buffer(s); if (s->buf_ptr < s->buf_end) return *s->buf_ptr++; else return 0; - } } int url_fgetc(ByteIOContext *s) { - if (s->buf_ptr < s->buf_end) { - return *s->buf_ptr++; - } else { + if (s->buf_ptr >= s->buf_end) fill_buffer(s); if (s->buf_ptr < s->buf_end) return *s->buf_ptr++; else return URL_EOF; - } } int get_buffer(ByteIOContext *s, unsigned char *buf, int size)