summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2023-01-20 13:19:27 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-01-21 18:06:50 +0000
commit4fd3fd36302f33fa0dda8ade3f99e40d2db138bc (patch)
tree215157b731ae83f4a9169e8c53b01f53c79c57e9
parent3c08e71af3629bc653f9eca8e570a3be9eaabac8 (diff)
fix ZipPackageHelper::addFile
after commit a04bf69bccfbc266643b418ef57030a42bbb5c05 Author: Noel Grandin <noel.grandin@collabora.co.uk> 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 <noel.grandin@collabora.co.uk>
-rw-r--r--unotools/source/misc/ZipPackageHelper.cxx7
1 files 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 <com/sun/star/container/XChild.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/util/XChangesBatch.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
@@ -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 );
}