diff options
author | David Tardon <dtardon@redhat.com> | 2016-09-09 10:12:44 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-09-09 12:14:04 +0200 |
commit | 05adc066ec8cbc0609e26ba0ddb2d8e766549309 (patch) | |
tree | b2e96c462c296059330c14d68405524e998af8b8 /writerperfect | |
parent | 1eb1ff0faa395ae51696662c85df5e654331b94c (diff) |
use std::unique_ptr
Change-Id: Idd19671bb2eab12cac2011160c617bf3f43659d7
Diffstat (limited to 'writerperfect')
-rw-r--r-- | writerperfect/qa/unit/DirectoryStreamTest.cxx | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/writerperfect/qa/unit/DirectoryStreamTest.cxx b/writerperfect/qa/unit/DirectoryStreamTest.cxx index 9201cdd9d85f..79646ed4e6fa 100644 --- a/writerperfect/qa/unit/DirectoryStreamTest.cxx +++ b/writerperfect/qa/unit/DirectoryStreamTest.cxx @@ -13,6 +13,8 @@ #include <comphelper/processfactory.hxx> +#include <o3tl/make_unique.hxx> + #include <ucbhelper/content.hxx> #include <test/bootstrapfixture.hxx> @@ -62,14 +64,14 @@ static const char g_aDirPath[] = "/writerperfect/qa/unit/data/stream/test.dir"; static const char g_aNondirPath[] = "/writerperfect/qa/unit/data/stream/test.dir/mimetype"; static const char g_aNonexistentPath[] = "/writerperfect/qa/unit/data/stream/foo/bar"; -DirectoryStream *createForParent(const css::uno::Reference<css::ucb::XContent> &xContent) +std::unique_ptr<DirectoryStream> createForParent(const css::uno::Reference<css::ucb::XContent> &xContent) { try { if (!xContent.is()) return nullptr; - DirectoryStream *pDir(nullptr); + unique_ptr<DirectoryStream> pDir; const uno::Reference<css::container::XChild> xChild(xContent, uno::UNO_QUERY); if (xChild.is()) @@ -77,12 +79,9 @@ DirectoryStream *createForParent(const css::uno::Reference<css::ucb::XContent> & const uno::Reference<ucb::XContent> xDirContent(xChild->getParent(), uno::UNO_QUERY); if (xDirContent.is()) { - pDir = new writerperfect::DirectoryStream(xDirContent); + pDir = o3tl::make_unique<DirectoryStream>(xDirContent); if (!pDir->isStructured()) - { - delete pDir; - pDir = nullptr; - } + pDir.reset(); } } |