diff --git a/eeschema/tools/backannotate.cpp b/eeschema/tools/backannotate.cpp index 648d756016..171a2297ac 100644 --- a/eeschema/tools/backannotate.cpp +++ b/eeschema/tools/backannotate.cpp @@ -185,8 +185,8 @@ void BACK_ANNOTATE::getPcbModulesFromString( const std::string& aPayload ) continue; // Fields are of the format "(field (name "name") "12345") - const auto fieldName = field.second.get_child_optional( "name" ); - const auto fieldValue = field.second.back().first; + const auto& fieldName = field.second.get_child_optional( "name" ); + const auto& fieldValue = field.second.back().first; if( !fieldName ) continue; diff --git a/libs/kimath/src/geometry/shape_poly_set.cpp b/libs/kimath/src/geometry/shape_poly_set.cpp index 83fb66cf70..09c149f8a6 100644 --- a/libs/kimath/src/geometry/shape_poly_set.cpp +++ b/libs/kimath/src/geometry/shape_poly_set.cpp @@ -671,53 +671,54 @@ void SHAPE_POLY_SET::RebuildHolesFromContours() std::function )> process; - process = [&]( int myId, int parentOutlineId, std::vector path ) - { - std::set relParents = childToParents[myId]; + process = + [&]( int myId, int parentOutlineId, const std::vector& path ) + { + std::set relParents = childToParents[myId]; - for( int pathId : path ) - { - int erased = relParents.erase( pathId ); - wxASSERT( erased > 0 ); - } + for( int pathId : path ) + { + int erased = relParents.erase( pathId ); + wxASSERT( erased > 0 ); + } - wxASSERT( relParents.size() == 0 ); + wxASSERT( relParents.size() == 0 ); - int myOutline = -1; + int myOutline = -1; - bool isOutline = path.size() % 2 == 0; + bool isOutline = path.size() % 2 == 0; - if( isOutline ) - { - int outlineId = result.AddOutline( contours[myId] ); - myOutline = outlineId; - } - else - { - wxASSERT( parentOutlineId != -1 ); - result.AddHole( contours[myId], parentOutlineId ); - } + if( isOutline ) + { + int outlineId = result.AddOutline( contours[myId] ); + myOutline = outlineId; + } + else + { + wxASSERT( parentOutlineId != -1 ); + result.AddHole( contours[myId], parentOutlineId ); + } - auto it = parentToChildren.find( myId ); - if( it != parentToChildren.end() ) - { - std::vector thisPath = path; - thisPath.emplace_back( myId ); + auto it = parentToChildren.find( myId ); + if( it != parentToChildren.end() ) + { + std::vector thisPath = path; + thisPath.emplace_back( myId ); - std::set thisPathSet; - thisPathSet.insert( thisPath.begin(), thisPath.end() ); + std::set thisPathSet; + thisPathSet.insert( thisPath.begin(), thisPath.end() ); - for( int childId : it->second ) - { - const std::set& childPathSet = childToParents[childId]; + for( int childId : it->second ) + { + const std::set& childPathSet = childToParents[childId]; - if( thisPathSet != childPathSet ) - continue; // Only interested in immediate children + if( thisPathSet != childPathSet ) + continue; // Only interested in immediate children - process( childId, myOutline, thisPath ); - } - } - }; + process( childId, myOutline, thisPath ); + } + } + }; for( int topParentId : topLevelParents ) { diff --git a/pcbnew/convert_shape_list_to_polygon.cpp b/pcbnew/convert_shape_list_to_polygon.cpp index c8afb46207..b52627a10c 100644 --- a/pcbnew/convert_shape_list_to_polygon.cpp +++ b/pcbnew/convert_shape_list_to_polygon.cpp @@ -493,7 +493,7 @@ bool doConvertOutlineToPolygon( std::vector& aShapeList, SHAPE_POLY_ parents.push_back( jj ); } - contourToParentIndexesMap[ii] = parents; + contourToParentIndexesMap[ii] = std::move( parents ); } // Next add those that are top-level outlines to the SHAPE_POLY_SET