diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2018-08-09 16:30:08 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-08-10 08:19:55 +0200 |
commit | b268ef57e97e692644335afeae834205ecb73557 (patch) | |
tree | 872299ece84d84bb335ede04c6687b287a751208 /sw/source/filter | |
parent | d063bea95848fd3b899b9809cb8e69eb61ded2fc (diff) |
unnecessary null check before dynamic_cast, in sw
Change-Id: I4f3f3f8b8b7fdf57fe76ff9a24cd8c58e386392d
Reviewed-on: https://gerrit.libreoffice.org/58770
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/filter')
-rw-r--r-- | sw/source/filter/html/swhtml.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8esh.cxx | 3 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8sty.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8gr.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8atr.cxx | 12 |
5 files changed, 8 insertions, 15 deletions
diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index c3130d840b52..21fda9474e88 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -785,9 +785,7 @@ if( m_pSttNdIdx->GetIndex()+1 == m_pPam->GetBound( false ).nNode.GetIndex() ) pCNd->EndOfSectionIndex() && !bHasFlysOrMarks ) { SwViewShell *pVSh = CheckActionViewShell(); - SwCursorShell *pCursorSh = pVSh && dynamic_cast< const SwCursorShell *>( pVSh ) != nullptr - ? static_cast < SwCursorShell * >( pVSh ) - : nullptr; + SwCursorShell *pCursorSh = dynamic_cast<SwCursorShell *>( pVSh ); if( pCursorSh && pCursorSh->GetCursor()->GetPoint() ->nNode.GetIndex() == nNodeIdx ) diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx index 98ec36fe9534..d212c27bb204 100644 --- a/sw/source/filter/ww8/wrtw8esh.cxx +++ b/sw/source/filter/ww8/wrtw8esh.cxx @@ -1083,11 +1083,10 @@ void MSWord_SdrAttrIter::OutEEField(const SfxPoolItem& rHt) { const SvxFieldItem &rField = static_cast<const SvxFieldItem &>(rHt); const SvxFieldData *pField = rField.GetField(); - if (pField && dynamic_cast< const SvxURLField *>( pField ) != nullptr) + if (auto pURL = dynamic_cast< const SvxURLField *>( pField )) { sal_uInt8 nOldTextTyp = m_rExport.m_nTextTyp; m_rExport.m_nTextTyp = mnTyp; - const SvxURLField *pURL = static_cast<const SvxURLField *>(pField); m_rExport.AttrOutput().StartURL( pURL->GetURL(), pURL->GetTargetFrame() ); const OUString &rStr = pURL->GetRepresentation(); diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index ef4b2c21d6f9..dc57e91f6c5f 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -2306,7 +2306,7 @@ void WW8_WrPlcSubDoc::WriteGenericPlc( WW8Export& rWrt, sal_uInt8 nTTyp, // is it a writer or sdr - textbox? const SdrObject* pObj = static_cast<SdrObject const *>(aContent[ i ]); sal_Int32 nCnt = 1; - if (pObj && dynamic_cast< const SdrTextObj *>( pObj ) == nullptr ) + if (dynamic_cast< const SdrTextObj *>( pObj )) { // find the "highest" SdrObject of this const SwFrameFormat& rFormat = *::FindFrameFormat( pObj ); diff --git a/sw/source/filter/ww8/wrtww8gr.cxx b/sw/source/filter/ww8/wrtww8gr.cxx index 9f908a86ec0a..e1db0e0a33e8 100644 --- a/sw/source/filter/ww8/wrtww8gr.cxx +++ b/sw/source/filter/ww8/wrtww8gr.cxx @@ -421,7 +421,7 @@ void WW8Export::OutGrf(const ww8::Frame &rFrame) bool bVert = false; //The default for word in vertical text mode is to center, //otherwise a sub/super script hack is employed - if (m_pOutFormatNode && dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) != nullptr ) + if (dynamic_cast< const SwContentNode *>( m_pOutFormatNode ) ) { const SwTextNode* pTextNd = static_cast<const SwTextNode*>(m_pOutFormatNode); SwPosition aPos(*pTextNd); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index d72c0cd37af9..3f82fa3963dc 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -3241,10 +3241,8 @@ void AttributeOutputBase::TextField( const SwFormatField& rField ) void AttributeOutputBase::TextFlyContent( const SwFormatFlyCnt& rFlyContent ) { - if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) != nullptr ) + if ( auto pTextNd = dynamic_cast< const SwContentNode *>( GetExport().m_pOutFormatNode ) ) { - const SwTextNode* pTextNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); - Point aLayPos; aLayPos = pTextNd->FindLayoutRect( false, &aLayPos ).Pos(); @@ -3745,7 +3743,7 @@ void WW8AttributeOutput::TableRowEnd(sal_uInt32 nDepth) void AttributeOutputBase::FormatPageDescription( const SwFormatPageDesc& rPageDesc ) { - if ( GetExport().m_bStyDef && GetExport().m_pOutFormatNode && dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) != nullptr ) + if ( GetExport().m_bStyDef && dynamic_cast< const SwTextFormatColl *>( GetExport().m_pOutFormatNode ) ) { const SwTextFormatColl* pC = static_cast<const SwTextFormatColl*>(GetExport().m_pOutFormatNode); if ( (SfxItemState::SET != pC->GetItemState( RES_BREAK, false ) ) && rPageDesc.KnowsPageDesc() ) @@ -4656,14 +4654,12 @@ void AttributeOutputBase::ParaLineSpacing( const SvxLineSpacingItem& rSpacing ) sal_uInt16 nScript = i18n::ScriptType::LATIN; const SwAttrSet *pSet = nullptr; - if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwFormat *>( GetExport().m_pOutFormatNode ) != nullptr ) + if ( auto pFormat = dynamic_cast< const SwFormat *>( GetExport().m_pOutFormatNode ) ) { - const SwFormat *pFormat = static_cast<const SwFormat*>( GetExport().m_pOutFormatNode ); pSet = &pFormat->GetAttrSet(); } - else if ( GetExport().m_pOutFormatNode && dynamic_cast< const SwTextNode *>( GetExport().m_pOutFormatNode ) != nullptr ) + else if ( auto pNd = dynamic_cast< const SwTextNode *>( GetExport().m_pOutFormatNode ) ) { - const SwTextNode* pNd = static_cast<const SwTextNode*>(GetExport().m_pOutFormatNode); pSet = &pNd->GetSwAttrSet(); nScript = g_pBreakIt->GetBreakIter()->getScriptType(pNd->GetText(), 0); } |