Commit 224dccda authored by Geoffroy Couprie's avatar Geoffroy Couprie

Revert "zip access: fix #2467. Now it's able to open files with non ASCII...

Revert "zip access: fix #2467. Now it's able to open files with non ASCII names, but can't open files with non ASCII names inside of the zip file"

This reverts commit e3d08b79.
parent 044ede9e
...@@ -64,7 +64,7 @@ int AccessOpen( vlc_object_t *p_this ) ...@@ -64,7 +64,7 @@ int AccessOpen( vlc_object_t *p_this )
int i_ret = VLC_EGENERIC; int i_ret = VLC_EGENERIC;
unzFile file = 0; unzFile file = 0;
char *psz_path = NULL, *psz_sep = NULL; char *psz_pathToZip = NULL, *psz_path = NULL, *psz_sep = NULL;
p_access->p_sys = p_sys = (access_sys_t*) p_access->p_sys = p_sys = (access_sys_t*)
calloc( 1, sizeof( access_sys_t ) ); calloc( 1, sizeof( access_sys_t ) );
...@@ -78,6 +78,7 @@ int AccessOpen( vlc_object_t *p_this ) ...@@ -78,6 +78,7 @@ int AccessOpen( vlc_object_t *p_this )
return VLC_EGENERIC; return VLC_EGENERIC;
*psz_sep = '\0'; *psz_sep = '\0';
psz_pathToZip = unescape_URI_duplicate( psz_path );
p_sys->psz_fileInzip = strdup( psz_sep + 1 ); p_sys->psz_fileInzip = strdup( psz_sep + 1 );
/* Define IO functions */ /* Define IO functions */
...@@ -93,10 +94,10 @@ int AccessOpen( vlc_object_t *p_this ) ...@@ -93,10 +94,10 @@ int AccessOpen( vlc_object_t *p_this )
p_func->opaque = p_access; p_func->opaque = p_access;
/* Open zip archive */ /* Open zip archive */
file = p_access->p_sys->zipFile = unzOpen2( psz_path, p_func ); file = p_access->p_sys->zipFile = unzOpen2( psz_pathToZip, p_func );
if( !file ) if( !file )
{ {
msg_Err( p_access, "not a valid zip archive: '%s'", psz_path ); msg_Err( p_access, "not a valid zip archive: '%s'", psz_pathToZip );
goto exit; goto exit;
} }
...@@ -130,6 +131,7 @@ exit: ...@@ -130,6 +131,7 @@ exit:
free( p_sys ); free( p_sys );
} }
free( psz_pathToZip );
free( psz_path ); free( psz_path );
return i_ret; return i_ret;
} }
......
...@@ -488,8 +488,8 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames, ...@@ -488,8 +488,8 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames,
/* Root node */ /* Root node */
node *playlist = new_node( psz_zip ); node *playlist = new_node( psz_zip );
/* Web-Encode the URI and append '|' */ /* Web-Encode the URI and append '!' */
char *psz_pathtozip = make_URI( psz_zippath ); char *psz_pathtozip = vlc_UrlEncode( psz_zippath );
if( astrcatf( &psz_pathtozip, ZIP_SEP ) < 0 ) return -1; if( astrcatf( &psz_pathtozip, ZIP_SEP ) < 0 ) return -1;
int i_track = 0; int i_track = 0;
...@@ -516,6 +516,11 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames, ...@@ -516,6 +516,11 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames,
char *psz_path = strdup( psz_pathtozip ); char *psz_path = strdup( psz_pathtozip );
if( astrcatf( &psz_path, psz_name ) < 0 ) return -1; if( astrcatf( &psz_path, psz_name ) < 0 ) return -1;
/* Double url-encode */
char *psz_tmp = psz_path;
psz_path = vlc_UrlEncode( psz_tmp );
free( psz_tmp );
/* Track information */ /* Track information */
if( astrcatf( pp_buffer, if( astrcatf( pp_buffer,
" <track>\n" " <track>\n"
...@@ -567,6 +572,8 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames, ...@@ -567,6 +572,8 @@ static int WriteXSPF( char **pp_buffer, vlc_array_t *p_filenames,
/* Close extension and playlist */ /* Close extension and playlist */
if( astrcatf( pp_buffer, " </extension>\n</playlist>\n" ) < 0 ) return -1; if( astrcatf( pp_buffer, " </extension>\n</playlist>\n" ) < 0 ) return -1;
/* printf( "%s", *pp_buffer ); */
free_all_node( playlist ); free_all_node( playlist );
return VLC_SUCCESS; return VLC_SUCCESS;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment