From 0c27cfc9b03ab2578b77e35abb8034831276d8de Mon Sep 17 00:00:00 2001 From: Keith Marshall Date: Wed, 29 Jul 2009 07:22:51 +0000 Subject: [PATCH] Correct disposition of wchar_t output in printf(). --- winsup/mingw/ChangeLog | 8 ++++++++ winsup/mingw/mingwex/stdio/pformat.c | 7 +++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/winsup/mingw/ChangeLog b/winsup/mingw/ChangeLog index c960e6762..dbb0a2148 100644 --- a/winsup/mingw/ChangeLog +++ b/winsup/mingw/ChangeLog @@ -1,3 +1,11 @@ +2009-07-29 Keith Marshall + + Correct disposition of wchar_t output in printf(). + + mingwex/stdio/pformat.c (__pformat) [%C]: Create new instance of... + (argval): ...this, in inner scope, with singular type `wchar_t'; use + it to pass one wchar to __pformat_wputchars(), for output. + 2009-07-27 Chris Sutcliffe * mingwex/stdio/pformat.c: Implement better fix for type punned warning. diff --git a/winsup/mingw/mingwex/stdio/pformat.c b/winsup/mingw/mingwex/stdio/pformat.c index 4b6ebcb5a..a59d5130f 100644 --- a/winsup/mingw/mingwex/stdio/pformat.c +++ b/winsup/mingw/mingwex/stdio/pformat.c @@ -734,8 +734,7 @@ char *__pformat_cvt( int mode, __pformat_fpreg_t x, int nd, int *dp, int *sign ) * his `__gdtoa()' function in a manner to provide extended precision * replacements for `ecvt()' and `fcvt()'. */ - int k; - unsigned int e = 0; char *ep; + int k; unsigned int e = 0; char *ep; static FPI fpi = { 64, 1-16383-64+1, 32766-16383-64+1, FPI_Round_near, 0 }; /* Classify the argument into an appropriate `__gdtoa()' category... @@ -1882,8 +1881,8 @@ int __pformat( int flags, void *dest, int max, const char *fmt, va_list argv ) /* considering any `long' type modifier as a reference to * `wchar_t' data, (which is promoted to an `int' argument)... */ - argval.__pformat_ullong_t = (wchar_t)(va_arg( argv, int )); - __pformat_wputchars( (wchar_t *)argval.__pformat_ptr_t, 1, &stream ); + wchar_t argval = (wchar_t)(va_arg( argv, int )); + __pformat_wputchars( &argval, 1, &stream ); } else