Commit 5a3695cc authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcrt: Make WEOF returned from swscanf signed.

parent 739bd884
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#ifdef WIDE_SCANF #ifdef WIDE_SCANF
#define _CHAR_ MSVCRT_wchar_t #define _CHAR_ MSVCRT_wchar_t
#define _EOF_ MSVCRT_WEOF #define _EOF_ MSVCRT_WEOF
#define _EOF_RET MSVCRT_WEOF #define _EOF_RET (short)MSVCRT_WEOF
#define _ISSPACE_(c) MSVCRT_iswspace(c) #define _ISSPACE_(c) MSVCRT_iswspace(c)
#define _ISDIGIT_(c) MSVCRT_iswdigit(c) #define _ISDIGIT_(c) MSVCRT_iswdigit(c)
#define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */ #define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */
......
...@@ -243,8 +243,25 @@ static void test_sscanf_s(void) ...@@ -243,8 +243,25 @@ static void test_sscanf_s(void)
ok(i==123, "i = %d\n", i); ok(i==123, "i = %d\n", i);
} }
static void test_swscanf( void )
{
wchar_t buffer[100];
int result, ret;
static const WCHAR formatd[] = {'%','d',0};
/* check WEOF */
/* WEOF is an unsigned short -1 but swscanf returns int
so it should be sign-extended */
buffer[0] = 0;
ret = swscanf(buffer, formatd, &result);
/* msvcrt returns 0 but should return -1 (later versions do) */
ok( ret == (short)WEOF || broken(ret == 0),
"swscanf returns %x instead of %x\n", ret, WEOF );
}
START_TEST(scanf) START_TEST(scanf)
{ {
test_sscanf(); test_sscanf();
test_sscanf_s(); test_sscanf_s();
test_swscanf();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment