[Libreoffice-commits] core.git: sw/inc sw/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Mon Sep 30 15:02:50 UTC 2019


 sw/inc/ndhints.hxx                 |    2 +-
 sw/source/core/txtnode/ndhints.cxx |   18 +++++++++---------
 2 files changed, 10 insertions(+), 10 deletions(-)

New commits:
commit 9366fc18143194909a158a8252c25d8c3ff6e87a
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Mon Sep 30 13:46:47 2019 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Sep 30 17:01:56 2019 +0200

    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 at collabora.com>

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


More information about the Libreoffice-commits mailing list