diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-16 12:08:56 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-04-23 08:14:14 +0200 |
commit | b603dad2dfb49a120084b2e4124b16bd18a3b6f1 (patch) | |
tree | a72896e2ec7eeb018a4dc34d4dd063aff6ba014c /package | |
parent | 7e937a13840129b1aba0ffcc560dc07e891ebe09 (diff) |
loplugin:useuniqueptr in SwitchablePersistenceStream
Change-Id: I8f7d8296b98bc1743b993aac195859b2d2be4f7f
Reviewed-on: https://gerrit.libreoffice.org/53225
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/switchpersistencestream.cxx | 18 | ||||
-rw-r--r-- | package/source/xstor/switchpersistencestream.hxx | 2 |
2 files changed, 8 insertions, 12 deletions
diff --git a/package/source/xstor/switchpersistencestream.cxx b/package/source/xstor/switchpersistencestream.cxx index 5d96d626d9d3..b85be26f7eb6 100644 --- a/package/source/xstor/switchpersistencestream.cxx +++ b/package/source/xstor/switchpersistencestream.cxx @@ -112,9 +112,9 @@ void SwitchablePersistenceStream::SwitchPersistenceTo( const uno::Reference< io: CloseAll_Impl(); - m_pStreamData = new SPStreamData_Impl( false, + m_pStreamData.reset( new SPStreamData_Impl( false, xNewTruncate, xNewSeekable, xNewInStream, xNewOutStream, - bInOpen, bOutOpen ); + bInOpen, bOutOpen ) ); } void SwitchablePersistenceStream::SwitchPersistenceTo( const uno::Reference< io::XInputStream >& xInputStream ) @@ -145,9 +145,9 @@ void SwitchablePersistenceStream::SwitchPersistenceTo( const uno::Reference< io: CloseAll_Impl(); - m_pStreamData = new SPStreamData_Impl( true, + m_pStreamData.reset( new SPStreamData_Impl( true, xNewTruncate, xNewSeekable, xInputStream, xNewOutStream, - bInOpen, bOutOpen ); + bInOpen, bOutOpen ) ); } @@ -189,18 +189,14 @@ void SwitchablePersistenceStream::CopyAndSwitchPersistenceTo( const uno::Referen CloseAll_Impl(); - m_pStreamData = new SPStreamData_Impl( false, + m_pStreamData.reset( new SPStreamData_Impl( false, xTargetTruncate, xTargetSeek, xTargetInStream, xTargetOutStream, - bInOpen, bOutOpen ); + bInOpen, bOutOpen ) ); } void SwitchablePersistenceStream::CloseAll_Impl() { - if ( m_pStreamData ) - { - delete m_pStreamData; - m_pStreamData = nullptr; - } + m_pStreamData.reset(); } // css::io::XStream diff --git a/package/source/xstor/switchpersistencestream.hxx b/package/source/xstor/switchpersistencestream.hxx index a42ca023e227..f52d9bd4415e 100644 --- a/package/source/xstor/switchpersistencestream.hxx +++ b/package/source/xstor/switchpersistencestream.hxx @@ -54,7 +54,7 @@ class SwitchablePersistenceStream const css::uno::Reference< css::uno::XComponentContext > m_xContext; - SPStreamData_Impl* m_pStreamData; + std::unique_ptr<SPStreamData_Impl> m_pStreamData; void CloseAll_Impl(); |