Coverity fixes

This commit is contained in:
Jon Evans 2024-04-05 08:16:29 -04:00
parent c1e7668d80
commit 7baccba01c
5 changed files with 11 additions and 7 deletions

View File

@ -82,6 +82,9 @@ void PackPolyLine( kiapi::common::types::PolyLine& aOutput, const SHAPE_LINE_CHA
{
for( int vertex = 0; vertex < aSlc.PointCount(); vertex = aSlc.NextShape( vertex ) )
{
if( vertex < 0 )
break;
kiapi::common::types::PolyLineNode* node = aOutput.mutable_nodes()->Add();
if( aSlc.IsPtOnArc( vertex ) )

View File

@ -432,7 +432,7 @@ DIALOG_LIB_FIELD_PROPERTIES::DIALOG_LIB_FIELD_PROPERTIES( SCH_BASE_FRAME* aParen
if( m_fieldId == FOOTPRINT_FIELD )
{
const LIB_SYMBOL* parentSymbol = dynamic_cast<const LIB_SYMBOL*>( aField->GetParentSymbol() );
const LIB_SYMBOL* parentSymbol = static_cast<const LIB_SYMBOL*>( aField->GetParentSymbol() );
/*
* Symbol netlist format:

View File

@ -137,7 +137,7 @@ DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES( SYMBOL_EDIT_FRAME* parent, LIB_PIN
m_initialized( false )
{
// Creates a dummy pin to show on a panel, inside this dialog:
m_dummyParent = new LIB_SYMBOL( *dynamic_cast<LIB_SYMBOL*>( m_pin->GetParentSymbol() ) );
m_dummyParent = new LIB_SYMBOL( *static_cast<LIB_SYMBOL*>( m_pin->GetParentSymbol() ) );
m_dummyPin = new LIB_PIN( *m_pin );
m_dummyPin->SetParent( m_dummyParent );
m_dummyParent->SetShowPinNames( true );

View File

@ -121,7 +121,7 @@ bool SYMBOL_EDITOR_PIN_TOOL::EditPinProperties( LIB_PIN* aPin )
LIB_PIN original_pin( *aPin );
DIALOG_PIN_PROPERTIES dlg( m_frame, aPin );
SCH_COMMIT commit( m_frame );
LIB_SYMBOL* parentSymbol = dynamic_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() );
LIB_SYMBOL* parentSymbol = static_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() );
if( aPin->GetEditFlags() == 0 )
commit.Modify( parentSymbol );
@ -340,7 +340,7 @@ void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( LIB_PIN* aPin )
if( ii == aPin->GetUnit() )
continue;
newPin = (LIB_PIN*) aPin->Duplicate();
newPin = static_cast<LIB_PIN*>( aPin->Duplicate() );
// To avoid mistakes, gives this pin a new pin number because
// it does no have the save pin number as the master pin
@ -353,7 +353,8 @@ void SYMBOL_EDITOR_PIN_TOOL::CreateImagePins( LIB_PIN* aPin )
try
{
dynamic_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() )->AddDrawItem( newPin );
LIB_SYMBOL* symbol = static_cast<LIB_SYMBOL*>( aPin->GetParentSymbol() );
symbol->AddDrawItem( newPin );
}
catch( const boost::bad_pointer& e )
{

View File

@ -154,9 +154,9 @@ int SYMBOL_SEARCH_HANDLER::Search( const wxString& aQuery )
auto search =
[frp]( SCH_ITEM* item, SCH_SHEET_PATH* sheet )
{
if( item->Type() == SCH_SYMBOL_T )
if( item && item->Type() == SCH_SYMBOL_T )
{
SCH_SYMBOL* sym = dynamic_cast<SCH_SYMBOL*>( item );
SCH_SYMBOL* sym = static_cast<SCH_SYMBOL*>( item );
// IsPower depends on non-missing lib symbol association
if( !sym->IsMissingLibSymbol() && sym->IsPower() )