[vlc-devel] commit: playlist.c: change FindPrefix to include access on returned string (Ilkka Ollakka )

git version control git at videolan.org
Tue Oct 13 10:53:36 CEST 2009


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Mon Oct 12 16:39:19 2009 +0300| [c041421df47283ce6d32cbabafaaa9558da66583] | committer: Ilkka Ollakka 

playlist.c: change FindPrefix to include access on returned string

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

 modules/demux/playlist/playlist.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/modules/demux/playlist/playlist.c b/modules/demux/playlist/playlist.c
index 6799451..7721a07 100644
--- a/modules/demux/playlist/playlist.c
+++ b/modules/demux/playlist/playlist.c
@@ -182,7 +182,17 @@ char *FindPrefix( demux_t *p_demux )
 {
     char *psz_file;
     char *psz_prefix;
-    const char *psz_path = p_demux->psz_path;
+    char *psz_path;
+    if( p_demux->psz_access )
+    {
+        if( asprintf( &psz_path,"%s://%s", p_demux->psz_access, p_demux->psz_path ) == -1 )
+            return NULL;
+    }
+    else
+    {
+        if( asprintf( &psz_path,"%s", p_demux->psz_path ) == -1 )
+            return NULL;
+    }
 
 #ifdef WIN32
     psz_file = strrchr( psz_path, '\\' );
@@ -194,6 +204,7 @@ char *FindPrefix( demux_t *p_demux )
         psz_prefix = strndup( psz_path, psz_file - psz_path + 1 );
     else
         psz_prefix = strdup( "" );
+    free( psz_path );
 
     return psz_prefix;
 }




More information about the vlc-devel mailing list