Commit 09a32152 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Add parameters to mimic *_s function behaviour in pf_vsnprintf.

parent 419f9025
......@@ -554,7 +554,8 @@ static void pf_fixup_exponent( char *buf )
*
* implements both A and W vsnprintf functions
*/
static int pf_vsnprintf( pf_output *out, const WCHAR *format, MSVCRT__locale_t locale, __ms_va_list valist )
static int pf_vsnprintf( pf_output *out, const WCHAR *format,
MSVCRT__locale_t locale, BOOL valid, __ms_va_list valist )
{
int r;
LPCWSTR q, p = format;
......@@ -785,9 +786,20 @@ static int pf_vsnprintf( pf_output *out, const WCHAR *format, MSVCRT__locale_t l
r = pf_output_stringA( out, x, -1 );
if( x != number )
HeapFree( GetProcessHeap(), 0, x );
if(r < 0)
return r;
}
else
{
if( valid )
{
MSVCRT__invalid_parameter( NULL, NULL, NULL, 0, 0 );
*MSVCRT__errno() = MSVCRT_EINVAL;
return -1;
}
continue;
}
if( r<0 )
return r;
......@@ -821,7 +833,7 @@ int CDECL MSVCRT_vsnprintf( char *str, unsigned int len,
formatW = HeapAlloc( GetProcessHeap(), 0, sz*sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, format, -1, formatW, sz );
r = pf_vsnprintf( &out, formatW, NULL, valist );
r = pf_vsnprintf( &out, formatW, NULL, FALSE, valist );
HeapFree( GetProcessHeap(), 0, formatW );
......@@ -878,7 +890,7 @@ int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
out.used = 0;
out.len = len;
return pf_vsnprintf( &out, format, NULL, valist );
return pf_vsnprintf( &out, format, NULL, FALSE, valist );
}
/*********************************************************************
......
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