Piotr Caban : msvcrt: Support z length modifier in scanf.
Alexandre Julliard
julliard at winehq.org
Fri Feb 25 07:30:25 CST 2022
Module: wine
Branch: oldstable
Commit: efdd2b8a572f5da3fa728a6aecabc7ec8746cdd1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=efdd2b8a572f5da3fa728a6aecabc7ec8746cdd1
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Sep 20 20:51:32 2021 +0200
msvcrt: Support z length modifier in scanf.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 5d5f11c0029691abb8962e8125bde5dfd40ba249)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
dlls/msvcrt/scanf.h | 5 +++++
dlls/ucrtbase/tests/scanf.c | 7 +++++++
2 files changed, 12 insertions(+)
diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h
index d9b29821121..3ab2efef13d 100644
--- a/dlls/msvcrt/scanf.h
+++ b/dlls/msvcrt/scanf.h
@@ -281,6 +281,11 @@ _FUNCTION_ {
format += 2;
}
break;
+#if _MSVCR_VER == 0 || _MSVCR_VER >= 140
+ case 'z':
+ if (sizeof(void *) == sizeof(LONGLONG)) I64_prefix = 1;
+ break;
+#endif
default:
prefix_finished = 1;
}
diff --git a/dlls/ucrtbase/tests/scanf.c b/dlls/ucrtbase/tests/scanf.c
index 2d469d2b04a..3d77746d23b 100644
--- a/dlls/ucrtbase/tests/scanf.c
+++ b/dlls/ucrtbase/tests/scanf.c
@@ -48,6 +48,7 @@ static void test_sscanf(void)
float ret_float1, ret_float2;
double double_res;
unsigned int i;
+ size_t ret_size;
static const unsigned int tests[] =
{
@@ -289,6 +290,12 @@ static void test_sscanf(void)
ret = vsscanf_wrapper(tests[i], "infi", -1, "%lf%n", &double_res, &count);
ok(ret == -1, "sscanf returned %d for flags %#x\n", ret, tests[i]);
+
+ ret_size = ~0;
+ ret = vsscanf_wrapper(tests[i], "1", -1, "%zd", &ret_size);
+ ok(ret == 1, "sscanf returned %d for flags %#x\n", ret, tests[i]);
+ ok(ret_size == 1, "got wrong size_t %s for flags %#x\n",
+ wine_dbgstr_longlong((LONGLONG)ret_size), tests[i]);
}
}
More information about the wine-cvs
mailing list