From f36671c57f5db8a08a1e97d3196a7d76ee480f08 Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Thu, 22 Apr 2010 13:54:03 +0200 Subject: [PATCH] msvcrt: Added _cwscanf* implementation. --- dlls/msvcr80/msvcr80.spec | 8 +++--- dlls/msvcr90/msvcr90.spec | 8 +++--- dlls/msvcrt/msvcrt.spec | 8 +++--- dlls/msvcrt/scanf.c | 67 +++++++++++++++++++++++++++++++++++++++++++++++ dlls/msvcrt/scanf.h | 8 ++++++ 5 files changed, 87 insertions(+), 12 deletions(-) diff --git a/dlls/msvcr80/msvcr80.spec b/dlls/msvcr80/msvcr80.spec index 938f61014cc..53cef753e1e 100644 --- a/dlls/msvcr80/msvcr80.spec +++ b/dlls/msvcr80/msvcr80.spec @@ -355,10 +355,10 @@ @ stub _cwprintf_p_l @ stub _cwprintf_s @ stub _cwprintf_s_l -@ stub _cwscanf -@ stub _cwscanf_l -@ stub _cwscanf_s -@ stub _cwscanf_s_l +@ varargs _cwscanf(wstr) msvcrt._cwscanf +@ varargs _cwscanf_l(wstr ptr) msvcrt._cwscanf_l +@ varargs _cwscanf_s(wstr) msvcrt._cwscanf_s +@ varargs _cwscanf_s_l(wstr ptr) msvcrt._cwscanf_s_l @ extern _daylight msvcrt._daylight @ cdecl _decode_pointer(ptr) msvcr90._decode_pointer @ cdecl _difftime32(long long) msvcrt._difftime32 diff --git a/dlls/msvcr90/msvcr90.spec b/dlls/msvcr90/msvcr90.spec index 3f9de550b41..d8f8e049594 100644 --- a/dlls/msvcr90/msvcr90.spec +++ b/dlls/msvcr90/msvcr90.spec @@ -347,10 +347,10 @@ @ stub _cwprintf_p_l @ stub _cwprintf_s @ stub _cwprintf_s_l -@ stub _cwscanf -@ stub _cwscanf_l -@ stub _cwscanf_s -@ stub _cwscanf_s_l +@ varargs _cwscanf(wstr) msvcrt._cwscanf +@ varargs _cwscanf_l(wstr ptr) msvcrt._cwscanf_l +@ varargs _cwscanf_s(wstr) msvcrt._cwscanf_s +@ varargs _cwscanf_s_l(wstr ptr) msvcrt._cwscanf_s_l @ extern _daylight msvcrt._daylight @ cdecl _decode_pointer(ptr) MSVCR90_decode_pointer @ cdecl _difftime32(long long) msvcrt._difftime32 diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index e9b898afeb2..0909cd0e235 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -329,10 +329,10 @@ # stub _cwprintf_p_l # stub _cwprintf_s # stub _cwprintf_s_l -# stub _cwscanf -# stub _cwscanf_l -# stub _cwscanf_s -# stub _cwscanf_s_l +@ varargs _cwscanf(wstr) +@ varargs _cwscanf_l(wstr ptr) +@ varargs _cwscanf_s(wstr) +@ varargs _cwscanf_s_l(wstr ptr) @ extern _daylight MSVCRT___daylight @ cdecl _difftime32(long long) MSVCRT__difftime32 @ cdecl _difftime64(long long) MSVCRT__difftime64 diff --git a/dlls/msvcrt/scanf.c b/dlls/msvcrt/scanf.c index 298d4c979b0..c795e154ce4 100644 --- a/dlls/msvcrt/scanf.c +++ b/dlls/msvcrt/scanf.c @@ -113,6 +113,17 @@ static int wchar2digit(MSVCRT_wchar_t c, int base) { #define SECURE 1 #include "scanf.h" +/* vcwscanf_l */ +#define WIDE_SCANF 1 +#define CONSOLE 1 +#undef STRING +#undef SECURE +#include "scanf.h" + +/* vcwscanf_s_l */ +#define SECURE 1 +#include "scanf.h" + /********************************************************************* * fscanf (MSVCRT.@) @@ -515,3 +526,59 @@ int CDECL _cscanf_s_l(const char *format, MSVCRT__locale_t locale, ...) __ms_va_end(valist); return res; } + +/********************************************************************* + * _cwscanf (MSVCRT.@) + */ +int CDECL _cwscanf(const char *format, ...) +{ + __ms_va_list valist; + int res; + + __ms_va_start(valist, format); + res = MSVCRT_vcwscanf_l(format, NULL, valist); + __ms_va_end(valist); + return res; +} + +/********************************************************************* + * _cwscanf_l (MSVCRT.@) + */ +int CDECL _cwscanf_l(const char *format, MSVCRT__locale_t locale, ...) +{ + __ms_va_list valist; + int res; + + __ms_va_start(valist, locale); + res = MSVCRT_vcwscanf_l(format, locale, valist); + __ms_va_end(valist); + return res; +} + +/********************************************************************* + * _cwscanf_s (MSVCRT.@) + */ +int CDECL _cwscanf_s(const char *format, ...) +{ + __ms_va_list valist; + int res; + + __ms_va_start(valist, format); + res = MSVCRT_vcwscanf_s_l(format, NULL, valist); + __ms_va_end(valist); + return res; +} + +/********************************************************************* + * _cwscanf_s_l (MSVCRT.@) + */ +int CDECL _cwscanf_s_l(const char *format, MSVCRT__locale_t locale, ...) +{ + __ms_va_list valist; + int res; + + __ms_va_start(valist, locale); + res = MSVCRT_vcwscanf_s_l(format, locale, valist); + __ms_va_end(valist); + return res; +} diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h index a5202feb149..6366a77bfc2 100644 --- a/dlls/msvcrt/scanf.h +++ b/dlls/msvcrt/scanf.h @@ -48,11 +48,19 @@ #ifdef CONSOLE #define _GETC_(file) (consumed++, _getch()) #define _UNGETC_(nch, file) do { _ungetch(nch); consumed--; } while(0) +#ifdef WIDE_SCANF +#ifdef SECURE +#define _FUNCTION_ static int MSVCRT_vcwscanf_s_l(const char *format, MSVCRT__locale_t locale, __ms_va_list ap) +#else /* SECURE */ +#define _FUNCTION_ static int MSVCRT_vcwscanf_l(const char *format, MSVCRT__locale_t locale, __ms_va_list ap) +#endif /* SECURE */ +#else /* WIDE_SCANF */ #ifdef SECURE #define _FUNCTION_ static int MSVCRT_vcscanf_s_l(const char *format, MSVCRT__locale_t locale, __ms_va_list ap) #else /* SECURE */ #define _FUNCTION_ static int MSVCRT_vcscanf_l(const char *format, MSVCRT__locale_t locale, __ms_va_list ap) #endif /* SECURE */ +#endif /* WIDE_SCANF */ #else #ifdef STRING #undef _EOF_ -- 2.11.4.GIT