SwapOutData url is always a file url

so can just use SvFileStream here and not go through ucb

Change-Id: I1d70a4e39977a178afaf7eeadb552f1bd7d9fd1a
Reviewed-on: https://gerrit.libreoffice.org/36024
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
This commit is contained in:
Caolán McNamara
2017-04-02 19:12:35 +01:00
parent d80b0c4d94
commit edf79cacbe

View File

@@ -21,13 +21,10 @@
#include <tools/stream.hxx> #include <tools/stream.hxx>
#include <tools/vcompat.hxx> #include <tools/vcompat.hxx>
#include <tools/debug.hxx> #include <tools/debug.hxx>
#include <unotools/ucbstreamhelper.hxx>
#include <unotools/tempfile.hxx> #include <unotools/tempfile.hxx>
#include <ucbhelper/content.hxx>
#include <vcl/graph.hxx> #include <vcl/graph.hxx>
#include <vcl/gfxlink.hxx> #include <vcl/gfxlink.hxx>
#include <vcl/cvtgrf.hxx> #include <vcl/cvtgrf.hxx>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <memory> #include <memory>
#include <o3tl/make_shared.hxx> #include <o3tl/make_shared.hxx>
@@ -269,22 +266,15 @@ std::shared_ptr<sal_uInt8> GfxLink::GetSwapInData() const
std::shared_ptr<sal_uInt8> pData; std::shared_ptr<sal_uInt8> pData;
std::unique_ptr<SvStream> xIStm(::utl::UcbStreamHelper::CreateStream( mpSwapOutData->maURL, StreamMode::READWRITE )); SvFileStream aFileStream(mpSwapOutData->maURL, StreamMode::READWRITE);
if( xIStm ) pData = o3tl::make_shared_array<sal_uInt8>(mnSwapInDataSize);
{ aFileStream.ReadBytes(pData.get(), mnSwapInDataSize);
pData = o3tl::make_shared_array<sal_uInt8>(mnSwapInDataSize); bool bError = (ERRCODE_NONE != aFileStream.GetError());
xIStm->ReadBytes( pData.get(), mnSwapInDataSize ); sal_uInt64 const nActReadSize = aFileStream.Tell();
bool bError = ( ERRCODE_NONE != xIStm->GetError() ); if (nActReadSize != mnSwapInDataSize)
sal_uInt64 const nActReadSize = xIStm->Tell(); bError = true;
if (nActReadSize != mnSwapInDataSize) if (bError)
{ pData.reset();
bError = true;
}
xIStm.reset();
if( bError )
pData.reset();
}
return pData; return pData;
} }