sd/source/ui/app/sdxfer.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
New commits: commit b5e1a1d16055a2782b46580ed8c8190244628fda Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Sep 18 18:39:01 2022 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Sep 20 08:08:20 2022 +0200 simplify usage of TempFile in sd TempFile already handles the stream. And not touching the URL means we stay on the fast path for temp files. Change-Id: I8672c5749f1e0dc95e59cd9d713015586301ae34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/140202 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 3c3fdcd6d912..a49579a60df5 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -599,11 +599,12 @@ bool SdTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pOb SfxObjectShell* pEmbObj = static_cast<SfxObjectShell*>(pObject); ::utl::TempFile aTempFile; aTempFile.EnableKillingFile(); + SvStream* pTempStream = aTempFile.GetStream(StreamMode::READWRITE); try { uno::Reference< embed::XStorage > xWorkStore = - ::comphelper::OStorageHelper::GetStorageFromURL( aTempFile.GetURL(), embed::ElementModes::READWRITE ); + ::comphelper::OStorageHelper::GetStorageFromStream( new utl::OStreamWrapper(*pTempStream), embed::ElementModes::READWRITE ); // write document storage pEmbObj->SetupStorage( xWorkStore, SOFFICE_FILEFORMAT_CURRENT, false ); @@ -616,13 +617,8 @@ bool SdTransferable::WriteObject( tools::SvRef<SotTempStream>& rxOStm, void* pOb if ( xTransact.is() ) xTransact->commit(); - std::unique_ptr<SvStream> pSrcStm = ::utl::UcbStreamHelper::CreateStream( aTempFile.GetURL(), StreamMode::READ ); - if( pSrcStm ) - { - rxOStm->SetBufferSize( 0xff00 ); - rxOStm->WriteStream( *pSrcStm ); - pSrcStm.reset(); - } + rxOStm->SetBufferSize( 0xff00 ); + rxOStm->WriteStream( *pTempStream ); bRet = true; }