From 49fac351abeb583944fa95e7e7719a7200713580 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 15 Jun 2015 16:01:43 +0200 Subject: [PATCH] Fix a few coverity warnings. --- common/geometry/shape_poly_set.cpp | 18 ++++++++++-------- eeschema/dialogs/dialog_lib_edit_pin_table.cpp | 1 + eeschema/sch_bus_entry.cpp | 2 ++ pcbnew/router/pns_diff_pair.cpp | 3 +++ pcbnew/router/pns_router.cpp | 5 ++++- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp index b6bad11f1a..fdf43f457e 100644 --- a/common/geometry/shape_poly_set.cpp +++ b/common/geometry/shape_poly_set.cpp @@ -515,11 +515,12 @@ bool SHAPE_POLY_SET::Parse( std::stringstream& aStream ) aStream >> tmp; - unsigned int n_polys = atoi( tmp.c_str() ); - if(n_polys < 0) + int n_polys = atoi( tmp.c_str() ); + + if( n_polys < 0 ) return false; - for( unsigned i = 0; i < n_polys; i++ ) + for( int i = 0; i < n_polys; i++ ) { ClipperLib::Paths paths; @@ -528,17 +529,18 @@ bool SHAPE_POLY_SET::Parse( std::stringstream& aStream ) return false; aStream >> tmp; - unsigned int n_outlines = atoi( tmp.c_str() ); - if(n_outlines < 0) + int n_outlines = atoi( tmp.c_str() ); + + if( n_outlines < 0 ) return false; - for( unsigned j = 0; j < n_outlines; j++) + for( int j = 0; j < n_outlines; j++ ) { ClipperLib::Path outline; aStream >> tmp; - unsigned int n_vertices = atoi( tmp.c_str() ); - for( unsigned v = 0; v < n_vertices; v++) + int n_vertices = atoi( tmp.c_str() ); + for( int v = 0; v < n_vertices; v++ ) { ClipperLib::IntPoint p; diff --git a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp index 28b4938cc7..58269191a5 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin_table.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin_table.cpp @@ -526,6 +526,7 @@ void DIALOG_LIB_EDIT_PIN_TABLE::DataViewModel::Group::Add( Pin* aPin ) case 1: m_Members.front()->SetGroup( this ); + break; default: aPin->SetGroup( this ); diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp index 6b3e3b6f8a..019a46eb05 100644 --- a/eeschema/sch_bus_entry.cpp +++ b/eeschema/sch_bus_entry.cpp @@ -51,6 +51,8 @@ SCH_BUS_ENTRY_BASE::SCH_BUS_ENTRY_BASE( KICAD_T aType, const wxPoint& pos, char if( shape == '/' ) m_size.y = -100; + + m_isDanglingStart = m_isDanglingEnd = true; } SCH_BUS_WIRE_ENTRY::SCH_BUS_WIRE_ENTRY( const wxPoint& pos, char shape ) : diff --git a/pcbnew/router/pns_diff_pair.cpp b/pcbnew/router/pns_diff_pair.cpp index 34d25fb567..769b48dbc6 100644 --- a/pcbnew/router/pns_diff_pair.cpp +++ b/pcbnew/router/pns_diff_pair.cpp @@ -66,8 +66,11 @@ PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const VECTOR2I& aAnchorP, const VE PNS_DP_PRIMITIVE_PAIR::PNS_DP_PRIMITIVE_PAIR( const PNS_DP_PRIMITIVE_PAIR& aOther ) { + m_primP = m_primN = NULL; + if( aOther.m_primP ) m_primP = aOther.m_primP->Clone(); + if( aOther.m_primN ) m_primN = aOther.m_primN->Clone(); diff --git a/pcbnew/router/pns_router.cpp b/pcbnew/router/pns_router.cpp index 7278fc6cc2..b235286d6c 100644 --- a/pcbnew/router/pns_router.cpp +++ b/pcbnew/router/pns_router.cpp @@ -94,7 +94,10 @@ PNS_PCBNEW_CLEARANCE_FUNC::PNS_PCBNEW_CLEARANCE_FUNC( PNS_ROUTER *aRouter ) : } m_overrideEnabled = false; - m_defaultClearance = 254000; // aBoard->m_NetClasses.Find ("Default clearance")->GetClearance(); + m_defaultClearance = Millimeter2iu( 0.254 ); // aBoard->m_NetClasses.Find ("Default clearance")->GetClearance(); + m_overrideNetA = 0; + m_overrideNetB = 0; + m_overrideClearance = 0; }