msvcr120: Added vsscanf() and vswscanf().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2017-09-23 20:16:45 +03:00 committed by Alexandre Julliard
parent 9463c52df6
commit 1b2554c2c3
4 changed files with 50 additions and 4 deletions

View File

@ -2436,10 +2436,10 @@
@ stub vscanf_s
@ cdecl vsprintf(ptr str ptr) MSVCRT_vsprintf
@ cdecl vsprintf_s(ptr long str ptr) MSVCRT_vsprintf_s
@ stub vsscanf
@ cdecl vsscanf(ptr str ptr) MSVCRT_vsscanf
@ stub vsscanf_s
@ cdecl vswprintf_s(ptr long wstr ptr) MSVCRT_vswprintf_s
@ stub vswscanf
@ cdecl vswscanf(ptr wstr ptr) MSVCRT_vswscanf
@ stub vswscanf_s
@ cdecl vwprintf(wstr ptr) MSVCRT_vwprintf
@ cdecl vwprintf_s(wstr ptr) MSVCRT_vwprintf_s

View File

@ -183,6 +183,7 @@ static int (CDECL *p__clearfp)(void);
static _locale_t (__cdecl *p_wcreate_locale)(int, const wchar_t *);
static void (__cdecl *p_free_locale)(_locale_t);
static unsigned short (__cdecl *p_wctype)(const char*);
static int (__cdecl *p_vsscanf)(const char*, const char *, __ms_va_list valist);
/* make sure we use the correct errno */
#undef errno
@ -240,6 +241,7 @@ static BOOL init(void)
SET(p_wctype, "wctype");
SET(p_fegetenv, "fegetenv");
SET(p__clearfp, "_clearfp");
SET(p_vsscanf, "vsscanf");
if(sizeof(void*) == 8) { /* 64-bit initialization */
SET(p_critical_section_ctor,
"??0critical_section@Concurrency@@QEAA@XZ");
@ -911,6 +913,29 @@ static void test_wctype(void)
}
}
static int __cdecl _vsscanf_wrapper(const char *buffer, const char *format, ...)
{
int ret;
__ms_va_list valist;
__ms_va_start(valist, format);
ret = p_vsscanf(buffer, format, valist);
__ms_va_end(valist);
return ret;
}
static void test_vsscanf(void)
{
static const char *fmt = "%d";
char buff[16];
int ret, v;
v = 0;
strcpy(buff, "10");
ret = _vsscanf_wrapper(buff, fmt, &v);
ok(ret == 1, "Unexpected ret %d.\n", ret);
ok(v == 10, "got %d.\n", v);
}
START_TEST(msvcr120)
{
if (!init()) return;
@ -928,4 +953,5 @@ START_TEST(msvcr120)
test__wcreate_locale();
test__Condition_variable();
test_wctype();
test_vsscanf();
}

View File

@ -2098,10 +2098,10 @@
@ stub vscanf_s
@ cdecl vsprintf(ptr str ptr) msvcr120.vsprintf
@ cdecl vsprintf_s(ptr long str ptr) msvcr120.vsprintf_s
@ stub vsscanf
@ cdecl vsscanf(ptr str ptr) msvcr120.vsscanf
@ stub vsscanf_s
@ cdecl vswprintf_s(ptr long wstr ptr) msvcr120.vswprintf_s
@ stub vswscanf
@ cdecl vswscanf(ptr wstr ptr) msvcr120.vswscanf
@ stub vswscanf_s
@ cdecl vwprintf(wstr ptr) msvcr120.vwprintf
@ cdecl vwprintf_s(wstr ptr) msvcr120.vwprintf_s

View File

@ -795,3 +795,23 @@ int CDECL MSVCRT__snwscanf_s_l(MSVCRT_wchar_t *input, MSVCRT_size_t length,
__ms_va_end(valist);
return res;
}
/*********************************************************************
* vsscanf (MSVCRT120.@)
*/
int CDECL MSVCRT_vsscanf(const char *buffer, const char *format, __ms_va_list valist)
{
if (!MSVCRT_CHECK_PMT(buffer != NULL && format != NULL)) return -1;
return MSVCRT_vsscanf_l(buffer, format, NULL, valist);
}
/*********************************************************************
* vswscanf (MSVCRT120.@)
*/
int CDECL MSVCRT_vswscanf(const MSVCRT_wchar_t *buffer, const MSVCRT_wchar_t *format, __ms_va_list valist)
{
if (!MSVCRT_CHECK_PMT(buffer != NULL && format != NULL)) return -1;
return MSVCRT_vswscanf_l(buffer, format, NULL, valist);
}