msvcrt: Implement %p for scanf.
This commit is contained in:
parent
02fb99e6b3
commit
9e3a4652da
|
@ -149,6 +149,8 @@ _FUNCTION_ {
|
||||||
}
|
}
|
||||||
/* read type */
|
/* read type */
|
||||||
switch(*format) {
|
switch(*format) {
|
||||||
|
case 'p':
|
||||||
|
case 'P': /* pointer. */
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X': /* hexadecimal integer. */
|
case 'X': /* hexadecimal integer. */
|
||||||
base = 16;
|
base = 16;
|
||||||
|
@ -179,7 +181,7 @@ _FUNCTION_ {
|
||||||
if (width>0) width--;
|
if (width>0) width--;
|
||||||
}
|
}
|
||||||
/* look for leading indication of base */
|
/* look for leading indication of base */
|
||||||
if (width!=0 && nch == '0') {
|
if (width!=0 && nch == '0' && *format != 'p' && *format != 'P') {
|
||||||
nch = _GETC_(file);
|
nch = _GETC_(file);
|
||||||
if (width>0) width--;
|
if (width>0) width--;
|
||||||
seendigit=1;
|
seendigit=1;
|
||||||
|
|
|
@ -41,7 +41,6 @@ static void test_sscanf( void )
|
||||||
ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF );
|
ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF );
|
||||||
|
|
||||||
/* check %p */
|
/* check %p */
|
||||||
todo_wine {
|
|
||||||
ok( sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n" );
|
ok( sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n" );
|
||||||
ok( ptr == (void *)0x46F170,"sscanf reads %p instead of %x\n", ptr, 0x46F170 );
|
ok( ptr == (void *)0x46F170,"sscanf reads %p instead of %x\n", ptr, 0x46F170 );
|
||||||
|
|
||||||
|
@ -66,7 +65,6 @@ static void test_sscanf( void )
|
||||||
|
|
||||||
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 );
|
ok( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 );
|
||||||
}
|
|
||||||
|
|
||||||
/* check %x */
|
/* check %x */
|
||||||
strcpy(buffer,"0x519");
|
strcpy(buffer,"0x519");
|
||||||
|
|
Loading…
Reference in New Issue