Since Mike McCormack's printf patch has our own vsnprintf parsing the format strings, but yet we still push integers to libc's printf, I figured that we can handle the 'I' (eye) size type now. I hacked together a patch that handles it and fixes 3 test failures with long long. It fixes it by converting I (eye) and I32 to long, and I64 to long long. 'll' (ell ell) is translated to be long only.
Mike, I have a question. You have flags.IntegerDouble++; on the case of long long -- what were you planning on doing with it? Other than that it is unused. I decided to use it as the flag for long long.
Patch below.
Jesse
--- dlls/msvcrt/wcs.c-original 2005-02-14 16:14:01.000000000 -0700 +++ dlls/msvcrt/wcs.c 2005-02-14 17:48:39.000000000 -0700 @@ -378,6 +378,16 @@ sprintf(p, ".%d", flags->Precision); p += strlen(p); } + if( flags->IntegerLength ) + { + sprintf(p, "%c", flags->IntegerLength); + p += strlen(p); + } + if( flags->IntegerDouble ) + { + sprintf(p, "l"); + p += strlen(p); + } *p++ = flags->Format; *p++ = 0; } @@ -474,12 +484,28 @@ { if( *p == 'h' || *p == 'l' || *p == 'L' ) { - if( flags.IntegerLength == *p ) /* FIXME: this is wrong */ - flags.IntegerDouble++; - else + if( flags.IntegerLength != *p ) flags.IntegerLength = *p; p++; } + else if( *p == 'I' ) + { + if ( *(p+1) == '3' && *(p+2) == '2' ) + { + /* Unchecked on 64-bit systems */ + flags.IntegerLength = 'l'; + p += 3; + } else if ( *(p+1) == '6' && *(p+2) == '4' ) { + flags.IntegerLength = 'l'; + flags.IntegerDouble++; /* Why ++? */ + p += 3; + } else { + /* FIXME: 'I' modifier needs to produce + 64-bit number output on 64-bit systems! */ + flags.IntegerLength = 'l'; + p++; + } + } else if( *p == 'w' ) flags.WideString = *p++; else @@ -567,6 +593,8 @@
if( pf_is_double_format( flags.Format ) ) sprintf( number, fmt, va_arg(valist, double) ); + else if ( flags.IntegerDouble ) + sprintf( number, fmt, va_arg(valist, long long) ); else sprintf( number, fmt, va_arg(valist, int) );