Peter Oberndorfer : msvcrt: Implement %p for scanf.

Alexandre Julliard julliard at winehq.org
Wed Jul 2 06:03:29 CDT 2008


Module: wine
Branch: master
Commit: 9e3a4652dafbcf1f3f957858a54f2149e91942b7
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9e3a4652dafbcf1f3f957858a54f2149e91942b7

Author: Peter Oberndorfer <kumbayo84 at arcor.de>
Date:   Tue Jul  1 21:15:00 2008 +0200

msvcrt: Implement %p for scanf.

---

 dlls/msvcrt/scanf.h       |    4 +++-
 dlls/msvcrt/tests/scanf.c |    2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h
index 07c64e8..c236f48 100644
--- a/dlls/msvcrt/scanf.h
+++ b/dlls/msvcrt/scanf.h
@@ -149,6 +149,8 @@ _FUNCTION_ {
 	    }
 	    /* read type */
             switch(*format) {
+	    case 'p':
+	    case 'P': /* pointer. */
 	    case 'x':
 	    case 'X': /* hexadecimal integer. */
 		base = 16;
@@ -179,7 +181,7 @@ _FUNCTION_ {
 			if (width>0) width--;
                     }
 		    /* look for leading indication of base */
-		    if (width!=0 && nch == '0') {
+		    if (width!=0 && nch == '0' && *format != 'p' && *format != 'P') {
                         nch = _GETC_(file);
 			if (width>0) width--;
 			seendigit=1;
diff --git a/dlls/msvcrt/tests/scanf.c b/dlls/msvcrt/tests/scanf.c
index c2a695b..b152eac 100644
--- a/dlls/msvcrt/tests/scanf.c
+++ b/dlls/msvcrt/tests/scanf.c
@@ -41,7 +41,6 @@ static void test_sscanf( void )
     ok( ret == EOF,"sscanf returns %x instead of %x\n", ret, EOF );
 
     /* check %p */
-    todo_wine {
     ok( sscanf("000000000046F170", "%p", &ptr) == 1, "sscanf failed\n"  );
     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( ptr == (void *)0x1234,"sscanf reads %p instead of %x\n", ptr, 0x1234 );
-    }
 
     /* check %x */
     strcpy(buffer,"0x519");




More information about the wine-cvs mailing list