From e6945a85b0b44469bfbbe03c3203133577d1908a Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sun, 12 Mar 2023 14:15:38 +0100 Subject: [PATCH] fix compil and Coverity warnings. --- libs/kimath/src/geometry/direction_45.cpp | 2 +- libs/kimath/src/geometry/shape_line_chain.cpp | 3 --- pcbnew/dialogs/dialog_copper_zones.cpp | 2 +- pcbnew/drc/drc_test_provider_library_parity.cpp | 6 ++++++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/kimath/src/geometry/direction_45.cpp b/libs/kimath/src/geometry/direction_45.cpp index ecd1a91339..049b3b23f7 100644 --- a/libs/kimath/src/geometry/direction_45.cpp +++ b/libs/kimath/src/geometry/direction_45.cpp @@ -51,7 +51,7 @@ const SHAPE_LINE_CHAIN DIRECTION_45::BuildInitialTrace( const VECTOR2I& aP0, con } VECTOR2I mp0, mp1; - int tangentLength; + int tangentLength = 0; if( is90mode ) { diff --git a/libs/kimath/src/geometry/shape_line_chain.cpp b/libs/kimath/src/geometry/shape_line_chain.cpp index 22322f23d4..f4e60b2833 100644 --- a/libs/kimath/src/geometry/shape_line_chain.cpp +++ b/libs/kimath/src/geometry/shape_line_chain.cpp @@ -1550,9 +1550,6 @@ int SHAPE_LINE_CHAIN::Intersect( const SHAPE_LINE_CHAIN& aChain, INTERSECTIONS& is.is_corner_our = false; is.is_corner_their = false; - int distA = ( b.A - *p ).EuclideanNorm(); - int distB = ( b.B - *p ).EuclideanNorm(); - if( p == a.A ) { is.is_corner_our = true; diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 711c48a0df..105c6c9d56 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -382,7 +382,7 @@ void DIALOG_COPPER_ZONE::readNetInformation() for( NETINFO_ITEM* net : netInfoList ) { - const int& netCode = net->GetNetCode(); + const int netCode = net->GetNetCode(); const wxString& netName = getUnescapedNetName( net ); m_netNameToNetCode[netName] = netCode; diff --git a/pcbnew/drc/drc_test_provider_library_parity.cpp b/pcbnew/drc/drc_test_provider_library_parity.cpp index 5e3af36269..61b32361a1 100644 --- a/pcbnew/drc/drc_test_provider_library_parity.cpp +++ b/pcbnew/drc/drc_test_provider_library_parity.cpp @@ -154,7 +154,9 @@ bool primitiveNeedsUpdate( const std::shared_ptr& a, TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices(), wxEmptyString); for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii ) + { TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ), wxEmptyString ); + } break; @@ -301,7 +303,9 @@ bool shapeNeedsUpdate( const FP_SHAPE* a, const FP_SHAPE* b ) TEST( a->GetPolyShape().TotalVertices(), b->GetPolyShape().TotalVertices(), wxEmptyString ); for( int ii = 0; ii < a->GetPolyShape().TotalVertices(); ++ii ) + { TEST( a->GetPolyShape().CVertex( ii ), b->GetPolyShape().CVertex( ii ), wxEmptyString ); + } break; @@ -397,7 +401,9 @@ bool zonesNeedUpdate( const FP_ZONE* a, const FP_ZONE* b ) bPoly.Move( parentFootprint->GetPosition() ); for( int ii = 0; ii < a->Outline()->TotalVertices(); ++ii ) + { TEST( aPoly.CVertex( ii ), bPoly.CVertex( ii ) , wxEmptyString); + } return diff; }