From 743ca935aa278f33ecb0488bd61f12ab00e3d951 Mon Sep 17 00:00:00 2001 From: Erwan Tulou Date: Thu, 11 Jun 2015 21:43:25 +0200 Subject: [PATCH] skins2(Win): fix multibyte issue for vlt filename (tar format) On Windows, gzopen() doesn't fully support Microsoft wide char either. So, use vlc_open() + gzdopen(). For OS2 and Linux, no functional change. --- modules/gui/skins2/src/theme_loader.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp index 083fa793a9..de99320339 100644 --- a/modules/gui/skins2/src/theme_loader.cpp +++ b/modules/gui/skins2/src/theme_loader.cpp @@ -516,14 +516,26 @@ int tar_open( TAR **t, char *pathname, int oflags ) { (void)oflags; - gzFile f = gzopen( pathname, "rb" ); + int fd = vlc_open( pathname, O_BINARY | O_RDONLY ); + if( !fd ) + { + fprintf( stderr, "Couldn't open %s\n", pathname ); + return -1; + } + gzFile f = gzdopen( fd, "rb" ); if( f == NULL ) { fprintf( stderr, "Couldn't gzopen %s\n", pathname ); + close( fd ); return -1; } *t = (gzFile *)malloc( sizeof(gzFile) ); + if( *t == NULL ) + { + gzclose( f ); + return -1; + } **t = f; return 0; } @@ -750,11 +762,17 @@ int gzopen_frontend( const char *pathname, int oflags, int mode ) errno = EINVAL; return -1; } - - gzf = gzopen( pathname, gzflags ); + int fd = vlc_open( pathname, oflags ); + if( !fd ) + { + fprintf( stderr, "Couldn't open %s\n", pathname ); + return -1; + } + gzf = gzdopen( fd, gzflags ); if( !gzf ) { errno = ENOMEM; + close( fd ); return -1; } -- 2.11.4.GIT