Commit 641b7faa authored by Marian Durkovic's avatar Marian Durkovic

Backport [18230] closes #862 for 0.8.6-branch

parent e4c89d48
......@@ -105,6 +105,27 @@ void E_(Close_M3U)( vlc_object_t *p_this )
free( p_demux->p_sys );
}
/* Kvik! */
static inline char *MaybeFromLocaleDup (const char *str)
{
if (str == NULL)
return NULL;
return IsUTF8 (str) ? strdup (str) : FromLocaleDup (str);
}
static inline void MaybeFromLocaleRep (char **str)
{
char *const orig_str = *str;
if ((orig_str != NULL) && !IsUTF8 (orig_str))
{
*str = FromLocaleDup (orig_str);
free (orig_str);
}
}
static int Demux( demux_t *p_demux )
{
playlist_t *p_playlist;
......@@ -176,7 +197,7 @@ static int Demux( demux_t *p_demux )
psz_parse += sizeof("EXTVLCOPT:") -1;
if( !*psz_parse ) goto error;
psz_option = strdup( psz_parse );
psz_option = MaybeFromLocaleDup( psz_parse );
if( psz_option )
INSERT_ELEM( ppsz_options, i_options, i_options,
psz_option );
......@@ -188,21 +209,18 @@ static int Demux( demux_t *p_demux )
if( !psz_name || !*psz_name )
{
/* Use filename as name for relative entries */
psz_name = strdup( psz_parse );
psz_name = MaybeFromLocaleDup( psz_parse );
}
psz_mrl = E_(ProcessMRL)( psz_parse, p_demux->p_sys->psz_prefix );
MaybeFromLocaleRep( &psz_mrl);
b_cleanup = VLC_TRUE;
if( !psz_mrl ) goto error;
EnsureUTF8( psz_name );
EnsureUTF8( psz_mrl );
p_item = playlist_ItemNew( p_playlist, psz_mrl, psz_name );
for( i = 0; i< i_options; i++ )
{
EnsureUTF8( ppsz_options[i] );
playlist_ItemAddOption( p_item, ppsz_options[i] );
}
p_item->input.i_duration = i_duration;
......
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