summaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/mbsnrtowcs.c6
-rw-r--r--wcsmbs/wchar.h6
-rw-r--r--wcsmbs/wcsnrtombs.c4
3 files changed, 12 insertions, 4 deletions
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index 8d0b9d3609..a5329a2331 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 <drepper@gnu.org>, 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
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index 0fd9e35440..aaf278dd8d 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2004,2005,2006,2007 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2004,2005,2006,2007, 2008 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -839,9 +839,9 @@ __END_DECLS
#endif /* _WCHAR_H defined */
+#endif /* wchar.h */
+
/* Undefined all __need_* constants in case we are included to get those
constants but the whole file was already read. */
#undef __need_mbstate_t
#undef __need_wint_t
-
-#endif /* wchar.h */
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index 171fc3c227..eead26fb3c 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -77,10 +77,14 @@ __wcsnrtombs (dst, src, nwc, 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 unsigned char *inbuf = (const unsigned char *) *src;
size_t dummy;
+ temp_state = *data.__statep;
+ data.__statep = &temp_state;
+
result = 0;
data.__outbufend = buf + sizeof (buf);