Commit 07ca8f4f authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Convert all the printf functions to use MS ABI varargs.

parent 34f24871
...@@ -289,9 +289,9 @@ int CDECL _cprintf(const char* format, ...) ...@@ -289,9 +289,9 @@ int CDECL _cprintf(const char* format, ...)
{ {
char buf[2048], *mem = buf; char buf[2048], *mem = buf;
int written, resize = sizeof(buf), retval; int written, resize = sizeof(buf), retval;
va_list valist; __ms_va_list valist;
va_start( valist, format ); __ms_va_start( valist, format );
/* There are two conventions for snprintf failing: /* There are two conventions for snprintf failing:
* Return -1 if we truncated, or * Return -1 if we truncated, or
* Return the number of bytes that would have been written * Return the number of bytes that would have been written
...@@ -305,9 +305,9 @@ int CDECL _cprintf(const char* format, ...) ...@@ -305,9 +305,9 @@ int CDECL _cprintf(const char* format, ...)
MSVCRT_free (mem); MSVCRT_free (mem);
if (!(mem = MSVCRT_malloc(resize))) if (!(mem = MSVCRT_malloc(resize)))
return MSVCRT_EOF; return MSVCRT_EOF;
va_start( valist, format ); __ms_va_start( valist, format );
} }
va_end(valist); __ms_va_end(valist);
LOCK_CONSOLE; LOCK_CONSOLE;
retval = _cputs( mem ); retval = _cputs( mem );
UNLOCK_CONSOLE; UNLOCK_CONSOLE;
......
...@@ -3018,7 +3018,7 @@ MSVCRT_FILE* CDECL MSVCRT_tmpfile(void) ...@@ -3018,7 +3018,7 @@ MSVCRT_FILE* CDECL MSVCRT_tmpfile(void)
/********************************************************************* /*********************************************************************
* vfprintf (MSVCRT.@) * vfprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist) int CDECL MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, __ms_va_list valist)
{ {
char buf[2048], *mem = buf; char buf[2048], *mem = buf;
int written, resize = sizeof(buf), retval; int written, resize = sizeof(buf), retval;
...@@ -3048,7 +3048,7 @@ int CDECL MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist) ...@@ -3048,7 +3048,7 @@ int CDECL MSVCRT_vfprintf(MSVCRT_FILE* file, const char *format, va_list valist)
* Is final char included in written (then resize is too big) or not * Is final char included in written (then resize is too big) or not
* (then we must test for equality too)? * (then we must test for equality too)?
*/ */
int CDECL MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, va_list valist) int CDECL MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, __ms_va_list valist)
{ {
MSVCRT_wchar_t buf[2048], *mem = buf; MSVCRT_wchar_t buf[2048], *mem = buf;
int written, resize = sizeof(buf) / sizeof(MSVCRT_wchar_t), retval; int written, resize = sizeof(buf) / sizeof(MSVCRT_wchar_t), retval;
...@@ -3071,7 +3071,7 @@ int CDECL MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, va_l ...@@ -3071,7 +3071,7 @@ int CDECL MSVCRT_vfwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, va_l
/********************************************************************* /*********************************************************************
* vprintf (MSVCRT.@) * vprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vprintf(const char *format, va_list valist) int CDECL MSVCRT_vprintf(const char *format, __ms_va_list valist)
{ {
return MSVCRT_vfprintf(MSVCRT_stdout,format,valist); return MSVCRT_vfprintf(MSVCRT_stdout,format,valist);
} }
...@@ -3079,7 +3079,7 @@ int CDECL MSVCRT_vprintf(const char *format, va_list valist) ...@@ -3079,7 +3079,7 @@ int CDECL MSVCRT_vprintf(const char *format, va_list valist)
/********************************************************************* /*********************************************************************
* vwprintf (MSVCRT.@) * vwprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vwprintf(const MSVCRT_wchar_t *format, va_list valist) int CDECL MSVCRT_vwprintf(const MSVCRT_wchar_t *format, __ms_va_list valist)
{ {
return MSVCRT_vfwprintf(MSVCRT_stdout,format,valist); return MSVCRT_vfwprintf(MSVCRT_stdout,format,valist);
} }
...@@ -3089,11 +3089,11 @@ int CDECL MSVCRT_vwprintf(const MSVCRT_wchar_t *format, va_list valist) ...@@ -3089,11 +3089,11 @@ int CDECL MSVCRT_vwprintf(const MSVCRT_wchar_t *format, va_list valist)
*/ */
int CDECL MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...) int CDECL MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...)
{ {
va_list valist; __ms_va_list valist;
int res; int res;
va_start(valist, format); __ms_va_start(valist, format);
res = MSVCRT_vfprintf(file, format, valist); res = MSVCRT_vfprintf(file, format, valist);
va_end(valist); __ms_va_end(valist);
return res; return res;
} }
...@@ -3102,11 +3102,11 @@ int CDECL MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...) ...@@ -3102,11 +3102,11 @@ int CDECL MSVCRT_fprintf(MSVCRT_FILE* file, const char *format, ...)
*/ */
int CDECL MSVCRT_fwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...) int CDECL MSVCRT_fwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...)
{ {
va_list valist; __ms_va_list valist;
int res; int res;
va_start(valist, format); __ms_va_start(valist, format);
res = MSVCRT_vfwprintf(file, format, valist); res = MSVCRT_vfwprintf(file, format, valist);
va_end(valist); __ms_va_end(valist);
return res; return res;
} }
...@@ -3115,11 +3115,11 @@ int CDECL MSVCRT_fwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...) ...@@ -3115,11 +3115,11 @@ int CDECL MSVCRT_fwprintf(MSVCRT_FILE* file, const MSVCRT_wchar_t *format, ...)
*/ */
int CDECL MSVCRT_printf(const char *format, ...) int CDECL MSVCRT_printf(const char *format, ...)
{ {
va_list valist; __ms_va_list valist;
int res; int res;
va_start(valist, format); __ms_va_start(valist, format);
res = MSVCRT_vfprintf(MSVCRT_stdout, format, valist); res = MSVCRT_vfprintf(MSVCRT_stdout, format, valist);
va_end(valist); __ms_va_end(valist);
return res; return res;
} }
...@@ -3164,11 +3164,11 @@ MSVCRT_wint_t CDECL MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file) ...@@ -3164,11 +3164,11 @@ MSVCRT_wint_t CDECL MSVCRT_ungetwc(MSVCRT_wint_t wc, MSVCRT_FILE * file)
*/ */
int CDECL MSVCRT_wprintf(const MSVCRT_wchar_t *format, ...) int CDECL MSVCRT_wprintf(const MSVCRT_wchar_t *format, ...)
{ {
va_list valist; __ms_va_list valist;
int res; int res;
va_start(valist, format); __ms_va_start(valist, format);
res = MSVCRT_vwprintf(format, valist); res = MSVCRT_vwprintf(format, valist);
va_end(valist); __ms_va_end(valist);
return res; return res;
} }
......
...@@ -665,9 +665,9 @@ double __cdecl MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2); ...@@ -665,9 +665,9 @@ double __cdecl MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2);
MSVCRT_time_t __cdecl MSVCRT_time(MSVCRT_time_t*); MSVCRT_time_t __cdecl MSVCRT_time(MSVCRT_time_t*);
MSVCRT_FILE* __cdecl MSVCRT__fdopen(int, const char *); MSVCRT_FILE* __cdecl MSVCRT__fdopen(int, const char *);
MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *); MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
int __cdecl MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, va_list valist); int __cdecl MSVCRT_vsnprintf(char *str, unsigned int len, const char *format, __ms_va_list valist);
int __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, unsigned int len, int __cdecl MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, unsigned int len,
const MSVCRT_wchar_t *format, va_list valist ); const MSVCRT_wchar_t *format, __ms_va_list valist );
int __cdecl MSVCRT_raise(int sig); int __cdecl MSVCRT_raise(int sig);
#ifndef __WINE_MSVCRT_TEST #ifndef __WINE_MSVCRT_TEST
......
...@@ -525,7 +525,7 @@ static void pf_fixup_exponent( char *buf ) ...@@ -525,7 +525,7 @@ static void pf_fixup_exponent( char *buf )
* *
* implements both A and W vsnprintf functions * implements both A and W vsnprintf functions
*/ */
static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist ) static int pf_vsnprintf( pf_output *out, const WCHAR *format, __ms_va_list valist )
{ {
int r; int r;
LPCWSTR q, p = format; LPCWSTR q, p = format;
...@@ -769,7 +769,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist ) ...@@ -769,7 +769,7 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, va_list valist )
* _vsnprintf (MSVCRT.@) * _vsnprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vsnprintf( char *str, unsigned int len, int CDECL MSVCRT_vsnprintf( char *str, unsigned int len,
const char *format, va_list valist ) const char *format, __ms_va_list valist )
{ {
DWORD sz; DWORD sz;
LPWSTR formatW = NULL; LPWSTR formatW = NULL;
...@@ -798,7 +798,7 @@ int CDECL MSVCRT_vsnprintf( char *str, unsigned int len, ...@@ -798,7 +798,7 @@ int CDECL MSVCRT_vsnprintf( char *str, unsigned int len,
/********************************************************************* /*********************************************************************
* vsprintf (MSVCRT.@) * vsprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vsprintf( char *str, const char *format, va_list valist) int CDECL MSVCRT_vsprintf( char *str, const char *format, __ms_va_list valist)
{ {
return MSVCRT_vsnprintf(str, INT_MAX, format, valist); return MSVCRT_vsnprintf(str, INT_MAX, format, valist);
} }
...@@ -809,10 +809,10 @@ int CDECL MSVCRT_vsprintf( char *str, const char *format, va_list valist) ...@@ -809,10 +809,10 @@ int CDECL MSVCRT_vsprintf( char *str, const char *format, va_list valist)
int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...) int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...)
{ {
int retval; int retval;
va_list valist; __ms_va_list valist;
va_start(valist, format); __ms_va_start(valist, format);
retval = MSVCRT_vsnprintf(str, len, format, valist); retval = MSVCRT_vsnprintf(str, len, format, valist);
va_end(valist); __ms_va_end(valist);
return retval; return retval;
} }
...@@ -820,7 +820,7 @@ int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...) ...@@ -820,7 +820,7 @@ int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...)
* _vsnwsprintf (MSVCRT.@) * _vsnwsprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len, int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
const MSVCRT_wchar_t *format, va_list valist ) const MSVCRT_wchar_t *format, __ms_va_list valist )
{ {
pf_output out; pf_output out;
...@@ -838,10 +838,10 @@ int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len, ...@@ -838,10 +838,10 @@ int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
int CDECL MSVCRT__snwprintf( MSVCRT_wchar_t *str, unsigned int len, const MSVCRT_wchar_t *format, ...) int CDECL MSVCRT__snwprintf( MSVCRT_wchar_t *str, unsigned int len, const MSVCRT_wchar_t *format, ...)
{ {
int retval; int retval;
va_list valist; __ms_va_list valist;
va_start(valist, format); __ms_va_start(valist, format);
retval = MSVCRT_vsnwprintf(str, len, format, valist); retval = MSVCRT_vsnwprintf(str, len, format, valist);
va_end(valist); __ms_va_end(valist);
return retval; return retval;
} }
...@@ -850,12 +850,12 @@ int CDECL MSVCRT__snwprintf( MSVCRT_wchar_t *str, unsigned int len, const MSVCRT ...@@ -850,12 +850,12 @@ int CDECL MSVCRT__snwprintf( MSVCRT_wchar_t *str, unsigned int len, const MSVCRT
*/ */
int CDECL MSVCRT_sprintf( char *str, const char *format, ... ) int CDECL MSVCRT_sprintf( char *str, const char *format, ... )
{ {
va_list ap; __ms_va_list ap;
int r; int r;
va_start( ap, format ); __ms_va_start( ap, format );
r = MSVCRT_vsnprintf( str, INT_MAX, format, ap ); r = MSVCRT_vsnprintf( str, INT_MAX, format, ap );
va_end( ap ); __ms_va_end( ap );
return r; return r;
} }
...@@ -864,19 +864,19 @@ int CDECL MSVCRT_sprintf( char *str, const char *format, ... ) ...@@ -864,19 +864,19 @@ int CDECL MSVCRT_sprintf( char *str, const char *format, ... )
*/ */
int CDECL MSVCRT_swprintf( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ... ) int CDECL MSVCRT_swprintf( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, ... )
{ {
va_list ap; __ms_va_list ap;
int r; int r;
va_start( ap, format ); __ms_va_start( ap, format );
r = MSVCRT_vsnwprintf( str, INT_MAX, format, ap ); r = MSVCRT_vsnwprintf( str, INT_MAX, format, ap );
va_end( ap ); __ms_va_end( ap );
return r; return r;
} }
/********************************************************************* /*********************************************************************
* vswprintf (MSVCRT.@) * vswprintf (MSVCRT.@)
*/ */
int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, va_list args ) int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, __ms_va_list args )
{ {
return MSVCRT_vsnwprintf( str, INT_MAX, format, args ); return MSVCRT_vsnwprintf( str, INT_MAX, format, args );
} }
...@@ -884,7 +884,7 @@ int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, v ...@@ -884,7 +884,7 @@ int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, v
/********************************************************************* /*********************************************************************
* vswprintf_s (MSVCRT.@) * vswprintf_s (MSVCRT.@)
*/ */
int CDECL MSVCRT_vswprintf_s( MSVCRT_wchar_t* str, MSVCRT_size_t num, const MSVCRT_wchar_t* format, va_list args ) int CDECL MSVCRT_vswprintf_s( MSVCRT_wchar_t* str, MSVCRT_size_t num, const MSVCRT_wchar_t* format, __ms_va_list args )
{ {
/* FIXME: must handle positional arguments */ /* FIXME: must handle positional arguments */
return MSVCRT_vsnwprintf( str, num, format, args ); return MSVCRT_vsnwprintf( str, num, format, args );
......
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