Fix clang compile warnings.

This commit is contained in:
Jeff Young 2020-06-02 20:27:22 +01:00
parent 9ff09aa784
commit 10add93d16
2 changed files with 14 additions and 7 deletions

View File

@ -881,10 +881,20 @@ LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName )
{ {
for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] ) for( LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
{ {
LIB_FIELD* field = ( LIB_FIELD* ) &item; if( static_cast<LIB_FIELD*>( &item )->GetCanonicalName() == aFieldName )
return static_cast<LIB_FIELD*>( &item );
}
if( field->GetCanonicalName() == aFieldName ) return NULL;
return field; }
const LIB_FIELD* LIB_PART::FindField( const wxString& aFieldName ) const
{
for( const LIB_ITEM& item : m_drawings[ LIB_FIELD_T ] )
{
if( static_cast<const LIB_FIELD*>( &item )->GetCanonicalName() == aFieldName )
return static_cast<const LIB_FIELD*>( &item );
} }
return NULL; return NULL;

View File

@ -271,10 +271,7 @@ public:
*/ */
LIB_FIELD* FindField( const wxString& aFieldName ); LIB_FIELD* FindField( const wxString& aFieldName );
const LIB_FIELD* FindField( const wxString& aFieldName ) const const LIB_FIELD* FindField( const wxString& aFieldName ) const;
{
return const_cast<LIB_FIELD*>( FindField( aFieldName ) );
}
/** /**
* Return pointer to the requested field. * Return pointer to the requested field.