diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-05-31 10:18:18 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-01 09:42:24 +0200 |
commit | 6e1bdeed547fdc1ae70fa3614b4583d31d831998 (patch) | |
tree | 9d15eea103a284177718ce2b46fc0869ac0e799d /sot | |
parent | aaa3e5f722e693ebc5dd925b7ce35dce1753e810 (diff) |
no need to allocate these on the heap
Change-Id: I46de98204ec705bd2f6a618cb0cfae5149cea84e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116475
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sot')
-rw-r--r-- | sot/source/sdstor/stgio.cxx | 5 | ||||
-rw-r--r-- | sot/source/sdstor/ucbstorage.cxx | 3 |
2 files changed, 5 insertions, 3 deletions
diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 7d90c490c634..304be0e35d92 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -27,6 +27,7 @@ #include <sal/log.hxx> #include <memory> +#include <optional> ///////////////////////////// class StgIo @@ -363,7 +364,7 @@ FatError StgIo::ValidateFATs() { if( m_bFile ) { - std::unique_ptr<Validator> pV(new Validator( *this )); + std::optional<Validator> pV( *this ); bool bRet1 = !pV->IsError(), bRet2 = true ; pV.reset(); @@ -376,7 +377,7 @@ FatError StgIo::ValidateFATs() StreamMode::READ | StreamMode::SHARE_DENYNONE) && aIo.Load() ) { - pV.reset(new Validator( aIo )); + pV.emplace( aIo ); bRet2 = !pV->IsError(); pV.reset(); } diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 7b26fa936db2..162748e5b5d2 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -42,6 +42,7 @@ #include <com/sun/star/ucb/ContentCreationException.hpp> #include <memory> +#include <optional> #include <osl/diagnose.h> #include <osl/file.hxx> #include <sal/log.hxx> @@ -2120,7 +2121,7 @@ sal_Int16 UCBStorage_Impl::Commit() { // create a stream to write the manifest file - use a temp file OUString aURL( aNewSubFolder.getURL() ); - std::unique_ptr< ::utl::TempFile> pTempFile(new ::utl::TempFile( &aURL )); + std::optional< ::utl::TempFile> pTempFile(&aURL ); // get the stream from the temp file and create an output stream wrapper SvStream* pStream = pTempFile->GetStream( StreamMode::STD_READWRITE ); |