msvcrt: Fixed 'h' modifier handling when printing integers.
This commit is contained in:
parent
5c9ca5cb53
commit
0cc16fc8a5
@ -525,11 +525,13 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
|
|||||||
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos,
|
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos,
|
||||||
VT_I8, valist).get_longlong);
|
VT_I8, valist).get_longlong);
|
||||||
else if(flags.Format=='d' || flags.Format=='i')
|
else if(flags.Format=='d' || flags.Format=='i')
|
||||||
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos,
|
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, flags.IntegerLength!='h' ?
|
||||||
VT_INT, valist).get_int);
|
pf_args(args_ctx, pos, VT_INT, valist).get_int :
|
||||||
|
(short)pf_args(args_ctx, pos, VT_INT, valist).get_int);
|
||||||
else
|
else
|
||||||
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, (unsigned)pf_args(
|
FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, flags.IntegerLength!='h' ?
|
||||||
args_ctx, pos, VT_INT, valist).get_int);
|
(unsigned)pf_args(args_ctx, pos, VT_INT, valist).get_int :
|
||||||
|
(unsigned short)pf_args(args_ctx, pos, VT_INT, valist).get_int);
|
||||||
|
|
||||||
#ifdef PRINTF_WIDE
|
#ifdef PRINTF_WIDE
|
||||||
i = FUNC_NAME(pf_output_format_wstr)(pf_puts, puts_ctx, tmp, -1, &flags, locinfo);
|
i = FUNC_NAME(pf_output_format_wstr)(pf_puts, puts_ctx, tmp, -1, &flags, locinfo);
|
||||||
|
@ -607,6 +607,16 @@ static void test_sprintf( void )
|
|||||||
r = sprintf(buffer, format);
|
r = sprintf(buffer, format);
|
||||||
ok(!strcmp(buffer,"%0"), "failed: \"%s\"\n", buffer);
|
ok(!strcmp(buffer,"%0"), "failed: \"%s\"\n", buffer);
|
||||||
ok( r==2, "return count wrong\n");
|
ok( r==2, "return count wrong\n");
|
||||||
|
|
||||||
|
format = "%hx";
|
||||||
|
r = sprintf(buffer, format, 0x12345);
|
||||||
|
ok(!strcmp(buffer,"2345"), "failed \"%s\"\n", buffer);
|
||||||
|
|
||||||
|
format = "%hhx";
|
||||||
|
r = sprintf(buffer, format, 0x123);
|
||||||
|
ok(!strcmp(buffer,"123"), "failed: \"%s\"\n", buffer);
|
||||||
|
r = sprintf(buffer, format, 0x12345);
|
||||||
|
ok(!strcmp(buffer,"2345"), "failed \"%s\"\n", buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_swprintf( void )
|
static void test_swprintf( void )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user