changeset 6311:daed56aa74bc libavformat

Simplify get_byte and url_fgetc.
author reimar
date Sun, 25 Jul 2010 14:33:40 +0000
parents 3d61da0c6e41
children b69e2ca7fb3f
files aviobuf.c
diffstat 1 files changed, 2 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/aviobuf.c	Sun Jul 25 07:54:33 2010 +0000
+++ b/aviobuf.c	Sun Jul 25 14:33:40 2010 +0000
@@ -390,28 +390,22 @@
 /* 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)