summaryrefslogtreecommitdiff
path: root/unotools/source/ucbhelper/ucbstreamhelper.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-24 15:04:47 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-25 10:14:02 +0200
commiteeefb8c440b514cefdc4e82cc06843da9eabeb13 (patch)
treee7ec81b12b9e5538281da13f1776fceeacc437db /unotools/source/ucbhelper/ucbstreamhelper.cxx
parentbbf134a2b77909706492cbc41952210f89c0df71 (diff)
make UcbStreamHelper return SvStream by std::unique_ptr
Change-Id: I408f9193680ea73c61fcfb2bd1e860152219702c
Diffstat (limited to 'unotools/source/ucbhelper/ucbstreamhelper.cxx')
-rw-r--r--unotools/source/ucbhelper/ucbstreamhelper.cxx34
1 files changed, 17 insertions, 17 deletions
diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx
index 63260f632b91..87f7d903a481 100644
--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -42,11 +42,11 @@ using namespace ::com::sun::star::beans;
namespace utl
{
-static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
const Reference < XInteractionHandler >& xInteractionHandler,
bool bEnsureFileExists )
{
- SvStream* pStream = nullptr;
+ std::unique_ptr<SvStream> pStream;
UcbLockBytesRef xLockBytes;
if ( eOpenMode & StreamMode::WRITE )
{
@@ -119,7 +119,7 @@ static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMo
eOpenMode, xInteractionHandler );
if ( xLockBytes.is() )
{
- pStream = new SvStream( xLockBytes.get() );
+ pStream.reset(new SvStream( xLockBytes.get() ));
pStream->SetBufferSize( 4096 );
pStream->SetError( xLockBytes->GetError() );
}
@@ -137,7 +137,7 @@ static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMo
return pStream;
}
-SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode )
+std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode )
{
// related tdf#99312
// create a specialized interaction handler to manages Web certificates and Web credentials when needed
@@ -149,7 +149,7 @@ SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode e
return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ );
}
-SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
+std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
bool bFileExists )
{
// related tdf#99312
@@ -162,13 +162,13 @@ SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode e
}
-SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream )
+std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream )
{
- SvStream* pStream = nullptr;
+ std::unique_ptr<SvStream> pStream;
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
if ( xLockBytes.is() )
{
- pStream = new SvStream( xLockBytes.get() );
+ pStream.reset(new SvStream( xLockBytes.get() ));
pStream->SetBufferSize( 4096 );
pStream->SetError( xLockBytes->GetError() );
}
@@ -176,15 +176,15 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStre
return pStream;
}
-SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
+std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
{
- SvStream* pStream = nullptr;
+ std::unique_ptr<SvStream> pStream;
if ( xStream->getOutputStream().is() )
{
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
if ( xLockBytes.is() )
{
- pStream = new SvStream( xLockBytes.get() );
+ pStream.reset(new SvStream( xLockBytes.get() ));
pStream->SetBufferSize( 4096 );
pStream->SetError( xLockBytes->GetError() );
}
@@ -195,16 +195,16 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
return pStream;
}
-SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream, bool bCloseStream )
+std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream, bool bCloseStream )
{
- SvStream* pStream = nullptr;
+ std::unique_ptr<SvStream> pStream;
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
if ( xLockBytes.is() )
{
if ( !bCloseStream )
xLockBytes->setDontClose_Impl();
- pStream = new SvStream( xLockBytes.get() );
+ pStream.reset(new SvStream( xLockBytes.get() ));
pStream->SetBufferSize( 4096 );
pStream->SetError( xLockBytes->GetError() );
}
@@ -212,9 +212,9 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStre
return pStream;
};
-SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, bool bCloseStream )
+std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, bool bCloseStream )
{
- SvStream* pStream = nullptr;
+ std::unique_ptr<SvStream> pStream;
if ( xStream->getOutputStream().is() )
{
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
@@ -223,7 +223,7 @@ SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, b
if ( !bCloseStream )
xLockBytes->setDontClose_Impl();
- pStream = new SvStream( xLockBytes.get() );
+ pStream.reset(new SvStream( xLockBytes.get() ));
pStream->SetBufferSize( 4096 );
pStream->SetError( xLockBytes->GetError() );
}