crt/stdlib: Add missing _wcstof_l function and redirections

Signed-off-by: LIU Hao <lh_mouse@126.com>
This commit is contained in:
L. E. Segovia via Mingw-w64-public 2022-11-03 00:24:58 +00:00 committed by LIU Hao
parent c8bc1ba94c
commit 800f69b136
4 changed files with 31 additions and 0 deletions

View File

@ -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 \

View File

@ -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;
}

View File

@ -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);

View File

@ -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