Commit d99727bc authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msvcrt: Fix char to int promotion that breaks pattern lookup.

parent b0d4502c
......@@ -68,7 +68,11 @@
#undef _EOF_
#define _EOF_ 0
#ifdef STRING_LEN
#ifdef WIDE_CHAR
#define _GETC_(file) (consumed==length ? '\0' : (consumed++, *file++))
#else /* WIDE_CHAR */
#define _GETC_(file) (consumed==length ? '\0' : (consumed++, (unsigned char)*file++))
#endif /* WIDE_CHAR */
#define _UNGETC_(nch, file) do { file--; consumed--; } while(0)
#define _LOCK_FILE_(file) do {} while(0)
#define _UNLOCK_FILE_(file) do {} while(0)
......@@ -86,7 +90,11 @@
#endif /* SECURE */
#endif /* WIDE_SCANF */
#else /* STRING_LEN */
#ifdef WIDE_CHAR
#define _GETC_(file) (consumed++, *file++)
#else /* WIDE_CHAR */
#define _GETC_(file) (consumed++, (unsigned char)*file++)
#endif /* WIDE_CHAR */
#define _UNGETC_(nch, file) do { file--; consumed--; } while(0)
#define _LOCK_FILE_(file) do {} while(0)
#define _UNLOCK_FILE_(file) do {} while(0)
......
......@@ -244,6 +244,13 @@ static void test_sscanf( void )
ret = sscanf(buffer, "%d:%d%n", &hour, &min, &number_so_far);
ok(ret == 2, "Wrong number of arguments read: %d\n", ret);
ok(number_so_far == 4, "%%n yielded wrong result: %d\n", number_so_far);
buffer[0] = 0;
buffer1[0] = 0;
ret = sscanf("test=value\xda", "%[^=] = %[^;]", buffer, buffer1);
ok(ret == 2, "got %d\n", ret);
ok(!strcmp(buffer, "test"), "buf %s\n", buffer);
ok(!strcmp(buffer1, "value\xda"), "buf %s\n", buffer1);
}
static void test_sscanf_s(void)
......
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