OSDN Git Service

Fix a silly bug in _wstdio_fwrite. wprintf %s should now work correctly.
authorManuel Novoa III <mjn3@codepoet.org>
Sun, 5 Jan 2003 04:47:26 +0000 (04:47 -0000)
committerManuel Novoa III <mjn3@codepoet.org>
Sun, 5 Jan 2003 04:47:26 +0000 (04:47 -0000)
TODO
libc/stdio/stdio.c

diff --git a/TODO b/TODO
index 88be58f..5a9fa22 100644 (file)
--- a/TODO
+++ b/TODO
@@ -22,7 +22,7 @@ I'm currently working on completing the wide char and locale support.
 
   1) Little things that need fixing:
   ----------------------------------
-  *) Fix bugs in *printf:  wprintf %ls bug ; outdigit precison bug
+  *) Fix bug in *printf: outdigit precison bug
   a) Use locale decimal point in *printf() and strto*d() -- slightly
      complicated by the fact that at least one locale uses a wchar
      radix that does not map to a single byte in UTF-8.
index e39cf52..7db727c 100644 (file)
@@ -48,6 +48,8 @@
  *
  *  Nov 21, 2002
  *  Added internal function _wstdio_fwrite.
+ *  Jan 3, 2003
+ *  Fixed a bug in _wstdio_fwrite.
  */
 
 /* Before we include anything, convert L_ctermid to L_ctermid_function
@@ -3514,7 +3516,7 @@ size_t _wstdio_fwrite(const wchar_t *__restrict ws, size_t n,
        pw = ws;
        count = 0;
        while (n > count) {
-               r = wcsnrtombs(buf, &pw, n, sizeof(buf), &stream->state);
+               r = wcsnrtombs(buf, &pw, n-count, sizeof(buf), &stream->state);
                if (r != ((size_t) -1)) { /* No encoding errors */
                        if (!r) {
                                ++r;              /* 0 is returned when nul is reached. */