[Libreoffice-commits] core.git: sal/rtl

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 30 08:27:32 UTC 2021


 sal/rtl/math.cxx |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 0b81761c86786eeb035f857f549d75f143e491ad
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Thu Sep 30 09:15:01 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Thu Sep 30 10:26:56 2021 +0200

    Simplify comparisons in the loop
    
    Change-Id: I9963a527d2323f4df8c3b46c13f5b7993e22f163
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122855
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 0cd53cd3902a..95dd6ae41bc6 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -367,22 +367,22 @@ void doubleToString(typename T::String ** pResult,
             typename T::Char* pStart = pEnd;
 
             // Backward fill.
-            size_t nGrouping = 0;
+            sal_Int32 nGrouping = cGroupSeparator && pGroups ? *pGroups : 0;
             sal_Int32 nGroupDigits = 0;
             do
             {
                 typename T::Char nDigit = nInt % 10;
                 nInt /= 10;
                 *--pStart = nDigit + '0';
-                if (pGroups && pGroups[nGrouping] == ++nGroupDigits && nInt > 0 && cGroupSeparator)
+                if (nGrouping && nGrouping == ++nGroupDigits && nInt)
                 {
                     *--pStart = cGroupSeparator;
-                    if (pGroups[nGrouping+1])
-                        ++nGrouping;
+                    if (*(pGroups + 1))
+                        nGrouping = *++pGroups;
                     nGroupDigits = 0;
                 }
             }
-            while (nInt > 0);
+            while (nInt);
             if (bSign)
                 *--pStart = '-';
 


More information about the Libreoffice-commits mailing list