msvcrt: scanf fix a typo
Austin English
austinenglish at gmail.com
Fri Sep 19 16:59:59 CDT 2008
On Fri, Sep 19, 2008 at 4:51 PM, James Hawkins <truiken at gmail.com> wrote:
> On Fri, Sep 19, 2008 at 4:39 PM, Austin English <austinenglish at gmail.com> wrote:
>> Found using -Werror (strangely, didn't occur on ubuntu, but does on
>> PC-BSD)...Must be the gcc version.
>>
>
> @@ -63,7 +63,7 @@ static void test_sscanf( void )
> ok( sscanf("1233", "%p", &ptr) == 1, "sscanf failed\n" );
> ok( ptr == (void *)0x1233,"sscanf reads %p instead of %x\n", ptr, 0x1233 );
>
> - ok( sscanf("1234", "%P", &ptr) == 1, "sscanf failed\n" );
> + ok( sscanf("1234", "%p", &ptr) == 1, "sscanf failed\n" );
> ok( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 );
>
> How do you figure that's a typo? The test right above it is exactly
> the same as what you've changed this one to. I didn't write the test,
> but I'm pretty sure the original author meant to test both cases.
> This is a good reason why tests should be commented, so the author's
> intent is well known.
>
> --
> James Hawkins
>
Relevant code:
/* check %p with no hex digits */
ok( sscanf("1233", "%p", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x1233,"sscanf reads %p instead of %x\n", ptr, 0x1233 );
ok( sscanf("1234", "%P", &ptr) == 1, "sscanf failed\n" );
ok( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 );
Comment reads %p. All the other chars are lower case, and you can see
the values are different (1233 vs 1234).
-Austin
More information about the wine-devel
mailing list