Coverity issue fixes.

This commit is contained in:
Wayne Stambaugh 2023-08-27 15:16:29 -04:00
parent f4bf3bf611
commit e4feb8826b
7 changed files with 19 additions and 9 deletions

View File

@ -461,6 +461,9 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
if( symbol->IsAlias() ) if( symbol->IsAlias() )
{ {
LIB_SYMBOL_SPTR parent = symbol->GetRootSymbol().lock(); LIB_SYMBOL_SPTR parent = symbol->GetRootSymbol().lock();
wxCHECK( parent, CLI::EXIT_CODES::ERR_UNKNOWN );
symbolToPlot = parent.get(); symbolToPlot = parent.get();
} }

View File

@ -431,6 +431,8 @@ INSPECT_RESULT GENERAL_COLLECTOR::Inspect( EDA_ITEM* aTestItem, void* aTestData
} }
else if( aTestItem->Type() == PCB_FOOTPRINT_T ) else if( aTestItem->Type() == PCB_FOOTPRINT_T )
{ {
wxCHECK( footprint, INSPECT_RESULT::CONTINUE );
if( footprint->HitTest( m_refPos, accuracy ) if( footprint->HitTest( m_refPos, accuracy )
&& footprint->HitTestAccurate( m_refPos, accuracy ) ) && footprint->HitTestAccurate( m_refPos, accuracy ) )
{ {

View File

@ -292,6 +292,7 @@ void DIALOG_EXPORT_SVG::ExportSVGFile( bool aOnlyOneFile )
svgPlotOptions.m_colorTheme = ""; // will use default svgPlotOptions.m_colorTheme = ""; // will use default
svgPlotOptions.m_mirror = m_printMirror; svgPlotOptions.m_mirror = m_printMirror;
svgPlotOptions.m_plotFrame = svgPlotOptions.m_pageSizeMode == 0; svgPlotOptions.m_plotFrame = svgPlotOptions.m_pageSizeMode == 0;
svgPlotOptions.m_drillShapeOption = 2; // actual size hole.
for( LSEQ seq = all_selected.Seq(); seq; ++seq ) for( LSEQ seq = all_selected.Seq(); seq; ++seq )
{ {

View File

@ -424,8 +424,8 @@ void DP_GATEWAYS::BuildFromPrimitivePair( const DP_PRIMITIVE_PAIR& aPair, bool a
{ {
VECTOR2I majorDirection; VECTOR2I majorDirection;
VECTOR2I p0_p, p0_n; VECTOR2I p0_p, p0_n;
int orthoFanDistance; int orthoFanDistance = 0;
int diagFanDistance; int diagFanDistance = 0;
const SHAPE* shP = nullptr; const SHAPE* shP = nullptr;
if( aPair.PrimP() == nullptr ) if( aPair.PrimP() == nullptr )

View File

@ -239,6 +239,7 @@ bool ITEM::collideSimple( const ITEM* aHead, const NODE* aNode,
obs.m_head = const_cast<ITEM*>( aHead ); obs.m_head = const_cast<ITEM*>( aHead );
obs.m_item = const_cast<ITEM*>( this ); obs.m_item = const_cast<ITEM*>( this );
obs.m_clearance = clearance; obs.m_clearance = clearance;
obs.m_distFirst = 0;
aCtx->obstacles.insert( obs ); aCtx->obstacles.insert( obs );
} }
else else

View File

@ -41,7 +41,7 @@ public:
if( aInitialItem ) if( aInitialItem )
m_items.emplace_back( aInitialItem ); m_items.emplace_back( aInitialItem );
if( aBecomeOwner ) if( aBecomeOwner && aInitialItem )
aInitialItem->SetOwner( this ); aInitialItem->SetOwner( this );
} }

View File

@ -124,8 +124,8 @@ bool ROUTER::RoutingInProgress() const
const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance ) const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
{ {
NODE* node; NODE* node = nullptr;
int clearance; int clearance = 0;
if( m_state == IDLE || m_placer == nullptr ) if( m_state == IDLE || m_placer == nullptr )
{ {
@ -154,12 +154,15 @@ const ITEM_SET ROUTER::QueryHoverItems( const VECTOR2I& aP, bool aUseClearance )
opts.m_differentNetsOnly = false; opts.m_differentNetsOnly = false;
opts.m_overrideClearance = clearance; opts.m_overrideClearance = clearance;
node->QueryColliding( &test, obs, opts );
PNS::ITEM_SET ret; PNS::ITEM_SET ret;
for( const OBSTACLE& obstacle : obs ) wxCHECK( node, ret );
ret.Add( obstacle.m_item, false );
node->QueryColliding( &test, obs, opts );
for( const OBSTACLE& obstacle : obs )
ret.Add( obstacle.m_item, false );
return ret; return ret;
} }