[vlc-commits] skins2(Win): fix multibyte issue for vlt filename (tar 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 21:43:25 2015 +0200| [2f2d5b5a7736e1610b8c1fe82f981eb141fd1435] | committer: Erwan Tulou
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.
(cherry picked from commit 743ca935aa278f33ecb0488bd61f12ab00e3d951)
Signed-off-by: Erwan Tulou <erwan10 at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=2f2d5b5a7736e1610b8c1fe82f981eb141fd1435
---
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 083fa79..de99320 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;
}
More information about the vlc-commits
mailing list