diff --git a/common/lib_id.cpp b/common/lib_id.cpp index f73999242d..4a54a8d443 100644 --- a/common/lib_id.cpp +++ b/common/lib_id.cpp @@ -174,7 +174,7 @@ int LIB_ID::HasIllegalChars( const UTF8& aLibItemName ) { int offset = 0; - for( auto ch : aLibItemName ) + for( auto& ch : aLibItemName ) { if( !isLegalChar( ch ) ) return offset; diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp index b7daa17b21..a10ef008f2 100644 --- a/common/wildcards_and_files_ext.cpp +++ b/common/wildcards_and_files_ext.cpp @@ -62,7 +62,7 @@ wxString formatWildcardExt( const wxString& aWildcard ) wxString wc; #if defined( __WXGTK__ ) - for( auto ch : aWildcard ) + for( auto& ch : aWildcard ) { if( wxIsalpha( ch ) ) wc += wxString::Format( "[%c%c]", wxTolower( ch ), wxToupper( ch ) ); diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index 3998e41786..37fbe7dbf4 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -244,7 +244,7 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet ) aSheet->GetScreen()->SetFileReadOnly( !fileName.IsFileWritable() ); aSheet->GetScreen()->SetFileExists( true ); - for( auto aItem : aSheet->GetScreen()->Items().OfType( SCH_SHEET_T ) ) + for( SCH_ITEM* aItem : aSheet->GetScreen()->Items().OfType( SCH_SHEET_T ) ) { wxCHECK2( aItem->Type() == SCH_SHEET_T, continue ); auto sheet = static_cast( aItem ); @@ -1466,7 +1466,7 @@ void SCH_LEGACY_PLUGIN::Format( SCH_SHEET* aSheet ) auto cmp = []( const SCH_ITEM* a, const SCH_ITEM* b ) { return *a < *b; }; std::multiset save_map( cmp ); - for( auto item : screen->Items() ) + for( SCH_ITEM* item : screen->Items() ) save_map.insert( item ); diff --git a/eeschema/sim/ngspice.cpp b/eeschema/sim/ngspice.cpp index c1f416ebc3..64d5c28133 100644 --- a/eeschema/sim/ngspice.cpp +++ b/eeschema/sim/ngspice.cpp @@ -73,9 +73,7 @@ NGSPICE::NGSPICE() : } -NGSPICE::~NGSPICE() -{ -} +NGSPICE::~NGSPICE() = default; void NGSPICE::Init( const SPICE_SIMULATOR_SETTINGS* aSettings ) @@ -595,7 +593,7 @@ bool NGSPICE::loadSpinit( const string& aFileName ) if( !file.Open( aFileName ) ) return false; - for( auto cmd = file.GetFirstLine(); !file.Eof(); cmd = file.GetNextLine() ) + for( wxString& cmd = file.GetFirstLine(); !file.Eof(); cmd = file.GetNextLine() ) Command( cmd.ToStdString() ); return true; diff --git a/eeschema/symbol_editor/symbol_library_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp index e2e3775535..9c48d5da85 100644 --- a/eeschema/symbol_editor/symbol_library_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -1209,7 +1209,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( std::shared_ptrSetOriginal( new LIB_SYMBOL( *libSymbol ) ); // Save the derived symbols. - for( auto entry : derivedSymbols ) + for( const wxString& entry : derivedSymbols ) { std::shared_ptr symbol = GetBuffer( entry ); @@ -1241,7 +1241,7 @@ bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::SaveBuffer( std::shared_ptr SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetBuffer( const wxString& aAlias ) const { - for( auto entry : m_symbols ) + for( std::shared_ptr entry : m_symbols ) { if( entry->GetSymbol()->GetName() == aAlias ) return entry; @@ -1253,7 +1253,7 @@ SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetBuffer( const wxString& aAlias ) const bool SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::HasDerivedSymbols( const wxString& aParentName ) const { - for( auto entry : m_symbols ) + for( auto& entry : m_symbols ) { if( entry->GetSymbol()->IsAlias() ) { @@ -1288,7 +1288,7 @@ size_t SYMBOL_LIBRARY_MANAGER::LIB_BUFFER::GetDerivedSymbolNames( const wxString { wxCHECK( !aSymbolName.IsEmpty(), 0 ); - for( auto entry : m_symbols ) + for( auto& entry : m_symbols ) { if( entry->GetSymbol()->IsAlias() ) { diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index 29269257e8..41e3e0a55d 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -584,7 +584,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) // Update our cache of the connected items. // First, re-attach our drag labels to the original line being re-merged. - for( auto possibleLabel : m_lineConnectionCache[bendLine] ) + for( EDA_ITEM* possibleLabel : m_lineConnectionCache[bendLine] ) { switch( possibleLabel->Type() ) { @@ -684,7 +684,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent ) // Update our cache of the connected items. // First, attach our drag labels to the line left behind. - for( auto possibleLabel : m_lineConnectionCache[line] ) + for( EDA_ITEM* possibleLabel : m_lineConnectionCache[line] ) { switch( possibleLabel->Type() ) { @@ -1588,7 +1588,7 @@ void SCH_MOVE_TOOL::setTransitions() void SCH_MOVE_TOOL::commitDragLines() { - for( auto newLine : m_newDragLines ) + for( SCH_LINE* newLine : m_newDragLines ) { newLine->ClearEditFlags(); saveCopyInUndoList( newLine, UNDO_REDO::NEWITEM, true ); @@ -1596,7 +1596,7 @@ void SCH_MOVE_TOOL::commitDragLines() // These lines have been changed, but aren't selected. We need // to manually clear these edit flags or they'll stick around. - for( auto oldLine : m_changedDragLines ) + for( SCH_LINE* oldLine : m_changedDragLines ) { oldLine->ClearEditFlags(); } diff --git a/gerbview/readgerb.cpp b/gerbview/readgerb.cpp index 122b687524..801a15aa3c 100644 --- a/gerbview/readgerb.cpp +++ b/gerbview/readgerb.cpp @@ -102,7 +102,7 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName ) // (maybe convert geometry into positives?) } - for( auto item : gerber->GetItems() ) + for( GERBER_DRAW_ITEM* item : gerber->GetItems() ) GetCanvas()->GetView()->Add( (KIGFX::VIEW_ITEM*) item ); } diff --git a/pcbnew/connectivity/connectivity_data.cpp b/pcbnew/connectivity/connectivity_data.cpp index 8d0911ca89..adb47f9f5b 100644 --- a/pcbnew/connectivity/connectivity_data.cpp +++ b/pcbnew/connectivity/connectivity_data.cpp @@ -824,11 +824,11 @@ const std::vector CONNECTIVITY_DATA::GetConnectedItemsAtA std::vector rv; SEG::ecoord maxErrorSq = (SEG::ecoord) aMaxError * aMaxError; - for( auto cnItem : entry.GetItems() ) + for( CN_ITEM* cnItem : entry.GetItems() ) { - for( auto connected : cnItem->ConnectedItems() ) + for( CN_ITEM* connected : cnItem->ConnectedItems() ) { - for( auto anchor : connected->Anchors() ) + for( std::shared_ptr& anchor : connected->Anchors() ) { if( ( anchor->Pos() - aAnchor ).SquaredEuclideanNorm() <= maxErrorSq ) { @@ -995,7 +995,7 @@ const std::vector CONNECTIVITY_DATA::GetRatsnestForComponent( FOOTPRINT std::set pads; std::vector edges; - for( auto pad : aComponent->Pads() ) + for( PAD* pad : aComponent->Pads() ) { nets.insert( pad->GetNetCode() ); pads.insert( pad ); diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index 25f70ce876..fb914aa8ea 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -387,7 +387,7 @@ bool CN_CLUSTER::Contains( const BOARD_CONNECTED_ITEM* aItem ) void CN_CLUSTER::Dump() { - for( auto item : m_items ) + for( CN_ITEM* item : m_items ) { wxLogTrace( wxT( "CN" ), wxT( " - item : %p bitem : %p type : %d inet %s\n" ), item, diff --git a/pcbnew/connectivity/connectivity_items.h b/pcbnew/connectivity/connectivity_items.h index dba8ee0e12..b9638d2e05 100644 --- a/pcbnew/connectivity/connectivity_items.h +++ b/pcbnew/connectivity/connectivity_items.h @@ -433,7 +433,7 @@ public: void ClearDirtyFlags() { - for( auto item : m_items ) + for( CN_ITEM* item : m_items ) item->SetDirty( false ); SetDirty( false ); diff --git a/pcbnew/connectivity/from_to_cache.cpp b/pcbnew/connectivity/from_to_cache.cpp index 881268f28a..8041a2c735 100644 --- a/pcbnew/connectivity/from_to_cache.cpp +++ b/pcbnew/connectivity/from_to_cache.cpp @@ -59,7 +59,7 @@ enum PATH_STATUS { static bool isVertexVisited( CN_ITEM* v, const std::vector& path ) { - for( auto u : path ) + for( CN_ITEM* u : path ) { if ( u == v ) return true; @@ -95,11 +95,11 @@ static PATH_STATUS uniquePathBetweenNodes( CN_ITEM* u, CN_ITEM* v, std::vectorConnectedItems() ) + for( CN_ITEM* ci : last->ConnectedItems() ) { bool vertexVisited = isVertexVisited( ci, path ); - for( auto& p : Q ) + for( std::vector& p : Q ) if( isVertexVisited( ci, p ) ) { vertexVisited = true; diff --git a/pcbnew/dialogs/panel_setup_layers.cpp b/pcbnew/dialogs/panel_setup_layers.cpp index eac15bf06d..0a0cbb06cb 100644 --- a/pcbnew/dialogs/panel_setup_layers.cpp +++ b/pcbnew/dialogs/panel_setup_layers.cpp @@ -725,7 +725,7 @@ LSEQ PANEL_SETUP_LAYERS::getNonRemovableLayers() PCB_LAYER_COLLECTOR collector; LSEQ newLayerSeq = newLayers.Seq(); - for( auto layer_id : curLayers.Seq() ) + for( PCB_LAYER_ID layer_id : curLayers.Seq() ) { if( IsCopperLayer( layer_id ) ) // Copper layers are not taken into account here continue; diff --git a/pcbnew/drc/drc_engine.cpp b/pcbnew/drc/drc_engine.cpp index ab388ed850..ff3fd8e802 100644 --- a/pcbnew/drc/drc_engine.cpp +++ b/pcbnew/drc/drc_engine.cpp @@ -1723,7 +1723,7 @@ bool DRC_ENGINE::IsNetTie( BOARD_ITEM* aItem ) DRC_TEST_PROVIDER* DRC_ENGINE::GetTestProvider( const wxString& name ) const { - for( auto prov : m_testProviders ) + for( DRC_TEST_PROVIDER* prov : m_testProviders ) { if( name == prov->GetName() ) return prov; diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 03c55a2c5a..773e7d3557 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -391,10 +391,10 @@ FOOTPRINT* FOOTPRINT_EDIT_FRAME::SelectFootprintFromBoard( BOARD* aPcb ) oldName = fpname; - for( auto mod : aPcb->Footprints() ) + for( FOOTPRINT* fp : aPcb->Footprints() ) { - if( fpname == mod->GetReference() ) - return mod; + if( fpname == fp->GetReference() ) + return fp; } return nullptr; diff --git a/pcbnew/microwave/microwave_inductor.cpp b/pcbnew/microwave/microwave_inductor.cpp index 396e3a6873..0856633567 100644 --- a/pcbnew/microwave/microwave_inductor.cpp +++ b/pcbnew/microwave/microwave_inductor.cpp @@ -359,7 +359,7 @@ FOOTPRINT* MICROWAVE_TOOL::createMicrowaveInductor( MICROWAVE_INDUCTOR_PATTERN& PCB_EDIT_FRAME& editFrame = *getEditFrame(); - auto pt = aInductorPattern.m_End - aInductorPattern.m_Start; + wxPoint pt = aInductorPattern.m_End - aInductorPattern.m_Start; int min_len = KiROUND( EuclideanNorm( pt ) ); aInductorPattern.m_Length = min_len; diff --git a/pcbnew/pcb_group.cpp b/pcbnew/pcb_group.cpp index e46abfd6ac..eccc74aeea 100644 --- a/pcbnew/pcb_group.cpp +++ b/pcbnew/pcb_group.cpp @@ -129,7 +129,7 @@ void PCB_GROUP::SetPosition( const VECTOR2I& aNewpos ) void PCB_GROUP::SetLayerRecursive( PCB_LAYER_ID aLayer, int aDepth ) { - for( auto item : m_items ) + for( BOARD_ITEM* item : m_items ) { if( ( item->Type() == PCB_GROUP_T ) && ( aDepth > 0 ) ) { diff --git a/pcbnew/plugins/fabmaster/import_fabmaster.cpp b/pcbnew/plugins/fabmaster/import_fabmaster.cpp index 63e94a0f63..062960415a 100644 --- a/pcbnew/plugins/fabmaster/import_fabmaster.cpp +++ b/pcbnew/plugins/fabmaster/import_fabmaster.cpp @@ -128,7 +128,7 @@ bool FABMASTER::Read( const std::string& aFile ) bool quoted = false; - for( auto ch : buffer ) + for( auto& ch : buffer ) { switch( ch ) { diff --git a/pcbnew/tools/pcb_grid_helper.cpp b/pcbnew/tools/pcb_grid_helper.cpp index 85cffa4775..fd6bc28355 100644 --- a/pcbnew/tools/pcb_grid_helper.cpp +++ b/pcbnew/tools/pcb_grid_helper.cpp @@ -133,7 +133,7 @@ VECTOR2I PCB_GRID_HELPER::AlignToArc( const VECTOR2I& aPoint, const SHAPE_ARC& a int min_d = std::numeric_limits::max(); - for( auto pt : { aArc.GetP0(), aArc.GetP1() } ) + for( VECTOR2I& pt : { aArc.GetP0(), aArc.GetP1() } ) { int d = ( pt - aPoint ).EuclideanNorm(); diff --git a/pcbnew/tracks_cleaner.cpp b/pcbnew/tracks_cleaner.cpp index d78027010d..92e61ac251 100644 --- a/pcbnew/tracks_cleaner.cpp +++ b/pcbnew/tracks_cleaner.cpp @@ -661,7 +661,7 @@ bool TRACKS_CLEANER::mergeCollinearSegments( PCB_TRACK* aSeg1, PCB_TRACK* aSeg2 // If the existing connected points are not the same as the points generated by our // min/max alg, then assign the missing points to the end closest. This ensures that // our replacement track is still connected - for( auto pt : pts ) + for( auto& pt : pts ) { if( !dummy_seg.IsPointOnEnds( wxPoint( pt.x, pt.y ) ) ) {