From 84defbc556c17aa58851fd14f8af0deaa3cc6e05 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 19 Jan 2017 09:09:05 +0200 Subject: new loplugin: useuniqueptr: ucb..ucbhelper Change-Id: Ib19ca3225b96d1bfec8a43bb762e16597f33b690 Reviewed-on: https://gerrit.libreoffice.org/33297 Tested-by: Jenkins Reviewed-by: Noel Grandin --- ucbhelper/source/provider/contentinfo.cxx | 16 ++++++---------- ucbhelper/source/provider/propertyvalueset.cxx | 1 - ucbhelper/source/provider/resultset.cxx | 11 ++--------- ucbhelper/source/provider/resultsethelper.cxx | 4 +--- 4 files changed, 9 insertions(+), 23 deletions(-) (limited to 'ucbhelper/source') diff --git a/ucbhelper/source/provider/contentinfo.cxx b/ucbhelper/source/provider/contentinfo.cxx index daeccdfcfb7e..b4838831cc3c 100644 --- a/ucbhelper/source/provider/contentinfo.cxx +++ b/ucbhelper/source/provider/contentinfo.cxx @@ -51,7 +51,6 @@ PropertySetInfo::PropertySetInfo( // virtual PropertySetInfo::~PropertySetInfo() { - delete m_pProps; } @@ -105,7 +104,7 @@ uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties() { uno::Sequence< beans::Property > aProps = m_pContent->getProperties( m_xEnv ); - m_pProps = new uno::Sequence< beans::Property >( aProps ); + m_pProps.reset(new uno::Sequence< beans::Property >( aProps )); } catch ( uno::RuntimeException const & ) { @@ -113,7 +112,7 @@ uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties() } catch ( uno::Exception const & ) { - m_pProps = new uno::Sequence< beans::Property >( 0 ); + m_pProps.reset(new uno::Sequence< beans::Property >( 0 )); } @@ -182,8 +181,7 @@ sal_Bool SAL_CALL PropertySetInfo::hasPropertyByName( void PropertySetInfo::reset() { osl::MutexGuard aGuard( m_aMutex ); - delete m_pProps; - m_pProps = nullptr; + m_pProps.reset(); } @@ -226,7 +224,6 @@ CommandProcessorInfo::CommandProcessorInfo( // virtual CommandProcessorInfo::~CommandProcessorInfo() { - delete m_pCommands; } @@ -284,7 +281,7 @@ CommandProcessorInfo::getCommands() { uno::Sequence< css::ucb::CommandInfo > aCmds = m_pContent->getCommands( m_xEnv ); - m_pCommands = new uno::Sequence< css::ucb::CommandInfo >( aCmds ); + m_pCommands.reset(new uno::Sequence< css::ucb::CommandInfo >( aCmds )); } catch ( uno::RuntimeException const & ) { @@ -292,7 +289,7 @@ CommandProcessorInfo::getCommands() } catch ( uno::Exception const & ) { - m_pCommands = new uno::Sequence< css::ucb::CommandInfo >( 0 ); + m_pCommands.reset(new uno::Sequence< css::ucb::CommandInfo >( 0 )); } } } @@ -354,8 +351,7 @@ sal_Bool SAL_CALL CommandProcessorInfo::hasCommandByHandle( sal_Int32 Handle ) void CommandProcessorInfo::reset() { osl::MutexGuard aGuard( m_aMutex ); - delete m_pCommands; - m_pCommands = nullptr; + m_pCommands.reset(); } diff --git a/ucbhelper/source/provider/propertyvalueset.cxx b/ucbhelper/source/provider/propertyvalueset.cxx index 4fd70e3e975b..5f836d149327 100644 --- a/ucbhelper/source/provider/propertyvalueset.cxx +++ b/ucbhelper/source/provider/propertyvalueset.cxx @@ -242,7 +242,6 @@ PropertyValueSet::PropertyValueSet( // virtual PropertyValueSet::~PropertyValueSet() { - delete m_pValues; } diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx index fb6d33239c41..2bf8c54dc45c 100644 --- a/ucbhelper/source/provider/resultset.cxx +++ b/ucbhelper/source/provider/resultset.cxx @@ -83,7 +83,7 @@ class PropertySetInfo : public lang::XTypeProvider, public beans::XPropertySetInfo { - uno::Sequence< beans::Property >* m_pProps; + std::unique_ptr> m_pProps; private: bool queryProperty( @@ -93,7 +93,6 @@ public: PropertySetInfo( const PropertyInfo* pProps, sal_Int32 nProps ); - virtual ~PropertySetInfo() override; // XInterface virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) @@ -1527,8 +1526,8 @@ namespace ucbhelper_impl { PropertySetInfo::PropertySetInfo( const PropertyInfo* pProps, sal_Int32 nProps ) + : m_pProps( new uno::Sequence< beans::Property >( nProps ) ) { - m_pProps = new uno::Sequence< beans::Property >( nProps ); if ( nProps ) { @@ -1550,12 +1549,6 @@ PropertySetInfo::PropertySetInfo( } -// virtual -PropertySetInfo::~PropertySetInfo() -{ - delete m_pProps; -} - // XInterface methods. void SAL_CALL PropertySetInfo::acquire() diff --git a/ucbhelper/source/provider/resultsethelper.cxx b/ucbhelper/source/provider/resultsethelper.cxx index 37a131011df4..314e4e6e6d58 100644 --- a/ucbhelper/source/provider/resultsethelper.cxx +++ b/ucbhelper/source/provider/resultsethelper.cxx @@ -60,7 +60,6 @@ ResultSetImplHelper::ResultSetImplHelper( // virtual ResultSetImplHelper::~ResultSetImplHelper() { - delete m_pDisposeEventListeners; } @@ -144,8 +143,7 @@ void SAL_CALL ResultSetImplHelper::addEventListener( osl::MutexGuard aGuard( m_aMutex ); if ( !m_pDisposeEventListeners ) - m_pDisposeEventListeners - = new cppu::OInterfaceContainerHelper( m_aMutex ); + m_pDisposeEventListeners.reset(new cppu::OInterfaceContainerHelper( m_aMutex )); m_pDisposeEventListeners->addInterface( Listener ); } -- cgit