summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2017-01-16 11:22:34 -0500
committerKohei Yoshida <libreoffice@kohei.us>2017-01-16 19:42:10 +0000
commiteea296d7b038a3f9f690ac9bf5c190dd80de971c (patch)
treec7dc19a216a7cf9bf57914551bab49d4dbe1a7b9 /package
parent5cd7b656de392a6dcd05cd55cf9d330c0ab5cd07 (diff)
Use unique_ptr for ZipFile here.
Change-Id: I9e3bbf23f9ee7de8ad05061496eeb7d4dc74774e Reviewed-on: https://gerrit.libreoffice.org/33175 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'package')
-rw-r--r--package/inc/zipfileaccess.hxx4
-rw-r--r--package/source/zippackage/zipfileaccess.cxx10
2 files changed, 6 insertions, 8 deletions
diff --git a/package/inc/zipfileaccess.hxx b/package/inc/zipfileaccess.hxx
index 8160447e33b0..a073acf58106 100644
--- a/package/inc/zipfileaccess.hxx
+++ b/package/inc/zipfileaccess.hxx
@@ -36,6 +36,8 @@
#include <ZipFile.hxx>
#include <HashMaps.hxx>
+#include <memory>
+
class OZipFileAccess : public ::cppu::WeakImplHelper<
css::packages::zip::XZipFileAccess2,
css::lang::XInitialization,
@@ -45,7 +47,7 @@ class OZipFileAccess : public ::cppu::WeakImplHelper<
rtl::Reference<SotMutexHolder> m_aMutexHolder;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::io::XInputStream > m_xContentStream;
- ZipFile* m_pZipFile;
+ std::unique_ptr<ZipFile> m_pZipFile;
::comphelper::OInterfaceContainerHelper2* m_pListenersContainer;
bool m_bDisposed;
bool m_bOwnContent;
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index 0b716d682486..88ac19c7dc01 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -32,6 +32,7 @@
#include <ucbhelper/content.hxx>
#include <rtl/ref.hxx>
+#include <o3tl/make_unique.hxx>
using namespace ::com::sun::star;
@@ -44,7 +45,6 @@ using namespace ::com::sun::star;
OZipFileAccess::OZipFileAccess( const uno::Reference< uno::XComponentContext >& rxContext )
: m_aMutexHolder( new SotMutexHolder )
, m_xContext( rxContext )
-, m_pZipFile( nullptr )
, m_pListenersContainer( nullptr )
, m_bDisposed( false )
, m_bOwnContent( false )
@@ -220,7 +220,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
}
// TODO: in case xSeekable is implemented on separated XStream implementation a wrapper is required
- m_pZipFile = new ZipFile(
+ m_pZipFile = o3tl::make_unique<ZipFile>(
m_xContentStream,
m_xContext,
true );
@@ -407,11 +407,7 @@ void SAL_CALL OZipFileAccess::dispose()
m_pListenersContainer = nullptr;
}
- if ( m_pZipFile )
- {
- delete m_pZipFile;
- m_pZipFile = nullptr;
- }
+ m_pZipFile.reset();
if ( m_xContentStream.is() && m_bOwnContent )
try {