new loplugin: useuniqueptr: dbaccess

Change-Id: I2421cd032066c41f80e8b6560c8c4a73f26edeb2
Reviewed-on: https://gerrit.libreoffice.org/33151
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2017-01-16 09:31:32 +02:00
parent 4883355c31
commit 2abe0df63c
3 changed files with 6 additions and 8 deletions

View File

@@ -75,7 +75,6 @@ ODBTableDecorator::ODBTableDecorator( const Reference< XConnection >& _rxConnect
ODBTableDecorator::~ODBTableDecorator() ODBTableDecorator::~ODBTableDecorator()
{ {
delete m_pColumns;
} }
Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeException, std::exception) Sequence< sal_Int8 > ODBTableDecorator::getImplementationId() throw (RuntimeException, std::exception)
@@ -453,7 +452,7 @@ Reference< XNameAccess> ODBTableDecorator::getColumns() throw (RuntimeException,
if(!m_pColumns) if(!m_pColumns)
refreshColumns(); refreshColumns();
return m_pColumns; return m_pColumns.get();
} }
OUString SAL_CALL ODBTableDecorator::getName() throw(RuntimeException, std::exception) OUString SAL_CALL ODBTableDecorator::getName() throw(RuntimeException, std::exception)
@@ -577,7 +576,7 @@ void ODBTableDecorator::refreshColumns()
OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions ); OContainerMediator* pMediator = new OContainerMediator( pCol, m_xColumnDefinitions );
m_xColumnMediator = pMediator; m_xColumnMediator = pMediator;
pCol->setMediator( pMediator ); pCol->setMediator( pMediator );
m_pColumns = pCol; m_pColumns.reset( pCol );
} }
else else
m_pColumns->reFill(aVector); m_pColumns->reFill(aVector);

View File

@@ -73,7 +73,7 @@ namespace dbaccess
// <properties> // <properties>
mutable sal_Int32 m_nPrivileges; mutable sal_Int32 m_nPrivileges;
// </properties> // </properties>
::connectivity::sdbcx::OCollection* m_pColumns; std::unique_ptr<::connectivity::sdbcx::OCollection> m_pColumns;
// IColumnFactory // IColumnFactory
virtual OColumn* createColumn(const OUString& _rName) const override; virtual OColumn* createColumn(const OUString& _rName) const override;

View File

@@ -35,7 +35,7 @@ namespace dbaui
*/ */
class OModuleImpl class OModuleImpl
{ {
ResMgr* m_pResources; std::unique_ptr<ResMgr> m_pResources;
public: public:
/// ctor /// ctor
@@ -54,7 +54,6 @@ OModuleImpl::OModuleImpl()
OModuleImpl::~OModuleImpl() OModuleImpl::~OModuleImpl()
{ {
delete m_pResources;
} }
ResMgr* OModuleImpl::getResManager() ResMgr* OModuleImpl::getResManager()
@@ -64,9 +63,9 @@ ResMgr* OModuleImpl::getResManager()
if (!m_pResources) if (!m_pResources)
{ {
// create a manager with a fixed prefix // 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 // OModule