vlc/vlc-2.0 | branch: master | bbcallen <[email protected]> | 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 <[email protected]>
(cherry picked from commit 8a57032172f9e6c737036cac6fe8f2e530ac21f1)

Signed-off-by: Jean-Baptiste Kempf <[email protected]>

> 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;

_______________________________________________
vlc-commits mailing list
[email protected]
http://mailman.videolan.org/listinfo/vlc-commits

Reply via email to