From 6a07e1f8df9bee9a7d8bd87f27d796bd671a5109 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 19 Jan 2000 07:29:43 +0000 Subject: 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. --- wcsmbs/mbrtowc.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'wcsmbs/mbrtowc.c') diff --git a/wcsmbs/mbrtowc.c b/wcsmbs/mbrtowc.c index cb0aa32bbc..2aeb67c154 100644 --- a/wcsmbs/mbrtowc.c +++ b/wcsmbs/mbrtowc.c @@ -34,6 +34,7 @@ static mbstate_t state; size_t __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) { + mbstate_t temp_state; wchar_t buf[1]; struct __gconv_step_data data; int status; @@ -57,6 +58,8 @@ __mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps) data.__outbuf = (char *) buf; s = ""; n = 1; + temp_state = *data.__statep; + data.__statep = &temp_state; } /* Make sure we use the correct function. */ -- cgit v1.2.3