[vlc-commits] commit: Zip: fix opening of files (	=?UTF-8?Q?Jean=2DPhilippe=20Andr=C3=A9=20?=)
    git at videolan.org 
    git at videolan.org
       
    Mon Jan 17 17:49:05 CET 2011
    
    
  
vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Mon Jan 17 16:05:44 2011 +0100| [c77acd6efb16d3af6de89b363ccdb7b579e7c18e] | committer: Jean-Philippe André 
Zip: fix opening of files
File paths without file:// don't work anymore
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c77acd6efb16d3af6de89b363ccdb7b579e7c18e
---
 modules/access/zip/zipaccess.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/modules/access/zip/zipaccess.c b/modules/access/zip/zipaccess.c
index 9f4faf4..0d092f7 100644
--- a/modules/access/zip/zipaccess.c
+++ b/modules/access/zip/zipaccess.c
@@ -373,7 +373,21 @@ static void* ZCALLBACK ZipIO_Open( void* opaque, const char* file, int mode )
 
     access_t *p_access = (access_t*) opaque;
 
-    return stream_UrlNew( p_access, file );
+    char *fileUri = malloc( strlen(file) + 8 );
+    if( !fileUri ) return VLC_ENOMEM;
+    if( !strstr( file, "://" ) )
+    {
+        strcpy( fileUri, "file://" );
+        strcat( fileUri, file );
+    }
+    else
+    {
+        strcpy( fileUri, file );
+    }
+
+    stream_t *s = stream_UrlNew( p_access, fileUri );
+    free( fileUri );
+    return s;
 }
 
 /** **************************************************************************
    
    
More information about the vlc-commits
mailing list