From 133a38fcfbe59524d6be8759a4c3997fbb6efbe6 Mon Sep 17 00:00:00 2001 From: Eryk Wieliczko Date: Wed, 24 Nov 2010 21:12:37 +0100 Subject: [PATCH] msvcrt: Implement printf_s and wprintf_s. --- dlls/msvcr100/msvcr100.spec | 4 ++-- dlls/msvcr80/msvcr80.spec | 4 ++-- dlls/msvcr90/msvcr90.spec | 4 ++-- dlls/msvcrt/file.c | 26 ++++++++++++++++++++++++++ dlls/msvcrt/msvcrt.spec | 4 ++-- include/msvcrt/stdio.h | 2 ++ include/msvcrt/wchar.h | 1 + 7 files changed, 37 insertions(+), 8 deletions(-) diff --git a/dlls/msvcr100/msvcr100.spec b/dlls/msvcr100/msvcr100.spec index 2600fc0aa6..25467ff7fd 100644 --- a/dlls/msvcr100/msvcr100.spec +++ b/dlls/msvcr100/msvcr100.spec @@ -1543,7 +1543,7 @@ @ cdecl perror(str) msvcrt.perror @ cdecl pow(double double) msvcrt.pow @ varargs printf(str) msvcrt.printf -@ stub printf_s +@ varargs printf_s(str) msvcrt.printf_s @ cdecl putc(long ptr) msvcrt.putc @ cdecl putchar(long) msvcrt.putchar @ cdecl puts(str) msvcrt.puts @@ -1665,6 +1665,6 @@ @ stub wmemcpy_s @ stub wmemmove_s @ varargs wprintf(wstr) msvcrt.wprintf -@ stub wprintf_s +@ varargs wprintf_s(wstr) msvcrt.wprintf_s @ varargs wscanf(wstr) msvcrt.wscanf @ varargs wscanf_s(wstr) msvcrt.wscanf_s diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 98232732a7..742144dc5d 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -1397,7 +1397,7 @@ @ cdecl perror(str) msvcrt.perror @ cdecl pow(double double) msvcrt.pow @ varargs printf(str) msvcrt.printf -@ stub printf_s +@ varargs printf_s(str) msvcrt.printf_s @ cdecl putc(long ptr) msvcrt.putc @ cdecl putchar(long) msvcrt.putchar @ cdecl puts(str) msvcrt.puts @@ -1517,6 +1517,6 @@ @ cdecl wctomb(ptr long) msvcrt.wctomb @ stub wctomb_s @ varargs wprintf(wstr) msvcrt.wprintf -@ stub wprintf_s +@ varargs wprintf_s(wstr) msvcrt.wprintf_s @ varargs wscanf(wstr) msvcrt.wscanf @ varargs wscanf_s(wstr) msvcrt.wscanf_s diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 4f6872483a..3c0279f4b2 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -1381,7 +1381,7 @@ @ cdecl perror(str) msvcrt.perror @ cdecl pow(double double) msvcrt.pow @ varargs printf(str) msvcrt.printf -@ stub printf_s +@ varargs printf_s(str) msvcrt.printf_s @ cdecl putc(long ptr) msvcrt.putc @ cdecl putchar(long) msvcrt.putchar @ cdecl puts(str) msvcrt.puts @@ -1501,6 +1501,6 @@ @ cdecl wctomb(ptr long) msvcrt.wctomb @ stub wctomb_s @ varargs wprintf(wstr) msvcrt.wprintf -@ stub wprintf_s +@ varargs wprintf_s(wstr) msvcrt.wprintf_s @ varargs wscanf(wstr) msvcrt.wscanf @ varargs wscanf_s(wstr) msvcrt.wscanf_s diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index b8f4338040..866ea4611e 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -3525,6 +3525,19 @@ int CDECL MSVCRT_printf(const char *format, ...) return res; } +/********************************************************************* + * printf_s (MSVCRT.@) + */ +int CDECL MSVCRT_printf_s(const char *format, ...) +{ + __ms_va_list valist; + int res; + __ms_va_start(valist, format); + res = MSVCRT_vprintf_s(format, valist); + __ms_va_end(valist); + return res; +} + /********************************************************************* * ungetc (MSVCRT.@) */ @@ -3574,6 +3587,19 @@ int CDECL MSVCRT_wprintf(const MSVCRT_wchar_t *format, ...) return res; } +/********************************************************************* + * wprintf_s (MSVCRT.@) + */ +int CDECL MSVCRT_wprintf_s(const MSVCRT_wchar_t *format, ...) +{ + __ms_va_list valist; + int res; + __ms_va_start(valist, format); + res = MSVCRT_vwprintf_s(format, valist); + __ms_va_end(valist); + return res; +} + /********************************************************************* * _getmaxstdio (MSVCRT.@) */ diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index c861643376..d528e067c0 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -1339,7 +1339,7 @@ @ cdecl pow(double double) MSVCRT_pow @ cdecl -arch=x86_64 powf(float float) MSVCRT_powf @ varargs printf(str) MSVCRT_printf -# stub printf_s +@ varargs printf_s(str) MSVCRT_printf_s @ cdecl putc(long ptr) MSVCRT_putc @ cdecl putchar(long) MSVCRT_putchar @ cdecl puts(str) MSVCRT_puts @@ -1470,7 +1470,7 @@ @ cdecl wctomb(ptr long) MSVCRT_wctomb # stub wctomb_s @ varargs wprintf(wstr) MSVCRT_wprintf -# stub wprintf_s +@ varargs wprintf_s(wstr) MSVCRT_wprintf_s @ varargs wscanf(wstr) MSVCRT_wscanf @ varargs wscanf_s(wstr) MSVCRT_wscanf_s diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index e8c7671bef..31ba8ca454 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -148,6 +148,7 @@ int __cdecl getchar(void); char* __cdecl gets(char*); void __cdecl perror(const char*); int __cdecl printf(const char*,...); +int __cdecl printf_s(const char*,...); int __cdecl putc(int,FILE*); int __cdecl putchar(int); int __cdecl puts(const char*); @@ -220,6 +221,7 @@ int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list); int __cdecl vwprintf(const wchar_t*,__ms_va_list); int __cdecl vwprintf_s(const wchar_t*,__ms_va_list); int __cdecl wprintf(const wchar_t*,...); +int __cdecl wprintf_s(const wchar_t*,...); int __cdecl wscanf(const wchar_t*,...); int __cdecl wscanf_s(const wchar_t*,...); #endif /* _WSTDIO_DEFINED */ diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index d0a6a37b0c..e753e3fe2f 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -316,6 +316,7 @@ int __cdecl vswprintf_s(wchar_t*,size_t,const wchar_t*,__ms_va_list); int __cdecl vwprintf(const wchar_t*,__ms_va_list); int __cdecl vwprintf_s(const wchar_t*,__ms_va_list); int __cdecl wprintf(const wchar_t*,...); +int __cdecl wprintf_s(const wchar_t*,...); int __cdecl wscanf(const wchar_t*,...); int __cdecl wscanf_s(const wchar_t*,...); #endif /* _WSTDIO_DEFINED */