Kaydet (Commit) 7223808a authored tarafından Mike Kaganski's avatar Mike Kaganski

tdf#120703 (PVS): too complex condition; wrong condition

V728 An excessive check can be simplified. The '(A && !B) || (!A && B)'
     expression is equivalent to the 'bool(A) != bool(B)' expression.

V668 There is no sense in testing the 'pCTLOptions' pointer against null,
     as the memory was allocated using the 'new' operator. The exception
     will be generated in the case of memory allocation error.

The latter is apparently error in our condition, since the || turned it
into unconditional execution, but _xISC must be a valid reference inside
the block, since it's dereferenced there in all code paths.

Change-Id: I7fbbb1c4b54503db50e8eabd2666cbcd05758103
Reviewed-on: https://gerrit.libreoffice.org/62153
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst 2f6d20d4
......@@ -1056,7 +1056,7 @@ EditPaM ImpEditEngine::CursorVisualLeftRight( EditView const * pEditView, const
if ( !bPortionBoundary || ( nRTLLevel == nRTLLevelNextPortion ) )
{
if ( ( bVisualToLeft && !(nRTLLevel%2) ) || ( !bVisualToLeft && (nRTLLevel%2) ) )
if (bVisualToLeft != bool(nRTLLevel % 2))
{
aPaM = CursorLeft( aPaM, nCharacterIteratorMode );
pEditView->pImpEditView->SetCursorBidiLevel( 1 );
......@@ -2601,7 +2601,7 @@ EditPaM ImpEditEngine::InsertTextUserInput( const EditSelection& rCurSel,
if (!pCTLOptions)
pCTLOptions.reset( new SvtCTLOptions );
if (_xISC.is() || pCTLOptions)
if (_xISC)
{
const sal_Int32 nTmpPos = aPaM.GetIndex();
sal_Int16 nCheckMode = pCTLOptions->IsCTLSequenceCheckingRestricted() ?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment