ucrtbase: Move the vsnprintf() wrapper function to the ucrtbase import library.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47250
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-05-24 12:20:42 +02:00
parent c3d3ef752b
commit 030a460934
6 changed files with 40 additions and 17 deletions

View File

@ -662,9 +662,3 @@ static inline int mbstowcs_wrapper( size_t *ret, wchar_t *wcs, size_t size, cons
#endif
void free_misc(void);
#if _MSVCP_VER >= 140
#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);
#endif

View File

@ -120,7 +120,7 @@ int WINAPIV _scprintf(const char* fmt, ...)
int ret;
__ms_va_list valist;
__ms_va_start(valist, fmt);
ret = __stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, NULL, 0, fmt, NULL, valist);
ret = _vsnprintf(NULL, 0, fmt, valist);
__ms_va_end(valist);
return ret;
}
@ -130,16 +130,10 @@ int WINAPIV sprintf(char *buf, const char *fmt, ...)
int ret;
__ms_va_list valist;
__ms_va_start(valist, fmt);
ret = __stdio_common_vsprintf(UCRTBASE_PRINTF_STANDARD_SNPRINTF_BEHAVIOUR, buf, -1, fmt, NULL, valist);
ret = _vsnprintf(buf, -1, fmt, valist);
__ms_va_end(valist);
return ret;
}
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 );
}
#endif
static void init_cxx_funcs(void)

View File

@ -796,8 +796,8 @@ static int puts_clbk_str_c99_a(void *ctx, int len, const char *str)
/*********************************************************************
* __stdio_common_vsprintf (UCRTBASE.@)
*/
int CDECL MSVCRT__stdio_common_vsprintf( unsigned __int64 options, char *str, MSVCRT_size_t len, const char *format,
MSVCRT__locale_t locale, __ms_va_list valist )
int CDECL __stdio_common_vsprintf( unsigned __int64 options, char *str, MSVCRT_size_t len, const char *format,
MSVCRT__locale_t locale, __ms_va_list valist )
{
static const char nullbyte = '\0';
struct _str_ctx_a ctx = {len, str};

View File

@ -26,6 +26,7 @@ C_SRCS = \
math.c \
mbcs.c \
misc.c \
printf.c \
process.c \
scanf.c \
string.c \

View File

@ -0,0 +1,34 @@
/*
* Copyright 2019 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* this function is part of the import lib */
#if 0
#pragma makedep implib
#endif
#include <stdarg.h>
#include "msvcrt.h"
int __cdecl __stdio_common_vsprintf(unsigned __int64 options, char *str, MSVCRT_size_t len,
const char *format, MSVCRT__locale_t locale, __ms_va_list valist);
int __cdecl _vsnprintf( char *buf, MSVCRT_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

@ -156,7 +156,7 @@
@ cdecl __stdio_common_vfwscanf(int64 ptr wstr ptr ptr) MSVCRT__stdio_common_vfwscanf
@ cdecl __stdio_common_vsnprintf_s(int64 ptr long long str ptr ptr) MSVCRT__stdio_common_vsnprintf_s
@ cdecl __stdio_common_vsnwprintf_s(int64 ptr long long wstr ptr ptr) MSVCRT__stdio_common_vsnwprintf_s
@ cdecl __stdio_common_vsprintf(int64 ptr long str ptr ptr) MSVCRT__stdio_common_vsprintf
@ cdecl __stdio_common_vsprintf(int64 ptr long str ptr ptr)
@ cdecl __stdio_common_vsprintf_p(int64 ptr long str ptr ptr) MSVCRT__stdio_common_vsprintf_p
@ cdecl __stdio_common_vsprintf_s(int64 ptr long str ptr ptr) MSVCRT__stdio_common_vsprintf_s
@ cdecl __stdio_common_vsscanf(int64 ptr long str ptr ptr) MSVCRT__stdio_common_vsscanf