mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
Update.
1998-04-29 12:11 Ulrich Drepper <drepper@cygnus.com> * wcsmbs/mbsnrtowcs.c: Remove variable to pass to conversion function by letting the later modify the variable computing the total directly. * wcsmbs/mbsrtowcs.c: Likewise. * wcsmbs/wcsnrtombs.c: Likewise. * wcsmbs/wcsrtombs.c: Likewise. * wcsmbs/btowc.c (converted): Rename variable to dummy to make clear it is not used. * wcsmbs/wctoc.c: Likewise.
This commit is contained in:
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
|||||||
|
1998-04-29 12:11 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
|
* wcsmbs/mbsnrtowcs.c: Remove variable to pass to conversion function
|
||||||
|
by letting the later modify the variable computing the total directly.
|
||||||
|
* wcsmbs/mbsrtowcs.c: Likewise.
|
||||||
|
* wcsmbs/wcsnrtombs.c: Likewise.
|
||||||
|
* wcsmbs/wcsrtombs.c: Likewise.
|
||||||
|
|
||||||
|
* wcsmbs/btowc.c (converted): Rename variable to dummy to make clear
|
||||||
|
it is not used.
|
||||||
|
* wcsmbs/wctoc.c: Likewise.
|
||||||
|
|
||||||
1998-04-29 Ulrich Drepper <drepper@cygnus.com>
|
1998-04-29 Ulrich Drepper <drepper@cygnus.com>
|
||||||
|
|
||||||
* iconv/skeleton.c: Correct counting of actually converted
|
* iconv/skeleton.c: Correct counting of actually converted
|
||||||
|
@ -229,16 +229,16 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
|
|||||||
char *outend = data->outbufend;
|
char *outend = data->outbufend;
|
||||||
char *outptr;
|
char *outptr;
|
||||||
|
|
||||||
|
/* This variable is used to count the number of characters we
|
||||||
|
actually converted. */
|
||||||
|
size_t converted = 0;
|
||||||
|
|
||||||
#ifdef PREPARE_LOOP
|
#ifdef PREPARE_LOOP
|
||||||
PREPARE_LOOP
|
PREPARE_LOOP
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
/* This variable is used to count the number of characters we
|
|
||||||
actually converted. */
|
|
||||||
size_t converted = 0;
|
|
||||||
|
|
||||||
/* Remember the start value for this round. */
|
/* Remember the start value for this round. */
|
||||||
inptr = *inbuf;
|
inptr = *inbuf;
|
||||||
/* The outbuf buffer is empty. */
|
/* The outbuf buffer is empty. */
|
||||||
|
@ -32,7 +32,7 @@ __btowc (c)
|
|||||||
struct gconv_step_data data;
|
struct gconv_step_data data;
|
||||||
char inbuf[1];
|
char inbuf[1];
|
||||||
const char *inptr = inbuf;
|
const char *inptr = inbuf;
|
||||||
size_t converted;
|
size_t dummy;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* If the parameter does not fit into one byte or it is the EOF value
|
/* If the parameter does not fit into one byte or it is the EOF value
|
||||||
@ -55,9 +55,8 @@ __btowc (c)
|
|||||||
/* Create the input string. */
|
/* Create the input string. */
|
||||||
inbuf[0] = c;
|
inbuf[0] = c;
|
||||||
|
|
||||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc, &data,
|
||||||
&data, &inptr, inptr + 1,
|
&inptr, inptr + 1, &dummy, 0);
|
||||||
&converted, 0);
|
|
||||||
/* The conversion failed. */
|
/* The conversion failed. */
|
||||||
if (status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
if (status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
||||||
&& status != GCONV_EMPTY_INPUT)
|
&& status != GCONV_EMPTY_INPUT)
|
||||||
|
@ -65,21 +65,17 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
|
|||||||
{
|
{
|
||||||
wchar_t buf[64]; /* Just an arbitrary size. */
|
wchar_t buf[64]; /* Just an arbitrary size. */
|
||||||
const char *inbuf = *src;
|
const char *inbuf = *src;
|
||||||
size_t written;
|
|
||||||
|
|
||||||
data.outbuf = (char *) buf;
|
data.outbuf = (char *) buf;
|
||||||
data.outbufend = data.outbuf + sizeof (buf);
|
data.outbufend = data.outbuf + sizeof (buf);
|
||||||
do
|
do
|
||||||
{
|
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
&data, &inbuf, srcend,
|
||||||
&data, &inbuf, srcend,
|
&result, 0);
|
||||||
&written, 0);
|
|
||||||
result += written;
|
|
||||||
}
|
|
||||||
while (status == GCONV_FULL_OUTPUT);
|
while (status == GCONV_FULL_OUTPUT);
|
||||||
|
|
||||||
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
||||||
&& buf[written - 1] == L'\0')
|
&& ((wchar_t *) data.outbuf)[-1] == L'\0')
|
||||||
/* Don't count the NUL character in. */
|
/* Don't count the NUL character in. */
|
||||||
--result;
|
--result;
|
||||||
}
|
}
|
||||||
|
@ -58,21 +58,17 @@ __mbsrtowcs (dst, src, len, ps)
|
|||||||
wchar_t buf[64]; /* Just an arbitrary size. */
|
wchar_t buf[64]; /* Just an arbitrary size. */
|
||||||
const char *srcend = *src + strlen (*src) + 1;
|
const char *srcend = *src + strlen (*src) + 1;
|
||||||
const char *inbuf = *src;
|
const char *inbuf = *src;
|
||||||
size_t written;
|
|
||||||
|
|
||||||
data.outbuf = (char *) buf;
|
data.outbuf = (char *) buf;
|
||||||
data.outbufend = data.outbuf + sizeof (buf);
|
data.outbufend = data.outbuf + sizeof (buf);
|
||||||
do
|
do
|
||||||
{
|
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
||||||
status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
|
&data, &inbuf, srcend,
|
||||||
&data, &inbuf, srcend,
|
&result, 0);
|
||||||
&written, 0);
|
|
||||||
result += written;
|
|
||||||
}
|
|
||||||
while (status == GCONV_FULL_OUTPUT);
|
while (status == GCONV_FULL_OUTPUT);
|
||||||
|
|
||||||
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
||||||
&& buf[written - 1] == L'\0')
|
&& ((wchar_t *) data.outbuf)[-1] == L'\0')
|
||||||
/* Don't count the NUL character in. */
|
/* Don't count the NUL character in. */
|
||||||
--result;
|
--result;
|
||||||
}
|
}
|
||||||
|
@ -64,20 +64,16 @@ __wcsnrtombs (dst, src, nwc, len, ps)
|
|||||||
{
|
{
|
||||||
char buf[256]; /* Just an arbitrary value. */
|
char buf[256]; /* Just an arbitrary value. */
|
||||||
const wchar_t *inbuf = *src;
|
const wchar_t *inbuf = *src;
|
||||||
size_t written;
|
|
||||||
|
|
||||||
data.outbuf = buf;
|
data.outbuf = buf;
|
||||||
data.outbufend = buf + sizeof (buf);
|
data.outbufend = buf + sizeof (buf);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
&data,
|
||||||
&data,
|
(const char **) &inbuf,
|
||||||
(const char **) &inbuf,
|
(const char *) srcend,
|
||||||
(const char *) srcend,
|
&result, 0);
|
||||||
&written, 0);
|
|
||||||
result += written;
|
|
||||||
}
|
|
||||||
while (status == GCONV_FULL_OUTPUT);
|
while (status == GCONV_FULL_OUTPUT);
|
||||||
|
|
||||||
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
||||||
|
@ -57,20 +57,16 @@ __wcsrtombs (dst, src, len, ps)
|
|||||||
char buf[256]; /* Just an arbitrary value. */
|
char buf[256]; /* Just an arbitrary value. */
|
||||||
const wchar_t *srcend = *src + __wcslen (*src) + 1;
|
const wchar_t *srcend = *src + __wcslen (*src) + 1;
|
||||||
const wchar_t *inbuf = *src;
|
const wchar_t *inbuf = *src;
|
||||||
size_t written;
|
|
||||||
|
|
||||||
data.outbuf = buf;
|
data.outbuf = buf;
|
||||||
data.outbufend = buf + sizeof (buf);
|
data.outbufend = buf + sizeof (buf);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
|
&data,
|
||||||
&data,
|
(const char **) &inbuf,
|
||||||
(const char **) &inbuf,
|
(const char *) srcend,
|
||||||
(const char *) srcend,
|
&result, 0);
|
||||||
&written, 0);
|
|
||||||
result += written;
|
|
||||||
}
|
|
||||||
while (status == GCONV_FULL_OUTPUT);
|
while (status == GCONV_FULL_OUTPUT);
|
||||||
|
|
||||||
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
|
||||||
|
@ -32,7 +32,7 @@ wctob (c)
|
|||||||
struct gconv_step_data data;
|
struct gconv_step_data data;
|
||||||
wchar_t inbuf[1];
|
wchar_t inbuf[1];
|
||||||
wchar_t *inptr = inbuf;
|
wchar_t *inptr = inbuf;
|
||||||
size_t converted;
|
size_t dummy;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* Tell where we want the result. */
|
/* Tell where we want the result. */
|
||||||
@ -53,7 +53,7 @@ wctob (c)
|
|||||||
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb, &data,
|
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb, &data,
|
||||||
(const char **) &inptr,
|
(const char **) &inptr,
|
||||||
(const char *) &inbuf[1],
|
(const char *) &inbuf[1],
|
||||||
&converted, 0);
|
&dummy, 0);
|
||||||
/* The conversion failed or the output is too long. */
|
/* The conversion failed or the output is too long. */
|
||||||
if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT
|
||||||
&& status != GCONV_EMPTY_INPUT)
|
&& status != GCONV_EMPTY_INPUT)
|
||||||
|
Reference in New Issue
Block a user