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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Wed Sep 12 06:59:02 UTC 2018


 sd/source/filter/ppt/pptin.cxx               |    8 ++++----
 sw/source/core/doc/DocumentFieldsManager.cxx |    8 +++-----
 2 files changed, 7 insertions(+), 9 deletions(-)

New commits:
commit 9ac209a67f06599a1f6fd8ea6fa6243e8cf1843b
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 10 14:40:50 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 12 08:58:50 2018 +0200

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

diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 6834616865fa..c683895e9543 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -670,7 +670,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt )
                 TBL_CALC != static_cast<SwTableFormulaUpdate*>(pHt)->m_eFlags ))
         return ;
 
-    SwCalc* pCalc = nullptr;
+    std::unique_ptr<SwCalc> pCalc;
 
     if( pFieldType )
     {
@@ -704,7 +704,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt )
                         continue;
 
                     if( !pCalc )
-                        pCalc = new SwCalc( m_rDoc );
+                        pCalc.reset(new SwCalc( m_rDoc ));
 
                     // get the values of all SetExpression fields that are valid
                     // until the table
@@ -769,7 +769,7 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt )
                 {
                     double nValue;
                     if( !pCalc )
-                        pCalc = new SwCalc( m_rDoc );
+                        pCalc.reset(new SwCalc( m_rDoc ));
 
                     // get the values of all SetExpression fields that are valid
                     // until the table
@@ -829,8 +829,6 @@ void DocumentFieldsManager::UpdateTableFields( SfxPoolItem* pHt )
             }
         }
     }
-
-    delete pCalc;
 }
 
 void DocumentFieldsManager::UpdateExpFields( SwTextField* pUpdateField, bool bUpdRefFields )
commit 61d6047727d2d6f80054094160d630bfed31ab03
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 10 14:39:30 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Sep 12 08:58:36 2018 +0200

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

diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 70a5ae3ee8ed..c885ed988ac5 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -110,7 +110,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
     : maParam(rDocStream)
 {
 #ifdef DBG_UTIL
-    PropRead* pSummaryInformation = new PropRead( rStorage, "\005SummaryInformation" );
+    std::unique_ptr<PropRead> pSummaryInformation(new PropRead( rStorage, "\005SummaryInformation" ));
     if ( pSummaryInformation->IsValid() )
     {
         pSummaryInformation->Read();
@@ -133,7 +133,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SotSt
             }
         }
     }
-    delete pSummaryInformation;
+    pSummaryInformation.reset();
 #endif
 
     SvStream* pCurrentUserStream = rStorage.OpenSotStream( "Current User", StreamMode::STD_READ );
@@ -259,7 +259,7 @@ bool ImplSdPPTImport::Import()
         SeekOle( pDocShell, mnFilterOptions );
 
     // hyperlinks
-    PropRead* pDInfoSec2 = new PropRead( mrStorage, "\005DocumentSummaryInformation" );
+    std::unique_ptr<PropRead> pDInfoSec2(new PropRead( mrStorage, "\005DocumentSummaryInformation" ));
     if ( pDInfoSec2->IsValid() )
     {
         PropItem aPropItem;
@@ -522,7 +522,7 @@ bool ImplSdPPTImport::Import()
             }
         }
     }
-    delete pDInfoSec2;
+    pDInfoSec2.reset();
 
     if ( mbDocumentFound )
     {


More information about the Libreoffice-commits mailing list