diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-29 08:49:48 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-29 09:44:28 +0200 |
commit | c3c8a7dbc4ce10156fca530a546babb0b478edaa (patch) | |
tree | 10891781518f0060183f7b9047d316e9941c9098 | |
parent | ad16387653f8e0d310a5eb44bce9fa8df27253c8 (diff) |
use std::optional in OTempFileService
since we are always needing this, no need to allocate it separately
Change-Id: Ic81aa485807dd1705fd0af2065044b4169c9cf5b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118044
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r-- | unotools/source/ucbhelper/XTempFile.hxx | 5 | ||||
-rw-r--r-- | unotools/source/ucbhelper/xtempfile.cxx | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/unotools/source/ucbhelper/XTempFile.hxx b/unotools/source/ucbhelper/XTempFile.hxx index 80036263f0b9..a59abd5ae622 100644 --- a/unotools/source/ucbhelper/XTempFile.hxx +++ b/unotools/source/ucbhelper/XTempFile.hxx @@ -18,7 +18,7 @@ */ #pragma once -#include <memory> +#include <optional> #include <com/sun/star/io/XInputStream.hpp> #include <com/sun/star/io/XOutputStream.hpp> #include <com/sun/star/io/XTempFile.hpp> @@ -29,6 +29,7 @@ #include <com/sun/star/lang/XServiceInfo.hpp> #include <cppuhelper/implbase.hxx> #include <osl/mutex.hxx> +#include <unotools/tempfile.hxx> namespace com::sun::star::uno { class XComponentContext; } @@ -48,7 +49,7 @@ typedef ::cppu::WeakImplHelper< css::io::XTempFile class OTempFileService : public OTempFileBase { protected: - std::unique_ptr<utl::TempFile> mpTempFile; + std::optional<utl::TempFile> mpTempFile; ::osl::Mutex maMutex; SvStream* mpStream; bool mbRemoveFile; diff --git a/unotools/source/ucbhelper/xtempfile.cxx b/unotools/source/ucbhelper/xtempfile.cxx index 712c788aa3e2..0cc0d8904bac 100644 --- a/unotools/source/ucbhelper/xtempfile.cxx +++ b/unotools/source/ucbhelper/xtempfile.cxx @@ -33,7 +33,7 @@ OTempFileService::OTempFileService(css::uno::Reference< css::uno::XComponentCont , mbInClosed( false ) , mbOutClosed( false ) { - mpTempFile.reset(new utl::TempFile()); + mpTempFile.emplace(); mpTempFile->EnableKillingFile(); } |