diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-19 09:09:05 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-01-20 06:56:32 +0000 |
commit | 84defbc556c17aa58851fd14f8af0deaa3cc6e05 (patch) | |
tree | 8eb1b3dceea8ca8b6d2e62b3c20c8d121deb8a9e /ucb/source/ucp/webdav-neon | |
parent | 3bb8bdb93f1546f64ff3f183d6162c41a03856bf (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>
Diffstat (limited to 'ucb/source/ucp/webdav-neon')
-rw-r--r-- | ucb/source/ucp/webdav-neon/LinkSequence.cxx | 9 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/LockEntrySequence.cxx | 7 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/LockSequence.cxx | 8 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavcontentcaps.cxx | 2 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavprovider.cxx | 1 | ||||
-rw-r--r-- | ucb/source/ucp/webdav-neon/webdavprovider.hxx | 2 |
6 files changed, 15 insertions, 14 deletions
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 ); |