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

Replace vlc_fix_readdir() with FromCharset()

parent e50e29c7
......@@ -90,11 +90,6 @@ void msg_StackSet ( int, const char*, ... );
void msg_StackAdd ( const char*, ... );
const char* msg_StackMsg ( void );
/*
* Unicode stuff
*/
char *vlc_fix_readdir (const char *);
/*
* LibVLC exit event handling
*/
......
......@@ -43,35 +43,6 @@
#include "libvlc.h"
#include <vlc_charset.h>
char *vlc_fix_readdir( const char *psz_string )
{
#ifdef __APPLE__
vlc_iconv_t hd = vlc_iconv_open( "UTF-8", "UTF-8-MAC" );
if (hd != (vlc_iconv_t)(-1))
{
const char *psz_in = psz_string;
size_t i_in = strlen(psz_in);
size_t i_out = i_in * 2;
char *psz_utf8 = malloc(i_out + 1);
char *psz_out = psz_utf8;
size_t i_ret = vlc_iconv (hd, &psz_in, &i_in, &psz_out, &i_out);
vlc_iconv_close (hd);
if( i_ret == (size_t)(-1) || i_in )
{
free( psz_utf8 );
return strdup( psz_string );
}
*psz_out = '\0';
return psz_utf8;
}
#endif
return strdup( psz_string );
}
/**
* us_strtod() has the same prototype as ANSI C strtod() but it uses the
* POSIX/C decimal format, regardless of the current numeric locale.
......
......@@ -347,7 +347,11 @@ char *vlc_readdir( DIR *dir )
if (val != 0)
errno = val;
else if (ent != NULL)
path = vlc_fix_readdir (ent->d_name);
#ifndef __APPLE__
path = strdup (ent->d_name);
#else
path = FromCharset ("UTF-8-MAC", ent->d_name, strlen (ent->d_name));
#endif
free (buf);
return path;
#endif
......
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