compilerplugins/clang/useuniqueptr.cxx | 3 +++ sfx2/source/doc/guisaveas.cxx | 18 +++++++----------- ucb/source/ucp/file/filrset.cxx | 16 ++++++---------- ucb/source/ucp/file/filrset.hxx | 7 +++---- 4 files changed, 19 insertions(+), 25 deletions(-)
New commits: commit 8a0935a9bc255df3f197ca484594e1cfb6514801 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Jan 23 14:58:44 2018 +0200 loplugin:useuniqueptr in XResultSet_impl Change-Id: I2f333d0d0784fc76f6a3b7a6a9e61b82b856afa0 Reviewed-on: https://gerrit.libreoffice.org/48703 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/ucb/source/ucp/file/filrset.cxx b/ucb/source/ucp/file/filrset.cxx index 81dd63afaea8..1d949a9996dd 100644 --- a/ucb/source/ucp/file/filrset.cxx +++ b/ucb/source/ucp/file/filrset.cxx @@ -88,10 +88,6 @@ XResultSet_impl::~XResultSet_impl() if( m_nIsOpen ) m_aFolder.close(); - - delete m_pDisposeEventListeners; - delete m_pRowCountListeners; - delete m_pIsFinalListeners; } @@ -109,8 +105,8 @@ XResultSet_impl::addEventListener( osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pDisposeEventListeners ) - m_pDisposeEventListeners = - new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); + m_pDisposeEventListeners.reset( + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ) ); m_pDisposeEventListeners->addInterface( Listener ); } @@ -681,8 +677,8 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener( { osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pIsFinalListeners ) - m_pIsFinalListeners = - new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); + m_pIsFinalListeners.reset( + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ) ); m_pIsFinalListeners->addInterface( xListener ); } @@ -690,8 +686,8 @@ void SAL_CALL XResultSet_impl::addPropertyChangeListener( { osl::MutexGuard aGuard( m_aMutex ); if ( ! m_pRowCountListeners ) - m_pRowCountListeners = - new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ); + m_pRowCountListeners.reset( + new comphelper::OInterfaceContainerHelper2( m_aEventListenerMutex ) ); m_pRowCountListeners->addInterface( xListener ); } else diff --git a/ucb/source/ucp/file/filrset.hxx b/ucb/source/ucp/file/filrset.hxx index 22f77d574891..c2ee576a3e65 100644 --- a/ucb/source/ucp/file/filrset.hxx +++ b/ucb/source/ucp/file/filrset.hxx @@ -439,10 +439,9 @@ class XResultSet_impl : public Notifier, osl::Mutex m_aMutex; osl::Mutex m_aEventListenerMutex; - comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; - - comphelper::OInterfaceContainerHelper2* m_pRowCountListeners; - comphelper::OInterfaceContainerHelper2* m_pIsFinalListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pRowCountListeners; + std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pIsFinalListeners; css::uno::Reference< css::ucb::XDynamicResultSetListener > m_xListener; commit 084571ee6ce7daf0d94f6c3e1ef7186edcf2b969 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Tue Jan 16 16:05:49 2018 +0200 loplugin:useuniqueptr in ModelData_Impl Change-Id: I66866ed1698fafe59ba31f99df09fb792da410e3 Reviewed-on: https://gerrit.libreoffice.org/48702 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/compilerplugins/clang/useuniqueptr.cxx b/compilerplugins/clang/useuniqueptr.cxx index 62d462d2d66d..56b669a5e1e1 100644 --- a/compilerplugins/clang/useuniqueptr.cxx +++ b/compilerplugins/clang/useuniqueptr.cxx @@ -235,6 +235,9 @@ void UseUniquePtr::CheckForForLoopDelete(const CXXDestructorDecl* destructorDecl StringRef aFileName = compiler.getSourceManager().getFilename(compiler.getSourceManager().getSpellingLoc(fieldDecl->getLocStart())); if (loplugin::hasPathnamePrefix(aFileName, WORKDIR)) continue; + // the std::vector is being passed to another class + if (loplugin::hasPathnamePrefix(aFileName, SRCDIR "/sfx2/source/explorer/nochaos.cxx")) + return; report( DiagnosticsEngine::Warning, diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx index 4240f62f16e2..4f878d32f14d 100644 --- a/sfx2/source/doc/guisaveas.cxx +++ b/sfx2/source/doc/guisaveas.cxx @@ -275,8 +275,8 @@ class ModelData_Impl uno::Reference< frame::XStorable2 > m_xStorable2; OUString m_aModuleName; - ::comphelper::SequenceAsHashMap* m_pDocumentPropsHM; - ::comphelper::SequenceAsHashMap* m_pModulePropsHM; + std::unique_ptr<::comphelper::SequenceAsHashMap> m_pDocumentPropsHM; + std::unique_ptr<::comphelper::SequenceAsHashMap> m_pModulePropsHM; ::comphelper::SequenceAsHashMap m_aMediaDescrHM; @@ -381,18 +381,14 @@ ModelData_Impl::ModelData_Impl( SfxStoringHelper& aOwner, ModelData_Impl::~ModelData_Impl() { FreeDocumentProps(); - delete m_pDocumentPropsHM; - delete m_pModulePropsHM; + m_pDocumentPropsHM.reset(); + m_pModulePropsHM.reset(); } void ModelData_Impl::FreeDocumentProps() { - if ( m_pDocumentPropsHM ) - { - delete m_pDocumentPropsHM; - m_pDocumentPropsHM = nullptr; - } + m_pDocumentPropsHM.reset(); } @@ -430,7 +426,7 @@ uno::Reference< frame::XStorable2 > const & ModelData_Impl::GetStorable2() const ::comphelper::SequenceAsHashMap& ModelData_Impl::GetDocProps() { if ( !m_pDocumentPropsHM ) - m_pDocumentPropsHM = new ::comphelper::SequenceAsHashMap( GetModel()->getArgs() ); + m_pDocumentPropsHM.reset( new ::comphelper::SequenceAsHashMap( GetModel()->getArgs() ) ); return *m_pDocumentPropsHM; } @@ -457,7 +453,7 @@ const ::comphelper::SequenceAsHashMap& ModelData_Impl::GetModuleProps() m_pOwner->GetModuleManager()->getByName( GetModuleName() ) >>= aModuleProps; if ( !aModuleProps.getLength() ) throw uno::RuntimeException(); // TODO; - m_pModulePropsHM = new ::comphelper::SequenceAsHashMap( aModuleProps ); + m_pModulePropsHM.reset( new ::comphelper::SequenceAsHashMap( aModuleProps ) ); } return *m_pModulePropsHM; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits