Module: wine Branch: master Commit: 3b5ab1b48facb8f30032948e326ce9eb3521502d URL: http://source.winehq.org/git/wine.git/?a=commit;h=3b5ab1b48facb8f30032948e32...
Author: Piotr Caban piotr@codeweavers.com Date: Mon Dec 17 15:19:07 2012 +0100
msvcrt: Added _atodbl_l implementation.
---
dlls/msvcrt/msvcrt.h | 6 ++++++ dlls/msvcrt/msvcrt.spec | 4 ++-- dlls/msvcrt/string.c | 23 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index ea31b3c..bdd5933 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -986,6 +986,7 @@ int pf_printf_w(puts_clbk_w, void*, const MSVCRT_wchar_t*, MSVCRT__locale_t, printf_arg arg_clbk_valist(void*, int, int, __ms_va_list*) DECLSPEC_HIDDEN;
#define MSVCRT_FLT_MIN 1.175494351e-38F +#define MSVCRT_DBL_MIN 2.2250738585072014e-308 #define MSVCRT__OVERFLOW 3 #define MSVCRT__UNDERFLOW 4
@@ -994,4 +995,9 @@ typedef struct float f; } MSVCRT__CRT_FLOAT;
+typedef struct +{ + double x; +} MSVCRT__CRT_DOUBLE; + #endif /* __WINE_MSVCRT_H */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 274554b..79f6511 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -300,8 +300,8 @@ # stub _aligned_realloc_dbg(ptr long long str long) @ cdecl _amsg_exit(long) @ cdecl _assert(str str long) MSVCRT__assert -@ stub _atodbl(ptr str) -# stub _atodbl_l(ptr str ptr) +@ cdecl _atodbl(ptr str) MSVCRT__atodbl +@ cdecl _atodbl_l(ptr str ptr) MSVCRT__atodbl_l @ cdecl _atof_l(str ptr) MSVCRT__atof_l @ cdecl _atoflt_l(ptr str ptr) MSVCRT__atoflt_l @ cdecl -ret64 _atoi64(str) ntdll._atoi64 diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index 90518bc..f166865 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -455,6 +455,29 @@ int CDECL MSVCRT__atoflt_l( MSVCRT__CRT_FLOAT *value, char *str, MSVCRT__locale_ }
/********************************************************************* + * _atodbl_l (MSVCRT.@) + */ +int CDECL MSVCRT__atodbl_l(MSVCRT__CRT_DOUBLE *value, char *str, MSVCRT__locale_t locale) +{ + int err; + + value->x = strtod_helper(str, NULL, locale, &err); + if(isinf(value->x)) + return MSVCRT__OVERFLOW; + if((value->x!=0 || err) && value->x>-MSVCRT_DBL_MIN && value->x<MSVCRT_DBL_MIN) + return MSVCRT__UNDERFLOW; + return 0; +} + +/********************************************************************* + * _atodbl (MSVCRT.@) + */ +int CDECL MSVCRT__atodbl(MSVCRT__CRT_DOUBLE *value, char *str) +{ + return MSVCRT__atodbl_l(value, str, NULL); +} + +/********************************************************************* * _strcoll_l (MSVCRT.@) */ int CDECL MSVCRT_strcoll_l( const char* str1, const char* str2, MSVCRT__locale_t locale )