From 184be2d1352c5d3f3aa1e276d26c463c6e49b302 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 31 Mar 2019 00:06:17 +0300 Subject: 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 --- xmlscript/source/xml_helper/xml_impctx.cxx | 9 +++------ xmlscript/source/xmldlg_imexp/xmldlg_import.cxx | 3 +-- xmlscript/source/xmllib_imexp/xmllib_import.cxx | 6 ++---- xmlscript/source/xmlmod_imexp/xmlmod_import.cxx | 3 +-- 4 files changed, 7 insertions(+), 14 deletions(-) (limited to 'xmlscript/source') diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index dfb4b8141be6..acdb002b6ec2 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -506,10 +506,8 @@ void DocumentHandlerImpl::startElement( } pPrefixes.reset(); // ownership of arrays belongs to attribute list - xAttributes = static_cast< xml::input::XAttributes * >( - new ExtendedAttributes( - nAttribs, std::move(pUids), std::move(pLocalNames), std::move(pQNames), - xAttribs ) ); + xAttributes = new ExtendedAttributes(nAttribs, std::move(pUids), std::move(pLocalNames), + std::move(pQNames), xAttribs); getElementName( rQElementName, &nUid, &aLocalName ); @@ -704,8 +702,7 @@ Reference< xml::sax::XDocumentHandler > createDocumentHandler( SAL_WARN_IF( !xRoot.is(), "xmlscript.xmlhelper", "xRoot is NULL" ); if (xRoot.is()) { - return static_cast< xml::sax::XDocumentHandler * >( - new DocumentHandlerImpl( xRoot, true /* mt use */ ) ); + return new DocumentHandlerImpl(xRoot, true /* mt use */); } return Reference< xml::sax::XDocumentHandler >(); } diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx index 4c8ea1327b21..50b86b5f601e 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx @@ -1767,8 +1767,7 @@ Reference< xml::sax::XDocumentHandler > importDialogModel( std::shared_ptr< std::vector< OUString > > pStyleNames( new std::vector< OUString > ); std::shared_ptr< std::vector< css::uno::Reference< css::xml::input::XElement > > > pStyles( new std::vector< css::uno::Reference< css::xml::input::XElement > > ); return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( - new DialogImport( xContext, xDialogModel, pStyleNames, pStyles, xDocument ) ) ); + new DialogImport(xContext, xDialogModel, pStyleNames, pStyles, xDocument)); } } diff --git a/xmlscript/source/xmllib_imexp/xmllib_import.cxx b/xmlscript/source/xmllib_imexp/xmllib_import.cxx index 59bc6ad64d0c..c5fbb84bf599 100644 --- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx +++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx @@ -233,15 +233,13 @@ void LibraryElement::endElement() Reference< css::xml::sax::XDocumentHandler > importLibraryContainer( LibDescriptorArray* pLibArray ) { - return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( new LibraryImport( pLibArray ) ) ); + return ::xmlscript::createDocumentHandler(new LibraryImport(pLibArray)); } css::uno::Reference< css::xml::sax::XDocumentHandler > importLibrary( LibDescriptor& rLib ) { - return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( new LibraryImport( &rLib ) ) ); + return ::xmlscript::createDocumentHandler(new LibraryImport(&rLib)); } LibDescriptorArray::LibDescriptorArray( sal_Int32 nLibCount ) diff --git a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx index dd5efff933f1..2751d9856c18 100644 --- a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx +++ b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx @@ -146,8 +146,7 @@ ModuleImport::~ModuleImport() Reference< xml::sax::XDocumentHandler > importScriptModule( ModuleDescriptor& rMod ) { - return ::xmlscript::createDocumentHandler( - static_cast< xml::input::XRoot * >( new ModuleImport( rMod ) ) ); + return ::xmlscript::createDocumentHandler(new ModuleImport(rMod)); } } -- cgit