diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-01-23 18:03:16 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-01-23 18:03:16 +0100 |
commit | c010fe8e5eb781899d77ac18ce6c2c4b74f6fcfd (patch) | |
tree | f0c99f71fd396bff147f7ebdf558d9b5acd178c9 /embedserv | |
parent | a90a4810aeefbad270978ade194ced3b09d50449 (diff) |
loplugin:useuniqueptr
Change-Id: I510731d7364a9fb670782a743cdefc4582e8c593
Diffstat (limited to 'embedserv')
-rw-r--r-- | embedserv/source/inprocserv/advisesink.cxx | 14 | ||||
-rw-r--r-- | embedserv/source/inprocserv/advisesink.hxx | 8 |
2 files changed, 12 insertions, 10 deletions
diff --git a/embedserv/source/inprocserv/advisesink.cxx b/embedserv/source/inprocserv/advisesink.cxx index e036e30850b3..8028fdb61e28 100644 --- a/embedserv/source/inprocserv/advisesink.cxx +++ b/embedserv/source/inprocserv/advisesink.cxx @@ -17,6 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <o3tl/make_unique.hxx> + #if defined _MSC_VER #pragma warning(disable : 4668) #endif @@ -28,7 +32,6 @@ namespace inprocserv OleWrapperAdviseSink::OleWrapperAdviseSink() : m_nRefCount( 0 ) -, m_pFormatEtc( nullptr ) , m_nAspect( DVASPECT_CONTENT ) , m_nRegID( 0 ) , m_bObjectAdvise( TRUE ) @@ -42,7 +45,6 @@ OleWrapperAdviseSink::OleWrapperAdviseSink() OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener ) : m_nRefCount( 0 ) , m_pListener( pListener ) -, m_pFormatEtc( nullptr ) , m_nAspect( DVASPECT_CONTENT ) , m_nRegID( 0 ) , m_bObjectAdvise( TRUE ) @@ -56,7 +58,6 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, FORMATETC* pFormatEtc, DWORD nDataRegFlag ) : m_nRefCount( 0 ) , m_pListener( pListener ) -, m_pFormatEtc( nullptr ) , m_nAspect( DVASPECT_CONTENT ) , m_nRegID( 0 ) , m_bObjectAdvise( FALSE ) @@ -67,7 +68,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList { if ( pFormatEtc ) { - m_pFormatEtc = new FORMATETC; + m_pFormatEtc = o3tl::make_unique<FORMATETC>(); m_pFormatEtc->cfFormat = pFormatEtc->cfFormat; m_pFormatEtc->ptd = nullptr; m_pFormatEtc->dwAspect = pFormatEtc->dwAspect; @@ -79,7 +80,6 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pListener, DWORD nAspect, DWORD nViewRegFlag ) : m_nRefCount( 0 ) , m_pListener( pListener ) -, m_pFormatEtc( nullptr ) , m_nAspect( nAspect ) , m_nRegID( 0 ) , m_bObjectAdvise( TRUE ) @@ -91,9 +91,7 @@ OleWrapperAdviseSink::OleWrapperAdviseSink( const ComSmart< IAdviseSink >& pList } OleWrapperAdviseSink::~OleWrapperAdviseSink() -{ - delete m_pFormatEtc; -} +{} STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv ) { diff --git a/embedserv/source/inprocserv/advisesink.hxx b/embedserv/source/inprocserv/advisesink.hxx index af07cde789d1..7edd17cd5100 100644 --- a/embedserv/source/inprocserv/advisesink.hxx +++ b/embedserv/source/inprocserv/advisesink.hxx @@ -20,6 +20,10 @@ #ifndef INCLUDED_EMBEDSERV_SOURCE_INPROCSERV_ADVISESINK_HXX #define INCLUDED_EMBEDSERV_SOURCE_INPROCSERV_ADVISESINK_HXX +#include <sal/config.h> + +#include <memory> + #include <windows.h> #include "smartpointer.hxx" @@ -33,7 +37,7 @@ protected: ComSmart< IAdviseSink > m_pListener; DWORD m_nListenerID; - FORMATETC* m_pFormatEtc; + std::unique_ptr<FORMATETC> m_pFormatEtc; DWORD m_nAspect; DWORD m_nRegID; @@ -66,7 +70,7 @@ public: DWORD GetDataAdviseFlag() { return m_nDataRegFlag; } DWORD GetViewAdviseFlag() { return m_nViewRegFlag; } - FORMATETC* GetFormatEtc() { return m_pFormatEtc; } + FORMATETC* GetFormatEtc() { return m_pFormatEtc.get(); } DWORD GetAspect() { return m_nAspect; } ComSmart< IAdviseSink >& GetOrigAdvise() { return m_pListener; } void DisconnectOrigAdvise() { m_pListener = nullptr; } |