Cleanup type casting in EE toolbase
* Ensure the lib edit undo checks for pointer validity * Assert that the frames are the correct type (satisfies coverity) * Convert C casts to C++ casts
This commit is contained in:
parent
cd0d92956b
commit
960b553a70
|
@ -38,6 +38,9 @@ void LIB_EDIT_FRAME::SaveCopyInUndoList( EDA_ITEM* ItemToCopy, UNDO_REDO_T undoT
|
|||
{
|
||||
wxASSERT_MSG( !aAppend, "Append not needed/supported for LibEdit" );
|
||||
|
||||
if( !ItemToCopy )
|
||||
return;
|
||||
|
||||
LIB_PART* CopyItem;
|
||||
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
|
||||
|
||||
|
|
|
@ -127,17 +127,20 @@ protected:
|
|||
if( m_isLibEdit )
|
||||
{
|
||||
LIB_EDIT_FRAME* editFrame = dynamic_cast<LIB_EDIT_FRAME*>( m_frame );
|
||||
editFrame->SaveCopyInUndoList( (LIB_ITEM*) aItem, aType, aAppend );
|
||||
wxASSERT( editFrame );
|
||||
|
||||
editFrame->SaveCopyInUndoList( dynamic_cast<LIB_ITEM*>( aItem ), aType, aAppend );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCH_EDIT_FRAME* editFrame = dynamic_cast<SCH_EDIT_FRAME*>( m_frame );
|
||||
wxASSERT( editFrame );
|
||||
|
||||
if( itemType == SCH_PIN_T || itemType == SCH_FIELD_T || itemType == SCH_SHEET_PIN_T )
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem->GetParent(), UR_CHANGED,
|
||||
aAppend );
|
||||
editFrame->SaveCopyInUndoList(
|
||||
dynamic_cast<SCH_ITEM*>( aItem->GetParent() ), UR_CHANGED, aAppend );
|
||||
else
|
||||
editFrame->SaveCopyInUndoList( (SCH_ITEM*) aItem, aType, aAppend );
|
||||
editFrame->SaveCopyInUndoList( dynamic_cast<SCH_ITEM*>( aItem ), aType, aAppend );
|
||||
}
|
||||
|
||||
if( selected && aItem->HasFlag( TEMP_SELECTED ) )
|
||||
|
|
Loading…
Reference in New Issue