Fix unnecessary copy initialization detected by clang-tidy

This commit is contained in:
Camille 2017-09-22 19:11:11 +02:00 committed by Wayne Stambaugh
parent 28692c40e1
commit 3168d03fe5
19 changed files with 35 additions and 35 deletions

View File

@ -392,17 +392,17 @@ bool OpenPDF( const wxString& file )
void OpenFile( const wxString& file )
{
wxString command;
wxString filename = file;
wxFileName CurrentFileName( filename );
wxString ext, type;
wxFileName currentFileName( file );
wxString ext;
wxString type;
ext = CurrentFileName.GetExt();
ext = currentFileName.GetExt();
wxFileType* filetype = wxTheMimeTypesManager->GetFileTypeFromExtension( ext );
bool success = false;
wxFileType::MessageParameters params( filename, type );
wxFileType::MessageParameters params( file, type );
if( filetype )
success = filetype->GetOpenCommand( &command, params );

View File

@ -79,7 +79,7 @@ void DIALOG_FP_CONFLICT_ASSIGNMENT_SELECTOR::OnColumnClick( wxListEvent& event )
// when it is the COL_SELCMP column, set all item choices to cmp file assigment.
// when it is the COL_SELSCH column, set all item choices to schematic assigment.
wxListItem item = event.GetItem();
const wxListItem& item = event.GetItem();
int column = event.GetColumn();
int colclr, colset;

View File

@ -319,7 +319,7 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
if( fieldSeq )
{
// Get the string containing the sequence of nodes:
wxString nodeSeqIndexLineStr = fieldSeq->GetText();
const wxString& nodeSeqIndexLineStr = fieldSeq->GetText();
// Verify field exists and is not empty:
if( !nodeSeqIndexLineStr.IsEmpty() )

View File

@ -165,7 +165,7 @@ void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER * aPlotter, SCH_SCREEN* aS
{
PAGE_INFO plotPage; // page size selected to plot
// Considerations on page size and scaling requests
PAGE_INFO actualPage = aScreen->GetPageSettings(); // page size selected in schematic
const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
switch( m_pageSizeSelect )
{

View File

@ -134,7 +134,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage( const wxString& aLayerName,
wxBusyCursor dummy;
boardBoundingBox = ((GERBVIEW_FRAME*) m_Parent)->GetGerberLayoutBoundingBox();
wxString titleblockFilename = aLayerName; // TODO see if we uses the gerber file name
const wxString& titleblockFilename = aLayerName; // TODO see if we uses the gerber file name
// Use the page size as the drawing area when the board is shown or the user scale
// is less than 1.

View File

@ -919,7 +919,7 @@ wxTreeItemId TREE_PROJECT_FRAME::findSubdirTreeItem( const wxString& aSubDir )
void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
{
wxFileName pathModified = event.GetPath();
const wxFileName& pathModified = event.GetPath();
wxString subdir = pathModified.GetPath();
wxString fn = pathModified.GetFullPath();
@ -970,8 +970,8 @@ void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
case wxFSW_EVENT_RENAME :
{
wxFileName newpath = event.GetNewPath();
wxString newfn = newpath.GetFullPath();
const wxFileName& newpath = event.GetNewPath();
wxString newfn = newpath.GetFullPath();
while( kid.IsOk() )
{
@ -1057,7 +1057,7 @@ void TREE_PROJECT_FRAME::FileWatcherReset()
if( itemData && itemData->GetType() == TREE_DIRECTORY )
{
// we can see wxString under a debugger, not a wxFileName
wxString path = itemData->GetFileName();
const wxString& path = itemData->GetFileName();
wxLogDebug( "%s: add '%s'\n", __func__, TO_UTF8( path ) );

View File

@ -573,7 +573,7 @@ bool BOARD_NETLIST_UPDATER::testConnectivity( NETLIST& aNetlist )
// Explore all pins/pads in component
for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
{
COMPONENT_NET net = component->GetNet( jj );
const COMPONENT_NET& net = component->GetNet( jj );
padname = net.GetPinName();
if( footprint->FindPadByName( padname ) )

View File

@ -2776,7 +2776,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// Explore all pins/pads in component
for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
{
COMPONENT_NET net = component->GetNet( jj );
const COMPONENT_NET& net = component->GetNet( jj );
padname = net.GetPinName();
if( footprint->FindPadByName( padname ) )

View File

@ -176,7 +176,7 @@ static bool getNumberingOffset( const wxString& str,
DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T type,
int& offsetToFill )
{
const wxString alphabet = alphabetFromNumberingScheme( type );
const wxString& alphabet = alphabetFromNumberingScheme( type );
int offset = 0;
const int radix = alphabet.length();

View File

@ -165,11 +165,11 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
bool aUseFootprintViewer,
wxDC* aDC )
{
MODULE* module = NULL;
wxPoint curspos = GetCrossHairPosition();
wxString moduleName, keys;
wxString libName = aLibrary;
bool allowWildSeach = true;
MODULE* module = NULL;
wxPoint curspos = GetCrossHairPosition();
wxString moduleName, keys;
const wxString& libName = aLibrary;
bool allowWildSeach = true;
static wxArrayString HistoryList;
static wxString lastComponentName;

View File

@ -156,7 +156,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage( const wxString& aLayerName, int aPageN
BOARD* brd = ((PCB_BASE_FRAME*) m_Parent)->GetBoard();
boardBoundingBox = brd->ComputeBoundingBox();
wxString titleblockFilename = brd->GetFileName();
const wxString& titleblockFilename = brd->GetFileName();
// Use the page size as the drawing area when the board is shown or the user scale
// is less than 1.

View File

@ -436,7 +436,7 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
const LINE LINE_PLACER::reduceToNearestObstacle( const LINE& aOriginalLine )
{
auto l0 = aOriginalLine.CLine();
const auto& l0 = aOriginalLine.CLine();
if ( !l0.PointCount() )
return aOriginalLine;

View File

@ -111,7 +111,7 @@ bool X3DPARSER::getGroupingNodes( wxXmlNode* aNode, std::vector<wxXmlNode*>& aRe
child != NULL;
child = child->GetNext() )
{
wxString name = child->GetName();
const wxString& name = child->GetName();
if( name == "Transform" || name == "Switch" || name == "Group" )
aResult.push_back( child );

View File

@ -110,7 +110,7 @@ void X3DAPP::readFields( wxXmlNode* aNode )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "DEF" )
{
@ -163,7 +163,7 @@ bool X3DAPP::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "DEF" )
{

View File

@ -78,7 +78,7 @@ bool X3DCOORDS::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "DEF" )
{

View File

@ -100,7 +100,7 @@ void X3DIFACESET::readFields( wxXmlNode* aNode )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "DEF" )
{

View File

@ -42,7 +42,7 @@ bool X3D::ReadTransform( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "USE" )
{
@ -89,7 +89,7 @@ bool X3D::ReadShape( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "USE" )
{
@ -129,7 +129,7 @@ bool X3D::ReadAppearance( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "USE" )
{
@ -169,7 +169,7 @@ bool X3D::ReadIndexedFaceSet( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDic
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "USE" )
{
@ -209,7 +209,7 @@ bool X3D::ReadCoordinates( wxXmlNode* aNode, X3DNODE* aParent, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "USE" )
{

View File

@ -93,7 +93,7 @@ bool X3DSHAPE::Read( wxXmlNode* aNode, X3DNODE* aTopNode, X3D_DICT& aDict )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "DEF" )
{

View File

@ -121,7 +121,7 @@ void X3DTRANSFORM::readFields( wxXmlNode* aNode )
prop != NULL;
prop = prop->GetNext() )
{
wxString pname = prop->GetName();
const wxString& pname = prop->GetName();
if( pname == "DEF" )
{