ucrtbase/tests: Directly use ucrtbase functions in scanf.c.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-03-12 17:22:02 +01:00 committed by Alexandre Julliard
parent d6f5afdd3d
commit c3165b4c96
1 changed files with 3 additions and 27 deletions

View File

@ -27,38 +27,16 @@
#include "wine/test.h" #include "wine/test.h"
static int (__cdecl *p_vsscanf)(unsigned __int64 options, const char *str, size_t len, const char *format,
void *locale, __ms_va_list valist);
static BOOL init(void)
{
HMODULE hmod = LoadLibraryA("ucrtbase.dll");
if (!hmod)
{
win_skip("ucrtbase.dll not installed\n");
return FALSE;
}
p_vsscanf = (void *)GetProcAddress(hmod, "__stdio_common_vsscanf");
return TRUE;
}
static int WINAPIV vsscanf_wrapper(unsigned __int64 options, const char *str, size_t len, const char *format, ...) static int WINAPIV vsscanf_wrapper(unsigned __int64 options, const char *str, size_t len, const char *format, ...)
{ {
int ret; int ret;
__ms_va_list valist; __ms_va_list valist;
__ms_va_start(valist, format); __ms_va_start(valist, format);
ret = p_vsscanf(options, str, len, format, NULL, valist); ret = __stdio_common_vsscanf(options, str, len, format, NULL, valist);
__ms_va_end(valist); __ms_va_end(valist);
return ret; return ret;
} }
#define UCRTBASE_SCANF_SECURECRT (0x0001)
#define UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS (0x0002)
#define UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY (0x0004)
static void test_sscanf(void) static void test_sscanf(void)
{ {
static const float float1 = -82.6267f, float2 = 27.76f; static const float float1 = -82.6267f, float2 = 27.76f;
@ -74,8 +52,8 @@ static void test_sscanf(void)
static const unsigned int tests[] = static const unsigned int tests[] =
{ {
0, 0,
UCRTBASE_SCANF_LEGACY_WIDE_SPECIFIERS, _CRT_INTERNAL_SCANF_LEGACY_WIDE_SPECIFIERS,
UCRTBASE_SCANF_LEGACY_MSVCRT_COMPATIBILITY, _CRT_INTERNAL_SCANF_LEGACY_MSVCRT_COMPATIBILITY,
}; };
for (i = 0; i < ARRAY_SIZE(tests); ++i) for (i = 0; i < ARRAY_SIZE(tests); ++i)
@ -316,7 +294,5 @@ static void test_sscanf(void)
START_TEST(scanf) START_TEST(scanf)
{ {
if (!init()) return;
test_sscanf(); test_sscanf();
} }