[Libreoffice-commits] core.git: sw/source
Noel Grandin
noel.grandin at collabora.co.uk
Fri Apr 20 10:10:04 UTC 2018
sw/source/core/crsr/trvltbl.cxx | 54 ++++++++++++++++++++--------------------
1 file changed, 28 insertions(+), 26 deletions(-)
New commits:
commit f5a9fb18b2b523e517ab425948c4488fe19e39a8
Author: Noel Grandin <noel.grandin at 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 <ci at libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin at 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;
}
More information about the Libreoffice-commits
mailing list