about summary refs log tree commit diff
path: root/wcsmbs/mbsrtowcs.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/mbsrtowcs.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/mbsrtowcs.c')
-rw-r--r--wcsmbs/mbsrtowcs.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index 7c55fec213..f8c39e69bb 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -62,10 +62,14 @@ __mbsrtowcs (dst, src, len, ps)
   /* We have to handle DST == NULL special.  */
   if (dst == NULL)
     {
+      mbstate_t temp_state;
       wchar_t buf[64];		/* Just an arbitrary size.  */
       const unsigned char *inbuf = (const unsigned char *) *src;
       const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
 
+      temp_state = *data.__statep;
+      data.__statep = &temp_state;
+
       result = 0;
       data.__outbufend = (char *) buf + sizeof (buf);
       do