summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-01-19 09:09:05 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-01-20 06:56:32 +0000
commit84defbc556c17aa58851fd14f8af0deaa3cc6e05 (patch)
tree8eb1b3dceea8ca8b6d2e62b3c20c8d121deb8a9e
parent3bb8bdb93f1546f64ff3f183d6162c41a03856bf (diff)
new loplugin: useuniqueptr: ucb..ucbhelper
Change-Id: Ib19ca3225b96d1bfec8a43bb762e16597f33b690 Reviewed-on: https://gerrit.libreoffice.org/33297 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--include/ucbhelper/contentinfo.hxx4
-rw-r--r--include/ucbhelper/propertyvalueset.hxx3
-rw-r--r--include/ucbhelper/resultsethelper.hxx2
-rw-r--r--ucb/source/cacher/cachedcontentresultset.cxx23
-rw-r--r--ucb/source/cacher/cachedcontentresultset.hxx5
-rw-r--r--ucb/source/cacher/dynamicresultsetwrapper.cxx6
-rw-r--r--ucb/source/cacher/dynamicresultsetwrapper.hxx3
-rw-r--r--ucb/source/core/ucb.cxx3
-rw-r--r--ucb/source/core/ucb.hxx3
-rw-r--r--ucb/source/core/ucbcmds.cxx12
-rw-r--r--ucb/source/core/ucbstore.cxx18
-rw-r--r--ucb/source/ucp/file/filnot.cxx1
-rw-r--r--ucb/source/ucp/file/filnot.hxx3
-rw-r--r--ucb/source/ucp/file/prov.cxx9
-rw-r--r--ucb/source/ucp/file/prov.hxx3
-rw-r--r--ucb/source/ucp/ftp/ftpdynresultset.cxx1
-rw-r--r--ucb/source/ucp/ftp/ftpdynresultset.hxx2
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.cxx5
-rw-r--r--ucb/source/ucp/hierarchy/hierarchydatasource.hxx7
-rw-r--r--ucb/source/ucp/package/pkgprovider.cxx3
-rw-r--r--ucb/source/ucp/package/pkgprovider.hxx2
-rw-r--r--ucb/source/ucp/webdav-neon/LinkSequence.cxx9
-rw-r--r--ucb/source/ucp/webdav-neon/LockEntrySequence.cxx7
-rw-r--r--ucb/source/ucp/webdav-neon/LockSequence.cxx8
-rw-r--r--ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx2
-rw-r--r--ucb/source/ucp/webdav-neon/webdavprovider.cxx1
-rw-r--r--ucb/source/ucp/webdav-neon/webdavprovider.hxx2
-rw-r--r--ucbhelper/source/provider/contentinfo.cxx16
-rw-r--r--ucbhelper/source/provider/propertyvalueset.cxx1
-rw-r--r--ucbhelper/source/provider/resultset.cxx11
-rw-r--r--ucbhelper/source/provider/resultsethelper.cxx4
31 files changed, 69 insertions, 110 deletions
diff --git a/include/ucbhelper/contentinfo.hxx b/include/ucbhelper/contentinfo.hxx
index ee1f9ec43420..171479ca0e1f 100644
--- a/include/ucbhelper/contentinfo.hxx
+++ b/include/ucbhelper/contentinfo.hxx
@@ -50,7 +50,7 @@ class PropertySetInfo :
{
css::uno::Reference< css::ucb::XCommandEnvironment >
m_xEnv;
- css::uno::Sequence< css::beans::Property >*
+ std::unique_ptr<css::uno::Sequence< css::beans::Property >>
m_pProps;
osl::Mutex m_aMutex;
ContentImplHelper* m_pContent;
@@ -113,7 +113,7 @@ class CommandProcessorInfo :
{
css::uno::Reference< css::ucb::XCommandEnvironment >
m_xEnv;
- css::uno::Sequence< css::ucb::CommandInfo >*
+ std::unique_ptr<css::uno::Sequence< css::ucb::CommandInfo >>
m_pCommands;
osl::Mutex m_aMutex;
ContentImplHelper* m_pContent;
diff --git a/include/ucbhelper/propertyvalueset.hxx b/include/ucbhelper/propertyvalueset.hxx
index c0c8c34ac698..e475243be8a4 100644
--- a/include/ucbhelper/propertyvalueset.hxx
+++ b/include/ucbhelper/propertyvalueset.hxx
@@ -29,6 +29,7 @@
#include <osl/mutex.hxx>
#include <ucbhelper/macros.hxx>
#include <ucbhelper/ucbhelperdllapi.h>
+#include <memory>
namespace com { namespace sun { namespace star { namespace script {
class XTypeConverter;
@@ -60,7 +61,7 @@ class UCBHELPER_DLLPUBLIC PropertyValueSet :
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter;
osl::Mutex m_aMutex;
- PropertyValues* m_pValues;
+ std::unique_ptr<PropertyValues> m_pValues;
bool m_bWasNull;
bool m_bTriedToGetTypeConverter;
diff --git a/include/ucbhelper/resultsethelper.hxx b/include/ucbhelper/resultsethelper.hxx
index e35466fce85c..078b1cb21c75 100644
--- a/include/ucbhelper/resultsethelper.hxx
+++ b/include/ucbhelper/resultsethelper.hxx
@@ -56,7 +56,7 @@ class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
public css::lang::XServiceInfo,
public css::ucb::XDynamicResultSet
{
- cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
+ std::unique_ptr<cppu::OInterfaceContainerHelper> m_pDisposeEventListeners;
bool m_bStatic;
bool m_bInitDone;
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index e1ab4c173063..e08edb397bc5 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -129,17 +129,12 @@ CachedContentResultSet::CCRS_Cache::CCRS_Cache(
CachedContentResultSet::CCRS_Cache::~CCRS_Cache()
{
- delete m_pResult;
}
void SAL_CALL CachedContentResultSet::CCRS_Cache
::clear()
{
- if( m_pResult )
- {
- delete m_pResult;
- m_pResult = nullptr;
- }
+ m_pResult.reset();
clearMappedReminder();
}
@@ -147,7 +142,7 @@ void SAL_CALL CachedContentResultSet::CCRS_Cache
::loadData( const FetchResult& rResult )
{
clear();
- m_pResult = new FetchResult( rResult );
+ m_pResult.reset( new FetchResult( rResult ) );
}
bool SAL_CALL CachedContentResultSet::CCRS_Cache
@@ -378,7 +373,7 @@ class CCRS_PropertySetInfo :
friend class CachedContentResultSet;
//my Properties
- Sequence< css::beans::Property >*
+ std::unique_ptr<Sequence< css::beans::Property >>
m_pProperties;
long m_nFetchSizePropertyHandle;
@@ -402,8 +397,6 @@ public:
explicit CCRS_PropertySetInfo( Reference<
XPropertySetInfo > const & xPropertySetInfoOrigin );
- virtual ~CCRS_PropertySetInfo() override;
-
// XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception ) override;
@@ -453,12 +446,12 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
if( xInfo.is() )
{
Sequence<Property> aProps = xInfo->getProperties();
- m_pProperties = new Sequence<Property> ( aProps );
+ m_pProperties.reset( new Sequence<Property> ( aProps ) );
}
else
{
OSL_FAIL( "The received XPropertySetInfo doesn't contain required properties" );
- m_pProperties = new Sequence<Property>;
+ m_pProperties.reset( new Sequence<Property> );
}
//ensure, that we haven't got the Properties 'FetchSize' and 'Direction' twice:
@@ -510,12 +503,6 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
}
}
-CCRS_PropertySetInfo::~CCRS_PropertySetInfo()
-{
- delete m_pProperties;
-}
-
-
// XInterface methods.
void SAL_CALL CCRS_PropertySetInfo::acquire()
diff --git a/ucb/source/cacher/cachedcontentresultset.hxx b/ucb/source/cacher/cachedcontentresultset.hxx
index 0d1a2a1c2d24..bced10f312e1 100644
--- a/ucb/source/cacher/cachedcontentresultset.hxx
+++ b/ucb/source/cacher/cachedcontentresultset.hxx
@@ -30,6 +30,8 @@
#include <com/sun/star/ucb/XCachedContentResultSetFactory.hpp>
#include <rtl/ref.hxx>
+#include <memory>
+
#define CACHED_CONTENT_RESULTSET_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSet"
#define CACHED_CONTENT_RESULTSET_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetFactory"
@@ -50,7 +52,8 @@ class CachedContentResultSet
class CCRS_Cache
{
private:
- css::ucb::FetchResult* m_pResult;
+ std::unique_ptr<css::ucb::FetchResult>
+ m_pResult;
css::uno::Reference< css::ucb::XContentIdentifierMapping >
m_xContentIdentifierMapping;
css::uno::Sequence< sal_Bool >* m_pMappedReminder;
diff --git a/ucb/source/cacher/dynamicresultsetwrapper.cxx b/ucb/source/cacher/dynamicresultsetwrapper.cxx
index 4afff6b4b04c..78aa7f39cd65 100644
--- a/ucb/source/cacher/dynamicresultsetwrapper.cxx
+++ b/ucb/source/cacher/dynamicresultsetwrapper.cxx
@@ -77,8 +77,6 @@ void SAL_CALL DynamicResultSetWrapper::impl_init()
DynamicResultSetWrapper::~DynamicResultSetWrapper()
{
//call impl_deinit() at start of destructor of derived class
-
- delete m_pDisposeEventListeners;
};
void SAL_CALL DynamicResultSetWrapper::impl_deinit()
@@ -173,8 +171,8 @@ void SAL_CALL DynamicResultSetWrapper::addEventListener( const Reference< XEvent
osl::Guard< osl::Mutex > aGuard( m_aMutex );
if ( !m_pDisposeEventListeners )
- m_pDisposeEventListeners =
- new OInterfaceContainerHelper2( m_aContainerMutex );
+ m_pDisposeEventListeners.reset(
+ new OInterfaceContainerHelper2( m_aContainerMutex ) );
m_pDisposeEventListeners->addInterface( Listener );
}
diff --git a/ucb/source/cacher/dynamicresultsetwrapper.hxx b/ucb/source/cacher/dynamicresultsetwrapper.hxx
index 8e614ecbef5b..733cc5f29d3b 100644
--- a/ucb/source/cacher/dynamicresultsetwrapper.hxx
+++ b/ucb/source/cacher/dynamicresultsetwrapper.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <rtl/ref.hxx>
+#include <memory>
class DynamicResultSetWrapperListener;
class DynamicResultSetWrapper
@@ -47,7 +48,7 @@ private:
bool m_bDisposed; ///Dispose call ready.
bool m_bInDispose;///In dispose call
osl::Mutex m_aContainerMutex;
- comphelper::OInterfaceContainerHelper2*
+ std::unique_ptr<comphelper::OInterfaceContainerHelper2>
m_pDisposeEventListeners;
protected:
rtl::Reference<DynamicResultSetWrapperListener>
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 717cb5880581..c452136ee086 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -238,7 +238,6 @@ UniversalContentBroker::UniversalContentBroker(
// virtual
UniversalContentBroker::~UniversalContentBroker()
{
- delete m_pDisposeEventListeners;
}
@@ -312,7 +311,7 @@ void SAL_CALL UniversalContentBroker::addEventListener(
throw( css::uno::RuntimeException, std::exception )
{
if ( !m_pDisposeEventListeners )
- m_pDisposeEventListeners = new OInterfaceContainerHelper2( m_aMutex );
+ m_pDisposeEventListeners.reset( new OInterfaceContainerHelper2( m_aMutex ) );
m_pDisposeEventListeners->addInterface( Listener );
}
diff --git a/ucb/source/core/ucb.hxx b/ucb/source/core/ucb.hxx
index 95069ba8e3e6..c09252829346 100644
--- a/ucb/source/core/ucb.hxx
+++ b/ucb/source/core/ucb.hxx
@@ -39,6 +39,7 @@
#include "providermap.hxx"
#include <ucbhelper/registerucb.hxx>
+#include <memory>
#include <vector>
@@ -211,7 +212,7 @@ private:
css::uno::Sequence< css::uno::Any > m_aArguments;
ProviderMap_Impl m_aProviders;
osl::Mutex m_aMutex;
- comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners;
+ std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners;
sal_Int32 m_nCommandId;
};
diff --git a/ucb/source/core/ucbcmds.cxx b/ucb/source/core/ucbcmds.cxx
index d8f87d1126d1..70f03c91fe24 100644
--- a/ucb/source/core/ucbcmds.cxx
+++ b/ucb/source/core/ucbcmds.cxx
@@ -198,11 +198,10 @@ uno::Reference< io::XInputStream > SAL_CALL ActiveDataSink::getInputStream()
class CommandProcessorInfo :
public cppu::WeakImplHelper< ucb::XCommandInfo >
{
- uno::Sequence< ucb::CommandInfo > * m_pInfo;
+ std::unique_ptr< uno::Sequence< ucb::CommandInfo > > m_pInfo;
public:
CommandProcessorInfo();
- virtual ~CommandProcessorInfo() override;
// XCommandInfo methods
virtual uno::Sequence< ucb::CommandInfo > SAL_CALL getCommands()
@@ -222,7 +221,7 @@ public:
CommandProcessorInfo::CommandProcessorInfo()
{
- m_pInfo = new uno::Sequence< ucb::CommandInfo >( 2 );
+ m_pInfo.reset( new uno::Sequence< ucb::CommandInfo >( 2 ) );
(*m_pInfo)[ 0 ]
= ucb::CommandInfo(
@@ -243,13 +242,6 @@ CommandProcessorInfo::CommandProcessorInfo()
// virtual
-CommandProcessorInfo::~CommandProcessorInfo()
-{
- delete m_pInfo;
-}
-
-
-// virtual
uno::Sequence< ucb::CommandInfo > SAL_CALL
CommandProcessorInfo::getCommands()
throw( uno::RuntimeException, std::exception )
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index 4b533d7b16d1..d51090765a59 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -113,12 +113,12 @@ PropertySetMap_Impl;
// class PropertySetInfo_Impl
class PropertySetInfo_Impl : public cppu::WeakImplHelper < XPropertySetInfo >
{
- Sequence< Property >* m_pProps;
+ std::unique_ptr<Sequence< Property >>
+ m_pProps;
PersistentPropertySet* m_pOwner;
public:
explicit PropertySetInfo_Impl(PersistentPropertySet* pOwner);
- virtual ~PropertySetInfo_Impl() override;
// XPropertySetInfo
virtual Sequence< Property > SAL_CALL getProperties()
@@ -129,7 +129,7 @@ public:
throw( RuntimeException, std::exception ) override;
// Non-interface methods.
- void reset() { delete m_pProps; m_pProps = nullptr; }
+ void reset() { m_pProps.reset(); }
};
@@ -2170,14 +2170,6 @@ PropertySetInfo_Impl::PropertySetInfo_Impl(
}
-// virtual
-PropertySetInfo_Impl::~PropertySetInfo_Impl()
-{
- delete m_pProps;
-
- // !!! Do not delete m_pOwner !!!
-}
-
// XPropertySetInfo methods.
@@ -2310,7 +2302,7 @@ Sequence< Property > SAL_CALL PropertySetInfo_Impl::getProperties()
}
// Success.
- m_pProps = pPropSeq;
+ m_pProps.reset( pPropSeq );
return *m_pProps;
}
}
@@ -2321,7 +2313,7 @@ Sequence< Property > SAL_CALL PropertySetInfo_Impl::getProperties()
}
OSL_FAIL( "PropertySetInfo_Impl::getProperties - Error!" );
- m_pProps = new Sequence< Property >( 0 );
+ m_pProps.reset( new Sequence< Property >( 0 ) );
}
return *m_pProps;
diff --git a/ucb/source/ucp/file/filnot.cxx b/ucb/source/ucp/file/filnot.cxx
index 49f074c062bd..9587755866ad 100644
--- a/ucb/source/ucp/file/filnot.cxx
+++ b/ucb/source/ucp/file/filnot.cxx
@@ -206,7 +206,6 @@ PropertyChangeNotifier::PropertyChangeNotifier(
PropertyChangeNotifier::~PropertyChangeNotifier()
{
- delete m_pListeners;
}
diff --git a/ucb/source/ucp/file/filnot.hxx b/ucb/source/ucp/file/filnot.hxx
index 2a5b510d3049..0a80f0f05920 100644
--- a/ucb/source/ucp/file/filnot.hxx
+++ b/ucb/source/ucp/file/filnot.hxx
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/ucb/XContentIdentifier.hpp>
#include "filglob.hxx"
+#include <memory>
#include <unordered_map>
#include <vector>
@@ -84,7 +85,7 @@ namespace fileaccess {
{
private:
css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
- ListenerMap* m_pListeners;
+ std::unique_ptr<ListenerMap> m_pListeners;
public:
PropertyChangeNotifier(
const css::uno::Reference< css::ucb::XContent >& xCreatorContent,
diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx
index 1264f4d4cc31..9659d5caaf59 100644
--- a/ucb/source/ucp/file/prov.cxx
+++ b/ucb/source/ucp/file/prov.cxx
@@ -92,14 +92,13 @@ FileProvider::FileProvider( const Reference< XComponentContext >& rxContext )
FileProvider::~FileProvider()
{
- delete m_pMyShell;
}
// XInitialization
void SAL_CALL FileProvider::init()
{
if( ! m_pMyShell )
- m_pMyShell = new TaskManager( m_xContext, this, true );
+ m_pMyShell.reset( new TaskManager( m_xContext, this, true ) );
}
@@ -113,9 +112,9 @@ FileProvider::initialize(
if( aArguments.getLength() > 0 &&
(aArguments[0] >>= config) &&
config == "NoConfig" )
- m_pMyShell = new TaskManager( m_xContext, this, false );
+ m_pMyShell.reset( new TaskManager( m_xContext, this, false ) );
else
- m_pMyShell = new TaskManager( m_xContext, this, true );
+ m_pMyShell.reset( new TaskManager( m_xContext, this, true ) );
}
}
@@ -177,7 +176,7 @@ FileProvider::queryContent(
if( err )
throw IllegalIdentifierException( THROW_WHERE );
- return Reference< XContent >( new BaseContent( m_pMyShell,xIdentifier,aUnc ) );
+ return Reference< XContent >( new BaseContent( m_pMyShell.get(), xIdentifier, aUnc ) );
}
diff --git a/ucb/source/ucp/file/prov.hxx b/ucb/source/ucp/file/prov.hxx
index 98d61e16881f..28c8238ea329 100644
--- a/ucb/source/ucp/file/prov.hxx
+++ b/ucb/source/ucp/file/prov.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <cppuhelper/implbase.hxx>
+#include <memory>
// FileProvider
@@ -196,7 +197,7 @@ namespace fileaccess {
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
- TaskManager* m_pMyShell;
+ std::unique_ptr<TaskManager> m_pMyShell;
};
} // end namespace fileaccess
diff --git a/ucb/source/ucp/ftp/ftpdynresultset.cxx b/ucb/source/ucp/ftp/ftpdynresultset.cxx
index dbdb4bbcf203..e4ca744525f8 100644
--- a/ucb/source/ucp/ftp/ftpdynresultset.cxx
+++ b/ucb/source/ucp/ftp/ftpdynresultset.cxx
@@ -44,7 +44,6 @@ DynamicResultSet::DynamicResultSet(
DynamicResultSet::~DynamicResultSet()
{
- delete m_pFactory;
}
diff --git a/ucb/source/ucp/ftp/ftpdynresultset.hxx b/ucb/source/ucp/ftp/ftpdynresultset.hxx
index e99c4b31a05a..928f29a2671a 100644
--- a/ucb/source/ucp/ftp/ftpdynresultset.hxx
+++ b/ucb/source/ucp/ftp/ftpdynresultset.hxx
@@ -31,7 +31,7 @@ namespace ftp {
class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
{
- ResultSetFactory* m_pFactory;
+ std::unique_ptr<ResultSetFactory> m_pFactory;
private:
virtual void initStatic() override;
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index 7f261ed846d3..4337e17761c9 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -223,7 +223,6 @@ HierarchyDataSource::HierarchyDataSource(
// virtual
HierarchyDataSource::~HierarchyDataSource()
{
- delete m_pDisposeEventListeners;
}
@@ -314,8 +313,8 @@ void SAL_CALL HierarchyDataSource::addEventListener(
osl::Guard< osl::Mutex > aGuard( m_aMutex );
if ( !m_pDisposeEventListeners )
- m_pDisposeEventListeners
- = new comphelper::OInterfaceContainerHelper2( m_aMutex );
+ m_pDisposeEventListeners.reset(
+ new comphelper::OInterfaceContainerHelper2( m_aMutex ) );
m_pDisposeEventListeners->addInterface( Listener );
}
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
index a6b994f7e8df..2f9b5cf79295 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.hxx
@@ -28,6 +28,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/weak.hxx>
#include <ucbhelper/macros.hxx>
+#include <memory>
namespace comphelper { class OInterfaceContainerHelper2; }
@@ -41,9 +42,9 @@ class HierarchyDataSource : public cppu::OWeakObject,
public css::lang::XMultiServiceFactory
{
osl::Mutex m_aMutex;
- css::uno::Reference< css::uno::XComponentContext > m_xContext;
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
- comphelper::OInterfaceContainerHelper2 * m_pDisposeEventListeners;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
+ css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
+ std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners;
public:
explicit HierarchyDataSource( const css::uno::Reference< css::uno::XComponentContext > & rxContext );
diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx
index f772f9d5d432..4095c2f64a8b 100644
--- a/ucb/source/ucp/package/pkgprovider.cxx
+++ b/ucb/source/ucp/package/pkgprovider.cxx
@@ -112,7 +112,6 @@ ContentProvider::ContentProvider(
// virtual
ContentProvider::~ContentProvider()
{
- delete m_pPackages;
}
// XInterface methods.
@@ -234,7 +233,7 @@ ContentProvider::createPackage( const PackageUri & rURI )
}
}
else
- m_pPackages = new Packages;
+ m_pPackages.reset( new Packages );
// Create new package...
uno::Sequence< uno::Any > aArguments( 1 );
diff --git a/ucb/source/ucp/package/pkgprovider.hxx b/ucb/source/ucp/package/pkgprovider.hxx
index 3abcf44fa9d7..dad04ea69091 100644
--- a/ucb/source/ucp/package/pkgprovider.hxx
+++ b/ucb/source/ucp/package/pkgprovider.hxx
@@ -45,7 +45,7 @@ class Packages;
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
{
- Packages* m_pPackages;
+ std::unique_ptr<Packages> m_pPackages;
public:
explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
diff --git a/ucb/source/ucp/webdav-neon/LinkSequence.cxx b/ucb/source/ucp/webdav-neon/LinkSequence.cxx
index 2551fa53cfd7..4fff36833eaf 100644
--- a/ucb/source/ucp/webdav-neon/LinkSequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LinkSequence.cxx
@@ -29,6 +29,7 @@
#include <config_lgpl.h>
#include <string.h>
#include <ne_xml.h>
+#include <memory>
#include "LinkSequence.hxx"
@@ -38,13 +39,13 @@ using namespace com::sun::star;
struct LinkSequenceParseContext
{
- ucb::Link * pLink;
+ std::unique_ptr<ucb::Link> pLink;
bool hasSource;
bool hasDestination;
LinkSequenceParseContext()
: pLink( nullptr ), hasSource( false ), hasDestination( false ) {}
- ~LinkSequenceParseContext() { delete pLink; }
+ ~LinkSequenceParseContext() {}
};
#define STATE_TOP (1)
@@ -91,7 +92,7 @@ extern "C" int LinkSequence_chardata_callback(
LinkSequenceParseContext * pCtx
= static_cast< LinkSequenceParseContext * >( userdata );
if ( !pCtx->pLink )
- pCtx->pLink = new ucb::Link;
+ pCtx->pLink.reset( new ucb::Link );
switch ( state )
{
@@ -120,7 +121,7 @@ extern "C" int LinkSequence_endelement_callback(
LinkSequenceParseContext * pCtx
= static_cast< LinkSequenceParseContext * >( userdata );
if ( !pCtx->pLink )
- pCtx->pLink = new ucb::Link;
+ pCtx->pLink.reset( new ucb::Link );
switch ( state )
{
diff --git a/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx b/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx
index d27f6b212924..7d3a839d5eec 100644
--- a/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx
@@ -30,6 +30,7 @@
#include <string.h>
#include <ne_xml.h>
#include "LockEntrySequence.hxx"
+#include <memory>
using namespace webdav_ucp;
using namespace com::sun::star;
@@ -37,13 +38,13 @@ using namespace com::sun::star;
struct LockEntrySequenceParseContext
{
- ucb::LockEntry * pEntry;
+ std::unique_ptr<ucb::LockEntry> pEntry;
bool hasScope;
bool hasType;
LockEntrySequenceParseContext()
: pEntry( nullptr ), hasScope( false ), hasType( false ) {}
- ~LockEntrySequenceParseContext() { delete pEntry; }
+ ~LockEntrySequenceParseContext() { }
};
#define STATE_TOP (1)
@@ -140,7 +141,7 @@ extern "C" int LockEntrySequence_endelement_callback(
LockEntrySequenceParseContext * pCtx
= static_cast< LockEntrySequenceParseContext * >( userdata );
if ( !pCtx->pEntry )
- pCtx->pEntry = new ucb::LockEntry;
+ pCtx->pEntry.reset( new ucb::LockEntry );
switch ( state )
{
diff --git a/ucb/source/ucp/webdav-neon/LockSequence.cxx b/ucb/source/ucp/webdav-neon/LockSequence.cxx
index e79ecd233a83..1598ed8c076a 100644
--- a/ucb/source/ucp/webdav-neon/LockSequence.cxx
+++ b/ucb/source/ucp/webdav-neon/LockSequence.cxx
@@ -38,7 +38,7 @@ using namespace com::sun::star;
struct LockSequenceParseContext
{
- ucb::Lock * pLock;
+ std::unique_ptr<ucb::Lock> pLock;
bool hasLockScope;
bool hasLockType;
bool hasDepth;
@@ -49,7 +49,7 @@ struct LockSequenceParseContext
: pLock( nullptr ), hasLockScope( false ), hasLockType( false ),
hasDepth( false ), hasHREF( false ), hasTimeout( false ) {}
- ~LockSequenceParseContext() { delete pLock; }
+ ~LockSequenceParseContext() {}
};
#define STATE_TOP (1)
@@ -133,7 +133,7 @@ extern "C" int LockSequence_chardata_callback(
LockSequenceParseContext * pCtx
= static_cast< LockSequenceParseContext * >( userdata );
if ( !pCtx->pLock )
- pCtx->pLock = new ucb::Lock;
+ pCtx->pLock.reset( new ucb::Lock );
// Beehive sends XML values containing trailing newlines.
if ( buf[ len - 1 ] == 0x0a )
@@ -242,7 +242,7 @@ extern "C" int LockSequence_endelement_callback(
LockSequenceParseContext * pCtx
= static_cast< LockSequenceParseContext * >( userdata );
if ( !pCtx->pLock )
- pCtx->pLock = new ucb::Lock;
+ pCtx->pLock.reset( new ucb::Lock );
switch ( state )
{
diff --git a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
index eaa586c7e577..c86938e533af 100644
--- a/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx
@@ -69,7 +69,7 @@ bool ContentProvider::getProperty(
osl::MutexGuard aGuard( m_aMutex );
if ( !m_pProps )
{
- m_pProps = new PropertyMap;
+ m_pProps.reset( new PropertyMap );
// Fill map of known properties...
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.cxx b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
index f373d835ee48..4c68042591fb 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
@@ -58,7 +58,6 @@ ContentProvider::ContentProvider(
// virtual
ContentProvider::~ContentProvider()
{
- delete m_pProps;
}
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.hxx b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
index 4a7557dfb4c5..cadd3f71e91c 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.hxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.hxx
@@ -73,7 +73,7 @@ namespace webdav_ucp {
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
{
rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory;
- PropertyMap * m_pProps;
+ std::unique_ptr<PropertyMap> m_pProps;
public:
explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
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<uno::Sequence< beans::Property >> 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 );
}