[vlc-devel] [PATCH 42/48] hls: Use a safe getter instead of a direct vlc_array access.

Hugo Beauzée-Luyssen beauze.h at gmail.com
Mon Jan 9 16:16:51 CET 2012


---
 modules/stream_filter/httplive.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/stream_filter/httplive.c b/modules/stream_filter/httplive.c
index 894ebd4..21a09af 100644
--- a/modules/stream_filter/httplive.c
+++ b/modules/stream_filter/httplive.c
@@ -1317,7 +1317,7 @@ static int hls_ReloadPlaylist(stream_t *s)
     int n = p_sys->playback.stream;
     {
         int err;
-        hls_stream_t *hls = vlc_array_item_at_index(p_sys->hls_stream, n);
+        hls_stream_t *hls = hls_Get( p_sys->hls_stream, n );
         if (!hls)
         {
             msg_Err(s, "This playlist doesn't exist ??? how this can be possible (playlist number %d)", n );
@@ -1981,8 +1981,9 @@ fail:
     for (int i = 0; i < vlc_array_count(p_sys->hls_stream); i++)
     {
         hls_stream_t *hls;
-        hls = (hls_stream_t *)vlc_array_item_at_index(p_sys->hls_stream, i);
-        if (hls) hls_Free(hls);
+        hls = hls_Get( p_sys->hls_stream, i );
+        if ( hls )
+            hls_Free( hls );
     }
     vlc_array_destroy(p_sys->hls_stream);
 
@@ -2046,7 +2047,7 @@ static void Close(vlc_object_t *p_this)
     for (int i = 0; i < vlc_array_count(p_sys->hls_stream); i++)
     {
         hls_stream_t *hls;
-        hls = (hls_stream_t *)vlc_array_item_at_index(p_sys->hls_stream, i);
+        hls = hls_Get( p_sys->hls_stream, i );
         if (hls) hls_Free(hls);
     }
     vlc_array_destroy(p_sys->hls_stream);
-- 
1.7.8.3




More information about the vlc-devel mailing list