From 4012aa70dafc3dfe722a59e693a3f5aa24788109 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Thu, 15 Feb 2018 10:16:05 +0100 Subject: [PATCH] Fix a few minor Coverity warnings --- common/convert_basic_shapes_to_polygon.cpp | 3 +-- eeschema/dialogs/dialog_choose_component.cpp | 3 --- include/geometry/shape_arc.h | 1 + include/geometry/shape_poly_set.h | 2 +- pcbnew/zone_filler.cpp | 2 +- 5 files changed, 4 insertions(+), 7 deletions(-) diff --git a/common/convert_basic_shapes_to_polygon.cpp b/common/convert_basic_shapes_to_polygon.cpp index 7e6b3a02a9..cf68cb2286 100644 --- a/common/convert_basic_shapes_to_polygon.cpp +++ b/common/convert_basic_shapes_to_polygon.cpp @@ -102,7 +102,7 @@ void TransformOvalClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, double delta_angle = atan2( (double)endp.y, (double)endp.x ); int seg_len = KiROUND( EuclideanNorm( endp ) ); - double delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree + double delta = 3600.0 / aCircleToSegmentsCount; // rot angle in 0.1 degree // Compute the outlines of the segment, and creates a polygon // Note: the polygonal shape is built from the equivalent horizontal @@ -163,7 +163,6 @@ void TransformOvalClearanceToPolygon( SHAPE_POLY_SET& aCornerBuffer, polyshape.Rotate( delta_angle, VECTOR2I( 0, 0 ) ); polyshape.Move( startp ); - aCornerBuffer.Append( polyshape); } diff --git a/eeschema/dialogs/dialog_choose_component.cpp b/eeschema/dialogs/dialog_choose_component.cpp index c1baea7897..a5f3cc8d6e 100644 --- a/eeschema/dialogs/dialog_choose_component.cpp +++ b/eeschema/dialogs/dialog_choose_component.cpp @@ -483,9 +483,6 @@ void DIALOG_CHOOSE_COMPONENT::RenderPreview( LIB_PART* aComponent, int aUnit ) dc.SetBackground( wxBrush( bgColor.ToColour() ) ); dc.Clear(); - if( !aComponent ) - return; - int unit = aUnit > 0 ? aUnit : 1; int convert = m_deMorganConvert > 0 ? m_deMorganConvert : 1; diff --git a/include/geometry/shape_arc.h b/include/geometry/shape_arc.h index 7b36c1014d..deb78ca2f6 100644 --- a/include/geometry/shape_arc.h +++ b/include/geometry/shape_arc.h @@ -45,6 +45,7 @@ public: m_p0 = aOther.m_p0; m_p1 = aOther.m_p1; m_pc = aOther.m_pc; + m_width = aOther.m_width; } ~SHAPE_ARC() {}; diff --git a/include/geometry/shape_poly_set.h b/include/geometry/shape_poly_set.h index 65728de0ed..ee9144d60f 100644 --- a/include/geometry/shape_poly_set.h +++ b/include/geometry/shape_poly_set.h @@ -67,7 +67,7 @@ class SHAPE_POLY_SET : public SHAPE public: struct TRI { - TRI() + TRI() : a(0), b(0), c(0) { } diff --git a/pcbnew/zone_filler.cpp b/pcbnew/zone_filler.cpp index 9bd5542022..0bd9e340fa 100644 --- a/pcbnew/zone_filler.cpp +++ b/pcbnew/zone_filler.cpp @@ -64,7 +64,7 @@ static double s_thermalRot = 450; // angle of stubs in thermal reliefs for ro static const bool s_DumpZonesWhenFilling = false; ZONE_FILLER::ZONE_FILLER( BOARD* aBoard, COMMIT* aCommit ) : - m_board( aBoard ), m_commit( aCommit ), m_progressReporter( nullptr ) + m_board( aBoard ), m_commit( aCommit ), m_progressReporter( nullptr ), m_count_done( 0 ) { }