]> sourceware.org Git - newlib-cygwin.git/commitdiff
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Add code to correctly handle
authorCorinna Vinschen <corinna@vinschen.de>
Fri, 11 Jan 2013 20:05:41 +0000 (20:05 +0000)
committerCorinna Vinschen <corinna@vinschen.de>
Fri, 11 Jan 2013 20:05:41 +0000 (20:05 +0000)
's' format specifier on not _MB_CAPABLE targets.  Fix a formatting
glitch in _MB_CAPABLE enabled code.  Add a missing 'L' specifier.

newlib/ChangeLog
newlib/libc/stdio/vfwprintf.c

index e9c67ba125ca4ac239dfa6264abcacd1da901154..2a6d564e92cc34d7eac4f35293f475d28859b9c3 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-11  Corinna Vinschen  <vinschen@redhat.com>
+
+       * libc/stdio/vfwprintf.c (_VFWPRINTF_R): Add code to correctly handle
+       's' format specifier on not _MB_CAPABLE targets.  Fix a formatting
+       glitch in _MB_CAPABLE enabled code.  Add a missing 'L' specifier.
+
 2013-01-10  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
 
        * libc/machine/aarch64/Makefile.am (lib_a_SOURCES): Add
@@ -8,7 +14,7 @@
 
 2013-01-10  Marcus Shawcroft  <marcus.shawcroft@linaro.org>
 
-        * libc/machine/aarch64/Makefile.am (lib_a_SOURCES): Add
+       * libc/machine/aarch64/Makefile.am (lib_a_SOURCES): Add
        strnlen-stub.c and strnlen.S
        * libc/machine/aarch64/Makefile.in: Regenerated.
        * libc/machine/aarch64/strnlen-stub.c: New file.
index 968c218b53998fee29b1f00c11c8d0d18fe60d35..dfa8fde2fc8a8c812d163846127503d79895fa56 100644 (file)
@@ -1171,11 +1171,11 @@ string:
                                        insize = strlen(arg);
                                if (insize >= BUF) {
                                    if ((malloc_buf = (wchar_t *) _malloc_r (data, (insize + 1) * sizeof (wchar_t)))
-                                                               == NULL) {
-                                                       fp->_flags |= __SERR;
-                                                       goto error;
-                                               }
-                                               cp = malloc_buf;
+                                       == NULL) {
+                                               fp->_flags |= __SERR;
+                                               goto error;
+                                       }
+                                       cp = malloc_buf;
                                } else
                                        cp = buf;
                                memset ((_PTR)&ps, '\0', sizeof (mbstate_t));
@@ -1195,9 +1195,31 @@ string:
                                *p = L'\0';
                                size = p - cp;
                        }
-                       else
+#else
+                       if (ch != L'S' && !(flags & LONGINT)) {
+                               char *arg = (char *) cp;
+                               size_t insize = 0;
+
+                               if (prec >= 0) {
+                                       char *p = memchr (arg, '\0', prec);
+                                       insize = p ? p - arg : prec;
+                               } else
+                                       insize = strlen (arg);
+                               if (insize >= BUF) {
+                                   if ((malloc_buf = (wchar_t *) _malloc_r (data, (insize + 1) * sizeof (wchar_t)))
+                                       == NULL) {
+                                               fp->_flags |= __SERR;
+                                               goto error;
+                                       }
+                                       cp = malloc_buf;
+                               } else
+                                       cp = buf;
+                               for (size = 0; size < insize; ++size)
+                                       cp[size] = arg[size];
+                               cp[size] = L'\0';
+                       }
 #endif /* _MB_CAPABLE */
-                       if (prec >= 0) {
+                       else if (prec >= 0) {
                                /*
                                 * can't use wcslen; can only look for the
                                 * NUL in the first `prec' characters, and
@@ -1222,7 +1244,7 @@ string:
                case L'X':
                        xdigs = L"0123456789ABCDEF";
                        goto hex;
-               case 'x':
+               case L'x':
                        xdigs = L"0123456789abcdef";
 hex:                   _uquad = UARG ();
                        base = HEX;
This page took 0.058017 seconds and 5 git commands to generate.