kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #30939
[PATCH] Fix some performance issues
-
To:
"kicad-developers@xxxxxxxxxxxxxxxxxxx" <kicad-developers@xxxxxxxxxxxxxxxxxxx>
-
From:
Camille 019 <camille019@xxxxxxxxxxx>
-
Date:
Sat, 23 Sep 2017 10:17:11 +0000
-
Accept-language:
fr-FR, en-US
-
Authentication-results:
lists.launchpad.net; dkim=none (message not signed) header.d=none;lists.launchpad.net; dmarc=none action=none header.from=outlook.com;
-
Spamdiagnosticmetadata:
NSPM
-
Spamdiagnosticoutput:
1:99
-
Thread-index:
AQHTNFH9rbMe0PapdkKTL0cu2fr/6A==
-
Thread-topic:
[PATCH] Fix some performance issues
Hi all,
I recently play with clang-tidy on the KiCad source code. Here is a set of 2 patch which fix the unnecessary-copy-initialization<https://clang.llvm.org/extra/clang-tidy/checks/performance-unnecessary-copy-initialization.html> and unnecessary-value-param<https://clang.llvm.org/extra/clang-tidy/checks/performance-unnecessary-value-param.html> checks.
I will run more performance checks in the future. The next two:
- for-range-copy<https://clang.llvm.org/extra/clang-tidy/checks/performance-for-range-copy.html>
- type-promotion-in-math-fn<https://clang.llvm.org/extra/clang-tidy/checks/performance-type-promotion-in-math-fn.html>
Best regards,
--
Camille
From 31547ad9cef4d77cc21ec7b1dc222a35daa03137 Mon Sep 17 00:00:00 2001
From: Camille <camille019@xxxxxxxxxxx>
Date: Sat, 23 Sep 2017 11:20:10 +0200
Subject: [PATCH 2/2] Fix unnecessary value parameter detected by clang-tidy.
- Replace value parameter by const reference parameter or move-assignement
in some cases
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.13.5"
This is a multi-part message in MIME format.
--------------2.13.5
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
3d-viewer/3d_rendering/buffers_debug.cpp | 10 +++---
3d-viewer/3d_rendering/buffers_debug.h | 8 ++---
3d-viewer/3d_rendering/cimage.cpp | 2 +-
3d-viewer/3d_rendering/cimage.h | 2 +-
common/confirm.cpp | 5 +--
common/eagle_parser.cpp | 4 +--
common/footprint_info.cpp | 3 +-
common/gal/gal_display_options.cpp | 4 +--
common/gal/opengl/opengl_gal.cpp | 2 +-
common/geometry/shape_file_io.cpp | 4 +--
common/geometry/shape_poly_set.cpp | 2 +-
common/incremental_text_ctrl.cpp | 4 ++-
common/search_stack.cpp | 2 +-
common/tool/tool_action.cpp | 2 +-
common/widgets/mathplot.cpp | 20 ++++++------
eeschema/bom_table_column.cpp | 4 +--
eeschema/bom_table_column.h | 4 +--
eeschema/bom_table_model.cpp | 6 ++--
eeschema/bom_table_model.h | 6 ++--
eeschema/cmp_tree_model_adapter.cpp | 2 +-
eeschema/cmp_tree_model_adapter.h | 2 +-
eeschema/dialogs/dialog_annotate.cpp | 6 ++--
eeschema/invoke_sch_dialog.h | 2 +-
eeschema/project_rescue.cpp | 2 +-
eeschema/sch_component.cpp | 2 +-
eeschema/sch_component.h | 2 +-
eeschema/sch_field.cpp | 2 +-
eeschema/sch_field.h | 2 +-
eeschema/sch_sheet_path.cpp | 2 +-
eeschema/sch_sheet_path.h | 2 +-
include/class_board_item.h | 2 +-
include/confirm.h | 4 +--
include/gal/gal_display_options.h | 4 +--
include/gal/opengl/opengl_gal.h | 2 +-
include/geometry/shape_file_io.h | 4 +--
include/geometry/shape_poly_set.h | 2 +-
include/search_stack.h | 2 +-
include/tool/tool_action.h | 2 +-
include/widgets/mathplot.h | 20 ++++++------
kicad/commandframe.cpp | 2 +-
kicad/kicad.h | 2 +-
lib_dxf/drw_objects.cpp | 21 +++++++------
lib_dxf/drw_objects.h | 18 +++++------
lib_dxf/intern/drw_textcodec.cpp | 2 +-
lib_dxf/intern/drw_textcodec.h | 2 +-
lib_dxf/intern/dxfwriter.cpp | 5 +--
lib_dxf/libdxfrw.cpp | 4 +--
lib_dxf/libdxfrw.h | 4 +--
pcb_calculator/datafile_read_write.cpp | 2 +-
pcb_calculator/datafile_read_write.h | 2 +-
pcbnew/class_action_plugin.cpp | 2 +-
pcbnew/class_action_plugin.h | 2 +-
pcbnew/class_board_item.cpp | 2 +-
pcbnew/class_footprint_wizard.cpp | 2 +-
pcbnew/class_footprint_wizard.h | 2 +-
pcbnew/class_module.cpp | 2 +-
pcbnew/class_module.h | 2 +-
pcbnew/class_netclass.cpp | 2 +-
pcbnew/class_netclass.h | 2 +-
pcbnew/class_netinfo.h | 2 +-
pcbnew/class_netinfo_item.cpp | 2 +-
pcbnew/clean.cpp | 2 +-
pcbnew/connectivity_algo.cpp | 6 ++--
pcbnew/connectivity_algo.h | 6 ++--
pcbnew/dialogs/dialog_create_array.cpp | 2 +-
pcbnew/dialogs/dialog_design_rules.cpp | 4 +--
pcbnew/drc.cpp | 2 +-
pcbnew/drc_stuff.h | 2 +-
pcbnew/footprint_info_impl.cpp | 2 +-
pcbnew/footprint_info_impl.h | 2 +-
pcbnew/footprint_preview_panel.cpp | 3 +-
pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp | 38 +++++++++++------------
pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h | 32 +++++++++----------
pcbnew/pcad2kicadpcb_plugin/pcb.cpp | 16 +++++-----
pcbnew/pcad2kicadpcb_plugin/pcb.h | 18 +++++------
pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp | 8 ++---
pcbnew/pcad2kicadpcb_plugin/pcb_module.h | 8 ++---
pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp | 4 +--
pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h | 4 +--
pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp | 5 +--
pcbnew/pcad2kicadpcb_plugin/s_expr_loader.h | 5 ++-
pcbnew/ratsnest_viewitem.cpp | 3 +-
pcbnew/router/pns_diff_pair.cpp | 4 +--
pcbnew/router/pns_diff_pair.h | 4 +--
pcbnew/router/pns_kicad_iface.cpp | 4 +--
pcbnew/router/pns_logger.cpp | 6 ++--
pcbnew/router/pns_logger.h | 6 ++--
pcbnew/specctra.cpp | 4 +--
pcbnew/specctra.h | 6 ++--
pcbnew/specctra_export.cpp | 2 +-
pcbnew/tools/edit_constraints.cpp | 4 ++-
pcbnew/tools/pad_tool.cpp | 4 ++-
polygon/poly2tri/sweep/cdt.cc | 6 ++--
polygon/poly2tri/sweep/sweep_context.cc | 3 +-
utils/idftools/dxf2idf.cpp | 2 +-
utils/idftools/dxf2idf.h | 2 +-
utils/idftools/idf_common.cpp | 4 +--
utils/idftools/idf_common.h | 4 +--
utils/idftools/idf_outlines.cpp | 3 +-
utils/idftools/idf_parser.cpp | 19 ++++++------
utils/idftools/idf_parser.h | 16 +++++-----
101 files changed, 272 insertions(+), 251 deletions(-)
--------------2.13.5
Content-Type: text/x-patch; name="0002-Fix-unnecessary-value-parameter-detected-by-clang-ti.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0002-Fix-unnecessary-value-parameter-detected-by-clang-ti.patch"
diff --git a/3d-viewer/3d_rendering/buffers_debug.cpp b/3d-viewer/3d_rendering/buffers_debug.cpp
index b5132cef5..3318900a1 100644
--- a/3d-viewer/3d_rendering/buffers_debug.cpp
+++ b/3d-viewer/3d_rendering/buffers_debug.cpp
@@ -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 )
diff --git a/3d-viewer/3d_rendering/buffers_debug.h b/3d-viewer/3d_rendering/buffers_debug.h
index bb6b38597..c64975d7a 100644
--- a/3d-viewer/3d_rendering/buffers_debug.h
+++ b/3d-viewer/3d_rendering/buffers_debug.h
@@ -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 );
diff --git a/3d-viewer/3d_rendering/cimage.cpp b/3d-viewer/3d_rendering/cimage.cpp
index 755ef0b88..78622970b 100644
--- a/3d-viewer/3d_rendering/cimage.cpp
+++ b/3d-viewer/3d_rendering/cimage.cpp
@@ -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 );
}
diff --git a/3d-viewer/3d_rendering/cimage.h b/3d-viewer/3d_rendering/cimage.h
index 341dc54d3..1cf079268 100644
--- a/3d-viewer/3d_rendering/cimage.h
+++ b/3d-viewer/3d_rendering/cimage.h
@@ -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
diff --git a/common/confirm.cpp b/common/confirm.cpp
index 9c3ab3dfe..4e31ea05b 100644
--- a/common/confirm.cpp
+++ b/common/confirm.cpp
@@ -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>
@@ -82,7 +83,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;
@@ -99,7 +100,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;
diff --git a/common/eagle_parser.cpp b/common/eagle_parser.cpp
index e63b30bea..968d033e5 100644
--- a/common/eagle_parser.cpp
+++ b/common/eagle_parser.cpp
@@ -111,7 +111,7 @@ EROT Convert<EROT>( const wxString& aRot )
* @return T - the attributed parsed as the specified type.
*/
template<typename T>
-T parseRequiredAttribute( wxXmlNode* aNode, string aAttribute )
+T parseRequiredAttribute( wxXmlNode* aNode, const string& aAttribute )
{
wxString value;
@@ -130,7 +130,7 @@ T parseRequiredAttribute( wxXmlNode* aNode, string aAttribute )
* found.
*/
template<typename T>
-OPTIONAL_XML_ATTRIBUTE<T> parseOptionalAttribute( wxXmlNode* aNode, string aAttribute )
+OPTIONAL_XML_ATTRIBUTE<T> parseOptionalAttribute( wxXmlNode* aNode, const string& aAttribute )
{
return OPTIONAL_XML_ATTRIBUTE<T>( aNode->GetAttribute( aAttribute ) );
}
diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp
index ce31cf5e1..3f84e8b27 100644
--- a/common/footprint_info.cpp
+++ b/common/footprint_info.cpp
@@ -47,6 +47,7 @@
#include <macros.h>
#include <pgm_base.h>
#include <thread>
+#include <utility>
#include <wildcards_and_files_ext.h>
@@ -203,7 +204,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);
}
diff --git a/common/gal/gal_display_options.cpp b/common/gal/gal_display_options.cpp
index 92d46dedf..e3ef839f7 100644
--- a/common/gal/gal_display_options.cpp
+++ b/common/gal/gal_display_options.cpp
@@ -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 ) );
diff --git a/common/gal/opengl/opengl_gal.cpp b/common/gal/opengl/opengl_gal.cpp
index ad485bb57..ee4db32b2 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1501,7 +1501,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;
diff --git a/common/geometry/shape_file_io.cpp b/common/geometry/shape_file_io.cpp
index a87fd744f..0c9a16689 100644
--- a/common/geometry/shape_file_io.cpp
+++ b/common/geometry/shape_file_io.cpp
@@ -105,7 +105,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 );
@@ -129,7 +129,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 );
diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp
index 63ed4ee4b..41e169428 100644
--- a/common/geometry/shape_poly_set.cpp
+++ b/common/geometry/shape_poly_set.cpp
@@ -1446,7 +1446,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 );
diff --git a/common/incremental_text_ctrl.cpp b/common/incremental_text_ctrl.cpp
index cc814c797..2fac82928 100644
--- a/common/incremental_text_ctrl.cpp
+++ b/common/incremental_text_ctrl.cpp
@@ -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();
diff --git a/common/search_stack.cpp b/common/search_stack.cpp
index 9982f4147..6c96c3fa5 100644
--- a/common/search_stack.cpp
+++ b/common/search_stack.cpp
@@ -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 );
diff --git a/common/tool/tool_action.cpp b/common/tool/tool_action.cpp
index c73445f95..5a1cde498 100644
--- a/common/tool/tool_action.cpp
+++ b/common/tool/tool_action.cpp
@@ -26,7 +26,7 @@
#include <tool/action_manager.h>
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 ),
diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp
index 6ad1057e1..a899c15cc 100644
--- a/common/widgets/mathplot.cpp
+++ b/common/widgets/mathplot.cpp
@@ -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 );
diff --git a/eeschema/bom_table_column.cpp b/eeschema/bom_table_column.cpp
index ef270217e..ee14d009f 100644
--- a/eeschema/bom_table_column.cpp
+++ b/eeschema/bom_table_column.cpp
@@ -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 );
}
diff --git a/eeschema/bom_table_column.h b/eeschema/bom_table_column.h
index bf8292769..f117adba9 100644
--- a/eeschema/bom_table_column.h
+++ b/eeschema/bom_table_column.h
@@ -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 );
diff --git a/eeschema/bom_table_model.cpp b/eeschema/bom_table_model.cpp
index 83885f648..f20752e03 100644
--- a/eeschema/bom_table_model.cpp
+++ b/eeschema/bom_table_model.cpp
@@ -53,7 +53,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 )
{
@@ -114,7 +114,7 @@ bool BOM_FIELD_VALUES::GetTemplateValue( unsigned int aFieldId, wxString& aValue
* - There is no current value
* - The current value is empty
*/
-void BOM_FIELD_VALUES::SetFieldValue( unsigned int aFieldId, wxString aValue, bool aOverwrite )
+void BOM_FIELD_VALUES::SetFieldValue( unsigned int aFieldId, const wxString& aValue, bool aOverwrite )
{
if( aOverwrite || m_currentValues.count( aFieldId ) == 0 || m_currentValues[aFieldId].IsEmpty() )
{
@@ -528,7 +528,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 )
diff --git a/eeschema/bom_table_model.h b/eeschema/bom_table_model.h
index e011b1eb8..75bd196a9 100644
--- a/eeschema/bom_table_model.h
+++ b/eeschema/bom_table_model.h
@@ -58,13 +58,13 @@ 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 );
bool GetFieldValue( unsigned int aFieldId, wxString& aValue ) const;
bool GetBackupValue( unsigned int aFieldId, wxString& aValue ) const;
bool GetTemplateValue( unsigned int aFieldId, wxString& aValue ) const;
- void SetFieldValue( unsigned int aFieldId, wxString aValue, bool aOverwrite = false );
+ void SetFieldValue( unsigned int aFieldId, const wxString& aValue, bool aOverwrite = false );
wxString GetReference() const { return m_refDes; }
@@ -191,7 +191,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;
diff --git a/eeschema/cmp_tree_model_adapter.cpp b/eeschema/cmp_tree_model_adapter.cpp
index d830a8331..d49808a48 100644
--- a/eeschema/cmp_tree_model_adapter.cpp
+++ b/eeschema/cmp_tree_model_adapter.cpp
@@ -397,7 +397,7 @@ int CMP_TREE_MODEL_ADAPTER::WidthFor( wxString const& aHeading, int aCol )
bool CMP_TREE_MODEL_ADAPTER::FindAndExpand(
CMP_TREE_NODE& aNode,
- std::function<bool( CMP_TREE_NODE const* )> aFunc )
+ const std::function<bool( CMP_TREE_NODE const* )>& aFunc )
{
for( auto& node: aNode.Children )
{
diff --git a/eeschema/cmp_tree_model_adapter.h b/eeschema/cmp_tree_model_adapter.h
index a4cc5ec1b..a5df0a6c4 100644
--- a/eeschema/cmp_tree_model_adapter.h
+++ b/eeschema/cmp_tree_model_adapter.h
@@ -350,7 +350,7 @@ private:
*/
bool FindAndExpand(
CMP_TREE_NODE& aNode,
- std::function<bool( CMP_TREE_NODE const* )> aFunc );
+ const std::function<bool( CMP_TREE_NODE const* )>& aFunc );
/**
* Find and expand successful search results
diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp
index d866414ee..29529a84d 100644
--- a/eeschema/dialogs/dialog_annotate.cpp
+++ b/eeschema/dialogs/dialog_annotate.cpp
@@ -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;
@@ -310,7 +310,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 );
diff --git a/eeschema/invoke_sch_dialog.h b/eeschema/invoke_sch_dialog.h
index a2692a8da..33f3de42b 100644
--- a/eeschema/invoke_sch_dialog.h
+++ b/eeschema/invoke_sch_dialog.h
@@ -66,7 +66,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
diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp
index c757cde90..8380ac691 100644
--- a/eeschema/project_rescue.cpp
+++ b/eeschema/project_rescue.cpp
@@ -186,7 +186,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;
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 77ff9477c..91f485743 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -815,7 +815,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;
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index 2d6d047f6..2bd550bc2 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -324,7 +324,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.
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index a141d5eb4..1622677d6 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -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()
{
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index fc13b01d4..9a5d817df 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -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.
diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp
index bc2a0f0fe..d17f84df9 100644
--- a/eeschema/sch_sheet_path.cpp
+++ b/eeschema/sch_sheet_path.cpp
@@ -437,7 +437,7 @@ SCH_SHEET_LIST::SCH_SHEET_LIST( SCH_SHEET* aSheet )
}
-SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheetByPath( const wxString aPath, bool aHumanReadable )
+SCH_SHEET_PATH* SCH_SHEET_LIST::GetSheetByPath( const wxString& aPath, bool aHumanReadable )
{
wxString sheetPath;
diff --git a/eeschema/sch_sheet_path.h b/eeschema/sch_sheet_path.h
index ec891b97a..637d146e4 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -346,7 +346,7 @@ public:
* @return The sheet that matches \a aPath or NULL if no sheet matching
* \a aPath is found.
*/
- SCH_SHEET_PATH* GetSheetByPath( const wxString aPath, bool aHumanReadable = true );
+ SCH_SHEET_PATH* GetSheetByPath( const wxString& aPath, bool aHumanReadable = true );
/**
* Function IsModified
diff --git a/include/class_board_item.h b/include/class_board_item.h
index a7b03fe19..3bf2a438b 100644
--- a/include/class_board_item.h
+++ b/include/class_board_item.h
@@ -79,7 +79,7 @@ class BOARD_ITEM : public EDA_ITEM
protected:
PCB_LAYER_ID m_Layer;
- static int getTrailingInt( wxString aStr );
+ static int getTrailingInt( const wxString& aStr );
static int getNextNumberInSequence( const std::set<int>& aSeq, bool aFillSequenceGaps );
public:
diff --git a/include/confirm.h b/include/confirm.h
index 6dab366cf..6af382c63 100644
--- a/include/confirm.h
+++ b/include/confirm.h
@@ -65,7 +65,7 @@ void DisplayError( wxWindow* parent, const wxString& aMessage, int displaytime =
* @param aMessage is the message text to display
* @param aExtraInfo is extra data that can be optionally displayed in a collapsible pane
*/
-void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage, const wxString aExtraInfo = wxEmptyString );
+void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage, const wxString& aExtraInfo = wxEmptyString );
/**
@@ -76,7 +76,7 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aMessage, const wxS
* @param aMessage is the message text to display
* @param aExtraInfo is the extra data that can be optionally displayed in a collapsible pane
*/
-void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, const wxString aExtraInfo = wxEmptyString );
+void DisplayInfoMessage( wxWindow* parent, const wxString& aMessage, const wxString& aExtraInfo = wxEmptyString );
/**
* Function IsOK
diff --git a/include/gal/gal_display_options.h b/include/gal/gal_display_options.h
index 606c410dc..55c7e190f 100644
--- a/include/gal/gal_display_options.h
+++ b/include/gal/gal_display_options.h
@@ -66,8 +66,8 @@ namespace KIGFX
public:
GAL_DISPLAY_OPTIONS();
- void ReadConfig ( wxConfigBase* aCfg, wxString aBaseName );
- void WriteConfig( wxConfigBase* aCfg, wxString aBaseName );
+ void ReadConfig ( wxConfigBase* aCfg, const wxString& aBaseName );
+ void WriteConfig( wxConfigBase* aCfg, const wxString& aBaseName );
void NotifyChanged();
diff --git a/include/gal/opengl/opengl_gal.h b/include/gal/opengl/opengl_gal.h
index 6a2b189d6..c2e2becd7 100644
--- a/include/gal/opengl/opengl_gal.h
+++ b/include/gal/opengl/opengl_gal.h
@@ -374,7 +374,7 @@ private:
* @param aPointGetter is a function to obtain coordinates of n-th vertex.
* @param aPointCount is the number of points to be drawn.
*/
- void drawPolyline( std::function<VECTOR2D (int)> aPointGetter, int aPointCount );
+ void drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount );
/**
* @brief Draws a filled polygon. It does not need the last point to have the same coordinates
diff --git a/include/geometry/shape_file_io.h b/include/geometry/shape_file_io.h
index 78784d74e..919b1e2ba 100644
--- a/include/geometry/shape_file_io.h
+++ b/include/geometry/shape_file_io.h
@@ -48,12 +48,12 @@ class SHAPE_FILE_IO
SHAPE_FILE_IO( const std::string& aFilename, IO_MODE aMode = IOM_READ );
~SHAPE_FILE_IO();
- void BeginGroup( const std::string aName = "<noname>");
+ void BeginGroup( const std::string& aName = "<noname>");
void EndGroup();
SHAPE* Read();
- void Write( const SHAPE* aShape, const std::string aName = "<noname>" );
+ void Write( const SHAPE* aShape, const std::string& aName = "<noname>" );
void Write( const SHAPE& aShape, const std::string aName = "<noname>" )
{
diff --git a/include/geometry/shape_poly_set.h b/include/geometry/shape_poly_set.h
index b82dd9de4..832013498 100644
--- a/include/geometry/shape_poly_set.h
+++ b/include/geometry/shape_poly_set.h
@@ -969,7 +969,7 @@ class SHAPE_POLY_SET : public SHAPE
* @return int - The minimum distance between aSegment and all the polygons in the set.
* If the point is contained in the polygon, the distance is zero.
*/
- int Distance( SEG aSegment, int aSegmentWidth = 0 );
+ int Distance( const SEG& aSegment, int aSegmentWidth = 0 );
/**
* Function IsVertexInHole.
diff --git a/include/search_stack.h b/include/search_stack.h
index 2c6af7808..4133cc78b 100644
--- a/include/search_stack.h
+++ b/include/search_stack.h
@@ -105,7 +105,7 @@ public:
* @param aPathString is concatonated string with interposing ';' or ':' separators.
* @return int - the count of paths found in aPathString
*/
- static int Split( wxArrayString* aResult, const wxString aPathString );
+ static int Split( wxArrayString* aResult, const wxString& aPathString );
#if 1 // this function is so poorly designed it deserves not to exist.
/**
diff --git a/include/tool/tool_action.h b/include/tool/tool_action.h
index c0d7e4a15..81d9ba2c1 100644
--- a/include/tool/tool_action.h
+++ b/include/tool/tool_action.h
@@ -47,7 +47,7 @@ class TOOL_ACTION
{
public:
TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope = AS_CONTEXT,
- int aDefaultHotKey = 0, const wxString aMenuItem = wxEmptyString,
+ int aDefaultHotKey = 0, const wxString& aMenuItem = wxEmptyString,
const wxString& aMenuDesc = wxEmptyString, const BITMAP_OPAQUE* aIcon = NULL,
TOOL_ACTION_FLAGS aFlags = AF_NONE, void* aParam = NULL );
diff --git a/include/widgets/mathplot.h b/include/widgets/mathplot.h
index e0f5bbfba..256522326 100644
--- a/include/widgets/mathplot.h
+++ b/include/widgets/mathplot.h
@@ -525,7 +525,7 @@ public:
/** @param name Label
* @param flags Label alignment, pass one of #mpALIGN_RIGHT, #mpALIGN_CENTER, #mpALIGN_LEFT.
*/
- mpFX( wxString name = wxEmptyString, int flags = mpALIGN_RIGHT );
+ mpFX( const wxString& name = wxEmptyString, int flags = mpALIGN_RIGHT );
/** Get function value for argument.
* Override this function in your implementation.
@@ -557,7 +557,7 @@ public:
/** @param name Label
* @param flags Label alignment, pass one of #mpALIGN_BOTTOM, #mpALIGN_CENTER, #mpALIGN_TOP.
*/
- mpFY( wxString name = wxEmptyString, int flags = mpALIGN_TOP );
+ mpFY( const wxString& name = wxEmptyString, int flags = mpALIGN_TOP );
/** Get function value for argument.
* Override this function in your implementation.
@@ -591,7 +591,7 @@ public:
/** @param name Label
* @param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
*/
- mpFXY( wxString name = wxEmptyString, int flags = mpALIGN_NE );
+ mpFXY( const wxString& name = wxEmptyString, int flags = mpALIGN_NE );
/** Rewind value enumeration with mpFXY::GetNextXY.
* Override this function in your implementation.
@@ -650,7 +650,7 @@ public:
/** @param name Label
* @param flags Label alignment, pass one of #mpALIGN_BOTTOM, #mpALIGN_CENTER, #mpALIGN_TOP.
*/
- mpProfile( wxString name = wxEmptyString, int flags = mpALIGN_TOP );
+ mpProfile( const wxString& name = wxEmptyString, int flags = mpALIGN_TOP );
/** Get function value for argument.
* Override this function in your implementation.
@@ -845,7 +845,7 @@ public:
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid.
* @param type mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
*/
- mpScaleXBase( wxString name = wxT("X"), int flags = mpALIGN_CENTER,
+ mpScaleXBase( const wxString& name = wxT("X"), int flags = mpALIGN_CENTER,
bool ticks = true, unsigned int type = mpX_NORMAL );
virtual ~mpScaleXBase() {};
@@ -871,7 +871,7 @@ public:
* @param flags Set the position of the scale with respect to the window.
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid.
* @param type mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds. */
- mpScaleX( wxString name = wxT("X"), int flags = mpALIGN_CENTER,
+ mpScaleX( const wxString& name = wxT("X"), int flags = mpALIGN_CENTER,
bool ticks = true, unsigned int type = mpX_NORMAL );
/** Layer plot handler.
@@ -900,7 +900,7 @@ public:
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid.
* @param type mpX_NORMAL for normal labels, mpX_TIME for time axis in hours, minutes, seconds.
*/
- mpScaleXLog( wxString name = wxT("log(X)"), int flags = mpALIGN_CENTER,
+ mpScaleXLog( const wxString& name = wxT("log(X)"), int flags = mpALIGN_CENTER,
bool ticks = true, unsigned int type = mpX_NORMAL );
virtual double TransformToPlot( double x ) override;
@@ -942,7 +942,7 @@ public:
* @param flags Set position of the scale respect to the window.
* @param ticks Select ticks or grid. Give TRUE (default) for drawing axis ticks, FALSE for drawing the grid
*/
- mpScaleY( wxString name = wxT("Y"), int flags = mpALIGN_CENTER, bool ticks = true );
+ mpScaleY( const wxString& name = wxT("Y"), int flags = mpALIGN_CENTER, bool ticks = true );
virtual bool IsHorizontal() override { return false; }
@@ -1544,7 +1544,7 @@ public:
/** @param name Label
* @param flags Label alignment, pass one of #mpALIGN_NE, #mpALIGN_NW, #mpALIGN_SW, #mpALIGN_SE.
*/
- mpFXYVector( wxString name = wxEmptyString, int flags = mpALIGN_NE );
+ mpFXYVector( const wxString& name = wxEmptyString, int flags = mpALIGN_NE );
virtual ~mpFXYVector() {}
@@ -1644,7 +1644,7 @@ public:
/** @param name text to be drawn in the plot
* @param offsetx holds offset for the X location in percentage (0-100)
* @param offsety holds offset for the Y location in percentage (0-100) */
- mpText( wxString name = wxT("Title"), int offsetx = 5, int offsety = 50 );
+ mpText( const wxString& name = wxT("Title"), int offsetx = 5, int offsety = 50 );
/** Text Layer plot handler.
* This implementation will plot text adjusted to the visible area. */
diff --git a/kicad/commandframe.cpp b/kicad/commandframe.cpp
index 89cb8934a..364c8f088 100644
--- a/kicad/commandframe.cpp
+++ b/kicad/commandframe.cpp
@@ -109,7 +109,7 @@ void LAUNCHER_PANEL::CreateCommandToolbar()
* @param aBitmap is the image to be used
* @param aToolTip is the button mouse-over tool tip
*/
-void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, wxString aToolTip )
+void LAUNCHER_PANEL::AddButton( wxWindowID aId, const wxBitmap& aBitmap, const wxString& aToolTip )
{
wxSize buttSize( aBitmap.GetWidth() + 2 * BUTTON_EXPANSION,
aBitmap.GetHeight() + 2 * BUTTON_EXPANSION );
diff --git a/kicad/kicad.h b/kicad/kicad.h
index 2455750dc..162024edd 100644
--- a/kicad/kicad.h
+++ b/kicad/kicad.h
@@ -333,7 +333,7 @@ private:
*/
void CreateCommandToolbar( void );
- void AddButton( wxWindowID aId, const wxBitmap& aBitmap, wxString aToolTip );
+ void AddButton( wxWindowID aId, const wxBitmap& aBitmap, const wxString& aToolTip );
};
// The C++ project manager includes a single PROJECT in its link image.
diff --git a/lib_dxf/drw_objects.cpp b/lib_dxf/drw_objects.cpp
index 128ab8d2d..6b63eeab3 100644
--- a/lib_dxf/drw_objects.cpp
+++ b/lib_dxf/drw_objects.cpp
@@ -11,6 +11,7 @@
******************************************************************************/
#include <iostream>
+#include <utility>
#include <math.h>
#include "drw_objects.h"
#include "intern/dxfreader.h"
@@ -731,7 +732,7 @@ void DRW_ImageDef::parseCode( int code, dxfReader* reader )
}
-void DRW_Header::addComment( std::string c )
+void DRW_Header::addComment( const std::string& c )
{
if( !comments.empty() )
comments += '\n';
@@ -1303,7 +1304,7 @@ void DRW_Header::write( dxfWriter* writer, DRW::Version ver )
}
-void DRW_Header::addDouble( std::string key, double value, int code )
+void DRW_Header::addDouble( const std::string& key, double value, int code )
{
curr = new DRW_Variant();
curr->addDouble( value );
@@ -1312,7 +1313,7 @@ void DRW_Header::addDouble( std::string key, double value, int code )
}
-void DRW_Header::addInt( std::string key, int value, int code )
+void DRW_Header::addInt( const std::string& key, int value, int code )
{
curr = new DRW_Variant();
curr->addInt( value );
@@ -1321,16 +1322,16 @@ void DRW_Header::addInt( std::string key, int value, int code )
}
-void DRW_Header::addStr( std::string key, std::string value, int code )
+void DRW_Header::addStr( const std::string& key, std::string value, int code )
{
curr = new DRW_Variant();
- curr->addString( value );
+ curr->addString( std::move(value) );
curr->code = code;
vars[key] = curr;
}
-void DRW_Header::addCoord( std::string key, DRW_Coord value, int code )
+void DRW_Header::addCoord( const std::string& key, DRW_Coord value, int code )
{
curr = new DRW_Variant();
curr->addCoord( value );
@@ -1339,7 +1340,7 @@ void DRW_Header::addCoord( std::string key, DRW_Coord value, int code )
}
-bool DRW_Header::getDouble( std::string key, double* varDouble )
+bool DRW_Header::getDouble( const std::string& key, double* varDouble )
{
bool result = false;
std::map<std::string, DRW_Variant*>::iterator it;
@@ -1363,7 +1364,7 @@ bool DRW_Header::getDouble( std::string key, double* varDouble )
}
-bool DRW_Header::getInt( std::string key, int* varInt )
+bool DRW_Header::getInt( const std::string& key, int* varInt )
{
bool result = false;
std::map<std::string, DRW_Variant*>::iterator it;
@@ -1387,7 +1388,7 @@ bool DRW_Header::getInt( std::string key, int* varInt )
}
-bool DRW_Header::getStr( std::string key, std::string* varStr )
+bool DRW_Header::getStr( const std::string& key, std::string* varStr )
{
bool result = false;
std::map<std::string, DRW_Variant*>::iterator it;
@@ -1411,7 +1412,7 @@ bool DRW_Header::getStr( std::string key, std::string* varStr )
}
-bool DRW_Header::getCoord( std::string key, DRW_Coord* varCoord )
+bool DRW_Header::getCoord( const std::string& key, DRW_Coord* varCoord )
{
bool result = false;
std::map<std::string, DRW_Variant*>::iterator it;
diff --git a/lib_dxf/drw_objects.h b/lib_dxf/drw_objects.h
index 46c9a3ca1..5de2d6181 100644
--- a/lib_dxf/drw_objects.h
+++ b/lib_dxf/drw_objects.h
@@ -426,22 +426,22 @@ public:
vars.clear();
}
- void addDouble( std::string key, double value, int code );
- void addInt( std::string key, int value, int code );
- void addStr( std::string key, std::string value, int code );
- void addCoord( std::string key, DRW_Coord value, int code );
+ void addDouble( const std::string& key, double value, int code );
+ void addInt( const std::string& key, int value, int code );
+ void addStr( const std::string& key, std::string value, int code );
+ void addCoord( const std::string& key, DRW_Coord value, int code );
std::string getComments() const { return comments; }
void parseCode( int code, dxfReader* reader );
void write( dxfWriter* writer, DRW::Version ver );
- void addComment( std::string c );
+ void addComment( const std::string& c );
private:
- bool getDouble( std::string key, double* varDouble );
- bool getInt( std::string key, int* varInt );
- bool getStr( std::string key, std::string* varStr );
- bool getCoord( std::string key, DRW_Coord* varStr );
+ bool getDouble( const std::string& key, double* varDouble );
+ bool getInt( const std::string& key, int* varInt );
+ bool getStr( const std::string& key, std::string* varStr );
+ bool getCoord( const std::string& key, DRW_Coord* varStr );
public:
std::map<std::string, DRW_Variant*> vars;
diff --git a/lib_dxf/intern/drw_textcodec.cpp b/lib_dxf/intern/drw_textcodec.cpp
index b640bc95a..fc587c3a1 100644
--- a/lib_dxf/intern/drw_textcodec.cpp
+++ b/lib_dxf/intern/drw_textcodec.cpp
@@ -235,7 +235,7 @@ std::string DRW_ConvTable::toUtf8( std::string* s )
}
-std::string DRW_Converter::encodeText( std::string stmp )
+std::string DRW_Converter::encodeText( const std::string& stmp )
{
int code;
diff --git a/lib_dxf/intern/drw_textcodec.h b/lib_dxf/intern/drw_textcodec.h
index d6a8977f6..530f72aae 100644
--- a/lib_dxf/intern/drw_textcodec.h
+++ b/lib_dxf/intern/drw_textcodec.h
@@ -43,7 +43,7 @@ public:
virtual ~DRW_Converter() {}
virtual std::string fromUtf8( std::string* s ) { return *s; }
virtual std::string toUtf8( std::string* s );
- std::string encodeText( std::string stmp );
+ std::string encodeText( const std::string& stmp );
std::string decodeText( int c );
std::string encodeNum( int c );
int decodeNum( std::string s, int* b );
diff --git a/lib_dxf/intern/dxfwriter.cpp b/lib_dxf/intern/dxfwriter.cpp
index fcd9fe7ce..112f8243e 100644
--- a/lib_dxf/intern/dxfwriter.cpp
+++ b/lib_dxf/intern/dxfwriter.cpp
@@ -14,6 +14,7 @@
#include <fstream>
#include <string>
#include <algorithm>
+#include <utility>
#include "dxfwriter.h"
#ifdef DRW_DBG
@@ -100,7 +101,7 @@
bool dxfWriter::writeUtf8String( int code, std::string text )
{
- std::string t = encoder.fromUtf8( text );
+ std::string t = encoder.fromUtf8( std::move(text) );
return writeString( code, t );
}
@@ -108,7 +109,7 @@ bool dxfWriter::writeUtf8String( int code, std::string text )
bool dxfWriter::writeUtf8Caps( int code, std::string text )
{
- std::string strname = text;
+ std::string strname = std::move(text);
std::transform( strname.begin(), strname.end(), strname.begin(), ::toupper );
std::string t = encoder.fromUtf8( strname );
diff --git a/lib_dxf/libdxfrw.cpp b/lib_dxf/libdxfrw.cpp
index adc8b61a1..3a0da7d27 100644
--- a/lib_dxf/libdxfrw.cpp
+++ b/lib_dxf/libdxfrw.cpp
@@ -1685,7 +1685,7 @@ bool dxfRW::writeViewport( DRW_Viewport* ent )
}
-DRW_ImageDef* dxfRW::writeImage( DRW_Image* ent, std::string name )
+DRW_ImageDef* dxfRW::writeImage( DRW_Image* ent, const std::string& name )
{
if( version > DRW::AC1009 )
{
@@ -1741,7 +1741,7 @@ DRW_ImageDef* dxfRW::writeImage( DRW_Image* ent, std::string name )
}
-bool dxfRW::writeBlockRecord( std::string name )
+bool dxfRW::writeBlockRecord( const std::string& name )
{
if( version > DRW::AC1009 )
{
diff --git a/lib_dxf/libdxfrw.h b/lib_dxf/libdxfrw.h
index c37dcb2f3..e9e5d47c4 100644
--- a/lib_dxf/libdxfrw.h
+++ b/lib_dxf/libdxfrw.h
@@ -59,14 +59,14 @@ public:
bool writeLWPolyline( DRW_LWPolyline* ent );
bool writePolyline( DRW_Polyline* ent );
bool writeSpline( DRW_Spline* ent );
- bool writeBlockRecord( std::string name );
+ bool writeBlockRecord( const std::string& name );
bool writeBlock( DRW_Block* ent );
bool writeInsert( DRW_Insert* ent );
bool writeMText( DRW_MText* ent );
bool writeText( DRW_Text* ent );
bool writeHatch( DRW_Hatch* ent );
bool writeViewport( DRW_Viewport* ent );
- DRW_ImageDef* writeImage( DRW_Image* ent, std::string name );
+ DRW_ImageDef* writeImage( DRW_Image* ent, const std::string& name );
bool writeLeader( DRW_Leader* ent );
bool writeDimension( DRW_Dimension* ent );
diff --git a/pcb_calculator/datafile_read_write.cpp b/pcb_calculator/datafile_read_write.cpp
index 349dd411d..f8f367ed3 100644
--- a/pcb_calculator/datafile_read_write.cpp
+++ b/pcb_calculator/datafile_read_write.cpp
@@ -177,7 +177,7 @@ PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( LINE_READER* aRe
}
-PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( char* aLine, wxString aSource ) :
+PCB_CALCULATOR_DATAFILE_PARSER::PCB_CALCULATOR_DATAFILE_PARSER( char* aLine, const wxString& aSource ) :
PCB_CALCULATOR_DATAFILE_LEXER( aLine, aSource )
{
}
diff --git a/pcb_calculator/datafile_read_write.h b/pcb_calculator/datafile_read_write.h
index ecf303d63..1b05e5247 100644
--- a/pcb_calculator/datafile_read_write.h
+++ b/pcb_calculator/datafile_read_write.h
@@ -56,7 +56,7 @@ class PCB_CALCULATOR_DATAFILE_PARSER : public PCB_CALCULATOR_DATAFILE_LEXER
{
public:
PCB_CALCULATOR_DATAFILE_PARSER( LINE_READER* aReader );
- PCB_CALCULATOR_DATAFILE_PARSER( char* aLine, wxString aSource );
+ PCB_CALCULATOR_DATAFILE_PARSER( char* aLine, const wxString& aSource );
LINE_READER* GetReader() { return reader; };
void Parse( PCB_CALCULATOR_DATAFILE* aDataList );
void ParseRegulatorDescr( PCB_CALCULATOR_DATAFILE* aDataList );
diff --git a/pcbnew/class_action_plugin.cpp b/pcbnew/class_action_plugin.cpp
index 171e0f2a6..50a05885f 100644
--- a/pcbnew/class_action_plugin.cpp
+++ b/pcbnew/class_action_plugin.cpp
@@ -76,7 +76,7 @@ int ACTION_PLUGINS::GetActionMenu( int aIndex )
}
-ACTION_PLUGIN* ACTION_PLUGINS::GetAction( wxString aName )
+ACTION_PLUGIN* ACTION_PLUGINS::GetAction( const wxString& aName )
{
int max = GetActionsCount();
diff --git a/pcbnew/class_action_plugin.h b/pcbnew/class_action_plugin.h
index 885310752..2d3eeffd2 100644
--- a/pcbnew/class_action_plugin.h
+++ b/pcbnew/class_action_plugin.h
@@ -127,7 +127,7 @@ public:
* @param aName is the action plugin name
* @return a action object by it's name or NULL if it isn't available.
*/
- static ACTION_PLUGIN* GetAction( wxString aName );
+ static ACTION_PLUGIN* GetAction( const wxString& aName );
/**
* Function SetActionMenu
diff --git a/pcbnew/class_board_item.cpp b/pcbnew/class_board_item.cpp
index 6cacf21f5..530093682 100644
--- a/pcbnew/class_board_item.cpp
+++ b/pcbnew/class_board_item.cpp
@@ -197,7 +197,7 @@ void BOARD_ITEM::ViewGetLayers( int aLayers[], int& aCount ) const
}
-int BOARD_ITEM::getTrailingInt( wxString aStr )
+int BOARD_ITEM::getTrailingInt( const wxString& aStr )
{
int number = 0;
int base = 1;
diff --git a/pcbnew/class_footprint_wizard.cpp b/pcbnew/class_footprint_wizard.cpp
index 473007e4d..6787bc25e 100644
--- a/pcbnew/class_footprint_wizard.cpp
+++ b/pcbnew/class_footprint_wizard.cpp
@@ -50,7 +50,7 @@ FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( int aIndex )
}
-FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( wxString aName )
+FOOTPRINT_WIZARD* FOOTPRINT_WIZARDS::GetWizard( const wxString& aName )
{
int max = GetWizardsCount();
diff --git a/pcbnew/class_footprint_wizard.h b/pcbnew/class_footprint_wizard.h
index 69c286ae1..ef82f9228 100644
--- a/pcbnew/class_footprint_wizard.h
+++ b/pcbnew/class_footprint_wizard.h
@@ -204,7 +204,7 @@ public:
* @param aName is the footprint wizard name
* @return a wizard object by it's name or NULL if it isn't available.
*/
- static FOOTPRINT_WIZARD* GetWizard( wxString aName );
+ static FOOTPRINT_WIZARD* GetWizard( const wxString& aName );
/**
* Function GetWizard
diff --git a/pcbnew/class_module.cpp b/pcbnew/class_module.cpp
index a23ef28a9..d8f18ee52 100644
--- a/pcbnew/class_module.cpp
+++ b/pcbnew/class_module.cpp
@@ -850,7 +850,7 @@ EDA_ITEM* MODULE::Clone() const
}
-void MODULE::RunOnChildren( std::function<void (BOARD_ITEM*)> aFunction )
+void MODULE::RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction )
{
try
{
diff --git a/pcbnew/class_module.h b/pcbnew/class_module.h
index 79431d458..9b1714af0 100644
--- a/pcbnew/class_module.h
+++ b/pcbnew/class_module.h
@@ -569,7 +569,7 @@ public:
* Invokes a function on all BOARD_ITEMs that belong to the module (pads, drawings, texts).
* @param aFunction is the function to be invoked.
*/
- void RunOnChildren( std::function<void (BOARD_ITEM*)> aFunction );
+ void RunOnChildren( const std::function<void (BOARD_ITEM*)>& aFunction );
virtual void ViewGetLayers( int aLayers[], int& aCount ) const override;
diff --git a/pcbnew/class_netclass.cpp b/pcbnew/class_netclass.cpp
index 2a4f45663..acacc6b56 100644
--- a/pcbnew/class_netclass.cpp
+++ b/pcbnew/class_netclass.cpp
@@ -95,7 +95,7 @@ NETCLASSES::~NETCLASSES()
}
-bool NETCLASSES::Add( NETCLASSPTR aNetClass )
+bool NETCLASSES::Add( const NETCLASSPTR& aNetClass )
{
const wxString& name = aNetClass->GetName();
diff --git a/pcbnew/class_netclass.h b/pcbnew/class_netclass.h
index 7d35bd13b..cefdf55c7 100644
--- a/pcbnew/class_netclass.h
+++ b/pcbnew/class_netclass.h
@@ -284,7 +284,7 @@ public:
* @return true if the name within aNetclass is unique and it could be inserted OK,
* else false because the name was not unique.
*/
- bool Add( NETCLASSPTR aNetclass );
+ bool Add( const NETCLASSPTR& aNetclass );
/**
* Function Remove
diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h
index 3ed89459c..3360f1d45 100644
--- a/pcbnew/class_netinfo.h
+++ b/pcbnew/class_netinfo.h
@@ -117,7 +117,7 @@ public:
* Function SetClass
* sets \a aNetclass into this NET
*/
- void SetClass( NETCLASSPTR aNetClass );
+ void SetClass( const NETCLASSPTR& aNetClass );
NETCLASSPTR GetNetClass()
{
diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp
index 93ee60c29..5c9ec0a5f 100644
--- a/pcbnew/class_netinfo_item.cpp
+++ b/pcbnew/class_netinfo_item.cpp
@@ -78,7 +78,7 @@ void NETINFO_ITEM::Draw( EDA_DRAW_PANEL* panel,
}
-void NETINFO_ITEM::SetClass( NETCLASSPTR aNetClass )
+void NETINFO_ITEM::SetClass( const NETCLASSPTR& aNetClass )
{
wxCHECK( m_parent, /* void */ );
m_NetClass = aNetClass ? aNetClass : m_parent->GetDesignSettings().m_NetClasses.GetDefault();
diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp
index 05c34ea94..85eba519a 100644
--- a/pcbnew/clean.cpp
+++ b/pcbnew/clean.cpp
@@ -611,7 +611,7 @@ static bool parallelismTest( int dx1, int dy1, int dx2, int dy2 )
* else return NULL
*/
-static void updateConn( TRACK *track, std::shared_ptr<CONNECTIVITY_DATA> connectivity )
+static void updateConn( TRACK *track, const std::shared_ptr<CONNECTIVITY_DATA>& connectivity )
{
for( auto pad : connectivity->GetConnectedPads( track ) )
{
diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp
index 608615957..456dacead 100644
--- a/pcbnew/connectivity_algo.cpp
+++ b/pcbnew/connectivity_algo.cpp
@@ -30,7 +30,7 @@
using namespace std::placeholders;
-bool operator<( const CN_ANCHOR_PTR a, const CN_ANCHOR_PTR b )
+bool operator<( const CN_ANCHOR_PTR& a, const CN_ANCHOR_PTR& b )
{
if( a->Pos().x == b->Pos().x )
return a->Pos().y < b->Pos().y;
@@ -948,7 +948,7 @@ void CN_CONNECTIVITY_ALGO::Clear()
}
-void CN_CONNECTIVITY_ALGO::ForEachItem( std::function<void(CN_ITEM*)> aFunc )
+void CN_CONNECTIVITY_ALGO::ForEachItem( const std::function<void(CN_ITEM*)>& aFunc )
{
for( auto item : m_padList )
aFunc( item );
@@ -964,7 +964,7 @@ void CN_CONNECTIVITY_ALGO::ForEachItem( std::function<void(CN_ITEM*)> aFunc )
}
-void CN_CONNECTIVITY_ALGO::ForEachAnchor( std::function<void(CN_ANCHOR_PTR)> aFunc )
+void CN_CONNECTIVITY_ALGO::ForEachAnchor( const std::function<void(CN_ANCHOR_PTR)>& aFunc )
{
for( auto anchor : m_padList.Anchors() )
aFunc( anchor );
diff --git a/pcbnew/connectivity_algo.h b/pcbnew/connectivity_algo.h
index 38e7b5afb..eb1749410 100644
--- a/pcbnew/connectivity_algo.h
+++ b/pcbnew/connectivity_algo.h
@@ -885,13 +885,13 @@ public:
CN_PAD_LIST& PadList() { return m_padList; }
- void ForEachAnchor( std::function<void(CN_ANCHOR_PTR)> aFunc );
- void ForEachItem( std::function<void(CN_ITEM*)> aFunc );
+ void ForEachAnchor( const std::function<void(CN_ANCHOR_PTR)>& aFunc );
+ void ForEachItem( const std::function<void(CN_ITEM*)>& aFunc );
void MarkNetAsDirty( int aNet );
};
-bool operator<( const CN_ANCHOR_PTR a, const CN_ANCHOR_PTR b );
+bool operator<( const CN_ANCHOR_PTR& a, const CN_ANCHOR_PTR& b );
#endif
diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp
index 0110279ed..92684cc68 100644
--- a/pcbnew/dialogs/dialog_create_array.cpp
+++ b/pcbnew/dialogs/dialog_create_array.cpp
@@ -264,7 +264,7 @@ static bool validateNumberingTypeAndOffset( const wxTextCtrl& offsetEntry,
*/
static bool validateLongEntry( const wxTextEntry& entry,
long& dest,
- const wxString description,
+ const wxString& description,
wxArrayString& errors )
{
bool ok = true;
diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp
index 64f5d8f8a..d05f91ff5 100644
--- a/pcbnew/dialogs/dialog_design_rules.cpp
+++ b/pcbnew/dialogs/dialog_design_rules.cpp
@@ -473,7 +473,7 @@ void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes()
/* Initialize the rules list from board
*/
-static void class2gridRow( wxGrid* grid, int row, NETCLASSPTR nc )
+static void class2gridRow( wxGrid* grid, int row, const NETCLASSPTR& nc )
{
wxString msg;
@@ -532,7 +532,7 @@ void DIALOG_DESIGN_RULES::InitRulesList()
}
-static void gridRow2class( wxGrid* grid, int row, NETCLASSPTR nc )
+static void gridRow2class( wxGrid* grid, int row, const NETCLASSPTR& nc )
{
#define MYCELL( col ) \
ValueFromString( g_UserUnit, grid->GetCellValue( row, col ) )
diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp
index 6213be96a..a928f1b6c 100644
--- a/pcbnew/drc.cpp
+++ b/pcbnew/drc.cpp
@@ -336,7 +336,7 @@ void DRC::updatePointers()
}
-bool DRC::doNetClass( NETCLASSPTR nc, wxString& msg )
+bool DRC::doNetClass( const NETCLASSPTR& nc, wxString& msg )
{
bool ret = true;
diff --git a/pcbnew/drc_stuff.h b/pcbnew/drc_stuff.h
index e0f55c2c6..effbcb9e6 100644
--- a/pcbnew/drc_stuff.h
+++ b/pcbnew/drc_stuff.h
@@ -305,7 +305,7 @@ private:
//-----<single "item" tests>-----------------------------------------
- bool doNetClass( std::shared_ptr<NETCLASS> aNetClass, wxString& msg );
+ bool doNetClass( const std::shared_ptr<NETCLASS>& aNetClass, wxString& msg );
/**
* Function doPadToPadsDrc
diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp
index db2d3788a..2eb4a9a7c 100644
--- a/pcbnew/footprint_info_impl.cpp
+++ b/pcbnew/footprint_info_impl.cpp
@@ -66,7 +66,7 @@ void FOOTPRINT_INFO_IMPL::load()
}
-bool FOOTPRINT_LIST_IMPL::CatchErrors( std::function<void()> aFunc )
+bool FOOTPRINT_LIST_IMPL::CatchErrors( const std::function<void()>& aFunc )
{
try
{
diff --git a/pcbnew/footprint_info_impl.h b/pcbnew/footprint_info_impl.h
index a2ec466b4..c18a18a54 100644
--- a/pcbnew/footprint_info_impl.h
+++ b/pcbnew/footprint_info_impl.h
@@ -69,7 +69,7 @@ class FOOTPRINT_LIST_IMPL : public FOOTPRINT_LIST
*
* @return true if no error occurred.
*/
- bool CatchErrors( std::function<void()> aFunc );
+ bool CatchErrors( const std::function<void()>& aFunc );
protected:
virtual void StartWorkers( FP_LIB_TABLE* aTable, wxString const* aNickname,
diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp
index 753e7be4c..05d5c2d38 100644
--- a/pcbnew/footprint_preview_panel.cpp
+++ b/pcbnew/footprint_preview_panel.cpp
@@ -32,6 +32,7 @@
#include <ki_mutex.h>
#include <boost/bind.hpp>
+#include <utility>
#include <make_unique.h>
#include <class_colors_design_settings.h>
@@ -103,7 +104,7 @@ class FP_THREAD_IFACE
void SetCurrentFootprint( LIB_ID aFp )
{
MUTLOCK lock( m_lock );
- m_current_fp = aFp;
+ m_current_fp = std::move(aFp);
}
/**
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp
index 31ebf5de1..398ec2c73 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp
@@ -102,7 +102,7 @@ XNODE* FindPinMap( XNODE* aNode )
}
-double StrToDoublePrecisionUnits( wxString aStr, char aAxe, wxString aActualConversion )
+double StrToDoublePrecisionUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion )
{
wxString ls;
double i;
@@ -161,13 +161,13 @@ double StrToDoublePrecisionUnits( wxString aStr, char aAxe, wxString aActualConv
}
-int StrToIntUnits( wxString aStr, char aAxe, wxString aActualConversion )
+int StrToIntUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion )
{
return KiROUND( StrToDoublePrecisionUnits( aStr, aAxe, aActualConversion ) );
}
-wxString GetAndCutWordWithMeasureUnits( wxString* aStr, wxString aDefaultMeasurementUnit )
+wxString GetAndCutWordWithMeasureUnits( wxString* aStr, const wxString& aDefaultMeasurementUnit )
{
wxString result;
@@ -206,7 +206,7 @@ wxString GetAndCutWordWithMeasureUnits( wxString* aStr, wxString aDefaultMeasure
}
-int StrToInt1Units( wxString aStr )
+int StrToInt1Units( const wxString& aStr )
{
double num, precision = 10;
@@ -226,9 +226,9 @@ wxString ValidateName( wxString aName )
void SetWidth( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
int* aWidth,
- wxString aActualConversion )
+ const wxString& aActualConversion )
{
*aWidth = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( ' ' ),
@@ -237,9 +237,9 @@ void SetWidth( wxString aStr,
void SetHeight( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
int* aHeight,
- wxString aActualConversion )
+ const wxString& aActualConversion )
{
*aHeight = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( ' ' ),
@@ -248,10 +248,10 @@ void SetHeight( wxString aStr,
void SetPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
int* aX,
int* aY,
- wxString aActualConversion )
+ const wxString& aActualConversion )
{
*aX = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( 'X' ),
@@ -263,10 +263,10 @@ void SetPosition( wxString aStr,
void SetDoublePrecisionPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
double* aX,
double* aY,
- wxString aActualConversion )
+ const wxString& aActualConversion )
{
*aX = StrToDoublePrecisionUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( 'X' ),
@@ -276,7 +276,7 @@ void SetDoublePrecisionPosition( wxString aStr,
aActualConversion );
}
-TTEXT_JUSTIFY GetJustifyIdentificator( wxString aJustify )
+TTEXT_JUSTIFY GetJustifyIdentificator( const wxString& aJustify )
{
TTEXT_JUSTIFY id;
@@ -304,8 +304,8 @@ TTEXT_JUSTIFY GetJustifyIdentificator( wxString aJustify )
void SetTextParameters( XNODE* aNode,
TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* tNode;
wxString str;
@@ -352,8 +352,8 @@ void SetTextParameters( XNODE* aNode,
void SetFontProperty( XNODE* aNode,
TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
wxString n, propValue;
@@ -556,7 +556,7 @@ void SetTextSizeFromStrokeFontHeight( EDA_TEXT* aText, int aTextHeight )
}
-XNODE* FindNode( XNODE* aChild, wxString aTag )
+XNODE* FindNode( XNODE* aChild, const wxString& aTag )
{
aChild = aChild->GetChildren();
@@ -571,7 +571,7 @@ XNODE* FindNode( XNODE* aChild, wxString aTag )
return NULL;
}
-wxString FindNodeGetContent( XNODE* aChild, wxString aTag )
+wxString FindNodeGetContent( XNODE* aChild, const wxString& aTag )
{
wxString str = wxEmptyString;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h
index 5d5a8127f..96296eb1d 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h
@@ -66,42 +66,42 @@ typedef struct _TTEXTVALUE
extern wxString GetWord( wxString* aStr );
extern XNODE* FindPinMap( XNODE* aNode );
-extern int StrToIntUnits( wxString aStr, char aAxe, wxString aActualConversion );
+extern int StrToIntUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion );
extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
- wxString aDefaultMeasurementUnit );
-extern int StrToInt1Units( wxString aStr );
+ const wxString& aDefaultMeasurementUnit );
+extern int StrToInt1Units( const wxString& aStr );
extern wxString ValidateName( wxString aName );
extern void SetWidth( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
int* aWidth,
- wxString aActualConversion );
+ const wxString& aActualConversion );
extern void SetPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
int* aX,
int* aY,
- wxString aActualConversion );
+ const wxString& aActualConversion );
extern void SetDoublePrecisionPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
+ const wxString& aDefaultMeasurementUnit,
double* aX,
double* aY,
- wxString aActualConversion );
-extern TTEXT_JUSTIFY GetJustifyIdentificator( wxString aJustify );
+ const wxString& aActualConversion );
+extern TTEXT_JUSTIFY GetJustifyIdentificator( const wxString& aJustify );
extern void SetTextParameters( XNODE* aNode,
TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
extern void SetFontProperty( XNODE* aNode,
TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
extern void SetTextJustify( EDA_TEXT* aText, TTEXT_JUSTIFY aJustify );
extern int CalculateTextLengthSize( TTEXTVALUE* aText );
extern void CorrectTextPosition( TTEXTVALUE* aValue );
extern void SetTextSizeFromStrokeFontHeight( EDA_TEXT* aText,
int aTextHeight );
-extern XNODE* FindNode( XNODE* aChild, wxString aTag );
-extern wxString FindNodeGetContent( XNODE* aChild, wxString aTag );
+extern XNODE* FindNode( XNODE* aChild, const wxString& aTag );
+extern wxString FindNodeGetContent( XNODE* aChild, const wxString& aTag );
extern void InitTTextValue( TTEXTVALUE* aTextValue );
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp
index 67a360899..390f6b06b 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb.cpp
@@ -133,7 +133,7 @@ int PCB::GetNetCode( wxString aNetName )
return 0;
}
-XNODE* PCB::FindCompDefName( XNODE* aNode, wxString aName )
+XNODE* PCB::FindCompDefName( XNODE* aNode, const wxString& aName )
{
XNODE* result = NULL, * lNode;
wxString propValue;
@@ -162,8 +162,8 @@ XNODE* PCB::FindCompDefName( XNODE* aNode, wxString aName )
void PCB::SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue,
- wxString aPatGraphRefName, wxString aXmlName,
- wxString aActualConversion )
+ const wxString& aPatGraphRefName, const wxString& aXmlName,
+ const wxString& aActualConversion )
{
XNODE* tNode, * t1Node;
wxString n, nnew, pn, propValue, str;
@@ -233,7 +233,7 @@ void PCB::SetTextProperty( XNODE* aNode, TTEXTVALUE* aTextValue,
void PCB::DoPCBComponents( XNODE* aNode,
wxXmlDocument* aXmlDoc,
- wxString aActualConversion,
+ const wxString& aActualConversion,
wxStatusBar* aStatusBar )
{
XNODE* lNode, * tNode, * mNode;
@@ -420,7 +420,7 @@ void PCB::DoPCBComponents( XNODE* aNode,
}
-void PCB::ConnectPinToNet( wxString aCompRef, wxString aPinRef, wxString aNetName )
+void PCB::ConnectPinToNet( const wxString& aCompRef, const wxString& aPinRef, const wxString& aNetName )
{
PCB_MODULE* module;
PCB_PAD* cp;
@@ -447,7 +447,7 @@ void PCB::ConnectPinToNet( wxString aCompRef, wxString aPinRef, wxString aNetNam
}
-int PCB::FindLayer( wxString aLayerName )
+int PCB::FindLayer( const wxString& aLayerName )
{
for( LAYER_NUM i = 0; i < (int)m_layersStackup.GetCount(); ++i )
{
@@ -575,7 +575,7 @@ double PCB::GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 )
( aPoint1->y - aPoint2->y ) );
}
-void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion )
+void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion )
{
XNODE* iNode, *lNode, *pNode;
long PCadLayer = 0;
@@ -666,7 +666,7 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion )
}
}
-void PCB::Parse( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, wxString aActualConversion )
+void PCB::Parse( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, const wxString& aActualConversion )
{
XNODE* aNode;//, *aaNode;
PCB_NET* net;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb.h b/pcbnew/pcad2kicadpcb_plugin/pcb.h
index 97f6f98ad..d000ff72b 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb.h
@@ -61,7 +61,7 @@ public:
void Parse( wxStatusBar* aStatusBar,
wxXmlDocument* aXmlDoc,
- wxString aActualConversion );
+ const wxString& aActualConversion );
void AddToBoard() override;
@@ -69,22 +69,22 @@ private:
int m_timestamp_cnt;
wxArrayString m_layersStackup;
- XNODE* FindCompDefName( XNODE* aNode, wxString aName );
+ XNODE* FindCompDefName( XNODE* aNode, const wxString& aName );
void SetTextProperty( XNODE* aNode,
TTEXTVALUE* aTextValue,
- wxString aPatGraphRefName,
- wxString aXmlName,
- wxString aActualConversion );
+ const wxString& aPatGraphRefName,
+ const wxString& aXmlName,
+ const wxString& aActualConversion );
void DoPCBComponents( XNODE* aNode,
wxXmlDocument* aXmlDoc,
- wxString aActualConversion,
+ const wxString& aActualConversion,
wxStatusBar* aStatusBar );
- void ConnectPinToNet( wxString aCr, wxString aPr, wxString aNetName );
- int FindLayer( wxString aLayerName );
+ void ConnectPinToNet( const wxString& aCr, const wxString& aPr, const wxString& aNetName );
+ int FindLayer( const wxString& aLayerName );
void MapLayer( XNODE* aNode );
int FindOutlinePoint( VERTICES_ARRAY* aOutline, wxRealPoint aPoint );
double GetDistance( wxRealPoint* aPoint1, wxRealPoint* aPoint2 );
- void GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion );
+ void GetBoardOutline( wxXmlDocument* aXmlDoc, const wxString& aActualConversion );
};
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
index be3304ac0..5d8dae8d8 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
@@ -68,7 +68,7 @@ PCB_MODULE::~PCB_MODULE()
}
-XNODE* PCB_MODULE::FindModulePatternDefName( XNODE* aNode, wxString aName )
+XNODE* PCB_MODULE::FindModulePatternDefName( XNODE* aNode, const wxString& aName )
{
XNODE* result, * lNode;
wxString propValue1, propValue2;
@@ -218,8 +218,8 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
PCB_MODULE* aPCBModule,
PCB_COMPONENTS_ARRAY* aList,
wxStatusBar* aStatusBar,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
PCB_ARC* arc;
PCB_POLYGON* polygon;
@@ -372,7 +372,7 @@ void PCB_MODULE::DoLayerContentsObjects( XNODE* aNode,
}
-void PCB_MODULE::SetName( wxString aPin, wxString aName )
+void PCB_MODULE::SetName( const wxString& aPin, const wxString& aName )
{
int i;
long num;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
index 356e36b32..0bb42cc08 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
@@ -48,16 +48,16 @@ public:
PCB_MODULE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_MODULE();
- XNODE* FindModulePatternDefName( XNODE* aNode, wxString aName );
+ XNODE* FindModulePatternDefName( XNODE* aNode, const wxString& aName );
void DoLayerContentsObjects( XNODE* aNode,
PCB_MODULE* aPCBModule,
PCB_COMPONENTS_ARRAY* aList,
wxStatusBar* aStatusBar,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
- void SetName( wxString aPin, wxString aName );
+ void SetName( const wxString& aPin, const wxString& aName );
virtual void Parse( XNODE* aNode, wxStatusBar* aStatusBar,
wxString aDefaultMeasurementUnit, wxString aActualConversion );
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp
index 9a5f2530b..a3973c427 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp
@@ -79,7 +79,7 @@ PCB_POLYGON::~PCB_POLYGON()
}
}
-void PCB_POLYGON::AssignNet( wxString aNetName )
+void PCB_POLYGON::AssignNet( const wxString& aNetName )
{
m_net = aNetName;
m_netCode = GetNetCode( m_net );
@@ -102,7 +102,7 @@ void PCB_POLYGON::SetOutline( VERTICES_ARRAY* aOutline )
}
void PCB_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
- wxString aDefaultMeasurementUnit, wxString aActualConversion )
+ const wxString& aDefaultMeasurementUnit, const wxString& aActualConversion )
{
XNODE* lNode;
double x, y;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h
index a37be8fc5..80bb73f2d 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h
@@ -61,11 +61,11 @@ public:
void AddToBoard() override;
// protected:
- void AssignNet( wxString aNetName );
+ void AssignNet( const wxString& aNetName );
void SetOutline( VERTICES_ARRAY* aOutline );
void FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
- wxString aDefaultMeasurementUnit, wxString actualConversion );
+ const wxString& aDefaultMeasurementUnit, const wxString& actualConversion );
protected:
bool m_filled;
};
diff --git a/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp b/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp
index 19ec21db8..74625ba33 100644
--- a/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.cpp
@@ -26,9 +26,10 @@
* @file s_expr_loader.cpp
*/
+#include <s_expr_loader.h>
+
#include <dsnlexer.h>
#include <macros.h>
-#include <wx/xml/xml.h>
#include <xnode.h>
namespace PCAD2KICAD {
@@ -36,7 +37,7 @@ namespace PCAD2KICAD {
static KEYWORD empty_keywords[1] = {};
static const char ACCEL_ASCII_KEYWORD[] = "ACCEL_ASCII";
-void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc )
+void LoadInputFile( const wxString& aFileName, wxXmlDocument* aXmlDoc )
{
char line[sizeof( ACCEL_ASCII_KEYWORD )];
int tok;
diff --git a/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.h b/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.h
index 02c1857a0..6076802f0 100644
--- a/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.h
+++ b/pcbnew/pcad2kicadpcb_plugin/s_expr_loader.h
@@ -29,9 +29,12 @@
#ifndef S_EXPR_LOADER_H_
#define S_EXPR_LOADER_H_
+#include <wx/wx.h>
+#include <wx/xml/xml.h>
+
namespace PCAD2KICAD
{
- void LoadInputFile( wxString aFileName, wxXmlDocument* aXmlDoc );
+ void LoadInputFile( const wxString& aFileName, wxXmlDocument* aXmlDoc );
}
#endif // S_EXPR_LOADER_H_
diff --git a/pcbnew/ratsnest_viewitem.cpp b/pcbnew/ratsnest_viewitem.cpp
index eeb722460..84df786c4 100644
--- a/pcbnew/ratsnest_viewitem.cpp
+++ b/pcbnew/ratsnest_viewitem.cpp
@@ -35,13 +35,14 @@
#include <layers_id_colors_and_visibility.h>
#include <memory>
+#include <utility>
#include <view/view.h>
namespace KIGFX {
RATSNEST_VIEWITEM::RATSNEST_VIEWITEM( std::shared_ptr<CONNECTIVITY_DATA> aData ) :
- EDA_ITEM( NOT_USED ), m_data( aData )
+ EDA_ITEM( NOT_USED ), m_data( std::move(aData) )
{
}
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 60889072f..26b4d301a 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -423,7 +423,7 @@ static VECTOR2I makeGapVector( VECTOR2I dir, int length )
return rv;
}
-void DP_GATEWAYS::BuildFromPrimitivePair( DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal )
+void DP_GATEWAYS::BuildFromPrimitivePair( const DP_PRIMITIVE_PAIR& aPair, bool aPreferDiagonal )
{
VECTOR2I majorDirection;
VECTOR2I p0_p, p0_n;
@@ -587,7 +587,7 @@ void DP_GATEWAYS::buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n )
}
-void DP_GATEWAYS::buildDpContinuation( DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal )
+void DP_GATEWAYS::buildDpContinuation( const DP_PRIMITIVE_PAIR& aPair, bool aIsDiagonal )
{
DP_GATEWAY gw( aPair.AnchorP(), aPair.AnchorN(), aIsDiagonal );
gw.SetPriority( 100 );
diff --git a/pcbnew/router/pns_diff_pair.h b/pcbnew/router/pns_diff_pair.h
index be074ffc1..25a288e7e 100644
--- a/pcbnew/router/pns_diff_pair.h
+++ b/pcbnew/router/pns_diff_pair.h
@@ -219,7 +219,7 @@ class DP_GATEWAYS
void BuildForCursor( const VECTOR2I& aCursorPos );
void BuildOrthoProjections( DP_GATEWAYS &aEntries, const VECTOR2I& aCursorPos, int aOrthoScore );
void BuildGeneric( const VECTOR2I& p0_p, const VECTOR2I& p0_n, bool aBuildEntries = false, bool aViaMode = false );
- void BuildFromPrimitivePair( DP_PRIMITIVE_PAIR aPair, bool aPreferDiagonal );
+ void BuildFromPrimitivePair( const DP_PRIMITIVE_PAIR& aPair, bool aPreferDiagonal );
bool FitGateways( DP_GATEWAYS& aEntry, DP_GATEWAYS& aTarget, bool aPrefDiagonal, DIFF_PAIR& aDp );
@@ -244,7 +244,7 @@ class DP_GATEWAYS
};
bool checkDiagonalAlignment( const VECTOR2I& a, const VECTOR2I& b ) const;
- void buildDpContinuation( DP_PRIMITIVE_PAIR aPair, bool aIsDiagonal );
+ void buildDpContinuation( const DP_PRIMITIVE_PAIR& aPair, bool aIsDiagonal );
void buildEntries( const VECTOR2I& p0_p, const VECTOR2I& p0_n );
int m_gap;
diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp
index e0be21219..dcb322061 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -83,7 +83,7 @@ private:
};
int localPadClearance( const PNS::ITEM* aItem ) const;
- int matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName );
+ int matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName );
PNS::ROUTER* m_router;
BOARD* m_board;
@@ -224,7 +224,7 @@ void PNS_PCBNEW_RULE_RESOLVER::OverrideClearance( bool aEnable, int aNetA, int a
}
-int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( wxString aNetName, wxString& aComplementNet, wxString& aBaseDpName )
+int PNS_PCBNEW_RULE_RESOLVER::matchDpSuffix( const wxString& aNetName, wxString& aComplementNet, wxString& aBaseDpName )
{
int rv = 0;
diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp
index 161b800fd..39611c8f4 100644
--- a/pcbnew/router/pns_logger.cpp
+++ b/pcbnew/router/pns_logger.cpp
@@ -72,7 +72,7 @@ void LOGGER::EndGroup()
}
-void LOGGER::Log ( const ITEM* aItem, int aKind, const std::string aName )
+void LOGGER::Log ( const ITEM* aItem, int aKind, const std::string& aName )
{
m_theLog << "item " << aKind << " " << aName << " ";
m_theLog << aItem->Net() << " " << aItem->Layers().Start() << " " <<
@@ -122,7 +122,7 @@ void LOGGER::Log ( const ITEM* aItem, int aKind, const std::string aName )
}
-void LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName )
+void LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string& aName )
{
m_theLog << "item " << aKind << " " << aName << " ";
m_theLog << 0 << " " << 0 << " " << 0 << " " << 0 << " " << 0;
@@ -134,7 +134,7 @@ void LOGGER::Log( const SHAPE_LINE_CHAIN *aL, int aKind, const std::string aName
void LOGGER::Log( const VECTOR2I& aStart, const VECTOR2I& aEnd,
- int aKind, const std::string aName)
+ int aKind, const std::string& aName)
{
}
diff --git a/pcbnew/router/pns_logger.h b/pcbnew/router/pns_logger.h
index bcc9c91d0..f9c3c410f 100644
--- a/pcbnew/router/pns_logger.h
+++ b/pcbnew/router/pns_logger.h
@@ -48,10 +48,10 @@ public:
void NewGroup( const std::string& aName, int aIter = 0 );
void EndGroup();
- void Log( const ITEM* aItem, int aKind = 0, const std::string aName = std::string() );
- void Log( const SHAPE_LINE_CHAIN *aL, int aKind = 0, const std::string aName = std::string() );
+ void Log( const ITEM* aItem, int aKind = 0, const std::string& aName = std::string() );
+ void Log( const SHAPE_LINE_CHAIN *aL, int aKind = 0, const std::string& aName = std::string() );
void Log( const VECTOR2I& aStart, const VECTOR2I& aEnd, int aKind = 0,
- const std::string aName = std::string() );
+ const std::string& aName = std::string() );
private:
void dumpShape( const SHAPE* aSh );
diff --git a/pcbnew/specctra.cpp b/pcbnew/specctra.cpp
index 6bcd06098..86807e583 100644
--- a/pcbnew/specctra.cpp
+++ b/pcbnew/specctra.cpp
@@ -3431,7 +3431,7 @@ void SPECCTRA_DB::doSUPPLY_PIN( SUPPLY_PIN* growth )
}
-void SPECCTRA_DB::ExportPCB( wxString aFilename, bool aNameChange )
+void SPECCTRA_DB::ExportPCB( const wxString& aFilename, bool aNameChange )
{
if( pcb )
{
@@ -3445,7 +3445,7 @@ void SPECCTRA_DB::ExportPCB( wxString aFilename, bool aNameChange )
}
-void SPECCTRA_DB::ExportSESSION( wxString aFilename )
+void SPECCTRA_DB::ExportSESSION( const wxString& aFilename )
{
if( session )
{
diff --git a/pcbnew/specctra.h b/pcbnew/specctra.h
index 9b0340a2d..512bb98d0 100644
--- a/pcbnew/specctra.h
+++ b/pcbnew/specctra.h
@@ -3816,7 +3816,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
* Function exportNETCLASS
* exports \a aNetClass to the DSN file.
*/
- void exportNETCLASS( std::shared_ptr<NETCLASS> aNetClass, BOARD* aBoard );
+ void exportNETCLASS( const std::shared_ptr<NETCLASS>& aNetClass, BOARD* aBoard );
//-----</FromBOARD>------------------------------------------------------
@@ -3928,7 +3928,7 @@ public:
* and also to to be changed in the output file.
* @throw IO_ERROR, if an i/o error occurs saving the file.
*/
- void ExportPCB( wxString aFilename, bool aNameChange=false );
+ void ExportPCB( const wxString& aFilename, bool aNameChange=false );
/**
* Function FromBOARD
@@ -3959,7 +3959,7 @@ public:
*
* @param aFilename The file to save to.
*/
- void ExportSESSION( wxString aFilename );
+ void ExportSESSION( const wxString& aFilename );
/**
* Function FlipMODULEs
diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp
index 273a94bfb..a8e19cc49 100644
--- a/pcbnew/specctra_export.cpp
+++ b/pcbnew/specctra_export.cpp
@@ -1488,7 +1488,7 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
}
-void SPECCTRA_DB::exportNETCLASS( NETCLASSPTR aNetClass, BOARD* aBoard )
+void SPECCTRA_DB::exportNETCLASS( const NETCLASSPTR& aNetClass, BOARD* aBoard )
{
/* From page 11 of specctra spec:
*
diff --git a/pcbnew/tools/edit_constraints.cpp b/pcbnew/tools/edit_constraints.cpp
index b73ac0c5a..33b51f449 100644
--- a/pcbnew/tools/edit_constraints.cpp
+++ b/pcbnew/tools/edit_constraints.cpp
@@ -29,6 +29,8 @@
#include <common.h>
+#include <utility>
+
void EC_VERTICAL::Apply( EDIT_POINT& aHandle )
{
VECTOR2I point = aHandle.GetPosition();
@@ -178,7 +180,7 @@ void EC_CONVERGING::Apply( EDIT_LINE& aHandle )
EC_SNAPLINE::EC_SNAPLINE( EDIT_LINE& aLine, V2D_TRANSFORM_FUN aSnapFun ) :
- EDIT_CONSTRAINT<EDIT_LINE>( aLine ), m_snapFun( aSnapFun )
+ EDIT_CONSTRAINT<EDIT_LINE>( aLine ), m_snapFun( std::move(aSnapFun) )
{}
diff --git a/pcbnew/tools/pad_tool.cpp b/pcbnew/tools/pad_tool.cpp
index 7c6709544..15bc7b466 100644
--- a/pcbnew/tools/pad_tool.cpp
+++ b/pcbnew/tools/pad_tool.cpp
@@ -37,6 +37,8 @@
#include <dialogs/dialog_global_pads_edition.h>
+#include <utility>
+
#include "pcb_actions.h"
#include "selection_tool.h"
#include "pcb_selection_conditions.h"
@@ -71,7 +73,7 @@ public:
PAD_CONTEXT_MENU( bool aEditingFootprint,
SHOW_FUNCTOR aHaveGlobalPadSetting ):
m_editingFootprint( aEditingFootprint ),
- m_haveGlobalPadSettings( aHaveGlobalPadSetting )
+ m_haveGlobalPadSettings( std::move(aHaveGlobalPadSetting) )
{
SetIcon( pad_xpm );
SetTitle( _( "Pads" ) );
diff --git a/polygon/poly2tri/sweep/cdt.cc b/polygon/poly2tri/sweep/cdt.cc
index 0cb910b6c..0fd2ac603 100644
--- a/polygon/poly2tri/sweep/cdt.cc
+++ b/polygon/poly2tri/sweep/cdt.cc
@@ -30,17 +30,19 @@
*/
#include "cdt.h"
+#include <utility>
+
namespace p2t {
CDT::CDT( std::vector<Point*> polyline )
{
- sweep_context_ = new SweepContext( polyline );
+ sweep_context_ = new SweepContext( std::move(polyline) );
sweep_ = new Sweep;
}
void CDT::AddHole( std::vector<Point*> polyline )
{
- sweep_context_->AddHole( polyline );
+ sweep_context_->AddHole( std::move(polyline) );
}
diff --git a/polygon/poly2tri/sweep/sweep_context.cc b/polygon/poly2tri/sweep/sweep_context.cc
index 012421560..63d148969 100644
--- a/polygon/poly2tri/sweep/sweep_context.cc
+++ b/polygon/poly2tri/sweep/sweep_context.cc
@@ -30,6 +30,7 @@
*/
#include "sweep_context.h"
#include <algorithm>
+#include <utility>
#include "advancing_front.h"
namespace p2t {
@@ -44,7 +45,7 @@ SweepContext::SweepContext( std::vector<Point*> polyline ) :
basin = Basin();
edge_event = EdgeEvent();
- points_ = polyline;
+ points_ = std::move(polyline);
InitEdges( points_ );
}
diff --git a/utils/idftools/dxf2idf.cpp b/utils/idftools/dxf2idf.cpp
index c921365b7..7c4571bf9 100644
--- a/utils/idftools/dxf2idf.cpp
+++ b/utils/idftools/dxf2idf.cpp
@@ -49,7 +49,7 @@ DXF2IDF::~DXF2IDF()
}
-bool DXF2IDF::ReadDxf( const std::string aFile )
+bool DXF2IDF::ReadDxf( const std::string& aFile )
{
dxfRW* reader = new dxfRW( aFile.c_str() );
diff --git a/utils/idftools/dxf2idf.h b/utils/idftools/dxf2idf.h
index 6b6d0bcd4..59b968004 100644
--- a/utils/idftools/dxf2idf.h
+++ b/utils/idftools/dxf2idf.h
@@ -41,7 +41,7 @@ public:
DXF2IDF() : m_scale( 1.0 ) {};
~DXF2IDF();
- bool ReadDxf( const std::string aFile );
+ bool ReadDxf( const std::string& aFile );
bool WriteOutline( FILE* aFile, bool isInch );
private:
diff --git a/utils/idftools/idf_common.cpp b/utils/idftools/idf_common.cpp
index b742c1207..a4b522b80 100644
--- a/utils/idftools/idf_common.cpp
+++ b/utils/idftools/idf_common.cpp
@@ -330,8 +330,8 @@ IDF_DRILL_DATA::IDF_DRILL_DATA()
IDF_DRILL_DATA::IDF_DRILL_DATA( double aDrillDia, double aPosX, double aPosY,
IDF3::KEY_PLATING aPlating,
- const std::string aRefDes,
- const std::string aHoleType,
+ const std::string& aRefDes,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner )
{
if( aDrillDia < 0.3 )
diff --git a/utils/idftools/idf_common.h b/utils/idftools/idf_common.h
index 8e29f5531..8dda141a9 100644
--- a/utils/idftools/idf_common.h
+++ b/utils/idftools/idf_common.h
@@ -401,8 +401,8 @@ public:
*/
IDF_DRILL_DATA( double aDrillDia, double aPosX, double aPosY,
IDF3::KEY_PLATING aPlating,
- const std::string aRefDes,
- const std::string aHoleType,
+ const std::string& aRefDes,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner );
/**
diff --git a/utils/idftools/idf_outlines.cpp b/utils/idftools/idf_outlines.cpp
index a53ea200f..ed19544fe 100644
--- a/utils/idftools/idf_outlines.cpp
+++ b/utils/idftools/idf_outlines.cpp
@@ -25,6 +25,7 @@
#include <iomanip>
#include <sstream>
#include <cmath>
+#include <utility>
#include <idf_helpers.h>
#include <idf_outlines.h>
@@ -2730,7 +2731,7 @@ bool GROUP_OUTLINE::SetGroupName( std::string aGroupName )
return false;
#endif
- groupName = aGroupName;
+ groupName = std::move(aGroupName);
return true;
}
diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp
index fc159f328..3ea410e4e 100644
--- a/utils/idftools/idf_parser.cpp
+++ b/utils/idftools/idf_parser.cpp
@@ -28,6 +28,7 @@
#include <cmath>
#include <cerrno>
#include <algorithm>
+#include <utility>
#include <wx/string.h>
#include <wx/filename.h>
@@ -717,7 +718,7 @@ bool IDF3_COMP_OUTLINE_DATA::readPlaceData( std::istream &aBoardFile,
void IDF3_COMP_OUTLINE_DATA::writePlaceData( std::ostream& aBoardFile,
double aXpos, double aYpos, double aAngle,
- const std::string aRefDes,
+ const std::string& aRefDes,
IDF3::IDF_PLACEMENT aPlacement,
IDF3::IDF_LAYER aSide )
{
@@ -988,7 +989,7 @@ const std::string& IDF3_COMPONENT::GetRefDes( void )
IDF_DRILL_DATA* IDF3_COMPONENT::AddDrill( double aDia, double aXpos, double aYpos,
IDF3::KEY_PLATING aPlating,
- const std::string aHoleType,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner )
{
IDF_DRILL_DATA* dp = new IDF_DRILL_DATA( aDia, aXpos, aYpos, aPlating,
@@ -1422,7 +1423,7 @@ IDF3::CAD_TYPE IDF3_BOARD::GetCadType( void )
void IDF3_BOARD::SetBoardName( std::string aBoardName )
{
- boardName = aBoardName;
+ boardName = std::move(aBoardName);
return;
}
@@ -3405,7 +3406,7 @@ const std::list< IDF_OUTLINE* >*const IDF3_BOARD::GetBoardOutlines( void )
IDF_DRILL_DATA* IDF3_BOARD::AddBoardDrill( double aDia, double aXpos, double aYpos,
IDF3::KEY_PLATING aPlating,
- const std::string aHoleType,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner )
{
IDF_DRILL_DATA* drill = new IDF_DRILL_DATA( aDia, aXpos, aYpos, aPlating,
@@ -3599,7 +3600,7 @@ bool IDF3_BOARD::AddSlot( double aWidth, double aLength, double aOrientation, do
IDF_DRILL_DATA* IDF3_BOARD::addCompDrill( double aDia, double aXpos, double aYpos,
IDF3::KEY_PLATING aPlating,
- const std::string aHoleType,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner,
const std::string& aRefDes )
{
@@ -3723,7 +3724,7 @@ IDF_DRILL_DATA* IDF3_BOARD::addCompDrill( IDF_DRILL_DATA* aDrilledHole )
}
-bool IDF3_BOARD::delCompDrill( double aDia, double aXpos, double aYpos, std::string aRefDes )
+bool IDF3_BOARD::delCompDrill( double aDia, double aXpos, double aYpos, const std::string& aRefDes )
{
errormsg.clear();
@@ -3831,7 +3832,7 @@ std::map< std::string, IDF3_COMPONENT* >*const IDF3_BOARD::GetComponents( void )
}
-IDF3_COMPONENT* IDF3_BOARD::FindComponent( std::string aRefDes )
+IDF3_COMPONENT* IDF3_BOARD::FindComponent( const std::string& aRefDes )
{
std::map<std::string, IDF3_COMPONENT*>::iterator it = components.find( aRefDes );
@@ -3844,7 +3845,7 @@ IDF3_COMPONENT* IDF3_BOARD::FindComponent( std::string aRefDes )
// returns a pointer to a component outline object or NULL
// if the object doesn't exist
-IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( wxString aFullFileName )
+IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( const wxString& aFullFileName )
{
std::string fname = TO_UTF8( aFullFileName );
wxFileName idflib( aFullFileName );
@@ -4054,7 +4055,7 @@ IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( wxString aFullFileName )
// returns a pointer to the component outline object with the
// unique ID aComponentID
-IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( std::string aComponentID )
+IDF3_COMP_OUTLINE* IDF3_BOARD::GetComponentOutline( const std::string& aComponentID )
{
std::map< std::string, IDF3_COMP_OUTLINE*>::iterator its = compOutlines.find( aComponentID );
diff --git a/utils/idftools/idf_parser.h b/utils/idftools/idf_parser.h
index b64fcf8b0..c3b25c95e 100644
--- a/utils/idftools/idf_parser.h
+++ b/utils/idftools/idf_parser.h
@@ -110,7 +110,7 @@ private:
* @return bool: true if data was successfully written, otherwise false
*/
void writePlaceData( std::ostream& aBoardFile, double aXpos, double aYpos, double aAngle,
- const std::string aRefDes, IDF3::IDF_PLACEMENT aPlacement,
+ const std::string& aRefDes, IDF3::IDF_PLACEMENT aPlacement,
IDF3::IDF_LAYER aSide );
public:
@@ -318,7 +318,7 @@ public:
*/
IDF_DRILL_DATA* AddDrill( double aDia, double aXpos, double aYpos,
IDF3::KEY_PLATING aPlating,
- const std::string aHoleType,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner );
/**
@@ -516,13 +516,13 @@ private:
IDF_DRILL_DATA* addCompDrill( double aDia, double aXpos, double aYpos,
IDF3::KEY_PLATING aPlating,
- const std::string aHoleType,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner,
const std::string& aRefDes );
IDF_DRILL_DATA* addCompDrill( IDF_DRILL_DATA* aDrilledHole );
- bool delCompDrill( double aDia, double aXpos, double aYpos, std::string aRefDes );
+ bool delCompDrill( double aDia, double aXpos, double aYpos, const std::string& aRefDes );
// read the DRILLED HOLES section
void readBrdDrills( std::istream& aBoardFile, IDF3::FILE_STATE& aBoardState );
@@ -676,7 +676,7 @@ public:
IDF_DRILL_DATA* AddBoardDrill( double aDia, double aXpos, double aYpos,
IDF3::KEY_PLATING aPlating,
- const std::string aHoleType,
+ const std::string& aHoleType,
IDF3::KEY_OWNER aOwner );
IDF_DRILL_DATA* AddDrill( IDF_DRILL_DATA* aDrilledHole );
@@ -693,15 +693,15 @@ public:
bool DelComponent( size_t aIndex );
size_t GetComponentsSize( void );
std::map< std::string, IDF3_COMPONENT* >*const GetComponents( void );
- IDF3_COMPONENT* FindComponent( std::string aRefDes );
+ IDF3_COMPONENT* FindComponent( const std::string& aRefDes );
// returns a pointer to a component outline object or NULL
// if the object doesn't exist
- IDF3_COMP_OUTLINE* GetComponentOutline( wxString aFullFileName );
+ IDF3_COMP_OUTLINE* GetComponentOutline( const wxString& aFullFileName );
// returns a pointer to the component outline object with the
// unique ID aComponentID
- IDF3_COMP_OUTLINE* GetComponentOutline( std::string aComponentID );
+ IDF3_COMP_OUTLINE* GetComponentOutline( const std::string& aComponentID );
// returns a pointer to the outline "NOGEOM NOPART" which is substituted
// whenever a true outline cannot be found or is defective
--------------2.13.5--
From 72d635a4866efd98dc318148f79bac08cf428b5a Mon Sep 17 00:00:00 2001
From: Camille <camille019@xxxxxxxxxxx>
Date: Fri, 22 Sep 2017 19:11:11 +0200
Subject: [PATCH 1/2] Fix unnecessary copy initialization detected by
clang-tidy
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.13.5"
This is a multi-part message in MIME format.
--------------2.13.5
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
common/gestfich.cpp | 10 +++++-----
cvpcb/dialogs/fp_conflict_assignment_selector.cpp | 2 +-
eeschema/netlist_exporters/netlist_exporter_pspice.cpp | 2 +-
eeschema/plot_schematic_PDF.cpp | 2 +-
gerbview/printout_control.cpp | 2 +-
kicad/tree_project_frame.cpp | 8 ++++----
pcbnew/board_netlist_updater.cpp | 2 +-
pcbnew/class_board.cpp | 2 +-
pcbnew/dialogs/dialog_create_array.cpp | 2 +-
pcbnew/loadcmp.cpp | 10 +++++-----
pcbnew/printout_controler.cpp | 2 +-
pcbnew/router/pns_line_placer.cpp | 2 +-
plugins/3d/vrml/x3d.cpp | 2 +-
plugins/3d/vrml/x3d/x3d_appearance.cpp | 4 ++--
plugins/3d/vrml/x3d/x3d_coords.cpp | 2 +-
plugins/3d/vrml/x3d/x3d_ifaceset.cpp | 2 +-
plugins/3d/vrml/x3d/x3d_ops.cpp | 10 +++++-----
plugins/3d/vrml/x3d/x3d_shape.cpp | 2 +-
plugins/3d/vrml/x3d/x3d_transform.cpp | 2 +-
19 files changed, 35 insertions(+), 35 deletions(-)
--------------2.13.5
Content-Type: text/x-patch; name="0001-Fix-unnecessary-copy-initialization-detected-by-clan.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0001-Fix-unnecessary-copy-initialization-detected-by-clan.patch"
diff --git a/common/gestfich.cpp b/common/gestfich.cpp
index 4e6fea79a..326d98188 100644
--- a/common/gestfich.cpp
+++ b/common/gestfich.cpp
@@ -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 );
diff --git a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp
index ef2f18002..0e5b372ee 100644
--- a/cvpcb/dialogs/fp_conflict_assignment_selector.cpp
+++ b/cvpcb/dialogs/fp_conflict_assignment_selector.cpp
@@ -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;
diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
index badb91e98..66af766ce 100644
--- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
@@ -318,7 +318,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() )
diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp
index 2d679a8d7..87e9fe60a 100644
--- a/eeschema/plot_schematic_PDF.cpp
+++ b/eeschema/plot_schematic_PDF.cpp
@@ -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 )
{
diff --git a/gerbview/printout_control.cpp b/gerbview/printout_control.cpp
index 21a758c2c..c80fe3af4 100644
--- a/gerbview/printout_control.cpp
+++ b/gerbview/printout_control.cpp
@@ -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.
diff --git a/kicad/tree_project_frame.cpp b/kicad/tree_project_frame.cpp
index a3d999201..646e4cc29 100644
--- a/kicad/tree_project_frame.cpp
+++ b/kicad/tree_project_frame.cpp
@@ -922,7 +922,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();
@@ -973,8 +973,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() )
{
@@ -1060,7 +1060,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 ) );
diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp
index c3b705ae8..3ce17bddc 100644
--- a/pcbnew/board_netlist_updater.cpp
+++ b/pcbnew/board_netlist_updater.cpp
@@ -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 ) )
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index a68a4e819..f7339edb6 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -2770,7 +2770,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 ) )
diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp
index d7600b6c3..0110279ed 100644
--- a/pcbnew/dialogs/dialog_create_array.cpp
+++ b/pcbnew/dialogs/dialog_create_array.cpp
@@ -175,7 +175,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();
diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp
index 31f64f072..053ae6e4a 100644
--- a/pcbnew/loadcmp.cpp
+++ b/pcbnew/loadcmp.cpp
@@ -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;
diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp
index 416a2bf01..a77bd21dd 100644
--- a/pcbnew/printout_controler.cpp
+++ b/pcbnew/printout_controler.cpp
@@ -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.
diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp
index f1cd748e1..a960bc287 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -438,7 +438,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;
diff --git a/plugins/3d/vrml/x3d.cpp b/plugins/3d/vrml/x3d.cpp
index 77f6f5ab5..c6014d81a 100644
--- a/plugins/3d/vrml/x3d.cpp
+++ b/plugins/3d/vrml/x3d.cpp
@@ -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 );
diff --git a/plugins/3d/vrml/x3d/x3d_appearance.cpp b/plugins/3d/vrml/x3d/x3d_appearance.cpp
index 876e49f93..35089f798 100644
--- a/plugins/3d/vrml/x3d/x3d_appearance.cpp
+++ b/plugins/3d/vrml/x3d/x3d_appearance.cpp
@@ -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" )
{
diff --git a/plugins/3d/vrml/x3d/x3d_coords.cpp b/plugins/3d/vrml/x3d/x3d_coords.cpp
index 51fe3ba0a..ed67c9eb6 100644
--- a/plugins/3d/vrml/x3d/x3d_coords.cpp
+++ b/plugins/3d/vrml/x3d/x3d_coords.cpp
@@ -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" )
{
diff --git a/plugins/3d/vrml/x3d/x3d_ifaceset.cpp b/plugins/3d/vrml/x3d/x3d_ifaceset.cpp
index 051b96180..78d5cbee9 100644
--- a/plugins/3d/vrml/x3d/x3d_ifaceset.cpp
+++ b/plugins/3d/vrml/x3d/x3d_ifaceset.cpp
@@ -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" )
{
diff --git a/plugins/3d/vrml/x3d/x3d_ops.cpp b/plugins/3d/vrml/x3d/x3d_ops.cpp
index 4ce5c8c26..0a413dc00 100644
--- a/plugins/3d/vrml/x3d/x3d_ops.cpp
+++ b/plugins/3d/vrml/x3d/x3d_ops.cpp
@@ -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" )
{
diff --git a/plugins/3d/vrml/x3d/x3d_shape.cpp b/plugins/3d/vrml/x3d/x3d_shape.cpp
index e71c7f4b4..93d07f980 100644
--- a/plugins/3d/vrml/x3d/x3d_shape.cpp
+++ b/plugins/3d/vrml/x3d/x3d_shape.cpp
@@ -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" )
{
diff --git a/plugins/3d/vrml/x3d/x3d_transform.cpp b/plugins/3d/vrml/x3d/x3d_transform.cpp
index 210834958..262db573f 100644
--- a/plugins/3d/vrml/x3d/x3d_transform.cpp
+++ b/plugins/3d/vrml/x3d/x3d_transform.cpp
@@ -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" )
{
--------------2.13.5--
Follow ups