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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Fri Sep 14 07:01:26 UTC 2018


 sw/source/core/inc/swblocks.hxx        |    2 +-
 sw/source/core/swg/SwXMLTextBlocks.cxx |    3 +--
 sw/source/core/swg/swblocks.cxx        |    4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

New commits:
commit 7fb70e419d8f6ce5b0821cb0476cc37483791180
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Thu Sep 13 10:47:27 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Fri Sep 14 09:00:55 2018 +0200

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

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 );


More information about the Libreoffice-commits mailing list