diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 440e735a48..ac63cf08d8 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -112,7 +112,7 @@ LIB_PART::LIB_PART( const wxString& aName, LIB_PART* aParent, PART_LIB* aLibrary } -LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : +LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) : EDA_ITEM( aPart ), m_me( this, null_deleter() ) { @@ -134,7 +134,7 @@ LIB_PART::LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary ) : m_keyWords = aPart.m_keyWords; m_docFileName = aPart.m_docFileName; - for( LIB_ITEM& oldItem : aPart.m_drawings ) + for( const LIB_ITEM& oldItem : aPart.m_drawings ) { if( ( oldItem.GetFlags() & ( IS_NEW | STRUCT_DELETED ) ) != 0 ) continue; @@ -278,7 +278,7 @@ std::unique_ptr< LIB_PART > LIB_PART::Flatten() const wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) ); // Copy the parent. - retv.reset( new LIB_PART( *const_cast< LIB_PART* >( parent.get() ) ) ); + retv.reset( new LIB_PART( *parent.get() ) ); // Now add the inherited part (this) information. retv->SetName( m_name ); @@ -291,7 +291,7 @@ std::unique_ptr< LIB_PART > LIB_PART::Flatten() const } else { - retv.reset( new LIB_PART( *const_cast< LIB_PART* >( this ) ) ); + retv.reset( new LIB_PART( *this ) ); } return retv; diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 99b7901de8..a9a949ac1f 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -129,7 +129,7 @@ public: /** * Copy constructor. */ - LIB_PART( LIB_PART& aPart, PART_LIB* aLibrary = NULL ); + LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary = NULL ); virtual ~LIB_PART(); @@ -144,7 +144,7 @@ public: } virtual void SetName( const wxString& aName ); - const wxString GetName() const override { return m_name; } + wxString GetName() const override { return m_name; } LIB_ID GetLibId() const override { return m_libId; } void SetLibId( const LIB_ID& aLibId ) { m_libId = aLibId; } @@ -156,21 +156,21 @@ public: m_description = aDescription; } - const wxString GetDescription() override { return m_description; } + wxString GetDescription() override { return m_description; } void SetKeyWords( const wxString& aKeyWords ) { m_keyWords = aKeyWords; } - const wxString GetKeyWords() const { return m_keyWords; } + wxString GetKeyWords() const { return m_keyWords; } void SetDocFileName( const wxString& aDocFileName ) { m_docFileName = aDocFileName; } - const wxString GetDocFileName() const { return m_docFileName; } + wxString GetDocFileName() const { return m_docFileName; } wxString GetSearchText() override; diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index a23833b29c..99e41ce160 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -4183,12 +4183,12 @@ void SCH_LEGACY_PLUGIN_CACHE::DeleteSymbol( const wxString& aSymbolName ) { if( it1->second->IsAlias() && it1->second->GetParent().lock() == rootPart->SharedPtr() ) { - delete it->second; - it = m_symbols.erase( it ); + delete it1->second; + it1 = m_symbols.erase( it1 ); } else { - it++; + it1++; } } diff --git a/eeschema/sch_view.cpp b/eeschema/sch_view.cpp index be19cf2c40..8d37336764 100644 --- a/eeschema/sch_view.cpp +++ b/eeschema/sch_view.cpp @@ -141,7 +141,7 @@ void SCH_VIEW::DisplayComponent( LIB_PART* aPart ) if( item.Type() != LIB_FIELD_T ) continue; - LIB_FIELD* field = (LIB_FIELD*) &item; + LIB_FIELD* field = dynamic_cast< LIB_FIELD* >( &item ); if( field->GetId() < MANDATORY_FIELDS ) Add( &item ); @@ -162,7 +162,7 @@ void SCH_VIEW::DisplayComponent( LIB_PART* aPart ) // The mandatory fields are already in place so we only add user defined fields. if( item.Type() == LIB_FIELD_T ) { - LIB_FIELD* field = (LIB_FIELD*) &item; + LIB_FIELD* field = dynamic_cast< LIB_FIELD* >( &item ); if( field->GetId() < MANDATORY_FIELDS ) continue; diff --git a/include/footprint_info.h b/include/footprint_info.h index 893a0ec28d..1cd6b35164 100644 --- a/include/footprint_info.h +++ b/include/footprint_info.h @@ -81,7 +81,7 @@ public: return m_nickname; } - const wxString GetName() const override + wxString GetName() const override { return m_fpname; } @@ -91,13 +91,13 @@ public: return LIB_ID( m_nickname, m_fpname ); } - const wxString GetDescription() override + wxString GetDescription() override { ensure_loaded(); return m_doc; } - const wxString GetKeywords() + wxString GetKeywords() { ensure_loaded(); return m_keywords; diff --git a/include/lib_tree_item.h b/include/lib_tree_item.h index d4a6a48461..097d25765e 100644 --- a/include/lib_tree_item.h +++ b/include/lib_tree_item.h @@ -41,10 +41,10 @@ class APIEXPORT LIB_TREE_ITEM public: virtual LIB_ID GetLibId() const = 0; - virtual const wxString GetName() const = 0; + virtual wxString GetName() const = 0; virtual wxString GetLibNickname() const = 0; - virtual const wxString GetDescription() = 0; + virtual wxString GetDescription() = 0; virtual wxString GetSearchText() { return wxEmptyString; }