Commit 494572ed authored by Martin Storsjo's avatar Martin Storsjo Committed by Alexandre Julliard

msvcrt: Interpret 'I' as size_t size specifier for integer conversions.

parent b9d0f5d5
......@@ -34,7 +34,7 @@ typedef struct FUNC_NAME(pf_flags_t)
{
APICHAR Sign, LeftAlign, Alternate, PadZero;
int FieldLength, Precision;
APICHAR IntegerLength, IntegerDouble;
APICHAR IntegerLength, IntegerDouble, IntegerNative;
APICHAR WideString;
APICHAR Format;
} FUNC_NAME(pf_flags);
......@@ -470,7 +470,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
else if(isdigit(*(p+1)) || !*(p+1))
break;
else
p++;
flags.IntegerNative = *p++;
} else if(*p == 'w')
flags.WideString = *p++;
else if((*p == 'F' || *p == 'N') && legacy_msvcrt_compat)
......@@ -533,7 +533,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
if(!tmp)
return -1;
if(flags.IntegerDouble)
if(flags.IntegerDouble || (flags.IntegerNative && sizeof(void*) == 8))
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos,
VT_I8, valist).get_longlong);
else if(flags.Format=='d' || flags.Format=='i')
......
......@@ -422,6 +422,11 @@ static void test_sprintf( void )
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X0000000000000039 "),"Pointer formatted incorrectly\n");
ok( r==20, "return count wrong\n");
format = "%Ix %d";
r = sprintf(buffer,format,(size_t)0x12345678123456,1);
ok(!strcmp(buffer,"12345678123456 1"),"buffer = %s\n",buffer);
ok( r==16, "return count wrong\n");
}
else
{
......@@ -449,6 +454,11 @@ static void test_sprintf( void )
r = sprintf(buffer,format,(void *)57);
ok(!strcmp(buffer,"0X00000039 "),"Pointer formatted incorrectly\n");
ok( r==12, "return count wrong\n");
format = "%Ix %d";
r = sprintf(buffer,format,0x123456,1);
ok(!strcmp(buffer,"123456 1"),"buffer = %s\n",buffer);
ok( r==8, "return count wrong\n");
}
format = "%04s";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment