OSDN Git Service

Correct disposition of wchar_t output in printf().
authorkeithmarshall <keithmarshall>
Wed, 29 Jul 2009 07:22:50 +0000 (07:22 +0000)
committerkeithmarshall <keithmarshall>
Wed, 29 Jul 2009 07:22:50 +0000 (07:22 +0000)
winsup/mingw/ChangeLog
winsup/mingw/mingwex/stdio/pformat.c

index c960e67..dbb0a21 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-29  Keith Marshall  <keithmarshall@users.sourceforge.net>
+
+       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  <ir0nh34d@users.sourceforge.net>
 
        * mingwex/stdio/pformat.c: Implement better fix for type punned warning.
index 4b6ebcb..a59d513 100644 (file)
@@ -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