Commit 9e3a4652 authored by Peter Oberndorfer's avatar Peter Oberndorfer Committed by Alexandre Julliard

msvcrt: Implement %p for scanf.

parent 02fb99e6
...@@ -149,6 +149,8 @@ _FUNCTION_ { ...@@ -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_ { ...@@ -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 ) ...@@ -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 ) ...@@ -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");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment