From 6e1bdeed547fdc1ae70fa3614b4583d31d831998 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 31 May 2021 10:18:18 +0200 Subject: 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 --- sot/source/sdstor/stgio.cxx | 5 +++-- sot/source/sdstor/ucbstorage.cxx | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'sot') 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 #include +#include ///////////////////////////// class StgIo @@ -363,7 +364,7 @@ FatError StgIo::ValidateFATs() { if( m_bFile ) { - std::unique_ptr pV(new Validator( *this )); + std::optional 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 #include +#include #include #include #include @@ -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 ); -- cgit