From 83e1917b77fc45e82c5a4d41e60a5b715070dc81 Mon Sep 17 00:00:00 2001 From: Amine Khaldi Date: Mon, 12 May 2014 12:52:40 +0000 Subject: [PATCH] [CRT] * Reduce difference to Wine. No code changes. CORE-8080 svn path=/trunk/; revision=63252 --- reactos/lib/sdk/crt/stdlib/errno.c | 71 +++++++++++++++--------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/reactos/lib/sdk/crt/stdlib/errno.c b/reactos/lib/sdk/crt/stdlib/errno.c index a56c0dd6d4e..7841d1949ca 100644 --- a/reactos/lib/sdk/crt/stdlib/errno.c +++ b/reactos/lib/sdk/crt/stdlib/errno.c @@ -13,45 +13,24 @@ static _invalid_parameter_handler invalid_parameter_handler = NULL; -/* - * @implemented - */ -unsigned long* CDECL __doserrno(void) -{ - return &(msvcrt_get_thread_data()->thread_doserrno); -} - -/* - * @implemented +/********************************************************************* + * _errno (MSVCRT.@) */ int CDECL *_errno(void) { return &(msvcrt_get_thread_data()->thread_errno); } -/* - * @implemented +/********************************************************************* + * __doserrno (MSVCRT.@) */ -errno_t CDECL _get_doserrno(unsigned long *pValue) +unsigned long* CDECL __doserrno(void) { - if (!pValue) - return EINVAL; - - *pValue = *__doserrno(); - return 0; + return &(msvcrt_get_thread_data()->thread_doserrno); } -/* - * @implemented - */ -errno_t CDECL _set_doserrno(unsigned long error) -{ - *__doserrno() = error; - return 0; -} - -/* - * @implemented +/********************************************************************* + * _get_errno (MSVCRT.@) */ errno_t CDECL _get_errno(int *pValue) { @@ -62,8 +41,20 @@ errno_t CDECL _get_errno(int *pValue) return 0; } -/* - * @implemented +/********************************************************************* + * _get_doserrno (MSVCRT.@) + */ +errno_t CDECL _get_doserrno(unsigned long *pValue) +{ + if (!pValue) + return EINVAL; + + *pValue = *__doserrno(); + return 0; +} + +/********************************************************************* + * _set_errno (MSVCRT.@) */ int CDECL _set_errno(int error) { @@ -71,6 +62,15 @@ int CDECL _set_errno(int error) return 0; } +/********************************************************************* + * _set_doserrno (MSVCRT.@) + */ +errno_t CDECL _set_doserrno(unsigned long error) +{ + *__doserrno() = error; + return 0; +} + /* * This function sets both doserrno to the passed in OS error code * and also maps this to an appropriate errno code. The mapping @@ -124,8 +124,8 @@ int CDECL _set_error_mode(int mode) } /****************************************************************************** -* _seterrormode (MSVCRT.@) -*/ + * _seterrormode (MSVCRT.@) + */ void CDECL _seterrormode(int mode) { SetErrorMode( mode ); @@ -134,8 +134,8 @@ void CDECL _seterrormode(int mode) /****************************************************************************** * _invalid_parameter (MSVCRT.@) */ -void CDECL _invalid_parameter(const wchar_t *expr, const wchar_t *func, - const wchar_t *file, unsigned int line, uintptr_t arg) +void __cdecl _invalid_parameter(const wchar_t *expr, const wchar_t *func, + const wchar_t *file, unsigned int line, uintptr_t arg) { if (invalid_parameter_handler) invalid_parameter_handler( expr, func, file, line, arg ); else @@ -163,4 +163,3 @@ _invalid_parameter_handler CDECL _set_invalid_parameter_handler( invalid_parameter_handler = handler; return old; } -/* EOF */