Fix a few Coverity warnings.

Sometimes a dynamic_cast was used without testing the returned value.
Some are replaced by static_cast, when the dynamic_cast was useless.
This commit is contained in:
jean-pierre charras 2018-11-11 08:28:58 +01:00
parent acfa13c038
commit f7cf40f2f4
4 changed files with 7 additions and 3 deletions

View File

@ -138,7 +138,7 @@ void SCH_EDIT_FRAME::HandleBlockPlace( wxDC* DC )
for( unsigned ii = 0; ii < block->GetItems().GetCount(); ii++ )
{
SCH_ITEM* item = dynamic_cast<SCH_ITEM*>( block->GetItems().GetPickedItem( ii ) );
SCH_ITEM* item = static_cast<SCH_ITEM*>( block->GetItems().GetPickedItem( ii ) );
item->Move( block->GetMoveVector() );
item->SetFlags( IS_MOVED );
GetCanvas()->GetView()->Update( item, KIGFX::GEOMETRY );

View File

@ -431,7 +431,7 @@ public:
{
// Commit any pending in-place edits before the row gets moved out from under
// the editor.
dynamic_cast<WX_GRID*>( GetView() )->CommitPendingChanges( true );
static_cast<WX_GRID*>( GetView() )->CommitPendingChanges( true );
wxGridTableMessage msg( this, wxGRIDTABLE_NOTIFY_ROWS_DELETED, 0, m_rows.size() );
GetView()->ProcessTableMessage( msg );

View File

@ -94,7 +94,7 @@ bool PANEL_GERBVIEW_DISPLAY_OPTIONS::TransferDataFromWindow()
// Apply changes to the GAL
auto view = m_Parent->GetGalCanvas()->GetView();
auto painter = dynamic_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
auto painter = static_cast<KIGFX::GERBVIEW_PAINTER*>( view->GetPainter() );
auto settings = painter->GetSettings();
settings->LoadDisplayOptions( displayOptions );
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );

View File

@ -1100,6 +1100,10 @@ void DRC::testCopperDrawItem( DRAWSEGMENT* aItem )
void DRC::testCopperTextItem( BOARD_ITEM* aTextItem )
{
EDA_TEXT* text = dynamic_cast<EDA_TEXT*>( aTextItem );
if( text == nullptr )
return;
std::vector<wxPoint> textShape; // a buffer to store the text shape (set of segments)
int textWidth = text->GetThickness();