diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-09-30 13:46:47 +0200 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-09-30 17:01:56 +0200 |
commit | 9366fc18143194909a158a8252c25d8c3ff6e87a (patch) | |
tree | 3f483461e60acfe291e69c5e9766e2c8936e88fc /sw | |
parent | 1ae450504cf57457f9702684b1517fda1dd3c481 (diff) |
The argument of SwpHints::Insert should not be const
Change-Id: Ic71a53140ae43c5936b0a63213e5c7d068bed45f
Reviewed-on: https://gerrit.libreoffice.org/79850
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/ndhints.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndhints.cxx | 18 |
2 files changed, 10 insertions, 10 deletions
diff --git a/sw/inc/ndhints.hxx b/sw/inc/ndhints.hxx index 697b11383df0..ceead82cecd9 100644 --- a/sw/inc/ndhints.hxx +++ b/sw/inc/ndhints.hxx @@ -124,7 +124,7 @@ private: const SetAttrMode nMode ); bool MergePortions( SwTextNode& rNode ); - void Insert( const SwTextAttr *pHt ); + void Insert(SwTextAttr* pHt); SW_DLLPUBLIC void Resort() const; SW_DLLPUBLIC void ResortStartMap() const; SW_DLLPUBLIC void ResortEndMap() const; diff --git a/sw/source/core/txtnode/ndhints.cxx b/sw/source/core/txtnode/ndhints.cxx index 8e3ee6025375..6c73067fcdea 100644 --- a/sw/source/core/txtnode/ndhints.cxx +++ b/sw/source/core/txtnode/ndhints.cxx @@ -144,12 +144,12 @@ bool CompareSwpHtEnd::operator()( const SwTextAttr* lhs, const SwTextAttr* rhs ) return ( nHt1 < nHt2 ); } -void SwpHints::Insert( const SwTextAttr *pHt ) +void SwpHints::Insert(SwTextAttr* pHt) { - assert(std::find(m_HintsByStart.begin(), m_HintsByStart.end(), const_cast<SwTextAttr*>(pHt)) + assert(std::find(m_HintsByStart.begin(), m_HintsByStart.end(), pHt) == m_HintsByStart.end()); // "Insert: hint already in HtStart" assert( pHt->m_pHints == nullptr ); - const_cast<SwTextAttr*>(pHt)->m_pHints = this; + pHt->m_pHints = this; if (m_bStartMapNeedsSorting) ResortStartMap(); @@ -158,14 +158,14 @@ void SwpHints::Insert( const SwTextAttr *pHt ) if (m_bWhichMapNeedsSorting) ResortWhichMap(); - auto it1 = std::lower_bound(m_HintsByStart.begin(), m_HintsByStart.end(), const_cast<SwTextAttr*>(pHt), CompareSwpHtStart); - m_HintsByStart.insert(it1, const_cast<SwTextAttr*>(pHt)); + auto it1 = std::lower_bound(m_HintsByStart.begin(), m_HintsByStart.end(), pHt, CompareSwpHtStart); + m_HintsByStart.insert(it1, pHt); - auto it2 = std::lower_bound(m_HintsByEnd.begin(), m_HintsByEnd.end(), const_cast<SwTextAttr*>(pHt), CompareSwpHtEnd()); - m_HintsByEnd.insert(it2, const_cast<SwTextAttr*>(pHt)); + auto it2 = std::lower_bound(m_HintsByEnd.begin(), m_HintsByEnd.end(), pHt, CompareSwpHtEnd()); + m_HintsByEnd.insert(it2, pHt); - auto it3 = std::lower_bound(m_HintsByWhichAndStart.begin(), m_HintsByWhichAndStart.end(), const_cast<SwTextAttr*>(pHt), CompareSwpHtWhichStart()); - m_HintsByWhichAndStart.insert(it3, const_cast<SwTextAttr*>(pHt)); + auto it3 = std::lower_bound(m_HintsByWhichAndStart.begin(), m_HintsByWhichAndStart.end(), pHt, CompareSwpHtWhichStart()); + m_HintsByWhichAndStart.insert(it3, pHt); } bool SwpHints::Contains( const SwTextAttr *pHt ) const |