[Libreoffice-commits] core.git: basic/source comphelper/source dtrans/source editeng/source oox/source package/source sd/source svx/source toolkit/source ucb/source unotools/source unoxml/source xmlhelp/source xmlscript/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Sun Mar 31 05:27:45 UTC 2019


 basic/source/classes/sbunoobj.cxx                   |    2 +-
 comphelper/source/streaming/seekableinput.cxx       |    5 +----
 dtrans/source/win32/clipb/wcbentry.cxx              |    3 ++-
 dtrans/source/win32/dnd/source.cxx                  |    3 +--
 dtrans/source/win32/dnd/target.cxx                  |    5 ++---
 editeng/source/misc/svxacorr.cxx                    |    4 ++--
 editeng/source/uno/unotext.cxx                      |    6 ++----
 oox/source/shape/ShapeContextHandler.cxx            |    4 ++--
 package/source/xstor/xfactory.cxx                   |   20 +++++++-------------
 package/source/zippackage/ZipPackageStream.cxx      |    4 ++--
 sd/source/ui/unoidl/unomodel.cxx                    |    2 +-
 svx/source/unodraw/unomod.cxx                       |    2 +-
 toolkit/source/controls/unocontrolcontainer.cxx     |    3 +--
 ucb/source/core/provprox.cxx                        |    4 +---
 ucb/source/core/ucbprops.cxx                        |    4 +---
 ucb/source/core/ucbstore.cxx                        |    5 ++---
 ucb/source/sorter/sortdynres.cxx                    |    5 ++---
 ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx |    4 +---
 unotools/source/ucbhelper/ucblockbytes.cxx          |    4 ++--
 unotools/source/ucbhelper/ucbstreamhelper.cxx       |    6 ++----
 unoxml/source/xpath/xpathapi.cxx                    |    2 +-
 xmlhelp/source/cxxhelp/provider/urlparameter.cxx    |    2 +-
 xmlhelp/source/treeview/tvfactory.cxx               |    4 ++--
 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 +--
 27 files changed, 47 insertions(+), 77 deletions(-)

New commits:
commit 184be2d1352c5d3f3aa1e276d26c463c6e49b302
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Mar 31 00:06:17 2019 +0300
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Sun Mar 31 07:27:24 2019 +0200

    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 at collabora.com>

diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 666fe69673f3..e985a7dddf1c 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3892,7 +3892,7 @@ static Reference< XInterface > createAllListenerAdapter
     if( xInvocationAdapterFactory.is() && xListenerType.is() && xListener.is() )
     {
         Reference< XInvocation > xInvocationToAllListenerMapper =
-            static_cast<XInvocation*>(new InvocationToAllListenerMapper( xListenerType, xListener, Helper ));
+            new InvocationToAllListenerMapper(xListenerType, xListener, Helper);
         Type aListenerType( xListenerType->getTypeClass(), xListenerType->getName() );
         Sequence<Type> arg2(1);
         arg2[0] = aListenerType;
diff --git a/comphelper/source/streaming/seekableinput.cxx b/comphelper/source/streaming/seekableinput.cxx
index 89d887ea3548..e4f654043dc7 100644
--- a/comphelper/source/streaming/seekableinput.cxx
+++ b/comphelper/source/streaming/seekableinput.cxx
@@ -81,10 +81,7 @@ uno::Reference< io::XInputStream > OSeekableInputWrapper::CheckSeekableCanWrap(
     if ( xSeek.is() )
         return xInStream;
 
-    uno::Reference< io::XInputStream > xNewStream(
-            static_cast< io::XInputStream* >(
-                new OSeekableInputWrapper( xInStream, rxContext ) ) );
-    return xNewStream;
+    return new OSeekableInputWrapper(xInStream, rxContext);
 }
 
 
diff --git a/dtrans/source/win32/clipb/wcbentry.cxx b/dtrans/source/win32/clipb/wcbentry.cxx
index d295bf00447c..2a316470f8d3 100644
--- a/dtrans/source/win32/clipb/wcbentry.cxx
+++ b/dtrans/source/win32/clipb/wcbentry.cxx
@@ -42,7 +42,8 @@ namespace
 
     Reference< XInterface > createInstance( const Reference< XMultiServiceFactory >& rServiceManager )
     {
-        return Reference< XInterface >( static_cast< XClipboard* >( new CWinClipboard( comphelper::getComponentContext(rServiceManager), "" ) ) );
+        return static_cast<XClipboard*>(
+            new CWinClipboard(comphelper::getComponentContext(rServiceManager), ""));
     }
 }
 
diff --git a/dtrans/source/win32/dnd/source.cxx b/dtrans/source/win32/dnd/source.cxx
index 45337ec764c4..772eeb0ccb00 100644
--- a/dtrans/source/win32/dnd/source.cxx
+++ b/dtrans/source/win32/dnd/source.cxx
@@ -96,8 +96,7 @@ void DragSource::StartDragImpl(
     // to the IDropSource interface implemented in this class (but only
     // while this function executes). The source context is also used
     // in DragSource::QueryContinueDrag.
-    m_currentContext= static_cast<XDragSourceContext*>( new SourceContext(
-                      this, listener ) );
+    m_currentContext = new SourceContext(this, listener);
 
     // Convert the XTransferable data object into an IDataObject object;
 
diff --git a/dtrans/source/win32/dnd/target.cxx b/dtrans/source/win32/dnd/target.cxx
index 494119c11f57..552e3700d3d3 100644
--- a/dtrans/source/win32/dnd/target.cxx
+++ b/dtrans/source/win32/dnd/target.cxx
@@ -312,8 +312,7 @@ HRESULT DropTarget::DragEnter( IDataObject *pDataObj,
         // will be DROPEFFECT_NONE throughout
         m_nLastDropAction= ACTION_DEFAULT | ACTION_MOVE;
 
-        m_currentDragContext= static_cast<XDropTargetDragContext*>( new TargetDragContext(
-            this ) );
+        m_currentDragContext = new TargetDragContext(this);
 
         //--> TRA
 
@@ -451,7 +450,7 @@ HRESULT DropTarget::Drop( IDataObject  * /*pDataObj*/,
         m_bDropComplete= false;
 
         m_nCurrentDropAction= getFilteredActions( grfKeyState, *pdwEffect);
-        m_currentDropContext= static_cast<XDropTargetDropContext*>( new TargetDropContext( this )  );
+        m_currentDropContext = new TargetDropContext(this);
         if( m_nCurrentDropAction)
         {
             DropTargetDropEvent e;
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 7261be47291d..c85c8a55e1b2 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2014,7 +2014,7 @@ void SvxAutoCorrectLanguageLists::LoadXMLExceptList_Imp(
 
                 // connect parser and filter
                 uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create( xContext );
-                uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = static_cast< xml::sax::XFastTokenHandler* >( new SvXMLAutoCorrectTokenHandler );
+                uno::Reference<xml::sax::XFastTokenHandler> xTokenHandler = new SvXMLAutoCorrectTokenHandler;
                 xParser->setFastDocumentHandler( xFilter );
                 xParser->registerNamespace( "http://openoffice.org/2001/block-list", SvXMLAutoCorrectToken::NAMESPACE );
                 xParser->setTokenHandler( xTokenHandler );
@@ -2124,7 +2124,7 @@ SvxAutocorrWordList* SvxAutoCorrectLanguageLists::LoadAutocorrWordList()
         uno::Reference< xml::sax::XFastParser > xParser = xml::sax::FastParser::create(xContext);
         SAL_INFO("editeng", "AutoCorrect Import" );
         uno::Reference< xml::sax::XFastDocumentHandler > xFilter = new SvXMLAutoCorrectImport( xContext, pAutocorr_List.get(), rAutoCorrect, xStg );
-        uno::Reference< xml::sax::XFastTokenHandler > xTokenHandler = static_cast< xml::sax::XFastTokenHandler* >( new SvXMLAutoCorrectTokenHandler );
+        uno::Reference<xml::sax::XFastTokenHandler> xTokenHandler = new SvXMLAutoCorrectTokenHandler;
 
         // connect parser and filter
         xParser->setFastDocumentHandler( xFilter );
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index c029eca7e244..1f31fcbccf00 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1931,13 +1931,11 @@ uno::Reference< container::XEnumeration > SAL_CALL SvxUnoTextBase::createEnumera
     {
         ESelection aSelection;
         ::GetSelection( aSelection, GetEditSource()->GetTextForwarder() );
-        uno::Reference< container::XEnumeration > xEnum( static_cast<container::XEnumeration*>( new SvxUnoTextContentEnumeration( *this, aSelection ) ) );
-        return xEnum;
+        return new SvxUnoTextContentEnumeration(*this, aSelection);
     }
     else
     {
-        uno::Reference< container::XEnumeration > xEnum( static_cast<container::XEnumeration*>( new SvxUnoTextContentEnumeration( *this, maSelection ) ) );
-        return xEnum;
+        return new SvxUnoTextContentEnumeration(*this, maSelection);
     }
 }
 
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 32533eadf825..3035a390a36f 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -191,7 +191,7 @@ ShapeContextHandler::getDrawingShapeContext()
     {
         mpDrawing.reset( new oox::vml::Drawing( *mxFilterBase, mxDrawPage, oox::vml::VMLDRAWING_WORD ) );
         mxDrawingFragmentHandler.set
-          (dynamic_cast<ContextHandler *>
+          (static_cast<ContextHandler *>
            (new oox::vml::DrawingFragment
             ( *mxFilterBase, msRelationFragmentPath, *mpDrawing )));
     }
@@ -203,7 +203,7 @@ ShapeContextHandler::getDrawingShapeContext()
         {
             mxDrawingFragmentHandler.clear();
             mxDrawingFragmentHandler.set
-              (dynamic_cast<ContextHandler *>
+              (static_cast<ContextHandler *>
                (new oox::vml::DrawingFragment
                 ( *mxFilterBase, msRelationFragmentPath, *mpDrawing )));
         }
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 );
 
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 32c02cc5423f..7f61d8bef8ba 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -715,7 +715,7 @@ uno::Reference< drawing::XDrawPages > SAL_CALL SdXImpressDocument::getDrawPages(
     if( !xDrawPages.is() )
     {
         initializeDocument();
-        mxDrawPagesAccess = xDrawPages = static_cast<drawing::XDrawPages*>(new SdDrawPagesAccess(*this));
+        mxDrawPagesAccess = xDrawPages = new SdDrawPagesAccess(*this);
     }
 
     return xDrawPages;
diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx
index bbbf62c9b398..30b545846808 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -343,7 +343,7 @@ uno::Reference< drawing::XDrawPages > SAL_CALL SvxUnoDrawingModel::getDrawPages(
     uno::Reference< drawing::XDrawPages >  xDrawPages( mxDrawPagesAccess );
 
     if( !xDrawPages.is() )
-        mxDrawPagesAccess = xDrawPages = static_cast<drawing::XDrawPages*>(new SvxUnoDrawPagesAccess(*this));
+        mxDrawPagesAccess = xDrawPages = new SvxUnoDrawPagesAccess(*this);
 
     return xDrawPages;
 }
diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx
index 21219a8a325b..ccdea4e41a76 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -754,8 +754,7 @@ void UnoControlContainer::createPeer( const uno::Reference< awt::XToolkit >& rxT
                 implUpdateVisibility( nDialogStep, xContainer );
 
                 uno::Reference< beans::XPropertyChangeListener > xListener =
-                    static_cast< beans::XPropertyChangeListener* >(
-                        new DialogStepChangedListener( xContainer ) );
+                    new DialogStepChangedListener(xContainer);
                 xPSet->addPropertyChangeListener( aPropName, xListener );
             }
 
diff --git a/ucb/source/core/provprox.cxx b/ucb/source/core/provprox.cxx
index 38b4d679153a..25e1a1d1ff74 100644
--- a/ucb/source/core/provprox.cxx
+++ b/ucb/source/core/provprox.cxx
@@ -54,9 +54,7 @@ XSERVICEINFO_COMMOM_IMPL( UcbContentProviderProxyFactory,
 static css::uno::Reference< css::uno::XInterface >
 UcbContentProviderProxyFactory_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new UcbContentProviderProxyFactory( rSMgr ));
-    return css::uno::Reference< css::uno::XInterface >::query( pX );
+    return static_cast<css::lang::XServiceInfo*>(new UcbContentProviderProxyFactory(rSMgr));
 }
 css::uno::Sequence< OUString >
 UcbContentProviderProxyFactory::getSupportedServiceNames_Static()
diff --git a/ucb/source/core/ucbprops.cxx b/ucb/source/core/ucbprops.cxx
index b8482c429c21..98f917621ed6 100644
--- a/ucb/source/core/ucbprops.cxx
+++ b/ucb/source/core/ucbprops.cxx
@@ -200,9 +200,7 @@ XSERVICEINFO_COMMOM_IMPL( UcbPropertiesManager,
 static css::uno::Reference< css::uno::XInterface >
 UcbPropertiesManager_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & /*rSMgr*/ )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new UcbPropertiesManager);
-    return css::uno::Reference< css::uno::XInterface >::query( pX );
+    return static_cast<css::lang::XServiceInfo*>(new UcbPropertiesManager);
 }
 css::uno::Sequence< OUString >
 UcbPropertiesManager::getSupportedServiceNames_Static()
diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx
index 3454a7afd655..eb28a1eb3a7b 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -163,9 +163,8 @@ XSERVICEINFO_COMMOM_IMPL( UcbStore,
 static css::uno::Reference< css::uno::XInterface >
 UcbStore_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new UcbStore( ucbhelper::getComponentContext(rSMgr) ));
-    return css::uno::Reference< css::uno::XInterface >::query( pX );
+    return static_cast<css::lang::XServiceInfo*>(
+        new UcbStore(ucbhelper::getComponentContext(rSMgr)));
 }
 
 css::uno::Sequence< OUString >
diff --git a/ucb/source/sorter/sortdynres.cxx b/ucb/source/sorter/sortdynres.cxx
index 32bc6f7a3761..e5b34599ea0d 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -443,9 +443,8 @@ static css::uno::Reference< css::uno::XInterface >
 SortedDynamicResultSetFactory_CreateInstance( const css::uno::Reference<
                                               css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX = static_cast<css::lang::XServiceInfo*>(
-        new SortedDynamicResultSetFactory( ucbhelper::getComponentContext(rSMgr) ));
-    return css::uno::Reference< css::uno::XInterface >::query( pX );
+    return static_cast<css::lang::XServiceInfo*>(
+        new SortedDynamicResultSetFactory(ucbhelper::getComponentContext(rSMgr)));
 }
 
 css::uno::Sequence< OUString > SortedDynamicResultSetFactory::getSupportedServiceNames_Static()
diff --git a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx
index 4fc417010a0f..4aea87a897aa 100644
--- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx
@@ -126,9 +126,7 @@ static uno::Reference< uno::XInterface >
 DocumentContentFactory_CreateInstance(
     const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
 {
-    lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
-        new DocumentContentFactory( rSMgr ) );
-    return uno::Reference< uno::XInterface >::query( pX );
+    return static_cast<lang::XServiceInfo*>(new DocumentContentFactory(rSMgr));
 }
 
 
diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx
index 1633bd294626..61e02c87072e 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -1278,9 +1278,9 @@ UcbLockBytesRef UcbLockBytes::CreateLockBytes( const Reference < XContent >& xCo
     xLockBytes->SetSynchronMode();
     Reference< XActiveDataControl > xSink;
     if ( eOpenMode & StreamMode::WRITE )
-        xSink = static_cast<XActiveDataControl*>(new UcbStreamer_Impl( xLockBytes.get() ));
+        xSink = new UcbStreamer_Impl(xLockBytes.get());
     else
-        xSink = static_cast<XActiveDataControl*>(new UcbDataSink_Impl( xLockBytes.get() ));
+        xSink = new UcbDataSink_Impl(xLockBytes.get());
 
     if ( rProps.getLength() )
     {
diff --git a/unotools/source/ucbhelper/ucbstreamhelper.cxx b/unotools/source/ucbhelper/ucbstreamhelper.cxx
index 4cb749306149..94d884564146 100644
--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -144,8 +144,7 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileNa
     // create a specialized interaction handler to manages Web certificates and Web credentials when needed
     Reference< XInteractionHandler > xIH(
         css::task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), nullptr ) );
-    Reference < XInteractionHandler > xIHScoped( static_cast< XInteractionHandler *> (
-                                                     new comphelper::SimpleFileAccessInteraction( xIH ) ) );
+    Reference<XInteractionHandler> xIHScoped(new comphelper::SimpleFileAccessInteraction(xIH));
 
     return lcl_CreateStream( rFileName, eOpenMode, xIHScoped, true /* bEnsureFileExists */ );
 }
@@ -157,8 +156,7 @@ std::unique_ptr<SvStream> UcbStreamHelper::CreateStream( const OUString& rFileNa
     // create a specialized interaction handler to manages Web certificates and Web credentials when needed
     Reference< XInteractionHandler > xIH(
         css::task::InteractionHandler::createWithParent( comphelper::getProcessComponentContext(), nullptr ) );
-    Reference < XInteractionHandler > xIHScoped( static_cast< XInteractionHandler *> (
-                                                     new comphelper::SimpleFileAccessInteraction( xIH ) ) );
+    Reference<XInteractionHandler> xIHScoped(new comphelper::SimpleFileAccessInteraction(xIH));
     return lcl_CreateStream( rFileName, eOpenMode, xIHScoped,!bFileExists );
 }
 
diff --git a/unoxml/source/xpath/xpathapi.cxx b/unoxml/source/xpath/xpathapi.cxx
index b010c6b61341..9fa2e6fd2cad 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -49,7 +49,7 @@ namespace XPath
     // factory
     Reference< XInterface > CXPathAPI::_getInstance(const Reference< XMultiServiceFactory >& rSMgr)
     {
-        return Reference< XInterface >(static_cast<XXPathAPI*>(new CXPathAPI(rSMgr)));
+        return static_cast<XXPathAPI*>(new CXPathAPI(rSMgr));
     }
 
     // ctor
diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
index 10970e8c50e6..e65d414bd97e 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -574,7 +574,7 @@ zipOpen(SAL_UNUSED_PARAMETER const char *) {
     OUString language,jar,path;
 
     if( !ugblData->m_pInitial->get_eid().isEmpty() )
-        return static_cast<void*>(new Reference< XHierarchicalNameAccess >);
+        return new Reference<XHierarchicalNameAccess>;
     else
     {
         jar = ugblData->m_pInitial->get_jar();
diff --git a/xmlhelp/source/treeview/tvfactory.cxx b/xmlhelp/source/treeview/tvfactory.cxx
index 30fcd22bff43..60a0596f9dc4 100644
--- a/xmlhelp/source/treeview/tvfactory.cxx
+++ b/xmlhelp/source/treeview/tvfactory.cxx
@@ -153,8 +153,8 @@ Reference< XInterface > SAL_CALL
 TVFactory::CreateInstance(
     const Reference< XMultiServiceFactory >& xMultiServiceFactory )
 {
-    XServiceInfo* xP = static_cast<XServiceInfo*>(new TVFactory( comphelper::getComponentContext(xMultiServiceFactory) ));
-    return Reference< XInterface >::query( xP );
+    return static_cast<XServiceInfo*>(
+        new TVFactory(comphelper::getComponentContext(xMultiServiceFactory)));
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
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));
 }
 
 }


More information about the Libreoffice-commits mailing list