From: RĂ©mi Denis-Courmont Date: Sun, 26 Mar 2006 20:25:07 +0000 (+0000) Subject: - Use iconv transliteration instead of custom code X-Git-Tag: 0.9.0-test0~11755 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=c8de6d5a401c5d1dae6a319a0b628e6cd7e669b4;p=vlc - Use iconv transliteration instead of custom code - Supposedly fix a memleak - Fix a few warnings --- diff --git a/modules/control/http/http.c b/modules/control/http/http.c index 207a36058d..8483b4e8f3 100644 --- a/modules/control/http/http.c +++ b/modules/control/http/http.c @@ -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 */ diff --git a/modules/control/http/util.c b/modules/control/http/util.c index 15569ed409..1a9e6b6576 100644 --- a/modules/control/http/util.c +++ b/modules/control/http/util.c @@ -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 );