diff options
Diffstat (limited to 'svl/source/fsstor')
-rw-r--r-- | svl/source/fsstor/fsstorage.cxx | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx index 3d21e23c3b0c..6a28dc07d422 100644 --- a/svl/source/fsstor/fsstorage.cxx +++ b/svl/source/fsstor/fsstorage.cxx @@ -369,14 +369,12 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( else { // TODO: test whether it really works for http and fwp - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), + std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), StreamMode::STD_WRITE ); if ( pStream ) { if ( !pStream->GetError() ) - xResult.set( new ::utl::OStreamWrapper( *pStream ) ); - else - delete pStream; + xResult.set( new ::utl::OStreamWrapper( std::move(pStream) ) ); } } @@ -1208,18 +1206,16 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl else { // TODO: test whether it really works for http and fwp - SvStream* pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL, + std::unique_ptr<SvStream> pStream = ::utl::UcbStreamHelper::CreateStream( aFileURL, StreamMode::STD_WRITE ); if ( pStream ) { if ( !pStream->GetError() ) { uno::Reference< io::XStream > xStream = - uno::Reference < io::XStream >( new ::utl::OStreamWrapper( *pStream ) ); + uno::Reference < io::XStream >( new ::utl::OStreamWrapper( std::move(pStream) ) ); xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); } - else - delete pStream; } } |