msvcrt: Added _vsnwprintf* implementation.

This commit is contained in:
Piotr Caban 2010-04-19 10:57:50 +02:00 committed by Alexandre Julliard
parent 85fa2ee53c
commit 743e6ba688
5 changed files with 73 additions and 14 deletions

View File

@ -1054,9 +1054,9 @@
@ cdecl _vsnprintf_s(ptr long long str ptr) msvcrt._vsnprintf_s
@ cdecl _vsnprintf_s_l(ptr long long str ptr ptr) msvcrt._vsnprintf_s_l
@ cdecl _vsnwprintf(ptr long wstr ptr) msvcrt._vsnwprintf
@ stub _vsnwprintf_l
@ stub _vsnwprintf_s
@ stub _vsnwprintf_s_l
@ cdecl _vsnwprintf_l(ptr long wstr ptr ptr) msvcrt._vsnwprintf_l
@ cdecl _vsnwprintf_s(ptr long long wstr ptr) msvcrt._vsnwprintf_s
@ cdecl _vsnwprintf_s_l(ptr long long wstr ptr ptr) msvcrt._vsnwprintf_s_l
@ stub _vsprintf_l
@ stub _vsprintf_p
@ stub _vsprintf_p_l

View File

@ -1041,9 +1041,9 @@
@ cdecl _vsnprintf_s(ptr long long str ptr) msvcrt._vsnprintf_s
@ cdecl _vsnprintf_s_l(ptr long long str ptr ptr) msvcrt._vsnprintf_s_l
@ cdecl _vsnwprintf(ptr long wstr ptr) msvcrt._vsnwprintf
@ stub _vsnwprintf_l
@ stub _vsnwprintf_s
@ stub _vsnwprintf_s_l
@ cdecl _vsnwprintf_l(ptr long wstr ptr ptr) msvcrt._vsnwprintf_l
@ cdecl _vsnwprintf_s(ptr long long wstr ptr) msvcrt._vsnwprintf_s
@ cdecl _vsnwprintf_s_l(ptr long long wstr ptr ptr) msvcrt._vsnwprintf_s_l
@ stub _vsprintf_l
@ stub _vsprintf_p
@ stub _vsprintf_p_l

View File

@ -738,7 +738,7 @@ MSVCRT___time64_t __cdecl MSVCRT__time64(MSVCRT___time64_t*);
MSVCRT_FILE* __cdecl MSVCRT__fdopen(int, const char *);
MSVCRT_FILE* __cdecl MSVCRT__wfdopen(int, const MSVCRT_wchar_t *);
int __cdecl MSVCRT_vsnprintf(char *str, MSVCRT_size_t 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, MSVCRT_size_t len,
const MSVCRT_wchar_t *format, __ms_va_list valist );
int __cdecl MSVCRT_raise(int sig);

View File

@ -983,9 +983,9 @@
@ cdecl _vsnprintf_s(ptr long long str ptr) MSVCRT_vsnprintf_s
@ cdecl _vsnprintf_s_l(ptr long long str ptr ptr) MSVCRT_vsnprintf_s_l
@ cdecl _vsnwprintf(ptr long wstr ptr) MSVCRT_vsnwprintf
# stub _vsnwprintf_l
# stub _vsnwprintf_s
# stub _vsnwprintf_s_l
@ cdecl _vsnwprintf_l(ptr long wstr ptr ptr) MSVCRT_vsnprintf_l
@ cdecl _vsnwprintf_s(ptr long long wstr ptr) MSVCRT_vsnprintf_s
@ cdecl _vsnwprintf_s_l(ptr long long wstr ptr ptr) MSVCRT_vsnprintf_s_l
# stub _vsprintf_l
# stub _vsprintf_p
# stub _vsprintf_p_l

View File

@ -935,10 +935,11 @@ int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...)
}
/*********************************************************************
* _vsnwsprintf (MSVCRT.@)
* vsnwsprintf_internal (INTERNAL)
*/
int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
const MSVCRT_wchar_t *format, __ms_va_list valist )
static inline int vsnwprintf_internal(MSVCRT_wchar_t *str, MSVCRT_size_t len,
const MSVCRT_wchar_t *format, MSVCRT__locale_t locale, BOOL valid,
__ms_va_list valist)
{
pf_output out;
@ -947,7 +948,65 @@ int CDECL MSVCRT_vsnwprintf( MSVCRT_wchar_t *str, unsigned int len,
out.used = 0;
out.len = len;
return pf_vsnprintf( &out, format, NULL, FALSE, valist );
return pf_vsnprintf( &out, format, locale, valid, valist );
}
/*********************************************************************
* _vsnwsprintf (MSVCRT.@)
*/
int CDECL MSVCRT_vsnwprintf(MSVCRT_wchar_t *str, MSVCRT_size_t len,
const MSVCRT_wchar_t *format, __ms_va_list valist)
{
return vsnwprintf_internal(str, len, format, NULL, FALSE, valist);
}
/*********************************************************************
* _vsnwsprintf_l (MSVCRT.@)
*/
int CDECL MSVCRT_vsnwprintf_l(MSVCRT_wchar_t *str, MSVCRT_size_t len,
const MSVCRT_wchar_t *format, MSVCRT__locale_t locale,
__ms_va_list valist)
{
return vsnwprintf_internal(str, len, format, locale, FALSE, valist);
}
/*********************************************************************
* _vsnwsprintf_s_l (MSVCRT.@)
*/
int CDECL MSVCRT_vsnwprintf_s_l( MSVCRT_wchar_t *str, MSVCRT_size_t sizeOfBuffer,
MSVCRT_size_t count, const MSVCRT_wchar_t *format,
MSVCRT__locale_t locale, __ms_va_list valist)
{
int len, ret;
len = sizeOfBuffer/sizeof(MSVCRT_wchar_t);
if(count!=-1 && len>count+1)
len = count+1;
ret = vsnwprintf_internal(str, len, format, locale, TRUE, valist);
if(ret<0 || ret==len) {
if(count!=_TRUNCATE && count>sizeOfBuffer/sizeof(MSVCRT_wchar_t)) {
MSVCRT__invalid_parameter( NULL, NULL, NULL, 0, 0 );
*MSVCRT__errno() = MSVCRT_ERANGE;
memset(str, 0, sizeOfBuffer);
} else
str[len-1] = '\0';
return -1;
}
return ret;
}
/*********************************************************************
* _vsnwsprintf_s (MSVCRT.@)
*/
int CDECL MSVCRT_vsnwprintf_s(MSVCRT_wchar_t *str, MSVCRT_size_t sizeOfBuffer,
MSVCRT_size_t count, const MSVCRT_wchar_t *format, __ms_va_list valist)
{
return MSVCRT_vsnwprintf_s_l(str, sizeOfBuffer, count,
format, NULL, valist);
}
/*********************************************************************