Commit 743ca935 authored by Erwan Tulou's avatar 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.
parent 1ac910a5
...@@ -516,14 +516,26 @@ int tar_open( TAR **t, char *pathname, int oflags ) ...@@ -516,14 +516,26 @@ int tar_open( TAR **t, char *pathname, int oflags )
{ {
(void)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 ) if( f == NULL )
{ {
fprintf( stderr, "Couldn't gzopen %s\n", pathname ); fprintf( stderr, "Couldn't gzopen %s\n", pathname );
close( fd );
return -1; return -1;
} }
*t = (gzFile *)malloc( sizeof(gzFile) ); *t = (gzFile *)malloc( sizeof(gzFile) );
if( *t == NULL )
{
gzclose( f );
return -1;
}
**t = f; **t = f;
return 0; return 0;
} }
...@@ -750,11 +762,17 @@ int gzopen_frontend( const char *pathname, int oflags, int mode ) ...@@ -750,11 +762,17 @@ int gzopen_frontend( const char *pathname, int oflags, int mode )
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
int fd = vlc_open( pathname, oflags );
gzf = gzopen( pathname, gzflags ); if( !fd )
{
fprintf( stderr, "Couldn't open %s\n", pathname );
return -1;
}
gzf = gzdopen( fd, gzflags );
if( !gzf ) if( !gzf )
{ {
errno = ENOMEM; errno = ENOMEM;
close( fd );
return -1; return -1;
} }
......
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