diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-10 12:30:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-01-11 12:47:37 +0100 |
commit | e57a036939e27ecd173ace691689e26a6a33df8e (patch) | |
tree | a36d589da272c4732cddb4ca0548cdb5dcb2b2bd /unotools/source/ucbhelper | |
parent | cb5d79b504aa8575ea15c777707c7465ea43cb07 (diff) |
loplugin:useuniqueptr in tools,stoc,unotools
Change-Id: Ia72b65577143623cedc7a40bc34f7fb897add097
Reviewed-on: https://gerrit.libreoffice.org/47726
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unotools/source/ucbhelper')
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 47afc2ed82ce..9d4c717ed3ae 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -373,16 +373,15 @@ TempFile::TempFile( const OUString& rLeadingChars, bool _bStartWithZero, } TempFile::TempFile(TempFile && other): - aName(std::move(other.aName)), pStream(other.pStream), bIsDirectory(other.bIsDirectory), + aName(std::move(other.aName)), pStream(std::move(other.pStream)), bIsDirectory(other.bIsDirectory), bKillingFileEnabled(other.bKillingFileEnabled) { - other.pStream = nullptr; other.bKillingFileEnabled = false; } TempFile::~TempFile() { - delete pStream; + pStream.reset(); if ( bKillingFileEnabled ) { if ( bIsDirectory ) @@ -420,21 +419,17 @@ SvStream* TempFile::GetStream( StreamMode eMode ) if (!pStream) { if (!aName.isEmpty()) - pStream = new SvFileStream(aName, eMode); + pStream.reset(new SvFileStream(aName, eMode)); else - pStream = new SvMemoryStream(nullptr, 0, eMode); + pStream.reset(new SvMemoryStream(nullptr, 0, eMode)); } - return pStream; + return pStream.get(); } void TempFile::CloseStream() { - if ( pStream ) - { - delete pStream; - pStream = nullptr; - } + pStream.reset(); } OUString TempFile::SetTempNameBaseDirectory( const OUString &rBaseName ) |