msvcrt: Implement _vscprintf and _vscwprintf.

This commit is contained in:
Hans Leidekker 2009-03-26 12:45:59 +01:00 committed by Alexandre Julliard
parent 5df31cc903
commit 0803575fd3
4 changed files with 29 additions and 8 deletions

View File

@ -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)

View File

@ -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;
}
@ -803,6 +803,14 @@ int CDECL MSVCRT_vsprintf( char *str, const char *format, __ms_va_list valist)
return MSVCRT_vsnprintf(str, INT_MAX, format, valist);
}
/*********************************************************************
* _vscprintf (MSVCRT.@)
*/
int CDECL _vscprintf( const char *format, __ms_va_list valist )
{
return MSVCRT_vsnprintf( NULL, INT_MAX, format, valist );
}
/*********************************************************************
* _snprintf (MSVCRT.@)
*/
@ -881,6 +889,14 @@ int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, _
return MSVCRT_vsnwprintf( str, INT_MAX, format, args );
}
/*********************************************************************
* _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.@)
*/

View File

@ -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*);

View File

@ -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*);