Commit 1f1820bc authored by Christophe Massiot's avatar Christophe Massiot
Browse files

* modules/gui/wxwidgets: Fix charset when getting file names from the

   filesystem.
parent 3740e6a3
......@@ -402,15 +402,17 @@ void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
p_file_dialog->GetPaths( paths );
for( size_t i = 0; i < paths.GetCount(); i++ )
{
char *psz_utf8 = FromLocale( paths[i].mb_str() );
if( event.GetInt() )
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
(const char *)paths[i].mb_str(),
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO),
PLAYLIST_END );
else
playlist_Add( p_playlist, (const char *)paths[i].mb_str(),
(const char *)paths[i].mb_str(),
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND, PLAYLIST_END );
LocaleFree( psz_utf8 );
}
}
vlc_object_release( p_playlist );
......@@ -432,11 +434,11 @@ void DialogsProvider::OnOpenDirectory( wxCommandEvent& event )
if( p_dir_dialog && p_dir_dialog->ShowModal() == wxID_OK )
{
wxString path = p_dir_dialog->GetPath();
playlist_Add( p_playlist, (const char *)path.mb_str(),
(const char *)path.mb_str(),
char *psz_utf8 = FromLocale( path.mb_str() );
playlist_Add( p_playlist, psz_utf8, psz_utf8,
PLAYLIST_APPEND | (event.GetInt() ? PLAYLIST_GO : 0),
PLAYLIST_END );
LocaleFree( psz_utf8 );
}
vlc_object_release( p_playlist );
......
......@@ -1117,15 +1117,20 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
for( int i = 0; i < (int)mrl.GetCount(); i++ )
{
vlc_bool_t b_start = !i && i_open_arg;
playlist_item_t *p_item =
playlist_ItemNew( p_intf, (const char*)mrl[i].mb_str(),
(const char *)mrl[i].mb_str() );
playlist_item_t *p_item;
char *psz_utf8;
psz_utf8 = FromLocale( mrl[i].mb_str() );
p_item = playlist_ItemNew( p_intf, psz_utf8, psz_utf8 );
LocaleFree( psz_utf8 );
/* Insert options */
while( i + 1 < (int)mrl.GetCount() &&
((const char *)mrl[i + 1].mb_str())[0] == ':' )
{
playlist_ItemAddOption( p_item, mrl[i + 1].mb_str() );
psz_utf8 = FromLocale( mrl[i + 1].mb_str() );
playlist_ItemAddOption( p_item, psz_utf8 );
LocaleFree( psz_utf8 );
i++;
}
......@@ -1134,7 +1139,9 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
for( int j = 0; j < (int)subsfile_mrl.GetCount(); j++ )
{
playlist_ItemAddOption( p_item, subsfile_mrl[j].mb_str() );
psz_utf8 = FromLocale( subsfile_mrl[j].mb_str() );
playlist_ItemAddOption( p_item, psz_utf8 );
LocaleFree( psz_utf8 );
}
}
......@@ -1143,16 +1150,17 @@ void OpenDialog::OnOk( wxCommandEvent& WXUNUSED(event) )
{
for( int j = 0; j < (int)sout_mrl.GetCount(); j++ )
{
psz_utf8 = FromLocale( sout_mrl[j].mb_str() );
playlist_ItemAddOption( p_item, sout_mrl[j].mb_str() );
LocaleFree( psz_utf8 );
}
}
playlist_AddItem( p_playlist, p_item,
PLAYLIST_APPEND, PLAYLIST_END );
playlist_AddItem( p_playlist, p_item, PLAYLIST_APPEND, PLAYLIST_END );
if( b_start )
{
playlist_Control( p_playlist, PLAYLIST_ITEMPLAY , p_item );
playlist_Control( p_playlist, PLAYLIST_ITEMPLAY, p_item );
}
}
......
......@@ -625,8 +625,9 @@ void UpdateVLC::OnUpdatesTreeActivate( wxTreeEvent& event )
void UpdateVLC::DownloadFile( wxString url, wxString dst )
{
char *psz_local = ToLocale( dst.mb_str() );
msg_Dbg( p_intf, "Downloading %s to %s",
(const char *)url.mb_str(), (const char *)dst.mb_str() );
(const char *)url.mb_str(), psz_local );
stream_t *p_stream = NULL;
p_stream = stream_UrlNew( p_intf, (const char *)url.mb_str() );
......@@ -638,13 +639,14 @@ void UpdateVLC::DownloadFile( wxString url, wxString dst )
}
FILE *p_file = NULL;
p_file = fopen( (const char *)dst.mb_str(), "w" );
p_file = fopen( psz_local, "w" );
if( !p_file )
{
msg_Err( p_intf, "Failed to open %s for writing", (const char *)dst.mb_str() );
msg_Err( p_intf, "Failed to open %s for writing", psz_local );
// FIXME : display error message in dialog
return;
}
LocaleFree( psz_local );
int i_progress = 0;
wxProgressDialog *progressdialog =
......
......@@ -1495,7 +1495,9 @@ void WizardDialog::SetStream( char const *method, char const *address )
void WizardDialog::SetTranscodeOut( char const *address )
{
this->address = strdup( address );
char *psz_utf8 = FromLocale( address );
this->address = strdup( psz_utf8 );
LocaleFree( psz_utf8 );
}
void WizardDialog::SetMux( char const *mux )
......
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