summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-07-22 13:50:48 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-07-23 07:53:20 +0200
commiteaf55518621b1fe08a60aec98b4367d7ad722cb9 (patch)
tree6e5e369e98719f705442914c63a442d77d5dbcc2 /sw
parentd8270636a57e7dc68ede51308c380e2098f765d7 (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>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/globalfilter/globalfilter.cxx2
-rw-r--r--sw/qa/extras/odfexport/odfexport.cxx2
-rw-r--r--sw/source/core/layout/flowfrm.cxx2
-rw-r--r--sw/source/core/unocore/unoobj.cxx4
4 files changed, 5 insertions, 5 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);
}