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>
This commit is contained in:
Noel Grandin
2021-06-01 09:42:24 +02:00
parent aaa3e5f722
commit 6e1bdeed54
2 changed files with 5 additions and 3 deletions
+3 -2
View File
@@ -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();
}
+2 -1
View File
@@ -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 );