summaryrefslogtreecommitdiff
path: root/sfx2/source/appl/appopen.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-06 17:17:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-08 09:31:02 +0200
commit6a6774cc4b22aceaca4441318420bb9dfb1cacab (patch)
treeab2dd62d7a69f1127fed8192268e16fbdaacd9fa /sfx2/source/appl/appopen.cxx
parent1444bd72006fec7ebcd3c5df2399da26ad3b1466 (diff)
loplugin:useuniqueptr in SfxApplication::LoadTemplate and SfxMedium
pass SfxItemSet around by std::unique_ptr Change-Id: I54da96d8df224f7c4f2fb9ebf06ed32d479298e7 Reviewed-on: https://gerrit.libreoffice.org/58649 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/appl/appopen.cxx')
-rw-r--r--sfx2/source/appl/appopen.cxx8
1 files changed, 2 insertions, 6 deletions
diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx
index 60f2c508ebbb..432db5e18ebb 100644
--- a/sfx2/source/appl/appopen.cxx
+++ b/sfx2/source/appl/appopen.cxx
@@ -281,7 +281,7 @@ ErrCode CheckPasswd_Impl
}
-ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &rFileName, SfxItemSet* pSet )
+ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &rFileName, std::unique_ptr<SfxItemSet> pSet )
{
std::shared_ptr<const SfxFilter> pFilter;
SfxMedium aMedium( rFileName, ( StreamMode::READ | StreamMode::SHARE_DENYNONE ) );
@@ -291,7 +291,6 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &
if ( aMedium.GetError() )
{
- delete pSet;
return aMedium.GetErrorCode();
}
@@ -299,20 +298,17 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &
ErrCode nErr = GetFilterMatcher().GuessFilter( aMedium, pFilter, SfxFilterFlags::TEMPLATE, SfxFilterFlags::NONE );
if ( ERRCODE_NONE != nErr)
{
- delete pSet;
return ERRCODE_SFX_NOTATEMPLATE;
}
if( !pFilter || !pFilter->IsAllowedAsTemplate() )
{
- delete pSet;
return ERRCODE_SFX_NOTATEMPLATE;
}
if ( pFilter->GetFilterFlags() & SfxFilterFlags::STARONEFILTER )
{
DBG_ASSERT( !xDoc.Is(), "Sorry, not implemented!" );
- delete pSet;
SfxStringItem aName( SID_FILE_NAME, rFileName );
SfxStringItem aReferer( SID_REFERER, OUString("private:user") );
SfxStringItem aFlags( SID_OPTIONS, OUString("T") );
@@ -343,7 +339,7 @@ ErrCode SfxApplication::LoadTemplate( SfxObjectShellLock& xDoc, const OUString &
xDoc = SfxObjectShell::CreateObject( pFilter->GetServiceName() );
//pMedium takes ownership of pSet
- SfxMedium *pMedium = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, pSet );
+ SfxMedium *pMedium = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, std::move(pSet) );
if(!xDoc->DoLoad(pMedium))
{
ErrCode nErrCode = xDoc->GetErrorCode();