sw/source/core/inc/UndoNumbering.hxx |    4 ++--
 sw/source/core/inc/UndoRedline.hxx   |    4 ++--
 sw/source/core/undo/unnum.cxx        |   10 +++++-----
 sw/source/core/undo/unredln.cxx      |   11 +++++------
 4 files changed, 14 insertions(+), 15 deletions(-)

New commits:
commit 59ef51a03160117f2df7393c13a6b524386e2678
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 13 10:54:06 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jul 16 08:37:43 2018 +0200

    loplugin:useuniqueptr in SwUndoRedline
    
    Change-Id: I158cfb0774b5991197816725aef7c74b7e1f00da
    Reviewed-on: https://gerrit.libreoffice.org/57417
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/inc/UndoRedline.hxx 
b/sw/source/core/inc/UndoRedline.hxx
index 8cf4e63f3f57..0de085da5bbe 100644
--- a/sw/source/core/inc/UndoRedline.hxx
+++ b/sw/source/core/inc/UndoRedline.hxx
@@ -31,8 +31,8 @@ class SwUndoDelete;
 class SwUndoRedline : public SwUndo, public SwUndRng
 {
 protected:
-    SwRedlineData* mpRedlData;
-    SwRedlineSaveDatas* mpRedlSaveData;
+    std::unique_ptr<SwRedlineData> mpRedlData;
+    std::unique_ptr<SwRedlineSaveDatas> mpRedlSaveData;
     SwUndoId mnUserId;
     bool mbHiddenRedlines;
 
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx
index e4f23da63968..2d3faa3194ad 100644
--- a/sw/source/core/undo/unredln.cxx
+++ b/sw/source/core/undo/unredln.cxx
@@ -47,7 +47,7 @@ SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& 
rRange )
         {
         case SwUndoId::DELETE:
         case SwUndoId::REPLACE:
-            mpRedlData = new SwRedlineData( nsRedlineType_t::REDLINE_DELETE, 
rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() );
+            mpRedlData.reset( new SwRedlineData( 
nsRedlineType_t::REDLINE_DELETE, 
rDoc.getIDocumentRedlineAccess().GetRedlineAuthor() ) );
             break;
         default:
             ;
@@ -57,11 +57,10 @@ SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& 
rRange )
 
     sal_uLong nEndExtra = rDoc.GetNodes().GetEndOfExtras().GetIndex();
 
-    mpRedlSaveData = new SwRedlineSaveDatas;
+    mpRedlSaveData.reset( new SwRedlineSaveDatas );
     if( !FillSaveData( rRange, *mpRedlSaveData, false, 
SwUndoId::REJECT_REDLINE != mnUserId ))
     {
-        delete mpRedlSaveData;
-        mpRedlSaveData = nullptr;
+        mpRedlSaveData.reset();
     }
     else
     {
@@ -77,8 +76,8 @@ SwUndoRedline::SwUndoRedline( SwUndoId nUsrId, const SwPaM& 
rRange )
 
 SwUndoRedline::~SwUndoRedline()
 {
-    delete mpRedlData;
-    delete mpRedlSaveData;
+    mpRedlData.reset();
+    mpRedlSaveData.reset();
 }
 
 sal_uInt16 SwUndoRedline::GetRedlSaveCount() const
commit ff186d94f32676030d86e2e5668f768254c53cde
Author:     Noel Grandin <noel.gran...@collabora.co.uk>
AuthorDate: Fri Jul 13 10:43:13 2018 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Mon Jul 16 08:37:34 2018 +0200

    loplugin:useuniqueptr in SwUndoInsNum
    
    Change-Id: I1bdf4b0ac9ccbb6fb618f7c44a15caf01bd321b4
    Reviewed-on: https://gerrit.libreoffice.org/57416
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sw/source/core/inc/UndoNumbering.hxx 
b/sw/source/core/inc/UndoNumbering.hxx
index 54cc833598f3..70e6149b383e 100644
--- a/sw/source/core/inc/UndoNumbering.hxx
+++ b/sw/source/core/inc/UndoNumbering.hxx
@@ -29,8 +29,8 @@
 class SwUndoInsNum : public SwUndo, private SwUndRng
 {
     SwNumRule aNumRule;
-    SwHistory* pHistory;
-    SwNumRule* pOldNumRule;
+    std::unique_ptr<SwHistory> pHistory;
+    std::unique_ptr<SwNumRule> pOldNumRule;
     OUString sReplaceRule;
     sal_uInt16 nLRSavePos;
 
diff --git a/sw/source/core/undo/unnum.cxx b/sw/source/core/undo/unnum.cxx
index 5ea3dcf13c1c..d680785d387d 100644
--- a/sw/source/core/undo/unnum.cxx
+++ b/sw/source/core/undo/unnum.cxx
@@ -61,8 +61,8 @@ SwUndoInsNum::SwUndoInsNum( const SwPosition& rPos, const 
SwNumRule& rRule,
 
 SwUndoInsNum::~SwUndoInsNum()
 {
-    delete pHistory;
-    delete pOldNumRule;
+    pHistory.reset();
+    pOldNumRule.reset();
 }
 
 SwRewriter SwUndoInsNum::GetRewriter() const
@@ -145,14 +145,14 @@ void SwUndoInsNum::RepeatImpl(::sw::RepeatContext & 
rContext)
 SwHistory* SwUndoInsNum::GetHistory()
 {
     if( !pHistory )
-        pHistory = new SwHistory;
-    return pHistory;
+        pHistory.reset(new SwHistory);
+    return pHistory.get();
 }
 
 void SwUndoInsNum::SaveOldNumRule( const SwNumRule& rOld )
 {
     if( !pOldNumRule )
-        pOldNumRule = new SwNumRule( rOld );
+        pOldNumRule.reset(new SwNumRule( rOld ));
 }
 
 SwUndoDelNum::SwUndoDelNum( const SwPaM& rPam )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to