Jacek Caban : corecrt_wstdio.h: Add ucrt _snwprintf, swprintf and _swprintf declarations.

Alexandre Julliard julliard at winehq.org
Mon Feb 24 15:23:53 CST 2020


Module: wine
Branch: master
Commit: eec622931f5818adcffdee44ccb3bd0bdfa8e297
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=eec622931f5818adcffdee44ccb3bd0bdfa8e297

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Mon Feb 24 15:33:26 2020 +0100

corecrt_wstdio.h: Add ucrt _snwprintf, swprintf and _swprintf declarations.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/msvcrt/corecrt_wstdio.h | 64 +++++++++++++++++++++++++++++++++++++++--
 1 file changed, 62 insertions(+), 2 deletions(-)

diff --git a/include/msvcrt/corecrt_wstdio.h b/include/msvcrt/corecrt_wstdio.h
index 87f74916c5..31702129cd 100644
--- a/include/msvcrt/corecrt_wstdio.h
+++ b/include/msvcrt/corecrt_wstdio.h
@@ -55,13 +55,11 @@ wint_t   __cdecl _getwc_nolock(FILE*);
 wchar_t* __cdecl _getws(wchar_t*);
 wint_t   __cdecl _putwc_nolock(wint_t,FILE*);
 int      __cdecl _putws(const wchar_t*);
-int      WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
 int      WINAPIV _snwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,...);
 int      WINAPIV _scwprintf(const wchar_t*,...);
 wint_t   __cdecl _ungetwc_nolock(wint_t,FILE*);
 int      __cdecl _vscwprintf(const wchar_t*,__ms_va_list);
 int      __cdecl _vscwprintf_p_l(const wchar_t*,_locale_t,__ms_va_list);
-int      __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
 int      __cdecl _vsnwprintf_s(wchar_t*,size_t,size_t,const wchar_t*,__ms_va_list);
 int      __cdecl _vswprintf_p_l(wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
 FILE*    __cdecl _wfdopen(int,const wchar_t*);
@@ -104,6 +102,66 @@ int      WINAPIV wprintf_s(const wchar_t*,...);
 int      WINAPIV wscanf(const wchar_t*,...);
 int      WINAPIV wscanf_s(const wchar_t*,...);
 
+#ifdef _UCRT
+
+_ACRTIMP int __cdecl __stdio_common_vswprintf(unsigned __int64,wchar_t*,size_t,const wchar_t*,_locale_t,__ms_va_list);
+
+static inline int __cdecl _vsnwprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args)
+{
+    int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
+    return ret < 0 ? -1 : ret;
+}
+
+static inline int WINAPIV _snwprintf(wchar_t *buffer, size_t size, const wchar_t* format, ...)
+{
+    int ret;
+    __ms_va_list args;
+
+    __ms_va_start(args, format);
+    ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
+    __ms_va_end(args);
+    return ret;
+}
+
+static inline int WINAPIV vswprintf(wchar_t *buffer, size_t size, const wchar_t *format, __ms_va_list args)
+{
+    int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
+    return ret < 0 ? -1 : ret;
+}
+
+static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *format, ...)
+{
+    int ret;
+    __ms_va_list args;
+
+    __ms_va_start(args, format);
+    ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, size, format, NULL, args);
+    __ms_va_end(args);
+    return ret;
+}
+
+static inline int WINAPIV _vswprintf(wchar_t *buffer, const wchar_t *format, __ms_va_list args)
+{
+    int ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, -1, format, NULL, args);
+    return ret < 0 ? -1 : ret;
+}
+
+static inline int WINAPIV _swprintf(wchar_t *buffer, const wchar_t *format, ...)
+{
+    int ret;
+    __ms_va_list args;
+
+    __ms_va_start(args, format);
+    ret = __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, buffer, -1, format, NULL, args);
+    __ms_va_end(args);
+    return ret < 0 ? -1 : ret;
+}
+
+#else /* _UCRT */
+
+_ACRTIMP int WINAPIV _snwprintf(wchar_t*,size_t,const wchar_t*,...);
+_ACRTIMP int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list);
+
 #ifdef _CRT_NON_CONFORMING_SWPRINTFS
 int WINAPIV swprintf(wchar_t*,const wchar_t*,...);
 int __cdecl vswprintf(wchar_t*,const wchar_t*,__ms_va_list);
@@ -121,6 +179,8 @@ static inline int WINAPIV swprintf(wchar_t *buffer, size_t size, const wchar_t *
 }
 #endif  /*  _CRT_NON_CONFORMING_SWPRINTFS */
 
+#endif /* _UCRT */
+
 #ifdef __cplusplus
 }
 #endif




More information about the wine-cvs mailing list