compilerplugins/clang/useuniqueptr.cxx | 6 +++++- sw/source/core/inc/UndoDraw.hxx | 4 ++-- sw/source/core/undo/undraw.cxx | 12 +++++------- sw/source/core/undo/unovwr.cxx | 16 +++++++--------- 4 files changed, 19 insertions(+), 19 deletions(-)
New commits: commit 8bcea1698c6ec45923a7675ab1250204e952527d Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jul 13 11:36:09 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jul 16 08:38:49 2018 +0200 loplugin:useuniqueptr in SwSdrUndo Change-Id: I67276f2cd13cce8a7cb047216ead40c5afc384bd Reviewed-on: https://gerrit.libreoffice.org/57423 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/inc/UndoDraw.hxx b/sw/source/core/inc/UndoDraw.hxx index 8229c2a8e77e..7df31833a46a 100644 --- a/sw/source/core/inc/UndoDraw.hxx +++ b/sw/source/core/inc/UndoDraw.hxx @@ -36,8 +36,8 @@ class SwDoc; // Undo for Draw Objects class SwSdrUndo : public SwUndo { - SdrUndoAction* pSdrUndo; - SdrMarkList* pMarkList; // MarkList for all selected SdrObjects + std::unique_ptr<SdrUndoAction> pSdrUndo; + std::unique_ptr<SdrMarkList> pMarkList; // MarkList for all selected SdrObjects public: SwSdrUndo( SdrUndoAction* , const SdrMarkList* pMarkList, const SwDoc* pDoc ); diff --git a/sw/source/core/undo/undraw.cxx b/sw/source/core/undo/undraw.cxx index f007d86eee08..9d164095ac5d 100644 --- a/sw/source/core/undo/undraw.cxx +++ b/sw/source/core/undo/undraw.cxx @@ -75,27 +75,25 @@ SwSdrUndo::SwSdrUndo( SdrUndoAction* pUndo, const SdrMarkList* pMrkLst, const Sw : SwUndo( SwUndoId::DRAWUNDO, pDoc ), pSdrUndo( pUndo ) { if( pMrkLst && pMrkLst->GetMarkCount() ) - pMarkList = new SdrMarkList( *pMrkLst ); - else - pMarkList = nullptr; + pMarkList.reset( new SdrMarkList( *pMrkLst ) ); } SwSdrUndo::~SwSdrUndo() { - delete pSdrUndo; - delete pMarkList; + pSdrUndo.reset(); + pMarkList.reset(); } void SwSdrUndo::UndoImpl(::sw::UndoRedoContext & rContext) { pSdrUndo->Undo(); - rContext.SetSelections(nullptr, pMarkList); + rContext.SetSelections(nullptr, pMarkList.get()); } void SwSdrUndo::RedoImpl(::sw::UndoRedoContext & rContext) { pSdrUndo->Redo(); - rContext.SetSelections(nullptr, pMarkList); + rContext.SetSelections(nullptr, pMarkList.get()); } OUString SwSdrUndo::GetComment() const commit e7a252166e2d88b4e16f25a04f1d5072236e8c5e Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri Jul 13 11:27:23 2018 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Mon Jul 16 08:38:38 2018 +0200 loplugin:useuniqueptr in UndoTransliterate_Data Change-Id: I1c6e865a6f59ce7f31c42d28b2b463a577b3cc28 Reviewed-on: https://gerrit.libreoffice.org/57421 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 0520546052a4..1cb392f718f8 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -70,11 +70,15 @@ public: if (fn == SRCDIR "/sc/source/ui/unoobj/funcuno.cxx") return; // SwAttrIter::m_pFont - if (fn == SRCDIR "/sw/source/core/text/itratr.cxx") + if (fn == SRCDIR "/sw/source/core/text/itratr.cxx" + || fn == SRCDIR "/sw/source/core/text/redlnitr.cxx") return; // SwWrongList if (fn == SRCDIR "/sw/source/core/text/wrong.cxx") return; + // SwLineLayout::m_pNext + if (fn == SRCDIR "/sw/source/core/text/porlay.cxx") + return; TraverseDecl(compiler.getASTContext().getTranslationUnitDecl()); } diff --git a/sw/source/core/undo/unovwr.cxx b/sw/source/core/undo/unovwr.cxx index beafde6a4773..e2fb76a19f63 100644 --- a/sw/source/core/undo/unovwr.cxx +++ b/sw/source/core/undo/unovwr.cxx @@ -322,16 +322,15 @@ SwRewriter SwUndoOverwrite::GetRewriter() const struct UndoTransliterate_Data { OUString sText; - SwHistory* pHistory; - Sequence< sal_Int32 >* pOffsets; + std::unique_ptr<SwHistory> pHistory; + std::unique_ptr<Sequence< sal_Int32 >> pOffsets; sal_uLong nNdIdx; sal_Int32 nStart, nLen; UndoTransliterate_Data( sal_uLong nNd, sal_Int32 nStt, sal_Int32 nStrLen, const OUString& rText ) - : sText( rText ), pHistory( nullptr ), pOffsets( nullptr ), + : sText( rText ), nNdIdx( nNd ), nStart( nStt ), nLen( nStrLen ) {} - ~UndoTransliterate_Data() { delete pOffsets; delete pHistory; } void SetChangeAtNode( SwDoc& rDoc ); }; @@ -396,7 +395,7 @@ void SwUndoTransliterate::AddChanges( SwTextNode& rTNd, if( *p != ( nStart + n )) { // create the Offset array - pNew->pOffsets = new Sequence <sal_Int32> ( nLen ); + pNew->pOffsets.reset( new Sequence <sal_Int32> ( nLen ) ); sal_Int32* pIdx = pNew->pOffsets->getArray(); p = pOffsets; long nMyOff, nNewVal = nStart; @@ -428,16 +427,15 @@ void SwUndoTransliterate::AddChanges( SwTextNode& rTNd, if( pD->nNdIdx == pNew->nNdIdx && pD->pHistory ) { // same node and have a history? - pNew->pHistory = pD->pHistory; - pD->pHistory = nullptr; + pNew->pHistory = std::move(pD->pHistory); break; // more can't exist } } if( !pNew->pHistory ) { - pNew->pHistory = new SwHistory; - SwRegHistory aRHst( rTNd, pNew->pHistory ); + pNew->pHistory.reset( new SwHistory ); + SwRegHistory aRHst( rTNd, pNew->pHistory.get() ); pNew->pHistory->CopyAttr( rTNd.GetpSwpHints(), pNew->nNdIdx, 0, rTNd.GetText().getLength(), false ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits