Commit ad505d55 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Don't rely on an object in fix_readdir_charset

parent 378c8bed
...@@ -342,8 +342,12 @@ vlc_bool_t vlc_current_charset( char **psz_charset ) ...@@ -342,8 +342,12 @@ vlc_bool_t vlc_current_charset( char **psz_charset )
char *__vlc_fix_readdir_charset( vlc_object_t *p_this, const char *psz_string ) char *__vlc_fix_readdir_charset( vlc_object_t *p_this, const char *psz_string )
{ {
(void)p_this;
#ifdef __APPLE__ #ifdef __APPLE__
if ( p_this->p_libvlc_global->iconv_macosx != (vlc_iconv_t)-1 ) vlc_iconv_t hd = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
if (hd != (vlc_iconv_t)(-1))
{ {
const char *psz_in = psz_string; const char *psz_in = psz_string;
size_t i_in = strlen(psz_in); size_t i_in = strlen(psz_in);
...@@ -351,15 +355,9 @@ char *__vlc_fix_readdir_charset( vlc_object_t *p_this, const char *psz_string ) ...@@ -351,15 +355,9 @@ char *__vlc_fix_readdir_charset( vlc_object_t *p_this, const char *psz_string )
char *psz_utf8 = malloc(i_out + 1); char *psz_utf8 = malloc(i_out + 1);
char *psz_out = psz_utf8; char *psz_out = psz_utf8;
vlc_mutex_lock( &p_this->p_libvlc_global->iconv_lock ); size_t i_ret = vlc_iconv (hd, &psz_in, &i_in, &psz_out, &i_out);
size_t i_ret = vlc_iconv( p_this->p_libvlc_global->iconv_macosx, if( i_ret == (size_t)(-1) || i_in )
&psz_in, &i_in, &psz_out, &i_out );
vlc_mutex_unlock( &p_this->p_libvlc_global->iconv_lock );
if( i_ret == (size_t)-1 || i_in )
{ {
msg_Warn( p_this,
"failed to convert \"%s\" from HFS+ charset (%s)",
psz_string, strerror(errno) );
free( psz_utf8 ); free( psz_utf8 );
return strdup( psz_string ); return strdup( psz_string );
} }
...@@ -368,8 +366,6 @@ char *__vlc_fix_readdir_charset( vlc_object_t *p_this, const char *psz_string ) ...@@ -368,8 +366,6 @@ char *__vlc_fix_readdir_charset( vlc_object_t *p_this, const char *psz_string )
return psz_utf8; return psz_utf8;
} }
#endif #endif
(void)p_this;
return strdup( psz_string ); return strdup( psz_string );
} }
......
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