summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-04-19 16:27:40 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-04-20 12:09:40 +0200
commitf5a9fb18b2b523e517ab425948c4488fe19e39a8 (patch)
treebc237c7d87a6cd221cc2a060c9804da1e3d047aa
parent0185e65bcd73dbad2205a39369e1e06b33a2ca51 (diff)
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@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--sw/source/core/crsr/trvltbl.cxx54
1 files changed, 28 insertions, 26 deletions
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;
}