diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index d74389065d..342efbcd93 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -248,7 +248,7 @@ bool EDA_3D_CANVAS::initializeOpenGL() // getting the OpenGL major and minor version as integers didn't exist. wxString tmp; - wxStringTokenizer tokenizer( version ); + wxStringTokenizer tokenizer( version, " \t\r\n" ); if( tokenizer.HasMoreTokens() ) { diff --git a/common/advanced_config.cpp b/common/advanced_config.cpp index 38b7973907..8e2a70f540 100644 --- a/common/advanced_config.cpp +++ b/common/advanced_config.cpp @@ -656,11 +656,11 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg ) wxConfigLoadSetups( &aCfg, m_entries ); // Now actually set the trace masks - wxStringTokenizer traceMaskTokenizer( m_traceMasks, wxS( "," ) ); + wxStringTokenizer traceMaskTokenizer( m_traceMasks, "," ); while( traceMaskTokenizer.HasMoreTokens() ) { - wxString mask = traceMaskTokenizer.GetNextToken(); + wxString mask = traceMaskTokenizer.GetNextToken().Trim( wxString::both ); wxLog::AddTraceMask( mask ); } diff --git a/common/design_block_info.cpp b/common/design_block_info.cpp index 10c3582047..9596565d8c 100644 --- a/common/design_block_info.cpp +++ b/common/design_block_info.cpp @@ -76,7 +76,7 @@ std::vector DESIGN_BLOCK_INFO::GetSearchTerms() terms.emplace_back( SEARCH_TERM( GetName(), 8 ) ); terms.emplace_back( SEARCH_TERM( GetLIB_ID().Format(), 16 ) ); - wxStringTokenizer keywordTokenizer( GetKeywords(), wxS( " " ), wxTOKEN_STRTOK ); + wxStringTokenizer keywordTokenizer( GetKeywords(), " \t\r\n", wxTOKEN_STRTOK ); while( keywordTokenizer.HasMoreTokens() ) terms.emplace_back( SEARCH_TERM( keywordTokenizer.GetNextToken(), 4 ) ); diff --git a/common/eda_pattern_match.cpp b/common/eda_pattern_match.cpp index b83033a202..2797ddd2fb 100644 --- a/common/eda_pattern_match.cpp +++ b/common/eda_pattern_match.cpp @@ -307,7 +307,7 @@ wxString const& EDA_PATTERN_MATCH_RELATIONAL::GetPattern() const EDA_PATTERN_MATCH::FIND_RESULT EDA_PATTERN_MATCH_RELATIONAL::Find( const wxString& aCandidate ) const { - wxStringTokenizer tokenizer( aCandidate ); + wxStringTokenizer tokenizer( aCandidate, " \t\r\n", wxTOKEN_STRTOK ); size_t lastpos = 0; while( tokenizer.HasMoreTokens() ) diff --git a/common/footprint_filter.cpp b/common/footprint_filter.cpp index a3aaa3031c..bcffd0ef5d 100644 --- a/common/footprint_filter.cpp +++ b/common/footprint_filter.cpp @@ -217,7 +217,7 @@ void FOOTPRINT_FILTER::FilterByTextPattern( wxString const& aPattern ) { m_filter_pattern = aPattern; - wxStringTokenizer tokenizer( aPattern.Lower() ); + wxStringTokenizer tokenizer( aPattern.Lower(), " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp index 25ef8465b1..ec72ffe009 100644 --- a/common/footprint_info.cpp +++ b/common/footprint_info.cpp @@ -78,7 +78,7 @@ std::vector FOOTPRINT_INFO::GetSearchTerms() terms.emplace_back( SEARCH_TERM( GetName(), 8 ) ); terms.emplace_back( SEARCH_TERM( GetLIB_ID().Format(), 16 ) ); - wxStringTokenizer keywordTokenizer( GetKeywords(), wxS( " " ), wxTOKEN_STRTOK ); + wxStringTokenizer keywordTokenizer( GetKeywords(), " \t\r\n", wxTOKEN_STRTOK ); while( keywordTokenizer.HasMoreTokens() ) terms.emplace_back( SEARCH_TERM( keywordTokenizer.GetNextToken(), 4 ) ); diff --git a/common/hotkeys_basic.cpp b/common/hotkeys_basic.cpp index cd8c435b8e..b735767539 100644 --- a/common/hotkeys_basic.cpp +++ b/common/hotkeys_basic.cpp @@ -394,19 +394,21 @@ void ReadHotKeyConfig( const wxString& aFileName, wxString input; file.ReadAll( &input ); input.Replace( "\r\n", "\n" ); // Convert Windows files to Unix line-ends - wxStringTokenizer fileTokenizer( input, wxS( "\n" ), wxTOKEN_STRTOK ); + wxStringTokenizer fileTokenizer( input, "\n", wxTOKEN_STRTOK ); while( fileTokenizer.HasMoreTokens() ) { - wxStringTokenizer lineTokenizer( fileTokenizer.GetNextToken(), wxS( "\t" ) ); + wxStringTokenizer lineTokenizer( fileTokenizer.GetNextToken(), "\t" ); wxString cmdName = lineTokenizer.GetNextToken(); wxString primary = lineTokenizer.GetNextToken(); wxString secondary = lineTokenizer.GetNextToken(); if( !cmdName.IsEmpty() ) - aHotKeys[cmdName.ToStdString()] = std::pair( - KeyCodeFromKeyName( primary ), KeyCodeFromKeyName( secondary ) ); + { + aHotKeys[cmdName.ToStdString()] = std::pair( KeyCodeFromKeyName( primary ), + KeyCodeFromKeyName( secondary ) ); + } } } @@ -507,12 +509,12 @@ int ReadLegacyHotkeyConfigFile( const wxString& aFilename, std::map> termMatchers; while( tokenizer.HasMoreTokens() && termMatchers.size() < MAX_TERMS ) diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index 5a621ce7ed..5433235a31 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -622,7 +622,7 @@ bool COMMON_SETTINGS::migrateSchema3to4() const nlohmann::json::json_pointer v3_pointer_eeschema( "/netclass_panel/eeschema_shown_columns"_json_pointer ); wxString eeSchemaColumnList_old = m_internals->at( v3_pointer_eeschema ); - wxStringTokenizer eeSchemaShownTokens( eeSchemaColumnList_old ); + wxStringTokenizer eeSchemaShownTokens( eeSchemaColumnList_old, " \t\r\n" ); wxString eeSchemaColumnList_new; while( eeSchemaShownTokens.HasMoreTokens() ) @@ -645,7 +645,7 @@ bool COMMON_SETTINGS::migrateSchema3to4() const nlohmann::json::json_pointer v3_pointer_pcbnew( "/netclass_panel/pcbnew_shown_columns"_json_pointer ); wxString pcbnewColumnList_old = m_internals->at( v3_pointer_pcbnew ); - wxStringTokenizer pcbnewShownTokens( pcbnewColumnList_old ); + wxStringTokenizer pcbnewShownTokens( pcbnewColumnList_old, " \t\r\n" ); wxString pcbnewColumnList_new; while( pcbnewShownTokens.HasMoreTokens() ) diff --git a/common/trace_helpers.cpp b/common/trace_helpers.cpp index 62f01cb668..e982e2b820 100644 --- a/common/trace_helpers.cpp +++ b/common/trace_helpers.cpp @@ -338,7 +338,7 @@ void TRACE_MANAGER::init() if( !m_globalTraceEnabled ) return; - wxStringTokenizer tokenizer( traceVars, wxT( "," ) ); + wxStringTokenizer tokenizer( traceVars, "," ); while( tokenizer.HasMoreTokens() ) { diff --git a/common/widgets/wx_grid.cpp b/common/widgets/wx_grid.cpp index b218629091..8d06d53aaa 100644 --- a/common/widgets/wx_grid.cpp +++ b/common/widgets/wx_grid.cpp @@ -489,7 +489,7 @@ void WX_GRID::ShowHideColumns( const wxString& shownColumns ) for( int i = 0; i < GetNumberCols(); ++i ) HideCol( i ); - wxStringTokenizer shownTokens( shownColumns ); + wxStringTokenizer shownTokens( shownColumns, " \t\r\n", wxTOKEN_STRTOK ); while( shownTokens.HasMoreTokens() ) { diff --git a/eeschema/dialogs/dialog_edit_symbols_libid.cpp b/eeschema/dialogs/dialog_edit_symbols_libid.cpp index 96aafcaaf9..abfe36eead 100644 --- a/eeschema/dialogs/dialog_edit_symbols_libid.cpp +++ b/eeschema/dialogs/dialog_edit_symbols_libid.cpp @@ -131,7 +131,7 @@ void GRIDCELL_AUTOWRAP_STRINGRENDERER::BreakLine( wxDC& dc, const wxString& logi wxString line; // For each word - wxStringTokenizer wordTokenizer( logicalLine, wxS( " \t" ), wxTOKEN_RET_DELIMS ); + wxStringTokenizer wordTokenizer( logicalLine, " \t", wxTOKEN_RET_DELIMS ); while( wordTokenizer.HasMoreTokens() ) { diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 4dbbb88ffe..3afa426142 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -518,7 +518,7 @@ public: wxString pinName = tokenizer.GetNextToken(); // Trim whitespace from both ends of the string - pinName.Trim( true ).Trim( false ); + pinName.Trim( wxString::both ); if( i < pins.size() ) { diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index 591647bb43..dbe9ad164d 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -697,7 +697,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow() for( unsigned i = 0; i < m_listJumperPinGroups->GetCount(); ++i ) { - wxStringTokenizer tokenizer( m_listJumperPinGroups->GetString( i ), ", " ); + wxStringTokenizer tokenizer( m_listJumperPinGroups->GetString( i ), ", \t\r\n", wxTOKEN_STRTOK ); std::set& group = jumpers.emplace_back(); while( tokenizer.HasMoreTokens() ) @@ -1347,7 +1347,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnBtnRemoveJumperPinGroup( wxCommandEvent& aE for( int idx : selections ) { - wxStringTokenizer tokenizer( m_listJumperPinGroups->GetString( idx ), ", " ); + wxStringTokenizer tokenizer( m_listJumperPinGroups->GetString( idx ), ", \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { diff --git a/eeschema/dialogs/dialog_sim_command.cpp b/eeschema/dialogs/dialog_sim_command.cpp index f011fdba05..7ec105f35a 100644 --- a/eeschema/dialogs/dialog_sim_command.cpp +++ b/eeschema/dialogs/dialog_sim_command.cpp @@ -643,7 +643,7 @@ void DIALOG_SIM_COMMAND::parseCommand( const wxString& aCommand ) m_commandTypeSizer->Show( false ); - wxStringTokenizer tokenizer( aCommand, wxS( " \t\n\r" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( aCommand, " \t\r\n", wxTOKEN_STRTOK ); wxString token = tokenizer.GetNextToken().Lower(); switch( simType ) diff --git a/eeschema/lib_symbol.cpp b/eeschema/lib_symbol.cpp index 360cd38bdb..3088809d7c 100644 --- a/eeschema/lib_symbol.cpp +++ b/eeschema/lib_symbol.cpp @@ -45,7 +45,7 @@ std::vector LIB_SYMBOL::GetSearchTerms() terms.emplace_back( SEARCH_TERM( GetName(), 8 ) ); terms.emplace_back( SEARCH_TERM( GetLIB_ID().Format(), 16 ) ); - wxStringTokenizer keywordTokenizer( GetKeyWords(), wxS( " " ), wxTOKEN_STRTOK ); + wxStringTokenizer keywordTokenizer( GetKeyWords(), " \t\r\n", wxTOKEN_STRTOK ); while( keywordTokenizer.HasMoreTokens() ) terms.emplace_back( SEARCH_TERM( keywordTokenizer.GetNextToken(), 4 ) ); diff --git a/eeschema/netlist_exporters/netlist_exporter_spice.cpp b/eeschema/netlist_exporters/netlist_exporter_spice.cpp index efb8306db6..ef70742b4e 100644 --- a/eeschema/netlist_exporters/netlist_exporter_spice.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_spice.cpp @@ -316,7 +316,7 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions ) continue; // Send anything that contains directives to SPICE - wxStringTokenizer tokenizer( text, wxT( "\r\n" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( text, "\r\n", wxTOKEN_STRTOK ); bool foundDirective = false; auto isDirective = @@ -377,7 +377,7 @@ void NETLIST_EXPORTER_SPICE::ReadDirectives( unsigned aNetlistOptions ) else if( line.StartsWith( wxT( "K" ) ) ) { // Check for mutual inductor declaration - wxStringTokenizer line_t( line, wxT( " \t" ), wxTOKEN_STRTOK ); + wxStringTokenizer line_t( line, " \t", wxTOKEN_STRTOK ); // Coupling ID if( !line_t.HasMoreTokens() || !line_t.GetNextToken().StartsWith( wxT( "K" ) ) ) diff --git a/eeschema/sch_io/database/sch_io_database.cpp b/eeschema/sch_io/database/sch_io_database.cpp index 97718143e2..d2e40e75f4 100644 --- a/eeschema/sch_io/database/sch_io_database.cpp +++ b/eeschema/sch_io/database/sch_io_database.cpp @@ -470,7 +470,7 @@ std::unique_ptr SCH_IO_DATABASE::loadSymbolFromRow( const wxString& std::string footprints = std::any_cast( aRow.at( aTable.footprints_col ) ); wxString footprintsStr = wxString( footprints.c_str(), wxConvUTF8 ); - wxStringTokenizer tokenizer( footprintsStr, ';' ); + wxStringTokenizer tokenizer( footprintsStr, ";\t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) footprintsList.Add( tokenizer.GetNextToken() ); diff --git a/eeschema/sch_io/eagle/sch_io_eagle.cpp b/eeschema/sch_io/eagle/sch_io_eagle.cpp index 1cff1adbce..723deef8ec 100644 --- a/eeschema/sch_io/eagle/sch_io_eagle.cpp +++ b/eeschema/sch_io/eagle/sch_io_eagle.cpp @@ -3440,7 +3440,7 @@ wxString SCH_IO_EAGLE::translateEagleBusName( const wxString& aEagleName ) const wxString ret = wxT( "{" ); - wxStringTokenizer tokenizer( aEagleName, wxT( "," ) ); + wxStringTokenizer tokenizer( aEagleName, "," ); while( tokenizer.HasMoreTokens() ) { diff --git a/eeschema/sch_io/http_lib/sch_io_http_lib.cpp b/eeschema/sch_io/http_lib/sch_io_http_lib.cpp index 29f04603bb..f42cec3784 100644 --- a/eeschema/sch_io/http_lib/sch_io_http_lib.cpp +++ b/eeschema/sch_io/http_lib/sch_io_http_lib.cpp @@ -403,7 +403,7 @@ LIB_SYMBOL* SCH_IO_HTTP_LIB::loadSymbolFromPart( const wxString& aSymbolName, if( lowerFieldName == footprint_field ) { SCH_FIELD* field = &symbol->GetFootprintField(); - wxStringTokenizer tokenizer( std::get<0>( fieldProperties ), ';' ); + wxStringTokenizer tokenizer( std::get<0>( fieldProperties ), ";\t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) fp_filters.Add( tokenizer.GetNextToken() ); 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 f7332aadb5..04b0349dc8 100644 --- a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp +++ b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy.cpp @@ -1131,11 +1131,13 @@ SCH_SYMBOL* SCH_IO_KICAD_LEGACY::loadSymbol( LINE_READER& aReader ) wxString libName; size_t pos = 2; // "X" plus ' ' space character. wxString utf8Line = wxString::FromUTF8( line ); - wxStringTokenizer tokens( utf8Line, " \r\n\t" ); + wxStringTokenizer tokens( utf8Line, " \t\r\n" ); if( tokens.CountTokens() < 2 ) + { THROW_PARSE_ERROR( "invalid symbol library definition", aReader.GetSource(), aReader.Line(), aReader.LineNumber(), pos ); + } libName = tokens.GetNextToken(); libName.Replace( "~", " " ); diff --git a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp index cb9254c706..1d7c0dea9c 100644 --- a/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp +++ b/eeschema/sch_io/kicad_legacy/sch_io_kicad_legacy_lib_cache.cpp @@ -310,7 +310,7 @@ LIB_SYMBOL* SCH_IO_KICAD_LEGACY_LIB_CACHE::LoadPart( LINE_READER& aReader, int a long num; size_t pos = 4; // "DEF" plus the first space. wxString utf8Line = wxString::FromUTF8( line ); - wxStringTokenizer tokens( utf8Line, " \r\n\t" ); + wxStringTokenizer tokens( utf8Line, " \t\r\n" ); if( tokens.CountTokens() < 8 ) SCH_PARSE_ERROR( "invalid symbol definition", aReader, line ); @@ -491,7 +491,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::loadAliases( std::unique_ptr& aS wxCHECK_RET( strCompare( "ALIAS", line, &line ), "Invalid ALIAS section" ); wxString utf8Line = wxString::FromUTF8( line ); - wxStringTokenizer tokens( utf8Line, " \r\n\t" ); + wxStringTokenizer tokens( utf8Line, " \t\r\n" ); // Parse the ALIAS list. while( tokens.HasMoreTokens() ) @@ -1114,7 +1114,7 @@ SCH_PIN* SCH_IO_KICAD_LEGACY_LIB_CACHE::loadPin( std::unique_ptr& aS size_t pos = 2; // "X" plus ' ' space character. wxString tmp; wxString utf8Line = wxString::FromUTF8( line ); - wxStringTokenizer tokens( utf8Line, " \r\n\t" ); + wxStringTokenizer tokens( utf8Line, " \t\r\n" ); if( tokens.CountTokens() < 11 ) SCH_PARSE_ERROR( "invalid pin definition", aReader, line ); diff --git a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp index 8f4e8fd118..afde222ff7 100644 --- a/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp +++ b/eeschema/sch_io/kicad_sexpr/sch_io_kicad_sexpr_parser.cpp @@ -1165,7 +1165,7 @@ SCH_FIELD* SCH_IO_KICAD_SEXPR_PARSER::parseProperty( std::unique_ptr { // Not a SCH_FIELD object yet. wxArrayString filters; - wxStringTokenizer tokenizer( value ); + wxStringTokenizer tokenizer( value, " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { diff --git a/eeschema/sim/legacy_workbook.cpp b/eeschema/sim/legacy_workbook.cpp index 902b68741a..7223500ce6 100644 --- a/eeschema/sim/legacy_workbook.cpp +++ b/eeschema/sim/legacy_workbook.cpp @@ -169,7 +169,7 @@ bool SIMULATOR_FRAME_UI::loadLegacyWorkbook( const wxString& aPath ) wxString command = UnescapeString( file.GetNextLine() ); wxString simCommand; int simOptions = NETLIST_EXPORTER_SPICE::OPTION_DEFAULT_FLAGS; - wxStringTokenizer tokenizer( command, wxT( "\r\n" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( command, "\r\n", wxTOKEN_STRTOK ); if( version >= 2 ) { diff --git a/eeschema/sim/sim_plot_tab.cpp b/eeschema/sim/sim_plot_tab.cpp index 06e6ad34ea..0176eb0f7f 100644 --- a/eeschema/sim/sim_plot_tab.cpp +++ b/eeschema/sim/sim_plot_tab.cpp @@ -1017,7 +1017,7 @@ void SIM_PLOT_TAB::ResetScales( bool aIncludeX ) if( GetSimType() == ST_TRAN ) { - wxStringTokenizer tokenizer( GetSimCommand(), wxS( " \t\n\r" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( GetSimCommand(), " \t\r\n", wxTOKEN_STRTOK ); wxString cmd = tokenizer.GetNextToken().Lower(); wxASSERT( cmd == wxS( ".tran" ) ); diff --git a/eeschema/sim/simulator_frame_ui.cpp b/eeschema/sim/simulator_frame_ui.cpp index 69f7fcc292..79c38f0bb3 100644 --- a/eeschema/sim/simulator_frame_ui.cpp +++ b/eeschema/sim/simulator_frame_ui.cpp @@ -870,7 +870,7 @@ void SIMULATOR_FRAME_UI::rebuildSignalsGrid( wxString aFilter ) if( plotPanel->GetSimType() == ST_FFT ) { - wxStringTokenizer tokenizer( plotPanel->GetSimCommand(), wxT( " \t\r\n" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( plotPanel->GetSimCommand(), " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() && tokenizer.GetNextToken().Lower() != wxT( "fft" ) ) {}; @@ -1113,7 +1113,7 @@ void SIMULATOR_FRAME_UI::rebuildSignalsList() // Add .SAVE and .PROBE directives for( const wxString& directive : circuitModel()->GetDirectives() ) { - wxStringTokenizer directivesTokenizer( directive, wxT( "\r\n" ), wxTOKEN_STRTOK ); + wxStringTokenizer directivesTokenizer( directive, "\r\n", wxTOKEN_STRTOK ); while( directivesTokenizer.HasMoreTokens() ) { @@ -1123,7 +1123,7 @@ void SIMULATOR_FRAME_UI::rebuildSignalsList() if( line.StartsWith( wxS( ".SAVE" ), &directiveParams ) || line.StartsWith( wxS( ".PROBE" ), &directiveParams ) ) { - wxStringTokenizer paramsTokenizer( directiveParams, wxT( " \t" ), wxTOKEN_STRTOK ); + wxStringTokenizer paramsTokenizer( directiveParams, " \t", wxTOKEN_STRTOK ); while( paramsTokenizer.HasMoreTokens() ) addSignal( paramsTokenizer.GetNextToken() ); diff --git a/eeschema/sim/spice_circuit_model.cpp b/eeschema/sim/spice_circuit_model.cpp index 8888600a6b..ea37d75590 100644 --- a/eeschema/sim/spice_circuit_model.cpp +++ b/eeschema/sim/spice_circuit_model.cpp @@ -126,7 +126,7 @@ bool SPICE_CIRCUIT_MODEL::ParseDCCommand( const wxString& aCmd, SPICE_DC_PARAMS* return false; wxString cmd = aCmd.Mid( 3 ); - wxStringTokenizer tokens( cmd, wxS( " \t" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokens( cmd, " \t", wxTOKEN_STRTOK ); aSource1->m_source = tokens.GetNextToken(); aSource1->m_vstart = SPICE_VALUE( tokens.GetNextToken() ); @@ -156,7 +156,7 @@ bool SPICE_CIRCUIT_MODEL::ParsePZCommand( const wxString& aCmd, wxString* transf analyses->m_Poles = true; analyses->m_Zeros = true; - wxStringTokenizer tokens( aCmd.Mid( 3 ), wxS( " \t" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokens( aCmd.Mid( 3 ), " \t", wxTOKEN_STRTOK ); if( tokens.HasMoreTokens() ) *input = tokens.GetNextToken(); @@ -206,12 +206,12 @@ bool SPICE_CIRCUIT_MODEL::ParseNoiseCommand( const wxString& aCmd, wxString* aOu wxString function = cmd.Before( ')' ); wxString params = cmd.After( ')' ); - wxStringTokenizer func_tokens( function, wxS( " ,\t" ), wxTOKEN_STRTOK ); + wxStringTokenizer func_tokens( function, " ,\t", wxTOKEN_STRTOK ); *aOutput = func_tokens.GetNextToken(); *aRef = func_tokens.GetNextToken(); - wxStringTokenizer tokens( params, wxS( " \t" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokens( params, " \t", wxTOKEN_STRTOK ); wxString token = tokens.GetNextToken(); if( !token.IsEmpty() ) diff --git a/eeschema/symbol_viewer_frame.cpp b/eeschema/symbol_viewer_frame.cpp index 49a4b1992c..f582363f47 100644 --- a/eeschema/symbol_viewer_frame.cpp +++ b/eeschema/symbol_viewer_frame.cpp @@ -570,9 +570,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList() { wxArrayString aliasNames; - PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( aLib, - aliasNames, - true ); + PROJECT_SCH::SchSymbolLibTable( &Prj() )->EnumerateSymbolLib( aLib, aliasNames, true ); if( aliasNames.IsEmpty() ) return; @@ -612,7 +610,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList() } else { - wxStringTokenizer tokenizer( m_libFilter->GetValue() ); + wxStringTokenizer tokenizer( m_libFilter->GetValue(), " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { @@ -648,8 +646,8 @@ bool SYMBOL_VIEWER_FRAME::ReCreateLibList() { // If not found, clear current library selection because it can be deleted after a // config change. - m_currentSymbol.SetLibNickname( m_libList->GetCount() > 0 - ? m_libList->GetBaseString( 0 ) : wxString( wxT( "" ) ) ); + m_currentSymbol.SetLibNickname( m_libList->GetCount() > 0 ? m_libList->GetBaseString( 0 ) + : wxString( wxEmptyString ) ); m_currentSymbol.SetLibItemName( wxEmptyString ); m_unit = 1; m_bodyStyle = BODY_STYLE::BASE; @@ -681,8 +679,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList() try { if( row ) - PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbolLib( symbols, libName, - m_listPowerOnly ); + PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbolLib( symbols, libName, m_listPowerOnly ); } catch( const IO_ERROR& ) {} // ignore, it is handled below @@ -690,7 +687,7 @@ bool SYMBOL_VIEWER_FRAME::ReCreateSymbolList() if( !m_symbolFilter->GetValue().IsEmpty() ) { - wxStringTokenizer tokenizer( m_symbolFilter->GetValue() ); + wxStringTokenizer tokenizer( m_symbolFilter->GetValue(), " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { diff --git a/kicad/cli/command_sch_export_plot.cpp b/kicad/cli/command_sch_export_plot.cpp index d8f77840c5..243a71cf2b 100644 --- a/kicad/cli/command_sch_export_plot.cpp +++ b/kicad/cli/command_sch_export_plot.cpp @@ -143,10 +143,10 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway ) std::vector pages; wxString pagesStr = From_UTF8( m_argParser.get( ARG_PAGES ).c_str() ); - wxStringTokenizer tokenizer( pagesStr, "," ); + wxStringTokenizer tokenizer( pagesStr, ",", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) - pages.push_back( tokenizer.GetNextToken().Trim() ); + pages.push_back( tokenizer.GetNextToken().Trim( wxString::both) ); std::unique_ptr plotJob; diff --git a/kicad/pcm/pcm.cpp b/kicad/pcm/pcm.cpp index 584aa2618e..9d5d617cfa 100644 --- a/kicad/pcm/pcm.cpp +++ b/kicad/pcm/pcm.cpp @@ -611,7 +611,7 @@ void PLUGIN_CONTENT_MANAGER::PreparePackage( PCM_PACKAGE& aPackage ) if( ver.version_epoch ) epoch = *ver.version_epoch; - wxStringTokenizer version_tokenizer( ver.version, wxT( "." ) ); + wxStringTokenizer version_tokenizer( ver.version, "." ); major = wxAtoi( version_tokenizer.GetNextToken() ); @@ -633,7 +633,7 @@ void PLUGIN_CONTENT_MANAGER::PreparePackage( PCM_PACKAGE& aPackage ) int ver_minor = deflt; int ver_patch = deflt; - wxStringTokenizer tokenizer( version, wxT( "." ) ); + wxStringTokenizer tokenizer( version, "." ); ver_major = wxAtoi( tokenizer.GetNextToken() ); diff --git a/libs/kiplatform/os/windows/environment.cpp b/libs/kiplatform/os/windows/environment.cpp index 9c0dca3a3b..a3f5fdace7 100644 --- a/libs/kiplatform/os/windows/environment.cpp +++ b/libs/kiplatform/os/windows/environment.cpp @@ -264,9 +264,10 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG& } bool bypassed = false; + if( bypassProxyStr != NULL ) { - wxStringTokenizer tokenizer( bypassProxyStr, wxT( ";" ) ); + wxStringTokenizer tokenizer( bypassProxyStr, ";" ); while( tokenizer.HasMoreTokens() ) { @@ -298,7 +299,7 @@ bool KIPLATFORM::ENV::GetSystemProxyConfig( const wxString& aURL, PROXY_CONFIG& // proxyStr can be in the following format per MSDN //([=]["://"][":"]) //and separated by semicolons or whitespace - wxStringTokenizer tokenizer( proxyStr, wxT( "; \t" ) ); + wxStringTokenizer tokenizer( proxyStr, "; \t" ); while( tokenizer.HasMoreTokens() ) { diff --git a/pcbnew/cross-probing.cpp b/pcbnew/cross-probing.cpp index ae2a6b0180..31a2934e2e 100644 --- a/pcbnew/cross-probing.cpp +++ b/pcbnew/cross-probing.cpp @@ -149,12 +149,12 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) if( !crossProbingSettings.auto_highlight ) return; - wxStringTokenizer netsTok = wxStringTokenizer( From_UTF8( text ), wxT( "," ) ); + wxStringTokenizer netsTok = wxStringTokenizer( From_UTF8( text ), ",", wxTOKEN_STRTOK ); bool first = true; while( netsTok.HasMoreTokens() ) { - NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken() ); + NETINFO_ITEM* netinfo = pcb->FindNet( netsTok.GetNextToken().Trim( wxString::both ) ); if( netinfo ) { diff --git a/pcbnew/dialogs/dialog_board_reannotate.cpp b/pcbnew/dialogs/dialog_board_reannotate.cpp index ce70d8173c..3dd5bca152 100644 --- a/pcbnew/dialogs/dialog_board_reannotate.cpp +++ b/pcbnew/dialogs/dialog_board_reannotate.cpp @@ -291,7 +291,7 @@ wxString DIALOG_BOARD_REANNOTATE::CoordTowxString( int aX, int aY ) void DIALOG_BOARD_REANNOTATE::ShowReport( const wxString& aMessage, SEVERITY aSeverity ) { - wxStringTokenizer msgs( aMessage, wxT( "\n" ) ); + wxStringTokenizer msgs( aMessage, "\n" ); while( msgs.HasMoreTokens() ) m_MessageWindow->Report( msgs.GetNextToken(), aSeverity ); @@ -441,7 +441,7 @@ bool DIALOG_BOARD_REANNOTATE::BuildFootprintList( std::vector& aBad m_excludeArray.clear(); m_footprints = m_frame->GetBoard()->Footprints(); - wxStringTokenizer tokenizer( m_ExcludeList->GetValue(), wxS( " ," ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( m_ExcludeList->GetValue(), " ,", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) m_excludeArray.push_back( tokenizer.GetNextToken() ); diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index d9091d3634..0ba46fe13e 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -734,15 +734,13 @@ void DIALOG_COPPER_ZONE::updateShowNetsFilter() if( netNameShowFilter.Len() == 0 ) netNameShowFilter = wxT( "*" ); - wxStringTokenizer showFilters( netNameShowFilter.Lower(), wxT( "," ) ); + wxStringTokenizer showFilters( netNameShowFilter.Lower(), "," ); m_showNetsFilter.clear(); while( showFilters.HasMoreTokens() ) { - wxString filter = showFilters.GetNextToken(); - filter.Trim( false ); - filter.Trim( true ); + wxString filter = showFilters.GetNextToken().Trim( wxString::both ); if( !filter.IsEmpty() ) { diff --git a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp index 2d65078018..d09d925a27 100644 --- a/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp +++ b/pcbnew/dialogs/dialog_footprint_properties_fp_editor.cpp @@ -868,7 +868,7 @@ bool DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataFromWindow() for( int ii = 0; ii < m_jumperGroupsGrid->GetNumberRows(); ++ii ) { - wxStringTokenizer tokenizer( m_jumperGroupsGrid->GetCellValue( ii, 0 ), ", " ); + wxStringTokenizer tokenizer( m_jumperGroupsGrid->GetCellValue( ii, 0 ), ", \t\r\n", wxTOKEN_STRTOK ); std::set& group = jumpers.emplace_back(); while( tokenizer.HasMoreTokens() ) diff --git a/pcbnew/exporters/step/exporter_step.cpp b/pcbnew/exporters/step/exporter_step.cpp index 60aa5f7d09..838a9749ce 100644 --- a/pcbnew/exporters/step/exporter_step.cpp +++ b/pcbnew/exporters/step/exporter_step.cpp @@ -327,10 +327,10 @@ bool EXPORTER_STEP::buildFootprint3DShapes( FOOTPRINT* aFootprint, const VECTOR2 if( componentFilter ) { - wxStringTokenizer tokenizer( m_params.m_ComponentFilter, wxS( "," ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( m_params.m_ComponentFilter, ",", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) - componentFilterPatterns.push_back( tokenizer.GetNextToken().Trim( false ) ); + componentFilterPatterns.push_back( tokenizer.GetNextToken().Trim( wxString::both ) ); bool found = false; diff --git a/pcbnew/footprint.cpp b/pcbnew/footprint.cpp index 4a69ce3b40..1ab879af23 100644 --- a/pcbnew/footprint.cpp +++ b/pcbnew/footprint.cpp @@ -366,7 +366,7 @@ void FOOTPRINT::Serialize( google::protobuf::Any &aContainer ) const for( const wxString& group : GetNetTiePadGroups() ) { types::NetTieDefinition* netTie = def->add_net_ties(); - wxStringTokenizer tokenizer( group, " " ); + wxStringTokenizer tokenizer( group, ", \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) netTie->add_pad_number( tokenizer.GetNextToken().ToStdString() ); diff --git a/pcbnew/footprint_viewer_frame.cpp b/pcbnew/footprint_viewer_frame.cpp index 6598ea0add..7cdea80e71 100644 --- a/pcbnew/footprint_viewer_frame.cpp +++ b/pcbnew/footprint_viewer_frame.cpp @@ -431,7 +431,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList() } else { - wxStringTokenizer tokenizer( m_libFilter->GetValue() ); + wxStringTokenizer tokenizer( m_libFilter->GetValue(), " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { @@ -507,7 +507,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList() if( !m_fpFilter->GetValue().IsEmpty() ) { - wxStringTokenizer tokenizer( m_fpFilter->GetValue() ); + wxStringTokenizer tokenizer( m_fpFilter->GetValue(), " \t\r\n", wxTOKEN_STRTOK ); while( tokenizer.HasMoreTokens() ) { diff --git a/pcbnew/footprint_wizard_frame.cpp b/pcbnew/footprint_wizard_frame.cpp index fe94bd32a8..3a6fb5d49f 100644 --- a/pcbnew/footprint_wizard_frame.cpp +++ b/pcbnew/footprint_wizard_frame.cpp @@ -426,9 +426,9 @@ void FOOTPRINT_WIZARD_FRAME::ReCreateParameterList() m_parameterGrid->SetCellRenderer( i, WIZ_COL_VALUE, new wxGridCellBoolRenderer ); } // Parameters that can be selected from a list of multiple options - else if( units.Contains( wxT( "," ) ) ) // Indicates list of available options + else if( units.Contains( "," ) ) // Indicates list of available options { - wxStringTokenizer tokenizer( units, wxT( "," ) ); + wxStringTokenizer tokenizer( units, "," ); wxArrayString options; while( tokenizer.HasMoreTokens() ) 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 dd7162a4a0..22122d7e8f 100644 --- a/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp +++ b/pcbnew/pcb_io/kicad_legacy/pcb_io_kicad_legacy.cpp @@ -1813,33 +1813,34 @@ void PCB_IO_KICAD_LEGACY::load3D( FOOTPRINT* aFootprint ) FP_3DMODEL t3D; // Lambda to parse three space-separated doubles using wxString::ToCDouble with C locale - auto parseThreeDoubles = []( const char* str, double& x, double& y, double& z ) -> bool - { - wxString wxStr( str ); - wxStr.Trim( false ).Trim( true ); + auto parseThreeDoubles = + []( const char* str, double& x, double& y, double& z ) -> bool + { + wxString wxStr( str ); + wxStr.Trim( wxString::both ); - wxStringTokenizer tokenizer( wxStr, wxT( " \t" ), wxTOKEN_STRTOK ); + wxStringTokenizer tokenizer( wxStr, " \t", wxTOKEN_STRTOK ); - if( !tokenizer.HasMoreTokens() ) - return false; + if( !tokenizer.HasMoreTokens() ) + return false; - wxString token1 = tokenizer.GetNextToken(); + wxString token1 = tokenizer.GetNextToken(); - if( !token1.ToCDouble( &x ) || !tokenizer.HasMoreTokens() ) - return false; + if( !token1.ToCDouble( &x ) || !tokenizer.HasMoreTokens() ) + return false; - wxString token2 = tokenizer.GetNextToken(); + wxString token2 = tokenizer.GetNextToken(); - if( !token2.ToCDouble( &y ) || !tokenizer.HasMoreTokens() ) - return false; + if( !token2.ToCDouble( &y ) || !tokenizer.HasMoreTokens() ) + return false; - wxString token3 = tokenizer.GetNextToken(); + wxString token3 = tokenizer.GetNextToken(); - if( !token3.ToCDouble( &z ) ) - return false; + if( !token3.ToCDouble( &z ) ) + return false; - return true; - }; + return true; + }; char* line; diff --git a/pcbnew/pcbnew_jobs_handler.cpp b/pcbnew/pcbnew_jobs_handler.cpp index cb656b6628..8cf3ae462c 100644 --- a/pcbnew/pcbnew_jobs_handler.cpp +++ b/pcbnew/pcbnew_jobs_handler.cpp @@ -462,7 +462,7 @@ LSEQ PCBNEW_JOBS_HANDLER::convertLayerArg( wxString& aLayerString, BOARD* aBoard while( layerTokens.HasMoreTokens() ) { - std::string token = TO_UTF8( layerTokens.GetNextToken() ); + std::string token = TO_UTF8( layerTokens.GetNextToken().Trim( wxString::both ) ); if( layerUserMasks.contains( token ) ) pushLayers( layerUserMasks.at( token ) );