[vlc-commits] hls: m3u8 parser should pass 0xD at line end

bbcallen git at videolan.org
Mon Mar 12 12:13:24 CET 2012


vlc/vlc-2.0 | branch: master | bbcallen <bbcallen at gmail.com> | Fri Mar  9 17:36:31 2012 +0800| [f3e2738e23a68edd872571dccf177fa05a135328] | committer: Jean-Baptiste Kempf

hls: m3u8 parser should pass 0xD at line end

Signed-off-by: Hugo Beauzée-Luyssen <beauze.h at gmail.com>
(cherry picked from commit 8a57032172f9e6c737036cac6fe8f2e530ac21f1)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=f3e2738e23a68edd872571dccf177fa05a135328
---

 modules/stream_filter/httplive.c |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index ffebc0f..f13c568 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1808,21 +1808,27 @@ static char *ReadLine(uint8_t *buffer, uint8_t **pos, const size_t len)
 
     while (p < end)
     {
-        if ((*p == '\n') || (*p == '\0'))
+        if ((*p == '\r') || (*p == '\n') || (*p == '\0'))
             break;
         p++;
     }
 
-    /* copy line excluding \n or \0 */
+    /* copy line excluding \r \n or \0 */
     line = strndup((char *)begin, p - begin);
 
-    if (*p == '\0')
-        *pos = end;
-    else
+    while ((*p == '\r') || (*p == '\n') || (*p == '\0'))
     {
-        /* next pass start after \n */
-        p++;
-        *pos = p;
+        if (*p == '\0')
+        {
+            *pos = end;
+            break;
+        }
+        else
+        {
+            /* next pass start after \r and \n */
+            p++;
+            *pos = p;
+        }   
     }
 
     return line;



More information about the vlc-commits mailing list