* wcsmbs/mbsrtowcs.c: Compute return value correctly after change
	in gconv function.
This commit is contained in:
Ulrich Drepper 2000-01-19 06:49:51 +00:00
parent 1f547466cf
commit a5334a6807
4 changed files with 20 additions and 5 deletions

View File

@ -1,5 +1,8 @@
2000-01-18 Ulrich Drepper <drepper@cygnus.com> 2000-01-18 Ulrich Drepper <drepper@cygnus.com>
* wcsmbs/mbsrtowcs.c: Compute return value correctly after change
in gconv function.
* wcsmbs/mbrtowc.c: Don't set errno if byte sequence is only * wcsmbs/mbrtowc.c: Don't set errno if byte sequence is only
incomplete but correct. incomplete but correct.

View File

@ -1,3 +1,7 @@
2000-01-18 Ulrich Drepper <drepper@cygnus.com>
* locales/ja_JP: Add double-width digits to digit class.
2000-01-12 Ulrich Drepper <drepper@cygnus.com> 2000-01-12 Ulrich Drepper <drepper@cygnus.com>
* charmaps/ISO-8859-16: Add mapping for /xba. * charmaps/ISO-8859-16: Add mapping for /xba.

View File

@ -60,7 +60,9 @@ alpha <A>;<B>;<C>;<D>;<E>;<F>;<G>;<H>;<I>;<J>;<K>;<L>;<M>;/
<J1137>....<J1187> <J1137>....<J1187>
digit <zero>;<one>;<two>;<three>;<four>;/ digit <zero>;<one>;<two>;<three>;<four>;/
<five>;<six>;<seven>;<eight>;<nine> <five>;<six>;<seven>;<eight>;<nine>;/
<j0316>;<j0317>;<j0318>;<j0319>;<j0320>;/
<j0321>;<j0322>;<j0323>;<j0324>;<j0325>
xdigit <zero>;<one>;<two>;<three>;<four>;/ xdigit <zero>;<one>;<two>;<three>;<four>;/
<five>;<six>;<seven>;<eight>;<nine>;/ <five>;<six>;<seven>;<eight>;<nine>;/

View File

@ -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. This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1996. Contributed by Ulrich Drepper <drepper@gnu.org>, 1996.
@ -42,9 +42,10 @@ __mbsrtowcs (dst, src, len, ps)
mbstate_t *ps; mbstate_t *ps;
{ {
struct __gconv_step_data data; struct __gconv_step_data data;
size_t result = 0; size_t result;
int status; int status;
struct __gconv_step *towc; struct __gconv_step *towc;
size_t non_reversible;
/* Tell where we want the result. */ /* Tell where we want the result. */
data.__invocation_counter = 0; data.__invocation_counter = 0;
@ -65,13 +66,16 @@ __mbsrtowcs (dst, src, len, ps)
const unsigned char *inbuf = (const unsigned char *) *src; const unsigned char *inbuf = (const unsigned char *) *src;
const unsigned char *srcend = inbuf + strlen (inbuf) + 1; const unsigned char *srcend = inbuf + strlen (inbuf) + 1;
result = 0;
data.__outbufend = (char *) buf + sizeof (buf); data.__outbufend = (char *) buf + sizeof (buf);
do do
{ {
data.__outbuf = (char *) buf; data.__outbuf = (char *) buf;
status = (*towc->__fct) (__wcsmbs_gconv_fcts.towc, &data, &inbuf, status = (*towc->__fct) (__wcsmbs_gconv_fcts.towc, &data, &inbuf,
srcend, &result, 0); srcend, &non_reversible, 0);
result += (wchar_t *) data.__outbuf - buf;
} }
while (status == __GCONV_FULL_OUTPUT); while (status == __GCONV_FULL_OUTPUT);
@ -99,7 +103,9 @@ __mbsrtowcs (dst, src, len, ps)
status = (*towc->__fct) (__wcsmbs_gconv_fcts.towc, &data, status = (*towc->__fct) (__wcsmbs_gconv_fcts.towc, &data,
(const unsigned char **) src, srcend, (const unsigned char **) src, srcend,
&result, 0); &non_reversible, 0);
result = (wchar_t *) data.__outbuf - dst;
/* We have to determine whether the last character converted /* We have to determine whether the last character converted
is the NUL character. */ is the NUL character. */