summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-10-21 22:28:05 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2018-10-22 00:00:00 +0200
commit7223808a4771ebf2d23fd263547009ceeecba6e0 (patch)
tree53a6d9d710eb197cdee489a2309b4c4785a45d62
parent2f6d20d4ff8a308979f84d823211408363502fac (diff)
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 <mike.kaganski@collabora.com>
-rw-r--r--editeng/source/editeng/impedit2.cxx4
1 files 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() ?