[PATCH v3 3/7] msvcrt: Ignore 'N' as format length modifier for pointers, just like 'F'
Martin Storsjo
martin at martin.st
Tue Nov 3 04:12:20 CST 2015
Signed-off-by: Martin Storsjo <martin at martin.st>
---
v2: Rebased on top of the updated version of preceding patches.
v3: Unchanged, previously approved by Piotr.
---
dlls/msvcrt/printf.h | 2 +-
dlls/msvcrt/tests/printf.c | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h
index 91b27ad..a724404 100644
--- a/dlls/msvcrt/printf.h
+++ b/dlls/msvcrt/printf.h
@@ -461,7 +461,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
p++;
} else if(*p == 'w')
flags.WideString = *p++;
- else if(*p == 'F')
+ else if(*p == 'F' || *p == 'N')
p++; /* ignore */
else
break;
diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index 2de515d..c5bc102 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -413,6 +413,11 @@ static void test_sprintf( void )
ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
ok( r==16, "return count wrong\n");
+ format = "%Np";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"0000000000000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
+ ok( r==16, "return count wrong\n");
+
format = "%#-020p";
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X0000000000000039 "),"Pointer formatted incorrectly\n");
@@ -435,6 +440,11 @@ static void test_sprintf( void )
ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
ok( r==8, "return count wrong\n");
+ format = "%Np";
+ r = sprintf(buffer,format,(void *)57);
+ ok(!strcmp(buffer,"00000039"),"Pointer formatted incorrectly \"%s\"\n",buffer);
+ ok( r==8, "return count wrong\n");
+
format = "%#-012p";
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted incorrectly\n");
@@ -670,6 +680,11 @@ static void test_sprintf( void )
ok(!strcmp(buffer,""), "failed\n");
ok( r==0, "return count wrong\n");
+ format = "%N";
+ r = sprintf(buffer, format,-1);
+ ok(!strcmp(buffer,""), "failed\n");
+ ok( r==0, "return count wrong\n");
+
format = "%H";
r = sprintf(buffer, format,-1);
ok(!strcmp(buffer,"H"), "failed\n");
--
1.8.1.2
More information about the wine-patches
mailing list