Fix coverity warnings:

CID 135848:  Memory - illegal accesses
CID 135846:  Class hierarchy inconsistencies
This commit is contained in:
jean-pierre charras 2016-03-06 09:31:00 +01:00
parent b9be9a4f57
commit 0d1395ee08
6 changed files with 12 additions and 14 deletions

View File

@ -68,11 +68,11 @@ public:
ELECTRICAL_PINTYPE GetElectricalType( void )
{
return m_choiceElectricalType->GetSelection();
return m_choiceElectricalType->GetPinTypeSelection();
}
void SetStyle( GRAPHIC_PINSHAPE style ) { m_choiceStyle->SetSelection( style ); }
GRAPHIC_PINSHAPE GetStyle( void ) { return m_choiceStyle->GetSelection(); }
GRAPHIC_PINSHAPE GetStyle( void ) { return m_choiceStyle->GetPinShapeSelection(); }
void SetPinName( const wxString& name ) { m_textPinName->SetValue( name ); }
wxString GetPinName( void ) { return m_textPinName->GetValue(); }

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -72,7 +72,8 @@ static const BITMAP_DEF iconsPinsOrientations[] =
const wxString LIB_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType )
{
assert( aType >= 0 && aType < (int) PINTYPE_COUNT );
if( aType < 0 || aType >= (int) PINTYPE_COUNT );
return wxT( "???" );
// These strings are the canonical name of the electrictal type
// Not translated, no space in name, only ASCII chars.
@ -93,9 +94,6 @@ const wxString LIB_PIN::GetCanonicalElectricalTypeName( ELECTRICAL_PINTYPE aType
wxT( "NotConnected" )
};
if( aType > (int) PINTYPE_COUNT )
return wxT( "???" );
return msgPinElectricType[ aType ];
}

View File

@ -57,9 +57,9 @@ PinShapeComboBox::PinShapeComboBox( wxWindow* parent,
}
GRAPHIC_PINSHAPE PinShapeComboBox::GetSelection()
GRAPHIC_PINSHAPE PinShapeComboBox::GetPinShapeSelection()
{
return static_cast<GRAPHIC_PINSHAPE>( wxBitmapComboBox::GetSelection() );
return static_cast<GRAPHIC_PINSHAPE>( GetSelection() );
}

View File

@ -46,6 +46,6 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr );
GRAPHIC_PINSHAPE GetSelection();
void SetSelection( GRAPHIC_PINSHAPE aShape );
GRAPHIC_PINSHAPE GetPinShapeSelection();
void SetSelection( GRAPHIC_PINSHAPE aShape );
};

View File

@ -57,9 +57,9 @@ PinTypeComboBox::PinTypeComboBox( wxWindow* parent,
}
ELECTRICAL_PINTYPE PinTypeComboBox::GetSelection()
ELECTRICAL_PINTYPE PinTypeComboBox::GetPinTypeSelection()
{
return static_cast<ELECTRICAL_PINTYPE>( wxBitmapComboBox::GetSelection() );
return static_cast<ELECTRICAL_PINTYPE>( GetSelection() );
}

View File

@ -46,6 +46,6 @@ public:
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxBitmapComboBoxNameStr );
ELECTRICAL_PINTYPE GetSelection();
ELECTRICAL_PINTYPE GetPinTypeSelection();
void SetSelection( ELECTRICAL_PINTYPE aType );
};