[Libreoffice-commits] core.git: include/rtl sal/rtl sal/util sax/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Jul 21 13:38:56 UTC 2021


 include/rtl/string.h             |   20 --------------------
 sal/rtl/string.cxx               |    8 --------
 sal/util/sal.map                 |    5 -----
 sax/source/tools/fastattribs.cxx |    4 +++-
 4 files changed, 3 insertions(+), 34 deletions(-)

New commits:
commit 99a1290b3f2c8584db0a33fe48adf93dccce3a92
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Jul 21 09:42:47 2021 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Jul 21 15:38:03 2021 +0200

    Use existing rtl_math_stringToDouble
    
    ...like it is also already done in LineParser::readDouble in
    sdext/source/pdfimport/wrapper/wrapper.cxx (esp. since the code should be
    changed to use C++17 std::from_chars once that is available in all our
    baselines), reverting again the introduction of rtl_str_toDouble_WithLength in
    b1df9c67349cf4cc5be4128d797aefb87f50e38f "[API CHANGE] reduce cost of numeric
    conversion"
    
    Change-Id: If7e3a15649f80093d3407157412fd3deb3a38b12
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119318
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
    Tested-by: Jenkins

diff --git a/include/rtl/string.h b/include/rtl/string.h
index 155c1d46126c..d29caf93a718 100644
--- a/include/rtl/string.h
+++ b/include/rtl/string.h
@@ -863,26 +863,6 @@ SAL_DLLPUBLIC float SAL_CALL rtl_str_toFloat(
 SAL_DLLPUBLIC double SAL_CALL rtl_str_toDouble(
         const char * str ) SAL_THROW_EXTERN_C();
 
-/** Interpret a string as a double.
-
-    This function cannot be used for language-specific conversion.  The string
-    must be null-terminated.
-
-    @param str
-    a null-terminated string.
-
-    @param nStrLength
-    number of chars to process
-
-    @return
-    the double value represented by the string, or 0.0 if the string does not
-    represent a double.
-
-    @since LibreOffice 7.3
- */
-SAL_DLLPUBLIC double SAL_CALL rtl_str_toDouble_WithLength(
-        const char * str, sal_Int32 nStrLength ) SAL_THROW_EXTERN_C();
-
 /* ======================================================================= */
 
 #ifdef _WIN32
diff --git a/sal/rtl/string.cxx b/sal/rtl/string.cxx
index 660f22552b0c..94be8029032a 100644
--- a/sal/rtl/string.cxx
+++ b/sal/rtl/string.cxx
@@ -110,14 +110,6 @@ double SAL_CALL rtl_str_toDouble(char const * pStr) SAL_THROW_EXTERN_C()
                                    nullptr, nullptr);
 }
 
-double SAL_CALL rtl_str_toDouble_WithLength(const char* pStr,
-                                              sal_Int32 nStrLength) SAL_THROW_EXTERN_C()
-{
-    assert(pStr);
-    return rtl_math_stringToDouble(pStr, pStr + nStrLength, '.', 0,
-                                   nullptr, nullptr);
-}
-
 /* ======================================================================= */
 
 static int rtl_ImplGetFastUTF8ByteLen( const sal_Unicode* pStr, sal_Int32 nLen )
diff --git a/sal/util/sal.map b/sal/util/sal.map
index e33dde55b8da..49efb2a436cd 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -755,11 +755,6 @@ PRIVATE_1.7 { # LibreOffice 7.1
         rtl_uString_newReplaceAllFromIndexUtf16LUtf16L;
 } PRIVATE_1.5;
 
-PRIVATE_1.8 { # LibreOffice 7.3
-    global:
-        rtl_str_toDouble_WithLength;
-} PRIVATE_1.7;
-
 PRIVATE_textenc.1 { # LibreOffice 3.6
     global:
         _ZN3sal6detail7textenc20convertCharToUnicode*;
diff --git a/sax/source/tools/fastattribs.cxx b/sax/source/tools/fastattribs.cxx
index 2512f6296aee..9bf4a3f4ae6e 100644
--- a/sax/source/tools/fastattribs.cxx
+++ b/sax/source/tools/fastattribs.cxx
@@ -20,6 +20,7 @@
 #include <algorithm>
 
 #include <com/sun/star/xml/sax/SAXException.hpp>
+#include <rtl/math.h>
 #include <sax/fastattribs.hxx>
 
 using namespace ::com::sun::star::uno;
@@ -221,7 +222,8 @@ bool FastAttributeList::getAsDouble( sal_Int32 nToken, double &rDouble) const
     for (size_t i = 0; i < maAttributeTokens.size(); ++i)
         if (maAttributeTokens[i] == nToken)
         {
-            rDouble = rtl_str_toDouble_WithLength( getFastAttributeValue(i),  AttributeValueLength(i) );
+            auto const p = getFastAttributeValue(i);
+            rDouble = rtl_math_stringToDouble( p,  p + AttributeValueLength(i), '.', 0, nullptr, nullptr );
             return true;
         }
     return false;


More information about the Libreoffice-commits mailing list