---
mingw-w64-crt/Makefile.am | 1 +
mingw-w64-crt/stdio/_wcstof_l.c | 28 ++++++++++++++++++++++++++++
mingw-w64-headers/crt/stdlib.h | 1 +
mingw-w64-headers/crt/tchar.h | 1 +
4 files changed, 31 insertions(+)
create mode 100644 mingw-w64-crt/stdio/_wcstof_l.c
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index dd5a9eb1..d3896946 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -182,6 +182,7 @@ src_msvcrt_common=\
stdio/_putc_nolock.c \
stdio/_putwc_nolock.c \
stdio/_strtof_l.c \
+ stdio/_wcstof_l.c \
stdio/acrt_iob_func.c \
stdio/strtof.c \
stdio/snprintf_alias.c \
diff --git a/mingw-w64-crt/stdio/_wcstof_l.c b/mingw-w64-crt/stdio/_wcstof_l.c
new file mode 100644
index 00000000..af511094
--- /dev/null
+++ b/mingw-w64-crt/stdio/_wcstof_l.c
@@ -0,0 +1,28 @@
+/**
+ * This file has no copyright assigned and is placed in the Public Domain.
+ * This file is part of the mingw-w64 runtime package.
+ * No warranty is given; refer to the file DISCLAIMER.PD within this package.
+ */
+#include <stdlib.h>
+#include <float.h>
+#include <errno.h>
+#include <math.h>
+#include <locale.h>
+
+float _wcstof_l( const wchar_t *nptr, wchar_t **endptr, _locale_t _Locale)
+{
+ const double ret = _wcstod_l(nptr, endptr, _Locale);
+ if (isfinite(ret)) {
+ /* Check for cases that aren't out of range for doubles, but that are
+ * for floats. */
+ if (ret > FLT_MAX)
+ errno = ERANGE;
+ else if (ret < -FLT_MAX)
+ errno = ERANGE;
+ else if (ret > 0 && ret < FLT_MIN)
+ errno = ERANGE;
+ else if (ret < 0 && ret > -FLT_MIN)
+ errno = ERANGE;
+ }
+ return ret;
+}
diff --git a/mingw-w64-headers/crt/stdlib.h b/mingw-w64-headers/crt/stdlib.h
index 59b51e80..1d864bbb 100644
--- a/mingw-w64-headers/crt/stdlib.h
+++ b/mingw-w64-headers/crt/stdlib.h
@@ -578,6 +578,7 @@ float __cdecl __MINGW_NOTHROW strtof(const char *
__restrict__ _Str,char ** __re
long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t **
__restrict__);
#endif /* __NO_ISOCEXT */
_CRTIMP double __cdecl _wcstod_l(const wchar_t * __restrict__ _Str,wchar_t
** __restrict__ _EndPtr,_locale_t _Locale);
+ _CRTIMP float __cdecl _wcstof_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,_locale_t _Locale);
long __cdecl wcstol(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
_CRTIMP long __cdecl _wcstol_l(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix,_locale_t _Locale);
unsigned long __cdecl wcstoul(const wchar_t * __restrict__ _Str,wchar_t **
__restrict__ _EndPtr,int _Radix);
diff --git a/mingw-w64-headers/crt/tchar.h b/mingw-w64-headers/crt/tchar.h
index 8468f9d6..5ae9479c 100644
--- a/mingw-w64-headers/crt/tchar.h
+++ b/mingw-w64-headers/crt/tchar.h
@@ -219,6 +219,7 @@ extern "C" {
#define _tstol _wtol
#define _tstoi _wtoi
#define _tstoi64 _wtoi64
+#define _tcstof_l _wcstof_l
#define _tcstod_l _wcstod_l
#define _tcstol_l _wcstol_l
#define _tcstoul_l _wcstoul_l
--
2.38.1
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public