[Libreoffice-commits] core.git: editeng/source include/editeng

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 6 19:40:35 UTC 2019


 editeng/source/editeng/eertfpar.cxx |    4 ++--
 editeng/source/rtf/svxrtf.cxx       |    8 ++++----
 include/editeng/svxrtf.hxx          |    2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

New commits:
commit 08e09136a60e176703c08aff8a7a8e8a12d3f9b1
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri Sep 6 16:23:52 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 6 21:39:19 2019 +0200

    use unique_ptr in EditNodeIdx
    
    Change-Id: I59702aa3d54f60cb3e41410e82b0532bac05274f
    Reviewed-on: https://gerrit.libreoffice.org/78717
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/editeng/source/editeng/eertfpar.cxx b/editeng/source/editeng/eertfpar.cxx
index a8fac71a7c72..cc1cf2bd3424 100644
--- a/editeng/source/editeng/eertfpar.cxx
+++ b/editeng/source/editeng/eertfpar.cxx
@@ -617,9 +617,9 @@ std::unique_ptr<EditPosition> EditPosition::Clone() const
     return std::unique_ptr<EditPosition>(new EditPosition(mpEditEngine, mpCurSel));
 }
 
-EditNodeIdx* EditPosition::MakeNodeIdx() const
+std::unique_ptr<EditNodeIdx> EditPosition::MakeNodeIdx() const
 {
-    return new EditNodeIdx(mpEditEngine, mpCurSel->Max().GetNode());
+    return std::make_unique<EditNodeIdx>(mpEditEngine, mpCurSel->Max().GetNode());
 }
 
 sal_Int32 EditPosition::GetNodeIdx() const
diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 4c284248c3e8..cb50be3cb795 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -793,7 +793,7 @@ void SvxRTFParser::AttrGroupEnd()   // process the current, delete from Stack
                     }
                 }
 
-                pOld->pEndNd = pInsPos->MakeNodeIdx();
+                pOld->pEndNd = pInsPos->MakeNodeIdx().release();
                 pOld->nEndCnt = pInsPos->GetCntIdx();
 
                 /*
@@ -939,7 +939,7 @@ SvxRTFItemStackType::SvxRTFItemStackType(
     : aAttrSet( rPool, pWhichRange )
     , nStyleNo( 0 )
 {
-    pSttNd.reset( rPos.MakeNodeIdx() );
+    pSttNd = rPos.MakeNodeIdx();
     nSttCnt = rPos.GetCntIdx();
     pEndNd = pSttNd.get();
     nEndCnt = nSttCnt;
@@ -952,7 +952,7 @@ SvxRTFItemStackType::SvxRTFItemStackType(
     : aAttrSet( *rCpy.aAttrSet.GetPool(), rCpy.aAttrSet.GetRanges() )
     , nStyleNo( rCpy.nStyleNo )
 {
-    pSttNd.reset( rPos.MakeNodeIdx() );
+    pSttNd = rPos.MakeNodeIdx();
     nSttCnt = rPos.GetCntIdx();
     pEndNd = pSttNd.get();
     nEndCnt = nSttCnt;
@@ -1017,7 +1017,7 @@ void SvxRTFItemStackType::SetStartPos( const EditPosition& rPos )
 {
     if (pSttNd.get() != pEndNd)
         delete pEndNd;
-    pSttNd.reset(rPos.MakeNodeIdx() );
+    pSttNd = rPos.MakeNodeIdx();
     pEndNd = pSttNd.get();
     nSttCnt = rPos.GetCntIdx();
 }
diff --git a/include/editeng/svxrtf.hxx b/include/editeng/svxrtf.hxx
index d38d1c605460..1188ed65f8af 100644
--- a/include/editeng/svxrtf.hxx
+++ b/include/editeng/svxrtf.hxx
@@ -71,7 +71,7 @@ public:
     std::unique_ptr<EditPosition> Clone() const;
 
     // clone NodeIndex
-    EditNodeIdx* MakeNodeIdx() const;
+    std::unique_ptr<EditNodeIdx> MakeNodeIdx() const;
 };
 
 typedef std::map<short, std::unique_ptr<vcl::Font>> SvxRTFFontTbl;


More information about the Libreoffice-commits mailing list