Commit 64cf2080 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Don't pass NULL as __ms_va_list in printf implementation.

parent ebac489c
......@@ -321,7 +321,7 @@ static int puts_clbk_console_w(void *ctx, int len, const MSVCRT_wchar_t *str)
*/
int CDECL _vcprintf(const char* format, __ms_va_list valist)
{
return pf_printf_a(puts_clbk_console_a, NULL, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, valist);
return pf_printf_a(puts_clbk_console_a, NULL, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, &valist);
}
/*********************************************************************
......@@ -345,7 +345,7 @@ int CDECL _cprintf(const char* format, ...)
*/
int CDECL _vcwprintf(const MSVCRT_wchar_t* format, __ms_va_list valist)
{
return pf_printf_w(puts_clbk_console_w, NULL, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, valist);
return pf_printf_w(puts_clbk_console_w, NULL, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, &valist);
}
/*********************************************************************
......
......@@ -3446,7 +3446,7 @@ static int puts_clbk_file_w(void *file, int len, const MSVCRT_wchar_t *str)
*/
int CDECL MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, __ms_va_list valist)
{
return pf_printf_a(puts_clbk_file_a, file, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, valist);
return pf_printf_a(puts_clbk_file_a, file, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, &valist);
}
/*********************************************************************
......@@ -3459,7 +3459,7 @@ int CDECL MSVCRT_vfprintf_s(MSVCRT_FILE* file, const char *format, __ms_va_list
return -1;
}
return pf_printf_a(puts_clbk_file_a, file, format, NULL, FALSE, TRUE, arg_clbk_valist, NULL, valist);
return pf_printf_a(puts_clbk_file_a, file, format, NULL, FALSE, TRUE, arg_clbk_valist, NULL, &valist);
}
/*********************************************************************
......@@ -3467,7 +3467,7 @@ int CDECL MSVCRT_vfprintf_s(MSVCRT_FILE* file, const char *format, __ms_va_list
*/
int CDECL MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, __ms_va_list valist)
{
return pf_printf_w(puts_clbk_file_w, file, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, valist);
return pf_printf_w(puts_clbk_file_w, file, format, NULL, FALSE, FALSE, arg_clbk_valist, NULL, &valist);
}
/*********************************************************************
......@@ -3480,7 +3480,7 @@ int CDECL MSVCRT_vfwprintf_s(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, __
return -1;
}
return pf_printf_w(puts_clbk_file_w, file, format, NULL, FALSE, TRUE, arg_clbk_valist, NULL, valist);
return pf_printf_w(puts_clbk_file_w, file, format, NULL, FALSE, TRUE, arg_clbk_valist, NULL, &valist);
}
/*********************************************************************
......
......@@ -929,9 +929,9 @@ typedef union _printf_arg
} printf_arg;
typedef printf_arg (*args_clbk)(void*, int, int, __ms_va_list*);
int pf_printf_a(puts_clbk_a, void*, const char*, MSVCRT__locale_t,
BOOL, BOOL, args_clbk, void*, __ms_va_list);
BOOL, BOOL, args_clbk, void*, __ms_va_list*);
int pf_printf_w(puts_clbk_w, void*, const MSVCRT_wchar_t*, MSVCRT__locale_t,
BOOL, BOOL, args_clbk, void*, __ms_va_list);
BOOL, BOOL, args_clbk, void*, __ms_va_list*);
printf_arg arg_clbk_valist(void*, int, int, __ms_va_list*);
#define MSVCRT__OVERFLOW 3
......
......@@ -337,7 +337,7 @@ static inline void FUNC_NAME(pf_fixup_exponent)(char *buf)
int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const APICHAR *fmt,
MSVCRT__locale_t locale, BOOL positional_params, BOOL invoke_invalid_param_handler,
args_clbk pf_args, void *args_ctx, __ms_va_list valist)
args_clbk pf_args, void *args_ctx, __ms_va_list *valist)
{
const APICHAR *q, *p = fmt;
APICHAR buf[32];
......@@ -407,7 +407,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
else
i = -1;
flags.FieldLength = pf_args(args_ctx, i, VT_INT, &valist).get_int;
flags.FieldLength = pf_args(args_ctx, i, VT_INT, valist).get_int;
if(flags.FieldLength < 0) {
flags.LeftAlign = '-';
flags.FieldLength = -flags.FieldLength;
......@@ -429,7 +429,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
else
i = -1;
flags.Precision = pf_args(args_ctx, i, VT_INT, &valist).get_int;
flags.Precision = pf_args(args_ctx, i, VT_INT, valist).get_int;
} else while(isdigit(*p)) {
flags.Precision *= 10;
flags.Precision += *p++ - '0';
......@@ -466,10 +466,10 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
if(flags.Format == 's' || flags.Format == 'S') {
i = FUNC_NAME(pf_handle_string)(pf_puts, puts_ctx,
pf_args(args_ctx, pos, VT_PTR, &valist).get_ptr,
pf_args(args_ctx, pos, VT_PTR, valist).get_ptr,
-1, &flags, locale);
} else if(flags.Format == 'c' || flags.Format == 'C') {
int ch = pf_args(args_ctx, pos, VT_INT, &valist).get_int;
int ch = pf_args(args_ctx, pos, VT_INT, valist).get_int;
if((ch&0xff) != ch)
FIXME("multibyte characters printing not supported\n");
......@@ -481,7 +481,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
i = flags.Precision;
flags.Precision = 2*sizeof(void*);
FUNC_NAME(pf_integer_conv)(buf, sizeof(buf)/sizeof(APICHAR), &flags,
pf_args(args_ctx, pos, VT_INT, &valist).get_int);
pf_args(args_ctx, pos, VT_INT, valist).get_int);
flags.PadZero = 0;
flags.Precision = i;
......@@ -499,7 +499,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
return -1;
}
used = pf_args(args_ctx, pos, VT_PTR, &valist).get_ptr;
used = pf_args(args_ctx, pos, VT_PTR, valist).get_ptr;
*used = written;
i = 0;
} else if(flags.Format && strchr("diouxX", flags.Format)) {
......@@ -513,13 +513,13 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
if(flags.IntegerDouble)
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos,
VT_I8, &valist).get_longlong);
VT_I8, valist).get_longlong);
else if(flags.Format=='d' || flags.Format=='i')
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos,
VT_INT, &valist).get_int);
VT_INT, valist).get_int);
else
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, (unsigned)pf_args(
args_ctx, pos, VT_INT, &valist).get_int);
args_ctx, pos, VT_INT, valist).get_int);
#ifdef PRINTF_WIDE
i = FUNC_NAME(pf_output_format_wstr)(pf_puts, puts_ctx, tmp, -1, &flags, locale);
......@@ -539,7 +539,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
FUNC_NAME(pf_rebuild_format_string)(fmt, &flags);
sprintf(tmp, fmt, pf_args(args_ctx, pos, VT_R8, &valist).get_double);
sprintf(tmp, fmt, pf_args(args_ctx, pos, VT_R8, valist).get_double);
if(toupper(flags.Format)=='E' || toupper(flags.Format)=='G')
FUNC_NAME(pf_fixup_exponent)(tmp);
......
......@@ -518,7 +518,7 @@ int CDECL MSVCRT_vsnprintf( char *str, MSVCRT_size_t len,
int ret;
ret = pf_printf_a(puts_clbk_str_a, &ctx, format, NULL, FALSE, FALSE,
arg_clbk_valist, NULL, valist);
arg_clbk_valist, NULL, &valist);
puts_clbk_str_a(&ctx, 1, &nullbyte);
return ret;
}
......@@ -534,7 +534,7 @@ int CDECL MSVCRT_vsnprintf_l( char *str, MSVCRT_size_t len, const char *format,
int ret;
ret = pf_printf_a(puts_clbk_str_a, &ctx, format, locale, FALSE, FALSE,
arg_clbk_valist, NULL, valist);
arg_clbk_valist, NULL, &valist);
puts_clbk_str_a(&ctx, 1, &nullbyte);
return ret;
}
......@@ -558,7 +558,7 @@ int CDECL MSVCRT_vsnprintf_s_l( char *str, MSVCRT_size_t sizeOfBuffer,
ctx.len = len;
ctx.buf = str;
ret = pf_printf_a(puts_clbk_str_a, &ctx, format, locale, FALSE, TRUE,
arg_clbk_valist, NULL, valist);
arg_clbk_valist, NULL, &valist);
puts_clbk_str_a(&ctx, 1, &nullbyte);
if(ret<0 || ret==len) {
......@@ -659,7 +659,7 @@ int CDECL MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, MSVCRT_size_t len,
int ret;
ret = pf_printf_w(puts_clbk_str_w, &ctx, format, NULL, FALSE, FALSE,
arg_clbk_valist, NULL, valist);
arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
return ret;
}
......@@ -676,7 +676,7 @@ int CDECL MSVCRT_vsnwprintf_l(MSVCRT_wchar_t *str, MSVCRT_size_t len,
int ret;
ret = pf_printf_w(puts_clbk_str_w, &ctx, format, locale, FALSE, FALSE,
arg_clbk_valist, NULL, valist);
arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
return ret;
}
......@@ -699,7 +699,7 @@ int CDECL MSVCRT_vsnwprintf_s_l( MSVCRT_wchar_t *str, MSVCRT_size_t sizeOfBuffer
ctx.len = len;
ctx.buf = str;
ret = pf_printf_w(puts_clbk_str_w, &ctx, format, locale, FALSE, TRUE,
arg_clbk_valist, NULL, valist);
arg_clbk_valist, NULL, &valist);
puts_clbk_str_w(&ctx, 1, &nullbyte);
if(ret<0 || ret==len) {
......@@ -880,7 +880,7 @@ int CDECL MSVCRT_vsprintf_p_l(char *buffer, MSVCRT_size_t length, const char *fo
return ret;
} else if(ret == 0)
ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale, FALSE, TRUE,
arg_clbk_valist, NULL, args);
arg_clbk_valist, NULL, &args);
else
ret = pf_printf_a(puts_clbk_str_a, &puts_ctx, format, locale, TRUE, TRUE,
arg_clbk_positional, args_ctx, NULL);
......@@ -934,7 +934,7 @@ int CDECL MSVCRT_vswprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length,
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);
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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment