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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Thu Jul 19 06:14:17 UTC 2018


 compilerplugins/clang/useuniqueptr.cxx |    4 ++++
 sw/source/core/inc/UndoTable.hxx       |    7 +++----
 sw/source/core/undo/untbl.cxx          |   18 ++++++++----------
 3 files changed, 15 insertions(+), 14 deletions(-)

New commits:
commit 8a939de0e1bb62843f8801f526dbdb47125bba64
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Wed Jul 18 11:35:46 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Thu Jul 19 08:13:50 2018 +0200

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

diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx
index df087bfeec11..3f563699e1f6 100644
--- a/compilerplugins/clang/useuniqueptr.cxx
+++ b/compilerplugins/clang/useuniqueptr.cxx
@@ -85,6 +85,10 @@ public:
         // ScTabView::pDrawActual and pDrawOld
         if (fn == SRCDIR "/sc/source/ui/view/tabview5.cxx")
             return;
+        // SwHTMLParser::m_pPendStack
+        if (fn == SRCDIR "/sw/source/filter/html/htmlcss1.cxx")
+            return;
+
 
         TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
     }
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index c5eecc28793a..15edd3a1c01e 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -221,16 +221,15 @@ public:
 };
 
 class SwUndoMove;
-using SwUndoMoves = std::vector<std::unique_ptr<SwUndoMove>>;
 
 class SwUndoTableMerge : public SwUndo, private SwUndRng
 {
     sal_uLong nTableNode;
-    SaveTable* pSaveTable;
+    std::unique_ptr<SaveTable> pSaveTable;
     std::set<sal_uLong> m_Boxes;
     std::vector<sal_uLong> aNewSttNds;
-    SwUndoMoves* m_pMoves;
-    SwHistory* pHistory;
+    std::vector<std::unique_ptr<SwUndoMove>> m_vMoves;
+    std::unique_ptr<SwHistory> pHistory;
 
 public:
     SwUndoTableMerge( const SwPaM& rTableSel );
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index c2d7e90b9eeb..7ea6694848a4 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1914,20 +1914,18 @@ void SwUndoTableNdsChg::RedoImpl(::sw::UndoRedoContext & rContext)
 
 SwUndoTableMerge::SwUndoTableMerge( const SwPaM& rTableSel )
     : SwUndo( SwUndoId::TABLE_MERGE, rTableSel.GetDoc() ), SwUndRng( rTableSel )
-    , m_pMoves(new SwUndoMoves)
-    , pHistory(nullptr)
 {
     const SwTableNode* pTableNd = rTableSel.GetNode().FindTableNode();
     OSL_ENSURE( pTableNd, "Where is the TableNode?" );
-    pSaveTable = new SaveTable( pTableNd->GetTable() );
+    pSaveTable.reset( new SaveTable( pTableNd->GetTable() ) );
     nTableNode = pTableNd->GetIndex();
 }
 
 SwUndoTableMerge::~SwUndoTableMerge()
 {
-    delete pSaveTable;
-    delete m_pMoves;
-    delete pHistory;
+    pSaveTable.reset();
+    m_vMoves.clear();
+    pHistory.reset();
 }
 
 void SwUndoTableMerge::UndoImpl(::sw::UndoRedoContext & rContext)
@@ -1990,11 +1988,11 @@ CHECKTABLE(pTableNd->GetTable())
                     *pBox->GetSttNd()->EndOfSectionNode() ), pColl );
 
             // this was the separator -> restore moved ones
-            for (size_t i = m_pMoves->size(); i; )
+            for (size_t i = m_vMoves.size(); i; )
             {
                 SwTextNode* pTextNd = nullptr;
                 sal_Int32 nDelPos = 0;
-                SwUndoMove *const pUndo = (*m_pMoves)[ --i ].get();
+                SwUndoMove *const pUndo = m_vMoves[ --i ].get();
                 if( !pUndo->IsMoveRange() )
                 {
                     pTextNd = rDoc.GetNodes()[ pUndo->GetDestSttNode() ]->GetTextNode();
@@ -2093,7 +2091,7 @@ void SwUndoTableMerge::MoveBoxContent( SwDoc* pDoc, SwNodeRange& rRg, SwNodeInde
     ++aTmp2;
     pUndo->SetDestRange( aTmp2, rPos, aTmp );
 
-    m_pMoves->push_back(std::move(pUndo));
+    m_vMoves.push_back(std::move(pUndo));
 }
 
 void SwUndoTableMerge::SetSelBoxes( const SwSelBoxes& rBoxes )
@@ -2116,7 +2114,7 @@ void SwUndoTableMerge::SetSelBoxes( const SwSelBoxes& rBoxes )
 void SwUndoTableMerge::SaveCollection( const SwTableBox& rBox )
 {
     if( !pHistory )
-        pHistory = new SwHistory;
+        pHistory.reset(new SwHistory);
 
     SwNodeIndex aIdx( *rBox.GetSttNd(), 1 );
     SwContentNode* pCNd = aIdx.GetNode().GetContentNode();


More information about the Libreoffice-commits mailing list