[Libreoffice-commits] core.git: package/inc package/source
Kohei Yoshida
kohei.yoshida at collabora.com
Mon Jan 16 19:42:32 UTC 2017
package/inc/zipfileaccess.hxx | 4 +++-
package/source/zippackage/zipfileaccess.cxx | 10 +++-------
2 files changed, 6 insertions(+), 8 deletions(-)
New commits:
commit eea296d7b038a3f9f690ac9bf5c190dd80de971c
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Mon Jan 16 11:22:34 2017 -0500
Use unique_ptr for ZipFile here.
Change-Id: I9e3bbf23f9ee7de8ad05061496eeb7d4dc74774e
Reviewed-on: https://gerrit.libreoffice.org/33175
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/package/inc/zipfileaccess.hxx b/package/inc/zipfileaccess.hxx
index 8160447..a073acf 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 0b716d6..88ac19c 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 {
More information about the Libreoffice-commits
mailing list