summaryrefslogtreecommitdiff
path: root/xmloff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-09-04 12:02:01 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-09-04 19:21:07 +0200
commit41a46a306f40a7296c56bdeea0ba8a6d630aa15c (patch)
tree6dfa116917069cc48976ee005429f7da01028382 /xmloff
parent50238bddf0e95169007cb90479cca86849a19007 (diff)
dynamic_cast -> static_cast (tdf#130795)
the dynamic_cast is hot here, and none of these dynamic_casts are necessary, we already assert that they must succeed, so just use static_cast Change-Id: I88ade90431c4da4792c778b5cdab22332ed1c428 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121637 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r--xmloff/source/core/xmlimp.cxx4
-rw-r--r--xmloff/source/draw/XMLNumberStyles.cxx2
-rw-r--r--xmloff/source/text/XMLTextFrameContext.cxx8
-rw-r--r--xmloff/source/transform/TransformerBase.cxx3
4 files changed, 8 insertions, 9 deletions
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index a4f709836427..ea5e88b47603 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -785,7 +785,7 @@ void SAL_CALL SvXMLImport::startFastElement (sal_Int32 Element,
const SvXMLImportContextRef & pHandler = maContexts.top();
SAL_INFO("xmloff.core", "calling createFastChildContext on " << typeid(*pHandler.get()).name());
auto tmp = pHandler->createFastChildContext( Element, Attribs );
- xContext = dynamic_cast<SvXMLImportContext*>(tmp.get());
+ xContext = static_cast<SvXMLImportContext*>(tmp.get());
assert((tmp && xContext) || (!tmp && !xContext));
}
else
@@ -823,7 +823,7 @@ void SAL_CALL SvXMLImport::startUnknownElement (const OUString & rNamespace, con
const SvXMLImportContextRef & pHandler = maContexts.top();
SAL_INFO("xmloff.core", "calling createUnknownChildContext on " << typeid(*pHandler.get()).name());
auto tmp = pHandler->createUnknownChildContext( rNamespace, rName, Attribs );
- xContext = dynamic_cast<SvXMLImportContext*>(tmp.get());
+ xContext = static_cast<SvXMLImportContext*>(tmp.get());
assert((tmp && xContext) || (!tmp && !xContext));
}
else
diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx
index 33bafa2b4435..baf9f1fbf924 100644
--- a/xmloff/source/draw/XMLNumberStyles.cxx
+++ b/xmloff/source/draw/XMLNumberStyles.cxx
@@ -704,7 +704,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLNumberFormatImpor
const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
{
return new SdXMLNumberFormatMemberImportContext( GetImport(), nElement, xAttrList,
- this, &dynamic_cast<SvXMLImportContext&>(*SvXMLNumFormatContext::createFastChildContext( nElement, xAttrList )) );
+ this, static_cast<SvXMLImportContext*>(SvXMLNumFormatContext::createFastChildContext( nElement, xAttrList ).get()) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx
index fdf40897e563..0100a25ef03e 100644
--- a/xmloff/source/text/XMLTextFrameContext.cxx
+++ b/xmloff/source/text/XMLTextFrameContext.cxx
@@ -1636,7 +1636,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c
// note: no more draw:image can be added once we get here
m_xImplContext = solveMultipleImages();
}
- xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext( nElement, xAttrList ));
+ xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext( nElement, xAttrList ).get());
}
else if (nElement == XML_ELEMENT(LO_EXT, XML_SIGNATURELINE))
{
@@ -1645,7 +1645,7 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c
// note: no more draw:image can be added once we get here
m_xImplContext = solveMultipleImages();
}
- xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext(nElement, xAttrList));
+ xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
}
else if (nElement == XML_ELEMENT(LO_EXT, XML_QRCODE))
{
@@ -1654,11 +1654,11 @@ css::uno::Reference< css::xml::sax::XFastContextHandler > XMLTextFrameContext::c
// note: no more draw:image can be added once we get here
m_xImplContext = solveMultipleImages();
}
- xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext(nElement, xAttrList));
+ xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
}
else if (nElement == XML_ELEMENT(DRAW, XML_A))
{
- xContext = &dynamic_cast<SvXMLImportContext&>(*m_xImplContext->createFastChildContext(nElement, xAttrList));
+ xContext = static_cast<SvXMLImportContext*>(m_xImplContext->createFastChildContext(nElement, xAttrList).get());
}
else
{
diff --git a/xmloff/source/transform/TransformerBase.cxx b/xmloff/source/transform/TransformerBase.cxx
index f75a2755223e..90f8b198862a 100644
--- a/xmloff/source/transform/TransformerBase.cxx
+++ b/xmloff/source/transform/TransformerBase.cxx
@@ -387,8 +387,7 @@ void SAL_CALL XMLTransformerBase::initialize( const Sequence< Any >& aArguments
css::uno::Reference< XFastDocumentHandler > xFastHandler;
if( (rArgument >>= xFastHandler) && xFastHandler )
{
- SvXMLImport *pFastHandler = dynamic_cast<SvXMLImport*>( xFastHandler.get() );
- assert(pFastHandler);
+ SvXMLImport *pFastHandler = static_cast<SvXMLImport*>( xFastHandler.get() );
m_xHandler.set( new SvXMLLegacyToFastDocHandler( pFastHandler ) );
}
// document handler