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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 8 18:45:32 UTC 2018


 sc/source/core/data/markarr.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit bc9385c71e780f4dca5c54b8e817faae43c30d18
Author:     Jochen Nitschke <j.nitschke+logerrit at ok.de>
AuthorDate: Mon Oct 8 18:02:30 2018 +0200
Commit:     Jochen Nitschke <j.nitschke+logerrit at ok.de>
CommitDate: Mon Oct 8 20:45:08 2018 +0200

    cppcheck: variableScope and fix index types
    
    Change-Id: I045b4d84e0ad07a98523b91fc7203bfd422b3529
    Reviewed-on: https://gerrit.libreoffice.org/61541
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins
    Reviewed-by: Jochen Nitschke <j.nitschke+logerrit at ok.de>

diff --git a/sc/source/core/data/markarr.cxx b/sc/source/core/data/markarr.cxx
index f9c5fdc3299a..7bdff0fcf989 100644
--- a/sc/source/core/data/markarr.cxx
+++ b/sc/source/core/data/markarr.cxx
@@ -63,13 +63,13 @@ bool ScMarkArray::Search( SCROW nRow, SCSIZE& nIndex ) const
 {
     if (pData)
     {
-        long    nHi         = static_cast<long>(nCount) - 1;
-        long    i           = 0;
-        long    nLo         = 0;
+        assert(nCount > 0);
+        SCSIZE    nHi         = nCount - 1;
+        SCSIZE    nLo         = 0;
 
         while ( nLo <= nHi )
         {
-            i = (nLo + nHi) / 2;
+            SCSIZE i = (nLo + nHi) / 2;
 
             if (pData[i].nRow < nRow)
             {
@@ -84,7 +84,7 @@ bool ScMarkArray::Search( SCROW nRow, SCSIZE& nIndex ) const
             else
             {
                 // found
-                nIndex=static_cast<SCSIZE>(i);
+                nIndex=i;
                 return true;
             }
         }


More information about the Libreoffice-commits mailing list