Kaydet (Commit) 04cf6de0 authored tarafından Mike Kaganski's avatar Mike Kaganski

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: I6d1523e71b3e06be1cf41abaabb44e49fe11cd8e
Reviewed-on: https://gerrit.libreoffice.org/69369
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 4859d0b6
...@@ -1194,10 +1194,9 @@ void LibPage::ExportAsPackage( const OUString& aLibName ) ...@@ -1194,10 +1194,9 @@ void LibPage::ExportAsPackage( const OUString& aLibName )
implExportLib( aLibName, aTmpPath, xDummyHandler ); implExportLib( aLibName, aTmpPath, xDummyHandler );
Reference< XCommandEnvironment > xCmdEnv = Reference< XCommandEnvironment > xCmdEnv =
static_cast<XCommandEnvironment*>(
new OLibCommandEnvironment( new OLibCommandEnvironment(
Reference< task::XInteractionHandler >( Reference< task::XInteractionHandler >(
xHandler, UNO_QUERY ) ) ); xHandler, UNO_QUERY));
::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv, comphelper::getProcessComponentContext() ); ::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv, comphelper::getProcessComponentContext() );
......
...@@ -155,7 +155,7 @@ Type SAL_CALL NameContainer::getElementType() ...@@ -155,7 +155,7 @@ Type SAL_CALL NameContainer::getElementType()
Reference< XNameContainer > comphelper::NameContainer_createInstance( const Type& aType ) Reference< XNameContainer > comphelper::NameContainer_createInstance( const Type& aType )
{ {
return static_cast<XNameContainer*>(new NameContainer( aType )); return new NameContainer(aType);
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -248,7 +248,7 @@ void OPropertySetHelper::disposing() ...@@ -248,7 +248,7 @@ void OPropertySetHelper::disposing()
Reference < XPropertySetInfo > OPropertySetHelper::createPropertySetInfo( Reference < XPropertySetInfo > OPropertySetHelper::createPropertySetInfo(
IPropertyArrayHelper & rProperties ) IPropertyArrayHelper & rProperties )
{ {
return static_cast< XPropertySetInfo * >( new OPropertySetHelperInfo_Impl( rProperties ) ); return new OPropertySetHelperInfo_Impl(rProperties);
} }
// XPropertySet // XPropertySet
......
...@@ -367,8 +367,8 @@ embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepres ...@@ -367,8 +367,8 @@ embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepres
if ( aVisReplSeq.getLength() ) if ( aVisReplSeq.getLength() )
{ {
m_xCachedVisualRepresentation = GetNewFilledTempStream_Impl( m_xCachedVisualRepresentation = GetNewFilledTempStream_Impl(
uno::Reference< io::XInputStream > ( static_cast< io::XInputStream* > ( uno::Reference< io::XInputStream >(
new ::comphelper::SequenceInputStream( aVisReplSeq ) ) ) ); new ::comphelper::SequenceInputStream(aVisReplSeq)));
} }
return aVisualRepr; return aVisualRepr;
......
...@@ -806,7 +806,7 @@ void OWriteStream_Impl::Commit() ...@@ -806,7 +806,7 @@ void OWriteStream_Impl::Commit()
uno::Reference< io::XInputStream > xInStream; uno::Reference< io::XInputStream > xInStream;
try try
{ {
xInStream.set( static_cast< io::XInputStream* >( new OSelfTerminateFileStream( m_xContext, m_aTempURL ) ), uno::UNO_QUERY ); xInStream = new OSelfTerminateFileStream(m_xContext, m_aTempURL);
} }
catch( const uno::Exception& ) catch( const uno::Exception& )
{ {
......
...@@ -319,9 +319,7 @@ uno::Reference< container::XEnumeration > SAL_CALL SfxGlobalEvents_Impl::createE ...@@ -319,9 +319,7 @@ uno::Reference< container::XEnumeration > SAL_CALL SfxGlobalEvents_Impl::createE
{ {
models[i] <<= m_lModels[i]; models[i] <<= m_lModels[i];
} }
uno::Reference< container::XEnumeration > xEnum( uno::Reference<container::XEnumeration> xEnum(new ::comphelper::OAnyEnumeration(models));
static_cast<container::XEnumeration*>(
new ::comphelper::OAnyEnumeration(models)));
aLock.clear(); aLock.clear();
// <- SAFE // <- SAFE
......
...@@ -369,7 +369,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement( ...@@ -369,7 +369,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), xDummyEnv, comphelper::getProcessComponentContext() ); ::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) ); xResult = new OFSInputStreamContainer(xInStream);
} }
} }
catch( embed::InvalidStorageException& ) catch( embed::InvalidStorageException& )
...@@ -1124,7 +1124,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl ...@@ -1124,7 +1124,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
uno::Reference< io::XStream > xStream = uno::Reference< io::XStream > xStream =
xSimpleFileAccess->openFileReadWrite( aFileURL ); xSimpleFileAccess->openFileReadWrite( aFileURL );
xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); xResult = new OFSStreamContainer(xStream);
} }
else else
{ {
...@@ -1135,7 +1135,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl ...@@ -1135,7 +1135,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
{ {
uno::Reference< io::XStream > xStream = uno::Reference< io::XStream > xStream =
uno::Reference < io::XStream >( new ::utl::OStreamWrapper( std::move(pStream) ) ); uno::Reference < io::XStream >( new ::utl::OStreamWrapper( std::move(pStream) ) );
xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) ); xResult = new OFSStreamContainer(xStream);
} }
} }
...@@ -1156,7 +1156,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl ...@@ -1156,7 +1156,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
::ucbhelper::Content aResultContent( aFileURL, xDummyEnv, comphelper::getProcessComponentContext() ); ::ucbhelper::Content aResultContent( aFileURL, xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream(); uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) ); xResult = new OFSInputStreamContainer(xInStream);
} }
} }
catch( embed::InvalidStorageException& ) catch( embed::InvalidStorageException& )
......
...@@ -420,7 +420,7 @@ ...@@ -420,7 +420,7 @@
Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents() Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents()
{ {
if( !mxEventContainer.is() ) if( !mxEventContainer.is() )
mxEventContainer = static_cast<XNameContainer*>(new toolkit::ScriptEventContainer()); mxEventContainer = new toolkit::ScriptEventContainer();
return mxEventContainer; return mxEventContainer;
} }
......
...@@ -154,7 +154,7 @@ Reference< XInterface > SAL_CALL ...@@ -154,7 +154,7 @@ Reference< XInterface > SAL_CALL
FileProvider::CreateInstance( FileProvider::CreateInstance(
const Reference< XMultiServiceFactory >& xMultiServiceFactory ) const Reference< XMultiServiceFactory >& xMultiServiceFactory )
{ {
XServiceInfo* xP = static_cast<XServiceInfo*>(new FileProvider( comphelper::getComponentContext(xMultiServiceFactory) )); XServiceInfo* xP = new FileProvider(comphelper::getComponentContext(xMultiServiceFactory));
return Reference< XInterface >::query( xP ); return Reference< XInterface >::query( xP );
} }
......
...@@ -406,8 +406,8 @@ static uno::Reference< uno::XInterface > ...@@ -406,8 +406,8 @@ static uno::Reference< uno::XInterface >
PasswordContainerInteractionHandler_CreateInstance( PasswordContainerInteractionHandler_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory> & rSMgr ) const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
{ {
lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >( lang::XServiceInfo* pX
new PasswordContainerInteractionHandler( comphelper::getComponentContext(rSMgr) ) ); = new PasswordContainerInteractionHandler(comphelper::getComponentContext(rSMgr));
return uno::Reference< uno::XInterface >::query( pX ); return uno::Reference< uno::XInterface >::query( pX );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment