From bf93cd3b8d6643977078c4b67facc0bbb85b03be Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 26 Dec 2008 19:02:29 +0000 Subject: [BZ #9677] 2008-12-21 Bruno Haible [BZ #9677] * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Create temporary state object if no output is written. --- ChangeLog | 6 ++++++ localedata/ChangeLog | 2 +- wcsmbs/mbsnrtowcs.c | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9ea040c..ef81776 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-12-21 Bruno Haible + + [BZ #9677] + * wcsmbs/mbsnrtowcs.c (__mbsnrtowcs): Create temporary state object + if no output is written. + 2008-12-13 Klaus Dittrich * login/utmp_file.c (pututline_file): Replace call to dup2 with diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 2f3e26c..6a7735b 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,6 +1,6 @@ 2008-12-26 Ulrich Drepper - * tests-mbwc/tst_types.h (TIN)MBRLEN_REC): Use correct array + * tests-mbwc/tst_types.h (TIN_MBRLEN_REC): Use correct array length constant. 2008-12-05 Ulrich Drepper diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c index 8d0b9d3..a5329a2 100644 --- a/wcsmbs/mbsnrtowcs.c +++ b/wcsmbs/mbsnrtowcs.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1996-2000, 2002, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1996-2000, 2002, 2005, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -79,9 +79,13 @@ __mbsnrtowcs (dst, src, nmc, 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; + temp_state = *data.__statep; + data.__statep = &temp_state; + result = 0; data.__outbufend = (unsigned char *) buf + sizeof (buf); do -- cgit v1.1