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>
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 666fe69..e985a7d 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -3892,7 +3892,7 @@
    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 89d887e..e4f6540 100644
--- a/comphelper/source/streaming/seekableinput.cxx
+++ b/comphelper/source/streaming/seekableinput.cxx
@@ -81,10 +81,7 @@
    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 d295bf0..2a31647 100644
--- a/dtrans/source/win32/clipb/wcbentry.cxx
+++ b/dtrans/source/win32/clipb/wcbentry.cxx
@@ -42,7 +42,8 @@

    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 45337ec7..772eeb0 100644
--- a/dtrans/source/win32/dnd/source.cxx
+++ b/dtrans/source/win32/dnd/source.cxx
@@ -96,8 +96,7 @@
    // 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 494119c..552e370 100644
--- a/dtrans/source/win32/dnd/target.cxx
+++ b/dtrans/source/win32/dnd/target.cxx
@@ -312,8 +312,7 @@
        // 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 @@
        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 7261be4..c85c8a5 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -2014,7 +2014,7 @@

                // 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 @@
        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 c029eca..1f31fcb 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1931,13 +1931,11 @@
    {
        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 32533ea..3035a39 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -191,7 +191,7 @@
    {
        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 @@
        {
            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 2fec79f..26116a0e 100644
--- a/package/source/xstor/xfactory.cxx
+++ b/package/source/xstor/xfactory.cxx
@@ -92,13 +92,9 @@
                        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 @@
        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 @@
        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 a1cc4bc..3d6f5b4 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -294,8 +294,8 @@

        // 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 32c02cc..7f61d8b 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -715,7 +715,7 @@
    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 bbbf62c..30b5458 100644
--- a/svx/source/unodraw/unomod.cxx
+++ b/svx/source/unodraw/unomod.cxx
@@ -343,7 +343,7 @@
    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 21219a8..ccdea4e 100644
--- a/toolkit/source/controls/unocontrolcontainer.cxx
+++ b/toolkit/source/controls/unocontrolcontainer.cxx
@@ -754,8 +754,7 @@
                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 38b4d67..25e1a1d 100644
--- a/ucb/source/core/provprox.cxx
+++ b/ucb/source/core/provprox.cxx
@@ -54,9 +54,7 @@
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 b8482c4..98f9176 100644
--- a/ucb/source/core/ucbprops.cxx
+++ b/ucb/source/core/ucbprops.cxx
@@ -200,9 +200,7 @@
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 3454a7a..eb28a1e 100644
--- a/ucb/source/core/ucbstore.cxx
+++ b/ucb/source/core/ucbstore.cxx
@@ -163,9 +163,8 @@
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 32bc6f7..e5b3459 100644
--- a/ucb/source/sorter/sortdynres.cxx
+++ b/ucb/source/sorter/sortdynres.cxx
@@ -443,9 +443,8 @@
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 4fc4170..4aea87a 100644
--- a/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_documentcontentfactory.cxx
@@ -126,9 +126,7 @@
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 1633bd2..61e02c8 100644
--- a/unotools/source/ucbhelper/ucblockbytes.cxx
+++ b/unotools/source/ucbhelper/ucblockbytes.cxx
@@ -1278,9 +1278,9 @@
    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 4cb7493..94d8845 100644
--- a/unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ b/unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -144,8 +144,7 @@
    // 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 @@
    // 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 b010c6b..9fa2e6f 100644
--- a/unoxml/source/xpath/xpathapi.cxx
+++ b/unoxml/source/xpath/xpathapi.cxx
@@ -49,7 +49,7 @@
    // 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 10970e8..e65d414 100644
--- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
+++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx
@@ -574,7 +574,7 @@
    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 30fcd22..60a0596 100644
--- a/xmlhelp/source/treeview/tvfactory.cxx
+++ b/xmlhelp/source/treeview/tvfactory.cxx
@@ -153,8 +153,8 @@
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 dfb4b81..acdb002 100644
--- a/xmlscript/source/xml_helper/xml_impctx.cxx
+++ b/xmlscript/source/xml_helper/xml_impctx.cxx
@@ -506,10 +506,8 @@
    }
    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 @@
    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 4c8ea13..50b86b5f 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -1767,8 +1767,7 @@
    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 59bc6ad..c5fbb84 100644
--- a/xmlscript/source/xmllib_imexp/xmllib_import.cxx
+++ b/xmlscript/source/xmllib_imexp/xmllib_import.cxx
@@ -233,15 +233,13 @@
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 dd5efff..2751d98 100644
--- a/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
+++ b/xmlscript/source/xmlmod_imexp/xmlmod_import.cxx
@@ -146,8 +146,7 @@
Reference< xml::sax::XDocumentHandler >
importScriptModule( ModuleDescriptor& rMod )
{
    return ::xmlscript::createDocumentHandler(
        static_cast< xml::input::XRoot * >( new ModuleImport( rMod ) ) );
    return ::xmlscript::createDocumentHandler(new ModuleImport(rMod));
}

}