From c483bebe2b9dcbe7980dc09ec2217f33a15defb2 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Tue, 20 Apr 2010 21:39:01 +0200 Subject: [PATCH] msvcrt: Added swprintf_s implementation. --- dlls/msvcr80/msvcr80.spec | 2 +- dlls/msvcr90/msvcr90.spec | 2 +- dlls/msvcrt/msvcrt.spec | 2 +- dlls/msvcrt/wcs.c | 17 +++++++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 917ac4f160..0bbbfda371 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1400,7 +1400,7 @@ @ cdecl strtol(str ptr long) msvcrt.strtol @ cdecl strtoul(str ptr long) msvcrt.strtoul @ cdecl strxfrm(ptr str long) msvcrt.strxfrm -@ stub swprintf_s +@ varargs swprintf_s(ptr long wstr) msvcrt.swprintf_s @ varargs swscanf(wstr wstr) msvcrt.swscanf @ stub swscanf_s @ cdecl system(str) msvcrt.system diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 57613015fc..45cd885d16 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1384,7 +1384,7 @@ @ cdecl strtol(str ptr long) msvcrt.strtol @ cdecl strtoul(str ptr long) msvcrt.strtoul @ cdecl strxfrm(ptr str long) msvcrt.strxfrm -@ stub swprintf_s +@ varargs swprintf_s(ptr long wstr) msvcrt.swprintf_s @ varargs swscanf(wstr wstr) msvcrt.swscanf @ stub swscanf_s @ cdecl system(str) msvcrt.system diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 2700895df2..98db83f2cc 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1341,7 +1341,7 @@ @ cdecl strtoul(str ptr long) MSVCRT_strtoul @ cdecl strxfrm(ptr str long) MSVCRT_strxfrm @ varargs swprintf(ptr wstr) MSVCRT_swprintf -# stub swprintf_s +@ varargs swprintf_s(ptr long wstr) MSVCRT_swprintf_s @ varargs swscanf(wstr wstr) MSVCRT_swscanf # stub swscanf_s @ cdecl system(str) MSVCRT_system diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index df0ac03db2..21d0d2809c 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -1064,6 +1064,23 @@ int CDECL MSVCRT_swprintf( MSVCRT_wchar_t *str, const MSVCRT_wchar_t *format, .. return r; } +/********************************************************************* + * swprintf_s (MSVCRT.@) + */ +int CDECL MSVCRT_swprintf_s(MSVCRT_wchar_t *str, MSVCRT_size_t numberOfElements, + const MSVCRT_wchar_t *format, ... ) +{ + __ms_va_list ap; + int r; + + __ms_va_start(ap, format); + r = MSVCRT_vsnwprintf_s(str, numberOfElements*sizeof(MSVCRT_wchar_t), + INT_MAX, format, ap); + __ms_va_end(ap); + + return r; +} + /********************************************************************* * vswprintf (MSVCRT.@) */