diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-10 11:44:28 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 07:37:16 +0100 |
commit | b27fee9e0ebb445ce82baeade3b249807dca392b (patch) | |
tree | ec602e834d8ac02c0495d1d25e2bed30fa22bfb3 /ucbhelper | |
parent | 96d9bd226215194632b6b0b7b0153f41ade1fc47 (diff) |
loplugin:useuniqueptr cppu,idlc,io,ucbhelper
Change-Id: I6d8c24fabd52b39c66ce0b88b547df7ec85dad76
Reviewed-on: https://gerrit.libreoffice.org/47725
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'ucbhelper')
-rw-r--r-- | ucbhelper/source/provider/contenthelper.cxx | 46 | ||||
-rw-r--r-- | ucbhelper/source/provider/resultset.cxx | 20 |
2 files changed, 21 insertions, 45 deletions
diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx index c6d08ec8afbd..f031df08a7a9 100644 --- a/ucbhelper/source/provider/contenthelper.cxx +++ b/ucbhelper/source/provider/contenthelper.cxx @@ -98,27 +98,11 @@ struct ContentImplHelper_Impl { rtl::Reference< ::ucbhelper::PropertySetInfo > m_xPropSetInfo; rtl::Reference< ::ucbhelper::CommandProcessorInfo > m_xCommandsInfo; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; - cppu::OInterfaceContainerHelper* m_pContentEventListeners; - cppu::OInterfaceContainerHelper* m_pPropSetChangeListeners; - cppu::OInterfaceContainerHelper* m_pCommandChangeListeners; - PropertyChangeListeners* m_pPropertyChangeListeners; - - ContentImplHelper_Impl() - : m_pDisposeEventListeners( nullptr ), - m_pContentEventListeners( nullptr ), - m_pPropSetChangeListeners( nullptr ), - m_pCommandChangeListeners( nullptr ), - m_pPropertyChangeListeners( nullptr ) {} - - ~ContentImplHelper_Impl() - { - delete m_pDisposeEventListeners; - delete m_pContentEventListeners; - delete m_pPropSetChangeListeners; - delete m_pCommandChangeListeners; - delete m_pPropertyChangeListeners; - } + std::unique_ptr<cppu::OInterfaceContainerHelper> m_pDisposeEventListeners; + std::unique_ptr<cppu::OInterfaceContainerHelper> m_pContentEventListeners; + std::unique_ptr<cppu::OInterfaceContainerHelper> m_pPropSetChangeListeners; + std::unique_ptr<cppu::OInterfaceContainerHelper> m_pCommandChangeListeners; + std::unique_ptr<PropertyChangeListeners> m_pPropertyChangeListeners; }; } // namespace ucbhelper_impl @@ -252,8 +236,8 @@ void SAL_CALL ContentImplHelper::addEventListener( osl::MutexGuard aGuard( m_aMutex ); if ( !m_pImpl->m_pDisposeEventListeners ) - m_pImpl->m_pDisposeEventListeners - = new cppu::OInterfaceContainerHelper( m_aMutex ); + m_pImpl->m_pDisposeEventListeners.reset( + new cppu::OInterfaceContainerHelper( m_aMutex )); m_pImpl->m_pDisposeEventListeners->addInterface( Listener ); } @@ -282,8 +266,8 @@ void SAL_CALL ContentImplHelper::addContentEventListener( osl::MutexGuard aGuard( m_aMutex ); if ( !m_pImpl->m_pContentEventListeners ) - m_pImpl->m_pContentEventListeners - = new cppu::OInterfaceContainerHelper( m_aMutex ); + m_pImpl->m_pContentEventListeners.reset( + new cppu::OInterfaceContainerHelper( m_aMutex )); m_pImpl->m_pContentEventListeners->addInterface( Listener ); } @@ -315,8 +299,8 @@ void SAL_CALL ContentImplHelper::addPropertiesChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( !m_pImpl->m_pPropertyChangeListeners ) - m_pImpl->m_pPropertyChangeListeners - = new PropertyChangeListeners( m_aMutex ); + m_pImpl->m_pPropertyChangeListeners.reset( + new PropertyChangeListeners( m_aMutex )); sal_Int32 nCount = PropertyNames.getLength(); if ( !nCount ) @@ -377,8 +361,8 @@ void SAL_CALL ContentImplHelper::addCommandInfoChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( !m_pImpl->m_pCommandChangeListeners ) - m_pImpl->m_pCommandChangeListeners - = new cppu::OInterfaceContainerHelper( m_aMutex ); + m_pImpl->m_pCommandChangeListeners.reset( + new cppu::OInterfaceContainerHelper( m_aMutex )); m_pImpl->m_pCommandChangeListeners->addInterface( Listener ); } @@ -583,8 +567,8 @@ void SAL_CALL ContentImplHelper::addPropertySetInfoChangeListener( osl::MutexGuard aGuard( m_aMutex ); if ( !m_pImpl->m_pPropSetChangeListeners ) - m_pImpl->m_pPropSetChangeListeners - = new cppu::OInterfaceContainerHelper( m_aMutex ); + m_pImpl->m_pPropSetChangeListeners.reset( + new cppu::OInterfaceContainerHelper( m_aMutex )); m_pImpl->m_pPropSetChangeListeners->addInterface( Listener ); } diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx index 780a2dc0fcdb..3c160e6d390f 100644 --- a/ucbhelper/source/provider/resultset.cxx +++ b/ucbhelper/source/provider/resultset.cxx @@ -143,8 +143,8 @@ struct ResultSet_Impl uno::Sequence< beans::Property > m_aProperties; rtl::Reference< ResultSetDataSupplier > m_xDataSupplier; osl::Mutex m_aMutex; - cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; - PropertyChangeListeners* m_pPropertyChangeListeners; + std::unique_ptr<cppu::OInterfaceContainerHelper> m_pDisposeEventListeners; + std::unique_ptr<PropertyChangeListeners> m_pPropertyChangeListeners; sal_Int32 m_nPos; bool m_bWasNull; bool m_bAfterLast; @@ -154,7 +154,6 @@ struct ResultSet_Impl const uno::Sequence< beans::Property >& rProperties, const rtl::Reference< ResultSetDataSupplier >& rDataSupplier, const uno::Reference< css::ucb::XCommandEnvironment >& rxEnv ); - inline ~ResultSet_Impl(); }; inline ResultSet_Impl::ResultSet_Impl( @@ -175,13 +174,6 @@ inline ResultSet_Impl::ResultSet_Impl( } -inline ResultSet_Impl::~ResultSet_Impl() -{ - delete m_pDisposeEventListeners; - delete m_pPropertyChangeListeners; -} - - // ResultSet Implementation. @@ -313,8 +305,8 @@ void SAL_CALL ResultSet::addEventListener( osl::MutexGuard aGuard( m_pImpl->m_aMutex ); if ( !m_pImpl->m_pDisposeEventListeners ) - m_pImpl->m_pDisposeEventListeners = - new cppu::OInterfaceContainerHelper( m_pImpl->m_aMutex ); + m_pImpl->m_pDisposeEventListeners.reset( + new cppu::OInterfaceContainerHelper( m_pImpl->m_aMutex )); m_pImpl->m_pDisposeEventListeners->addInterface( Listener ); } @@ -1314,8 +1306,8 @@ void SAL_CALL ResultSet::addPropertyChangeListener( throw beans::UnknownPropertyException(); if ( !m_pImpl->m_pPropertyChangeListeners ) - m_pImpl->m_pPropertyChangeListeners - = new PropertyChangeListeners( m_pImpl->m_aMutex ); + m_pImpl->m_pPropertyChangeListeners.reset( + new PropertyChangeListeners( m_pImpl->m_aMutex )); m_pImpl->m_pPropertyChangeListeners->addInterface( aPropertyName, xListener ); |