aboutsummaryrefslogtreecommitdiff
path: root/wcsmbs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-29 12:15:49 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-29 12:15:49 +0000
commit5e7a22c9c3d09ad8bdefb127eb4a0faeee5fbb0b (patch)
tree721a0884bdb59f87db85171a056d51b1e246e467 /wcsmbs
parentbf979eef1d8d6c6e9b5ad623d47ce9bab20b8be9 (diff)
downloadglibc-5e7a22c9c3d09ad8bdefb127eb4a0faeee5fbb0b.zip
glibc-5e7a22c9c3d09ad8bdefb127eb4a0faeee5fbb0b.tar.gz
glibc-5e7a22c9c3d09ad8bdefb127eb4a0faeee5fbb0b.tar.bz2
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.
Diffstat (limited to 'wcsmbs')
-rw-r--r--wcsmbs/btowc.c7
-rw-r--r--wcsmbs/mbsnrtowcs.c12
-rw-r--r--wcsmbs/mbsrtowcs.c12
-rw-r--r--wcsmbs/wcsnrtombs.c14
-rw-r--r--wcsmbs/wcsrtombs.c14
-rw-r--r--wcsmbs/wctob.c4
6 files changed, 23 insertions, 40 deletions
diff --git a/wcsmbs/btowc.c b/wcsmbs/btowc.c
index 3ca5af2..cca4645 100644
--- a/wcsmbs/btowc.c
+++ b/wcsmbs/btowc.c
@@ -32,7 +32,7 @@ __btowc (c)
struct gconv_step_data data;
char inbuf[1];
const char *inptr = inbuf;
- size_t converted;
+ size_t dummy;
int status;
/* 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. */
inbuf[0] = c;
- status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
- &data, &inptr, inptr + 1,
- &converted, 0);
+ status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc, &data,
+ &inptr, inptr + 1, &dummy, 0);
/* The conversion failed. */
if (status != GCONV_OK && status != GCONV_FULL_OUTPUT
&& status != GCONV_EMPTY_INPUT)
diff --git a/wcsmbs/mbsnrtowcs.c b/wcsmbs/mbsnrtowcs.c
index 46a718b..790e777 100644
--- a/wcsmbs/mbsnrtowcs.c
+++ b/wcsmbs/mbsnrtowcs.c
@@ -65,21 +65,17 @@ __mbsnrtowcs (dst, src, nmc, len, ps)
{
wchar_t buf[64]; /* Just an arbitrary size. */
const char *inbuf = *src;
- size_t written;
data.outbuf = (char *) buf;
data.outbufend = data.outbuf + sizeof (buf);
do
- {
- status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
- &data, &inbuf, srcend,
- &written, 0);
- result += written;
- }
+ status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
+ &data, &inbuf, srcend,
+ &result, 0);
while (status == GCONV_FULL_OUTPUT);
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. */
--result;
}
diff --git a/wcsmbs/mbsrtowcs.c b/wcsmbs/mbsrtowcs.c
index 9172fd9..5043fd1 100644
--- a/wcsmbs/mbsrtowcs.c
+++ b/wcsmbs/mbsrtowcs.c
@@ -58,21 +58,17 @@ __mbsrtowcs (dst, src, len, ps)
wchar_t buf[64]; /* Just an arbitrary size. */
const char *srcend = *src + strlen (*src) + 1;
const char *inbuf = *src;
- size_t written;
data.outbuf = (char *) buf;
data.outbufend = data.outbuf + sizeof (buf);
do
- {
- status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
- &data, &inbuf, srcend,
- &written, 0);
- result += written;
- }
+ status = (*__wcsmbs_gconv_fcts.towc->fct) (__wcsmbs_gconv_fcts.towc,
+ &data, &inbuf, srcend,
+ &result, 0);
while (status == GCONV_FULL_OUTPUT);
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. */
--result;
}
diff --git a/wcsmbs/wcsnrtombs.c b/wcsmbs/wcsnrtombs.c
index 37b525b..815d7ad 100644
--- a/wcsmbs/wcsnrtombs.c
+++ b/wcsmbs/wcsnrtombs.c
@@ -64,20 +64,16 @@ __wcsnrtombs (dst, src, nwc, len, ps)
{
char buf[256]; /* Just an arbitrary value. */
const wchar_t *inbuf = *src;
- size_t written;
data.outbuf = buf;
data.outbufend = buf + sizeof (buf);
do
- {
- status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
- &data,
- (const char **) &inbuf,
- (const char *) srcend,
- &written, 0);
- result += written;
- }
+ status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
+ &data,
+ (const char **) &inbuf,
+ (const char *) srcend,
+ &result, 0);
while (status == GCONV_FULL_OUTPUT);
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
diff --git a/wcsmbs/wcsrtombs.c b/wcsmbs/wcsrtombs.c
index b055a09..ba2d8dc 100644
--- a/wcsmbs/wcsrtombs.c
+++ b/wcsmbs/wcsrtombs.c
@@ -57,20 +57,16 @@ __wcsrtombs (dst, src, len, ps)
char buf[256]; /* Just an arbitrary value. */
const wchar_t *srcend = *src + __wcslen (*src) + 1;
const wchar_t *inbuf = *src;
- size_t written;
data.outbuf = buf;
data.outbufend = buf + sizeof (buf);
do
- {
- status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
- &data,
- (const char **) &inbuf,
- (const char *) srcend,
- &written, 0);
- result += written;
- }
+ status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb,
+ &data,
+ (const char **) &inbuf,
+ (const char *) srcend,
+ &result, 0);
while (status == GCONV_FULL_OUTPUT);
if ((status == GCONV_OK || status == GCONV_EMPTY_INPUT)
diff --git a/wcsmbs/wctob.c b/wcsmbs/wctob.c
index b06d170..7376538 100644
--- a/wcsmbs/wctob.c
+++ b/wcsmbs/wctob.c
@@ -32,7 +32,7 @@ wctob (c)
struct gconv_step_data data;
wchar_t inbuf[1];
wchar_t *inptr = inbuf;
- size_t converted;
+ size_t dummy;
int status;
/* Tell where we want the result. */
@@ -53,7 +53,7 @@ wctob (c)
status = (*__wcsmbs_gconv_fcts.tomb->fct) (__wcsmbs_gconv_fcts.tomb, &data,
(const char **) &inptr,
(const char *) &inbuf[1],
- &converted, 0);
+ &dummy, 0);
/* The conversion failed or the output is too long. */
if ((status != GCONV_OK && status != GCONV_FULL_OUTPUT
&& status != GCONV_EMPTY_INPUT)