Fix a few minor Coverity warnings

This commit is contained in:
jean-pierre charras 2022-08-12 10:22:33 +02:00
parent 9b20e7debb
commit 488a53e71b
3 changed files with 11 additions and 9 deletions

View File

@ -629,12 +629,10 @@ wxString DIALOG_SIM_MODEL<T>::getSymbolPinString( int symbolPinNumber ) const
if( symbolPin ) if( symbolPin )
name = symbolPin->GetShownName(); name = symbolPin->GetShownName();
LOCALE_IO toggle;
if( name.IsEmpty() ) if( name.IsEmpty() )
return wxString::Format( "%d", symbolPinNumber ); return wxString::Format( "%d", symbolPinNumber );
else else
return wxString::Format( "%d (%s)", symbolPinNumber, symbolPin->GetShownName() ); return wxString::Format( "%d (%s)", symbolPinNumber, name );
} }
@ -643,8 +641,6 @@ wxString DIALOG_SIM_MODEL<T>::getModelPinString( int modelPinNumber ) const
{ {
const wxString& pinName = curModel().GetPin( modelPinNumber - 1 ).name; const wxString& pinName = curModel().GetPin( modelPinNumber - 1 ).name;
LOCALE_IO toggle;
if( pinName.IsEmpty() ) if( pinName.IsEmpty() )
return wxString::Format( "%d", modelPinNumber, pinName ); return wxString::Format( "%d", modelPinNumber, pinName );
else else

View File

@ -118,7 +118,7 @@ void SIM_VALIDATOR::onKeyDown( wxKeyEvent& aEvent )
// and wxPropertyGrid::AddActionTrigger() don't work for it. So instead we translate it to an // and wxPropertyGrid::AddActionTrigger() don't work for it. So instead we translate it to an
// (up or down) arrow key, which has proper handling (select next or previous property) defined // (up or down) arrow key, which has proper handling (select next or previous property) defined
// by the aforementioned functions. // by the aforementioned functions.
if( aEvent.GetKeyCode() == WXK_TAB ) if( aEvent.GetKeyCode() == WXK_TAB )
{ {
// However, before that, if this is the first or last property, we instead want to navigate // However, before that, if this is the first or last property, we instead want to navigate
@ -150,7 +150,7 @@ void SIM_VALIDATOR::onKeyDown( wxKeyEvent& aEvent )
navigate( wxNavigationKeyEvent::IsBackward ); navigate( wxNavigationKeyEvent::IsBackward );
return; return;
} }
if( isLast && !aEvent.ShiftDown() ) if( isLast && !aEvent.ShiftDown() )
{ {
navigate( wxNavigationKeyEvent::IsForward ); navigate( wxNavigationKeyEvent::IsForward );
@ -191,9 +191,11 @@ SIM_STRING_VALIDATOR::SIM_STRING_VALIDATOR( SIM_VALUE::TYPE aValueType,
SIM_VALUE_GRAMMAR::NOTATION aNotation ) SIM_VALUE_GRAMMAR::NOTATION aNotation )
: SIM_VALIDATOR(), : SIM_VALIDATOR(),
m_valueType( aValueType ), m_valueType( aValueType ),
m_notation( aNotation ) m_notation( aNotation ),
m_prevInsertionPoint( 0 )
{ {
wxTextEntry* textEntry = getTextEntry(); wxTextEntry* textEntry = getTextEntry();
if( !textEntry ) if( !textEntry )
return; return;

View File

@ -1569,7 +1569,11 @@ void DIALOG_NET_INSPECTOR::updateNet( NETINFO_ITEM* aNet )
unsigned int DIALOG_NET_INSPECTOR::calculateViaLength( const PCB_TRACK* aTrack ) const unsigned int DIALOG_NET_INSPECTOR::calculateViaLength( const PCB_TRACK* aTrack ) const
{ {
const PCB_VIA* via = dynamic_cast<const PCB_VIA*>( aTrack ); const PCB_VIA* via = dynamic_cast<const PCB_VIA*>( aTrack );
if( !via )
return 0;
BOARD_DESIGN_SETTINGS& bds = m_brd->GetDesignSettings(); BOARD_DESIGN_SETTINGS& bds = m_brd->GetDesignSettings();
// calculate the via length individually from the board stackup and via's start and end layer. // calculate the via length individually from the board stackup and via's start and end layer.