From 84abf28e05fc55be867028f3d3a59220ca2669f0 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 19 Jul 2019 20:08:45 +0200 Subject: loplugin:referencecasting in oox..pyuno Change-Id: Ie920c154aef3074016704c632b15d99110b219aa Reviewed-on: https://gerrit.libreoffice.org/75974 Tested-by: Jenkins Reviewed-by: Noel Grandin --- package/qa/cppunit/test_package.cxx | 2 +- package/source/xstor/owriteablestream.cxx | 13 ++++--------- 2 files changed, 5 insertions(+), 10 deletions(-) (limited to 'package') diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx index acd2b5c795a6..ec65d7a88351 100644 --- a/package/qa/cppunit/test_package.cxx +++ b/package/qa/cppunit/test_package.cxx @@ -70,7 +70,7 @@ namespace CPPUNIT_ASSERT(xZip.is()); - mxNA = uno::Reference(xZip, uno::UNO_QUERY); + mxNA = xZip; CPPUNIT_ASSERT(mxNA.is()); } diff --git a/package/source/xstor/owriteablestream.cxx b/package/source/xstor/owriteablestream.cxx index 3c26f052b665..041363cb5142 100644 --- a/package/source/xstor/owriteablestream.cxx +++ b/package/source/xstor/owriteablestream.cxx @@ -1320,12 +1320,7 @@ uno::Reference< io::XStream > OWriteStream_Impl::GetStream_Impl( sal_Int32 nStre else m_pAntiImpl = new OWriteStream( this, xStream, bHierarchyAccess ); - uno::Reference< io::XStream > xWriteStream( static_cast< ::cppu::OWeakObject* >( m_pAntiImpl ), - uno::UNO_QUERY ); - - SAL_WARN_IF( !xWriteStream.is(), "package.xstor", "OWriteStream MUST implement XStream && XComponent interfaces!" ); - - return xWriteStream; + return m_pAntiImpl; } throw lang::IllegalArgumentException(); // TODO @@ -1380,7 +1375,7 @@ void OWriteStream_Impl::CreateReadonlyCopyBasedOnData( const uno::Reference< io: { uno::Reference < io::XStream > xTempFile; if ( !xTargetStream.is() ) - xTempFile.set( io::TempFile::create(m_xContext), uno::UNO_QUERY ); + xTempFile = io::TempFile::create(m_xContext); else xTempFile = xTargetStream; @@ -2069,7 +2064,7 @@ uno::Reference< io::XInputStream > SAL_CALL OWriteStream::getInputStream() if ( !m_bInitOnDemand && ( m_bInStreamDisconnected || !m_xInStream.is() ) ) return uno::Reference< io::XInputStream >(); - return uno::Reference< io::XInputStream >( static_cast< io::XInputStream* >( this ), uno::UNO_QUERY ); + return this; } uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() @@ -2095,7 +2090,7 @@ uno::Reference< io::XOutputStream > SAL_CALL OWriteStream::getOutputStream() if ( !m_xOutStream.is() ) return uno::Reference< io::XOutputStream >(); - return uno::Reference< io::XOutputStream >( static_cast< io::XOutputStream* >( this ), uno::UNO_QUERY ); + return this; } void SAL_CALL OWriteStream::writeBytes( const uno::Sequence< sal_Int8 >& aData ) -- cgit