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

Noel Grandin noel.grandin at collabora.co.uk
Mon Jan 16 09:05:20 UTC 2017


 dbaccess/source/core/api/TableDeco.cxx |    5 ++---
 dbaccess/source/core/inc/TableDeco.hxx |    2 +-
 dbaccess/source/ui/misc/moduledbu.cxx  |    7 +++----
 3 files changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 2abe0df63c59637ea1b00703458edf71dff8167c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jan 16 09:31:32 2017 +0200

    new loplugin: useuniqueptr: dbaccess
    
    Change-Id: I2421cd032066c41f80e8b6560c8c4a73f26edeb2
    Reviewed-on: https://gerrit.libreoffice.org/33151
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/dbaccess/source/core/api/TableDeco.cxx b/dbaccess/source/core/api/TableDeco.cxx
index 643ed93..54c82bc 100644
--- a/dbaccess/source/core/api/TableDeco.cxx
+++ b/dbaccess/source/core/api/TableDeco.cxx
@@ -75,7 +75,6 @@ ODBTableDecorator::ODBTableDecorator( const Reference< XConnection >& _rxConnect
 
 ODBTableDecorator::~ODBTableDecorator()
 {
-    delete m_pColumns;
 }
 
 Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeException, std::exception)
@@ -453,7 +452,7 @@ Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException,
     if(!m_pColumns)
         refreshColumns();
 
-    return m_pColumns;
+    return m_pColumns.get();
 }
 
 OUString SAL_CALL ODBTableDecorator::getName() throw(RuntimeException, std::exception)
@@ -577,7 +576,7 @@ void ODBTableDecorator::refreshColumns()
         OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
         m_xColumnMediator = pMediator;
         pCol->setMediator( pMediator );
-        m_pColumns  = pCol;
+        m_pColumns.reset( pCol );
     }
     else
         m_pColumns->reFill(aVector);
diff --git a/dbaccess/source/core/inc/TableDeco.hxx b/dbaccess/source/core/inc/TableDeco.hxx
index 1107014..7c269f7 100644
--- a/dbaccess/source/core/inc/TableDeco.hxx
+++ b/dbaccess/source/core/inc/TableDeco.hxx
@@ -73,7 +73,7 @@ namespace dbaccess
     // <properties>
         mutable sal_Int32                                         m_nPrivileges;
     // </properties>
-        ::connectivity::sdbcx::OCollection*                       m_pColumns;
+        std::unique_ptr<::connectivity::sdbcx::OCollection>       m_pColumns;
 
         // IColumnFactory
         virtual OColumn*    createColumn(const OUString& _rName) const override;
diff --git a/dbaccess/source/ui/misc/moduledbu.cxx b/dbaccess/source/ui/misc/moduledbu.cxx
index 8e30860..8f1bba1 100644
--- a/dbaccess/source/ui/misc/moduledbu.cxx
+++ b/dbaccess/source/ui/misc/moduledbu.cxx
@@ -35,7 +35,7 @@ namespace dbaui
 */
 class OModuleImpl
 {
-    ResMgr* m_pResources;
+    std::unique_ptr<ResMgr> m_pResources;
 
 public:
     /// ctor
@@ -54,7 +54,6 @@ OModuleImpl::OModuleImpl()
 
 OModuleImpl::~OModuleImpl()
 {
-    delete m_pResources;
 }
 
 ResMgr* OModuleImpl::getResManager()
@@ -64,9 +63,9 @@ ResMgr* OModuleImpl::getResManager()
     if (!m_pResources)
     {
         // create a manager with a fixed prefix
-        m_pResources = ResMgr::CreateResMgr("dbu");
+        m_pResources.reset( ResMgr::CreateResMgr("dbu") );
     }
-    return m_pResources;
+    return m_pResources.get();
 }
 
 // OModule


More information about the Libreoffice-commits mailing list