Makefile.fetch                                    |    2 
 RepositoryExternal.mk                             |   22 ++--
 bin/oss-fuzz-setup.sh                             |    1 
 codemaker/Executable_cppumaker.mk                 |    6 -
 codemaker/Executable_javamaker.mk                 |    6 -
 config_host.mk.in                                 |    2 
 configure.ac                                      |   29 ++++++
 download.lst                                      |    4 
 external/Module_external.mk                       |    2 
 external/dtoa/C6011.patch.0                       |   10 --
 external/dtoa/README                              |   10 --
 external/dtoa/StaticLibrary_dtoa.mk               |   30 ------
 external/dtoa/UnpackedTarball_dtoa.mk             |   24 -----
 external/dtoa/const.patch                         |   56 ------------
 external/dtoa/coverity.patch                      |   51 -----------
 external/dtoa/include_header.patch                |  100 ----------------------
 external/dtoa/source/dtoa.cxx                     |   15 ---
 external/dtoa/ubsan.patch.0                       |   11 --
 external/fast_float/Module_fast_float.mk          |    6 -
 external/fast_float/README                        |    3 
 external/fast_float/UnpackedTarball_fast_float.mk |    9 -
 idl/Executable_svidl.mk                           |    6 -
 jurt/Library_jpipe.mk                             |    8 -
 jurt/source/pipe/staticsalhack.cxx                |    5 -
 readlicense_oo/license/license.xml                |   42 +++++++--
 sal/CppunitTest_sal_osl_file_details.mk           |    1 
 sal/Library_sal.mk                                |    2 
 sal/rtl/math.cxx                                  |   34 ++-----
 solenv/flatpak-manifest.in                        |    6 -
 svl/Library_svl.mk                                |    2 
 svl/source/numbers/zforfind.cxx                   |    8 +
 unoidl/Executable_unoidl-check.mk                 |    6 -
 unoidl/Executable_unoidl-write.mk                 |    6 -
 vcl/commonfuzzer.mk                               |    1 
 34 files changed, 112 insertions(+), 414 deletions(-)

New commits:
commit 8933978710b8ef862222f53317cca73913e359a8
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Sep 21 03:11:25 2025 +0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Wed Oct 1 09:49:37 2025 +0200

    Replace dtoa with fast_float for faster string-to-float parsing
    
    fast_float implements C++17 from_chars for floating-point types, which
    is still unavailable even in the latest versions of compilers e.g. for
    macOS. It is maintained, unlike dtoa; it is said to be adopted as the
    from_chars implementation for gcc. It is header-only, which simplifies
    many things.
    
    Change-Id: I6b597d4d35a076930e6e35f4f8cff3ca84f48ba1
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191248
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <[email protected]>
    (cherry picked from commit b6feccc9a2154336ff4a83fcc62def322cfcbe84)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/191301
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/Makefile.fetch b/Makefile.fetch
index cc59884a1a85..79b832099151 100644
--- a/Makefile.fetch
+++ b/Makefile.fetch
@@ -114,7 +114,7 @@ $(WORKDIR)/download: $(BUILDDIR)/config_$(gb_Side).mk 
$(SRCDIR)/download.lst $(S
                $(call fetch_Optional,CDR,CDR_TARBALL) \
                $(call fetch_Optional,CLUCENE,CLUCENE_TARBALL) \
                $(call fetch_Optional,DRAGONBOX,DRAGONBOX_TARBALL) \
-               DTOA_TARBALL \
+               $(call fetch_Optional,FAST_FLOAT,FAST_FLOAT_TARBALL) \
                $(call fetch_Optional,LIBCMIS,LIBCMIS_TARBALL) \
                $(call fetch_Optional,COINMP,COINMP_TARBALL) \
                $(call fetch_Optional,CPPUNIT,CPPUNIT_TARBALL) \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index ff8adde5f289..c075418c55c7 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -4343,23 +4343,27 @@ endef
 
 endif
 
-define gb_LinkTarget__use_dtoa
-$(call gb_LinkTarget_use_unpacked,$(1),dtoa)
+ifneq ($(SYSTEM_FAST_FLOAT),)
+
+define gb_LinkTarget__use_fast_float
 $(call gb_LinkTarget_set_include,$(1),\
-       -I$(gb_UnpackedTarball_workdir)/dtoa/include/\
        $$(INCLUDE) \
+       $$(FAST_FLOAT_CFLAGS) \
 )
-$(call gb_LinkTarget_use_static_libraries,$(1),\
-       dtoa \
-)
-
 endef
 
-define gb_ExternalProject__use_dtoa
-$(call gb_ExternalProject_use_static_libraries,$(1),dtoa)
+else
 
+define gb_LinkTarget__use_fast_float
+$(call gb_LinkTarget_use_unpacked,$(1),fast_float)
+$(call gb_LinkTarget_set_include,$(1),\
+       -I$(gb_UnpackedTarball_workdir)/fast_float/include/\
+       $$(INCLUDE) \
+)
 endef
 
+endif
+
 $(eval $(call gb_Helper_register_packages_for_install,ucrt_binarytable,\
        $(if $(UCRT_REDISTDIR),ucrt) \
 ))
diff --git a/bin/oss-fuzz-setup.sh b/bin/oss-fuzz-setup.sh
index ca98c2121c24..c51b3ad9df80 100755
--- a/bin/oss-fuzz-setup.sh
+++ b/bin/oss-fuzz-setup.sh
@@ -22,7 +22,6 @@ curl --no-progress-meter -S \
     -C - -O https://dev-www.libreoffice.org/src/$REDLAND_TARBALL \
     -C - -O https://dev-www.libreoffice.org/src/$BOOST_TARBALL \
     -C - -O https://dev-www.libreoffice.org/src/$BOX2D_TARBALL \
-    -C - -O https://dev-www.libreoffice.org/src/$DTOA_TARBALL \
     -C - -O https://dev-www.libreoffice.org/src/$EXPAT_TARBALL \
     -C - -O https://dev-www.libreoffice.org/src/$LIBJPEG_TURBO_TARBALL \
     -C - -O https://dev-www.libreoffice.org/src/$LCMS2_TARBALL \
diff --git a/codemaker/Executable_cppumaker.mk 
b/codemaker/Executable_cppumaker.mk
index 9b8581356738..41ca490718d7 100644
--- a/codemaker/Executable_cppumaker.mk
+++ b/codemaker/Executable_cppumaker.mk
@@ -11,12 +11,6 @@ $(eval $(call gb_Executable_Executable,cppumaker))
 
 $(eval $(call gb_Executable_use_external,cppumaker,boost_headers))
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-$(eval $(call gb_Executable_use_externals,cppumaker,\
-    dtoa \
-))
-endif
-
 $(eval $(call gb_Executable_use_libraries,cppumaker,\
     unoidl \
     $(if $(filter TRUE,$(DISABLE_DYNLOADING)),reg) \
diff --git a/codemaker/Executable_javamaker.mk 
b/codemaker/Executable_javamaker.mk
index 0cb237c4b6fc..febfe9a71c29 100644
--- a/codemaker/Executable_javamaker.mk
+++ b/codemaker/Executable_javamaker.mk
@@ -11,12 +11,6 @@ $(eval $(call gb_Executable_Executable,javamaker))
 
 $(eval $(call gb_Executable_use_external,javamaker,boost_headers))
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-$(eval $(call gb_Executable_use_externals,javamaker,\
-    dtoa \
-))
-endif
-
 $(eval $(call gb_Executable_use_libraries,javamaker,\
     unoidl \
     $(if $(filter TRUE,$(DISABLE_DYNLOADING)),reg) \
diff --git a/config_host.mk.in b/config_host.mk.in
index 3c13efc3bbfe..691d52aee930 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -144,6 +144,7 @@ DOTNET_ROOT=@DOTNET_ROOT@
 export DOXYGEN=@DOXYGEN@
 export DO_FETCH_TARBALLS=@DO_FETCH_TARBALLS@
 export DRAGONBOX_CFLAGS=@DRAGONBOX_CFLAGS@
+export FAST_FLOAT_CFLAGS=@FAST_FLOAT_CFLAGS@
 export FROZEN_CFLAGS=@FROZEN_CFLAGS@
 export DPKG=@DPKG@
 export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@
@@ -177,6 +178,7 @@ export ENABLE_DCONF=@ENABLE_DCONF@
 export ENABLE_DEBUG=@ENABLE_DEBUG@
 ENABLE_DOTNET=@ENABLE_DOTNET@
 SYSTEM_DRAGONBOX=@SYSTEM_DRAGONBOX@
+SYSTEM_FAST_FLOAT=@SYSTEM_FAST_FLOAT@
 SYSTEM_FROZEN=@SYSTEM_FROZEN@
 export ENABLE_EMSCRIPTEN_JSPI=@ENABLE_EMSCRIPTEN_JSPI@
 export 
ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS=@ENABLE_EMSCRIPTEN_PROXY_POSIX_SOCKETS@
diff --git a/configure.ac b/configure.ac
index abac3b68bb43..03febbf5cc67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2660,6 +2660,11 @@ AC_ARG_WITH(system-dragonbox,
         [Use dragonbox already on system.]),,
     [with_system_dragonbox="$with_system_headers"])
 
+AC_ARG_WITH(system-fast-float,
+    AS_HELP_STRING([--with-system-fast-float],
+        [Use fast_float already on system.]),,
+    [with_system_fast_float="$with_system_headers"])
+
 AC_ARG_WITH(system-frozen,
     AS_HELP_STRING([--with-system-frozen],
         [Use frozen already on system.]),,
@@ -6209,6 +6214,7 @@ if test "$cross_compiling" = "yes"; then
         DYNLOADING
         EPOXY
         EXPAT
+        FAST_FLOAT
         FROZEN
         GLM
         GRAPHITE
@@ -11213,6 +11219,29 @@ fi
 AC_SUBST([SYSTEM_DRAGONBOX])
 AC_SUBST([DRAGONBOX_CFLAGS])
 
+dnl ===================================================================
+dnl Check for system fast_float
+dnl ===================================================================
+AC_MSG_CHECKING([which fast_float to use])
+if test "$with_system_fast_float" = "yes"; then
+    AC_MSG_RESULT([external])
+    SYSTEM_FAST_FLOAT=TRUE
+    AC_LANG_PUSH([C++])
+    save_CPPFLAGS=$CPPFLAGS
+    FAST_FLOAT_CFLAGS=-I/usr/include
+    CPPFLAGS="$CPPFLAGS $FAST_FLOAT_CFLAGS"
+    AC_CHECK_HEADER([fast_float/fast_float.h], [],
+       [AC_MSG_ERROR([fast_float/fast_float.h not found. install 
fast_float])], [])
+    AC_LANG_POP([C++])
+    CPPFLAGS=$save_CPPFLAGS
+else
+    AC_MSG_RESULT([internal])
+    BUILD_TYPE="$BUILD_TYPE FAST_FLOAT"
+    SYSTEM_FAST_FLOAT=
+fi
+AC_SUBST([SYSTEM_FAST_FLOAT])
+AC_SUBST([FAST_FLOAT_CFLAGS])
+
 dnl ===================================================================
 dnl Check for system frozen
 dnl ===================================================================
diff --git a/download.lst b/download.lst
index 8c36f6e296e1..ee2469a47a53 100644
--- a/download.lst
+++ b/download.lst
@@ -60,8 +60,8 @@ DRAGONBOX_TARBALL := dragonbox-1.1.3.tar.gz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
-DTOA_SHA256SUM := 
0082d0684f7db6f62361b76c4b7faba19e0c7ce5cb8e36c4b65fea8281e711b4
-DTOA_TARBALL := dtoa-20180411.tgz
+FAST_FLOAT_SHA256SUM := 
4bfabb5979716995090ce68dce83f88f99629bc17ae280eae79311c5340143e1
+FAST_FLOAT_TARBALL := fast_float-8.1.0.tar.gz
 # three static lines
 # so that git cherry-pick
 # will not run into conflicts
diff --git a/external/Module_external.mk b/external/Module_external.mk
index decbe0bd9106..35d7e47ad551 100644
--- a/external/Module_external.mk
+++ b/external/Module_external.mk
@@ -32,7 +32,7 @@ $(eval $(call gb_Module_add_moduledirs,external,\
        $(call gb_Helper_optional,CPPUNIT,cppunit) \
        $(call gb_Helper_optional,CURL,curl) \
        $(call gb_Helper_optional,DRAGONBOX,dragonbox) \
-       dtoa \
+       $(call gb_Helper_optional,FAST_FLOAT,fast_float) \
        $(call gb_Helper_optional,EBOOK,libebook) \
        $(call gb_Helper_optional,EPM,epm) \
        $(call gb_Helper_optional,EPOXY,epoxy) \
diff --git a/external/dtoa/C6011.patch.0 b/external/dtoa/C6011.patch.0
deleted file mode 100644
index a5e55e34f179..000000000000
--- a/external/dtoa/C6011.patch.0
+++ /dev/null
@@ -1,10 +0,0 @@
---- src/dtoa.c 2024-05-01 10:10:49.702762020 +0100
-+++ src/dtoa.c 2024-05-01 10:11:45.308831303 +0100
-@@ -1606,6 +1606,7 @@
-               else
-                       rv = (Bigint*)MALLOC(len*sizeof(double));
- #endif
-+              assert(rv && "Don't handle OOM conditions");
-               rv->k = k;
-               rv->maxwds = x;
-               }
diff --git a/external/dtoa/README b/external/dtoa/README
deleted file mode 100644
index 9f46b9865d84..000000000000
--- a/external/dtoa/README
+++ /dev/null
@@ -1,10 +0,0 @@
-dtoa is available from [ https://www.netlib.org/fp/ ].
-
-Used to convert a decimal string to double (until std::from_chars is available 
on used compilers).
-Packaged using
-
-  mkdir dtoa && mkdir dtoa/src && wget https://www.netlib.org/fp/dtoa.c -O 
dtoa/src/dtoa.c && \
-   printf 'd8bab255476f39ea495c8c8ed164f9077da926e6ca7afb9ad3c56d337c4484fe 
dtoa/src/dtoa.c' | sha256sum -c && \
-   tar -c --owner=0 --group=0 --mode=go=r,u=rw --mtime='Wed, 11 Apr 2018 
15:59:39 GMT' dtoa/src/dtoa.c | gzip -n > dtoa-20180411.tgz && \
-   printf '0082d0684f7db6f62361b76c4b7faba19e0c7ce5cb8e36c4b65fea8281e711b4 
dtoa-20180411.tgz' | sha256sum -c
-(where the date "Wed, 11 Apr 2018 15:59:39 GMT" is from `wget -S 
https://www.netlib.org/fp/dtoa.c` "Last-Modified: Wed, 11 Apr 2018 15:59:39 
GMT" header).
diff --git a/external/dtoa/StaticLibrary_dtoa.mk 
b/external/dtoa/StaticLibrary_dtoa.mk
deleted file mode 100644
index b309da0a0378..000000000000
--- a/external/dtoa/StaticLibrary_dtoa.mk
+++ /dev/null
@@ -1,30 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_StaticLibrary_StaticLibrary,dtoa))
-
-$(eval $(call gb_StaticLibrary_use_unpacked,dtoa,dtoa))
-
-# A place that duplicates these settings is jurt/Library_jpipe.mk
-$(eval $(call gb_StaticLibrary_add_defs,dtoa,\
-    $(if $(filter little,$(ENDIANNESS)),-DIEEE_8087,-DIEEE_MC68k)\
-))
-
-$(eval $(call gb_StaticLibrary_set_warnings_disabled,dtoa))
-
-$(eval $(call gb_StaticLibrary_set_include,dtoa,\
-    -I$(gb_UnpackedTarball_workdir)/dtoa/src/\
-    $$(INCLUDE)\
-))
-
-$(eval $(call gb_StaticLibrary_add_exception_objects,dtoa,\
-    external/dtoa/source/dtoa \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/external/dtoa/UnpackedTarball_dtoa.mk 
b/external/dtoa/UnpackedTarball_dtoa.mk
deleted file mode 100644
index 28eb48c5776c..000000000000
--- a/external/dtoa/UnpackedTarball_dtoa.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-#-*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-$(eval $(call gb_UnpackedTarball_UnpackedTarball,dtoa))
-
-$(eval $(call gb_UnpackedTarball_set_tarball,dtoa,$(DTOA_TARBALL)))
-
-$(eval $(call gb_UnpackedTarball_set_patchlevel,dtoa,1))
-
-$(eval $(call gb_UnpackedTarball_add_patches,dtoa, \
-    external/dtoa/include_header.patch \
-    external/dtoa/coverity.patch \
-    external/dtoa/ubsan.patch.0 \
-    external/dtoa/C6011.patch.0 \
-    external/dtoa/const.patch \
-))
-
-# vim: set noet sw=4 ts=4:
diff --git a/external/dtoa/const.patch b/external/dtoa/const.patch
deleted file mode 100644
index 26de2a829ad6..000000000000
--- a/external/dtoa/const.patch
+++ /dev/null
@@ -1,56 +0,0 @@
---- dtoa/src/dtoa.c.const
-+++ dtoa/src/dtoa.c
-@@ -371,7 +371,7 @@
- #ifdef SET_INEXACT
- #define dtoa_divmax 27
- #else
--int dtoa_divmax = 2;  /* Permit experimenting: on some systems, 64-bit 
integer */
-+const int dtoa_divmax = 2;    /* Permit experimenting: on some systems, 
64-bit integer */
-                       /* division is slow enough that we may sometimes want 
to */
-                       /* avoid using it.   We assume (but do not check) that  
 */
-                       /* dtoa_divmax <= 27.*/
-@@ -382,7 +382,7 @@
-       int e;                  /* number represented = b * 2^e, with .5 <= b < 
1 */
-       } BF96;
- 
-- static BF96 pten[667] = {
-+ static const BF96 pten[667] = {
-       { 0xeef453d6, 0x923bd65a, 0x113faa29, -1136 },
-       { 0x9558b466, 0x1b6565f8, 0x4ac7ca59, -1132 },
-       { 0xbaaee17f, 0xa23ebf76, 0x5d79bcf0, -1129 },
-@@ -1262,7 +1262,7 @@
-         641,   642,   642,   642,   643,   643,   643,   644,   644,   644,
-         644,   645,   645,   645,   646,   646,   646,   647,   647,   647,
-         647,   648,   648,   648,   649,   649,   649,   650,   650 };
-- static ULLong pfive[27] = {
-+ static const ULLong pfive[27] = {
-               5ll,
-               25ll,
-               125ll,
-@@ -1928,7 +1928,7 @@
-       ThInfo *TI;
- #endif
-       int i;
--      static int p05[3] = { 5, 25, 125 };
-+      static const int p05[3] = { 5, 25, 125 };
- 
-       if ((i = k & 3))
-               b = multadd(b, p05[i-1], 0 MTa);
-@@ -2500,7 +2500,7 @@
-       htinit(hexdig, USC "ABCDEF", 0x10 + 10);
-       }
- #else
--static unsigned char hexdig[256] = {
-+static const unsigned char hexdig[256] = {
-       0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-       0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-       0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
-@@ -5013,7 +5013,7 @@
-       int inexact, oldinexact;
- #endif
- #ifdef USE_BF96 /*{{*/
--      BF96 *p10;
-+      const BF96 *p10;
-       ULLong dbhi, dbits, dblo, den, hb, rb, rblo, res, res0, res3, reslo, 
sres,
-               sulp, tv0, tv1, tv2, tv3, ulp, ulplo, ulpmask, ures, ureslo, zb;
-       int eulp, k1, n2, ulpadj, ulpshift;
diff --git a/external/dtoa/coverity.patch b/external/dtoa/coverity.patch
deleted file mode 100644
index 8fb1765315af..000000000000
--- a/external/dtoa/coverity.patch
+++ /dev/null
@@ -1,51 +0,0 @@
---- dtor/src/dtoa.c.coverity
-+++ dtor/src/dtoa.c
-@@ -216,14 +216,14 @@
- typedef unsigned Long ULong;
- #endif
- 
--#ifdef DEBUG
- #include <assert.h>
-+
-+#ifdef DEBUG
- #include "stdio.h"
- #define Bug(x) {fprintf(stderr, "%s
", x); exit(1);}
- #define Debug(x) x
- int dtoa_stats[7]; /* strtod_{64,96,bigcomp},dtoa_{exact,64,96,bigcomp} */
- #else
--#define assert(x) /*nothing*/
- #define Debug(x) /*nothing*/
- #endif
- 
-@@ -2301,6 +2301,7 @@
-       if ((y = d1)) {
-               if ((k = lo0bits(&y))) {
-                       x[0] = y | z << (32 - k);
-+                      assert(k < 32); /* https://bugs.python.org/issue23999 */
-                       z >>= k;
-                       }
-               else
-@@ -3029,6 +3030,7 @@
-                        || ((n = nbits & kmask) !=0
-                            && hi0bits(x[k-1]) < 32-n)) {
-                               rshift(b,1);
-+                              /* coverity[dead_error_line] - not worth 
investigating */
-                               if (++e > Emax)
-                                       goto ovfl;
-                               }
-@@ -3345,6 +3347,7 @@
-               if ((dd = s0[j++] - '0' - dig))
-                       goto ret;
-               if (!b->x[0] && b->wds == 1) {
-+                      /* coverity[copy_paste_error : FALSE] */
-                       if (i < nd)
-                               dd = 1;
-                       goto ret;
-@@ -3607,6 +3610,7 @@
-               switch(c = *++s) {
-                       case '-':
-                               esign = 1;
-+                              /* fall through */
-                       case '+':
-                               c = *++s;
-                       }
diff --git a/external/dtoa/include_header.patch 
b/external/dtoa/include_header.patch
deleted file mode 100644
index 7cf0a8a21471..000000000000
--- a/external/dtoa/include_header.patch
+++ /dev/null
@@ -1,100 +0,0 @@
---- /dev/null
-+++ dtoa/include/dtoa.h
-@@ -0,0 +1,1 @@
-+extern "C" double strtod_nolocale(const char *s00, char **se);
---- dtoa/src/dtoa.c.orig
-+++ dtoa/src/dtoa.c
-@@ -268,7 +268,7 @@ #ifndef PRIVATE_MEM
- #define PRIVATE_MEM 2304
- #endif
- #define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double))
--static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
-+static thread_local double private_mem[PRIVATE_mem], *pmem_next = private_mem;
- #endif
- 
- #undef IEEE_Arith
-@@ -1502,9 +1502,7 @@ static unsigned int maxthreads = 0;
- #define Kmax 7
- 
- #ifdef __cplusplus
--extern "C" double strtod(const char *s00, char **se);
--extern "C" char *dtoa(double d, int mode, int ndigits,
--                      int *decpt, int *sign, char **rve);
-+extern "C" double strtod_nolocale(const char *s00, char **se);
- #endif
- 
-  struct
-@@ -1521,7 +1519,7 @@ ThInfo {
-       Bigint *P5s;
-       } ThInfo;
- 
-- static ThInfo TI0;
-+ static thread_local ThInfo TI0;
- 
- #ifdef MULTIPLE_THREADS
-  static ThInfo *TI1;
-@@ -1529,7 +1527,7 @@ #ifdef MULTIPLE_THREADS
-  static ThInfo *TI1;
-  static int TI0_used;
- 
-- void
-+ static void
- set_max_dtoa_threads(unsigned int n)
- {
-       size_t L;
-@@ -2717,7 +2715,7 @@ enum {   /* rounding values: same as FLT_ROUNDS */
-       Round_down = 3
-       };
- 
-- void
-+ static void
- gethex( const char **sp, U *rvp, int rounding, int sign MTd)
- {
-       Bigint *b;
-@@ -3429,7 +3427,7 @@ retlow1:
- #endif /* NO_STRTOD_BIGCOMP */
- 
-  double
--strtod(const char *s00, char **se)
-+strtod_nolocale(const char *s00, char **se)
- {
-       int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
-       int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;
-@@ -4851,7 +4849,7 @@ strtod_nolocale(const char *s00, char **se)
-       }
- 
- #ifndef MULTIPLE_THREADS
-- static char *dtoa_result;
-+ static thread_local char *dtoa_result;
- #endif
- 
-  static char *
-@@ -4902,7 +4900,7 @@ nrv_alloc(const char *s, char *s0, size_t s0len, char 
**rve, int n MTd)
-  * when MULTIPLE_THREADS is not defined.
-  */
- 
-- void
-+ static void
- freedtoa(char *s)
- {
- #ifdef MULTIPLE_THREADS
-@@ -4951,7 +4949,7 @@ freedtoa(char *s)
-  *       calculation.
-  */
- 
-- char *
-+ static char *
- dtoa_r(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve, 
char *buf, size_t blen)
- {
-  /*   Arguments ndigits, decpt, sign are similar to those
-@@ -6184,8 +6182,8 @@ dtoa_r(double dd, int mode, int ndigits, int *decpt, int 
*sign, char **rve, char
-       return buf;
-       }
- 
-- char *
--dtoa(double dd, int mode, int ndigits, int *decpt, int *sign, char **rve)
-+ static char *
-+dtoa_nolocale(double dd, int mode, int ndigits, int *decpt, int *sign, char 
**rve)
- {
-       /*      Sufficient space is allocated to the return value
-               to hold the suppressed trailing zeros.
diff --git a/external/dtoa/source/dtoa.cxx b/external/dtoa/source/dtoa.cxx
deleted file mode 100644
index d3c8b8211bc8..000000000000
--- a/external/dtoa/source/dtoa.cxx
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; 
fill-column: 100 -*- */
-/*
- * This file is part of the LibreOffice project.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
- */
-
-#include <sal/config.h>
-
-// build this as C++ code, to allow e.g. thread_local keyword in MSVC
-#include <dtoa.c>
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s 
cinkeys+=0=break: */
diff --git a/external/dtoa/ubsan.patch.0 b/external/dtoa/ubsan.patch.0
deleted file mode 100644
index de39d41aca68..000000000000
--- a/external/dtoa/ubsan.patch.0
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/dtoa.c
-+++ src/dtoa.c
-@@ -3618,7 +3618,7 @@
-                       while(c == '0')
-                               c = *++s;
-                       if (c > '0' && c <= '9') {
--                              L = c - '0';
-+                              ULong L = c - '0';
-                               s1 = s;
-                               while((c = *++s) >= '0' && c <= '9')
-                                       L = 10*L + c - '0';
diff --git a/external/dtoa/Makefile b/external/fast_float/Module_fast_float.mk
similarity index 74%
rename from external/dtoa/Makefile
rename to external/fast_float/Module_fast_float.mk
index 6427d44e3790..5a67f51e7ef7 100644
--- a/external/dtoa/Makefile
+++ b/external/fast_float/Module_fast_float.mk
@@ -7,8 +7,10 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+$(eval $(call gb_Module_Module,fast_float))
 
-include $(module_directory)/../../solenv/gbuild/partial_build.mk
+$(eval $(call gb_Module_add_targets,fast_float,\
+    UnpackedTarball_fast_float \
+))
 
 # vim: set noet sw=4 ts=4:
diff --git a/external/fast_float/README b/external/fast_float/README
new file mode 100644
index 000000000000..aa321c165023
--- /dev/null
+++ b/external/fast_float/README
@@ -0,0 +1,3 @@
+fast_float is available from [ https://github.com/fastfloat/fast_float ].
+
+Provides fast header-only implementations for the C++ from_chars functions for 
float and double types.
diff --git a/external/dtoa/Module_dtoa.mk 
b/external/fast_float/UnpackedTarball_fast_float.mk
similarity index 55%
rename from external/dtoa/Module_dtoa.mk
rename to external/fast_float/UnpackedTarball_fast_float.mk
index c652f97e0b58..5c6c9af3209a 100644
--- a/external/dtoa/Module_dtoa.mk
+++ b/external/fast_float/UnpackedTarball_fast_float.mk
@@ -1,4 +1,4 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 
100 -*-
 #
 # This file is part of the LibreOffice project.
 #
@@ -7,11 +7,8 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_Module_Module,dtoa))
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,fast_float))
 
-$(eval $(call gb_Module_add_targets,dtoa,\
-    UnpackedTarball_dtoa \
-    StaticLibrary_dtoa \
-))
+$(eval $(call gb_UnpackedTarball_set_tarball,fast_float,$(FAST_FLOAT_TARBALL)))
 
 # vim: set noet sw=4 ts=4:
diff --git a/idl/Executable_svidl.mk b/idl/Executable_svidl.mk
index ffce1cdab285..05baac62ccf0 100644
--- a/idl/Executable_svidl.mk
+++ b/idl/Executable_svidl.mk
@@ -21,12 +21,6 @@ $(eval $(call gb_Executable_Executable,svidl))
 
 $(eval $(call gb_Executable_use_external,svidl,boost_headers))
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-$(eval $(call gb_Executable_use_externals,svidl,\
-    dtoa \
-))
-endif
-
 $(eval $(call gb_Executable_set_include,svidl,\
        $$(INCLUDE) \
        -I$(SRCDIR)/idl/inc \
diff --git a/jurt/Library_jpipe.mk b/jurt/Library_jpipe.mk
index 1048c61fda3f..13d716256961 100644
--- a/jurt/Library_jpipe.mk
+++ b/jurt/Library_jpipe.mk
@@ -46,11 +46,6 @@ $(eval $(call gb_Library_add_cobjects,jpipe, \
     jurt/source/pipe/com_sun_star_lib_connections_pipe_PipeConnection \
 ))
 
-# see external/dtoa/StaticLibrary_dtoa.mk
-$(eval $(call gb_Library_add_defs,jpipe,\
-    $(if $(filter little,$(ENDIANNESS)),-DIEEE_8087,-DIEEE_MC68k)\
-))
-
 $(eval $(call gb_Library_add_exception_objects,jpipe, \
     jurt/source/pipe/staticsalhack \
 ))
@@ -67,8 +62,6 @@ $(eval $(call gb_Library_set_include,jpipe, \
     -I$(SRCDIR)/sal/osl/unx \
     -I$(SRCDIR)/sal/rtl \
     -I$(SRCDIR)/sal/textenc \
-    -I$(gb_UnpackedTarball_workdir)/dtoa \
-    -I$(gb_UnpackedTarball_workdir)/dtoa/include \
 ))
 
 $(eval $(call gb_Library_use_externals,jpipe, \
@@ -82,7 +75,6 @@ $(eval $(call gb_Library_use_system_darwin_frameworks,jpipe, \
 ))
 endif
 
-$(call gb_Library_get_linktarget_target,jpipe): $(call 
gb_UnpackedTarball_get_target,dtoa)
 $(call gb_Library_get_linktarget_target,jpipe): gb_CC := $(filter-out 
-fsanitize%,$(gb_CC))
 $(call gb_Library_get_linktarget_target,jpipe): gb_CXX := $(filter-out 
-fsanitize%,$(gb_CXX))
 
diff --git a/jurt/source/pipe/staticsalhack.cxx 
b/jurt/source/pipe/staticsalhack.cxx
index fd03738f8d8d..eff99c283d88 100644
--- a/jurt/source/pipe/staticsalhack.cxx
+++ b/jurt/source/pipe/staticsalhack.cxx
@@ -90,9 +90,4 @@ extern "C" ImplTextEncodingData const* 
sal_getFullTextEncodingData(rtl_TextEncod
     std::abort();
 }
 
-#pragma clang diagnostic ignored "-Weverything"
-extern "C" {
-#include <src/dtoa.c> // workdir/UnpackedTarball/dtoa/src/dtoa.c
-}
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/readlicense_oo/license/license.xml 
b/readlicense_oo/license/license.xml
index 11e4cc5298fd..af1444fe1761 100644
--- a/readlicense_oo/license/license.xml
+++ b/readlicense_oo/license/license.xml
@@ -257,16 +257,6 @@
         the terms of the license below:</p>
         <p><a href="#a__CPL_version_1_0">Jump to Common Public License Version 
1.0 (CPL)</a></p>
     </div>
-    <h2>dtoa.c</h2>
-    <p>The following software may be included in this product: dtoa.c, which 
provides a function to convert a decimal
-    string to double. Use of any of this software is governed by the terms of 
the license below:</p>
-    <p>Copyright (c) 1991, 2000, 2001 by Lucent Technologies.</p>
-    <p>Permission to use, copy, modify, and distribute this software for any 
purpose without fee is hereby granted,
-    provided that this entire notice is included in all copies of any software 
which is or includes a copy or
-    modification of this software and in all copies of the supporting 
documentation for such software.</p>
-    <p>THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED 
WARRANTY. IN PARTICULAR, NEITHER THE
-    AUTHOR NOR LUCENT MAKES ANY REPRESENTATION OR WARRANTY OF ANY KIND 
CONCERNING THE MERCHANTABILITY OF THIS SOFTWARE
-    OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.</p>
     <div class="DRAGONBOX">
         <h2>Dragonbox</h2>
         <p>The following software may be included in this product: 
Dragonbox.</p>
@@ -290,6 +280,38 @@
             Software.</p>
         </blockquote>
     </div>
+    <div class="FAST_FLOAT">
+        <h2>fast_float</h2>
+        <p>The following software may be included in this product: 
fast_float.</p>
+        <p>fast_float code is covered by the MIT license:</p>
+        <blockquote>
+            <p>Copyright (c) 2021 The fast_float authors</p>
+
+            <p>Permission is hereby granted, free of charge, to any
+            person obtaining a copy of this software and associated
+            documentation files (the "Software"), to deal in the
+            Software without restriction, including without
+            limitation the rights to use, copy, modify, merge,
+            publish, distribute, sublicense, and/or sell copies of
+            the Software, and to permit persons to whom the Software
+            is furnished to do so, subject to the following
+            conditions:</p>
+
+            <p>The above copyright notice and this permission notice
+            shall be included in all copies or substantial portions
+            of the Software.</p>
+
+            <p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+            ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
+            TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
+            PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
+            SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+            CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+            IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+            DEALINGS IN THE SOFTWARE.</p>
+        </blockquote>
+    </div>
     <div class="EPOXY">
         <h2>Epoxy</h2>
         <p>The following software may be included in this product: epoxy.</p>
diff --git a/sal/CppunitTest_sal_osl_file_details.mk 
b/sal/CppunitTest_sal_osl_file_details.mk
index 921ec37cd4d1..d34586ce2288 100644
--- a/sal/CppunitTest_sal_osl_file_details.mk
+++ b/sal/CppunitTest_sal_osl_file_details.mk
@@ -34,7 +34,6 @@ $(eval $(call 
gb_CppunitTest_set_include,sal_osl_file_details, \
 ))
 
 $(eval $(call gb_CppunitTest_use_externals,sal_osl_file_details, \
-    dtoa \
     zlib \
 ))
 
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index 94e7fe10c5ca..92febf6227c8 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ -44,7 +44,7 @@ $(eval $(call gb_Library_use_libraries,sal,\
 
 $(eval $(call gb_Library_use_externals,sal,\
     dragonbox \
-    dtoa \
+    fast_float \
     valgrind \
     zlib \
 ))
diff --git a/sal/rtl/math.cxx b/sal/rtl/math.cxx
index 8106c28e7c44..d6f733278867 100644
--- a/sal/rtl/math.cxx
+++ b/sal/rtl/math.cxx
@@ -35,7 +35,7 @@
 
 #include "strtmpl.hxx"
 
-#include <dtoa.h>
+#include <fast_float/fast_float.h>
 
 constexpr int minExp = -323, maxExp = 308;
 constexpr double n10s[] = {
@@ -358,34 +358,24 @@ double stringToDouble(CharT const* pBegin, CharT const* 
pEnd, CharT cDecSeparato
         if (!bDone)
         {
             buf.insert('
-            char* pCharParseEnd;
-            errno = 0;
-            fVal = strtod_nolocale(buf.string, &pCharParseEnd);
-            if (errno == ERANGE)
+            const auto fmt(fast_float::chars_format::general | 
fast_float::chars_format::no_infnan);
+            auto result = fast_float::from_chars(buf.string, buf.string + 
buf.pos, fVal, fmt);
+            if (result.ec == std::errc::result_out_of_range)
             {
-                // This happens with overflow and underflow (including 
subnormals!)
-                if (std::isinf(fVal))
+                // Check for the dreaded rounded to 15 digits max value
+                // 1.79769313486232e+308 for 1.7976931348623157e+308 we wrote
+                // everywhere, accept with or without plus sign in exponent.
+                std::string_view num_view(buf.string, result.ptr - buf.string);
+                if (num_view == "1.79769313486232E308")
                 {
-                    // Check for the dreaded rounded to 15 digits max value
-                    // 1.79769313486232e+308 for 1.7976931348623157e+308 we 
wrote
-                    // everywhere, accept with or without plus sign in 
exponent.
-                    std::string_view num_view(buf.string, pCharParseEnd - 
buf.string);
-                    if (num_view == "1.79769313486232E308")
-                    {
-                        fVal = DBL_MAX;
-                    }
-                    else
-                    {
-                        eStatus = rtl_math_ConversionStatus_OutOfRange;
-                    }
+                    fVal = DBL_MAX;
                 }
-                else if (fVal == 0)
+                else
                 {
                     eStatus = rtl_math_ConversionStatus_OutOfRange;
                 }
-                // else it's subnormal: allow it
             }
-            p = buf.map[pCharParseEnd - buf.string];
+            p = buf.map[result.ptr - buf.string];
         }
     }
 
diff --git a/solenv/flatpak-manifest.in b/solenv/flatpak-manifest.in
index 08236356d7fa..bd92ba1e5c4f 100644
--- a/solenv/flatpak-manifest.in
+++ b/solenv/flatpak-manifest.in
@@ -810,11 +810,11 @@
                     "dest-filename": "@DRAGONBOX_TARBALL@"
                 },
                 {
-                    "url": 
"https://dev-www.libreoffice.org/src/@DTOA_TARBALL@";,
-                    "sha256": "@DTOA_SHA256SUM@",
+                    "url": 
"https://dev-www.libreoffice.org/src/@FAST_FLOAT_TARBALL@";,
+                    "sha256": "@FAST_FLOAT_SHA256SUM@",
                     "type": "file",
                     "dest": "external/tarballs",
-                    "dest-filename": "@DTOA_TARBALL@"
+                    "dest-filename": "@FAST_FLOAT_TARBALL@"
                 },
                 {
                     "url": 
"https://dev-www.libreoffice.org/src/@BOX2D_TARBALL@";,
diff --git a/svl/Library_svl.mk b/svl/Library_svl.mk
index afb64aca110d..fd48601e5182 100644
--- a/svl/Library_svl.mk
+++ b/svl/Library_svl.mk
@@ -23,7 +23,7 @@ $(eval $(call gb_Library_use_externals,svl,\
     boost_headers \
     $(if $(filter LINUX MACOSX ANDROID iOS %BSD SOLARIS HAIKU,$(OS)), \
         curl) \
-    dtoa \
+    fast_float \
     icu_headers \
     icui18n \
     icuuc \
diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx
index 2b91fa662845..8e18d86d3d98 100644
--- a/svl/source/numbers/zforfind.cxx
+++ b/svl/source/numbers/zforfind.cxx
@@ -18,7 +18,7 @@
  */
 
 #include <cstdlib>
-#include <dtoa.h>
+#include <fast_float/fast_float.h>
 #include <float.h>
 #include <comphelper/string.hxx>
 #include <o3tl/string_view.hxx>
@@ -174,9 +174,11 @@ double ImpSvNumberInputScan::StringToDouble( 
std::u16string_view aStr, bool bFor
         else
             break;
     }
-    *p = '
 
-    return strtod_nolocale(buf, nullptr);
+    double result = 0;
+    (void)fast_float::from_chars(
+        buf, p, result, fast_float::chars_format::general | 
fast_float::chars_format::no_infnan);
+    return result;
 }
 
 namespace {
diff --git a/unoidl/Executable_unoidl-check.mk 
b/unoidl/Executable_unoidl-check.mk
index cdf9f5aa28ff..36dfc44de635 100644
--- a/unoidl/Executable_unoidl-check.mk
+++ b/unoidl/Executable_unoidl-check.mk
@@ -21,10 +21,4 @@ $(eval $(call gb_Executable_use_libraries,unoidl-check, \
     sal \
 ))
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-$(eval $(call gb_Executable_use_externals,unoidl-check,\
-    dtoa \
-))
-endif
-
 # vim: set noet sw=4 ts=4:
diff --git a/unoidl/Executable_unoidl-write.mk 
b/unoidl/Executable_unoidl-write.mk
index e7ec3ba23c21..9accb31ac14d 100644
--- a/unoidl/Executable_unoidl-write.mk
+++ b/unoidl/Executable_unoidl-write.mk
@@ -21,10 +21,4 @@ $(eval $(call gb_Executable_use_libraries,unoidl-write, \
     sal \
 ))
 
-ifeq ($(DISABLE_DYNLOADING),TRUE)
-$(eval $(call gb_Executable_use_externals,unoidl-write,\
-    dtoa \
-))
-endif
-
 # vim: set noet sw=4 ts=4:
diff --git a/vcl/commonfuzzer.mk b/vcl/commonfuzzer.mk
index fe625a1bc88a..5302b572e450 100644
--- a/vcl/commonfuzzer.mk
+++ b/vcl/commonfuzzer.mk
@@ -17,7 +17,6 @@ fuzzer_externals = \
     boost_system \
     boost_iostreams \
     curl \
-    dtoa \
     harfbuzz \
     graphite \
     cairo \

Reply via email to