[vlc-commits] skins2(Win): fix multibyte issue for vlt filename (zip format)
Erwan Tulou
git at videolan.org
Fri Jun 12 22:03:11 CEST 2015
vlc/vlc-2.2 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jun 11 20:53:06 2015 +0200| [e76b5fad18d4abc906a338b93e7c9c2ab919bba4] | committer: Erwan Tulou
skins2(Win): fix multibyte issue for vlt filename (zip format)
On Windows, unzOpen() doesn't fully support Microsoft wide char.
So, use unzOpen2() with a callback to use vlc_fopen() instead of
the default fopen().
This fixes situations where a skin filename or path contains
e.g Japanese characters whatever the Windows locale.
For OS2 and Linux, no functional change.
(cherry picked from commit 1ac910a5f378a77d88469facf830055877701d3c)
Signed-off-by: Erwan Tulou <erwan10 at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=e76b5fad18d4abc906a338b93e7c9c2ab919bba4
---
modules/gui/skins2/src/theme_loader.cpp | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp
index 1fba110..083fa79 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -78,7 +78,7 @@ bool ThemeLoader::load( const string &fileName )
// file...
#if defined( HAVE_ZLIB_H )
- if( ! extract( sToLocale( fileName ) ) && ! parse( path, fileName ) )
+ if( ! extract( fileName ) && ! parse( path, fileName ) )
return false;
#else
if( ! parse( path, fileName ) )
@@ -134,13 +134,28 @@ bool ThemeLoader::extractTarGz( const string &tarFile, const string &rootDir )
return true;
}
+static voidpf ZCALLBACK open_vlc( voidpf opaque, const char *filename, int mode)
+{
+ (void)mode;
+ intf_thread_t *pIntf = (intf_thread_t *)opaque;
+
+ FILE *stream = vlc_fopen( filename, "rb" );
+ if( stream == NULL )
+ msg_Dbg( pIntf, "vlc_fopen failed for %s", filename );
+ return stream;
+}
bool ThemeLoader::extractZip( const string &zipFile, const string &rootDir )
{
bool b_isWsz = strstr( zipFile.c_str(), ".wsz" );
// Try to open the ZIP file
- unzFile file = unzOpen( zipFile.c_str() );
+ zlib_filefunc_def descr;
+ fill_fopen_filefunc( &descr );
+ descr.zopen_file = open_vlc;
+ descr.opaque = getIntf();
+
+ unzFile file = unzOpen2( zipFile.c_str(), &descr );
if( file == 0 )
{
msg_Dbg( getIntf(), "failed to open %s as a zip file",
More information about the vlc-commits
mailing list