From: Piotr Caban Subject: msvcrt: Added vscwprintf_{l,p_l} functions implementation Message-Id: <4E36B346.9090705@codeweavers.com> Date: Mon, 01 Aug 2011 16:08:06 +0200 --- dlls/msvcr100/msvcr100.spec | 4 +- dlls/msvcr80/msvcr80.spec | 4 +- dlls/msvcr90/msvcr90.spec | 4 +- dlls/msvcrt/msvcrt.spec | 4 +- dlls/msvcrt/wcs.c | 74 ++++++++++++++++++++++++++----------------- 5 files changed, 53 insertions(+), 37 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 1a2fa4b..e25af8f 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1246,9 +1246,9 @@ @ stub _vscprintf_p @ stub _vscprintf_p_l @ cdecl _vscwprintf(wstr ptr) msvcrt._vscwprintf -@ stub _vscwprintf_l +@ cdecl _vscwprintf_l(wstr ptr ptr) msvcrt._vscwprintf_l @ stub _vscwprintf_p -@ stub _vscwprintf_p_l +@ cdecl _vscwprintf_p_l(wstr ptr ptr) msvcrt._vscwprintf_p_l @ cdecl _vsnprintf(ptr long str ptr) msvcrt._vsnprintf @ cdecl _vsnprintf_c(ptr long str ptr) msvcrt._vsnprintf_c @ cdecl _vsnprintf_c_l(ptr long str ptr ptr) msvcrt._vsnprintf_c_l diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 1e14bfc..6eddfd7 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1099,9 +1099,9 @@ @ stub _vscprintf_p @ stub _vscprintf_p_l @ cdecl _vscwprintf(wstr ptr) msvcrt._vscwprintf -@ stub _vscwprintf_l +@ cdecl _vscwprintf_l(wstr ptr ptr) msvcrt._vscwprintf_l @ stub _vscwprintf_p -@ stub _vscwprintf_p_l +@ cdecl _vscwprintf_p_l(wstr ptr ptr) msvcrt._vscwprintf_p_l @ cdecl _vsnprintf(ptr long str ptr) msvcrt._vsnprintf @ cdecl _vsnprintf_c(ptr long str ptr) msvcrt._vsnprintf_c @ cdecl _vsnprintf_c_l(ptr long str ptr ptr) msvcrt._vsnprintf_c_l diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 02cb845..74d5cdc 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1086,9 +1086,9 @@ @ stub _vscprintf_p @ stub _vscprintf_p_l @ cdecl _vscwprintf(wstr ptr) msvcrt._vscwprintf -@ stub _vscwprintf_l +@ cdecl _vscwprintf_l(wstr ptr ptr) msvcrt._vscwprintf_l @ stub _vscwprintf_p -@ stub _vscwprintf_p_l +@ cdecl _vscwprintf_p_l(wstr ptr ptr) msvcrt._vscwprintf_p_l @ cdecl _vsnprintf(ptr long str ptr) msvcrt._vsnprintf @ cdecl _vsnprintf_c(ptr long str ptr) msvcrt._vsnprintf_c @ cdecl _vsnprintf_c_l(ptr long str ptr ptr) msvcrt._vsnprintf_c_l diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 289ea46..2186904 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1031,8 +1031,8 @@ # stub _vscprintf_l(str ptr ptr) # stub _vscprintf_p_l(str ptr ptr) @ cdecl _vscwprintf(wstr ptr) MSVCRT__vscwprintf -# stub _vscwprintf_l(wstr ptr ptr) -# stub _vscwprintf_p_l(wstr ptr ptr) +@ cdecl _vscwprintf_l(wstr ptr ptr) MSVCRT__vscwprintf_l +@ cdecl _vscwprintf_p_l(wstr ptr ptr) MSVCRT__vscwprintf_p_l @ cdecl _vsnprintf(ptr long str ptr) MSVCRT_vsnprintf @ cdecl _vsnprintf_c(ptr long str ptr) MSVCRT_vsnprintf @ cdecl _vsnprintf_c_l(ptr long str ptr ptr) MSVCRT_vsnprintf_l diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index dbcee85..d771d4f 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -691,6 +691,35 @@ int CDECL MSVCRT_vsnwprintf_l(MSVCRT_wchar_t *str, MSVCRT_size_t len, } /********************************************************************* + * _vswprintf_p_l (MSVCRT.@) + */ +int CDECL MSVCRT_vswprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length, + const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, __ms_va_list args) +{ + static const MSVCRT_wchar_t nullbyte = '\0'; + printf_arg args_ctx[MSVCRT__ARGMAX+1]; + struct _str_ctx_w puts_ctx = {length, buffer}; + int ret; + + memset(args_ctx, 0, sizeof(args_ctx)); + + ret = create_positional_ctx_w(args_ctx, format, args); + if(ret < 0) { + MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); + *MSVCRT__errno() = MSVCRT_EINVAL; + return ret; + } else if(ret == 0) + ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale, TRUE, TRUE, + arg_clbk_valist, NULL, &args); + else + ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale, TRUE, TRUE, + arg_clbk_positional, args_ctx, NULL); + + puts_clbk_str_w(&puts_ctx, 1, &nullbyte); + return ret; +} + +/********************************************************************* * _vsnwprintf_s_l (MSVCRT.@) */ int CDECL MSVCRT_vsnwprintf_s_l( MSVCRT_wchar_t *str, MSVCRT_size_t sizeOfBuffer, @@ -860,6 +889,22 @@ int CDECL MSVCRT__vscwprintf( const MSVCRT_wchar_t *format, __ms_va_list args ) } /********************************************************************* + * _vscwprintf_l (MSVCRT.@) + */ +int CDECL MSVCRT__vscwprintf_l( const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, __ms_va_list args ) +{ + return MSVCRT_vsnwprintf_l( NULL, INT_MAX, format, locale, args ); +} + +/********************************************************************* + * _vscwprintf_p_l (MSVCRT.@) + */ +int CDECL MSVCRT__vscwprintf_p_l( const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, __ms_va_list args ) +{ + return MSVCRT_vswprintf_p_l( NULL, INT_MAX, format, locale, args ); +} + +/********************************************************************* * vswprintf_s (MSVCRT.@) */ int CDECL MSVCRT_vswprintf_s(MSVCRT_wchar_t* str, MSVCRT_size_t numberOfElements, @@ -933,35 +978,6 @@ int CDECL MSVCRT_sprintf_p_l(char *buffer, MSVCRT_size_t length, } /********************************************************************* - * _vswprintf_p_l (MSVCRT.@) - */ -int CDECL MSVCRT_vswprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length, - const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, __ms_va_list args) -{ - static const MSVCRT_wchar_t nullbyte = '\0'; - printf_arg args_ctx[MSVCRT__ARGMAX+1]; - struct _str_ctx_w puts_ctx = {length, buffer}; - int ret; - - memset(args_ctx, 0, sizeof(args_ctx)); - - ret = create_positional_ctx_w(args_ctx, format, args); - if(ret < 0) { - MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0); - *MSVCRT__errno() = MSVCRT_EINVAL; - return ret; - } else if(ret == 0) - ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale, TRUE, TRUE, - arg_clbk_valist, NULL, &args); - else - ret = pf_printf_w(puts_clbk_str_w, &puts_ctx, format, locale, TRUE, TRUE, - arg_clbk_positional, args_ctx, NULL); - - puts_clbk_str_w(&puts_ctx, 1, &nullbyte); - return ret; -} - -/********************************************************************* * _swprintf_p_l (MSVCRT.@) */ int CDECL MSVCRT_swprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length,