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: Mike Kaganski <mike.kaganski@collabora.com>
This commit is contained in:
Mike Kaganski 2019-03-17 21:36:10 +03:00
parent 4859d0b6ce
commit 04cf6de098
10 changed files with 15 additions and 18 deletions

View file

@ -1194,10 +1194,9 @@ void LibPage::ExportAsPackage( const OUString& aLibName )
implExportLib( aLibName, aTmpPath, xDummyHandler );
Reference< XCommandEnvironment > xCmdEnv =
static_cast<XCommandEnvironment*>(
new OLibCommandEnvironment(
Reference< task::XInteractionHandler >(
xHandler, UNO_QUERY ) ) );
xHandler, UNO_QUERY));
::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv, comphelper::getProcessComponentContext() );

View file

@ -155,7 +155,7 @@ Type SAL_CALL NameContainer::getElementType()
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: */

View file

@ -248,7 +248,7 @@ void OPropertySetHelper::disposing()
Reference < XPropertySetInfo > OPropertySetHelper::createPropertySetInfo(
IPropertyArrayHelper & rProperties )
{
return static_cast< XPropertySetInfo * >( new OPropertySetHelperInfo_Impl( rProperties ) );
return new OPropertySetHelperInfo_Impl(rProperties);
}
// XPropertySet

View file

@ -367,8 +367,8 @@ embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepres
if ( aVisReplSeq.getLength() )
{
m_xCachedVisualRepresentation = GetNewFilledTempStream_Impl(
uno::Reference< io::XInputStream > ( static_cast< io::XInputStream* > (
new ::comphelper::SequenceInputStream( aVisReplSeq ) ) ) );
uno::Reference< io::XInputStream >(
new ::comphelper::SequenceInputStream(aVisReplSeq)));
}
return aVisualRepr;

View file

@ -806,7 +806,7 @@ void OWriteStream_Impl::Commit()
uno::Reference< io::XInputStream > xInStream;
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& )
{

View file

@ -319,9 +319,7 @@ uno::Reference< container::XEnumeration > SAL_CALL SfxGlobalEvents_Impl::createE
{
models[i] <<= m_lModels[i];
}
uno::Reference< container::XEnumeration > xEnum(
static_cast<container::XEnumeration*>(
new ::comphelper::OAnyEnumeration(models)));
uno::Reference<container::XEnumeration> xEnum(new ::comphelper::OAnyEnumeration(models));
aLock.clear();
// <- SAFE

View file

@ -369,7 +369,7 @@ uno::Reference< io::XStream > SAL_CALL FSStorage::openStreamElement(
::ucbhelper::Content aResultContent( aFileURL.GetMainURL( INetURLObject::DecodeMechanism::NONE ), xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
xResult = new OFSInputStreamContainer(xInStream);
}
}
catch( embed::InvalidStorageException& )
@ -1124,7 +1124,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
uno::Reference< io::XStream > xStream =
xSimpleFileAccess->openFileReadWrite( aFileURL );
xResult = static_cast< io::XStream* >( new OFSStreamContainer( xStream ) );
xResult = new OFSStreamContainer(xStream);
}
else
{
@ -1135,7 +1135,7 @@ uno::Reference< embed::XExtendedStorageStream > SAL_CALL FSStorage::openStreamEl
{
uno::Reference< io::XStream > xStream =
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
::ucbhelper::Content aResultContent( aFileURL, xDummyEnv, comphelper::getProcessComponentContext() );
uno::Reference< io::XInputStream > xInStream = aResultContent.openStream();
xResult = static_cast< io::XStream* >( new OFSInputStreamContainer( xInStream ) );
xResult = new OFSInputStreamContainer(xInStream);
}
}
catch( embed::InvalidStorageException& )

View file

@ -420,7 +420,7 @@
Reference< XNameContainer > SAL_CALL OGeometryControlModel_Base::getEvents()
{
if( !mxEventContainer.is() )
mxEventContainer = static_cast<XNameContainer*>(new toolkit::ScriptEventContainer());
mxEventContainer = new toolkit::ScriptEventContainer();
return mxEventContainer;
}

View file

@ -154,7 +154,7 @@ Reference< XInterface > SAL_CALL
FileProvider::CreateInstance(
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 );
}

View file

@ -406,8 +406,8 @@ static uno::Reference< uno::XInterface >
PasswordContainerInteractionHandler_CreateInstance(
const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
{
lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
new PasswordContainerInteractionHandler( comphelper::getComponentContext(rSMgr) ) );
lang::XServiceInfo* pX
= new PasswordContainerInteractionHandler(comphelper::getComponentContext(rSMgr));
return uno::Reference< uno::XInterface >::query( pX );
}