From 7223808a4771ebf2d23fd263547009ceeecba6e0 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Sun, 21 Oct 2018 22:28:05 +0200 Subject: 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: Mike Kaganski --- editeng/source/editeng/impedit2.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 06a18b7f7403..639419eaf0f7 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -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() ? -- cgit v1.2.3