Fix loop variable copy in for-range loop, use const reference instead
This commit is contained in:
parent
5c4f8abd24
commit
f5f7ba4746
|
@ -187,7 +187,7 @@ bool S3D_FILENAME_RESOLVER::createPathList( void )
|
|||
|
||||
if( GetKicadPaths( epaths ) )
|
||||
{
|
||||
for( auto i : epaths )
|
||||
for( const auto& i : epaths )
|
||||
{
|
||||
wxString pathVal = ExpandEnvVarSubstitutions( i );
|
||||
|
||||
|
|
|
@ -341,7 +341,7 @@ void DLG_3D_PATH_CONFIG::updateEnvVars( void )
|
|||
|
||||
int j = 0;
|
||||
|
||||
for( auto i : epaths )
|
||||
for( const auto& i : epaths )
|
||||
{
|
||||
wxString val = ExpandEnvVarSubstitutions( i );
|
||||
m_EnvVars->SetCellValue( j, 0, i );
|
||||
|
|
|
@ -103,7 +103,7 @@ void WX_HTML_REPORT_PANEL::refreshView()
|
|||
{
|
||||
wxString html;
|
||||
|
||||
for( REPORT_LINE l : m_report )
|
||||
for( const REPORT_LINE& l : m_report )
|
||||
{
|
||||
html += generateHtml( l );
|
||||
}
|
||||
|
@ -271,7 +271,7 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
|
|||
return;
|
||||
}
|
||||
|
||||
for( REPORT_LINE l : m_report )
|
||||
for( const REPORT_LINE& l : m_report )
|
||||
{
|
||||
f.Write( generatePlainText( l ) );
|
||||
}
|
||||
|
|
|
@ -155,7 +155,7 @@ const std::string TOOL_EVENT_LIST::Format() const
|
|||
{
|
||||
std::string s;
|
||||
|
||||
for( TOOL_EVENT e : m_events )
|
||||
for( const TOOL_EVENT& e : m_events )
|
||||
s += e.Format() + " ";
|
||||
|
||||
return s;
|
||||
|
|
|
@ -120,7 +120,7 @@ void CMP_TREE_MODEL_ADAPTER_BASE::AddLibrariesWithProgress(
|
|||
|
||||
unsigned int ii = 0;
|
||||
|
||||
for( auto nickname : aNicknames )
|
||||
for( const auto& nickname : aNicknames )
|
||||
{
|
||||
if( prg )
|
||||
prg->Update( ii++, wxString::Format( _( "Loading library \"%s\"" ), nickname ) );
|
||||
|
|
|
@ -198,7 +198,7 @@ void DIALOG_BOM_EDITOR::ApplyAllChanges()
|
|||
ITEM_PICKER picker;
|
||||
|
||||
// Iterate through each of the components that were changed
|
||||
for( auto ref : changed )
|
||||
for( const auto& ref : changed )
|
||||
{
|
||||
// Extract the SCH_COMPONENT* object
|
||||
auto cmp = ref.GetComp();
|
||||
|
|
|
@ -501,7 +501,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
|||
newScreens.GetLibNicknames( names );
|
||||
wxArrayString newLibNames;
|
||||
|
||||
for( auto name : names )
|
||||
for( const auto& name : names )
|
||||
{
|
||||
if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
|
||||
newLibNames.Add( name );
|
||||
|
@ -526,7 +526,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
|||
|
||||
if( !table.IsEmpty() )
|
||||
{
|
||||
for( auto libName : newLibNames )
|
||||
for( const auto& libName : newLibNames )
|
||||
{
|
||||
if( !table.HasLibrary( libName ) )
|
||||
continue;
|
||||
|
@ -602,7 +602,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
|
|||
SCH_SCREEN* newScreen = newSheet->GetScreen();
|
||||
wxCHECK_MSG( newScreen, false, "No screen defined for imported sheet." );
|
||||
|
||||
for( auto duplicateName : duplicateSheetNames )
|
||||
for( const auto& duplicateName : duplicateSheetNames )
|
||||
{
|
||||
SCH_SHEET* renamedSheet = newScreen->GetSheet( duplicateName );
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
|
|||
aFormatter->Print( 0, ".title KiCad schematic\n" );
|
||||
|
||||
// Write .include directives
|
||||
for( auto lib : m_libraries )
|
||||
for( const auto& lib : m_libraries )
|
||||
{
|
||||
wxString full_path;
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
|
|||
|
||||
bool SCH_SHEET::HasPin( const wxString& aName )
|
||||
{
|
||||
for( SCH_SHEET_PIN pin : m_pins )
|
||||
for( const SCH_SHEET_PIN& pin : m_pins )
|
||||
{
|
||||
if( pin.GetText().CmpNoCase( aName ) == 0 )
|
||||
return true;
|
||||
|
@ -219,7 +219,7 @@ bool SCH_SHEET::HasPin( const wxString& aName )
|
|||
|
||||
bool SCH_SHEET::IsVerticalOrientation() const
|
||||
{
|
||||
for( SCH_SHEET_PIN pin : m_pins )
|
||||
for( const SCH_SHEET_PIN& pin : m_pins )
|
||||
{
|
||||
if( pin.GetEdge() > 1 )
|
||||
return true;
|
||||
|
@ -230,7 +230,7 @@ bool SCH_SHEET::IsVerticalOrientation() const
|
|||
|
||||
bool SCH_SHEET::HasUndefinedPins()
|
||||
{
|
||||
for( SCH_SHEET_PIN pin : m_pins )
|
||||
for( const SCH_SHEET_PIN& pin : m_pins )
|
||||
{
|
||||
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
|
||||
EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
|
||||
|
|
|
@ -91,7 +91,7 @@ wxString SCH_BASE_FRAME::SelectLibraryFromList()
|
|||
std::vector< wxString > libNicknames = prj.SchSymbolLibTable()->GetLogicalLibs();
|
||||
|
||||
// Conversion from wxArrayString to vector of ArrayString
|
||||
for( auto name : libNicknames )
|
||||
for( const auto& name : libNicknames )
|
||||
{
|
||||
wxArrayString item;
|
||||
|
||||
|
|
|
@ -240,7 +240,7 @@ int SYMBOL_LIB_TABLE::GetModifyHash()
|
|||
int hash = 0;
|
||||
std::vector< wxString > libNames = GetLogicalLibs();
|
||||
|
||||
for( auto libName : libNames )
|
||||
for( const auto& libName : libNames )
|
||||
{
|
||||
const SYMBOL_LIB_TABLE_ROW* row = FindRow( libName );
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ bool LIB_VIEW_FRAME::ReCreateListLib()
|
|||
|
||||
wxArrayString libNames;
|
||||
|
||||
for( auto name : libs )
|
||||
for( const auto& name : libs )
|
||||
libNames.Add( name );
|
||||
|
||||
m_libList->Append( libNames );
|
||||
|
|
|
@ -351,7 +351,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
|
|||
{
|
||||
std::vector< wxFileName > overwrittenFiles;
|
||||
|
||||
for( auto file : destFiles )
|
||||
for( const auto& file : destFiles )
|
||||
{
|
||||
if( file.FileExists() )
|
||||
overwrittenFiles.push_back( file );
|
||||
|
@ -361,7 +361,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
|
|||
{
|
||||
wxString extendedMsg = _( "Overwriting files:" ) + "\n";
|
||||
|
||||
for( auto file : overwrittenFiles )
|
||||
for( const auto& file : overwrittenFiles )
|
||||
{
|
||||
extendedMsg += "\n" + file.GetFullName();
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
|
|||
// Find the template file name base. this is the name of the .pro template file
|
||||
wxString basename;
|
||||
|
||||
for( auto file : srcFiles )
|
||||
for( const auto& file : srcFiles )
|
||||
{
|
||||
if( file.GetExt() == wxT( "pro" ) )
|
||||
{
|
||||
|
@ -132,7 +132,7 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
|
|||
}
|
||||
}
|
||||
|
||||
for( auto file : srcFiles )
|
||||
for( const auto& file : srcFiles )
|
||||
{
|
||||
wxFileName destFile = file;
|
||||
|
||||
|
|
|
@ -365,7 +365,7 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK* aTrack, ENDPOINT_T aEndPo
|
|||
|
||||
auto anchors = citem->Anchors();
|
||||
|
||||
for( auto anchor : anchors )
|
||||
for( const auto& anchor : anchors )
|
||||
{
|
||||
if( anchor->Pos() == endpoint && anchor->IsDangling() )
|
||||
return true;
|
||||
|
|
|
@ -797,7 +797,7 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
|
|||
|
||||
void CN_CONNECTIVITY_ALGO::propagateConnections()
|
||||
{
|
||||
for( auto cluster : m_connClusters )
|
||||
for( const auto& cluster : m_connClusters )
|
||||
{
|
||||
if( cluster->IsConflicting() )
|
||||
{
|
||||
|
@ -862,7 +862,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std
|
|||
|
||||
m_connClusters = SearchClusters( CSM_CONNECTIVITY_CHECK );
|
||||
|
||||
for( auto cluster : m_connClusters )
|
||||
for( const auto& cluster : m_connClusters )
|
||||
{
|
||||
if( cluster->Contains( aZone ) && cluster->IsOrphaned() )
|
||||
{
|
||||
|
@ -897,7 +897,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLAT
|
|||
if( zone.m_zone->GetFilledPolysList().IsEmpty() )
|
||||
continue;
|
||||
|
||||
for( auto cluster : m_connClusters )
|
||||
for( const auto& cluster : m_connClusters )
|
||||
{
|
||||
if( cluster->Contains( zone.m_zone ) && cluster->IsOrphaned() )
|
||||
{
|
||||
|
@ -1051,16 +1051,16 @@ void CN_CONNECTIVITY_ALGO::ForEachItem( const std::function<void( CN_ITEM& )>& a
|
|||
|
||||
void CN_CONNECTIVITY_ALGO::ForEachAnchor( const std::function<void( CN_ANCHOR& )>& aFunc )
|
||||
{
|
||||
for( auto anchor : m_padList.Anchors() )
|
||||
for( const auto& anchor : m_padList.Anchors() )
|
||||
aFunc( *anchor );
|
||||
|
||||
for( auto anchor : m_viaList.Anchors() )
|
||||
for( const auto& anchor : m_viaList.Anchors() )
|
||||
aFunc( *anchor );
|
||||
|
||||
for( auto anchor : m_trackList.Anchors() )
|
||||
for( const auto& anchor : m_trackList.Anchors() )
|
||||
aFunc( *anchor );
|
||||
|
||||
for( auto anchor : m_zoneList.Anchors() )
|
||||
for( const auto& anchor : m_zoneList.Anchors() )
|
||||
aFunc( *anchor );
|
||||
}
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ const DIFF_PAIR DP_GATEWAY::Entry() const
|
|||
void DP_GATEWAYS::BuildOrthoProjections( DP_GATEWAYS& aEntries,
|
||||
const VECTOR2I& aCursorPos, int aOrthoScore )
|
||||
{
|
||||
for( DP_GATEWAY g : aEntries.Gateways() )
|
||||
for( const DP_GATEWAY& g : aEntries.Gateways() )
|
||||
{
|
||||
VECTOR2I midpoint( ( g.AnchorP() + g.AnchorN() ) / 2 );
|
||||
SEG guide_s( midpoint, midpoint + VECTOR2I( 1, 0 ) );
|
||||
|
|
Loading…
Reference in New Issue