summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorKohei Yoshida <kohei.yoshida@collabora.com>2017-01-10 22:09:49 -0500
committerKohei Yoshida <libreoffice@kohei.us>2017-01-11 14:48:32 +0000
commit52b8739f5b2108c3c1ba116ed3ec79847add5396 (patch)
tree62bcfc1bfa14ff606792d3efbfe2ef162ef7649b /package
parenta544fd5fa233135f150b44c843a14be461952ecd (diff)
Let's return std::unique_ptr<...> directly.
It's only used at one call site, which already uses std::unique_ptr. Change-Id: I5ff528ebc560bb6eb8783d20002cea40a451761e Reviewed-on: https://gerrit.libreoffice.org/32946 Reviewed-by: Kohei Yoshida <libreoffice@kohei.us> Tested-by: Kohei Yoshida <libreoffice@kohei.us>
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipFile.hxx4
-rw-r--r--package/source/zipapi/ZipFile.cxx5
-rw-r--r--package/source/zippackage/ZipPackage.cxx2
3 files changed, 7 insertions, 4 deletions
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index bfc056f191ff..bac0168c3afc 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -33,6 +33,8 @@
#include <mutexholder.hxx>
+#include <memory>
+
namespace com { namespace sun { namespace star {
namespace uno { class XComponentContext; }
namespace ucb { class XProgressHandler; }
@@ -159,7 +161,7 @@ public:
const OUString& aMediaType,
const rtl::Reference<SotMutexHolder>& aMutexHolder );
- ZipEnumeration* entries();
+ std::unique_ptr<ZipEnumeration> entries();
};
#endif
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 943fde17b38d..49264b01c091 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -32,6 +32,7 @@
#include <comphelper/processfactory.hxx>
#include <rtl/digest.h>
#include <osl/diagnose.h>
+#include <o3tl/make_unique.hxx>
#include <algorithm>
#include <vector>
@@ -518,9 +519,9 @@ uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
return new XUnbufferedStream ( m_xContext, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
}
-ZipEnumeration* ZipFile::entries()
+std::unique_ptr<ZipEnumeration> ZipFile::entries()
{
- return new ZipEnumeration ( aEntries );
+ return o3tl::make_unique<ZipEnumeration>(aEntries);
}
uno::Reference< XInputStream > SAL_CALL ZipFile::getInputStream( ZipEntry& rEntry,
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index 8fc9a953ea7f..026e1ed6da6b 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -486,7 +486,7 @@ void ZipPackage::parseContentType()
void ZipPackage::getZipFileContents()
{
- std::unique_ptr < ZipEnumeration > xEnum(m_pZipFile->entries());
+ std::unique_ptr<ZipEnumeration> xEnum = m_pZipFile->entries();
ZipPackageStream *pPkgStream;
ZipPackageFolder *pPkgFolder, *pCurrent;
OUString sTemp, sDirName;