diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp index 3651dd5bcf..f3c39db71a 100644 --- a/common/dialogs/wx_html_report_panel.cpp +++ b/common/dialogs/wx_html_report_panel.cpp @@ -27,6 +27,7 @@ #include #include #include +#include WX_HTML_REPORT_PANEL::WX_HTML_REPORT_PANEL( wxWindow* parent, wxWindowID id, @@ -335,7 +336,7 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event ) if( fn.GetExt().IsEmpty() ) fn.SetExt( "txt" ); - wxFile f( fn.GetFullPath(), wxFile::write ); + wxFFile f( fn.GetFullPath(), "wb" ); if( !f.IsOpened() ) { diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index 8e239711cd..2c615b8313 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -335,7 +335,7 @@ void ReadHotKeyConfig( wxString fileName, std::map& aHotKeys ) if( !wxFile::Exists( fileName ) ) return; - wxFile file( fileName, wxFile::OpenMode::read ); + wxFFile file( fileName, "rb" ); if( !file.IsOpened() ) // There is a problem to open file return; @@ -418,15 +418,13 @@ int ReadLegacyHotkeyConfigFile( const wxString& aFilename, std::map buffer( size ); diff --git a/common/page_layout/page_layout_reader.cpp b/common/page_layout/page_layout_reader.cpp index e889d1e9f6..c6f52b1edb 100644 --- a/common/page_layout/page_layout_reader.cpp +++ b/common/page_layout/page_layout_reader.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -837,7 +838,7 @@ void WS_DATA_MODEL::SetPageLayout( const wxString& aFullFileName, bool Append ) } } - wxFile wksFile( fullFileName ); + wxFFile wksFile( fullFileName, "rb" ); if( ! wksFile.IsOpened() ) { diff --git a/eeschema/bom_plugins.cpp b/eeschema/bom_plugins.cpp index 4d992946ec..32f0c7018b 100644 --- a/eeschema/bom_plugins.cpp +++ b/eeschema/bom_plugins.cpp @@ -23,6 +23,7 @@ */ #include "bom_plugins.h" +#include BOM_GENERATOR_HANDLER::BOM_GENERATOR_HANDLER( const wxString& aFile ) : m_file( aFile ) @@ -95,7 +96,7 @@ wxString BOM_GENERATOR_HANDLER::readHeader( const wxString& aEndSection ) if( aEndSection.IsEmpty() ) return wxEmptyString; - wxFile fdata( m_file.GetFullPath() ); // dtor will close the file + wxFFile fdata( m_file.GetFullPath(), "rb" ); // dtor will close the file wxString data; if( !fdata.ReadAll( &data ) ) diff --git a/eeschema/eeschema.cpp b/eeschema/eeschema.cpp index 722c27a79e..13e802691a 100644 --- a/eeschema/eeschema.cpp +++ b/eeschema/eeschema.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -377,12 +378,12 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje } } ); - wxFile destNetList( destFile.GetFullPath(), wxFile::write ); + wxFFile destNetList( destFile.GetFullPath(), "wb" ); if( destNetList.IsOpened() ) success = destNetList.Write( sexpr->AsString( 0 ) ); - // wxFile dtor will close the file + // wxFFile dtor will close the file } catch( ... ) { diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index ac09b3317d..1ebd934474 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -57,6 +57,7 @@ #include #include #include +#include #include #include @@ -927,9 +928,9 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) BASE_SCREEN::m_PageLayoutDescrFileName = "empty.kicad_wks"; wxFileName layoutfn( Prj().GetProjectPath(), BASE_SCREEN::m_PageLayoutDescrFileName ); - wxFile layoutfile; + wxFFile layoutfile; - if( layoutfile.Create( layoutfn.GetFullPath() ) ) + if( layoutfile.Open( layoutfn.GetFullPath(), "wb" ) ) { layoutfile.Write( WS_DATA_MODEL::EmptyLayout() ); layoutfile.Close(); diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp index 75af8420eb..976481029f 100644 --- a/eeschema/sim/sim_plot_frame.cpp +++ b/eeschema/sim/sim_plot_frame.cpp @@ -45,6 +45,7 @@ #include #include #include +#include SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond ) { @@ -1099,7 +1100,7 @@ void SIM_PLOT_FRAME::menuSaveCsv( wxCommandEvent& event ) if( saveDlg.ShowModal() == wxID_CANCEL ) return; - wxFile out( saveDlg.GetPath(), wxFile::write ); + wxFFile out( saveDlg.GetPath(), "wb" ); bool timeWritten = false; for( const auto& t : CurrentPlot()->GetTraces() ) diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 4275059876..1f25ed6fb1 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -35,6 +35,7 @@ #include #include #include +#include using json = nlohmann::json; @@ -207,12 +208,12 @@ void IFACE::SaveFileAs( const wxString& aProjectBasePath, const wxString& aProje } } - wxFile destJobFile( destFile.GetFullPath(), wxFile::write ); + wxFFile destJobFile( destFile.GetFullPath(), "wb" ); if( destJobFile.IsOpened() ) success = destJobFile.Write( js.dump( 0 ) ); - // wxFile dtor will close the file + // wxFFile dtor will close the file } catch( ... ) { diff --git a/kicad/kicad_manager_frame.cpp b/kicad/kicad_manager_frame.cpp index f6916ff9ac..be1d82e8e9 100644 --- a/kicad/kicad_manager_frame.cpp +++ b/kicad/kicad_manager_frame.cpp @@ -49,6 +49,8 @@ #include #include #include +#include + #ifdef __WXMAC__ #include @@ -474,11 +476,11 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, if( !wxFileName::FileExists( srcFileName ) || !wxCopyFile( srcFileName, destFileName.GetFullPath() ) ) { - wxFile file( destFileName.GetFullPath(), wxFile::write ); + wxFFile file( destFileName.GetFullPath(), "wb" ); if( file.IsOpened() ) file.Write( wxT( "{\n}\n") ); - // wxFile dtor will close the file + // wxFFile dtor will close the file } } } @@ -494,7 +496,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, // If a .kicad_sch file does not exist, create a "stub" file ( minimal schematic file ) if( !fn.FileExists() ) { - wxFile file( fn.GetFullPath(), wxFile::write ); + wxFFile file( fn.GetFullPath(), "wb" ); if( file.IsOpened() ) file.Write( wxT( "(kicad_sch (version 20200310) (host eeschema \"unknown\")\n" @@ -502,7 +504,7 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, " (symbol_instances)\n)\n" ) ); - // wxFile dtor will close the file + // wxFFile dtor will close the file } // If a .kicad_pcb or .brd file does not exist, @@ -513,12 +515,12 @@ void KICAD_MANAGER_FRAME::CreateNewProject( const wxFileName& aProjectFileName, if( !fn.FileExists() && !leg_fn.FileExists() ) { - wxFile file( fn.GetFullPath(), wxFile::write ); + wxFFile file( fn.GetFullPath(), "wb" ); if( file.IsOpened() ) file.Write( wxT( "(kicad_pcb (version 4) (host kicad \"dummy file\") )\n" ) ); - // wxFile dtor will close the file + // wxFFile dtor will close the file } } diff --git a/libs/sexpr/sexpr_parser.cpp b/libs/sexpr/sexpr_parser.cpp index 62586acd5a..ae2feda990 100644 --- a/libs/sexpr/sexpr_parser.cpp +++ b/libs/sexpr/sexpr_parser.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -62,7 +63,7 @@ namespace SEXPR // the filename is not always a UTF7 string, so do not use ifstream // that do not work with unicode chars. wxString fname( FROM_UTF8( aFileName.c_str() ) ); - wxFile file( fname ); + wxFFile file( fname, "rb" ); size_t length = file.Length(); if( length <= 0 )