OSDN Git Service

* libc/stdio/vfprintf.c (_VFPRINTF_R): Just wave bytes invalid in
authorcorinna <corinna>
Thu, 14 Jan 2010 12:48:58 +0000 (12:48 +0000)
committercorinna <corinna>
Thu, 14 Jan 2010 12:48:58 +0000 (12:48 +0000)
the current charset through.

newlib/ChangeLog
newlib/libc/stdio/vfprintf.c

index 1afbaf6..d4f0c5d 100644 (file)
@@ -1,3 +1,18 @@
+2010-01-14  Corinna Vinschen  <corinna@vinschen.de>
+
+       * libc/stdio/vfprintf.c (_VFPRINTF_R): Just wave bytes invalid in
+       the current charset through.
+
+2010-01-13  Corinna Vinschen  <corinna@vinschen.de>
+
+       * libc/locale/locale.c (lc_ctype_charset): Disable defaulting to
+       "UTF-8" on Cygwin.
+       (lc_message_charset): Ditto.
+       (loadlocale): Disable setting charset of the "C" locale to "UTF-8" on
+       Cygwin.
+       * libc/stdlib/mbtowc_r.c (__mbtowc): Add Cygwin-specific comment.
+       * libc/stdlib/wctomb_r.c (__wctomb): Ditto.
+
 2010-01-11  Sebastian Huber <sebastian.huber@embedded-brains.de>
 
        * libc/posix/telldir.c (_cleanupdir): Fixed usage of freed memory.
index 7734858..fc33c30 100644 (file)
@@ -724,8 +724,13 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap),
                cp = fmt;
 #ifdef _MB_CAPABLE
                while ((n = __mbtowc (data, &wc, fmt, MB_CUR_MAX,
-                                     __locale_charset (), &state)) > 0) {
-                    if (wc == '%')
+                                     __locale_charset (), &state)) != 0) {
+                   if (n < 0) {
+                       /* Wave invalid chars through. */
+                       memset (&state, 0, sizeof state);
+                       n = 1;
+                   }
+                    else if (wc == '%')
                         break;
                     fmt += n;
                }