From c3e45f10e003e540710c18967ef9b29210a795e4 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 12 Mar 2015 18:29:02 +0100 Subject: package: convert OStorage::m_pData to std::unique_ptr Change-Id: I875432aeb98072882df1f228d9fcf43c6027e8d5 --- package/source/xstor/xstorage.cxx | 8 +++----- package/source/xstor/xstorage.hxx | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'package') diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx index 254c2b2b0489..80dc555457f2 100644 --- a/package/source/xstor/xstorage.cxx +++ b/package/source/xstor/xstorage.cxx @@ -1887,7 +1887,7 @@ OStorage::OStorage( uno::Reference< io::XInputStream > xInputStream, : m_pImpl( new OStorage_Impl( xInputStream, nMode, xProperties, xContext, nStorageType ) ) { m_pImpl->m_pAntiImpl = this; - m_pData = new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false ); + m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); } OStorage::OStorage( uno::Reference< io::XStream > xStream, @@ -1898,7 +1898,7 @@ OStorage::OStorage( uno::Reference< io::XStream > xStream, : m_pImpl( new OStorage_Impl( xStream, nMode, xProperties, xContext, nStorageType ) ) { m_pImpl->m_pAntiImpl = this; - m_pData = new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false ); + m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, false)); } OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) @@ -1907,7 +1907,7 @@ OStorage::OStorage( OStorage_Impl* pImpl, bool bReadOnlyWrap ) // this call can be done only from OStorage_Impl implementation to create child storage OSL_ENSURE( m_pImpl && m_pImpl->m_rMutexRef.Is(), "The provided pointer & mutex MUST NOT be empty!\n" ); - m_pData = new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, bReadOnlyWrap ); + m_pData.reset(new StorInternalData_Impl( m_pImpl->m_rMutexRef, m_pImpl->m_bIsRoot, m_pImpl->m_nStorageType, bReadOnlyWrap)); OSL_ENSURE( ( m_pImpl->m_nStorageMode & embed::ElementModes::WRITE ) == embed::ElementModes::WRITE || m_pData->m_bReadOnlyWrap, @@ -1948,8 +1948,6 @@ OStorage::~OStorage() delete m_pData->m_pTypeCollection; m_pData->m_pTypeCollection = NULL; } - - delete m_pData; } } diff --git a/package/source/xstor/xstorage.hxx b/package/source/xstor/xstorage.hxx index d15b39bd86a8..c8688ecf9faf 100644 --- a/package/source/xstor/xstorage.hxx +++ b/package/source/xstor/xstorage.hxx @@ -51,6 +51,7 @@ #include "mutexholder.hxx" #include +#include namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; @@ -293,7 +294,7 @@ class OStorage : public ::com::sun::star::lang::XTypeProvider , public ::cppu::OWeakObject { OStorage_Impl* m_pImpl; - StorInternalData_Impl* m_pData; + std::unique_ptr m_pData; protected: -- cgit