avformat/aviobuf/ff_get_line: also accept \r as end of line character
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 12 May 2014 22:03:30 +0000 (00:03 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 17 May 2014 21:49:05 +0000 (23:49 +0200)
Fixes Ticket3108

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/aviobuf.c

index 32a1f92..738459e 100644 (file)
@@ -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;