Jesse Allen : msvcrt: Parse I, I32, and I64 integer size flags in printf.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 26 11:46:10 CST 2005


Module: wine
Branch: refs/heads/master
Commit: 6c70942a057644e926367a68486bc96222f1d573
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6c70942a057644e926367a68486bc96222f1d573

Author: Jesse Allen <the3dfxdude at gmail.com>
Date:   Mon Dec 26 13:00:01 2005 +0100

msvcrt: Parse I, I32, and I64 integer size flags in printf.

---

 dlls/msvcrt/tests/printf.c |   15 +++++++++++++++
 dlls/msvcrt/wcs.c          |   14 ++++++++++++++
 2 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c
index d96c61e..28ddf49 100644
--- a/dlls/msvcrt/tests/printf.c
+++ b/dlls/msvcrt/tests/printf.c
@@ -56,6 +56,21 @@ static void test_sprintf( void )
     ok(!strcmp(buffer, "I"), "Problem with \"I\" interpretation\n");
     ok( r==1, "return count wrong\n");
 
+    format = "%I0d";
+    r = sprintf(buffer,format,1);
+    ok(!strcmp(buffer,"I0d"),"I0d failed\n");
+    ok( r==3, "return count wrong\n");
+
+    format = "%I32d";
+    r = sprintf(buffer,format,1);
+    ok(!strcmp(buffer,"1"),"I32d failed\n");
+    ok( r==1, "return count wrong\n");
+
+    format = "%I64D";
+    r = sprintf(buffer,format,(LONGLONG)-1);
+    ok(!strcmp(buffer,"D"),"I64D failed: %s\n",buffer);
+    ok( r==1, "return count wrong\n");
+
     format = "% d";
     r = sprintf(buffer,format,1);
     ok(!strcmp(buffer, " 1"),"Problem with sign place-holder: '%s'\n",buffer);
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 83a713e..5ef929b 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -495,6 +495,20 @@ static int pf_vsnprintf( pf_output *out,
                     flags.IntegerLength = *p;
                 p++;
             }
+            else if( *p == 'I' )
+            {
+                if( *(p+1) == '6' && *(p+2) == '4' )
+                {
+                    flags.IntegerDouble++;
+                    p += 3;
+                }
+                else if( *(p+1) == '3' && *(p+2) == '2' )
+                    p += 3;
+                else if( isdigit(*(p+1)) || *(p+1) == 0 )
+                    break;
+                else
+                    p++;
+            }
             else if( *p == 'w' )
                 flags.WideString = *p++;
             else if( *p == 'F' )




More information about the wine-cvs mailing list