diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-02-02 16:40:49 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-02-02 18:23:30 +0000 |
commit | fd35fad16a656d333bdbf1cc9214d1185d33ceb3 (patch) | |
tree | 69c4ebd6d7df3448df7a16e58737462be79737fe | |
parent | a33f4060a4baa16eac5d997187764270e93cb6dd (diff) |
coverity#1267629 Logically dead code
Change-Id: I5ac6fd2507bda0c985abb54e2269563ed79afc6a
-rw-r--r-- | writerfilter/source/ooxml/OOXMLFastContextHandler.cxx | 9 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 8 |
2 files changed, 6 insertions, 11 deletions
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx index 509637dea6d8..3a47a8a7c572 100644 --- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx +++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx @@ -2031,15 +2031,12 @@ void OOXMLFastContextHandlerMath::process() assert(ref.is()); if (!ref.is()) return; - uno::Reference< uno::XInterface > component( ref->getComponent(), uno::UNO_QUERY ); + uno::Reference< uno::XInterface > component(ref->getComponent(), uno::UNO_QUERY_THROW); // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated // to RTLD_GLOBAL, so most probably a gcc bug. - oox::FormulaImportBase* import = dynamic_cast< oox::FormulaImportBase* >( dynamic_cast< SfxBaseModel* >(component.get())); - assert( import != nullptr ); - if (!import) - return; - import->readFormulaOoxml( buffer ); + oox::FormulaImportBase& import = dynamic_cast<oox::FormulaImportBase&>(dynamic_cast<SfxBaseModel&>(*component.get())); + import.readFormulaOoxml(buffer); if (isForwardEvents()) { OOXMLPropertySet * pProps = new OOXMLPropertySetImpl(); diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index d24b5d27afb1..28607ea63c71 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -5539,14 +5539,12 @@ RTFError RTFDocumentImpl::popState() comphelper::EmbeddedObjectContainer aContainer; OUString aName; uno::Reference<embed::XEmbeddedObject> xObject = aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName); - uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_QUERY); + uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_QUERY_THROW); // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class, // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated // to RTLD_GLOBAL, so most probably a gcc bug. - oox::FormulaImportBase* pImport = dynamic_cast<oox::FormulaImportBase*>(dynamic_cast<SfxBaseModel*>(xComponent.get())); - assert(pImport != nullptr); - if (pImport) - pImport->readFormulaOoxml(m_aMathBuffer); + oox::FormulaImportBase& rImport = dynamic_cast<oox::FormulaImportBase&>(dynamic_cast<SfxBaseModel&>(*xComponent.get())); + rImport.readFormulaOoxml(m_aMathBuffer); auto pValue = std::make_shared<RTFValue>(xObject); RTFSprms aMathAttributes; aMathAttributes.set(NS_ooxml::LN_starmath, pValue); |