Eeschema: fix build errors and warnings.

Fix build error when KICAD_USE_SCH_IO_MANAGER=OFF due to const issues with
LIB_PART ctor.

Fix unused variable build warning in legacy schematic plugin.
This commit is contained in:
Wayne Stambaugh 2016-09-17 20:15:07 -04:00
parent 225f0d8917
commit 679eef1c43
3 changed files with 9 additions and 7 deletions

View File

@ -206,7 +206,7 @@ LIB_PART::LIB_PART( const wxString& aName, PART_LIB* aLibrary ) :
} }
LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) : LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) :
EDA_ITEM( aPart ), EDA_ITEM( aPart ),
m_me( this, null_deleter() ) m_me( this, null_deleter() )
{ {

View File

@ -218,7 +218,7 @@ private:
public: public:
LIB_PART( const wxString& aName, PART_LIB* aLibrary = NULL ); LIB_PART( const wxString& aName, PART_LIB* aLibrary = NULL );
LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary = NULL ); LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary = NULL );
virtual ~LIB_PART(); virtual ~LIB_PART();

View File

@ -2054,8 +2054,10 @@ LIB_ALIAS* SCH_LEGACY_PLUGIN_CACHE::removeAlias( LIB_ALIAS* aAlias )
void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_PART* aPart ) void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_PART* aPart )
{ {
// add a clone, not the caller's copy // Ugly hack to fix the fact that the LIB_PART copy constructor doesn't take a const
LIB_PART* part = new LIB_PART( *aPart ); // reference. I feel all dirty inside doing this.
// @todo: fix LIB_PART copy ctor so it can take a const reference.
LIB_PART* part = new LIB_PART( *const_cast< LIB_PART* >( aPart ) );
wxArrayString aliasNames = aPart->GetAliasNames(); wxArrayString aliasNames = aPart->GetAliasNames();
@ -2066,10 +2068,10 @@ void SCH_LEGACY_PLUGIN_CACHE::AddSymbol( const LIB_PART* aPart )
if( it != m_aliases.end() ) if( it != m_aliases.end() )
removeAlias( it->second ); removeAlias( it->second );
LIB_ALIAS* alias = aPart->GetAlias( aliasNames[i] ); LIB_ALIAS* alias = part->GetAlias( aliasNames[i] );
wxASSERT_MSG( alias != NULL, "No alias <" + aliasNames[i] + "> found in symbol <" + wxASSERT_MSG( alias != NULL, "No alias <" + aliasNames[i] + "> found in symbol <" +
aPart->GetName() +">." ); part->GetName() +">." );
m_aliases[ aliasNames[i] ] = alias; m_aliases[ aliasNames[i] ] = alias;
} }
@ -2133,7 +2135,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Load()
if( strCompare( "DEF", line ) ) if( strCompare( "DEF", line ) )
{ {
// Read one DEF/ENDDEF part entry from library: // Read one DEF/ENDDEF part entry from library:
LIB_PART* part = loadPart( reader ); loadPart( reader );
} }
} }