Revert "make UcbStreamHelper return SvStream by std::unique_ptr"
This reverts commit eeefb8c440
.
this was pushed in error
This commit is contained in:
@@ -25,7 +25,6 @@
|
|||||||
#include <unotools/unotoolsdllapi.h>
|
#include <unotools/unotoolsdllapi.h>
|
||||||
|
|
||||||
#include <tools/stream.hxx>
|
#include <tools/stream.hxx>
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace com
|
namespace com
|
||||||
{
|
{
|
||||||
@@ -53,13 +52,13 @@ namespace utl
|
|||||||
class UNOTOOLS_DLLPUBLIC UcbStreamHelper
|
class UNOTOOLS_DLLPUBLIC UcbStreamHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static std::unique_ptr<SvStream> CreateStream( const OUString& rFileName, StreamMode eOpenMode );
|
static SvStream* CreateStream( const OUString& rFileName, StreamMode eOpenMode );
|
||||||
static std::unique_ptr<SvStream> CreateStream( const OUString& rFileName, StreamMode eOpenMode,
|
static SvStream* CreateStream( const OUString& rFileName, StreamMode eOpenMode,
|
||||||
bool bFileExists );
|
bool bFileExists );
|
||||||
static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
|
static SvStream* CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream );
|
||||||
static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
|
static SvStream* CreateStream( const css::uno::Reference < css::io::XStream >& xStream );
|
||||||
static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
|
static SvStream* CreateStream( const css::uno::Reference < css::io::XInputStream >& xStream, bool bCloseStream );
|
||||||
static std::unique_ptr<SvStream> CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
|
static SvStream* CreateStream( const css::uno::Reference < css::io::XStream >& xStream, bool bCloseStream );
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -42,11 +42,11 @@ using namespace ::com::sun::star::beans;
|
|||||||
namespace utl
|
namespace utl
|
||||||
{
|
{
|
||||||
|
|
||||||
static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
|
static SvStream* lcl_CreateStream( const OUString& rFileName, StreamMode eOpenMode,
|
||||||
const Reference < XInteractionHandler >& xInteractionHandler,
|
const Reference < XInteractionHandler >& xInteractionHandler,
|
||||||
bool bEnsureFileExists )
|
bool bEnsureFileExists )
|
||||||
{
|
{
|
||||||
std::unique_ptr<SvStream> pStream;
|
SvStream* pStream = nullptr;
|
||||||
UcbLockBytesRef xLockBytes;
|
UcbLockBytesRef xLockBytes;
|
||||||
if ( eOpenMode & StreamMode::WRITE )
|
if ( eOpenMode & StreamMode::WRITE )
|
||||||
{
|
{
|
||||||
@@ -119,7 +119,7 @@ static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, St
|
|||||||
eOpenMode, xInteractionHandler );
|
eOpenMode, xInteractionHandler );
|
||||||
if ( xLockBytes.is() )
|
if ( xLockBytes.is() )
|
||||||
{
|
{
|
||||||
pStream.reset(new SvStream( xLockBytes.get() ));
|
pStream = new SvStream( xLockBytes.get() );
|
||||||
pStream->SetBufferSize( 4096 );
|
pStream->SetBufferSize( 4096 );
|
||||||
pStream->SetError( xLockBytes->GetError() );
|
pStream->SetError( xLockBytes->GetError() );
|
||||||
}
|
}
|
||||||
@@ -137,7 +137,7 @@ static std::unique_ptr<SvStream> lcl_CreateStream( const OUString& rFileName, St
|
|||||||
return pStream;
|
return pStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode )
|
SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode )
|
||||||
{
|
{
|
||||||
// related tdf#99312
|
// related tdf#99312
|
||||||
// create a specialized interaction handler to manages Web certificates and Web credentials when needed
|
// create a specialized interaction handler to manages Web certificates and Web credentials when needed
|
||||||
@@ -149,7 +149,7 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileNa
|
|||||||
return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ );
|
return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
|
SvStream* UcbStreamHelper::CreateStream( const OUString& rFileName, StreamMode eOpenMode,
|
||||||
bool bFileExists )
|
bool bFileExists )
|
||||||
{
|
{
|
||||||
// related tdf#99312
|
// related tdf#99312
|
||||||
@@ -162,13 +162,13 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileNa
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream )
|
SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream )
|
||||||
{
|
{
|
||||||
std::unique_ptr<SvStream> pStream;
|
SvStream* pStream = nullptr;
|
||||||
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
|
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
|
||||||
if ( xLockBytes.is() )
|
if ( xLockBytes.is() )
|
||||||
{
|
{
|
||||||
pStream.reset(new SvStream( xLockBytes.get() ));
|
pStream = new SvStream( xLockBytes.get() );
|
||||||
pStream->SetBufferSize( 4096 );
|
pStream->SetBufferSize( 4096 );
|
||||||
pStream->SetError( xLockBytes->GetError() );
|
pStream->SetError( xLockBytes->GetError() );
|
||||||
}
|
}
|
||||||
@@ -176,15 +176,15 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInpu
|
|||||||
return pStream;
|
return pStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
|
SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream )
|
||||||
{
|
{
|
||||||
std::unique_ptr<SvStream> pStream;
|
SvStream* pStream = nullptr;
|
||||||
if ( xStream->getOutputStream().is() )
|
if ( xStream->getOutputStream().is() )
|
||||||
{
|
{
|
||||||
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
|
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
|
||||||
if ( xLockBytes.is() )
|
if ( xLockBytes.is() )
|
||||||
{
|
{
|
||||||
pStream.reset(new SvStream( xLockBytes.get() ));
|
pStream = new SvStream( xLockBytes.get() );
|
||||||
pStream->SetBufferSize( 4096 );
|
pStream->SetBufferSize( 4096 );
|
||||||
pStream->SetError( xLockBytes->GetError() );
|
pStream->SetError( xLockBytes->GetError() );
|
||||||
}
|
}
|
||||||
@@ -195,16 +195,16 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStre
|
|||||||
return pStream;
|
return pStream;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream, bool bCloseStream )
|
SvStream* UcbStreamHelper::CreateStream( const Reference < XInputStream >& xStream, bool bCloseStream )
|
||||||
{
|
{
|
||||||
std::unique_ptr<SvStream> pStream;
|
SvStream* pStream = nullptr;
|
||||||
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
|
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateInputLockBytes( xStream );
|
||||||
if ( xLockBytes.is() )
|
if ( xLockBytes.is() )
|
||||||
{
|
{
|
||||||
if ( !bCloseStream )
|
if ( !bCloseStream )
|
||||||
xLockBytes->setDontClose_Impl();
|
xLockBytes->setDontClose_Impl();
|
||||||
|
|
||||||
pStream.reset(new SvStream( xLockBytes.get() ));
|
pStream = new SvStream( xLockBytes.get() );
|
||||||
pStream->SetBufferSize( 4096 );
|
pStream->SetBufferSize( 4096 );
|
||||||
pStream->SetError( xLockBytes->GetError() );
|
pStream->SetError( xLockBytes->GetError() );
|
||||||
}
|
}
|
||||||
@@ -212,9 +212,9 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XInpu
|
|||||||
return pStream;
|
return pStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, bool bCloseStream )
|
SvStream* UcbStreamHelper::CreateStream( const Reference < XStream >& xStream, bool bCloseStream )
|
||||||
{
|
{
|
||||||
std::unique_ptr<SvStream> pStream;
|
SvStream* pStream = nullptr;
|
||||||
if ( xStream->getOutputStream().is() )
|
if ( xStream->getOutputStream().is() )
|
||||||
{
|
{
|
||||||
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
|
UcbLockBytesRef xLockBytes = UcbLockBytes::CreateLockBytes( xStream );
|
||||||
@@ -223,7 +223,7 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const Reference < XStre
|
|||||||
if ( !bCloseStream )
|
if ( !bCloseStream )
|
||||||
xLockBytes->setDontClose_Impl();
|
xLockBytes->setDontClose_Impl();
|
||||||
|
|
||||||
pStream.reset(new SvStream( xLockBytes.get() ));
|
pStream = new SvStream( xLockBytes.get() );
|
||||||
pStream->SetBufferSize( 4096 );
|
pStream->SetBufferSize( 4096 );
|
||||||
pStream->SetError( xLockBytes->GetError() );
|
pStream->SetError( xLockBytes->GetError() );
|
||||||
}
|
}
|
||||||
|
@@ -34,8 +34,8 @@ Graphic loadFromURL(OUString const& rURL, sal_Int16 nExtWidth, sal_Int16 nExtHei
|
|||||||
|
|
||||||
Graphic aGraphic;
|
Graphic aGraphic;
|
||||||
|
|
||||||
std::unique_ptr<SvStream> pInputStream
|
std::unique_ptr<SvStream> pInputStream;
|
||||||
= utl::UcbStreamHelper::CreateStream(rURL, StreamMode::READ);
|
pInputStream.reset(utl::UcbStreamHelper::CreateStream(rURL, StreamMode::READ));
|
||||||
|
|
||||||
if (pInputStream)
|
if (pInputStream)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user