[FFmpeg-cvslog] avformat/subtitles: ignore extra '\r' at line endings

Paul B Mahol git at videolan.org
Sat Apr 27 13:59:44 EEST 2019


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Thu Apr 25 23:21:38 2019 +0200| [6347146e3d3d55216445696504d49e33470e17ad] | committer: Paul B Mahol

avformat/subtitles: ignore extra '\r' at line endings

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6347146e3d3d55216445696504d49e33470e17ad
---

 libavformat/subtitles.c | 2 +-
 libavformat/subtitles.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 93c9ef05cf..659c99d1cf 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -417,7 +417,7 @@ ptrdiff_t ff_subtitles_read_line(FFTextReader *tr, char *buf, size_t size)
         buf[cur++] = c;
         buf[cur] = '\0';
     }
-    if (ff_text_peek_r8(tr) == '\r')
+    while (ff_text_peek_r8(tr) == '\r')
         ff_text_r8(tr);
     if (ff_text_peek_r8(tr) == '\n')
         ff_text_r8(tr);
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index ca78db224d..6b418e3621 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -188,7 +188,7 @@ static av_always_inline int ff_subtitles_next_line(const char *ptr)
 {
     int n = strcspn(ptr, "\r\n");
     ptr += n;
-    if (*ptr == '\r') {
+    while (*ptr == '\r') {
         ptr++;
         n++;
     }



More information about the ffmpeg-cvslog mailing list