From b78f7b35ef162d23ee7a213e78d3a60125e1f60d Mon Sep 17 00:00:00 2001 From: Piotr Caban Date: Mon, 16 Apr 2012 15:21:47 +0200 Subject: [PATCH] msvcrt: Fixed 'h' modifier handling when printing integers. (cherry picked from commit 0cc16fc8a56ef9511366dec8a904cd8da34b661c) --- dlls/msvcrt/printf.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h index b1cb53f886c..cfba4b76edd 100644 --- a/dlls/msvcrt/printf.h +++ b/dlls/msvcrt/printf.h @@ -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, VT_I8, valist).get_longlong); else if(flags.Format=='d' || flags.Format=='i') - FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, pf_args(args_ctx, pos, - VT_INT, valist).get_int); + FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, flags.IntegerLength!='h' ? + pf_args(args_ctx, pos, VT_INT, valist).get_int : + (short)pf_args(args_ctx, pos, VT_INT, valist).get_int); else - FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, (unsigned)pf_args( - args_ctx, pos, VT_INT, valist).get_int); + FUNC_NAME(pf_integer_conv)(tmp, max_len, &flags, flags.IntegerLength!='h' ? + (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 i = FUNC_NAME(pf_output_format_wstr)(pf_puts, puts_ctx, tmp, -1, &flags, locinfo); -- 2.11.4.GIT