pf_vsnprintf implementatnion of 'I', 'I32' and 'I64' prefixes for type specifiers

Lukasz Janyst ljan at wp.pl
Mon Aug 1 14:44:29 CDT 2005


Hello,
    I've implemented 'I', 'I32' and 'I64' prefixes support
for pf_vsnprintf. This patch seems to resolve profile creation
issues in Warcraft 3.

Lukasz Janyst
-------------- next part --------------
Index: dlls/msvcrt/wcs.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/wcs.c,v
retrieving revision 1.25
diff -u -u -p -r1.25 wcs.c
--- dlls/msvcrt/wcs.c	3 Jul 2005 11:19:29 -0000	1.25
+++ dlls/msvcrt/wcs.c	1 Aug 2005 17:42:19 -0000
@@ -384,6 +384,12 @@ static void pf_rebuild_format_string( ch
         sprintf(p, ".%d", flags->Precision);
         p += strlen(p);
     }
+    if( flags->IntegerLength )
+    {
+        *p++ = flags->IntegerLength;
+        if( flags->IntegerDouble )
+            *p++ = flags->IntegerLength;
+    }
     *p++ = flags->Format;
     *p++ = 0;
 }
@@ -487,12 +493,24 @@ static int pf_vsnprintf( pf_output *out,
         {
             if( *p == 'h' || *p == 'l' || *p == 'L' )
             {
-                if( flags.IntegerLength == *p )  /* FIXME: this is wrong */
+                if( flags.IntegerLength == *p && *p != 'l' )  /* FIXME: this is wrong */
                     flags.IntegerDouble++;
                 else
                     flags.IntegerLength = *p;
                 p++;
             }
+            else if( *p == 'I' )
+            {
+                p++;
+                flags.IntegerLength = 'l';
+                if( *p == '3' )
+                    p += 2;
+                else if( *p == '6' )
+                {
+                    flags.IntegerDouble = 1;
+                    p += 2;
+                }
+            }
             else if( *p == 'w' )
                 flags.WideString = *p++;
             else if( *p == 'F' )
@@ -583,7 +601,12 @@ static int pf_vsnprintf( pf_output *out,
             if( pf_is_double_format( flags.Format ) )
                 sprintf( number, fmt, va_arg(valist, double) );
             else
-                sprintf( number, fmt, va_arg(valist, int) );
+            {
+                if( flags.IntegerDouble )
+                    sprintf( number, fmt, va_arg(valist, long long) );
+                else
+                    sprintf( number, fmt, va_arg(valist, int) );
+            }
 
             r = pf_output_stringA( out, number, -1 );
             if( x != number )


More information about the wine-patches mailing list