[PATCH 2/2] msvcrt/tests: Work around sscanf("%hhd") not working yet.

Serge Gautherie winehq-git_serge_180711 at gautherie.fr
Sat Nov 2 21:51:37 CDT 2019


Signed-off-by: Serge Gautherie <winehq-git_serge_180711 at gautherie.fr>
---
The only correct result is 0xdeadbe4e, as in dlls/ucrtbase/tests/scanf.c,
but test fails on Windows/ReactOS too, until Wine code is fixed...
---
 dlls/msvcrt/tests/scanf.c | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/dlls/msvcrt/tests/scanf.c b/dlls/msvcrt/tests/scanf.c
index 07132e4..e2c619c 100644
--- a/dlls/msvcrt/tests/scanf.c
+++ b/dlls/msvcrt/tests/scanf.c
@@ -201,14 +201,24 @@ static void test_sscanf( void )
 
     result = 0xdeadbeef;
     strcpy(buffer,"12345678");
+    ret = p_sscanf(buffer, "%d", &result);
+    ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
+    /* int */
+    ok(result == 0x00bc614e, "Wrong number read (%08x)\n", result);
+
+    result = 0xdeadbeef;
     ret = p_sscanf(buffer, "%hd", (short *)&result);
     ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
-    ok(result == 0xdead614e, "Wrong number read (%x)\n", result);
+    /* int, truncated to short int */
+    ok(result == 0xdead614e, "Wrong number read (%08x)\n", result);
 
     result = 0xdeadbeef;
     ret = p_sscanf(buffer, "%hhd", (char *)&result);
     ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
-    ok(result == 0xbc614e, "Wrong number read (%x)\n", result);
+    /* int, NOT truncated to char: overflow! */
+    ok(result == 0x00bc614e, "Wrong number read (%08x)\n", result);
+    /* int, truncated to char: intended, but not working yet! */
+    todo_wine ok(result == 0xdeadbe4e || broken(result == 0x00bc614e), "Wrong number read (%08x)\n", result);
 
     strcpy(buffer,"12345678901234");
     ret = p_sscanf(buffer, "%lld", &result64);
-- 
2.10.0.windows.1




More information about the wine-devel mailing list