7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 16:10:10 +00:00

Fix unnecessary value parameter detected by clang-tidy. - Replace value parameter by const reference parameter or move-assignement in some cases

This commit is contained in:
Camille 2017-09-23 11:20:10 +02:00 committed by Wayne Stambaugh
parent 3168d03fe5
commit 9ff66a5274
123 changed files with 404 additions and 370 deletions
3d-viewer/3d_rendering
common
eeschema
include
kicad
lib_dxf
pcb_calculator
pcbnew
polygon/poly2tri/sweep
utils/idftools

View File

@ -39,7 +39,7 @@
* @param aXSize
* @param aYSize
*/
static void dbg_save_rgb_buffer( wxString aFileName,
static void dbg_save_rgb_buffer( const wxString& aFileName,
unsigned char *aRGBpixelBuffer,
unsigned int aXSize,
unsigned int aYSize )
@ -52,7 +52,7 @@ static void dbg_save_rgb_buffer( wxString aFileName,
}
void DBG_SaveBuffer( wxString aFileName,
void DBG_SaveBuffer( const wxString& aFileName,
const unsigned char *aInBuffer,
unsigned int aXSize,
unsigned int aYSize )
@ -75,7 +75,7 @@ void DBG_SaveBuffer( wxString aFileName,
}
void DBG_SaveBuffer( wxString aFileName,
void DBG_SaveBuffer( const wxString& aFileName,
const float *aInBuffer,
unsigned int aXSize,
unsigned int aYSize )
@ -99,7 +99,7 @@ void DBG_SaveBuffer( wxString aFileName,
}
void DBG_SaveBuffer( wxString aFileName,
void DBG_SaveBuffer( const wxString& aFileName,
const SFVEC3F *aInBuffer,
unsigned int aXSize,
unsigned int aYSize )
@ -123,7 +123,7 @@ void DBG_SaveBuffer( wxString aFileName,
}
void DBG_SaveNormalsBuffer( wxString aFileName,
void DBG_SaveNormalsBuffer( const wxString& aFileName,
const SFVEC3F *aInNormalsBuffer,
unsigned int aXSize,
unsigned int aYSize )

View File

@ -33,21 +33,21 @@
#include <plugins/3dapi/xv3d_types.h>
#include <wx/string.h>
void DBG_SaveBuffer( wxString aFileName,
void DBG_SaveBuffer( const wxString& aFileName,
const unsigned char *aInBuffer,
unsigned int aXSize, unsigned int aYSize );
void DBG_SaveBuffer( wxString aFileName,
void DBG_SaveBuffer( const wxString& aFileName,
const float *aInBuffer,
unsigned int aXSize,
unsigned int aYSize );
void DBG_SaveBuffer( wxString aFileName,
void DBG_SaveBuffer( const wxString& aFileName,
const SFVEC3F *aInBuffer,
unsigned int aXSize,
unsigned int aYSize );
void DBG_SaveNormalsBuffer( wxString aFileName,
void DBG_SaveNormalsBuffer( const wxString& aFileName,
const SFVEC3F *aInNormalsBuffer,
unsigned int aXSize,
unsigned int aYSize );

View File

@ -512,7 +512,7 @@ void CIMAGE::SetPixelsFromNormalizedFloat( const float * aNormalizedFloatArray )
}
void CIMAGE::SaveAsPNG( wxString aFileName ) const
void CIMAGE::SaveAsPNG( const wxString& aFileName ) const
{
DBG_SaveBuffer( aFileName, m_pixels, m_width, m_height );
}

View File

@ -186,7 +186,7 @@ public:
* each of RGB channel will have the 8bit-channel from the image.
* @param aFileName fime name (without extension)
*/
void SaveAsPNG( wxString aFileName ) const;
void SaveAsPNG( const wxString& aFileName ) const;
/**
* Function SetPixelsFromNormalizedFloat

View File

@ -30,6 +30,7 @@
#include <wx/stockitem.h>
#include <wx/richmsgdlg.h>
#include <confirm.h>
#include <bitmaps.h>
#include <html_messagebox.h>
#include <dialog_exit_base.h>
@ -84,7 +85,7 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
}
void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxString aExtraInfo )
void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxString& aExtraInfo )
{
wxRichMessageDialog* dlg;
@ -101,7 +102,7 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxStri
}
void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxString aExtraInfo )
void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxString& aExtraInfo )
{
wxRichMessageDialog* dlg;

View File

@ -47,6 +47,7 @@
#include <macros.h>
#include <pgm_base.h>
#include <thread>
#include <utility>
#include <wildcards_and_files_ext.h>
@ -205,7 +206,7 @@ int FOOTPRINT_ASYNC_LOADER::GetProgress() const
void FOOTPRINT_ASYNC_LOADER::SetCompletionCallback( std::function<void()> aCallback )
{
m_completion_cb = aCallback;
m_completion_cb = std::move(aCallback);
}

View File

@ -69,7 +69,7 @@ GAL_DISPLAY_OPTIONS::GAL_DISPLAY_OPTIONS()
{}
void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, const wxString& aBaseName )
{
long readLong; // Temp value buffer
@ -100,7 +100,7 @@ void GAL_DISPLAY_OPTIONS::ReadConfig( wxConfigBase* aCfg, wxString aBaseName )
}
void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, wxString aBaseName )
void GAL_DISPLAY_OPTIONS::WriteConfig( wxConfigBase* aCfg, const wxString& aBaseName )
{
aCfg->Write( aBaseName + GalGLAntialiasingKeyword,
UTIL::GetConfigForVal( aaModeConfigVals, gl_antialiasing_mode ) );

View File

@ -1545,7 +1545,7 @@ void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
}
void OPENGL_GAL::drawPolyline( std::function<VECTOR2D (int)> aPointGetter, int aPointCount )
void OPENGL_GAL::drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount )
{
if( aPointCount < 2 )
return;

View File

@ -115,7 +115,7 @@ SHAPE* SHAPE_FILE_IO::Read()
}
void SHAPE_FILE_IO::BeginGroup( const std::string aName )
void SHAPE_FILE_IO::BeginGroup( const std::string& aName )
{
assert( m_mode != IOM_READ );
@ -139,7 +139,7 @@ void SHAPE_FILE_IO::EndGroup()
}
void SHAPE_FILE_IO::Write( const SHAPE* aShape, const std::string aName )
void SHAPE_FILE_IO::Write( const SHAPE* aShape, const std::string& aName )
{
assert( m_mode != IOM_READ );

View File

@ -1657,7 +1657,7 @@ int SHAPE_POLY_SET::Distance( VECTOR2I aPoint )
}
int SHAPE_POLY_SET::Distance( SEG aSegment, int aSegmentWidth )
int SHAPE_POLY_SET::Distance( const SEG& aSegment, int aSegmentWidth )
{
int currentDistance;
int minDistance = DistanceToPolygon( aSegment, 0 );

View File

@ -24,6 +24,8 @@
#include <incremental_text_ctrl.h>
#include <utility>
/**
* Check that a string looks like a floating point number that can
* be dealt with.
@ -61,7 +63,7 @@ void INCREMENTAL_TEXT_CTRL::SetStep( double aMin, double aMax,
m_minVal = std::min( aMin, aMax );
m_maxVal = std::max( aMin, aMax );
m_stepFunc = aStepFunc;
m_stepFunc = std::move( aStepFunc );
// finally, clamp the current value and re-display
updateTextValue();

View File

@ -34,7 +34,7 @@
#endif
int SEARCH_STACK::Split( wxArrayString* aResult, const wxString aPathString )
int SEARCH_STACK::Split( wxArrayString* aResult, const wxString& aPathString )
{
wxStringTokenizer tokenizer( aPathString, PATH_SEPS, wxTOKEN_STRTOK );

View File

@ -28,7 +28,7 @@
#include <algorithm>
TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope,
int aDefaultHotKey, const wxString aMenuItem, const wxString& aMenuDesc,
int aDefaultHotKey, const wxString& aMenuItem, const wxString& aMenuDesc,
const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) :
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
m_menuItem( aMenuItem ), m_menuDescription( aMenuDesc ),

View File

@ -452,7 +452,7 @@ double mpScaleY::P2x( mpWindow& w, double x )
IMPLEMENT_ABSTRACT_CLASS( mpFX, mpLayer )
mpFX::mpFX( wxString name, int flags )
mpFX::mpFX( const wxString& name, int flags )
{
SetName( name );
m_flags = flags;
@ -529,7 +529,7 @@ void mpFX::Plot( wxDC& dc, mpWindow& w )
IMPLEMENT_ABSTRACT_CLASS( mpFY, mpLayer )
mpFY::mpFY( wxString name, int flags )
mpFY::mpFY( const wxString& name, int flags )
{
SetName( name );
m_flags = flags;
@ -598,7 +598,7 @@ void mpFY::Plot( wxDC& dc, mpWindow& w )
IMPLEMENT_ABSTRACT_CLASS( mpFXY, mpLayer )
mpFXY::mpFXY( wxString name, int flags )
mpFXY::mpFXY( const wxString& name, int flags )
{
SetName( name );
m_flags = flags;
@ -790,7 +790,7 @@ void mpFXY::Plot( wxDC& dc, mpWindow& w )
IMPLEMENT_ABSTRACT_CLASS( mpProfile, mpLayer )
mpProfile::mpProfile( wxString name, int flags )
mpProfile::mpProfile( const wxString& name, int flags )
{
SetName( name );
m_flags = flags;
@ -1273,7 +1273,7 @@ IMPLEMENT_ABSTRACT_CLASS( mpScaleXBase, mpLayer )
IMPLEMENT_DYNAMIC_CLASS( mpScaleX, mpScaleXBase )
IMPLEMENT_DYNAMIC_CLASS( mpScaleXLog, mpScaleXBase )
mpScaleXBase::mpScaleXBase( wxString name, int flags, bool ticks, unsigned int type )
mpScaleXBase::mpScaleXBase( const wxString& name, int flags, bool ticks, unsigned int type )
{
SetName( name );
SetFont( (wxFont&) *wxSMALL_FONT );
@ -1285,13 +1285,13 @@ mpScaleXBase::mpScaleXBase( wxString name, int flags, bool ticks, unsigned int t
}
mpScaleX::mpScaleX( wxString name, int flags, bool ticks, unsigned int type ) :
mpScaleX::mpScaleX( const wxString& name, int flags, bool ticks, unsigned int type ) :
mpScaleXBase( name, flags, ticks, type )
{
}
mpScaleXLog::mpScaleXLog( wxString name, int flags, bool ticks, unsigned int type ) :
mpScaleXLog::mpScaleXLog( const wxString& name, int flags, bool ticks, unsigned int type ) :
mpScaleXBase( name, flags, ticks, type )
{
}
@ -1501,7 +1501,7 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
IMPLEMENT_DYNAMIC_CLASS( mpScaleY, mpLayer )
mpScaleY::mpScaleY( wxString name, int flags, bool ticks )
mpScaleY::mpScaleY( const wxString& name, int flags, bool ticks )
{
SetName( name );
SetFont( (wxFont&) *wxSMALL_FONT );
@ -3268,7 +3268,7 @@ void mpWindow::SetColourTheme( const wxColour& bgColour,
IMPLEMENT_DYNAMIC_CLASS( mpFXYVector, mpFXY )
// Constructor
mpFXYVector::mpFXYVector( wxString name, int flags ) : mpFXY( name, flags )
mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags )
{
m_index = 0;
// printf("FXYVector::FXYVector!\n");
@ -3425,7 +3425,7 @@ IMPLEMENT_DYNAMIC_CLASS( mpText, mpLayer )
* @param offsetx x position in percentage (0-100)
* @param offsetx y position in percentage (0-100)
*/
mpText::mpText( wxString name, int offsetx, int offsety )
mpText::mpText( const wxString& name, int offsetx, int offsety )
{
SetName( name );

View File

@ -82,7 +82,7 @@ BOM_COLUMN* BOM_COLUMN_LIST::GetColumnById( unsigned int aColId )
/**
* Return a column based on its string title
*/
BOM_COLUMN* BOM_COLUMN_LIST::GetColumnByTitle( wxString aColTitle )
BOM_COLUMN* BOM_COLUMN_LIST::GetColumnByTitle( const wxString& aColTitle )
{
for( unsigned int ii=0; ii<Columns.size(); ii++ )
{
@ -110,7 +110,7 @@ bool BOM_COLUMN_LIST::ContainsColumn( unsigned int aColId )
/**
* Test if the list includes a column with the given title
*/
bool BOM_COLUMN_LIST::ContainsColumn( wxString aColTitle )
bool BOM_COLUMN_LIST::ContainsColumn( const wxString& aColTitle )
{
return nullptr != GetColumnByTitle( aColTitle );
}

View File

@ -138,10 +138,10 @@ public:
BOM_COLUMN* GetColumnByIndex( unsigned int aColIndex );
BOM_COLUMN* GetColumnById( unsigned int aColId );
BOM_COLUMN* GetColumnByTitle( const wxString aColTitle ) ;
BOM_COLUMN* GetColumnByTitle( const wxString& aColTitle ) ;
bool ContainsColumn( unsigned int aColId );
bool ContainsColumn( const wxString aColTitle );
bool ContainsColumn( const wxString& aColTitle );
bool AddColumn( BOM_COLUMN* aCol );

View File

@ -56,7 +56,7 @@ static BOM_TABLE_ROW const* ItemToRow( wxDataViewItem aItem )
}
BOM_FIELD_VALUES::BOM_FIELD_VALUES( wxString aRefDes, FIELD_VALUE_MAP* aTemplate ) :
BOM_FIELD_VALUES::BOM_FIELD_VALUES( const wxString& aRefDes, FIELD_VALUE_MAP* aTemplate ) :
m_refDes( aRefDes ),
m_templateValues( aTemplate )
{
@ -542,7 +542,7 @@ BOM_TABLE_COMPONENT::BOM_TABLE_COMPONENT( BOM_TABLE_GROUP* aParent,
* Try to add a unit to this component
* If the references match, it will be added
*/
bool BOM_TABLE_COMPONENT::AddUnit( SCH_REFERENCE aUnit )
bool BOM_TABLE_COMPONENT::AddUnit( const SCH_REFERENCE& aUnit )
{
// Addition is successful if the references match or there are currently no units in the group
if( Units.size() == 0 || Units[0].GetRef().Cmp( aUnit.GetRef() ) == 0 )

View File

@ -58,7 +58,7 @@ typedef std::map<unsigned int, wxString> FIELD_VALUE_MAP;
class BOM_FIELD_VALUES
{
public:
BOM_FIELD_VALUES( wxString aRefDes, FIELD_VALUE_MAP* aTemplate );
BOM_FIELD_VALUES( const wxString& aRefDes, FIELD_VALUE_MAP* aTemplate );
/**
* Return the current value for the provided field ID
@ -218,7 +218,7 @@ public:
BOM_TABLE_COMPONENT( BOM_TABLE_GROUP* aParent, BOM_COLUMN_LIST* aColumnList, BOM_FIELD_VALUES* aValues );
bool AddUnit( SCH_REFERENCE aUnit );
bool AddUnit( const SCH_REFERENCE& aUnit );
virtual wxString GetFieldValue( unsigned int aFieldId ) const override;

View File

@ -52,7 +52,7 @@ class wxConfigBase;
class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE
{
public:
DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, wxString message );
DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& message );
private:
@ -98,7 +98,7 @@ private:
};
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, wxString message )
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent, const wxString& message )
: DIALOG_ANNOTATE_BASE( parent )
{
m_Parent = parent;
@ -311,7 +311,7 @@ int DIALOG_ANNOTATE::GetAnnotateAlgo()
}
int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, wxString message )
int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& message )
{
DIALOG_ANNOTATE dlg( aCaller, message );

View File

@ -67,7 +67,7 @@ int InvokeDialogRescueEach( SCH_EDIT_FRAME* aCaller, RESCUER& aRescuer, bool aAs
/// Create and show DIALOG_ANNOTATE and return whatever
/// DIALOG_ANNOTATE::ShowModal() returns.
int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, wxString message = "" );
int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& message = "" );
/// Create the modeless DIALOG_ERC and show it, return something to
/// destroy or close it. The dialog will have ID_DIALOG_ERC from id.h

View File

@ -91,7 +91,7 @@ static void get_components( std::vector<SCH_COMPONENT*>& aComponents )
* @param aLibs - the loaded PART_LIBS
* @param aCached - whether we are looking for the cached part
*/
static LIB_PART* find_component( wxString aName, PART_LIBS* aLibs, bool aCached )
static LIB_PART* find_component( const wxString& aName, PART_LIBS* aLibs, bool aCached )
{
LIB_PART *part = NULL;

View File

@ -900,7 +900,7 @@ SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
}
wxString SCH_COMPONENT::GetFieldText( wxString aFieldName, bool aIncludeDefaultFields ) const
wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, bool aIncludeDefaultFields ) const
{
// Field name for comparison
wxString cmpFieldName;

View File

@ -334,7 +334,7 @@ public:
* @param aIncludeDefaultFields is used to search the default library symbol fields in the
* search.
*/
wxString GetFieldText( wxString aFieldName, bool aIncludeDefaultFields = true ) const;
wxString GetFieldText( const wxString& aFieldName, bool aIncludeDefaultFields = true ) const;
/**
* Populates a std::vector with SCH_FIELDs.

View File

@ -52,7 +52,7 @@
#include <kicad_string.h>
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, wxString aName ) :
SCH_FIELD::SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent, const wxString& aName ) :
SCH_ITEM( aParent, SCH_FIELD_T ),
EDA_TEXT()
{

View File

@ -61,7 +61,7 @@ class SCH_FIELD : public SCH_ITEM, public EDA_TEXT
public:
SCH_FIELD( const wxPoint& aPos, int aFieldId, SCH_COMPONENT* aParent,
wxString aName = wxEmptyString );
const wxString& aName = wxEmptyString );
// Do not create a copy constructor. The one generated by the compiler is adequate.

Some files were not shown because too many files have changed in this diff Show More