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

New commits:
commit 596be948da407beac93e89017e3104cfe8313873
Author:     Mike Kaganski <[email protected]>
AuthorDate: Thu Sep 18 13:06:15 2025 +0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Sep 29 09:25:38 2025 +0200

    Simplify bSign handling
    
    No need to put the minus to the buffer, process it in conversion,
    check a second special case string, and reset bSign, when we can
    handle unsigned number, and negate it as needed.
    
    Change-Id: I6b9bfb06ab984017fa0078225a1c7281a7b8a99e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191145
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit 9984520ea5b1c5bf4a103bc6031afbd733265228)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191299
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index ce1239eb7b69..0a2993023aa2 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -250,12 +250,8 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
                 ++pos;
             }
         };
-        Buf_t buf(pEnd - p + (bSign ? 2 : 1));
+        Buf_t buf(pEnd - p + 1);
 
-        if (bSign)
-        {
-            buf.insert('-', p); // yes, this may be the same pointer as for 
the next mapping
-        }
         // Put first zero to buffer for strings like "-0"
         if (p != pEnd && *p == '0')
         {
@@ -381,10 +377,6 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
                     {
                         fVal = DBL_MAX;
                     }
-                    else if (num_view == "-1.79769313486232E308")
-                    {
-                        fVal = -DBL_MAX;
-                    }
                     else
                     {
                         eStatus = rtl_math_ConversionStatus_OutOfRange;
@@ -397,7 +389,6 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
                 // else it's subnormal: allow it
             }
             p = buf.map[pCharParseEnd - buf.string];
-            bSign = false;
         }
     }
 

Reply via email to