# HG changeset patch # User aurel # Date 1279748410 0 # Node ID 1b2b5dbcf54913dcbe2260eebc46437e38a31c14 # Parent e62d23b0547d15bc9753597e1e08e2b017e8b890 improve ff_get_line to return line length diff -r e62d23b0547d -r 1b2b5dbcf549 aviobuf.c --- a/aviobuf.c Wed Jul 21 21:39:01 2010 +0000 +++ b/aviobuf.c Wed Jul 21 21:40:10 2010 +0000 @@ -554,18 +554,19 @@ return buf; } -void ff_get_line(ByteIOContext *s, char *buf, int maxlen) +int ff_get_line(ByteIOContext *s, char *buf, int maxlen) { int i = 0; char c; do { c = get_byte(s); - if (i < maxlen-1) + if (c && i < maxlen-1) buf[i++] = c; } while (c != '\n' && c); buf[i] = 0; + return i; } uint64_t get_be64(ByteIOContext *s) diff -r e62d23b0547d -r 1b2b5dbcf549 internal.h --- a/internal.h Wed Jul 21 21:39:01 2010 +0000 +++ b/internal.h Wed Jul 21 21:40:10 2010 +0000 @@ -167,7 +167,7 @@ */ void ff_put_v(ByteIOContext *bc, uint64_t val); -void ff_get_line(ByteIOContext *s, char *buf, int maxlen); +int ff_get_line(ByteIOContext *s, char *buf, int maxlen); #define SPACE_CHARS " \t\r\n"