From f2cd9c0c789b5825b4d5bb84b352d089e231e527 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sat, 24 Nov 2018 21:55:10 +0300 Subject: tdf#120703 PVS: V560 A part of conditional expression is always true/false Change-Id: If173f42302553b164267909a0a3156bb25a6d558 Reviewed-on: https://gerrit.libreoffice.org/63957 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- sw/source/core/edit/edtox.cxx | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sw/source/core/edit/edtox.cxx') diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 80526cc81b5f..2495fc8de524 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -154,17 +154,16 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) } /// update tables of content -void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) +void SwEditShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) { - OSL_ENSURE( dynamic_cast( &rTOX) != nullptr, "no TOXBaseSection!" ); - SwTOXBaseSection* pTOX = const_cast(static_cast(&rTOX)); - OSL_ENSURE(pTOX, "no current listing"); - if( pTOX && nullptr != pTOX->GetFormat()->GetSectionNode() ) + assert(dynamic_cast(&rTOX) && "no TOXBaseSection!"); + SwTOXBaseSection& rTOXSect = static_cast(const_cast(rTOX)); + if (rTOXSect.GetFormat()->GetSectionNode()) { SwDoc* pMyDoc = GetDoc(); SwDocShell* pDocSh = pMyDoc->GetDocShell(); - bool bInIndex = pTOX == GetCurTOX(); + bool bInIndex = &rTOX == GetCurTOX(); SET_CURR_SHELL( this ); StartAllAction(); @@ -174,17 +173,17 @@ void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) pMyDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::TOXCHANGE, nullptr); // create listing stub - pTOX->Update(pSet); + rTOXSect.Update(pSet); // correct Cursor if( bInIndex ) - pTOX->SetPosAtStartEnd( *GetCursor()->GetPoint() ); + rTOXSect.SetPosAtStartEnd(*GetCursor()->GetPoint()); // start formatting CalcLayout(); // insert page numbering - pTOX->UpdatePageNum(); + rTOXSect.UpdatePageNum(); pMyDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::TOXCHANGE, nullptr); -- cgit v1.2.3