Fix a few Coverity warnings.
Mainly not initialized members, and replace not tested dynamic_cast by static_cast.
This commit is contained in:
parent
25f8b1ce72
commit
db7dba96ad
|
@ -27,7 +27,8 @@ DIALOG_EDIT_LIBRARY_TABLES::DIALOG_EDIT_LIBRARY_TABLES( wxWindow* aParent,
|
|||
DIALOG_SHIM( aParent, wxID_ANY, aTitle, wxDefaultPosition, wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
|
||||
m_GlobalTableChanged( false ),
|
||||
m_ProjectTableChanged( false )
|
||||
m_ProjectTableChanged( false ),
|
||||
m_contentPanel( nullptr )
|
||||
{
|
||||
// Construction delayed until after panel is installed
|
||||
}
|
||||
|
|
|
@ -120,6 +120,7 @@ CAIRO_PRINT_GAL::CAIRO_PRINT_GAL( GAL_DISPLAY_OPTIONS& aDisplayOptions,
|
|||
cairo_reference( context );
|
||||
cairo_surface_reference( surface );
|
||||
m_clearColor = COLOR4D( 1.0, 1.0, 1.0, 1.0 );
|
||||
m_hasNativeLandscapeRotation = false;
|
||||
resetContext();
|
||||
SetScreenDPI( m_printCtx->GetNativeDPI() );
|
||||
}
|
||||
|
|
|
@ -447,7 +447,7 @@ void SCH_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
}
|
||||
}
|
||||
|
||||
auto painter = dynamic_cast<KIGFX::SCH_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
|
||||
auto painter = static_cast<KIGFX::SCH_PAINTER*>( GetCanvas()->GetView()->GetPainter() );
|
||||
KIGFX::SCH_RENDER_SETTINGS* settings = painter->GetSettings();
|
||||
settings->m_ShowPinsElectricalType = false;
|
||||
settings->m_ShowHiddenText = false;
|
||||
|
|
|
@ -607,7 +607,7 @@ void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
|
|||
EDA_DRAW_FRAME* frame = aPanel->GetParent();
|
||||
|
||||
if( frame->IsType( FRAME_SCH ) )
|
||||
drawHidden = dynamic_cast<SCH_EDIT_FRAME*>( frame )->GetShowAllPins();
|
||||
drawHidden = static_cast<SCH_EDIT_FRAME*>( frame )->GetShowAllPins();
|
||||
else if( frame->IsType( FRAME_SCH_LIB_EDITOR ) )
|
||||
drawHidden = true; // must be able to edit
|
||||
}
|
||||
|
|
|
@ -101,7 +101,7 @@ void LIB_EDIT_FRAME::BlockMoveSelectedItems( const wxPoint& aOffset, LIB_PART* a
|
|||
item.ClearFlags();
|
||||
}
|
||||
|
||||
// view update
|
||||
// view update
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,7 +140,7 @@ void LIB_EDIT_FRAME::BlockCopySelectedItems( const wxPoint& aOffset, LIB_PART* a
|
|||
|
||||
for( unsigned ii = 0; ii < aItemsList.GetCount(); ii++ )
|
||||
{
|
||||
oldItem = dynamic_cast<LIB_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
||||
oldItem = static_cast<LIB_ITEM*>( aItemsList.GetPickedItem( ii ) );
|
||||
|
||||
// We *do not* copy fields because they are unique for the whole component
|
||||
// so skip them (do not duplicate) if they are flagged selected.
|
||||
|
@ -388,7 +388,7 @@ bool LIB_EDIT_FRAME::HandleBlockEnd( wxDC* aDC )
|
|||
{
|
||||
if( block->GetCommand() != BLOCK_SELECT_ITEMS_ONLY && GetCurPart() )
|
||||
BlockClearSelectedItems( GetCurPart(), block );
|
||||
|
||||
|
||||
GetScreen()->ClearBlockCommand();
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString,
|
||||
|
@ -461,7 +461,7 @@ void LIB_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
|
|||
block->SetCommand( BLOCK_IDLE );
|
||||
GetScreen()->SetCurItem( NULL );
|
||||
m_canvas->EndMouseCapture( GetToolId(), GetGalCanvas()->GetCurrentCursor(), wxEmptyString, false );
|
||||
|
||||
|
||||
GetCanvas()->GetView()->ClearPreview();
|
||||
GetCanvas()->GetView()->ClearHiddenFlags();
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
|
|||
return;
|
||||
|
||||
block->SetMoveVector( frame->GetCrossHairPosition( true ) - block->GetLastCursorPosition() );
|
||||
|
||||
|
||||
preview->Clear();
|
||||
view->SetVisible( preview, true );
|
||||
|
||||
|
|
|
@ -1195,7 +1195,7 @@ void LIB_EDIT_FRAME::OnRotate( wxCommandEvent& aEvent )
|
|||
|
||||
for( unsigned ii = 0; ii < block.GetCount(); ii++ )
|
||||
{
|
||||
item = dynamic_cast<LIB_ITEM*>( block.GetItem( ii ) );
|
||||
item = static_cast<LIB_ITEM*>( block.GetItem( ii ) );
|
||||
item->Rotate( rotationPoint );
|
||||
}
|
||||
|
||||
|
@ -1254,7 +1254,7 @@ void LIB_EDIT_FRAME::OnOrient( wxCommandEvent& aEvent )
|
|||
|
||||
for( unsigned ii = 0; ii < block.GetCount(); ii++ )
|
||||
{
|
||||
item = dynamic_cast<LIB_ITEM*>( block.GetItem( ii ) );
|
||||
item = static_cast<LIB_ITEM*>( block.GetItem( ii ) );
|
||||
|
||||
if( aEvent.GetId() == ID_LIBEDIT_MIRROR_Y || aEvent.GetId() == ID_POPUP_MIRROR_Y_BLOCK )
|
||||
item->MirrorHorizontal( mirrorPoint );
|
||||
|
|
|
@ -60,10 +60,14 @@ namespace KIGFX
|
|||
{
|
||||
|
||||
SCH_RENDER_SETTINGS::SCH_RENDER_SETTINGS() :
|
||||
m_ShowUnit( 0 ),
|
||||
m_ShowConvert( 0 )
|
||||
m_ShowUnit( 0 ), m_ShowConvert( 0 )
|
||||
{
|
||||
ImportLegacyColors( nullptr );
|
||||
|
||||
m_ShowHiddenText = true;
|
||||
m_ShowHiddenPins = true;
|
||||
m_ShowPinsElectricalType = true;
|
||||
m_ShowUmbilicals = true;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1532,6 +1532,9 @@ size_t SCH_SCREENS::GetLibNicknames( wxArrayString& aLibNicknames )
|
|||
symbol = dynamic_cast< SCH_COMPONENT* >( item );
|
||||
wxASSERT( symbol );
|
||||
|
||||
if( !symbol )
|
||||
continue;
|
||||
|
||||
nickname = symbol->GetLibId().GetLibNickname();
|
||||
|
||||
if( !nickname.empty() && ( aLibNicknames.Index( nickname ) == wxNOT_FOUND ) )
|
||||
|
|
|
@ -84,7 +84,26 @@ protected:
|
|||
|
||||
public:
|
||||
|
||||
EDA_DRAW_PANEL(){};
|
||||
EDA_DRAW_PANEL() :
|
||||
m_showCrossHair( true ),
|
||||
m_cursorLevel( 0 ),
|
||||
m_scrollIncrementX( 1 ),
|
||||
m_scrollIncrementY( 1 ),
|
||||
m_abortRequest( false ),
|
||||
m_enableZoomNoCenter( false ),
|
||||
m_enableMousewheelPan( false ),
|
||||
m_enableAutoPan( false ),
|
||||
m_ignoreMouseEvents( false ),
|
||||
m_ignoreNextLeftButtonRelease( false ),
|
||||
m_enableBlockCommands( true ),
|
||||
m_minDragEventCount( 5 ),
|
||||
m_PrintIsMirrored( false ),
|
||||
m_mouseCaptureCallback( nullptr ),
|
||||
m_endMouseCaptureCallback( nullptr ),
|
||||
m_canStartBlock( true ),
|
||||
m_doubleClickInterval( 0 )
|
||||
{};
|
||||
|
||||
virtual ~EDA_DRAW_PANEL(){};
|
||||
|
||||
/**
|
||||
|
|
|
@ -183,11 +183,12 @@ void DIALOG_POSITION_RELATIVE::OnUseUserOriginClick( wxCommandEvent& event )
|
|||
void DIALOG_POSITION_RELATIVE::UpdateAnchor( EDA_ITEM* aItem )
|
||||
{
|
||||
wxString reference = _( "<none selected>" );
|
||||
BOARD_ITEM* item = dynamic_cast<BOARD_ITEM*>( aItem );
|
||||
|
||||
if( aItem )
|
||||
if( item )
|
||||
{
|
||||
m_anchor_position = dynamic_cast<BOARD_ITEM*>( aItem )->GetPosition();
|
||||
reference = aItem->GetSelectMenuText( GetUserUnits() );
|
||||
m_anchor_position = item->GetPosition();
|
||||
reference = item->GetSelectMenuText( GetUserUnits() );
|
||||
}
|
||||
|
||||
m_referenceInfo->SetLabel( wxString::Format( "Reference item: %s", reference ) );
|
||||
|
|
|
@ -598,9 +598,9 @@ wxString PANEL_SETUP_LAYERS::getLayerName( LAYER_NUM aLayer )
|
|||
wxControl* control = getName( aLayer );
|
||||
|
||||
if( dynamic_cast<wxTextCtrl*>( control ) )
|
||||
return dynamic_cast<wxTextCtrl*>( control )->GetValue().Trim();
|
||||
return static_cast<wxTextCtrl*>( control )->GetValue().Trim();
|
||||
else
|
||||
return dynamic_cast<wxStaticText*>( control )->GetLabel();
|
||||
return static_cast<wxStaticText*>( control )->GetLabel();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue