Alexandre Julliard : ucrtbase: Move the vsnprintf() wrapper function to the ucrtbase import library.
Alexandre Julliard
julliard at winehq.org
Fri May 24 15:46:36 CDT 2019
Module: wine
Branch: master
Commit: 030a460934054808d66dab74547d4b150ce01169
URL: https://source.winehq.org/git/wine.git/?a=commit;h=030a460934054808d66dab74547d4b150ce01169
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri May 24 12:20:42 2019 +0200
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 at winehq.org>
---
dlls/msvcp90/msvcp90.h | 6 ------
dlls/msvcp90/msvcp_main.c | 10 ++--------
dlls/msvcrt/wcs.c | 4 ++--
dlls/ucrtbase/Makefile.in | 1 +
dlls/ucrtbase/printf.c | 34 ++++++++++++++++++++++++++++++++++
dlls/ucrtbase/ucrtbase.spec | 2 +-
6 files changed, 40 insertions(+), 17 deletions(-)
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h
index 77c96e3..2e3d071 100644
--- a/dlls/msvcp90/msvcp90.h
+++ b/dlls/msvcp90/msvcp90.h
@@ -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
diff --git a/dlls/msvcp90/msvcp_main.c b/dlls/msvcp90/msvcp_main.c
index 6d78ce3..52f25a9 100644
--- a/dlls/msvcp90/msvcp_main.c
+++ b/dlls/msvcp90/msvcp_main.c
@@ -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)
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 2a75030..e62ac25 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -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};
diff --git a/dlls/ucrtbase/Makefile.in b/dlls/ucrtbase/Makefile.in
index 23d8292..63fcc9b 100644
--- a/dlls/ucrtbase/Makefile.in
+++ b/dlls/ucrtbase/Makefile.in
@@ -26,6 +26,7 @@ C_SRCS = \
math.c \
mbcs.c \
misc.c \
+ printf.c \
process.c \
scanf.c \
string.c \
diff --git a/dlls/ucrtbase/printf.c b/dlls/ucrtbase/printf.c
new file mode 100644
index 0000000..8f58e6c
--- /dev/null
+++ b/dlls/ucrtbase/printf.c
@@ -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 );
+}
diff --git a/dlls/ucrtbase/ucrtbase.spec b/dlls/ucrtbase/ucrtbase.spec
index c64fee2..441ef70 100644
--- a/dlls/ucrtbase/ucrtbase.spec
+++ b/dlls/ucrtbase/ucrtbase.spec
@@ -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
More information about the wine-cvs
mailing list