[Libreoffice-commits] core.git: editeng/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Oct 21 22:00:24 UTC 2018


 editeng/source/editeng/impedit2.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7223808a4771ebf2d23fd263547009ceeecba6e0
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Sun Oct 21 22:28:05 2018 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Mon Oct 22 00:00:00 2018 +0200

    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 at collabora.com>

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() ?


More information about the Libreoffice-commits mailing list