summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-09-13 10:47:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-09-14 09:00:55 +0200
commit7fb70e419d8f6ce5b0821cb0476cc37483791180 (patch)
treeae0433fb11f353dc90ed3aa882d0216db075b1bb
parent8920f62b51cd0fe2dc9f92be2d66eec6e663cdce (diff)
loplugin:useuniqueptr in SwImpBlocks::MakePaM
Change-Id: Icba921c1875592df7d120c9cc4866184cea74b92 Reviewed-on: https://gerrit.libreoffice.org/60449 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/inc/swblocks.hxx2
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks.cxx3
-rw-r--r--sw/source/core/swg/swblocks.cxx4
3 files changed, 4 insertions, 5 deletions
diff --git a/sw/source/core/inc/swblocks.hxx b/sw/source/core/inc/swblocks.hxx
index 98f01ecaafd9..b29bd82e0b16 100644
--- a/sw/source/core/inc/swblocks.hxx
+++ b/sw/source/core/inc/swblocks.hxx
@@ -80,7 +80,7 @@ protected:
virtual FileType GetFileType() const = 0;
virtual void ClearDoc(); // Delete Doc content
- SwPaM* MakePaM(); // Span PaM over Doc
+ std::unique_ptr<SwPaM> MakePaM(); // Span PaM over Doc
virtual void AddName( const OUString&, const OUString&, bool bOnlyText = false );
bool IsFileChanged() const;
void Touch();
diff --git a/sw/source/core/swg/SwXMLTextBlocks.cxx b/sw/source/core/swg/SwXMLTextBlocks.cxx
index 753aba1ada31..34012be29642 100644
--- a/sw/source/core/swg/SwXMLTextBlocks.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks.cxx
@@ -388,9 +388,8 @@ ErrCode SwXMLTextBlocks::PutBlock()
ErrCode SwXMLTextBlocks::PutDoc()
{
- SwPaM* pPaM = MakePaM();
+ std::unique_ptr<SwPaM> pPaM = MakePaM();
ErrCode nErr = PutBlock();
- delete pPaM;
return nErr;
}
diff --git a/sw/source/core/swg/swblocks.cxx b/sw/source/core/swg/swblocks.cxx
index 3d65575cdcf7..11f76c80c751 100644
--- a/sw/source/core/swg/swblocks.cxx
+++ b/sw/source/core/swg/swblocks.cxx
@@ -116,9 +116,9 @@ void SwImpBlocks::ClearDoc()
/**
* Creating a PaM, that spans the whole document
*/
-SwPaM* SwImpBlocks::MakePaM()
+std::unique_ptr<SwPaM> SwImpBlocks::MakePaM()
{
- SwPaM* pPam = new SwPaM( m_xDoc->GetNodes().GetEndOfContent() );
+ std::unique_ptr<SwPaM> pPam(new SwPaM( m_xDoc->GetNodes().GetEndOfContent() ));
pPam->Move( fnMoveBackward, GoInDoc );
pPam->SetMark();
pPam->Move( fnMoveForward, GoInDoc );