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

- Use iconv transliteration instead of custom code

- Supposedly fix a memleak
- Fix a few warnings
parent f9a94a39
......@@ -167,10 +167,13 @@ static int Open( vlc_object_t *p_this )
if( strcmp( psz_src, "UTF-8" ) )
{
p_sys->iconv_from_utf8 = vlc_iconv_open( psz_src, "UTF-8" );
char psz_encoding[strlen( psz_src ) + sizeof( "//translit")];
sprintf( psz_encoding, "%s//translit", psz_src);
p_sys->iconv_from_utf8 = vlc_iconv_open( psz_encoding, "UTF-8" );
if( p_sys->iconv_from_utf8 == (vlc_iconv_t)-1 )
msg_Warn( p_intf, "unable to perform charset conversion to %s",
psz_src );
psz_encoding );
else
{
p_sys->iconv_to_utf8 = vlc_iconv_open( "UTF-8", psz_src );
......@@ -185,7 +188,7 @@ static int Open( vlc_object_t *p_this )
p_sys->iconv_from_utf8 = p_sys->iconv_to_utf8 = (vlc_iconv_t)-1;
}
p_sys->psz_charset = strdup( psz_src );
p_sys->psz_charset = psz_src;
psz_src = NULL;
/* determine file handler associations */
......
......@@ -357,26 +357,9 @@ char *E_(FromUTF8)( intf_thread_t *p_intf, char *psz_utf8 )
char *psz_out = psz_local;
size_t i_ret;
char psz_tmp[i_in + 1];
char *psz_in = psz_tmp;
uint8_t *p = (uint8_t *)psz_tmp;
const char *psz_in = psz_tmp;
strcpy( psz_tmp, psz_utf8 );
/* Fix Unicode quotes. If we are here we are probably converting
* to an inferior charset not understanding Unicode quotes. */
while( *p )
{
if( p[0] == 0xe2 && p[1] == 0x80 && p[2] == 0x99 )
{
*p = '\'';
memmove( &p[1], &p[3], strlen((char *)&p[3]) + 1 );
}
if( p[0] == 0xe2 && p[1] == 0x80 && p[2] == 0x9a )
{
*p = '"';
memmove( &p[1], &p[3], strlen((char *)&p[3]) + 1 );
}
p++;
}
i_in = strlen( psz_tmp );
i_ret = vlc_iconv( p_sys->iconv_from_utf8, &psz_in, &i_in,
......@@ -403,7 +386,7 @@ char *E_(ToUTF8)( intf_thread_t *p_intf, char *psz_local )
if ( p_sys->iconv_to_utf8 != (vlc_iconv_t)-1 )
{
char *psz_in = psz_local;
const char *psz_in = psz_local;
size_t i_in = strlen(psz_in);
size_t i_out = i_in * 6;
char *psz_utf8 = malloc(i_out + 1);
......@@ -471,7 +454,7 @@ void E_(PlaylistListNode)( intf_thread_t *p_intf, playlist_t *p_pl,
E_(mvar_AppendNewVar)( itm, "ro", "rw" );
}
sprintf( value, "%d", p_node->input.i_duration );
sprintf( value, "%ld", (long)p_node->input.i_duration );
E_(mvar_AppendNewVar)( itm, "duration", value );
E_(mvar_AppendVar)( s, itm );
......
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