diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-03-31 00:06:17 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2019-03-31 07:27:24 +0200 |
commit | 184be2d1352c5d3f3aa1e276d26c463c6e49b302 (patch) | |
tree | 65ee35397f445b264dcb05d0087aed60000f0e75 /package | |
parent | f42d729e41da918bc496d5feb5861a09737c438a (diff) |
tdf#120703 PVS: remove redundant static casts
V572 It is odd that the object which was created using 'new' operator
is immediately cast to another type.
Change-Id: I54976062dc3f62eaaa79f89eff54454f0b24ac2c
Reviewed-on: https://gerrit.libreoffice.org/69989
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'package')
-rw-r--r-- | package/source/xstor/xfactory.cxx | 20 | ||||
-rw-r--r-- | package/source/zippackage/ZipPackageStream.cxx | 4 |
2 files changed, 9 insertions, 15 deletions
diff --git a/package/source/xstor/xfactory.cxx b/package/source/xstor/xfactory.cxx index 2fec79f49965..26116a0eae56 100644 --- a/package/source/xstor/xfactory.cxx +++ b/package/source/xstor/xfactory.cxx @@ -92,13 +92,9 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstance() io::TempFile::create(m_xContext), uno::UNO_QUERY_THROW ); - return uno::Reference< uno::XInterface >( - static_cast< OWeakObject* >( new OStorage( xTempStream, - embed::ElementModes::READWRITE, - uno::Sequence< beans::PropertyValue >(), - m_xContext, - embed::StorageFormats::PACKAGE ) ), - uno::UNO_QUERY ); + return static_cast<OWeakObject*>(new OStorage(xTempStream, embed::ElementModes::READWRITE, + uno::Sequence<beans::PropertyValue>(), m_xContext, + embed::StorageFormats::PACKAGE)); } uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithArguments( @@ -260,9 +256,8 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr if ( !CheckPackageSignature_Impl( xInputStream, xSeekable ) ) throw io::IOException(); // TODO: this is not a package file - return uno::Reference< uno::XInterface >( - static_cast< OWeakObject* >( new OStorage( xInputStream, nStorageMode, aPropsToSet, m_xContext, nStorageType ) ), - uno::UNO_QUERY ); + return static_cast<OWeakObject*>( + new OStorage(xInputStream, nStorageMode, aPropsToSet, m_xContext, nStorageType)); } else if ( xStream.is() ) { @@ -280,9 +275,8 @@ uno::Reference< uno::XInterface > SAL_CALL OStorageFactory::createInstanceWithAr if ( !CheckPackageSignature_Impl( xStream->getInputStream(), xSeekable ) ) throw io::IOException(); // TODO: this is not a package file - return uno::Reference< uno::XInterface >( - static_cast< OWeakObject* >( new OStorage( xStream, nStorageMode, aPropsToSet, m_xContext, nStorageType ) ), - uno::UNO_QUERY ); + return static_cast<OWeakObject*>( + new OStorage(xStream, nStorageMode, aPropsToSet, m_xContext, nStorageType)); } throw uno::Exception("no input stream or regular stream", nullptr); // general error during creation diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx index a1cc4bc34511..3d6f5b432986 100644 --- a/package/source/zippackage/ZipPackageStream.cxx +++ b/package/source/zippackage/ZipPackageStream.cxx @@ -294,8 +294,8 @@ uno::Reference< io::XInputStream > ZipPackageStream::TryToGetRawFromDataStream( // create a new package stream uno::Reference< XDataSinkEncrSupport > xNewPackStream( xPackageAsFactory->createInstance(), UNO_QUERY_THROW ); - xNewPackStream->setDataStream( static_cast< io::XInputStream* >( - new WrapStreamForShare( GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef() ) ) ); + xNewPackStream->setDataStream( + new WrapStreamForShare(GetOwnSeekStream(), m_rZipPackage.GetSharedMutexRef())); uno::Reference< XPropertySet > xNewPSProps( xNewPackStream, UNO_QUERY_THROW ); |