include/svtools/treelist.hxx          |    2 +-
 include/svtools/treelistbox.hxx       |    2 +-
 sc/inc/fielduno.hxx                   |    2 +-
 sc/inc/funcuno.hxx                    |    2 +-
 sc/source/ui/unoobj/fielduno.cxx      |    4 ++--
 sc/source/ui/unoobj/funcuno.cxx       |    6 +++---
 svtools/source/contnr/treelist.cxx    |    7 ++++---
 svtools/source/contnr/treelistbox.cxx |    5 ++---
 8 files changed, 15 insertions(+), 15 deletions(-)

New commits:
commit 0df31898281a771821d62ad419c7343da72cfb51
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Jul 2 11:02:59 2018 +0200

    loplugin:useuniqueptr in ScFunctionAccess
    
    Change-Id: I678bfbc54a1c35540bb7f2b76f4f7e5c7c62b23c
    Reviewed-on: https://gerrit.libreoffice.org/56826
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/funcuno.hxx b/sc/inc/funcuno.hxx
index d93cc41c6a2f..df65d249c212 100644
--- a/sc/inc/funcuno.hxx
+++ b/sc/inc/funcuno.hxx
@@ -61,7 +61,7 @@ class ScFunctionAccess : public cppu::WeakImplHelper<
 {
 private:
     ScTempDocCache  aDocCache;
-    ScDocOptions*   pOptions;
+    std::unique_ptr<ScDocOptions> pOptions;
     SfxItemPropertyMap aPropertyMap;
     bool            mbArray;
     bool            mbValid;
diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx
index 68cf909663f4..59de6fc42165 100644
--- a/sc/source/ui/unoobj/funcuno.cxx
+++ b/sc/source/ui/unoobj/funcuno.cxx
@@ -176,7 +176,7 @@ ScFunctionAccess::ScFunctionAccess() :
 
 ScFunctionAccess::~ScFunctionAccess()
 {
-    delete pOptions;
+    pOptions.reset();
     {
         // SfxBroadcaster::RemoveListener checks DBG_TESTSOLARMUTEX():
         SolarMutexGuard g;
@@ -241,7 +241,7 @@ void SAL_CALL ScFunctionAccess::setPropertyValue(
     else
     {
         if ( !pOptions )
-            pOptions = new ScDocOptions();
+            pOptions.reset( new ScDocOptions() );
 
         // options aren't initialized from configuration - always get the same 
default behaviour
 
@@ -259,7 +259,7 @@ uno::Any SAL_CALL ScFunctionAccess::getPropertyValue( const 
OUString& aPropertyN
         return uno::Any( mbArray );
 
     if ( !pOptions )
-        pOptions = new ScDocOptions();
+        pOptions.reset( new ScDocOptions() );
 
     // options aren't initialized from configuration - always get the same 
default behaviour
 
commit 6118675b1f6bd37589d88d5893dffd41501cf624
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Jul 2 10:59:43 2018 +0200

    loplugin:useuniqueptr in ScHeaderFieldsObj
    
    Change-Id: Ibf9251880e658605e83179c9de7ac2104d2c1c14
    Reviewed-on: https://gerrit.libreoffice.org/56825
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/sc/inc/fielduno.hxx b/sc/inc/fielduno.hxx
index 8664e2b673a8..c600f29d79e9 100644
--- a/sc/inc/fielduno.hxx
+++ b/sc/inc/fielduno.hxx
@@ -114,7 +114,7 @@ class ScHeaderFieldsObj : public cppu::WeakImplHelper<
 {
 private:
     ScHeaderFooterTextData& mrData;
-    ScEditSource* mpEditSource;
+    std::unique_ptr<ScEditSource> mpEditSource;
 
     /// List of refresh listeners.
     comphelper::OInterfaceContainerHelper2* mpRefreshListeners;
diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx
index 0316b832cc75..77856751701d 100644
--- a/sc/source/ui/unoobj/fielduno.cxx
+++ b/sc/source/ui/unoobj/fielduno.cxx
@@ -428,12 +428,12 @@ 
ScHeaderFieldsObj::ScHeaderFieldsObj(ScHeaderFooterTextData& rData) :
     mrData(rData),
     mpRefreshListeners( nullptr )
 {
-    mpEditSource = new ScHeaderFooterEditSource(rData);
+    mpEditSource.reset( new ScHeaderFooterEditSource(rData) );
 }
 
 ScHeaderFieldsObj::~ScHeaderFieldsObj()
 {
-    delete mpEditSource;
+    mpEditSource.reset();
 
     // increment refcount to prevent double call off dtor
     osl_atomic_increment( &m_refCount );
commit b82d6a3ddc1e70c2f61b8f8fdbfeb9345206472f
Author: Noel Grandin <noel.gran...@collabora.co.uk>
Date:   Mon Jul 2 09:54:39 2018 +0200

    return by std::unique_ptr from CreateViewData
    
    Change-Id: I83572646fb2ebe8afe8cff581e574375798e74f7
    Reviewed-on: https://gerrit.libreoffice.org/56818
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Tested-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx
index c246a5610ad8..0d190ab3a022 100644
--- a/include/svtools/treelist.hxx
+++ b/include/svtools/treelist.hxx
@@ -317,7 +317,7 @@ public:
     SvViewDataEntry*         GetViewData( SvTreeListEntry* pEntry );
     bool                HasViewData() const;
 
-    virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* pEntry );
+    virtual std::unique_ptr<SvViewDataEntry> CreateViewData( SvTreeListEntry* 
pEntry );
     virtual void        InitViewData( SvViewDataEntry*, SvTreeListEntry* 
pEntry );
 
     virtual void        ModelHasCleared();
diff --git a/include/svtools/treelistbox.hxx b/include/svtools/treelistbox.hxx
index b29908debe4a..5bb92a84a005 100644
--- a/include/svtools/treelistbox.hxx
+++ b/include/svtools/treelistbox.hxx
@@ -297,7 +297,7 @@ protected:
     bool            EditingCanceled() const;
 
     // Return value must be derived from SvViewDataEntry!
-    virtual SvViewDataEntry* CreateViewData( SvTreeListEntry* ) override;
+    virtual std::unique_ptr<SvViewDataEntry> CreateViewData( SvTreeListEntry* 
) override;
     // InitViewData is called right after CreateViewData
     // The Entry is has not yet been added to the View in InitViewData!
     virtual void InitViewData( SvViewDataEntry*, SvTreeListEntry* pEntry ) 
override;
diff --git a/svtools/source/contnr/treelist.cxx 
b/svtools/source/contnr/treelist.cxx
index e4d66eec25e0..e20e571f2d4a 100644
--- a/svtools/source/contnr/treelist.cxx
+++ b/svtools/source/contnr/treelist.cxx
@@ -21,6 +21,7 @@
 #include <svtools/treelistentry.hxx>
 #include <svtools/viewdataentry.hxx>
 #include <osl/diagnose.h>
+#include <o3tl/make_unique.hxx>
 
 #include <memory>
 #include <map>
@@ -1139,7 +1140,7 @@ void SvListView::Impl::InitTable()
     pEntry = m_rThis.pModel->First();
     while( pEntry )
     {
-        pViewData.reset(m_rThis.CreateViewData( pEntry ));
+        pViewData = m_rThis.CreateViewData( pEntry );
         DBG_ASSERT(pViewData,"InitTable:No ViewData");
         m_rThis.InitViewData( pViewData.get(), pEntry );
         m_DataTable.insert(std::make_pair(pEntry, std::move(pViewData)));
@@ -1147,9 +1148,9 @@ void SvListView::Impl::InitTable()
     }
 }
 
-SvViewDataEntry* SvListView::CreateViewData( SvTreeListEntry* )
+std::unique_ptr<SvViewDataEntry> SvListView::CreateViewData( SvTreeListEntry* )
 {
-    return new SvViewDataEntry;
+    return o3tl::make_unique<SvViewDataEntry>();
 }
 
 void SvListView::Clear()
diff --git a/svtools/source/contnr/treelistbox.cxx 
b/svtools/source/contnr/treelistbox.cxx
index 8338033e2263..5d9bc907ae24 100644
--- a/svtools/source/contnr/treelistbox.cxx
+++ b/svtools/source/contnr/treelistbox.cxx
@@ -810,10 +810,9 @@ const SvViewDataItem* SvTreeListBox::GetViewDataItem(const 
SvTreeListEntry* pEnt
     return &pEntryData->GetItem(nItemPos);
 }
 
-SvViewDataEntry* SvTreeListBox::CreateViewData( SvTreeListEntry* )
+std::unique_ptr<SvViewDataEntry> SvTreeListBox::CreateViewData( 
SvTreeListEntry* )
 {
-    SvViewDataEntry* pEntryData = new SvViewDataEntry;
-    return pEntryData;
+    return o3tl::make_unique<SvViewDataEntry>();
 }
 
 void SvTreeListBox::InitViewData( SvViewDataEntry* pData, SvTreeListEntry* 
pEntry )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to