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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 10:35:37 UTC 2018


 sw/source/core/inc/UndoTable.hxx |    4 ++--
 sw/source/core/undo/untbl.cxx    |   17 +++++++++--------
 2 files changed, 11 insertions(+), 10 deletions(-)

New commits:
commit 087b1fc95a1d500e75de3ddc357298c9f93bf7b5
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 18 16:01:32 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 19 12:35:12 2018 +0200

    loplugin:useuniqueptr in SwUndoMergeTable
    
    Change-Id: I5c75bc85019be1e4bd25b955f873e230c0ffe132
    Reviewed-on: https://gerrit.libreoffice.org/57695
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 74bfedfecf2a..4343f09225ed 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -350,8 +350,8 @@ class SwUndoMergeTable : public SwUndo
 {
     OUString aName;
     sal_uLong nTableNode;
-    SaveTable* pSavTable, *pSavHdl;
-    SwHistory* pHistory;
+    std::unique_ptr<SaveTable> pSavTable, pSavHdl;
+    std::unique_ptr<SwHistory> pHistory;
     sal_uInt16 nMode;
     bool bWithPrev;
 
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index 411d2d8ac1a9..fb15b3d90016 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -2977,8 +2977,8 @@ void SwUndoSplitTable::SaveFormula( SwHistory& rHistory )
 SwUndoMergeTable::SwUndoMergeTable( const SwTableNode& rTableNd,
                                 const SwTableNode& rDelTableNd,
                                 bool bWithPrv, sal_uInt16 nMd )
-    : SwUndo( SwUndoId::MERGE_TABLE, rTableNd.GetDoc() ), pSavTable( nullptr ),
-    pHistory( nullptr ), nMode( nMd ), bWithPrev( bWithPrv )
+    : SwUndo( SwUndoId::MERGE_TABLE, rTableNd.GetDoc() ),
+    nMode( nMd ), bWithPrev( bWithPrv )
 {
     // memorize end node of the last table cell that'll stay in position
     if( bWithPrev )
@@ -2987,16 +2987,17 @@ SwUndoMergeTable::SwUndoMergeTable( const SwTableNode& rTableNd,
         nTableNode = rTableNd.EndOfSectionIndex() - 1;
 
     aName = rDelTableNd.GetTable().GetFrameFormat()->GetName();
-    pSavTable = new SaveTable( rDelTableNd.GetTable() );
+    pSavTable.reset(new SaveTable( rDelTableNd.GetTable() ));
 
-    pSavHdl = bWithPrev ? new SaveTable( rTableNd.GetTable(), 1 ) : nullptr;
+    if (bWithPrev)
+        pSavHdl.reset( new SaveTable( rTableNd.GetTable(), 1 ) );
 }
 
 SwUndoMergeTable::~SwUndoMergeTable()
 {
-    delete pSavTable;
-    delete pSavHdl;
-    delete pHistory;
+    pSavTable.reset();
+    pSavHdl.reset();
+    pHistory.reset();
 }
 
 void SwUndoMergeTable::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -3093,7 +3094,7 @@ void SwUndoMergeTable::RepeatImpl(::sw::RepeatContext & rContext)
 void SwUndoMergeTable::SaveFormula( SwHistory& rHistory )
 {
     if( !pHistory )
-        pHistory = new SwHistory;
+        pHistory.reset( new SwHistory );
     pHistory->Move( 0, &rHistory );
 }
 


More information about the Libreoffice-commits mailing list