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>
This commit is contained in:
Noel Grandin 2017-01-19 09:09:05 +02:00
parent 3bb8bdb93f
commit 84defbc556
31 changed files with 69 additions and 110 deletions

View File

@ -50,7 +50,7 @@ class PropertySetInfo :
{ {
css::uno::Reference< css::ucb::XCommandEnvironment > css::uno::Reference< css::ucb::XCommandEnvironment >
m_xEnv; m_xEnv;
css::uno::Sequence< css::beans::Property >* std::unique_ptr<css::uno::Sequence< css::beans::Property >>
m_pProps; m_pProps;
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
ContentImplHelper* m_pContent; ContentImplHelper* m_pContent;
@ -113,7 +113,7 @@ class CommandProcessorInfo :
{ {
css::uno::Reference< css::ucb::XCommandEnvironment > css::uno::Reference< css::ucb::XCommandEnvironment >
m_xEnv; m_xEnv;
css::uno::Sequence< css::ucb::CommandInfo >* std::unique_ptr<css::uno::Sequence< css::ucb::CommandInfo >>
m_pCommands; m_pCommands;
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
ContentImplHelper* m_pContent; ContentImplHelper* m_pContent;

View File

@ -29,6 +29,7 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <ucbhelper/macros.hxx> #include <ucbhelper/macros.hxx>
#include <ucbhelper/ucbhelperdllapi.h> #include <ucbhelper/ucbhelperdllapi.h>
#include <memory>
namespace com { namespace sun { namespace star { namespace script { namespace com { namespace sun { namespace star { namespace script {
class XTypeConverter; class XTypeConverter;
@ -60,7 +61,7 @@ class UCBHELPER_DLLPUBLIC PropertyValueSet :
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter; css::uno::Reference< css::script::XTypeConverter > m_xTypeConverter;
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
PropertyValues* m_pValues; std::unique_ptr<PropertyValues> m_pValues;
bool m_bWasNull; bool m_bWasNull;
bool m_bTriedToGetTypeConverter; bool m_bTriedToGetTypeConverter;

View File

@ -56,7 +56,7 @@ class UCBHELPER_DLLPUBLIC ResultSetImplHelper :
public css::lang::XServiceInfo, public css::lang::XServiceInfo,
public css::ucb::XDynamicResultSet public css::ucb::XDynamicResultSet
{ {
cppu::OInterfaceContainerHelper* m_pDisposeEventListeners; std::unique_ptr<cppu::OInterfaceContainerHelper> m_pDisposeEventListeners;
bool m_bStatic; bool m_bStatic;
bool m_bInitDone; bool m_bInitDone;

View File

@ -129,17 +129,12 @@ CachedContentResultSet::CCRS_Cache::CCRS_Cache(
CachedContentResultSet::CCRS_Cache::~CCRS_Cache() CachedContentResultSet::CCRS_Cache::~CCRS_Cache()
{ {
delete m_pResult;
} }
void SAL_CALL CachedContentResultSet::CCRS_Cache void SAL_CALL CachedContentResultSet::CCRS_Cache
::clear() ::clear()
{ {
if( m_pResult ) m_pResult.reset();
{
delete m_pResult;
m_pResult = nullptr;
}
clearMappedReminder(); clearMappedReminder();
} }
@ -147,7 +142,7 @@ void SAL_CALL CachedContentResultSet::CCRS_Cache
::loadData( const FetchResult& rResult ) ::loadData( const FetchResult& rResult )
{ {
clear(); clear();
m_pResult = new FetchResult( rResult ); m_pResult.reset( new FetchResult( rResult ) );
} }
bool SAL_CALL CachedContentResultSet::CCRS_Cache bool SAL_CALL CachedContentResultSet::CCRS_Cache
@ -378,7 +373,7 @@ class CCRS_PropertySetInfo :
friend class CachedContentResultSet; friend class CachedContentResultSet;
//my Properties //my Properties
Sequence< css::beans::Property >* std::unique_ptr<Sequence< css::beans::Property >>
m_pProperties; m_pProperties;
long m_nFetchSizePropertyHandle; long m_nFetchSizePropertyHandle;
@ -402,8 +397,6 @@ public:
explicit CCRS_PropertySetInfo( Reference< explicit CCRS_PropertySetInfo( Reference<
XPropertySetInfo > const & xPropertySetInfoOrigin ); XPropertySetInfo > const & xPropertySetInfoOrigin );
virtual ~CCRS_PropertySetInfo() override;
// XInterface // XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
throw( css::uno::RuntimeException, std::exception ) override; throw( css::uno::RuntimeException, std::exception ) override;
@ -453,12 +446,12 @@ CCRS_PropertySetInfo::CCRS_PropertySetInfo(
if( xInfo.is() ) if( xInfo.is() )
{ {
Sequence<Property> aProps = xInfo->getProperties(); Sequence<Property> aProps = xInfo->getProperties();
m_pProperties = new Sequence<Property> ( aProps ); m_pProperties.reset( new Sequence<Property> ( aProps ) );
} }
else else
{ {
OSL_FAIL( "The received XPropertySetInfo doesn't contain required properties" ); 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: //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. // XInterface methods.
void SAL_CALL CCRS_PropertySetInfo::acquire() void SAL_CALL CCRS_PropertySetInfo::acquire()

View File

@ -30,6 +30,8 @@
#include <com/sun/star/ucb/XCachedContentResultSetFactory.hpp> #include <com/sun/star/ucb/XCachedContentResultSetFactory.hpp>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <memory>
#define CACHED_CONTENT_RESULTSET_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSet" #define CACHED_CONTENT_RESULTSET_SERVICE_NAME "com.sun.star.ucb.CachedContentResultSet"
#define CACHED_CONTENT_RESULTSET_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetFactory" #define CACHED_CONTENT_RESULTSET_FACTORY_NAME "com.sun.star.ucb.CachedContentResultSetFactory"
@ -50,7 +52,8 @@ class CachedContentResultSet
class CCRS_Cache class CCRS_Cache
{ {
private: private:
css::ucb::FetchResult* m_pResult; std::unique_ptr<css::ucb::FetchResult>
m_pResult;
css::uno::Reference< css::ucb::XContentIdentifierMapping > css::uno::Reference< css::ucb::XContentIdentifierMapping >
m_xContentIdentifierMapping; m_xContentIdentifierMapping;
css::uno::Sequence< sal_Bool >* m_pMappedReminder; css::uno::Sequence< sal_Bool >* m_pMappedReminder;

View File

@ -77,8 +77,6 @@ void SAL_CALL DynamicResultSetWrapper::impl_init()
DynamicResultSetWrapper::~DynamicResultSetWrapper() DynamicResultSetWrapper::~DynamicResultSetWrapper()
{ {
//call impl_deinit() at start of destructor of derived class //call impl_deinit() at start of destructor of derived class
delete m_pDisposeEventListeners;
}; };
void SAL_CALL DynamicResultSetWrapper::impl_deinit() 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 ); osl::Guard< osl::Mutex > aGuard( m_aMutex );
if ( !m_pDisposeEventListeners ) if ( !m_pDisposeEventListeners )
m_pDisposeEventListeners = m_pDisposeEventListeners.reset(
new OInterfaceContainerHelper2( m_aContainerMutex ); new OInterfaceContainerHelper2( m_aContainerMutex ) );
m_pDisposeEventListeners->addInterface( Listener ); m_pDisposeEventListeners->addInterface( Listener );
} }

View File

@ -35,6 +35,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <rtl/ref.hxx> #include <rtl/ref.hxx>
#include <memory>
class DynamicResultSetWrapperListener; class DynamicResultSetWrapperListener;
class DynamicResultSetWrapper class DynamicResultSetWrapper
@ -47,7 +48,7 @@ private:
bool m_bDisposed; ///Dispose call ready. bool m_bDisposed; ///Dispose call ready.
bool m_bInDispose;///In dispose call bool m_bInDispose;///In dispose call
osl::Mutex m_aContainerMutex; osl::Mutex m_aContainerMutex;
comphelper::OInterfaceContainerHelper2* std::unique_ptr<comphelper::OInterfaceContainerHelper2>
m_pDisposeEventListeners; m_pDisposeEventListeners;
protected: protected:
rtl::Reference<DynamicResultSetWrapperListener> rtl::Reference<DynamicResultSetWrapperListener>

View File

@ -238,7 +238,6 @@ UniversalContentBroker::UniversalContentBroker(
// virtual // virtual
UniversalContentBroker::~UniversalContentBroker() UniversalContentBroker::~UniversalContentBroker()
{ {
delete m_pDisposeEventListeners;
} }
@ -312,7 +311,7 @@ void SAL_CALL UniversalContentBroker::addEventListener(
throw( css::uno::RuntimeException, std::exception ) throw( css::uno::RuntimeException, std::exception )
{ {
if ( !m_pDisposeEventListeners ) if ( !m_pDisposeEventListeners )
m_pDisposeEventListeners = new OInterfaceContainerHelper2( m_aMutex ); m_pDisposeEventListeners.reset( new OInterfaceContainerHelper2( m_aMutex ) );
m_pDisposeEventListeners->addInterface( Listener ); m_pDisposeEventListeners->addInterface( Listener );
} }

View File

@ -39,6 +39,7 @@
#include "providermap.hxx" #include "providermap.hxx"
#include <ucbhelper/registerucb.hxx> #include <ucbhelper/registerucb.hxx>
#include <memory>
#include <vector> #include <vector>
@ -211,7 +212,7 @@ private:
css::uno::Sequence< css::uno::Any > m_aArguments; css::uno::Sequence< css::uno::Any > m_aArguments;
ProviderMap_Impl m_aProviders; ProviderMap_Impl m_aProviders;
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
comphelper::OInterfaceContainerHelper2* m_pDisposeEventListeners; std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners;
sal_Int32 m_nCommandId; sal_Int32 m_nCommandId;
}; };

View File

@ -198,11 +198,10 @@ uno::Reference< io::XInputStream > SAL_CALL ActiveDataSink::getInputStream()
class CommandProcessorInfo : class CommandProcessorInfo :
public cppu::WeakImplHelper< ucb::XCommandInfo > public cppu::WeakImplHelper< ucb::XCommandInfo >
{ {
uno::Sequence< ucb::CommandInfo > * m_pInfo; std::unique_ptr< uno::Sequence< ucb::CommandInfo > > m_pInfo;
public: public:
CommandProcessorInfo(); CommandProcessorInfo();
virtual ~CommandProcessorInfo() override;
// XCommandInfo methods // XCommandInfo methods
virtual uno::Sequence< ucb::CommandInfo > SAL_CALL getCommands() virtual uno::Sequence< ucb::CommandInfo > SAL_CALL getCommands()
@ -222,7 +221,7 @@ public:
CommandProcessorInfo::CommandProcessorInfo() CommandProcessorInfo::CommandProcessorInfo()
{ {
m_pInfo = new uno::Sequence< ucb::CommandInfo >( 2 ); m_pInfo.reset( new uno::Sequence< ucb::CommandInfo >( 2 ) );
(*m_pInfo)[ 0 ] (*m_pInfo)[ 0 ]
= ucb::CommandInfo( = ucb::CommandInfo(
@ -242,13 +241,6 @@ CommandProcessorInfo::CommandProcessorInfo()
} }
// virtual
CommandProcessorInfo::~CommandProcessorInfo()
{
delete m_pInfo;
}
// virtual // virtual
uno::Sequence< ucb::CommandInfo > SAL_CALL uno::Sequence< ucb::CommandInfo > SAL_CALL
CommandProcessorInfo::getCommands() CommandProcessorInfo::getCommands()

View File

@ -113,12 +113,12 @@ PropertySetMap_Impl;
// class PropertySetInfo_Impl // class PropertySetInfo_Impl
class PropertySetInfo_Impl : public cppu::WeakImplHelper < XPropertySetInfo > class PropertySetInfo_Impl : public cppu::WeakImplHelper < XPropertySetInfo >
{ {
Sequence< Property >* m_pProps; std::unique_ptr<Sequence< Property >>
m_pProps;
PersistentPropertySet* m_pOwner; PersistentPropertySet* m_pOwner;
public: public:
explicit PropertySetInfo_Impl(PersistentPropertySet* pOwner); explicit PropertySetInfo_Impl(PersistentPropertySet* pOwner);
virtual ~PropertySetInfo_Impl() override;
// XPropertySetInfo // XPropertySetInfo
virtual Sequence< Property > SAL_CALL getProperties() virtual Sequence< Property > SAL_CALL getProperties()
@ -129,7 +129,7 @@ public:
throw( RuntimeException, std::exception ) override; throw( RuntimeException, std::exception ) override;
// Non-interface methods. // 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. // XPropertySetInfo methods.
@ -2310,7 +2302,7 @@ Sequence< Property > SAL_CALL PropertySetInfo_Impl::getProperties()
} }
// Success. // Success.
m_pProps = pPropSeq; m_pProps.reset( pPropSeq );
return *m_pProps; return *m_pProps;
} }
} }
@ -2321,7 +2313,7 @@ Sequence< Property > SAL_CALL PropertySetInfo_Impl::getProperties()
} }
OSL_FAIL( "PropertySetInfo_Impl::getProperties - Error!" ); OSL_FAIL( "PropertySetInfo_Impl::getProperties - Error!" );
m_pProps = new Sequence< Property >( 0 ); m_pProps.reset( new Sequence< Property >( 0 ) );
} }
return *m_pProps; return *m_pProps;

View File

@ -206,7 +206,6 @@ PropertyChangeNotifier::PropertyChangeNotifier(
PropertyChangeNotifier::~PropertyChangeNotifier() PropertyChangeNotifier::~PropertyChangeNotifier()
{ {
delete m_pListeners;
} }

View File

@ -24,6 +24,7 @@
#include <com/sun/star/beans/PropertyChangeEvent.hpp> #include <com/sun/star/beans/PropertyChangeEvent.hpp>
#include <com/sun/star/ucb/XContentIdentifier.hpp> #include <com/sun/star/ucb/XContentIdentifier.hpp>
#include "filglob.hxx" #include "filglob.hxx"
#include <memory>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
@ -84,7 +85,7 @@ namespace fileaccess {
{ {
private: private:
css::uno::Reference< css::ucb::XContent > m_xCreatorContent; css::uno::Reference< css::ucb::XContent > m_xCreatorContent;
ListenerMap* m_pListeners; std::unique_ptr<ListenerMap> m_pListeners;
public: public:
PropertyChangeNotifier( PropertyChangeNotifier(
const css::uno::Reference< css::ucb::XContent >& xCreatorContent, const css::uno::Reference< css::ucb::XContent >& xCreatorContent,

View File

@ -92,14 +92,13 @@ FileProvider::FileProvider( const Reference< XComponentContext >& rxContext )
FileProvider::~FileProvider() FileProvider::~FileProvider()
{ {
delete m_pMyShell;
} }
// XInitialization // XInitialization
void SAL_CALL FileProvider::init() void SAL_CALL FileProvider::init()
{ {
if( ! m_pMyShell ) 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 && if( aArguments.getLength() > 0 &&
(aArguments[0] >>= config) && (aArguments[0] >>= config) &&
config == "NoConfig" ) config == "NoConfig" )
m_pMyShell = new TaskManager( m_xContext, this, false ); m_pMyShell.reset( new TaskManager( m_xContext, this, false ) );
else 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 ) if( err )
throw IllegalIdentifierException( THROW_WHERE ); throw IllegalIdentifierException( THROW_WHERE );
return Reference< XContent >( new BaseContent( m_pMyShell,xIdentifier,aUnc ) ); return Reference< XContent >( new BaseContent( m_pMyShell.get(), xIdentifier, aUnc ) );
} }

View File

@ -36,6 +36,7 @@
#include <com/sun/star/ucb/XFileIdentifierConverter.hpp> #include <com/sun/star/ucb/XFileIdentifierConverter.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <memory>
// FileProvider // FileProvider
@ -196,7 +197,7 @@ namespace fileaccess {
css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo; css::uno::Reference< css::beans::XPropertySetInfo > m_xPropertySetInfo;
TaskManager* m_pMyShell; std::unique_ptr<TaskManager> m_pMyShell;
}; };
} // end namespace fileaccess } // end namespace fileaccess

View File

@ -44,7 +44,6 @@ DynamicResultSet::DynamicResultSet(
DynamicResultSet::~DynamicResultSet() DynamicResultSet::~DynamicResultSet()
{ {
delete m_pFactory;
} }

View File

@ -31,7 +31,7 @@ namespace ftp {
class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper class DynamicResultSet : public ::ucbhelper::ResultSetImplHelper
{ {
ResultSetFactory* m_pFactory; std::unique_ptr<ResultSetFactory> m_pFactory;
private: private:
virtual void initStatic() override; virtual void initStatic() override;

View File

@ -223,7 +223,6 @@ HierarchyDataSource::HierarchyDataSource(
// virtual // virtual
HierarchyDataSource::~HierarchyDataSource() HierarchyDataSource::~HierarchyDataSource()
{ {
delete m_pDisposeEventListeners;
} }
@ -314,8 +313,8 @@ void SAL_CALL HierarchyDataSource::addEventListener(
osl::Guard< osl::Mutex > aGuard( m_aMutex ); osl::Guard< osl::Mutex > aGuard( m_aMutex );
if ( !m_pDisposeEventListeners ) if ( !m_pDisposeEventListeners )
m_pDisposeEventListeners m_pDisposeEventListeners.reset(
= new comphelper::OInterfaceContainerHelper2( m_aMutex ); new comphelper::OInterfaceContainerHelper2( m_aMutex ) );
m_pDisposeEventListeners->addInterface( Listener ); m_pDisposeEventListeners->addInterface( Listener );
} }

View File

@ -28,6 +28,7 @@
#include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
#include <ucbhelper/macros.hxx> #include <ucbhelper/macros.hxx>
#include <memory>
namespace comphelper { class OInterfaceContainerHelper2; } namespace comphelper { class OInterfaceContainerHelper2; }
@ -41,9 +42,9 @@ class HierarchyDataSource : public cppu::OWeakObject,
public css::lang::XMultiServiceFactory public css::lang::XMultiServiceFactory
{ {
osl::Mutex m_aMutex; osl::Mutex m_aMutex;
css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider; css::uno::Reference< css::lang::XMultiServiceFactory > m_xConfigProvider;
comphelper::OInterfaceContainerHelper2 * m_pDisposeEventListeners; std::unique_ptr<comphelper::OInterfaceContainerHelper2> m_pDisposeEventListeners;
public: public:
explicit HierarchyDataSource( const css::uno::Reference< css::uno::XComponentContext > & rxContext ); explicit HierarchyDataSource( const css::uno::Reference< css::uno::XComponentContext > & rxContext );

View File

@ -112,7 +112,6 @@ ContentProvider::ContentProvider(
// virtual // virtual
ContentProvider::~ContentProvider() ContentProvider::~ContentProvider()
{ {
delete m_pPackages;
} }
// XInterface methods. // XInterface methods.
@ -234,7 +233,7 @@ ContentProvider::createPackage( const PackageUri & rURI )
} }
} }
else else
m_pPackages = new Packages; m_pPackages.reset( new Packages );
// Create new package... // Create new package...
uno::Sequence< uno::Any > aArguments( 1 ); uno::Sequence< uno::Any > aArguments( 1 );

View File

@ -45,7 +45,7 @@ class Packages;
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
{ {
Packages* m_pPackages; std::unique_ptr<Packages> m_pPackages;
public: public:
explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );

View File

@ -29,6 +29,7 @@
#include <config_lgpl.h> #include <config_lgpl.h>
#include <string.h> #include <string.h>
#include <ne_xml.h> #include <ne_xml.h>
#include <memory>
#include "LinkSequence.hxx" #include "LinkSequence.hxx"
@ -38,13 +39,13 @@ using namespace com::sun::star;
struct LinkSequenceParseContext struct LinkSequenceParseContext
{ {
ucb::Link * pLink; std::unique_ptr<ucb::Link> pLink;
bool hasSource; bool hasSource;
bool hasDestination; bool hasDestination;
LinkSequenceParseContext() LinkSequenceParseContext()
: pLink( nullptr ), hasSource( false ), hasDestination( false ) {} : pLink( nullptr ), hasSource( false ), hasDestination( false ) {}
~LinkSequenceParseContext() { delete pLink; } ~LinkSequenceParseContext() {}
}; };
#define STATE_TOP (1) #define STATE_TOP (1)
@ -91,7 +92,7 @@ extern "C" int LinkSequence_chardata_callback(
LinkSequenceParseContext * pCtx LinkSequenceParseContext * pCtx
= static_cast< LinkSequenceParseContext * >( userdata ); = static_cast< LinkSequenceParseContext * >( userdata );
if ( !pCtx->pLink ) if ( !pCtx->pLink )
pCtx->pLink = new ucb::Link; pCtx->pLink.reset( new ucb::Link );
switch ( state ) switch ( state )
{ {
@ -120,7 +121,7 @@ extern "C" int LinkSequence_endelement_callback(
LinkSequenceParseContext * pCtx LinkSequenceParseContext * pCtx
= static_cast< LinkSequenceParseContext * >( userdata ); = static_cast< LinkSequenceParseContext * >( userdata );
if ( !pCtx->pLink ) if ( !pCtx->pLink )
pCtx->pLink = new ucb::Link; pCtx->pLink.reset( new ucb::Link );
switch ( state ) switch ( state )
{ {

View File

@ -30,6 +30,7 @@
#include <string.h> #include <string.h>
#include <ne_xml.h> #include <ne_xml.h>
#include "LockEntrySequence.hxx" #include "LockEntrySequence.hxx"
#include <memory>
using namespace webdav_ucp; using namespace webdav_ucp;
using namespace com::sun::star; using namespace com::sun::star;
@ -37,13 +38,13 @@ using namespace com::sun::star;
struct LockEntrySequenceParseContext struct LockEntrySequenceParseContext
{ {
ucb::LockEntry * pEntry; std::unique_ptr<ucb::LockEntry> pEntry;
bool hasScope; bool hasScope;
bool hasType; bool hasType;
LockEntrySequenceParseContext() LockEntrySequenceParseContext()
: pEntry( nullptr ), hasScope( false ), hasType( false ) {} : pEntry( nullptr ), hasScope( false ), hasType( false ) {}
~LockEntrySequenceParseContext() { delete pEntry; } ~LockEntrySequenceParseContext() { }
}; };
#define STATE_TOP (1) #define STATE_TOP (1)
@ -140,7 +141,7 @@ extern "C" int LockEntrySequence_endelement_callback(
LockEntrySequenceParseContext * pCtx LockEntrySequenceParseContext * pCtx
= static_cast< LockEntrySequenceParseContext * >( userdata ); = static_cast< LockEntrySequenceParseContext * >( userdata );
if ( !pCtx->pEntry ) if ( !pCtx->pEntry )
pCtx->pEntry = new ucb::LockEntry; pCtx->pEntry.reset( new ucb::LockEntry );
switch ( state ) switch ( state )
{ {

View File

@ -38,7 +38,7 @@ using namespace com::sun::star;
struct LockSequenceParseContext struct LockSequenceParseContext
{ {
ucb::Lock * pLock; std::unique_ptr<ucb::Lock> pLock;
bool hasLockScope; bool hasLockScope;
bool hasLockType; bool hasLockType;
bool hasDepth; bool hasDepth;
@ -49,7 +49,7 @@ struct LockSequenceParseContext
: pLock( nullptr ), hasLockScope( false ), hasLockType( false ), : pLock( nullptr ), hasLockScope( false ), hasLockType( false ),
hasDepth( false ), hasHREF( false ), hasTimeout( false ) {} hasDepth( false ), hasHREF( false ), hasTimeout( false ) {}
~LockSequenceParseContext() { delete pLock; } ~LockSequenceParseContext() {}
}; };
#define STATE_TOP (1) #define STATE_TOP (1)
@ -133,7 +133,7 @@ extern "C" int LockSequence_chardata_callback(
LockSequenceParseContext * pCtx LockSequenceParseContext * pCtx
= static_cast< LockSequenceParseContext * >( userdata ); = static_cast< LockSequenceParseContext * >( userdata );
if ( !pCtx->pLock ) if ( !pCtx->pLock )
pCtx->pLock = new ucb::Lock; pCtx->pLock.reset( new ucb::Lock );
// Beehive sends XML values containing trailing newlines. // Beehive sends XML values containing trailing newlines.
if ( buf[ len - 1 ] == 0x0a ) if ( buf[ len - 1 ] == 0x0a )
@ -242,7 +242,7 @@ extern "C" int LockSequence_endelement_callback(
LockSequenceParseContext * pCtx LockSequenceParseContext * pCtx
= static_cast< LockSequenceParseContext * >( userdata ); = static_cast< LockSequenceParseContext * >( userdata );
if ( !pCtx->pLock ) if ( !pCtx->pLock )
pCtx->pLock = new ucb::Lock; pCtx->pLock.reset( new ucb::Lock );
switch ( state ) switch ( state )
{ {

View File

@ -69,7 +69,7 @@ bool ContentProvider::getProperty(
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
if ( !m_pProps ) if ( !m_pProps )
{ {
m_pProps = new PropertyMap; m_pProps.reset( new PropertyMap );
// Fill map of known properties... // Fill map of known properties...

View File

@ -58,7 +58,6 @@ ContentProvider::ContentProvider(
// virtual // virtual
ContentProvider::~ContentProvider() ContentProvider::~ContentProvider()
{ {
delete m_pProps;
} }

View File

@ -73,7 +73,7 @@ namespace webdav_ucp {
class ContentProvider : public ::ucbhelper::ContentProviderImplHelper class ContentProvider : public ::ucbhelper::ContentProviderImplHelper
{ {
rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory; rtl::Reference< DAVSessionFactory > m_xDAVSessionFactory;
PropertyMap * m_pProps; std::unique_ptr<PropertyMap> m_pProps;
public: public:
explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext ); explicit ContentProvider( const css::uno::Reference< css::uno::XComponentContext >& rxContext );

View File

@ -51,7 +51,6 @@ PropertySetInfo::PropertySetInfo(
// virtual // virtual
PropertySetInfo::~PropertySetInfo() PropertySetInfo::~PropertySetInfo()
{ {
delete m_pProps;
} }
@ -105,7 +104,7 @@ uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
{ {
uno::Sequence< beans::Property > aProps uno::Sequence< beans::Property > aProps
= m_pContent->getProperties( m_xEnv ); = 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 & ) catch ( uno::RuntimeException const & )
{ {
@ -113,7 +112,7 @@ uno::Sequence< beans::Property > SAL_CALL PropertySetInfo::getProperties()
} }
catch ( uno::Exception const & ) 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() void PropertySetInfo::reset()
{ {
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
delete m_pProps; m_pProps.reset();
m_pProps = nullptr;
} }
@ -226,7 +224,6 @@ CommandProcessorInfo::CommandProcessorInfo(
// virtual // virtual
CommandProcessorInfo::~CommandProcessorInfo() CommandProcessorInfo::~CommandProcessorInfo()
{ {
delete m_pCommands;
} }
@ -284,7 +281,7 @@ CommandProcessorInfo::getCommands()
{ {
uno::Sequence< css::ucb::CommandInfo > aCmds uno::Sequence< css::ucb::CommandInfo > aCmds
= m_pContent->getCommands( m_xEnv ); = 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 & ) catch ( uno::RuntimeException const & )
{ {
@ -292,7 +289,7 @@ CommandProcessorInfo::getCommands()
} }
catch ( uno::Exception const & ) 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() void CommandProcessorInfo::reset()
{ {
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
delete m_pCommands; m_pCommands.reset();
m_pCommands = nullptr;
} }

View File

@ -242,7 +242,6 @@ PropertyValueSet::PropertyValueSet(
// virtual // virtual
PropertyValueSet::~PropertyValueSet() PropertyValueSet::~PropertyValueSet()
{ {
delete m_pValues;
} }

View File

@ -83,7 +83,7 @@ class PropertySetInfo :
public lang::XTypeProvider, public lang::XTypeProvider,
public beans::XPropertySetInfo public beans::XPropertySetInfo
{ {
uno::Sequence< beans::Property >* m_pProps; std::unique_ptr<uno::Sequence< beans::Property >> m_pProps;
private: private:
bool queryProperty( bool queryProperty(
@ -93,7 +93,6 @@ public:
PropertySetInfo( PropertySetInfo(
const PropertyInfo* pProps, const PropertyInfo* pProps,
sal_Int32 nProps ); sal_Int32 nProps );
virtual ~PropertySetInfo() override;
// XInterface // XInterface
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType ) virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type & rType )
@ -1527,8 +1526,8 @@ namespace ucbhelper_impl {
PropertySetInfo::PropertySetInfo( PropertySetInfo::PropertySetInfo(
const PropertyInfo* pProps, const PropertyInfo* pProps,
sal_Int32 nProps ) sal_Int32 nProps )
: m_pProps( new uno::Sequence< beans::Property >( nProps ) )
{ {
m_pProps = new uno::Sequence< beans::Property >( nProps );
if ( nProps ) if ( nProps )
{ {
@ -1550,12 +1549,6 @@ PropertySetInfo::PropertySetInfo(
} }
// virtual
PropertySetInfo::~PropertySetInfo()
{
delete m_pProps;
}
// XInterface methods. // XInterface methods.
void SAL_CALL PropertySetInfo::acquire() void SAL_CALL PropertySetInfo::acquire()

View File

@ -60,7 +60,6 @@ ResultSetImplHelper::ResultSetImplHelper(
// virtual // virtual
ResultSetImplHelper::~ResultSetImplHelper() ResultSetImplHelper::~ResultSetImplHelper()
{ {
delete m_pDisposeEventListeners;
} }
@ -144,8 +143,7 @@ void SAL_CALL ResultSetImplHelper::addEventListener(
osl::MutexGuard aGuard( m_aMutex ); osl::MutexGuard aGuard( m_aMutex );
if ( !m_pDisposeEventListeners ) if ( !m_pDisposeEventListeners )
m_pDisposeEventListeners m_pDisposeEventListeners.reset(new cppu::OInterfaceContainerHelper( m_aMutex ));
= new cppu::OInterfaceContainerHelper( m_aMutex );
m_pDisposeEventListeners->addInterface( Listener ); m_pDisposeEventListeners->addInterface( Listener );
} }