summary refs log tree commit diff
path: root/wcsmbs/wcsrtombs.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-19 07:29:43 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-19 07:29:43 +0000
commit6a07e1f8df9bee9a7d8bd87f27d796bd671a5109 (patch)
tree3e4d935fe8a8662db3048b9abf32332888322ba7 /wcsmbs/wcsrtombs.c
parenta5334a6807f9ee2b321c78483a0519e82aa667aa (diff)
downloadglibc-6a07e1f8df9bee9a7d8bd87f27d796bd671a5109.tar.gz
glibc-6a07e1f8df9bee9a7d8bd87f27d796bd671a5109.tar.xz
glibc-6a07e1f8df9bee9a7d8bd87f27d796bd671a5109.zip
Update.
	* wcsmbs/mbrtowc.c: Create temporary state object if no output is
	written.
	* wcsmbs/mbsrtowcs.c: Likewise.
	* wcsmbs/wcrtomb.c: Likewise.
	* wcsmbs/wcsrtombs.c: Likewise.

	* wcsmbs/wcrtomb.c: Compute result correctly for successful call
	with s == NULL.
Diffstat (limited to 'wcsmbs/wcsrtombs.c')
-rw-r--r--wcsmbs/wcsrtombs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index a8105d5b85..6058db72c1 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1996, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
 
@@ -60,11 +60,15 @@ __wcsrtombs (dst, src, len, ps)
   /* We have to handle DST == NULL special.  */
   if (dst == NULL)
     {
+      mbstate_t temp_state;
       unsigned char buf[256];		/* Just an arbitrary value.  */
       const wchar_t *srcend = *src + __wcslen (*src) + 1;
       const wchar_t *inbuf = *src;
       size_t dummy;
 
+      temp_state = *data.__statep;
+      data.__statep = &temp_state;
+
       result = 0;
       data.__outbufend = buf + sizeof (buf);