msvcrt: Add vf[w]printf_p & vf[w]printf_p_l.

Signed-off-by: Gijs Vermeulen <gijsvrm@gmail.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Gijs Vermeulen 2017-10-13 20:23:29 +02:00 committed by Alexandre Julliard
parent e3a29a6c1d
commit 7f9c2dabc3
11 changed files with 99 additions and 32 deletions

View File

@ -1434,12 +1434,12 @@
@ stub _vcwprintf_s
@ stub _vcwprintf_s_l
@ cdecl _vfprintf_l(ptr str ptr ptr) MSVCRT__vfprintf_l
@ stub _vfprintf_p
@ stub _vfprintf_p_l
@ cdecl _vfprintf_p(ptr str ptr) MSVCRT__vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) MSVCRT__vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) MSVCRT__vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_l
@ stub _vfwprintf_p
@ stub _vfwprintf_p_l
@ cdecl _vfwprintf_p(ptr wstr ptr) MSVCRT__vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_s_l
@ stub _vprintf_l
@ stub _vprintf_p

View File

@ -1791,12 +1791,12 @@
@ stub _vcwprintf_s
@ stub _vcwprintf_s_l
@ cdecl _vfprintf_l(ptr str ptr ptr) MSVCRT__vfprintf_l
@ stub _vfprintf_p
@ stub _vfprintf_p_l
@ cdecl _vfprintf_p(ptr str ptr) MSVCRT__vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) MSVCRT__vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) MSVCRT__vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_l
@ stub _vfwprintf_p
@ stub _vfwprintf_p_l
@ cdecl _vfwprintf_p(ptr wstr ptr) MSVCRT__vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_s_l
@ stub _vprintf_l
@ stub _vprintf_p

View File

@ -1809,12 +1809,12 @@
@ stub _vcwprintf_s
@ stub _vcwprintf_s_l
@ cdecl _vfprintf_l(ptr str ptr ptr) MSVCRT__vfprintf_l
@ stub _vfprintf_p
@ stub _vfprintf_p_l
@ cdecl _vfprintf_p(ptr str ptr) MSVCRT__vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) MSVCRT__vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) MSVCRT__vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_l
@ stub _vfwprintf_p
@ stub _vfwprintf_p_l
@ cdecl _vfwprintf_p(ptr wstr ptr) MSVCRT__vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_s_l
@ stub _vprintf_l
@ stub _vprintf_p

View File

@ -1503,12 +1503,12 @@
@ cdecl _utime64(str ptr) msvcr120._utime64
@ cdecl _vacopy(ptr ptr) msvcr120._vacopy
@ cdecl _vfprintf_l(ptr str ptr ptr) msvcr120._vfprintf_l
@ stub _vfprintf_p
@ stub _vfprintf_p_l
@ cdecl _vfprintf_p(ptr str ptr) msvcr120._vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) msvcr120._vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) msvcr120._vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) msvcr120._vfwprintf_l
@ stub _vfwprintf_p
@ stub _vfwprintf_p_l
@ cdecl _vfwprintf_p(ptr wstr ptr) msvcr120._vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) msvcr120._vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) msvcr120._vfwprintf_s_l
@ stub _vprintf_l
@ stub _vprintf_p

View File

@ -1113,12 +1113,12 @@
@ stub _vcwprintf_s
@ stub _vcwprintf_s_l
@ cdecl _vfprintf_l(ptr str ptr ptr) MSVCRT__vfprintf_l
@ stub _vfprintf_p
@ stub _vfprintf_p_l
@ cdecl _vfprintf_p(ptr str ptr) MSVCRT__vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) MSVCRT__vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) MSVCRT__vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_l
@ stub _vfwprintf_p
@ stub _vfwprintf_p_l
@ cdecl _vfwprintf_p(ptr wstr ptr) MSVCRT__vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_s_l
@ stub _vprintf_l
@ stub _vprintf_p

View File

@ -1089,12 +1089,12 @@
@ stub _vcwprintf_s
@ stub _vcwprintf_s_l
@ cdecl _vfprintf_l(ptr str ptr ptr) MSVCRT__vfprintf_l
@ stub _vfprintf_p
@ stub _vfprintf_p_l
@ cdecl _vfprintf_p(ptr str ptr) MSVCRT__vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) MSVCRT__vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) MSVCRT__vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_l
@ stub _vfwprintf_p
@ stub _vfwprintf_p_l
@ cdecl _vfwprintf_p(ptr wstr ptr) MSVCRT__vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_s_l
@ stub _vprintf_l
@ stub _vprintf_p

View File

@ -5051,15 +5051,29 @@ static int puts_clbk_file_w(void *file, int len, const MSVCRT_wchar_t *str)
static int vfprintf_helper(DWORD options, MSVCRT_FILE* file, const char *format,
MSVCRT__locale_t locale, __ms_va_list valist)
{
printf_arg args_ctx[MSVCRT__ARGMAX+1];
BOOL tmp_buf;
int ret;
if(!MSVCRT_CHECK_PMT( file != NULL )) return -1;
if(!MSVCRT_CHECK_PMT( format != NULL )) return -1;
if(options & MSVCRT_PRINTF_POSITIONAL_PARAMS) {
memset(args_ctx, 0, sizeof(args_ctx));
ret = create_positional_ctx_a(args_ctx, format, valist);
if(ret < 0) {
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
*MSVCRT__errno() = MSVCRT_EINVAL;
return ret;
} else if(!ret)
options &= ~MSVCRT_PRINTF_POSITIONAL_PARAMS;
}
MSVCRT__lock_file(file);
tmp_buf = add_std_buffer(file);
ret = pf_printf_a(puts_clbk_file_a, file, format, locale, options, arg_clbk_valist, NULL, &valist);
ret = pf_printf_a(puts_clbk_file_a, file, format, locale, options,
options & MSVCRT_PRINTF_POSITIONAL_PARAMS ? arg_clbk_positional : arg_clbk_valist,
options & MSVCRT_PRINTF_POSITIONAL_PARAMS ? args_ctx : NULL, &valist);
if(tmp_buf) remove_std_buffer(file);
MSVCRT__unlock_file(file);
@ -5069,15 +5083,29 @@ static int vfprintf_helper(DWORD options, MSVCRT_FILE* file, const char *format,
static int vfwprintf_helper(DWORD options, MSVCRT_FILE* file, const MSVCRT_wchar_t *format,
MSVCRT__locale_t locale, __ms_va_list valist)
{
printf_arg args_ctx[MSVCRT__ARGMAX+1];
BOOL tmp_buf;
int ret;
if(!MSVCRT_CHECK_PMT( file != NULL )) return -1;
if(!MSVCRT_CHECK_PMT( format != NULL )) return -1;
if(options & MSVCRT_PRINTF_POSITIONAL_PARAMS) {
memset(args_ctx, 0, sizeof(args_ctx));
ret = create_positional_ctx_w(args_ctx, format, valist);
if(ret < 0) {
MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
*MSVCRT__errno() = MSVCRT_EINVAL;
return ret;
} else if(!ret)
options &= ~MSVCRT_PRINTF_POSITIONAL_PARAMS;
}
MSVCRT__lock_file(file);
tmp_buf = add_std_buffer(file);
ret = pf_printf_w(puts_clbk_file_w, file, format, locale, options, arg_clbk_valist, NULL, &valist);
ret = pf_printf_w(puts_clbk_file_w, file, format, locale, options,
options & MSVCRT_PRINTF_POSITIONAL_PARAMS ? arg_clbk_positional : arg_clbk_valist,
options & MSVCRT_PRINTF_POSITIONAL_PARAMS ? args_ctx : NULL, &valist);
if(tmp_buf) remove_std_buffer(file);
MSVCRT__unlock_file(file);
@ -5202,6 +5230,42 @@ int CDECL MSVCRT__vfwprintf_l(MSVCRT_FILE* file, const MSVCRT_wchar_t *format,
return vfwprintf_helper(0, file, format, locale, valist);
}
/*********************************************************************
* _vfprintf_p_l (MSVCRT.@)
*/
int CDECL MSVCRT__vfprintf_p_l(MSVCRT_FILE* file, const char *format,
MSVCRT__locale_t locale, __ms_va_list valist)
{
return vfprintf_helper(MSVCRT_PRINTF_POSITIONAL_PARAMS | MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER,
file, format, locale, valist);
}
/*********************************************************************
* _vfprintf_p (MSVCRT.@)
*/
int CDECL MSVCRT__vfprintf_p(MSVCRT_FILE* file, const char *format, __ms_va_list valist)
{
return MSVCRT__vfprintf_p_l(file, format, NULL, valist);
}
/*********************************************************************
* _vfwprintf_p_l (MSVCRT.@)
*/
int CDECL MSVCRT__vfwprintf_p_l(MSVCRT_FILE* file, const MSVCRT_wchar_t *format,
MSVCRT__locale_t locale, __ms_va_list valist)
{
return vfwprintf_helper(MSVCRT_PRINTF_POSITIONAL_PARAMS | MSVCRT_PRINTF_INVOKE_INVALID_PARAM_HANDLER,
file, format, locale, valist);
}
/*********************************************************************
* _vfwprintf_p (MSVCRT.@)
*/
int CDECL MSVCRT__vfwprintf_p(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, __ms_va_list valist)
{
return MSVCRT__vfwprintf_p_l(file, format, NULL, valist);
}
/*********************************************************************
* vprintf (MSVCRT.@)
*/

View File

@ -1167,7 +1167,10 @@ int pf_printf_a(puts_clbk_a, void*, const char*, MSVCRT__locale_t,
DWORD, args_clbk, void*, __ms_va_list*) DECLSPEC_HIDDEN;
int pf_printf_w(puts_clbk_w, void*, const MSVCRT_wchar_t*, MSVCRT__locale_t,
DWORD, args_clbk, void*, __ms_va_list*) DECLSPEC_HIDDEN;
int create_positional_ctx_a(void*, const char*, __ms_va_list) DECLSPEC_HIDDEN;
int create_positional_ctx_w(void*, const MSVCRT_wchar_t*, __ms_va_list) DECLSPEC_HIDDEN;
printf_arg arg_clbk_valist(void*, int, int, __ms_va_list*) DECLSPEC_HIDDEN;
printf_arg arg_clbk_positional(void*, int, int, __ms_va_list*) DECLSPEC_HIDDEN;
#define MSVCRT_FLT_MIN 1.175494351e-38F
#define MSVCRT_DBL_MIN 2.2250738585072014e-308

View File

@ -1045,12 +1045,12 @@
# stub _vcwprintf_s(wstr ptr)
# stub _vcwprintf_s_l(wstr ptr ptr)
@ cdecl _vfprintf_l(ptr str ptr ptr) MSVCRT__vfprintf_l
# stub _vfprintf_p(ptr str ptr)
# stub _vfprintf_p_l(ptr str ptr ptr)
@ cdecl _vfprintf_p(ptr str ptr) MSVCRT__vfprintf_p
@ cdecl _vfprintf_p_l(ptr str ptr ptr) MSVCRT__vfprintf_p_l
@ cdecl _vfprintf_s_l(ptr str ptr ptr) MSVCRT__vfprintf_s_l
@ cdecl _vfwprintf_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_l
# stub _vfwprintf_p(ptr wstr ptr)
# stub _vfwprintf_p_l(ptr wstr ptr ptr)
@ cdecl _vfwprintf_p(ptr wstr ptr) MSVCRT__vfwprintf_p
@ cdecl _vfwprintf_p_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_p_l
@ cdecl _vfwprintf_s_l(ptr wstr ptr ptr) MSVCRT__vfwprintf_s_l
# stub _vprintf_l(str ptr ptr)
# stub _vprintf_p(str ptr)

View File

@ -742,7 +742,7 @@ static printf_arg arg_clbk_type(void *ctx, int pos, int type, __ms_va_list *vali
}
#endif
static int FUNC_NAME(create_positional_ctx)(void *args_ctx, const APICHAR *format, __ms_va_list valist)
int FUNC_NAME(create_positional_ctx)(void *args_ctx, const APICHAR *format, __ms_va_list valist)
{
struct FUNC_NAME(_str_ctx) puts_ctx = {INT_MAX, NULL};
printf_arg *args = args_ctx;

View File

@ -706,7 +706,7 @@ printf_arg arg_clbk_valist(void *ctx, int arg_pos, int type, __ms_va_list *valis
/*********************************************************************
* arg_clbk_positional (INTERNAL)
*/
static printf_arg arg_clbk_positional(void *ctx, int pos, int type, __ms_va_list *valist)
printf_arg arg_clbk_positional(void *ctx, int pos, int type, __ms_va_list *valist)
{
printf_arg *args = ctx;
return args[pos];