From 46380e8d261920eed8687eb0eabb8d8726239583 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Tue, 13 May 2014 00:03:30 +0200 Subject: [PATCH] avformat/aviobuf/ff_get_line: also accept \r as end of line character Fixes Ticket3108 Signed-off-by: Michael Niedermayer --- libavformat/aviobuf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 32a1f92cb8..738459e830 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -665,7 +665,9 @@ int ff_get_line(AVIOContext *s, char *buf, int maxlen) c = avio_r8(s); if (c && i < maxlen-1) buf[i++] = c; - } while (c != '\n' && c); + } while (c != '\n' && c != '\r' && c); + if (c == '\r' && avio_r8(s) != '\n') + avio_skip(s, -1); buf[i] = 0; return i;