stdio.h: Add ucrt version of vsnprintf inline wrapper.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-02-18 15:21:29 +01:00 committed by Alexandre Julliard
parent 229c33791f
commit c60b21926e
2 changed files with 25 additions and 12 deletions

View File

@ -22,10 +22,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(vcruntime);
#define UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR (0x0002)
int __cdecl __stdio_common_vsprintf(unsigned __int64 options, char *str, size_t len, const char *format,
_locale_t locale, __ms_va_list valist);
int* CDECL __processing_throw(void);
/*********************************************************************
@ -58,9 +54,3 @@ int __cdecl __uncaught_exceptions(void)
{
return *__processing_throw();
}
int __cdecl _vsnprintf( char *buf, size_t size, const char *fmt, __ms_va_list args )
{
return __stdio_common_vsprintf( UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR,
buf, size, fmt, NULL, args );
}

View File

@ -95,7 +95,6 @@ char* __cdecl _tempnam(const char*,const char*);
int __cdecl _unlink(const char*);
int WINAPIV _scprintf(const char*,...);
int __cdecl _vscprintf(const char*,__ms_va_list);
int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list);
int __cdecl _vsnprintf_s(char*,size_t,size_t,const char*,__ms_va_list);
int __cdecl _vsprintf_p_l(char*,size_t,const char*,_locale_t,__ms_va_list);
@ -173,6 +172,31 @@ int __cdecl vsprintf_s(char*,size_t,const char*,__ms_va_list);
unsigned int __cdecl _get_output_format(void);
unsigned int __cdecl _set_output_format(void);
#ifdef _UCRT
_ACRTIMP int __cdecl __stdio_common_vsprintf(unsigned __int64,char*,size_t,const char*,_locale_t,__ms_va_list);
static inline int __cdecl vsnprintf(char *buffer, size_t size, const char *format, __ms_va_list args)
{
int ret = __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR,
buffer, size, format, NULL, args);
return ret < 0 ? -1 : ret;
}
static inline int __cdecl _vsnprintf(char *buffer, size_t size, const char *format, __ms_va_list args)
{
int ret = __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | _CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION,
buffer, size, format, NULL, args);
return ret < 0 ? -1 : ret;
}
#else /* _UCRT */
int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list);
static inline int vsnprintf(char *buffer, size_t size, const char *format, __ms_va_list args) { return _vsnprintf(buffer,size,format,args); }
#endif /* _UCRT */
#endif /* _STDIO_DEFINED */
#ifdef __cplusplus
@ -191,7 +215,6 @@ static inline char* tempnam(const char *dir, const char *prefix) { return _tempn
static inline int unlink(const char* path) { return _unlink(path); }
#define _UNLINK_DEFINED
#endif
static inline int vsnprintf(char *buffer, size_t size, const char *format, __ms_va_list args) { return _vsnprintf(buffer,size,format,args); }
static inline int WINAPIV snprintf(char *buffer, size_t size, const char *format, ...)
{