diff --git a/common/design_block_info.cpp b/common/design_block_info.cpp index 55aedb95ec..10c3582047 100644 --- a/common/design_block_info.cpp +++ b/common/design_block_info.cpp @@ -37,7 +37,6 @@ #include #include #include -#include DESIGN_BLOCK_INFO* DESIGN_BLOCK_LIST::GetDesignBlockInfo( const wxString& aLibNickname, const wxString& aDesignBlockName ) diff --git a/common/design_block_info.h b/common/design_block_info.h index 4816438681..20070bea17 100644 --- a/common/design_block_info.h +++ b/common/design_block_info.h @@ -42,7 +42,6 @@ class DESIGN_BLOCK_LIST_IMPL; class PROGRESS_REPORTER; class wxTopLevelWindow; class KIWAY; -class LOCALE_IO; class wxTextFile; @@ -114,7 +113,7 @@ protected: } /// lazily load stuff not filled in by constructor. This may throw IO_ERRORS. - virtual void load( const LOCALE_IO* locale = nullptr ) {}; + virtual void load() {}; protected: DESIGN_BLOCK_LIST* m_owner; ///< provides access to DESIGN_BLOCK_LIB_TABLE diff --git a/common/design_block_info_impl.cpp b/common/design_block_info_impl.cpp index 4fcaa1cfc1..2ff96ad5b9 100644 --- a/common/design_block_info_impl.cpp +++ b/common/design_block_info_impl.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -35,14 +34,13 @@ #include -void DESIGN_BLOCK_INFO_IMPL::load( const LOCALE_IO* locale ) +void DESIGN_BLOCK_INFO_IMPL::load() { DESIGN_BLOCK_LIB_TABLE* dbtable = m_owner->GetTable(); wxASSERT( dbtable ); - std::unique_ptr design_block( dbtable->GetEnumeratedDesignBlock( m_nickname, m_dbname, - locale ) ); + std::unique_ptr design_block( dbtable->GetEnumeratedDesignBlock( m_nickname, m_dbname ) ); if( design_block ) { @@ -148,14 +146,7 @@ bool DESIGN_BLOCK_LIST_IMPL::ReadDesignBlockFiles( DESIGN_BLOCK_LIB_TABLE* aTabl void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks() { - LOCALE_IO toggle_locale; - - // Parse the design_blocks in parallel. WARNING! This requires changing the locale, which is - // GLOBAL. It is only thread safe to construct the LOCALE_IO before the threads are created, - // destroy it after they finish, and block the main (GUI) thread while they work. Any deviation - // from this will cause nasal demons. - // - // TODO: blast LOCALE_IO into the sun + // Parse the design_blocks in parallel. SYNC_QUEUE> queue_parsed; @@ -164,7 +155,7 @@ void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks() std::vector> returns( num_elements ); auto db_thread = - [ this, &queue_parsed, &toggle_locale ]() -> size_t + [ this, &queue_parsed ]() -> size_t { wxString nickname; @@ -176,7 +167,7 @@ void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks() CatchErrors( [&]() { - m_lib_table->DesignBlockEnumerate( dbnames, nickname, false, &toggle_locale ); + m_lib_table->DesignBlockEnumerate( dbnames, nickname, false ); } ); for( wxString dbname : dbnames ) @@ -184,7 +175,7 @@ void DESIGN_BLOCK_LIST_IMPL::loadDesignBlocks() CatchErrors( [&]() { - auto* dbinfo = new DESIGN_BLOCK_INFO_IMPL( this, nickname, dbname, &toggle_locale ); + auto* dbinfo = new DESIGN_BLOCK_INFO_IMPL( this, nickname, dbname ); queue_parsed.move_push( std::unique_ptr( dbinfo ) ); } ); diff --git a/common/design_block_info_impl.h b/common/design_block_info_impl.h index cdc2b55b5b..423b8aba91 100644 --- a/common/design_block_info_impl.h +++ b/common/design_block_info_impl.h @@ -30,13 +30,11 @@ #include #include -class LOCALE_IO; - class KICOMMON_API DESIGN_BLOCK_INFO_IMPL : public DESIGN_BLOCK_INFO { public: DESIGN_BLOCK_INFO_IMPL( DESIGN_BLOCK_LIST* aOwner, const wxString& aNickname, - const wxString& aDesignBlockName, const LOCALE_IO* aLocale ) + const wxString& aDesignBlockName ) { m_nickname = aNickname; m_dbname = aDesignBlockName; @@ -44,7 +42,7 @@ public: m_owner = aOwner; m_loaded = false; - load( aLocale ); + load(); } // A constructor for cached items @@ -73,7 +71,7 @@ public: } protected: - virtual void load( const LOCALE_IO* aLocale = nullptr ) override; + virtual void load() override; }; diff --git a/common/design_block_lib_table.cpp b/common/design_block_lib_table.cpp index a1d07351c7..466922e5ca 100644 --- a/common/design_block_lib_table.cpp +++ b/common/design_block_lib_table.cpp @@ -39,7 +39,6 @@ #include #include -#include #define OPT_SEP '|' ///< options separator character @@ -334,23 +333,13 @@ long long DESIGN_BLOCK_LIB_TABLE::GenerateTimestamp( const wxString* aNickname ) void DESIGN_BLOCK_LIB_TABLE::DesignBlockEnumerate( wxArrayString& aDesignBlockNames, const wxString& aNickname, - bool aBestEfforts, const LOCALE_IO* aLocale ) + bool aBestEfforts ) { const DESIGN_BLOCK_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); - if( !aLocale ) - { - LOCALE_IO toggle_locale; - - row->plugin->DesignBlockEnumerate( aDesignBlockNames, row->GetFullURI( true ), aBestEfforts, - row->GetProperties() ); - } - else - { - row->plugin->DesignBlockEnumerate( aDesignBlockNames, row->GetFullURI( true ), aBestEfforts, - row->GetProperties() ); - } + row->plugin->DesignBlockEnumerate( aDesignBlockNames, row->GetFullURI( true ), aBestEfforts, + row->GetProperties() ); } @@ -401,34 +390,19 @@ static void setLibNickname( DESIGN_BLOCK* aModule, const wxString& aNickname, const DESIGN_BLOCK* DESIGN_BLOCK_LIB_TABLE::GetEnumeratedDesignBlock( const wxString& aNickname, - const wxString& aDesignBlockName, - const LOCALE_IO* aLocale ) + const wxString& aDesignBlockName ) { const DESIGN_BLOCK_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); - if( !aLocale ) - { - LOCALE_IO toggle_locale; - - return row->plugin->GetEnumeratedDesignBlock( row->GetFullURI( true ), aDesignBlockName, - row->GetProperties() ); - } - else - { - return row->plugin->GetEnumeratedDesignBlock( row->GetFullURI( true ), aDesignBlockName, - row->GetProperties() ); - } + return row->plugin->GetEnumeratedDesignBlock( row->GetFullURI( true ), aDesignBlockName, + row->GetProperties() ); } bool DESIGN_BLOCK_LIB_TABLE::DesignBlockExists( const wxString& aNickname, const wxString& aDesignBlockName ) { - // NOT THREAD-SAFE! LOCALE_IO is global! - - LOCALE_IO toggle_locale; - try { const DESIGN_BLOCK_LIB_TABLE_ROW* row = FindRow( aNickname, true ); @@ -448,10 +422,6 @@ DESIGN_BLOCK* DESIGN_BLOCK_LIB_TABLE::DesignBlockLoad( const wxString& aNickname const wxString& aDesignBlockName, bool aKeepUUID ) { - // NOT THREAD-SAFE! LOCALE_IO is global! - - LOCALE_IO toggle_locale; - const DESIGN_BLOCK_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); @@ -468,10 +438,6 @@ DESIGN_BLOCK_LIB_TABLE::SAVE_T DESIGN_BLOCK_LIB_TABLE::DesignBlockSave( const wxString& aNickname, const DESIGN_BLOCK* aDesignBlock, bool aOverwrite ) { - // NOT THREAD-SAFE! LOCALE_IO is global! - - LOCALE_IO toggle_locale; - const DESIGN_BLOCK_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 933c2e98ab..25ef8465b1 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -39,7 +39,6 @@ #include #include #include -#include FOOTPRINT_INFO* FOOTPRINT_LIST::GetFootprintInfo( const wxString& aLibNickname, const wxString& aFootprintName ) diff --git a/common/fp_lib_table.cpp b/common/fp_lib_table.cpp index 4d428728e7..789783b12d 100644 --- a/common/fp_lib_table.cpp +++ b/common/fp_lib_table.cpp @@ -40,7 +40,6 @@ #include #include -#include #define OPT_SEP '|' ///< options separator character @@ -313,23 +312,13 @@ long long FP_LIB_TABLE::GenerateTimestamp( const wxString* aNickname ) void FP_LIB_TABLE::FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname, - bool aBestEfforts, const LOCALE_IO* aLocale ) + bool aBestEfforts ) { const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); - if( !aLocale ) - { - LOCALE_IO toggle_locale; - - row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts, - row->GetProperties() ); - } - else - { - row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts, - row->GetProperties() ); - } + row->plugin->FootprintEnumerate( aFootprintNames, row->GetFullURI( true ), aBestEfforts, + row->GetProperties() ); } @@ -379,33 +368,18 @@ static void setLibNickname( FOOTPRINT* aModule, const wxString& aNickname, const FOOTPRINT* FP_LIB_TABLE::GetEnumeratedFootprint( const wxString& aNickname, - const wxString& aFootprintName, - const LOCALE_IO* aLocale ) + const wxString& aFootprintName ) { const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); - if( !aLocale ) - { - LOCALE_IO toggle_locale; - - return row->plugin->GetEnumeratedFootprint( row->GetFullURI( true ), aFootprintName, - row->GetProperties() ); - } - else - { - return row->plugin->GetEnumeratedFootprint( row->GetFullURI( true ), aFootprintName, - row->GetProperties() ); - } + return row->plugin->GetEnumeratedFootprint( row->GetFullURI( true ), aFootprintName, + row->GetProperties() ); } bool FP_LIB_TABLE::FootprintExists( const wxString& aNickname, const wxString& aFootprintName ) { - // NOT THREAD-SAFE! LOCALE_IO is global! - - LOCALE_IO toggle_locale; - try { const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true ); @@ -424,10 +398,6 @@ bool FP_LIB_TABLE::FootprintExists( const wxString& aNickname, const wxString& a FOOTPRINT* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString& aFootprintName, bool aKeepUUID ) { - // NOT THREAD-SAFE! LOCALE_IO is global! - - LOCALE_IO toggle_locale; - const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); @@ -443,10 +413,6 @@ FOOTPRINT* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, const FOOTPRINT* aFootprint, bool aOverwrite ) { - // NOT THREAD-SAFE! LOCALE_IO is global! - - LOCALE_IO toggle_locale; - const FP_LIB_TABLE_ROW* row = FindRow( aNickname, true ); wxASSERT( row->plugin ); diff --git a/eeschema/sch_io/eagle/sch_io_eagle.cpp b/eeschema/sch_io/eagle/sch_io_eagle.cpp index a72dad4a0f..fedf145103 100644 --- a/eeschema/sch_io/eagle/sch_io_eagle.cpp +++ b/eeschema/sch_io/eagle/sch_io_eagle.cpp @@ -24,8 +24,6 @@ #include -#include - #include #include #include @@ -351,7 +349,6 @@ SCH_SHEET* SCH_IO_EAGLE::LoadSchematicFile( const wxString& aFileName, SCHEMATIC const std::map* aProperties ) { wxASSERT( !aFileName || aSchematic != nullptr ); - LOCALE_IO toggle; // toggles on, then off, the C locale. // Show the font substitution warnings fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() ); @@ -559,8 +556,6 @@ void SCH_IO_EAGLE::ensureLoadedLibrary( const wxString& aLibraryPath ) return; } - LOCALE_IO toggle; // toggles on, then off, the C locale. - if( m_progressReporter ) { m_progressReporter->Report( wxString::Format( _( "Loading %s..." ), aLibraryPath ) ); diff --git a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp index 7ff4913a56..551ae46b96 100644 --- a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp +++ b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp @@ -37,7 +37,6 @@ #include #include #include -#include #include #include #include @@ -130,9 +129,7 @@ SCH_SHEET* SCH_IO_KICAD_LEGACY::LoadSchematicFile( const wxString& aFileName, SC { wxASSERT( !aFileName || aSchematic != nullptr ); - LOCALE_IO toggle; // toggles on, then off, the C locale. SCH_SHEET* sheet; - wxFileName fn = aFileName; // Unfortunately child sheet file names the legacy schematic file format are not fully @@ -1502,8 +1499,6 @@ void SCH_IO_KICAD_LEGACY::SaveSchematicFile( const wxString& aFileName, SCH_SHEE wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET object." ); wxCHECK_RET( !aFileName.IsEmpty(), "No schematic file name defined." ); - LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values. - init( aSchematic, aProperties ); wxFileName fn = aFileName; @@ -1804,7 +1799,7 @@ void SCH_IO_KICAD_LEGACY::saveBitmap( const SCH_BITMAP& aBitmap ) m_out->Print( 0, "Pos %-4d %-4d\n", schIUScale.IUToMils( aBitmap.GetPosition().x ), schIUScale.IUToMils( aBitmap.GetPosition().y ) ); - m_out->Print( "%s", fmt::format("Scale {:g}\n atof", refImage.GetImageScale()).c_str() ); + m_out->Print( "%s", fmt::format("Scale {:g}\n", refImage.GetImageScale()).c_str() ); m_out->Print( 0, "Data\n" ); wxMemoryOutputStream stream; @@ -2123,8 +2118,6 @@ void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( wxArrayString& aSymbolNameList, const wxString& aLibraryPath, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - bool powerSymbolsOnly = ( aProperties && aProperties->find( SYMBOL_LIB_TABLE::PropPowerSymsOnly ) != aProperties->end() ); @@ -2144,8 +2137,6 @@ void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( std::vector& aSymbolL const wxString& aLibraryPath, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - bool powerSymbolsOnly = ( aProperties && aProperties->find( SYMBOL_LIB_TABLE::PropPowerSymsOnly ) != aProperties->end() ); @@ -2165,8 +2156,6 @@ LIB_SYMBOL* SCH_IO_KICAD_LEGACY::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - cacheLib( aLibraryPath, aProperties ); LIB_SYMBOL_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName ); @@ -2181,8 +2170,6 @@ LIB_SYMBOL* SCH_IO_KICAD_LEGACY::LoadSymbol( const wxString& aLibraryPath, void SCH_IO_KICAD_LEGACY::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - cacheLib( aLibraryPath, aProperties ); m_cache->AddSymbol( aSymbol ); @@ -2195,8 +2182,6 @@ void SCH_IO_KICAD_LEGACY::SaveSymbol( const wxString& aLibraryPath, const LIB_SY void SCH_IO_KICAD_LEGACY::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - cacheLib( aLibraryPath, aProperties ); m_cache->DeleteSymbol( aSymbolName ); @@ -2215,8 +2200,6 @@ void SCH_IO_KICAD_LEGACY::CreateLibrary( const wxString& aLibraryPath, aLibraryPath.GetData() ) ); } - LOCALE_IO toggle; - delete m_cache; m_cache = new SCH_IO_KICAD_LEGACY_LIB_CACHE( aLibraryPath ); m_cache->SetModified(); diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp index b2d08d7d3d..f8ef30cc52 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -101,7 +100,6 @@ SCH_SHEET* SCH_IO_KICAD_SEXPR::LoadSchematicFile( const wxString& aFileName, SCH { wxASSERT( !aFileName || aSchematic != nullptr ); - LOCALE_IO toggle; // toggles on, then off, the C locale. SCH_SHEET* sheet; wxFileName fn = aFileName; @@ -324,7 +322,6 @@ void SCH_IO_KICAD_SEXPR::LoadContent( LINE_READER& aReader, SCH_SHEET* aSheet, i { wxCHECK( aSheet, /* void */ ); - LOCALE_IO toggle; SCH_IO_KICAD_SEXPR_PARSER parser( &aReader ); parser.ParseSchematic( aSheet, true, aFileVersion ); @@ -338,8 +335,6 @@ void SCH_IO_KICAD_SEXPR::SaveSchematicFile( const wxString& aFileName, SCH_SHEET wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET object." ); wxCHECK_RET( !aFileName.IsEmpty(), "No schematic file name defined." ); - LOCALE_IO toggle; // toggles on, then off, the C locale, to write floating point values. - wxString sanityResult = aSheet->GetScreen()->GroupsSanityCheck(); if( sanityResult != wxEmptyString && m_queryUserCallback ) @@ -520,7 +515,6 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SELECTION* aSelection, SCH_SHEET_PATH* aSel { wxCHECK( aSelection && aSelectionPath && aFormatter, /* void */ ); - LOCALE_IO toggle; SCH_SHEET_LIST sheets = aSchematic.Hierarchy(); m_schematic = &aSchematic; @@ -1583,8 +1577,6 @@ void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( wxArrayString& aSymbolNameList, const wxString& aLibraryPath, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - bool powerSymbolsOnly = ( aProperties && aProperties->find( SYMBOL_LIB_TABLE::PropPowerSymsOnly ) != aProperties->end() ); @@ -1604,8 +1596,6 @@ void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( std::vector& aSymbolLi const wxString& aLibraryPath, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - bool powerSymbolsOnly = ( aProperties && aProperties->find( SYMBOL_LIB_TABLE::PropPowerSymsOnly ) != aProperties->end() ); @@ -1625,8 +1615,6 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - cacheLib( aLibraryPath, aProperties ); LIB_SYMBOL_MAP::const_iterator it = m_cache->m_symbols.find( aSymbolName ); @@ -1652,8 +1640,6 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR::LoadSymbol( const wxString& aLibraryPath, void SCH_IO_KICAD_SEXPR::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - cacheLib( aLibraryPath, aProperties ); m_cache->AddSymbol( aSymbol ); @@ -1666,8 +1652,6 @@ void SCH_IO_KICAD_SEXPR::SaveSymbol( const wxString& aLibraryPath, const LIB_SYM void SCH_IO_KICAD_SEXPR::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - cacheLib( aLibraryPath, aProperties ); m_cache->DeleteSymbol( aSymbolName ); @@ -1686,8 +1670,6 @@ void SCH_IO_KICAD_SEXPR::CreateLibrary( const wxString& aLibraryPath, aLibraryPath.GetData() ) ); } - LOCALE_IO toggle; - delete m_cache; m_cache = new SCH_IO_KICAD_SEXPR_LIB_CACHE( aLibraryPath ); m_cache->SetModified(); @@ -1802,7 +1784,6 @@ std::vector SCH_IO_KICAD_SEXPR::ParseLibSymbols( std::string& aSymb std::string aSource, int aFileVersion ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. LIB_SYMBOL* newSymbol = nullptr; LIB_SYMBOL_MAP map; @@ -1829,7 +1810,6 @@ std::vector SCH_IO_KICAD_SEXPR::ParseLibSymbols( std::string& aSymb void SCH_IO_KICAD_SEXPR::FormatLibSymbol( LIB_SYMBOL* symbol, OUTPUTFORMATTER & formatter ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol( symbol, formatter ); } diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.cpp b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.cpp index 40cc101f18..3de31b953f 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.cpp +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_lib_cache.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include #include "sch_io_kicad_sexpr_lib_cache.h" @@ -63,10 +62,6 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::Load() wxString::Format( "Cannot use relative file paths in sexpr plugin to " "open library '%s'.", m_libFileName.GetFullPath() ) ); - // The current locale must use period as the decimal point. - // Yes, we did this earlier, but it's sadly not thread-safe. - LOCALE_IO toggle; - wxLogTrace( traceSchLegacyPlugin, "Loading sexpr symbol library file '%s'", m_libFileName.GetFullPath() ); @@ -89,8 +84,6 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::Save( const std::optional& aOpt ) if( !m_isModified ) return; - LOCALE_IO toggle; // toggles on, then off, the C locale. - // Write through symlinks, don't replace them. wxFileName fn = GetRealFile(); @@ -139,11 +132,6 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMAT { wxCHECK_RET( aSymbol, "Invalid LIB_SYMBOL pointer." ); - // The current locale must use period as the decimal point. - wxCHECK2( wxLocale::GetInfo( wxLOCALE_DECIMAL_POINT, wxLOCALE_CAT_NUMBER ) == ".", - LOCALE_IO toggle ); - - // If we've requested to embed the fonts in the symbol, do so. // Otherwise, clear the embedded fonts from the symbol. Embedded // fonts will be used if available diff --git a/gerbview/excellon_read_drill_file.cpp b/gerbview/excellon_read_drill_file.cpp index 033daa2186..4933892278 100644 --- a/gerbview/excellon_read_drill_file.cpp +++ b/gerbview/excellon_read_drill_file.cpp @@ -74,7 +74,6 @@ #include #include #include -#include #include #include #include @@ -481,8 +480,6 @@ bool EXCELLON_IMAGE::LoadFile( const wxString & aFullFileName, EXCELLON_DEFAULTS wxString msg; m_FileName = aFullFileName; - LOCALE_IO toggleIo; - // FILE_LINE_READER will close the file. FILE_LINE_READER excellonReader( m_Current_File, m_FileName ); diff --git a/gerbview/export_to_pcbnew.cpp b/gerbview/export_to_pcbnew.cpp index 549c613cc5..a2bb4b3ca8 100644 --- a/gerbview/export_to_pcbnew.cpp +++ b/gerbview/export_to_pcbnew.cpp @@ -28,7 +28,6 @@ #include #include -#include #include #include #include @@ -57,8 +56,6 @@ GBR_TO_PCB_EXPORTER::~GBR_TO_PCB_EXPORTER() bool GBR_TO_PCB_EXPORTER::ExportPcb( const int* aLayerLookUpTable, int aCopperLayers ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - m_fp = wxFopen( m_pcb_file_name, wxT( "wt" ) ); if( m_fp == nullptr ) diff --git a/gerbview/job_file_reader.cpp b/gerbview/job_file_reader.cpp index 3dfe193b2c..6ae5231cd0 100644 --- a/gerbview/job_file_reader.cpp +++ b/gerbview/job_file_reader.cpp @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -111,8 +110,6 @@ bool GERBER_JOBFILE_READER::ReadGerberJobFile() if( jobFile == nullptr ) return false; - LOCALE_IO toggleIo; - FILE_LINE_READER jobfileReader( jobFile, m_filename.GetFullPath() ); // Will close jobFile wxString data; diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index f44f2a0537..3af5297592 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -24,7 +24,6 @@ #include "ki_exception.h" #include -#include #include #include #include @@ -245,8 +244,6 @@ bool GERBER_FILE_IMAGE::LoadGerberFile( const wxString& aFullFileName ) m_FileName = aFullFileName; - LOCALE_IO toggleIo; - wxString msg; while( true ) diff --git a/gerbview/rs274_read_XY_and_IJ_coordinates.cpp b/gerbview/rs274_read_XY_and_IJ_coordinates.cpp index a379095667..8de3542f0b 100644 --- a/gerbview/rs274_read_XY_and_IJ_coordinates.cpp +++ b/gerbview/rs274_read_XY_and_IJ_coordinates.cpp @@ -114,7 +114,9 @@ VECTOR2I GERBER_FILE_IMAGE::ReadXYCoord( char*& aText, bool aExcellonMode ) line.push_back( *( aText++ ) ); } - double val = strtod( line.data(), nullptr ); + double val; + wxString text( line.data() ); + text.ToCDouble( &val ); if( is_float ) { @@ -202,7 +204,10 @@ VECTOR2I GERBER_FILE_IMAGE::ReadIJCoord( char*& aText ) line.push_back( *( aText++ ) ); } - double val = strtod( line.data(), nullptr ); + double val; + wxString text( line.data() ); + text.Trim( true ).Trim( false ); + text.ToCDouble( &val ); if( is_float ) { @@ -314,7 +319,21 @@ double ReadDouble( char*& text, bool aSkipSeparator = true ) } else { - ret = strtod( text, &text ); + wxString line( text ); + auto endpos = line.find_first_not_of( "0123456789.-+eE" ); + line.Trim( false ); + line.ToCDouble( &ret ); + + if( endpos != wxString::npos ) + { + // Advance the text pointer to the end of the number + text += endpos; + } + else + { + // If no non-number characters found, advance to the end of the string + text += line.length(); + } } if( *text == ',' || isspace( *text ) ) diff --git a/include/design_block_lib_table.h b/include/design_block_lib_table.h index d951d07d62..68a7bcd6c6 100644 --- a/include/design_block_lib_table.h +++ b/include/design_block_lib_table.h @@ -158,13 +158,11 @@ public: * \a aNickname. * @param aNickname is a locator for the "library", it is a "name" in LIB_TABLE_ROW. * @param aBestEfforts if true, don't throw on errors. - * @param aLocale a previously set-up locale. Currently required for multi-threading, as LOCALE_IO - * uses global storage. * * @throw IO_ERROR if the library cannot be found, or design block cannot be loaded. */ void DesignBlockEnumerate( wxArrayString& aDesignBlockNames, const wxString& aNickname, - bool aBestEfforts, const LOCALE_IO* aLocale = nullptr ); + bool aBestEfforts ); /** * Generate a hashed timestamp representing the last-mod-times of the library indicated @@ -202,8 +200,7 @@ public: * * The return value is const to allow it to return a reference to a cached item. */ - const DESIGN_BLOCK* GetEnumeratedDesignBlock( const wxString& aNickname, const wxString& aDesignBlockName, - const LOCALE_IO* aLocale = nullptr ); + const DESIGN_BLOCK* GetEnumeratedDesignBlock( const wxString& aNickname, const wxString& aDesignBlockName ); /** * The set of return values from DesignBlockSave() below. */ diff --git a/include/footprint_info.h b/include/footprint_info.h index e8e0f5f73f..cc15c0a768 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -46,7 +46,6 @@ class FOOTPRINT_LIST_IMPL; class PROGRESS_REPORTER; class wxTopLevelWindow; class KIWAY; -class LOCALE_IO; class wxTextFile; @@ -135,7 +134,7 @@ protected: } /// lazily load stuff not filled in by constructor. This may throw IO_ERRORS. - virtual void load( const LOCALE_IO* aLocale = nullptr ) { }; + virtual void load() { }; FOOTPRINT_LIST* m_owner; ///< provides access to FP_LIB_TABLE diff --git a/include/fp_lib_table.h b/include/fp_lib_table.h index 7f8a49d34f..8f355eebd2 100644 --- a/include/fp_lib_table.h +++ b/include/fp_lib_table.h @@ -32,7 +32,6 @@ class FOOTPRINT; class FP_LIB_TABLE_GRID; class PCB_IO; -class LOCALE_IO; /** @@ -144,13 +143,11 @@ public: * @param aFootprintNames is the list to fill with the footprint names found in \a aNickname * @param aNickname is a locator for the "library", it is a "name" in LIB_TABLE_ROW. * @param aBestEfforts if true, don't throw on errors. - * @param aLocale a previously set-up locale. Currently required for multi-threading, as LOCALE_IO - * uses global storage. * * @throw IO_ERROR if the library cannot be found, or footprint cannot be loaded. */ void FootprintEnumerate( wxArrayString& aFootprintNames, const wxString& aNickname, - bool aBestEfforts, const LOCALE_IO* aLocale = nullptr ); + bool aBestEfforts ); /** * Generate a hashed timestamp representing the last-mod-times of the library indicated @@ -183,14 +180,10 @@ public: * A version of #FootprintLoad() for use after #FootprintEnumerate() for more efficient * cache management. * - * @param aLocale a previously set-up locale. Currently required for multi-threading, as LOCALE_IO - * uses global storage. - * * The return value is const to allow it to return a reference to a cached item. */ const FOOTPRINT* GetEnumeratedFootprint( const wxString& aNickname, - const wxString& aFootprintName, - const LOCALE_IO* aLocale = nullptr ); + const wxString& aFootprintName ); /** * The set of return values from FootprintSave() below. */ diff --git a/pcb_calculator/datafile_read_write.cpp b/pcb_calculator/datafile_read_write.cpp index 9f3995db15..2556182d08 100644 --- a/pcb_calculator/datafile_read_write.cpp +++ b/pcb_calculator/datafile_read_write.cpp @@ -22,6 +22,8 @@ * with this program. If not, see . */ +#include + #include #include @@ -30,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -53,8 +54,6 @@ bool PANEL_REGULATOR::ReadDataFile() if( file == nullptr ) return false; - // Switch the locale to standard C (needed to read/write floating point numbers) - LOCALE_IO toggle; m_RegulatorList.Clear(); PCB_CALCULATOR_DATAFILE* datafile = new PCB_CALCULATOR_DATAFILE( &m_RegulatorList ); @@ -92,9 +91,6 @@ bool PANEL_REGULATOR::ReadDataFile() bool PANEL_REGULATOR::WriteDataFile() { - // Switch the locale to standard C (needed to read/write floating point numbers) - LOCALE_IO toggle; - auto datafile = std::make_unique( &m_RegulatorList ); try @@ -155,19 +151,19 @@ void PCB_CALCULATOR_DATAFILE::Format( OUTPUTFORMATTER* aFormatter, aFormatter->Print( aNestLevel, "(%s %s\n", getTokenName( T_regulator ), aFormatter->Quotew( item->m_Name ).c_str() ); - aFormatter->Print( aNestLevel + 1, "(%s %g)\n", getTokenName( T_reg_vref_min ), - item->m_VrefMin ); - aFormatter->Print( aNestLevel + 1, "(%s %g)\n", getTokenName( T_reg_vref_typ ), - item->m_VrefTyp ); - aFormatter->Print( aNestLevel + 1, "(%s %g)\n", getTokenName( T_reg_vref_max ), - item->m_VrefMax ); + aFormatter->Print( aNestLevel + 1, "%s", fmt::format( "({} {:g})\n", getTokenName( T_reg_vref_min ), + item->m_VrefMin ).c_str() ); + aFormatter->Print( aNestLevel + 1, "%s", fmt::format( "({} {:g})\n", getTokenName( T_reg_vref_typ ), + item->m_VrefTyp ).c_str() ); + aFormatter->Print( aNestLevel + 1, "%s", fmt::format( "({} {:g})\n", getTokenName( T_reg_vref_max ), + item->m_VrefMax ).c_str() ); if( item->m_Type == 1 ) { - aFormatter->Print( aNestLevel + 1, "(%s %g)\n", getTokenName( T_reg_iadj_typ ), - item->m_IadjTyp ); - aFormatter->Print( aNestLevel + 1, "(%s %g)\n", getTokenName( T_reg_iadj_max ), - item->m_IadjMax ); + aFormatter->Print( aNestLevel + 1, "%s", fmt::format( "({} {:g})\n", getTokenName( T_reg_iadj_typ ), + item->m_IadjTyp ).c_str() ); + aFormatter->Print( aNestLevel + 1, "%s", fmt::format( "({} {:g})\n", getTokenName( T_reg_iadj_max ), + item->m_IadjMax ).c_str() ); } aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_reg_type ), @@ -233,7 +229,10 @@ void PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr( PCB_CALCULATOR_DATAFIL if( token != T_NUMBER ) Expecting( T_NUMBER ); - sscanf( CurText(), "%lf", &val ); + wxString text = CurText(); + text.Trim( true ).Trim( false ); + + text.ToCDouble( &val ); NeedRIGHT(); return val; }; diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp index 2f585f36dd..4ddf81e6eb 100644 --- a/pcbnew/footprint_info_impl.cpp +++ b/pcbnew/footprint_info_impl.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include @@ -41,13 +40,13 @@ #include -void FOOTPRINT_INFO_IMPL::load( const LOCALE_IO* aLocale ) +void FOOTPRINT_INFO_IMPL::load() { FP_LIB_TABLE* fptable = m_owner->GetTable(); wxASSERT( fptable ); - const FOOTPRINT* footprint = fptable->GetEnumeratedFootprint( m_nickname, m_fpname, aLocale ); + const FOOTPRINT* footprint = fptable->GetEnumeratedFootprint( m_nickname, m_fpname ); if( footprint == nullptr ) // Should happen only with malformed/broken libraries { @@ -165,14 +164,7 @@ bool FOOTPRINT_LIST_IMPL::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxStri void FOOTPRINT_LIST_IMPL::loadFootprints() { - LOCALE_IO toggle_locale; - - // Parse the footprints in parallel. WARNING! This requires changing the locale, which is - // GLOBAL. It is only thread safe to construct the LOCALE_IO before the threads are created, - // destroy it after they finish, and block the main (GUI) thread while they work. Any deviation - // from this will cause nasal demons. - // - // TODO: blast LOCALE_IO into the sun + // Parse the footprints in parallel. SYNC_QUEUE> queue_parsed; thread_pool& tp = GetKiCadThreadPool(); @@ -180,7 +172,7 @@ void FOOTPRINT_LIST_IMPL::loadFootprints() std::vector> returns( num_elements ); auto fp_thread = - [ this, &queue_parsed, &toggle_locale ]() -> size_t + [ this, &queue_parsed ]() -> size_t { wxString nickname; @@ -192,7 +184,7 @@ void FOOTPRINT_LIST_IMPL::loadFootprints() CatchErrors( [&]() { - m_lib_table->FootprintEnumerate( fpnames, nickname, false, &toggle_locale ); + m_lib_table->FootprintEnumerate( fpnames, nickname, false ); } ); for( wxString fpname : fpnames ) @@ -200,7 +192,7 @@ void FOOTPRINT_LIST_IMPL::loadFootprints() CatchErrors( [&]() { - auto* fpinfo = new FOOTPRINT_INFO_IMPL( this, nickname, fpname, &toggle_locale ); + auto* fpinfo = new FOOTPRINT_INFO_IMPL( this, nickname, fpname ); queue_parsed.move_push( std::unique_ptr( fpinfo ) ); } ); diff --git a/pcbnew/footprint_info_impl.h b/pcbnew/footprint_info_impl.h index fee0c569b6..1df5e1a73f 100644 --- a/pcbnew/footprint_info_impl.h +++ b/pcbnew/footprint_info_impl.h @@ -34,8 +34,7 @@ class LOCALE_IO; class FOOTPRINT_INFO_IMPL : public FOOTPRINT_INFO { public: - FOOTPRINT_INFO_IMPL( FOOTPRINT_LIST* aOwner, const wxString& aNickname, const wxString& aFootprintName, - const LOCALE_IO* aLocale ) + FOOTPRINT_INFO_IMPL( FOOTPRINT_LIST* aOwner, const wxString& aNickname, const wxString& aFootprintName ) { m_nickname = aNickname; m_fpname = aFootprintName; @@ -45,7 +44,7 @@ public: m_owner = aOwner; m_loaded = false; - load( aLocale ); + load(); } // A constructor for cached items @@ -77,7 +76,7 @@ public: } protected: - virtual void load( const LOCALE_IO* aLocale ) override; + virtual void load() override; }; diff --git a/pcbnew/footprint_libraries_utils.cpp b/pcbnew/footprint_libraries_utils.cpp index 30a750fb71..c0e8d17ae9 100644 --- a/pcbnew/footprint_libraries_utils.cpp +++ b/pcbnew/footprint_libraries_utils.cpp @@ -599,7 +599,7 @@ void PCB_EDIT_FRAME::ExportFootprintsToLibrary( bool aStoreInNewLib, const wxStr DisplayInfoMessage( this, _( "No footprints to export!" ) ); return; } - + auto resetReference = []( FOOTPRINT* aFootprint ) { @@ -1265,7 +1265,7 @@ FOOTPRINT* PCB_BASE_FRAME::CreateNewFootprint( wxString aFootprintName, const wx // Try to infer the footprint attributes from an existing footprint in the library try { - tbl->FootprintEnumerate( fpnames, aLibName, true, nullptr ); + tbl->FootprintEnumerate( fpnames, aLibName, true ); if( !fpnames.empty() ) footprintAttrs = tbl->FootprintLoad( aLibName, fpnames.Last() )->GetAttributes(); diff --git a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp index d7378f1c3d..17d45526f7 100644 --- a/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp +++ b/pcbnew/pcb_io/eagle/pcb_io_eagle.cpp @@ -64,7 +64,6 @@ Load() TODO's #include #include #include -#include #include #include #include @@ -324,7 +323,6 @@ VECTOR2I inline PCB_IO_EAGLE::kicad_fontsize( const ECOORD& d, int aTextThicknes BOARD* PCB_IO_EAGLE::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, const std::map* aProperties, PROJECT* aProject ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. wxXmlNode* doc; fontconfig::FONTCONFIG::SetReporter( &WXLOG_REPORTER::GetInstance() ); @@ -3198,7 +3196,6 @@ void PCB_IO_EAGLE::cacheLib( const wxString& aLibPath ) if( aLibPath != m_lib_path || m_timestamp != timestamp ) { wxXmlNode* doc; - LOCALE_IO toggle; // toggles on, then off, the C locale. deleteTemplates(); diff --git a/pcbnew/pcb_io/geda/pcb_io_geda.cpp b/pcbnew/pcb_io/geda/pcb_io_geda.cpp index 56d20cbe79..31b7af70b1 100644 --- a/pcbnew/pcb_io/geda/pcb_io_geda.cpp +++ b/pcbnew/pcb_io/geda/pcb_io_geda.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include #include #include @@ -934,8 +933,6 @@ FOOTPRINT* PCB_IO_GEDA::FootprintLoad( const wxString& aLibraryPath, void PCB_IO_GEDA::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - init( aProperties ); validateCache( aLibraryPath ); @@ -1036,8 +1033,6 @@ long long PCB_IO_GEDA::GetLibraryTimestamp( const wxString& aLibraryPath ) const bool PCB_IO_GEDA::IsLibraryWritable( const wxString& aLibraryPath ) { - LOCALE_IO toggle; - init( nullptr ); validateCache( aLibraryPath ); diff --git a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp index 3329ba9cd6..ed58091ada 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp @@ -71,7 +71,6 @@ #include #include -#include #include #include #include @@ -469,8 +468,6 @@ bool PCB_IO_KICAD_LEGACY::CanReadFootprint( const wxString& aFileName ) const BOARD* PCB_IO_KICAD_LEGACY::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, const std::map* aProperties, PROJECT* aProject ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - init( aProperties ); std::unique_ptr boardDeleter; @@ -3318,8 +3315,6 @@ bool PCB_IO_KICAD_LEGACY::DeleteLibrary( const wxString& aLibraryPath, bool PCB_IO_KICAD_LEGACY::IsLibraryWritable( const wxString& aLibraryPath ) { - LOCALE_IO toggle; - init( nullptr ); cacheLib( aLibraryPath ); diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp index e3dabf1df9..47043f95db 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr.cpp @@ -39,7 +39,6 @@ #include #include #include -#include #include #include #include @@ -309,8 +308,6 @@ bool PCB_IO_KICAD_SEXPR::CanReadBoard( const wxString& aFileName ) const void PCB_IO_KICAD_SEXPR::SaveBoard( const wxString& aFileName, BOARD* aBoard, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - wxString sanityResult = aBoard->GroupsSanityCheck(); if( sanityResult != wxEmptyString && m_queryUserCallback ) @@ -379,8 +376,6 @@ BOARD_ITEM* PCB_IO_KICAD_SEXPR::Parse( const wxString& aClipboardSourceInput ) void PCB_IO_KICAD_SEXPR::Format( const BOARD_ITEM* aItem ) const { - LOCALE_IO toggle; // public API function, perform anything convenient for caller - switch( aItem->Type() ) { case PCB_T: @@ -3107,8 +3102,6 @@ void PCB_IO_KICAD_SEXPR::FootprintDelete( const wxString& aLibraryPath, const wxString& aFootprintName, const std::map* aProperties ) { - LOCALE_IO toggle; // toggles on, then off, the C locale. - init( aProperties ); validateCache( aLibraryPath ); @@ -3139,8 +3132,6 @@ void PCB_IO_KICAD_SEXPR::CreateLibrary( const wxString& aLibraryPath, aLibraryPath.GetData() ) ); } - LOCALE_IO toggle; - init( aProperties ); delete m_cache; @@ -3229,8 +3220,6 @@ bool PCB_IO_KICAD_SEXPR::DeleteLibrary( const wxString& aLibraryPath, bool PCB_IO_KICAD_SEXPR::IsLibraryWritable( const wxString& aLibraryPath ) { - LOCALE_IO toggle; - init( nullptr ); validateCache( aLibraryPath ); diff --git a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp index cbb2712137..ac9516396a 100644 --- a/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp +++ b/pcbnew/pcb_io/kicad_sexpr/pcb_io_kicad_sexpr_parser.cpp @@ -61,7 +61,6 @@ #include #include #include -#include #include #include #include // for RECT_CHAMFER_POSITIONS definition @@ -809,8 +808,6 @@ FP_3DMODEL* PCB_IO_KICAD_SEXPR_PARSER::parse3DModel() bool PCB_IO_KICAD_SEXPR_PARSER::IsValidBoardHeader() { - LOCALE_IO toggle; - m_groupInfos.clear(); // See Parse() - FOOTPRINTS can be prefixed with an initial block of single line comments, @@ -831,7 +828,6 @@ BOARD_ITEM* PCB_IO_KICAD_SEXPR_PARSER::Parse() { T token; BOARD_ITEM* item; - LOCALE_IO toggle; m_groupInfos.clear(); diff --git a/pcbnew/pcb_io/odbpp/odb_netlist.cpp b/pcbnew/pcb_io/odbpp/odb_netlist.cpp index 970c643416..958e365907 100644 --- a/pcbnew/pcb_io/odbpp/odb_netlist.cpp +++ b/pcbnew/pcb_io/odbpp/odb_netlist.cpp @@ -27,7 +27,6 @@ #include #include #include -#include #include #include #include diff --git a/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp b/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp index 47c4edbdfb..6d77bb8e39 100644 --- a/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp +++ b/pcbnew/pcb_io/pcad/pcb_io_pcad.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #include @@ -77,8 +76,6 @@ BOARD* PCB_IO_PCAD::LoadBoard( const wxString& aFileName, BOARD* aAppendToMe, PCAD_PCB pcb( m_board ); - LOCALE_IO toggle; // toggles on, then off, the C locale. - LoadInputFile( aFileName, &xmlDoc ); pcb.ParseBoard( nullptr, &xmlDoc, wxT( "PCB" ) ); pcb.AddToBoard(); diff --git a/pcbnew/pcb_io/pcb_io_mgr.cpp b/pcbnew/pcb_io/pcb_io_mgr.cpp index 618e655f1b..54926c0569 100644 --- a/pcbnew/pcb_io/pcb_io_mgr.cpp +++ b/pcbnew/pcb_io/pcb_io_mgr.cpp @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -196,7 +195,6 @@ bool PCB_IO_MGR::ConvertLibrary( std::map* aOldFileProps, con if( oldFileType == PCB_IO_MGR::FILE_TYPE_NONE ) return false; - LOCALE_IO toggle_locale; IO_RELEASER oldFilePI( PCB_IO_MGR::PluginFind( oldFileType ) ); IO_RELEASER kicadPI( PCB_IO_MGR::PluginFind( PCB_IO_MGR::KICAD_SEXP ) ); wxArrayString fpNames; diff --git a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp index 23de08acb7..2b5a0d4f94 100644 --- a/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp +++ b/pcbnew/python/scripting/pcbnew_scripting_helpers.cpp @@ -56,7 +56,6 @@ #include #include #include -#include #include #include #include @@ -127,10 +126,6 @@ SETTINGS_MANAGER* GetSettingsManager() PROJECT* GetDefaultProject() { - // For some reasons, LoadProject() needs a C locale, so ensure we have the right locale - // This is mainly when running QA Python tests - LOCALE_IO dummy; - PROJECT* project = GetSettingsManager()->GetProject( "" ); if( !project ) @@ -160,11 +155,6 @@ BOARD* LoadBoard( const wxString& aFileName, PCB_IO_MGR::PCB_FILE_T aFormat, boo // By default only the BMP handler is available. wxInitAllImageHandlers(); - - // Ensure the "C" locale is temporary set, before reading any file - // It also avoid wxWidget alerts about locale issues, later, when using Python 3 - LOCALE_IO dummy; - PROJECT* project = GetSettingsManager()->GetProject( projectPath ); if( !project ) @@ -281,10 +271,6 @@ BOARD* NewBoard( wxString& aFileName ) wxString projectPath = proFn.GetFullPath(); - // Ensure the "C" locale is temporary set, before reading any file - // It also avoids wxWidgets alerts about locale issues, later, when using Python 3 - LOCALE_IO dummy; - GetSettingsManager()->LoadProject( projectPath, false ); PROJECT* project = GetSettingsManager()->GetProject( projectPath ); @@ -319,10 +305,6 @@ bool SaveBoard( wxString& aFileName, BOARD* aBoard, PCB_IO_MGR::PCB_FILE_T aForm aBoard->BuildConnectivity(); aBoard->SynchronizeNetsAndNetClasses( false ); - // Ensure the "C" locale is temporary set, before saving any file - // It also avoid wxWidget alerts about locale issues, later, when using Python 3 - LOCALE_IO dummy; - try { PCB_IO_MGR::Save( aFormat, aFileName, aBoard, nullptr );