Commit 0803575f authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

msvcrt: Implement _vscprintf and _vscwprintf.

parent 5df31cc9
......@@ -508,6 +508,8 @@
@ cdecl _unloaddll(long)
@ cdecl _unlock(long)
@ cdecl _utime(str ptr)
@ cdecl _vscprintf(str ptr)
@ cdecl _vscwprintf(wstr ptr)
@ cdecl _vsnprintf(ptr long str ptr) MSVCRT_vsnprintf
@ cdecl _vsnwprintf(ptr long wstr ptr) MSVCRT_vsnwprintf
@ cdecl _waccess(wstr long)
......
......@@ -200,11 +200,11 @@ static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len )
if( space >= len )
{
memcpy( p, str, len*sizeof(WCHAR) );
if (out->buf.W) memcpy( p, str, len*sizeof(WCHAR) );
out->used += len;
return len;
}
if( space > 0 )
if( space > 0 && out->buf.W )
memcpy( p, str, space*sizeof(WCHAR) );
out->used += len;
}
......@@ -215,11 +215,11 @@ static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len )
if( space >= n )
{
WideCharToMultiByte( CP_ACP, 0, str, len, p, n, NULL, NULL );
if (out->buf.A) WideCharToMultiByte( CP_ACP, 0, str, len, p, n, NULL, NULL );
out->used += n;
return len;
}
if( space > 0 )
if( space > 0 && out->buf.A )
WideCharToMultiByte( CP_ACP, 0, str, len, p, space, NULL, NULL );
out->used += n;
}
......@@ -238,11 +238,11 @@ static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len )
if( space >= len )
{
memcpy( p, str, len );
if (out->buf.A) memcpy( p, str, len );
out->used += len;
return len;
}
if( space > 0 )
if( space > 0 && out->buf.A )
memcpy( p, str, space );
out->used += len;
}
......@@ -253,11 +253,11 @@ static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len )
if( space >= n )
{
MultiByteToWideChar( CP_ACP, 0, str, len, p, n );
if (out->buf.W) MultiByteToWideChar( CP_ACP, 0, str, len, p, n );
out->used += n;
return len;
}
if( space > 0 )
if( space > 0 && out->buf.W )
MultiByteToWideChar( CP_ACP, 0, str, len, p, space );
out->used += n;
}
......@@ -804,6 +804,14 @@ int CDECL MSVCRT_vsprintf( char *str, const char *format, __ms_va_list valist)
}
/*********************************************************************
* _vscprintf (MSVCRT.@)
*/
int CDECL _vscprintf( const char *format, __ms_va_list valist )
{
return MSVCRT_vsnprintf( NULL, INT_MAX, format, valist );
}
/*********************************************************************
* _snprintf (MSVCRT.@)
*/
int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...)
......@@ -882,6 +890,14 @@ int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, _
}
/*********************************************************************
* _vscwprintf (MSVCRT.@)
*/
int CDECL _vscwprintf( const MSVCRT_wchar_t *format, __ms_va_list args )
{
return MSVCRT_vsnwprintf( NULL, INT_MAX, format, args );
}
/*********************************************************************
* vswprintf_s (MSVCRT.@)
*/
int CDECL MSVCRT_vswprintf_s( MSVCRT_wchar_t* str, MSVCRT_size_t num, const MSVCRT_wchar_t* format, __ms_va_list args )
......
......@@ -115,6 +115,7 @@ int __cdecl _setmaxstdio(int);
int __cdecl _snprintf(char*,size_t,const char*,...);
char* __cdecl _tempnam(const char*,const char*);
int __cdecl _unlink(const char*);
int __cdecl _vscprintf(const char*,__ms_va_list);
int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list);
void __cdecl clearerr(FILE*);
......@@ -166,6 +167,7 @@ wint_t __cdecl _fputwchar(wint_t);
wchar_t* __cdecl _getws(wchar_t*);
int __cdecl _putws(const wchar_t*);
int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...);
int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
FILE* __cdecl _wfdopen(int,const wchar_t*);
FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
......
......@@ -275,6 +275,7 @@ wint_t __cdecl _fputwchar(wint_t);
wchar_t* __cdecl _getws(wchar_t*);
int __cdecl _putws(const wchar_t*);
int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...);
int __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
FILE* __cdecl _wfdopen(int,const wchar_t*);
FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*);
......
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