diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2020-07-22 13:50:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2020-07-23 07:53:20 +0200 |
commit | eaf55518621b1fe08a60aec98b4367d7ad722cb9 (patch) | |
tree | 6e5e369e98719f705442914c63a442d77d5dbcc2 | |
parent | d8270636a57e7dc68ede51308c380e2098f765d7 (diff) |
Silence GCC 11 trunk -Werror=nonnull involving dynamic_cast
...where the compiler now warns that the implicit this pointer argument could be
null in a member function call made via a dynamic_cast-converted pointer (and
where the code apparently relies on the dynamic_cast not to fail)
Change-Id: I79482f4a853b6b47c5f9dd099a4e8377a19f7b0d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/99219
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r-- | sw/qa/extras/globalfilter/globalfilter.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/odfexport/odfexport.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/flowfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/unocore/unoobj.cxx | 4 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/cpptypemaker.cxx | 4 | ||||
-rw-r--r-- | unodevtools/source/skeletonmaker/javatypemaker.cxx | 8 |
6 files changed, 11 insertions, 11 deletions
diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 8a57aa68f442..5b3e84ace854 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -845,7 +845,7 @@ void Test::testSkipImages() static auto verifyNestedFieldmark(OUString const& rTestName, uno::Reference<lang::XComponent> const& xComponent) -> void { - SwDoc const*const pDoc(dynamic_cast<SwXTextDocument*>(xComponent.get())->GetDocShell()->GetDoc()); + SwDoc const*const pDoc(dynamic_cast<SwXTextDocument&>(*xComponent).GetDocShell()->GetDoc()); IDocumentMarkAccess const& rIDMA(*pDoc->getIDocumentMarkAccess()); // no spurious bookmarks have been created diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index c084c008d59b..04d9729dcfa4 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -981,7 +981,7 @@ DECLARE_ODFEXPORT_TEST(testProtectionKey, "protection-key.fodt") DECLARE_ODFEXPORT_TEST(testTdf128188, "footnote-collect-at-end-of-section.fodt") { - SwDoc *const pDoc = dynamic_cast<SwXTextDocument*>(mxComponent.get())->GetDocShell()->GetDoc(); + SwDoc *const pDoc = dynamic_cast<SwXTextDocument&>(*mxComponent).GetDocShell()->GetDoc(); CPPUNIT_ASSERT(pDoc); SwFootnoteIdxs const& rFootnotes(pDoc->GetFootnoteIdxs()); // Section1 diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx index c4a9f76fdde8..2bd324c0f47f 100644 --- a/sw/source/core/layout/flowfrm.cxx +++ b/sw/source/core/layout/flowfrm.cxx @@ -2380,7 +2380,7 @@ bool SwFlowFrame::MoveBwd( bool &rbReformat ) while ( pLower ) { if ( pLower->IsSctFrame() && - !dynamic_cast<const SwSectionFrame*>(pLower)->GetSection() ) + !dynamic_cast<const SwSectionFrame&>(*pLower).GetSection() ) { pLower = pLower->GetNext(); continue; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 236481cb03b2..aa3fd65fc2f4 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1707,8 +1707,8 @@ SwXTextCursor::setString(const OUString& aString) m_pImpl->GetCursorOrThrow(); // just to check if valid const bool bForceExpandHints( (CursorType::Meta == m_pImpl->m_eType) - && dynamic_cast<SwXMeta*>(m_pImpl->m_xParentText.get()) - ->CheckForOwnMemberMeta(*GetPaM(), true) ); + && dynamic_cast<SwXMeta&>(*m_pImpl->m_xParentText) + .CheckForOwnMemberMeta(*GetPaM(), true) ); DeleteAndInsert(aString, bForceExpandHints); } diff --git a/unodevtools/source/skeletonmaker/cpptypemaker.cxx b/unodevtools/source/skeletonmaker/cpptypemaker.cxx index 14304c4761ff..b7b4f4a7c0ec 100644 --- a/unodevtools/source/skeletonmaker/cpptypemaker.cxx +++ b/unodevtools/source/skeletonmaker/cpptypemaker.cxx @@ -952,8 +952,8 @@ void generateDocumentation(std::ostream & o, o << "; get method:\nstatic "; printType( o, options, manager, - dynamic_cast< unoidl::InterfaceBasedSingletonEntity * >( - entity.get())->getBase(), + dynamic_cast< unoidl::InterfaceBasedSingletonEntity & >( + *entity).getBase(), 1); o << " get(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & context);\n"; break; diff --git a/unodevtools/source/skeletonmaker/javatypemaker.cxx b/unodevtools/source/skeletonmaker/javatypemaker.cxx index f88530ecb316..ea373dac520e 100644 --- a/unodevtools/source/skeletonmaker/javatypemaker.cxx +++ b/unodevtools/source/skeletonmaker/javatypemaker.cxx @@ -816,8 +816,8 @@ void generateDocumentation(std::ostream & o, printConstructors(o, options, manager, nucleus); generateDocumentation( o, options, manager, - u2b(dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity * >( - entity.get())->getBase()), + u2b(dynamic_cast< unoidl::SingleInterfaceBasedServiceEntity & >( + *entity).getBase()), delegate); break; @@ -837,8 +837,8 @@ void generateDocumentation(std::ostream & o, o << "; get method:\npublic static "; printType( o, options, manager, - dynamic_cast< unoidl::InterfaceBasedSingletonEntity * >( - entity.get())->getBase(), + dynamic_cast< unoidl::InterfaceBasedSingletonEntity & >( + *entity).getBase(), false); o << " get(com.sun.star.uno.XComponentContext context);\n"; break; |