diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-20 16:36:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-06-21 08:27:33 +0200 |
commit | 9e005eb3096f01cda638e6817c9614e262afae6c (patch) | |
tree | 7fbbb5de2ac9eeb6927815ab23db2fee07ab970a /sd | |
parent | 7042d52b0789c8311f8f007862aa80dba54e72f1 (diff) |
loplugin:useuniqueptr in EasyFile
Change-Id: Ic18811145db90a7f9eff61e94069e68b3c80c298
Reviewed-on: https://gerrit.libreoffice.org/56196
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/html/htmlex.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 53677a73c4be..b072437e5325 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -132,7 +132,7 @@ const char * const pButtonNames[] = class EasyFile { private: - SvStream* pOStm; + std::unique_ptr<SvStream> pOStm; bool bOpen; public: @@ -3140,7 +3140,7 @@ ErrCode EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr ) createFileName( rUrl, aFileName ); ErrCode nErr = ERRCODE_NONE; - pOStm = ::utl::UcbStreamHelper::CreateStream( aFileName, StreamMode::WRITE | StreamMode::TRUNC ); + pOStm.reset( ::utl::UcbStreamHelper::CreateStream( aFileName, StreamMode::WRITE | StreamMode::TRUNC ) ); if( pOStm ) { bOpen = true; @@ -3154,11 +3154,10 @@ ErrCode EasyFile::createStream( const OUString& rUrl, SvStream* &rpStr ) if( nErr != ERRCODE_NONE ) { bOpen = false; - delete pOStm; - pOStm = nullptr; + pOStm.reset(); } - rpStr = pOStm; + rpStr = pOStm.get(); return nErr; } @@ -3182,8 +3181,7 @@ void EasyFile::createFileName( const OUString& rURL, OUString& rFileName ) void EasyFile::close() { - delete pOStm; - pOStm = nullptr; + pOStm.reset(); bOpen = false; } |