msvcrt: Use wcstod_l/strtod_l in other functions that parses doubles.

This commit is contained in:
Piotr Caban 2010-04-26 12:33:49 +02:00 committed by Alexandre Julliard
parent f7197663c9
commit 6974abe0e6
5 changed files with 43 additions and 84 deletions

View File

@ -289,7 +289,7 @@
@ cdecl _assert(str str long) msvcrt._assert
@ stub _atodbl
@ stub _atodbl_l
@ stub _atof_l
@ cdecl _atof_l(str ptr) msvcrt._atof_l
@ stub _atoflt
@ stub _atoflt_l
@ cdecl -ret64 _atoi64(str) msvcrt._atoi64
@ -1105,7 +1105,7 @@
@ cdecl _wcsrev(wstr) msvcrt._wcsrev
@ cdecl _wcsset(wstr long) msvcrt._wcsset
@ stub _wcsset_s
@ stub _wcstod_l
@ cdecl _wcstod_l(wstr ptr) msvcrt._wcstod_l
@ stub _wcstoi64
@ stub _wcstoi64_l
@ stub _wcstol_l
@ -1207,8 +1207,8 @@
@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam
@ stub _wtmpnam
@ stub _wtmpnam_s
@ stub _wtof
@ stub _wtof_l
@ cdecl _wtof(wstr) msvcrt._wtof
@ cdecl _wtof_l(wstr ptr) msvcrt._wtof_l
@ cdecl _wtoi(wstr) msvcrt._wtoi
@ cdecl _wtoi64(wstr) msvcrt._wtoi64
@ stub _wtoi64_l

View File

@ -281,7 +281,7 @@
@ cdecl _assert(str str long) msvcrt._assert
@ stub _atodbl
@ stub _atodbl_l
@ stub _atof_l
@ cdecl _atof_l(str ptr) msvcrt._atof_l
@ stub _atoflt
@ stub _atoflt_l
@ cdecl -ret64 _atoi64(str) msvcrt._atoi64
@ -1092,7 +1092,7 @@
@ cdecl _wcsrev(wstr) msvcrt._wcsrev
@ cdecl _wcsset(wstr long) msvcrt._wcsset
@ stub _wcsset_s
@ stub _wcstod_l
@ cdecl _wcstod_l(wstr ptr) msvcrt._wcstod_l
@ stub _wcstoi64
@ stub _wcstoi64_l
@ stub _wcstol_l
@ -1191,8 +1191,8 @@
@ cdecl _wtempnam(wstr wstr) msvcrt._wtempnam
@ stub _wtmpnam
@ stub _wtmpnam_s
@ stub _wtof
@ stub _wtof_l
@ cdecl _wtof(wstr) msvcrt._wtof
@ cdecl _wtof_l(wstr ptr) msvcrt._wtof_l
@ cdecl _wtoi(wstr) msvcrt._wtoi
@ cdecl _wtoi64(wstr) msvcrt._wtoi64
@ stub _wtoi64_l

View File

@ -264,7 +264,7 @@
@ cdecl _assert(str str long) MSVCRT__assert
@ stub _atodbl #(ptr str)
# stub _atodbl_l
# stub _atof_l
@ cdecl _atof_l(str ptr) MSVCRT__atof_l
# stub _atoflt_l
@ cdecl -ret64 _atoi64(str) ntdll._atoi64
# stub _atoi64_l
@ -1136,8 +1136,8 @@
# stub _wtempnam_dbg
@ stub _wtmpnam #(ptr)
# stub _wtmpnam_s
# stub _wtof
# stub _wtof_l
@ cdecl _wtof(wstr) MSVCRT__wtof
@ cdecl _wtof_l(wstr ptr) MSVCRT__wtof_l
@ cdecl _wtoi(wstr) ntdll._wtoi
@ cdecl _wtoi64(wstr) ntdll._wtoi64
# stub _wtoi64_l

View File

@ -131,14 +131,6 @@ void CDECL MSVCRT__swab(char* src, char* dst, int len)
}
}
/*********************************************************************
* atof (MSVCRT.@)
*/
double CDECL MSVCRT_atof( const char *str )
{
return atof( str );
}
/*********************************************************************
* strtod_l (MSVCRT.@)
*/
@ -252,6 +244,22 @@ double CDECL MSVCRT_strtod( const char *str, char **end )
return MSVCRT_strtod_l( str, end, NULL );
}
/*********************************************************************
* atof (MSVCRT.@)
*/
double CDECL MSVCRT_atof( const char *str )
{
return MSVCRT_strtod_l(str, NULL, NULL);
}
/*********************************************************************
* _atof_l (MSVCRT.@)
*/
double CDECL MSVCRT__atof_l( const char *str, MSVCRT__locale_t locale)
{
return MSVCRT_strtod_l(str, NULL, locale);
}
/*********************************************************************
* strcoll (MSVCRT.@)
*/

View File

@ -231,73 +231,24 @@ double CDECL MSVCRT__wcstod_l(const MSVCRT_wchar_t* str, MSVCRT_wchar_t** end,
*/
double CDECL MSVCRT_wcstod(const MSVCRT_wchar_t* lpszStr, MSVCRT_wchar_t** end)
{
const MSVCRT_wchar_t* str = lpszStr;
int negative = 0;
double ret = 0, divisor = 10.0;
TRACE("(%s,%p) semi-stub\n", debugstr_w(lpszStr), end);
/* FIXME:
* - Should set errno on failure
* - Should fail on overflow
* - Need to check which input formats are allowed
*/
while (isspaceW(*str))
str++;
if (*str == '-')
{
negative = 1;
str++;
}
while (isdigitW(*str))
{
ret = ret * 10.0 + (*str - '0');
str++;
}
if (*str == '.')
str++;
while (isdigitW(*str))
{
ret = ret + (*str - '0') / divisor;
divisor *= 10;
str++;
}
if (*str == 'E' || *str == 'e' || *str == 'D' || *str == 'd')
{
int negativeExponent = 0;
int exponent = 0;
if (*(++str) == '-')
{
negativeExponent = 1;
str++;
}
while (isdigitW(*str))
{
exponent = exponent * 10 + (*str - '0');
str++;
}
if (exponent != 0)
{
if (negativeExponent)
ret = ret / pow(10.0, exponent);
else
ret = ret * pow(10.0, exponent);
}
}
if (negative)
ret = -ret;
if (end)
*end = (MSVCRT_wchar_t*)str;
TRACE("returning %g\n", ret);
return ret;
return MSVCRT__wcstod_l(lpszStr, end, NULL);
}
/*********************************************************************
* _wtof (MSVCRT.@)
*/
double CDECL MSVCRT__wtof(const MSVCRT_wchar_t *str)
{
return MSVCRT__wcstod_l(str, NULL, NULL);
}
/*********************************************************************
* _wtof_l (MSVCRT.@)
*/
double CDECL MSVCRT__wtof_l(const MSVCRT_wchar_t *str, MSVCRT__locale_t locale)
{
return MSVCRT__wcstod_l(str, NULL, locale);
}
typedef struct pf_output_t
{