A first stab at wcstod().

This commit is contained in:
Jon Griffiths 2003-09-23 22:50:30 +00:00 committed by Alexandre Julliard
parent fc049ecdd5
commit d051a95b26
2 changed files with 47 additions and 1 deletions

View File

@ -753,7 +753,7 @@
@ cdecl wcsrchr(wstr long) ntdll.wcsrchr
@ cdecl wcsspn(wstr wstr) ntdll.wcsspn
@ cdecl wcsstr(wstr wstr) ntdll.wcsstr
@ stub wcstod #(wstr ptr)
@ cdecl wcstod(wstr ptr) MSVCRT_wcstod
@ cdecl wcstok(wstr wstr) ntdll.wcstok
@ cdecl wcstol(wstr ptr long) ntdll.wcstol
@ cdecl wcstombs(ptr ptr long) ntdll.wcstombs

View File

@ -111,6 +111,52 @@ MSVCRT_wchar_t* _wcsset( MSVCRT_wchar_t* str, MSVCRT_wchar_t c )
return ret;
}
/*********************************************************************
* wcstod (MSVCRT.@)
*/
double 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 (end)
*end = (MSVCRT_wchar_t*)str;
TRACE("returning %g\n", ret);
return ret;
}
/*********************************************************************
* _vsnwprintf (MSVCRT.@)
*/