[Libreoffice-commits] core.git: package/inc package/source
Kohei Yoshida
kohei.yoshida at collabora.com
Wed Jan 11 14:49:16 UTC 2017
package/inc/ZipFile.hxx | 4 +++-
package/source/zipapi/ZipFile.cxx | 5 +++--
package/source/zippackage/ZipPackage.cxx | 2 +-
3 files changed, 7 insertions(+), 4 deletions(-)
New commits:
commit 52b8739f5b2108c3c1ba116ed3ec79847add5396
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date: Tue Jan 10 22:09:49 2017 -0500
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 at kohei.us>
Tested-by: Kohei Yoshida <libreoffice at kohei.us>
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index bfc056f..bac0168 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 943fde1..49264b0 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 8fc9a95..026e1ed 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;
More information about the Libreoffice-commits
mailing list