kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #33044
Re: [PATCH] Fix some performance issues
Hi,
As promised, here are the patches up to date.
Regards,
Camille
________________________________
De : Camille <camille019@xxxxxxxxxxx>
Envoyé : mardi 26 septembre 2017 21:56:07
À : Wayne Stambaugh
Cc : kicad-developers@xxxxxxxxxxxxxxxxxxx
Objet : Re: [Kicad-developers] [PATCH] Fix some performance issues
Hi,
Ok, I'll keep the patchset synchronized with the master branch, for future inclusion. When will the feature freeze take effect ?
I agree my patchset has no real impact on the performance. I mainly wanted to test clang-tidy on a consistent source code base. I also think that keeping automated checks empty of warning can help to improve the overall code quality.
Regards,
--
Camille
Le lun. 25 sept. 2017 à 16:21, Wayne Stambaugh <stambaughw@xxxxxxxxx> a écrit :
On 9/25/2017 4:07 AM, Maciej Sumiński wrote:
Hi Camille, I think the attached patches are sensible, even though I hope most compilers apply optimizations to avoid performance penalties whenever possible.
I agree although I'm not sure about the compiler optimization. A quick look at the patches and I'm not sure the performance gains will be that noticeable. Most of the changes are in code that is called once on demand in response to a user request as opposed to the drawing or drc code where large numbers of calls happen frequently. That being said, we really should be doing a better job of not passing entire objects on the stack unless there is a good reason to do so.
If the attached patches are autogenerated, then I would kindly ask you to generate them when we reach the feature freeze stage. There are a few branches that await to be merged and I am not sure whether your patches would not create too many conflicts. During the feature freeze we anticipate the code changes will not be as disruptive as they are now.
I second this. There are quite a few outstanding patches that will likely have enough conflicts so I would rather not pile more on top of that.
Regards, Orson On 09/23/2017 12:17 PM, Camille 019 wrote:
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 _______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx> Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx> Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
_______________________________________________ Mailing list: https://launchpad.net/~kicad-developers Post to : kicad-developers@xxxxxxxxxxxxxxxxxxx<mailto:kicad-developers@xxxxxxxxxxxxxxxxxxx> Unsubscribe : https://launchpad.net/~kicad-developers More help : https://help.launchpad.net/ListHelp
From 0430cae37850cf1147b48248d938639b2c8a2929 Mon Sep 17 00:00:00 2001
From: Camille <camille019@xxxxxxxxxxx>
Date: Fri, 22 Sep 2017 19:11:11 +0200
Subject: [PATCH 1/4] Fix unnecessary copy initialization detected by
clang-tidy
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.14.3"
This is a multi-part message in MIME format.
--------------2.14.3
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.14.3
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 b95892fd4..8a853f7c9 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 be6d533f3..e67f71515 100644
--- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
@@ -319,7 +319,7 @@ bool NETLIST_EXPORTER_PSPICE::ProcessNetlist( unsigned aCtl )
if( fieldSeq )
{
// Get the string containing the sequence of nodes:
- wxString nodeSeqIndexLineStr = fieldSeq->GetText();
+ const wxString& nodeSeqIndexLineStr = fieldSeq->GetText();
// Verify field exists and is not empty:
if( !nodeSeqIndexLineStr.IsEmpty() )
diff --git a/eeschema/plot_schematic_PDF.cpp b/eeschema/plot_schematic_PDF.cpp
index 6ca854a92..c1a073c16 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 c2d361dba..74f9fac46 100644
--- a/kicad/tree_project_frame.cpp
+++ b/kicad/tree_project_frame.cpp
@@ -919,7 +919,7 @@ wxTreeItemId TREE_PROJECT_FRAME::findSubdirTreeItem( const wxString& aSubDir )
void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
{
- wxFileName pathModified = event.GetPath();
+ const wxFileName& pathModified = event.GetPath();
wxString subdir = pathModified.GetPath();
wxString fn = pathModified.GetFullPath();
@@ -970,8 +970,8 @@ void TREE_PROJECT_FRAME::OnFileSystemEvent( wxFileSystemWatcherEvent& event )
case wxFSW_EVENT_RENAME :
{
- wxFileName newpath = event.GetNewPath();
- wxString newfn = newpath.GetFullPath();
+ const wxFileName& newpath = event.GetNewPath();
+ wxString newfn = newpath.GetFullPath();
while( kid.IsOk() )
{
@@ -1057,7 +1057,7 @@ void TREE_PROJECT_FRAME::FileWatcherReset()
if( itemData && itemData->GetType() == TREE_DIRECTORY )
{
// we can see wxString under a debugger, not a wxFileName
- wxString path = itemData->GetFileName();
+ const wxString& path = itemData->GetFileName();
wxLogDebug( "%s: add '%s'\n", __func__, TO_UTF8( path ) );
diff --git a/pcbnew/board_netlist_updater.cpp b/pcbnew/board_netlist_updater.cpp
index 37ea7ce99..a31cb9c6d 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 cca62f844..ef65e50bd 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -2776,7 +2776,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// Explore all pins/pads in component
for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
{
- COMPONENT_NET net = component->GetNet( jj );
+ const COMPONENT_NET& net = component->GetNet( jj );
padname = net.GetPinName();
if( footprint->FindPadByName( padname ) )
diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp
index 2c3bcad43..934c9578d 100644
--- a/pcbnew/dialogs/dialog_create_array.cpp
+++ b/pcbnew/dialogs/dialog_create_array.cpp
@@ -176,7 +176,7 @@ static bool getNumberingOffset( const wxString& str,
DIALOG_CREATE_ARRAY::ARRAY_NUMBERING_TYPE_T type,
int& offsetToFill )
{
- const wxString alphabet = alphabetFromNumberingScheme( type );
+ const wxString& alphabet = alphabetFromNumberingScheme( type );
int offset = 0;
const int radix = alphabet.length();
diff --git a/pcbnew/loadcmp.cpp b/pcbnew/loadcmp.cpp
index 819a0dd86..4edef4426 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 336b2b158..9013f604f 100644
--- a/pcbnew/router/pns_line_placer.cpp
+++ b/pcbnew/router/pns_line_placer.cpp
@@ -436,7 +436,7 @@ bool LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, LINE& aNewHead )
const LINE LINE_PLACER::reduceToNearestObstacle( const LINE& aOriginalLine )
{
- auto l0 = aOriginalLine.CLine();
+ const auto& l0 = aOriginalLine.CLine();
if ( !l0.PointCount() )
return aOriginalLine;
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.14.3--
From 43ff2ef1e8fc8587883f7d1f635aa94eec7b7863 Mon Sep 17 00:00:00 2001
From: Camille <camille019@xxxxxxxxxxx>
Date: Sat, 23 Sep 2017 11:20:10 +0200
Subject: [PATCH 2/4] 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.14.3"
This is a multi-part message in MIME format.
--------------2.14.3
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/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 | 4 +-
eeschema/bom_table_model.h | 4 +-
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 | 22 ++++----
pcbnew/connectivity_algo.h | 6 +--
pcbnew/connectivity_data.cpp | 12 ++---
pcbnew/connectivity_data.h | 2 +-
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 | 66 +++++++++++------------
pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h | 61 +++++++++++----------
pcbnew/pcad2kicadpcb_plugin/pcb.cpp | 19 ++++---
pcbnew/pcad2kicadpcb_plugin/pcb.h | 37 +++++++------
pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp | 8 +--
pcbnew/pcad2kicadpcb_plugin/pcb_arc.h | 6 ++-
pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.cpp | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.h | 4 +-
pcbnew/pcad2kicadpcb_plugin/pcb_cutout.cpp | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_cutout.h | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_keepout.cpp | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_keepout.h | 4 +-
pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp | 8 +--
pcbnew/pcad2kicadpcb_plugin/pcb_line.h | 8 +--
pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp | 11 ++--
pcbnew/pcad2kicadpcb_plugin/pcb_module.h | 11 ++--
pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp | 5 +-
pcbnew/pcad2kicadpcb_plugin/pcb_pad.h | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.cpp | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.h | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_plane.cpp | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_plane.h | 4 +-
pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp | 11 ++--
pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h | 9 ++--
pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp | 8 +--
pcbnew/pcad2kicadpcb_plugin/pcb_text.h | 8 +--
pcbnew/pcad2kicadpcb_plugin/pcb_via.cpp | 5 +-
pcbnew/pcad2kicadpcb_plugin/pcb_via.h | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.cpp | 6 +--
pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.h | 6 +--
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 | 4 +-
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 | 5 +-
utils/idftools/idf_outlines.h | 2 +-
utils/idftools/idf_parser.cpp | 19 +++----
utils/idftools/idf_parser.h | 16 +++---
123 files changed, 404 insertions(+), 370 deletions(-)
--------------2.14.3
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 e5e083890..5921f3364 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>
@@ -84,7 +85,7 @@ void DisplayError( wxWindow* parent, const wxString& text, int displaytime )
}
-void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxString aExtraInfo )
+void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxString& aExtraInfo )
{
wxRichMessageDialog* dlg;
@@ -101,7 +102,7 @@ void DisplayErrorMessage( wxWindow* aParent, const wxString& aText, const wxStri
}
-void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxString aExtraInfo )
+void DisplayInfoMessage( wxWindow* aParent, const wxString& aMessage, const wxString& aExtraInfo )
{
wxRichMessageDialog* dlg;
diff --git a/common/footprint_info.cpp b/common/footprint_info.cpp
index a39de4fe3..174412940 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>
@@ -205,7 +206,7 @@ int FOOTPRINT_ASYNC_LOADER::GetProgress() const
void FOOTPRINT_ASYNC_LOADER::SetCompletionCallback( std::function<void()> aCallback )
{
- m_completion_cb = aCallback;
+ m_completion_cb = std::move(aCallback);
}
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 e712553cd..608c11714 100644
--- a/common/gal/opengl/opengl_gal.cpp
+++ b/common/gal/opengl/opengl_gal.cpp
@@ -1545,7 +1545,7 @@ void OPENGL_GAL::drawPolygon( GLdouble* aPoints, int aPointCount )
}
-void OPENGL_GAL::drawPolyline( std::function<VECTOR2D (int)> aPointGetter, int aPointCount )
+void OPENGL_GAL::drawPolyline( const std::function<VECTOR2D (int)>& aPointGetter, int aPointCount )
{
if( aPointCount < 2 )
return;
diff --git a/common/geometry/shape_file_io.cpp b/common/geometry/shape_file_io.cpp
index 6bcbafb44..2d3a70095 100644
--- a/common/geometry/shape_file_io.cpp
+++ b/common/geometry/shape_file_io.cpp
@@ -115,7 +115,7 @@ SHAPE* SHAPE_FILE_IO::Read()
}
-void SHAPE_FILE_IO::BeginGroup( const std::string aName )
+void SHAPE_FILE_IO::BeginGroup( const std::string& aName )
{
assert( m_mode != IOM_READ );
@@ -139,7 +139,7 @@ void SHAPE_FILE_IO::EndGroup()
}
-void SHAPE_FILE_IO::Write( const SHAPE* aShape, const std::string aName )
+void SHAPE_FILE_IO::Write( const SHAPE* aShape, const std::string& aName )
{
assert( m_mode != IOM_READ );
diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp
index 0d0878532..b1cba0e2c 100644
--- a/common/geometry/shape_poly_set.cpp
+++ b/common/geometry/shape_poly_set.cpp
@@ -1657,7 +1657,7 @@ int SHAPE_POLY_SET::Distance( VECTOR2I aPoint )
}
-int SHAPE_POLY_SET::Distance( SEG aSegment, int aSegmentWidth )
+int SHAPE_POLY_SET::Distance( const SEG& aSegment, int aSegmentWidth )
{
int currentDistance;
int minDistance = DistanceToPolygon( aSegment, 0 );
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 622bb5e7f..8693bcdd0 100644
--- a/common/tool/tool_action.cpp
+++ b/common/tool/tool_action.cpp
@@ -28,7 +28,7 @@
#include <algorithm>
TOOL_ACTION::TOOL_ACTION( const std::string& aName, TOOL_ACTION_SCOPE aScope,
- int aDefaultHotKey, const wxString aMenuItem, const wxString& aMenuDesc,
+ int aDefaultHotKey, const wxString& aMenuItem, const wxString& aMenuDesc,
const BITMAP_OPAQUE* aIcon, TOOL_ACTION_FLAGS aFlags, void* aParam ) :
m_name( aName ), m_scope( aScope ), m_defaultHotKey( aDefaultHotKey ),
m_menuItem( aMenuItem ), m_menuDescription( aMenuDesc ),
diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp
index e696a2364..48517ade8 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 113b8a40e..2a602bd8f 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 b1cd78c24..5dd6b3920 100644
--- a/eeschema/bom_table_model.cpp
+++ b/eeschema/bom_table_model.cpp
@@ -56,7 +56,7 @@ static BOM_TABLE_ROW const* ItemToRow( wxDataViewItem aItem )
}
-BOM_FIELD_VALUES::BOM_FIELD_VALUES( wxString aRefDes, FIELD_VALUE_MAP* aTemplate ) :
+BOM_FIELD_VALUES::BOM_FIELD_VALUES( const wxString& aRefDes, FIELD_VALUE_MAP* aTemplate ) :
m_refDes( aRefDes ),
m_templateValues( aTemplate )
{
@@ -542,7 +542,7 @@ BOM_TABLE_COMPONENT::BOM_TABLE_COMPONENT( BOM_TABLE_GROUP* aParent,
* Try to add a unit to this component
* If the references match, it will be added
*/
-bool BOM_TABLE_COMPONENT::AddUnit( SCH_REFERENCE aUnit )
+bool BOM_TABLE_COMPONENT::AddUnit( const SCH_REFERENCE& aUnit )
{
// Addition is successful if the references match or there are currently no units in the group
if( Units.size() == 0 || Units[0].GetRef().Cmp( aUnit.GetRef() ) == 0 )
diff --git a/eeschema/bom_table_model.h b/eeschema/bom_table_model.h
index f3b9b19ce..aec7603de 100644
--- a/eeschema/bom_table_model.h
+++ b/eeschema/bom_table_model.h
@@ -58,7 +58,7 @@ typedef std::map<unsigned int, wxString> FIELD_VALUE_MAP;
class BOM_FIELD_VALUES
{
public:
- BOM_FIELD_VALUES( wxString aRefDes, FIELD_VALUE_MAP* aTemplate );
+ BOM_FIELD_VALUES( const wxString& aRefDes, FIELD_VALUE_MAP* aTemplate );
/**
* Return the current value for the provided field ID
@@ -218,7 +218,7 @@ public:
BOM_TABLE_COMPONENT( BOM_TABLE_GROUP* aParent, BOM_COLUMN_LIST* aColumnList, BOM_FIELD_VALUES* aValues );
- bool AddUnit( SCH_REFERENCE aUnit );
+ bool AddUnit( const SCH_REFERENCE& aUnit );
virtual wxString GetFieldValue( unsigned int aFieldId ) const override;
diff --git a/eeschema/dialogs/dialog_annotate.cpp b/eeschema/dialogs/dialog_annotate.cpp
index 3c1cd7b08..6b7cf2175 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;
@@ -311,7 +311,7 @@ int DIALOG_ANNOTATE::GetAnnotateAlgo()
}
-int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, wxString message )
+int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& message )
{
DIALOG_ANNOTATE dlg( aCaller, message );
diff --git a/eeschema/invoke_sch_dialog.h b/eeschema/invoke_sch_dialog.h
index 1691d2e03..08a9c7c46 100644
--- a/eeschema/invoke_sch_dialog.h
+++ b/eeschema/invoke_sch_dialog.h
@@ -67,7 +67,7 @@ int InvokeDialogRescueEach( SCH_EDIT_FRAME* aCaller, RESCUER& aRescuer, bool aAs
/// Create and show DIALOG_ANNOTATE and return whatever
/// DIALOG_ANNOTATE::ShowModal() returns.
-int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, wxString message = "" );
+int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller, const wxString& message = "" );
/// Create the modeless DIALOG_ERC and show it, return something to
/// destroy or close it. The dialog will have ID_DIALOG_ERC from id.h
diff --git a/eeschema/project_rescue.cpp b/eeschema/project_rescue.cpp
index 35105c20b..9e72cedd2 100644
--- a/eeschema/project_rescue.cpp
+++ b/eeschema/project_rescue.cpp
@@ -91,7 +91,7 @@ static void get_components( std::vector<SCH_COMPONENT*>& aComponents )
* @param aLibs - the loaded PART_LIBS
* @param aCached - whether we are looking for the cached part
*/
-static LIB_PART* find_component( wxString aName, PART_LIBS* aLibs, bool aCached )
+static LIB_PART* find_component( const wxString& aName, PART_LIBS* aLibs, bool aCached )
{
LIB_PART *part = NULL;
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 5455d4b6c..21e154b02 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -900,7 +900,7 @@ SCH_FIELD* SCH_COMPONENT::GetField( int aFieldNdx ) const
}
-wxString SCH_COMPONENT::GetFieldText( wxString aFieldName, bool aIncludeDefaultFields ) const
+wxString SCH_COMPONENT::GetFieldText( const wxString& aFieldName, bool aIncludeDefaultFields ) const
{
// Field name for comparison
wxString cmpFieldName;
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index 68abcf78b..dd9854743 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -334,7 +334,7 @@ public:
* @param aIncludeDefaultFields is used to search the default library symbol fields in the
* search.
*/
- wxString GetFieldText( wxString aFieldName, bool aIncludeDefaultFields = true ) const;
+ wxString GetFieldText( const wxString& aFieldName, bool aIncludeDefaultFields = true ) const;
/**
* Populates a std::vector with SCH_FIELDs.
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index 5a2a08daf..79a040501 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 7d4870103..030b1c8ae 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 45cc8eee0..a88325163 100644
--- a/eeschema/sch_sheet_path.cpp
+++ b/eeschema/sch_sheet_path.cpp
@@ -436,7 +436,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 ca6e368a1..b41798538 100644
--- a/eeschema/sch_sheet_path.h
+++ b/eeschema/sch_sheet_path.h
@@ -349,7 +349,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 8cc841f3d..39d6d343d 100644
--- a/include/class_board_item.h
+++ b/include/class_board_item.h
@@ -71,7 +71,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 5769f7ece..0cedcc693 100644
--- a/include/confirm.h
+++ b/include/confirm.h
@@ -66,7 +66,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 );
/**
@@ -77,7 +77,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 30a3b7076..7ab14c3a6 100644
--- a/include/gal/opengl/opengl_gal.h
+++ b/include/gal/opengl/opengl_gal.h
@@ -376,7 +376,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 ce7bfa790..19a68a112 100644
--- a/include/geometry/shape_file_io.h
+++ b/include/geometry/shape_file_io.h
@@ -49,12 +49,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 70d2a1470..9df221030 100644
--- a/include/geometry/shape_poly_set.h
+++ b/include/geometry/shape_poly_set.h
@@ -1058,7 +1058,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 cdaa66b5f..9a304ed11 100644
--- a/kicad/kicad.h
+++ b/kicad/kicad.h
@@ -339,7 +339,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 bcaeb371d..0e42dd491 100644
--- a/pcbnew/class_board_item.cpp
+++ b/pcbnew/class_board_item.cpp
@@ -198,7 +198,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 791ee007b..c1faeeaf1 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 f987ff575..3eca1a015 100644
--- a/pcbnew/class_module.h
+++ b/pcbnew/class_module.h
@@ -589,7 +589,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 bd5b6f6ce..c94987cea 100644
--- a/pcbnew/class_netclass.cpp
+++ b/pcbnew/class_netclass.cpp
@@ -99,7 +99,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 f6ebaddf5..67abe1914 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 e87874401..cf69dba94 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 ea5393aa0..bcfd5b7d9 100644
--- a/pcbnew/clean.cpp
+++ b/pcbnew/clean.cpp
@@ -617,7 +617,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 0229f667a..88913b2bd 100644
--- a/pcbnew/connectivity_algo.cpp
+++ b/pcbnew/connectivity_algo.cpp
@@ -34,7 +34,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;
@@ -1033,35 +1033,35 @@ 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 );
+ aFunc( *item );
for( auto item : m_viaList )
- aFunc( item );
+ aFunc( *item );
for( auto item : m_trackList )
- aFunc( item );
+ aFunc( *item );
for( auto item : m_zoneList )
- aFunc( item );
+ aFunc( *item );
}
-void CN_CONNECTIVITY_ALGO::ForEachAnchor( std::function<void(CN_ANCHOR_PTR)> aFunc )
+void CN_CONNECTIVITY_ALGO::ForEachAnchor( const std::function<void( CN_ANCHOR& )>& aFunc )
{
for( auto anchor : m_padList.Anchors() )
- aFunc( anchor );
+ aFunc( *anchor );
for( auto anchor : m_viaList.Anchors() )
- aFunc( anchor );
+ aFunc( *anchor );
for( auto anchor : m_trackList.Anchors() )
- aFunc( anchor );
+ aFunc( *anchor );
for( auto anchor : m_zoneList.Anchors() )
- aFunc( anchor );
+ aFunc( *anchor );
}
diff --git a/pcbnew/connectivity_algo.h b/pcbnew/connectivity_algo.h
index c1bcd04f5..514e22bf0 100644
--- a/pcbnew/connectivity_algo.h
+++ b/pcbnew/connectivity_algo.h
@@ -896,14 +896,14 @@ 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& )>& aFunc );
+ void ForEachItem( const std::function<void( CN_ITEM& )>& aFunc );
void MarkNetAsDirty( int aNet );
void SetProgressReporter( PROGRESS_REPORTER* aReporter );
};
-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/connectivity_data.cpp b/pcbnew/connectivity_data.cpp
index 3ce92e276..b5a4f7aa6 100644
--- a/pcbnew/connectivity_data.cpp
+++ b/pcbnew/connectivity_data.cpp
@@ -122,7 +122,7 @@ void CONNECTIVITY_DATA::updateRatsnest()
}
-void CONNECTIVITY_DATA::addRatsnestCluster( std::shared_ptr<CN_CLUSTER> aCluster )
+void CONNECTIVITY_DATA::addRatsnestCluster( const std::shared_ptr<CN_CLUSTER>& aCluster )
{
auto rnNet = m_nets[ aCluster->OriginNet() ];
@@ -281,7 +281,7 @@ void CONNECTIVITY_DATA::ComputeDynamicRatsnest( const std::vector<BOARD_ITEM*>&
void CONNECTIVITY_DATA::ClearDynamicRatsnest()
{
- m_connAlgo->ForEachAnchor( [] (CN_ANCHOR_PTR anchor ) { anchor->SetNoLine( false ); } );
+ m_connAlgo->ForEachAnchor( [] ( CN_ANCHOR& anchor ) { anchor.SetNoLine( false ); } );
HideDynamicRatsnest();
}
@@ -359,11 +359,11 @@ const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNe
std::set<BOARD_CONNECTED_ITEM*> items;
std::vector<BOARD_CONNECTED_ITEM*> rv;
- m_connAlgo->ForEachItem( [&items, aNetCode, &aTypes] ( CN_ITEM* aItem )
+ m_connAlgo->ForEachItem( [&items, aNetCode, &aTypes] ( CN_ITEM& aItem )
{
- if( aItem->Valid() && aItem->Net() == aNetCode )
+ if( aItem.Valid() && ( aItem.Net() == aNetCode ) )
{
- KICAD_T itemType = aItem->Parent()->Type();
+ KICAD_T itemType = aItem.Parent()->Type();
for( int i = 0; aTypes[i] > 0; ++i )
{
@@ -371,7 +371,7 @@ const std::vector<BOARD_CONNECTED_ITEM*> CONNECTIVITY_DATA::GetNetItems( int aNe
if( itemType == aTypes[i] )
{
- items.insert( aItem->Parent() );
+ items.insert( aItem.Parent() );
break;
}
}
diff --git a/pcbnew/connectivity_data.h b/pcbnew/connectivity_data.h
index af0acc1f0..fb614f07a 100644
--- a/pcbnew/connectivity_data.h
+++ b/pcbnew/connectivity_data.h
@@ -230,7 +230,7 @@ public:
private:
void updateRatsnest();
- void addRatsnestCluster( std::shared_ptr<CN_CLUSTER> aCluster );
+ void addRatsnestCluster( const std::shared_ptr<CN_CLUSTER>& aCluster );
std::unique_ptr<CONNECTIVITY_DATA> m_dynamicConnectivity;
std::shared_ptr<CN_CONNECTIVITY_ALGO> m_connAlgo;
diff --git a/pcbnew/dialogs/dialog_create_array.cpp b/pcbnew/dialogs/dialog_create_array.cpp
index 934c9578d..2e8de4834 100644
--- a/pcbnew/dialogs/dialog_create_array.cpp
+++ b/pcbnew/dialogs/dialog_create_array.cpp
@@ -265,7 +265,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 49bad04eb..61d0eade6 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 2e4615452..5f52e2f92 100644
--- a/pcbnew/drc.cpp
+++ b/pcbnew/drc.cpp
@@ -501,7 +501,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 9d33d3629..85166e103 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 23743ff99..56bf260cb 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 82ddd7d31..fd539655e 100644
--- a/pcbnew/footprint_info_impl.h
+++ b/pcbnew/footprint_info_impl.h
@@ -68,7 +68,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 3165eb6d0..d71bd7522 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 a4c1db251..e2aef01df 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.cpp
@@ -109,7 +109,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;
@@ -168,13 +168,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;
@@ -213,7 +213,7 @@ wxString GetAndCutWordWithMeasureUnits( wxString* aStr, wxString aDefaultMeasure
}
-int StrToInt1Units( wxString aStr )
+int StrToInt1Units( const wxString& aStr )
{
double num, precision = 10;
@@ -244,10 +244,10 @@ wxString ValidateReference( wxString aRef )
}
-void SetWidth( wxString aStr,
- wxString aDefaultMeasurementUnit,
- int* aWidth,
- wxString aActualConversion )
+void SetWidth( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ int* aWidth,
+ const wxString& aActualConversion )
{
*aWidth = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( ' ' ),
@@ -255,10 +255,10 @@ void SetWidth( wxString aStr,
}
-void SetHeight( wxString aStr,
- wxString aDefaultMeasurementUnit,
- int* aHeight,
- wxString aActualConversion )
+void SetHeight( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ int* aHeight,
+ const wxString& aActualConversion )
{
*aHeight = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( ' ' ),
@@ -266,11 +266,11 @@ void SetHeight( wxString aStr,
}
-void SetPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
- int* aX,
- int* aY,
- wxString aActualConversion )
+void SetPosition( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ int* aX,
+ int* aY,
+ const wxString& aActualConversion )
{
*aX = StrToIntUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( 'X' ),
@@ -281,11 +281,11 @@ void SetPosition( wxString aStr,
}
-void SetDoublePrecisionPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
- double* aX,
- double* aY,
- wxString aActualConversion )
+void SetDoublePrecisionPosition( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ double* aX,
+ double* aY,
+ const wxString& aActualConversion )
{
*aX = StrToDoublePrecisionUnits( GetAndCutWordWithMeasureUnits( &aStr,
aDefaultMeasurementUnit ), wxT( 'X' ),
@@ -296,7 +296,7 @@ void SetDoublePrecisionPosition( wxString aStr,
}
-TTEXT_JUSTIFY GetJustifyIdentificator( wxString aJustify )
+TTEXT_JUSTIFY GetJustifyIdentificator( const wxString& aJustify )
{
TTEXT_JUSTIFY id;
@@ -323,10 +323,10 @@ TTEXT_JUSTIFY GetJustifyIdentificator( wxString aJustify )
}
-void SetTextParameters( XNODE* aNode,
- TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void SetTextParameters( XNODE* aNode,
+ TTEXTVALUE* aTextValue,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* tNode;
wxString str;
@@ -377,10 +377,10 @@ void SetTextParameters( XNODE* aNode,
}
-void SetFontProperty( XNODE* aNode,
- TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void SetFontProperty( XNODE* aNode,
+ TTEXTVALUE* aTextValue,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
wxString n, propValue;
@@ -558,7 +558,7 @@ void SetTextSizeFromTrueTypeFontHeight( EDA_TEXT* aText, int aTextHeight )
}
-XNODE* FindNode( XNODE* aChild, wxString aTag )
+XNODE* FindNode( XNODE* aChild, const wxString& aTag )
{
aChild = aChild->GetChildren();
@@ -573,7 +573,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 68e5571a3..1dbfb6ecb 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcad2kicad_common.h
@@ -69,43 +69,42 @@ typedef struct _TTEXTVALUE
extern wxString GetWord( wxString* aStr );
extern XNODE* FindPinMap( XNODE* aNode );
-extern int StrToIntUnits( wxString aStr, char aAxe, wxString aActualConversion );
-extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
- wxString aDefaultMeasurementUnit );
-extern int StrToInt1Units( wxString aStr );
+extern int StrToIntUnits( const wxString& aStr, char aAxe, const wxString& aActualConversion );
+extern wxString GetAndCutWordWithMeasureUnits( wxString* aStr,
+ const wxString& aDefaultMeasurementUnit );
+extern int StrToInt1Units( const wxString& aStr );
extern wxString ValidateName( wxString aName );
extern wxString ValidateReference( wxString aRef );
-extern void SetWidth( wxString aStr,
- wxString aDefaultMeasurementUnit,
- int* aWidth,
- wxString aActualConversion );
-extern void SetPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
- int* aX,
- int* aY,
- wxString aActualConversion );
-extern void SetDoublePrecisionPosition( wxString aStr,
- wxString aDefaultMeasurementUnit,
- double* aX,
- double* aY,
- wxString aActualConversion );
-extern TTEXT_JUSTIFY GetJustifyIdentificator( wxString aJustify );
-extern void SetTextParameters( XNODE* aNode,
- TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
-extern void SetFontProperty( XNODE* aNode,
- TTEXTVALUE* aTextValue,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+extern void SetWidth( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ int* aWidth,
+ const wxString& aActualConversion );
+extern void SetPosition( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ int* aX,
+ int* aY,
+ const wxString& aActualConversion );
+extern void SetDoublePrecisionPosition( wxString aStr,
+ const wxString& aDefaultMeasurementUnit,
+ double* aX,
+ double* aY,
+ const wxString& aActualConversion );
+extern TTEXT_JUSTIFY GetJustifyIdentificator( const wxString& aJustify );
+extern void SetTextParameters( XNODE* aNode,
+ TTEXTVALUE* aTextValue,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
+extern void SetFontProperty( XNODE* aNode,
+ TTEXTVALUE* aTextValue,
+ 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 void SetTextSizeFromStrokeFontHeight( EDA_TEXT* aText, int aTextHeight );
extern void SetTextSizeFromTrueTypeFontHeight( 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 35ed2fee3..c42add645 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,9 @@ 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 +234,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 +421,9 @@ 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 +450,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 +578,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 +669,7 @@ void PCB::GetBoardOutline( wxXmlDocument* aXmlDoc, wxString aActualConversion )
}
}
-void PCB::ParseBoard( wxStatusBar* aStatusBar, wxXmlDocument* aXmlDoc, wxString aActualConversion )
+void PCB::ParseBoard( 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 a8cfdf302..f1e074d94 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb.h
@@ -53,15 +53,15 @@ public:
PCB( BOARD* aBoard );
~PCB();
- PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override;
+ PCB_LAYER_ID GetKiCadLayer( int aPCadLayer ) override;
LAYER_TYPE_T GetLayerType( int aPCadLayer ) override;
wxString GetLayerNetNameRef( int aPCadLayer ) override;
int GetNewTimestamp() override;
int GetNetCode( wxString aNetName ) override;
- void ParseBoard( wxStatusBar* aStatusBar,
- wxXmlDocument* aXmlDoc,
- wxString aActualConversion );
+ void ParseBoard( wxStatusBar* aStatusBar,
+ wxXmlDocument* aXmlDoc,
+ const wxString& aActualConversion );
void AddToBoard() override;
@@ -69,22 +69,25 @@ private:
int m_timestamp_cnt;
wxArrayString m_layersStackup;
- XNODE* FindCompDefName( XNODE* aNode, wxString aName );
- void SetTextProperty( XNODE* aNode,
- TTEXTVALUE* aTextValue,
- wxString aPatGraphRefName,
- wxString aXmlName,
- wxString aActualConversion );
- void DoPCBComponents( XNODE* aNode,
- wxXmlDocument* aXmlDoc,
- wxString aActualConversion,
- wxStatusBar* aStatusBar );
- void ConnectPinToNet( wxString aCr, wxString aPr, wxString aNetName );
- int FindLayer( wxString aLayerName );
+ XNODE* FindCompDefName( XNODE* aNode, const wxString& aName );
+ void SetTextProperty( XNODE* aNode,
+ TTEXTVALUE* aTextValue,
+ const wxString& aPatGraphRefName,
+ const wxString& aXmlName,
+ const wxString& aActualConversion );
+ void DoPCBComponents( XNODE* aNode,
+ wxXmlDocument* aXmlDoc,
+ const wxString& aActualConversion,
+ wxStatusBar* aStatusBar );
+ 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_arc.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
index 38fa914d2..71c895cdf 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.cpp
@@ -52,10 +52,10 @@ PCB_ARC::~PCB_ARC()
}
-void PCB_ARC::Parse( XNODE* aNode,
- int aLayer,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_ARC::Parse( XNODE* aNode,
+ int aLayer,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
double a = 0.0;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h
index 9f1022299..e8b90b203 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_arc.h
@@ -47,8 +47,10 @@ public:
PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_ARC();
- virtual void Parse( XNODE* aNode, int aLayer,
- wxString aDefaultMeasurementUnit, wxString aActualConversion );
+ virtual void Parse( XNODE* aNode,
+ int aLayer,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
virtual void SetPosOffset( int aX_offs, int aY_offs ) override;
virtual void Flip() override;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.cpp
index 3d60888b0..c43874418 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.cpp
@@ -50,9 +50,9 @@ PCB_COPPER_POUR::~PCB_COPPER_POUR()
}
-bool PCB_COPPER_POUR::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+bool PCB_COPPER_POUR::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
wxString pourType, str, propValue;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.h b/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.h
index b556fa8b4..feb5e99ee 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_copper_pour.h
@@ -44,8 +44,8 @@ public:
~PCB_COPPER_POUR();
virtual bool Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion ) override;
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion ) override;
};
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.cpp
index 4499783ea..39a0d6fca 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.cpp
@@ -46,9 +46,9 @@ PCB_CUTOUT::~PCB_CUTOUT()
}
-bool PCB_CUTOUT::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+bool PCB_CUTOUT::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.h b/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.h
index 1265df2ed..86f7b9ce8 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_cutout.h
@@ -43,9 +43,9 @@ public:
PCB_CUTOUT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard, int aPCadLayer );
~PCB_CUTOUT();
- virtual bool Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion ) override;
+ virtual bool Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& actualConversion ) override;
};
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.cpp
index d6305b334..8aee07fdb 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.cpp
@@ -49,9 +49,9 @@ PCB_KEEPOUT::~PCB_KEEPOUT()
}
-bool PCB_KEEPOUT::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+bool PCB_KEEPOUT::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.h b/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.h
index fbd1c57a4..dde890435 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_keepout.h
@@ -43,8 +43,8 @@ public:
~PCB_KEEPOUT();
virtual bool Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion ) override;
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion ) override;
};
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
index bc24d297c..7bcd1d780 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.cpp
@@ -51,10 +51,10 @@ PCB_LINE::~PCB_LINE()
}
-void PCB_LINE::Parse( XNODE* aNode,
- int aLayer,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_LINE::Parse( XNODE* aNode,
+ int aLayer,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
wxString propValue;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_line.h b/pcbnew/pcad2kicadpcb_plugin/pcb_line.h
index 3bbec94ca..556e88822 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_line.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_line.h
@@ -47,10 +47,10 @@ public:
PCB_LINE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_LINE();
- virtual void Parse( XNODE* aNode,
- int aLayer,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ virtual void Parse( XNODE* aNode,
+ int aLayer,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
virtual void SetPosOffset( int aX_offs, int aY_offs ) override;
virtual void Flip() override;
void AddToModule( MODULE* aModule ) override;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_module.cpp
index 44946ecbd..ec039b3b5 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;
@@ -369,7 +369,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;
@@ -388,7 +388,8 @@ void PCB_MODULE::SetName( wxString aPin, wxString aName )
void PCB_MODULE::Parse( XNODE* aNode, wxStatusBar* aStatusBar,
- wxString aDefaultMeasurementUnit, wxString aActualConversion )
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode, * tNode, * mNode;
PCB_PAD* pad;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
index 356e36b32..c2da5bb69 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_module.h
@@ -48,19 +48,20 @@ 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 );
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
virtual void Flip() override;
void AddToBoard() override;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
index f8f44e65e..0d0923733 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.cpp
@@ -56,8 +56,9 @@ PCB_PAD::~PCB_PAD()
}
-void PCB_PAD::Parse( XNODE* aNode, wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_PAD::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode, *cNode;
long num;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h
index 3bf76ddc8..a14a101e7 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad.h
@@ -48,9 +48,9 @@ public:
PCB_PAD( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD();
- virtual void Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ virtual void Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
virtual void Flip() override;
void AddToModule( MODULE* aModule ) override
{
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.cpp
index 699f51fac..82ca1c92e 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.cpp
@@ -50,9 +50,9 @@ PCB_PAD_SHAPE::~PCB_PAD_SHAPE()
}
-void PCB_PAD_SHAPE::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_PAD_SHAPE::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
wxString str, s;
long num;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.h b/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.h
index 518f0898d..5398eab2c 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_pad_shape.h
@@ -47,9 +47,9 @@ public:
PCB_PAD_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_PAD_SHAPE();
- virtual void Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ virtual void Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
void AddToBoard() override;
};
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_plane.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_plane.cpp
index 29e8b2bba..d4075f61c 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_plane.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_plane.cpp
@@ -49,9 +49,9 @@ PCB_PLANE::~PCB_PLANE()
}
-bool PCB_PLANE::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+bool PCB_PLANE::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
wxString pourType, str, propValue;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_plane.h b/pcbnew/pcad2kicadpcb_plugin/pcb_plane.h
index 93a8524fc..6a173162b 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_plane.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_plane.h
@@ -43,8 +43,8 @@ public:
~PCB_PLANE();
virtual bool Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion ) override;
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion ) override;
};
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.cpp
index e6cd534ad..38dabf553 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,8 @@ 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;
@@ -123,9 +124,9 @@ void PCB_POLYGON::FormPolygon( XNODE* aNode, VERTICES_ARRAY* aPolygon,
}
-bool PCB_POLYGON::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+bool PCB_POLYGON::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
wxString propValue;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h
index a6623edd7..c0eb27ae1 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_polygon.h
@@ -52,8 +52,8 @@ public:
~PCB_POLYGON();
virtual bool Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
virtual void SetPosOffset( int aX_offs, int aY_offs ) override;
virtual void Flip() override;
@@ -61,11 +61,12 @@ 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/pcb_text.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp
index 5c1b19a34..2d0e33c6c 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_text.cpp
@@ -48,10 +48,10 @@ PCB_TEXT::~PCB_TEXT()
}
-void PCB_TEXT::Parse( XNODE* aNode,
- int aLayer,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_TEXT::Parse( XNODE* aNode,
+ int aLayer,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
wxString str;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_text.h b/pcbnew/pcad2kicadpcb_plugin/pcb_text.h
index 1fe856b2c..d623d0503 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_text.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_text.h
@@ -44,10 +44,10 @@ public:
PCB_TEXT( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_TEXT();
- virtual void Parse( XNODE* aNode,
- int aLayer,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion );
+ virtual void Parse( XNODE* aNode,
+ int aLayer,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion );
void AddToModule( MODULE* aModule ) override;
void AddToBoard() override;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_via.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_via.cpp
index 49789d1d5..92ed1e442 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_via.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_via.cpp
@@ -46,8 +46,9 @@ PCB_VIA::~PCB_VIA()
}
-void PCB_VIA::Parse( XNODE* aNode, wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_VIA::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode, * tNode;
wxString propValue;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_via.h b/pcbnew/pcad2kicadpcb_plugin/pcb_via.h
index d29ac7d8f..557c7ac16 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_via.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_via.h
@@ -44,9 +44,9 @@ public:
PCB_VIA( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA();
- virtual void Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion ) override;
+ virtual void Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion ) override;
};
} // namespace PCAD2KICAD
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.cpp b/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.cpp
index 70e6d609c..3aeedf7da 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.cpp
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.cpp
@@ -47,9 +47,9 @@ PCB_VIA_SHAPE::~PCB_VIA_SHAPE()
}
-void PCB_VIA_SHAPE::Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion )
+void PCB_VIA_SHAPE::Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion )
{
XNODE* lNode;
wxString str;
diff --git a/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.h b/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.h
index 9eb222d02..42a5262e3 100644
--- a/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.h
+++ b/pcbnew/pcad2kicadpcb_plugin/pcb_via_shape.h
@@ -42,9 +42,9 @@ public:
PCB_VIA_SHAPE( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
~PCB_VIA_SHAPE();
- virtual void Parse( XNODE* aNode,
- wxString aDefaultMeasurementUnit,
- wxString aActualConversion ) override;
+ virtual void Parse( XNODE* aNode,
+ const wxString& aDefaultMeasurementUnit,
+ const wxString& aActualConversion ) override;
};
} // namespace PCAD2KICAD
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 00867cebc..522de670b 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 f301304e9..67f93c0d1 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 efb29e860..8db250f2d 100644
--- a/pcbnew/router/pns_kicad_iface.cpp
+++ b/pcbnew/router/pns_kicad_iface.cpp
@@ -84,7 +84,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;
@@ -225,7 +225,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 ff193f753..b09e4a10e 100644
--- a/pcbnew/specctra.cpp
+++ b/pcbnew/specctra.cpp
@@ -3435,7 +3435,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 )
{
@@ -3449,7 +3449,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 ac6fb94be..5b86e276c 100644
--- a/pcbnew/specctra.h
+++ b/pcbnew/specctra.h
@@ -3819,7 +3819,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>------------------------------------------------------
@@ -3931,7 +3931,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
@@ -3962,7 +3962,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 587fc3a0e..71a0c2484 100644
--- a/pcbnew/specctra_export.cpp
+++ b/pcbnew/specctra_export.cpp
@@ -1497,7 +1497,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 e240c0266..4d75fe91f 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 d7838257c..c05453078 100644
--- a/polygon/poly2tri/sweep/cdt.cc
+++ b/polygon/poly2tri/sweep/cdt.cc
@@ -30,11 +30,13 @@
*/
#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;
}
diff --git a/polygon/poly2tri/sweep/sweep_context.cc b/polygon/poly2tri/sweep/sweep_context.cc
index 6c0b0447d..1abd81694 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 {
@@ -45,7 +46,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..1cef84e22 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>
@@ -1556,7 +1557,7 @@ OTHER_OUTLINE::OTHER_OUTLINE( IDF3_BOARD* aParent )
return;
}
-bool OTHER_OUTLINE::SetOutlineIdentifier( const std::string aUniqueID )
+bool OTHER_OUTLINE::SetOutlineIdentifier( const std::string& aUniqueID )
{
#ifndef DISABLE_IDF_OWNERSHIP
if( !CheckOwnership( __LINE__, __FUNCTION__, parent, owner, outlineType, errormsg ) )
@@ -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_outlines.h b/utils/idftools/idf_outlines.h
index 74149ab4f..36f190513 100644
--- a/utils/idftools/idf_outlines.h
+++ b/utils/idftools/idf_outlines.h
@@ -382,7 +382,7 @@ public:
* sets the Outline Identifier string of this OTHER_OUTLINE object
* as per IDFv3 spec.
*/
- virtual bool SetOutlineIdentifier( const std::string aUniqueID );
+ virtual bool SetOutlineIdentifier( const std::string& aUniqueID );
/**
* Function GetOutlineIdentifier
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.14.3--
From e448fc90f952703437c18bc9ac9b729b4870b5aa Mon Sep 17 00:00:00 2001
From: Camille <camille019@xxxxxxxxxxx>
Date: Sun, 24 Sep 2017 13:06:10 +0200
Subject: [PATCH 3/4] Fix type promotion in math function
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.14.3"
This is a multi-part message in MIME format.
--------------2.14.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
.../3d_render_raytracing/PerlinNoise.cpp | 21 +++++++++++----------
3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp | 8 +++++---
2 files changed, 16 insertions(+), 13 deletions(-)
--------------2.14.3
Content-Type: text/x-patch; name="0003-Fix-type-promotion-in-math-function.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0003-Fix-type-promotion-in-math-function.patch"
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/PerlinNoise.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/PerlinNoise.cpp
index daf4fd321..523edb619 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/PerlinNoise.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/PerlinNoise.cpp
@@ -40,6 +40,7 @@
*/
#include "PerlinNoise.h"
+#include <cmath>
#include <iostream>
#include <cmath>
#include <random>
@@ -97,14 +98,14 @@ PerlinNoise::PerlinNoise( unsigned int seed )
float PerlinNoise::noise( float x, float y, float z ) const
{
// Find the unit cube that contains the point
- int X = (int) ((float)floor( x )) & 255;
- int Y = (int) ((float)floor( y )) & 255;
- int Z = (int) ((float)floor( z )) & 255;
+ int X = static_cast<int>( std::floor( x ) ) & 255;
+ int Y = static_cast<int>( std::floor( y ) ) & 255;
+ int Z = static_cast<int>( std::floor( z ) ) & 255;
// Find relative x, y,z of point in cube
- x -= (float)floor( x );
- y -= (float)floor( y );
- z -= (float)floor( z );
+ x -= std::floor( x );
+ y -= std::floor( y );
+ z -= std::floor( z );
// Compute fade curves for each of x, y, z
const float u = fade( x );
@@ -143,12 +144,12 @@ float PerlinNoise::noise( float x, float y, float z ) const
float PerlinNoise::noise( float x, float y ) const
{
// Find the unit cube that contains the point
- int X = (int) ((float)floor( x )) & 255;
- int Y = (int) ((float)floor( y )) & 255;
+ int X = static_cast<int>( std::floor( x ) ) & 255;
+ int Y = static_cast<int>( std::floor( y ) ) & 255;
// Find relative x, y,z of point in cube
- x -= (float)floor( x );
- y -= (float)floor( y );
+ x -= std::floor( x );
+ y -= std::floor( y );
// Compute fade curves for each of x, y
const float u = fade( x );
diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp
index 5a7104171..6f556b992 100644
--- a/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp
+++ b/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp
@@ -33,6 +33,8 @@
#include <stdio.h>
#include <wx/debug.h>
+#include <cmath>
+
//static unsigned int gs_next_rayID = 0;
void RAY::Init( const SFVEC3F& o, const SFVEC3F& d )
@@ -185,7 +187,7 @@ bool IntersectSegment( const SFVEC2F &aStartA, const SFVEC2F &aEnd_minus_startA,
aEnd_minus_startB.y - aEnd_minus_startA.y *
aEnd_minus_startB.x;
- if( fabs(rxs) > glm::epsilon<float>() )
+ if( std::abs(rxs) > glm::epsilon<float>() )
{
float inv_rxs = 1.0f / rxs;
@@ -294,7 +296,7 @@ bool RAYSEG2D::IntersectSegment( const SFVEC2F &aStart,
aEnd_minus_start.y - m_End_minus_start.y *
aEnd_minus_start.x;
- if( fabs( rxs ) > glm::epsilon<float>() )
+ if( std::abs( rxs ) > glm::epsilon<float>() )
{
const float inv_rxs = 1.0f / rxs;
@@ -371,7 +373,7 @@ bool RAYSEG2D::IntersectCircle( const SFVEC2F &aCenter,
// Otherwise check and make sure that the intersections occur on the ray (t
// > 0) and return the closer one
- const float discriminant = sqrt( discriminantsqr );
+ const float discriminant = std::sqrt( discriminantsqr );
const float t1 = (-qd - discriminant);
const float t2 = (-qd + discriminant);
--------------2.14.3--
From 21abebf2571e83b190867264e5e0546c02ede572 Mon Sep 17 00:00:00 2001
From: Camille <camille019@xxxxxxxxxxx>
Date: Sun, 24 Sep 2017 20:11:58 +0200
Subject: [PATCH 4/4] Fix loop variable copy in for-range loop, use const
reference instead
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="------------2.14.3"
This is a multi-part message in MIME format.
--------------2.14.3
Content-Type: text/plain; charset=UTF-8; format=fixed
Content-Transfer-Encoding: 8bit
---
3d-viewer/3d_cache/3d_filename_resolver.cpp | 2 +-
3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp | 2 +-
common/dialogs/wx_html_report_panel.cpp | 4 ++--
common/tool/tool_event.cpp | 2 +-
eeschema/cmp_tree_model_adapter_base.cpp | 2 +-
eeschema/dialogs/dialog_bom_editor.cpp | 2 +-
eeschema/files-io.cpp | 6 +++---
eeschema/netlist_exporters/netlist_exporter_pspice.cpp | 2 +-
eeschema/sch_sheet.cpp | 6 +++---
eeschema/selpart.cpp | 2 +-
eeschema/symbol_lib_table.cpp | 2 +-
eeschema/viewlib_frame.cpp | 2 +-
kicad/prjconfig.cpp | 4 ++--
kicad/project_template.cpp | 4 ++--
pcbnew/clean.cpp | 2 +-
pcbnew/connectivity_algo.cpp | 14 +++++++-------
pcbnew/router/pns_diff_pair.cpp | 2 +-
17 files changed, 30 insertions(+), 30 deletions(-)
--------------2.14.3
Content-Type: text/x-patch; name="0004-Fix-loop-variable-copy-in-for-range-loop-use-const-r.patch"
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="0004-Fix-loop-variable-copy-in-for-range-loop-use-const-r.patch"
diff --git a/3d-viewer/3d_cache/3d_filename_resolver.cpp b/3d-viewer/3d_cache/3d_filename_resolver.cpp
index 2e6000170..82ff7dfc7 100644
--- a/3d-viewer/3d_cache/3d_filename_resolver.cpp
+++ b/3d-viewer/3d_cache/3d_filename_resolver.cpp
@@ -187,7 +187,7 @@ bool S3D_FILENAME_RESOLVER::createPathList( void )
if( GetKicadPaths( epaths ) )
{
- for( auto i : epaths )
+ for( const auto& i : epaths )
{
wxString pathVal = ExpandEnvVarSubstitutions( i );
diff --git a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp
index ceb85e9b4..19c9ed9c3 100644
--- a/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp
+++ b/3d-viewer/3d_cache/dialogs/dlg_3d_pathconfig.cpp
@@ -341,7 +341,7 @@ void DLG_3D_PATH_CONFIG::updateEnvVars( void )
int j = 0;
- for( auto i : epaths )
+ for( const auto& i : epaths )
{
wxString val = ExpandEnvVarSubstitutions( i );
m_EnvVars->SetCellValue( j, 0, i );
diff --git a/common/dialogs/wx_html_report_panel.cpp b/common/dialogs/wx_html_report_panel.cpp
index 57937b6db..6ed282678 100644
--- a/common/dialogs/wx_html_report_panel.cpp
+++ b/common/dialogs/wx_html_report_panel.cpp
@@ -103,7 +103,7 @@ void WX_HTML_REPORT_PANEL::refreshView()
{
wxString html;
- for( REPORT_LINE l : m_report )
+ for( const REPORT_LINE& l : m_report )
{
html += generateHtml( l );
}
@@ -271,7 +271,7 @@ void WX_HTML_REPORT_PANEL::onBtnSaveToFile( wxCommandEvent& event )
return;
}
- for( REPORT_LINE l : m_report )
+ for( const REPORT_LINE& l : m_report )
{
f.Write( generatePlainText( l ) );
}
diff --git a/common/tool/tool_event.cpp b/common/tool/tool_event.cpp
index 044feffb6..6bc276306 100644
--- a/common/tool/tool_event.cpp
+++ b/common/tool/tool_event.cpp
@@ -155,7 +155,7 @@ const std::string TOOL_EVENT_LIST::Format() const
{
std::string s;
- for( TOOL_EVENT e : m_events )
+ for( const TOOL_EVENT& e : m_events )
s += e.Format() + " ";
return s;
diff --git a/eeschema/cmp_tree_model_adapter_base.cpp b/eeschema/cmp_tree_model_adapter_base.cpp
index 0e95de012..041d02ca0 100644
--- a/eeschema/cmp_tree_model_adapter_base.cpp
+++ b/eeschema/cmp_tree_model_adapter_base.cpp
@@ -120,7 +120,7 @@ void CMP_TREE_MODEL_ADAPTER_BASE::AddLibrariesWithProgress(
unsigned int ii = 0;
- for( auto nickname : aNicknames )
+ for( const auto& nickname : aNicknames )
{
if( prg )
prg->Update( ii++, wxString::Format( _( "Loading library \"%s\"" ), nickname ) );
diff --git a/eeschema/dialogs/dialog_bom_editor.cpp b/eeschema/dialogs/dialog_bom_editor.cpp
index 3d1b0323c..7dd8b6a01 100644
--- a/eeschema/dialogs/dialog_bom_editor.cpp
+++ b/eeschema/dialogs/dialog_bom_editor.cpp
@@ -198,7 +198,7 @@ void DIALOG_BOM_EDITOR::ApplyAllChanges()
ITEM_PICKER picker;
// Iterate through each of the components that were changed
- for( auto ref : changed )
+ for( const auto& ref : changed )
{
// Extract the SCH_COMPONENT* object
auto cmp = ref.GetComp();
diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp
index e33431323..a61404290 100644
--- a/eeschema/files-io.cpp
+++ b/eeschema/files-io.cpp
@@ -501,7 +501,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
newScreens.GetLibNicknames( names );
wxArrayString newLibNames;
- for( auto name : names )
+ for( const auto& name : names )
{
if( !Prj().SchSymbolLibTable()->HasLibrary( name ) )
newLibNames.Add( name );
@@ -526,7 +526,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
if( !table.IsEmpty() )
{
- for( auto libName : newLibNames )
+ for( const auto& libName : newLibNames )
{
if( !table.HasLibrary( libName ) )
continue;
@@ -602,7 +602,7 @@ bool SCH_EDIT_FRAME::AppendSchematic()
SCH_SCREEN* newScreen = newSheet->GetScreen();
wxCHECK_MSG( newScreen, false, "No screen defined for imported sheet." );
- for( auto duplicateName : duplicateSheetNames )
+ for( const auto& duplicateName : duplicateSheetNames )
{
SCH_SHEET* renamedSheet = newScreen->GetSheet( duplicateName );
diff --git a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
index e67f71515..18a5c0c5d 100644
--- a/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
+++ b/eeschema/netlist_exporters/netlist_exporter_pspice.cpp
@@ -69,7 +69,7 @@ bool NETLIST_EXPORTER_PSPICE::Format( OUTPUTFORMATTER* aFormatter, unsigned aCtl
aFormatter->Print( 0, ".title KiCad schematic\n" );
// Write .include directives
- for( auto lib : m_libraries )
+ for( const auto& lib : m_libraries )
{
wxString full_path;
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 127696489..91d1237dc 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -207,7 +207,7 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
bool SCH_SHEET::HasPin( const wxString& aName )
{
- for( SCH_SHEET_PIN pin : m_pins )
+ for( const SCH_SHEET_PIN& pin : m_pins )
{
if( pin.GetText().CmpNoCase( aName ) == 0 )
return true;
@@ -219,7 +219,7 @@ bool SCH_SHEET::HasPin( const wxString& aName )
bool SCH_SHEET::IsVerticalOrientation() const
{
- for( SCH_SHEET_PIN pin : m_pins )
+ for( const SCH_SHEET_PIN& pin : m_pins )
{
if( pin.GetEdge() > 1 )
return true;
@@ -230,7 +230,7 @@ bool SCH_SHEET::IsVerticalOrientation() const
bool SCH_SHEET::HasUndefinedPins()
{
- for( SCH_SHEET_PIN pin : m_pins )
+ for( const SCH_SHEET_PIN& pin : m_pins )
{
/* Search the schematic for a hierarchical label corresponding to this sheet label. */
EDA_ITEM* DrawStruct = m_screen->GetDrawItems();
diff --git a/eeschema/selpart.cpp b/eeschema/selpart.cpp
index d4d6bf88d..b038ab8c0 100644
--- a/eeschema/selpart.cpp
+++ b/eeschema/selpart.cpp
@@ -91,7 +91,7 @@ wxString SCH_BASE_FRAME::SelectLibraryFromList()
std::vector< wxString > libNicknames = prj.SchSymbolLibTable()->GetLogicalLibs();
// Conversion from wxArrayString to vector of ArrayString
- for( auto name : libNicknames )
+ for( const auto& name : libNicknames )
{
wxArrayString item;
diff --git a/eeschema/symbol_lib_table.cpp b/eeschema/symbol_lib_table.cpp
index 642a98967..32e001101 100644
--- a/eeschema/symbol_lib_table.cpp
+++ b/eeschema/symbol_lib_table.cpp
@@ -240,7 +240,7 @@ int SYMBOL_LIB_TABLE::GetModifyHash()
int hash = 0;
std::vector< wxString > libNames = GetLogicalLibs();
- for( auto libName : libNames )
+ for( const auto& libName : libNames )
{
const SYMBOL_LIB_TABLE_ROW* row = FindRow( libName );
diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp
index 7a2cf0007..02d4ba03b 100644
--- a/eeschema/viewlib_frame.cpp
+++ b/eeschema/viewlib_frame.cpp
@@ -469,7 +469,7 @@ bool LIB_VIEW_FRAME::ReCreateListLib()
wxArrayString libNames;
- for( auto name : libs )
+ for( const auto& name : libs )
libNames.Add( name );
m_libList->Append( libNames );
diff --git a/kicad/prjconfig.cpp b/kicad/prjconfig.cpp
index ee0f01cd2..ad16fadc3 100644
--- a/kicad/prjconfig.cpp
+++ b/kicad/prjconfig.cpp
@@ -351,7 +351,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
{
std::vector< wxFileName > overwrittenFiles;
- for( auto file : destFiles )
+ for( const auto& file : destFiles )
{
if( file.FileExists() )
overwrittenFiles.push_back( file );
@@ -361,7 +361,7 @@ void KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate( wxCommandEvent& event )
{
wxString extendedMsg = _( "Overwriting files:" ) + "\n";
- for( auto file : overwrittenFiles )
+ for( const auto& file : overwrittenFiles )
{
extendedMsg += "\n" + file.GetFullName();
}
diff --git a/kicad/project_template.cpp b/kicad/project_template.cpp
index f541ccf07..af82fc824 100644
--- a/kicad/project_template.cpp
+++ b/kicad/project_template.cpp
@@ -123,7 +123,7 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
// Find the template file name base. this is the name of the .pro template file
wxString basename;
- for( auto file : srcFiles )
+ for( const auto& file : srcFiles )
{
if( file.GetExt() == wxT( "pro" ) )
{
@@ -132,7 +132,7 @@ size_t PROJECT_TEMPLATE::GetDestinationFiles( const wxFileName& aNewProjectPath,
}
}
- for( auto file : srcFiles )
+ for( const auto& file : srcFiles )
{
wxFileName destFile = file;
diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp
index bcfd5b7d9..eb4494c79 100644
--- a/pcbnew/clean.cpp
+++ b/pcbnew/clean.cpp
@@ -365,7 +365,7 @@ bool TRACKS_CLEANER::testTrackEndpointDangling( TRACK* aTrack, ENDPOINT_T aEndPo
auto anchors = citem->Anchors();
- for( auto anchor : anchors )
+ for( const auto& anchor : anchors )
{
if( anchor->Pos() == endpoint && anchor->IsDangling() )
return true;
diff --git a/pcbnew/connectivity_algo.cpp b/pcbnew/connectivity_algo.cpp
index 88913b2bd..c00fd0447 100644
--- a/pcbnew/connectivity_algo.cpp
+++ b/pcbnew/connectivity_algo.cpp
@@ -797,7 +797,7 @@ void CN_CONNECTIVITY_ALGO::Build( const std::vector<BOARD_ITEM*>& aItems )
void CN_CONNECTIVITY_ALGO::propagateConnections()
{
- for( auto cluster : m_connClusters )
+ for( const auto& cluster : m_connClusters )
{
if( cluster->IsConflicting() )
{
@@ -862,7 +862,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( ZONE_CONTAINER* aZone, std
m_connClusters = SearchClusters( CSM_CONNECTIVITY_CHECK );
- for( auto cluster : m_connClusters )
+ for( const auto& cluster : m_connClusters )
{
if( cluster->Contains( aZone ) && cluster->IsOrphaned() )
{
@@ -897,7 +897,7 @@ void CN_CONNECTIVITY_ALGO::FindIsolatedCopperIslands( std::vector<CN_ZONE_ISOLAT
if( zone.m_zone->GetFilledPolysList().IsEmpty() )
continue;
- for( auto cluster : m_connClusters )
+ for( const auto& cluster : m_connClusters )
{
if( cluster->Contains( zone.m_zone ) && cluster->IsOrphaned() )
{
@@ -1051,16 +1051,16 @@ void CN_CONNECTIVITY_ALGO::ForEachItem( const std::function<void( CN_ITEM& )>& a
void CN_CONNECTIVITY_ALGO::ForEachAnchor( const std::function<void( CN_ANCHOR& )>& aFunc )
{
- for( auto anchor : m_padList.Anchors() )
+ for( const auto& anchor : m_padList.Anchors() )
aFunc( *anchor );
- for( auto anchor : m_viaList.Anchors() )
+ for( const auto& anchor : m_viaList.Anchors() )
aFunc( *anchor );
- for( auto anchor : m_trackList.Anchors() )
+ for( const auto& anchor : m_trackList.Anchors() )
aFunc( *anchor );
- for( auto anchor : m_zoneList.Anchors() )
+ for( const auto& anchor : m_zoneList.Anchors() )
aFunc( *anchor );
}
diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp
index 67f93c0d1..e603f196e 100644
--- a/pcbnew/router/pns_diff_pair.cpp
+++ b/pcbnew/router/pns_diff_pair.cpp
@@ -309,7 +309,7 @@ const DIFF_PAIR DP_GATEWAY::Entry() const
void DP_GATEWAYS::BuildOrthoProjections( DP_GATEWAYS& aEntries,
const VECTOR2I& aCursorPos, int aOrthoScore )
{
- for( DP_GATEWAY g : aEntries.Gateways() )
+ for( const DP_GATEWAY& g : aEntries.Gateways() )
{
VECTOR2I midpoint( ( g.AnchorP() + g.AnchorN() ) / 2 );
SEG guide_s( midpoint, midpoint + VECTOR2I( 1, 0 ) );
--------------2.14.3--
Follow ups
References