]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wxwidgets: Fix charset when getting file names from the
authorChristophe Massiot <massiot@videolan.org>
Thu, 25 Aug 2005 16:36:39 +0000 (16:36 +0000)
committerChristophe Massiot <massiot@videolan.org>
Thu, 25 Aug 2005 16:36:39 +0000 (16:36 +0000)
   filesystem.

modules/gui/wxwidgets/dialogs.cpp
modules/gui/wxwidgets/open.cpp
modules/gui/wxwidgets/updatevlc.cpp
modules/gui/wxwidgets/wizard.cpp

index e33d5243041151772018dba4900784f907ccc963..cb2f35540dedbba3e0a8b82ec024c6bfe74f89d2 100644 (file)
@@ -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 );
index 60174ae5b6474099a7e56555a69fb3288c4f92ca..51a8b092db8eafc4db04843d6f47f6882b678e0e 100644 (file)
@@ -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 );
         }
     }
 
index 167c9361f1eb6aa4b9f02f04f6977b3ecadf73b6..2f707ecd4ccc1422edd22e662367ea5801f97e4d 100644 (file)
@@ -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 =
index 7860e9a9768e092447d9aaee384ff4981d0bcfc8..9b69cbff133fcee751eb05e9d5367b27a4518651 100644 (file)
@@ -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 )