Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/locale C89/AMD1: mbsrtowcs() and wcsrtombs() are no...



details:   https://anonhg.NetBSD.org/src/rev/5e0e7e9b804a
branches:  trunk
changeset: 510299:5e0e7e9b804a
user:      kleink <kleink%NetBSD.org@localhost>
date:      Sat May 26 13:18:42 2001 +0000

description:
C89/AMD1: mbsrtowcs() and wcsrtombs() are not to return the terminating
null; also correct the corresponding conversion loop exit in mbsrtowcs().
>From YAMAMOTO Takashi in PR lib/13016.

diffstat:

 lib/libc/locale/multibyte.c |  12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diffs (43 lines):

diff -r 880ff5786651 -r 5e0e7e9b804a lib/libc/locale/multibyte.c
--- a/lib/libc/locale/multibyte.c       Sat May 26 12:31:56 2001 +0000
+++ b/lib/libc/locale/multibyte.c       Sat May 26 13:18:42 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: multibyte.c,v 1.8 2001/02/06 18:48:41 christos Exp $   */
+/*     $NetBSD: multibyte.c,v 1.9 2001/05/26 13:18:42 kleink Exp $     */
 
 /*-
  * Copyright (c) 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)ansi.c     8.1 (Berkeley) 6/27/93";
 #else
-__RCSID("$NetBSD: multibyte.c,v 1.8 2001/02/06 18:48:41 christos Exp $");
+__RCSID("$NetBSD: multibyte.c,v 1.9 2001/05/26 13:18:42 kleink Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -379,10 +379,8 @@
                        (*s)++;
                        break;
                case 0:
-                       pwcs++;
-                       cnt++;
                        (*s)++;
-                       break;
+                       goto bye;
                default:
                        pwcs++;
                        cnt++;
@@ -473,10 +471,10 @@
                if (n - cnt < siz)
                        return cnt;
                memcpy(s, buf, siz);
+               if (!**pwcs)
+                       break;
                cnt += siz;
                s += siz;
-               if (!**pwcs)
-                       break;
                (*pwcs)++;
        }
 bye:



Home | Main Index | Thread Index | Old Index