Use reference to strings in for loop rather than copy.

Closes Coverity ID 486180.
This commit is contained in:
Wayne Stambaugh 2024-02-07 07:58:57 -05:00
parent d91e744f0f
commit 105bcd4082
1 changed files with 4 additions and 4 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com> * Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2024 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -54,8 +54,8 @@ PROJECT_TEMPLATE::PROJECT_TEMPLATE( const wxString& aPath )
else if( !wxFileName::DirExists( m_metaPath.GetPath() ) ) else if( !wxFileName::DirExists( m_metaPath.GetPath() ) )
{ {
// Error, the meta information directory doesn't exist! // Error, the meta information directory doesn't exist!
m_title = _( "Couldn't open the meta information directory for this template!" ) + wxS( " " ) + m_title = _( "Couldn't open the meta information directory for this template!" ) +
m_metaPath.GetPath(); wxS( " " ) + m_metaPath.GetPath();
} }
else if( !wxFileName::FileExists( m_metaHtmlFile.GetFullPath() ) ) else if( !wxFileName::FileExists( m_metaHtmlFile.GetFullPath() ) )
{ {
@ -94,7 +94,7 @@ public:
{ {
const wxString gitfiles[] = { wxT( ".gitignore" ), wxT( ".gitattributes" ) }; const wxString gitfiles[] = { wxT( ".gitignore" ), wxT( ".gitattributes" ) };
for( auto file : gitfiles ) for( const wxString& file : gitfiles )
{ {
if( wxFileExists( path + file ) ) if( wxFileExists( path + file ) )
m_files.emplace_back( wxFileName( path + file ) ); m_files.emplace_back( wxFileName( path + file ) );