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

dvdread: clean up path handling and fix error message encoding

Paths given to msg_*() function must be UTF-8, not local.
(cherry picked from commit 140a43f3)

Conflicts:

	modules/access/dvdread.c
parent 79ab3b72
...@@ -174,8 +174,7 @@ static int Open( vlc_object_t *p_this ) ...@@ -174,8 +174,7 @@ static int Open( vlc_object_t *p_this )
{ {
demux_t *p_demux = (demux_t*)p_this; demux_t *p_demux = (demux_t*)p_this;
demux_sys_t *p_sys; demux_sys_t *p_sys;
char *psz_name; char *psz_file;
dvd_reader_t *p_dvdread;
ifo_handle_t *p_vmg_file; ifo_handle_t *p_vmg_file;
if( !p_demux->psz_path || !*p_demux->psz_path ) if( !p_demux->psz_path || !*p_demux->psz_path )
...@@ -184,30 +183,38 @@ static int Open( vlc_object_t *p_this ) ...@@ -184,30 +183,38 @@ static int Open( vlc_object_t *p_this )
if( !p_demux->psz_access || !*p_demux->psz_access ) if( !p_demux->psz_access || !*p_demux->psz_access )
return VLC_EGENERIC; return VLC_EGENERIC;
psz_name = var_CreateGetString( p_this, "dvd" ); psz_file = var_InheritString( p_this, "dvd" );
if( !psz_name )
{
psz_name = strdup("");
}
} }
else else
psz_name = ToLocaleDup( p_demux->psz_path ); psz_file = strdup( p_demux->psz_path );
#ifdef WIN32 #ifdef WIN32
if( psz_name[0] && psz_name[1] == ':' && if( psz_file != NULL )
psz_name[2] == '\\' && psz_name[3] == '\0' ) psz_name[2] = '\0'; {
size_t flen = strlen( psz_file );
if( flen > 0 && psz_file[flen - 1] == '\\' )
psz_file[flen - 1] = '\0';
}
else
psz_file = strdup("");
#endif #endif
if( unlikely(psz_file == NULL) )
return VLC_EGENERIC;
/* Open dvdread */ /* Open dvdread */
if( !(p_dvdread = DVDOpen( psz_name )) ) const char *psz_path = ToLocale( psz_file );
dvd_reader_t *p_dvdread = DVDOpen( psz_path );
LocaleFree( psz_path );
if( p_dvdread == NULL )
{ {
msg_Err( p_demux, "DVDRead cannot open source: %s", psz_name ); msg_Err( p_demux, "DVDRead cannot open source: %s", psz_file );
dialog_Fatal( p_demux, _("Playback failure"), dialog_Fatal( p_demux, _("Playback failure"),
_("DVDRead could not open the disc \"%s\"."), psz_name ); _("DVDRead could not open the disc \"%s\"."), psz_file );
free( psz_name ); free( psz_file );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
free( psz_name ); free( psz_file );
/* Ifo allocation & initialisation */ /* Ifo allocation & initialisation */
if( !( p_vmg_file = ifoOpen( p_dvdread, 0 ) ) ) if( !( p_vmg_file = ifoOpen( p_dvdread, 0 ) ) )
......
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