From 4fd3fd36302f33fa0dda8ade3f99e40d2db138bc Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 20 Jan 2023 13:19:27 +0200 Subject: [PATCH] fix ZipPackageHelper::addFile after commit a04bf69bccfbc266643b418ef57030a42bbb5c05 Author: Noel Grandin Date: Mon Jan 16 10:36:59 2023 +0200 XUnoTunnel->dynamic_cast in ZipPackageEntry it no longer implements XUnoTunnel. And add an assert, the createInstance call should never fail. Change-Id: I9a0698862ba783057a299b9c52ebc2b828cc2ac1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145929 Tested-by: Jenkins Reviewed-by: Noel Grandin --- unotools/source/misc/ZipPackageHelper.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/unotools/source/misc/ZipPackageHelper.cxx b/unotools/source/misc/ZipPackageHelper.cxx index c66db01272fe..d94b431bb6c6 100644 --- a/unotools/source/misc/ZipPackageHelper.cxx +++ b/unotools/source/misc/ZipPackageHelper.cxx @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include @@ -155,12 +154,12 @@ void ZipPackageHelper::addFile( css::uno::Reference< css::uno::XInterface > cons SvFileStream* pStream = new SvFileStream(rSourceFileURL, StreamMode::READ ); Reference< XInputStream > xInput( new utl::OSeekableInputStreamWrapper( pStream, true ) ); Reference< XActiveDataSink > xSink( mxFactory->createInstance(), UNO_QUERY ); - Reference< XUnoTunnel > xTunnel( xSink, UNO_QUERY ); - if( !xSink.is() || !xTunnel.is()) + assert(xSink); // this should never fail + if( !xSink.is() ) return; Reference< XNameContainer > xNameContainer(xRootFolder, UNO_QUERY ); - xNameContainer->insertByName(encodeZipUri( aName ), Any(xTunnel)); + xNameContainer->insertByName(encodeZipUri( aName ), Any(xSink)); xSink->setInputStream( xInput ); }