[PATCH v2] msvcrt/tests: Be more explicit about sscanf() with %d/%hd/%hhd.
Piotr Caban
piotr.caban at gmail.com
Mon Feb 3 11:22:20 CST 2020
Hi Serge,
I think it's better to leave this test as is. I don't think that this
patch makes the tests easier to read.
Thanks,
Piotr
On 1/29/20 6:37 PM, Serge Gautherie wrote:
> Signed-off-by: Serge Gautherie <winehq-git_serge_180711 at gautherie.fr>
> ---
> Removed comments, added a cast.
> ---
> dlls/msvcrt/tests/scanf.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/dlls/msvcrt/tests/scanf.c b/dlls/msvcrt/tests/scanf.c
> index 57d9cc0..60e1f6c 100644
> --- a/dlls/msvcrt/tests/scanf.c
> +++ b/dlls/msvcrt/tests/scanf.c
> @@ -207,9 +207,14 @@ static void test_sscanf( void )
>
> result = 0xdeadbeef;
> strcpy(buffer,"12345678");
> - ret = p_sscanf(buffer, "%hd", &result);
> + ret = p_sscanf(buffer, "%d", &result);
> ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
> - ok(result == 0xdead614e, "Wrong number read (%x)\n", result);
> + 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 (%08x)\n", result);
>
> result = 0xdeadbeef;
> strcpy(buffer,"12345678");
> @@ -238,7 +243,7 @@ static void test_sscanf( void )
> result = 0xdeadbeef;
> ret = p_sscanf(buffer, "%hhd", &result);
> ok(ret == 1, "Wrong number of arguments read: %d\n", ret);
> - ok(result == 0xbc614e, "Wrong number read (%x)\n", result);
> + ok(result == 0x00bc614e, "Wrong number read (%08x)\n", result);
>
> strcpy(buffer,"12345678901234");
> ret = p_sscanf(buffer, "%lld", &result64);
>
More information about the wine-devel
mailing list