sw/source/core/crsr/trvltbl.cxx | 54 ++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 26 deletions(-)
New commits: commit f5a9fb18b2b523e517ab425948c4488fe19e39a8 Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Thu Apr 19 16:27:40 2018 +0200 remove unnecessary braces in GotoNextTable and comment the flow a little, it can be confusing Change-Id: I22fb11896a6d7e3b2007d822021b791b06caa1de Reviewed-on: https://gerrit.libreoffice.org/53185 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx index ccc648dfe248..1763af7216cc 100644 --- a/sw/source/core/crsr/trvltbl.cxx +++ b/sw/source/core/crsr/trvltbl.cxx @@ -590,41 +590,43 @@ bool GotoNextTable( SwPaM& rCurrentCursor, SwMoveFnCollection const & fnPosTable continue; } - if( pTableNd ) // should never be nullptr + assert( pTableNd ); // coverity, should never be nullptr + + if( &fnPosTable == &fnMoveForward ) // at the beginning? { - if( &fnPosTable == &fnMoveForward ) // at the beginning? + if( !lcl_FindNextCell( aIdx, bInReadOnly )) { - if( !lcl_FindNextCell( aIdx, bInReadOnly )) - { - // skip table - aIdx.Assign( *pTableNd->EndOfSectionNode(), + 1 ); - continue; - } + // skip table + aIdx.Assign( *pTableNd->EndOfSectionNode(), + 1 ); + continue; } - else + } + else + { + aIdx = *aIdx.GetNode().EndOfSectionNode(); + // check protected cells + if( !lcl_FindNextCell( aIdx, bInReadOnly )) { - aIdx = *aIdx.GetNode().EndOfSectionNode(); - // check protected cells - if( !lcl_FindNextCell( aIdx, bInReadOnly )) - { - // skip table - aIdx.Assign( *pTableNd->EndOfSectionNode(), + 1 ); - continue; - } + // skip table + aIdx.Assign( *pTableNd->EndOfSectionNode(), + 1 ); + continue; } + } - SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); - if ( pTextNode ) - { - rCurrentCursor.GetPoint()->nNode = *pTextNode; - rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? - pTextNode->Len() : - 0 ); - } - return true; + SwTextNode* pTextNode = aIdx.GetNode().GetTextNode(); + if ( pTextNode ) + { + rCurrentCursor.GetPoint()->nNode = *pTextNode; + rCurrentCursor.GetPoint()->nContent.Assign( pTextNode, &fnPosTable == &fnMoveBackward ? + pTextNode->Len() : + 0 ); } + return true; + } while( true ); + // the flow is such that it is not possible to get there + return false; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits