aboutsummaryrefslogtreecommitdiff
path: root/iconv/skeleton.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-04-29 10:33:09 +0000
committerUlrich Drepper <drepper@redhat.com>1998-04-29 10:33:09 +0000
commitbf979eef1d8d6c6e9b5ad623d47ce9bab20b8be9 (patch)
treec7d1759c983ea9536c1e86e35a0cbd8b22cd5f6c /iconv/skeleton.c
parent842d0295a1656d82eff7395682371390f3962e95 (diff)
downloadglibc-bf979eef1d8d6c6e9b5ad623d47ce9bab20b8be9.zip
glibc-bf979eef1d8d6c6e9b5ad623d47ce9bab20b8be9.tar.gz
glibc-bf979eef1d8d6c6e9b5ad623d47ce9bab20b8be9.tar.bz2
Update.
* iconv/skeleton.c: Correct counting of actually converted characters.
Diffstat (limited to 'iconv/skeleton.c')
-rw-r--r--iconv/skeleton.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/iconv/skeleton.c b/iconv/skeleton.c
index cc090af..596838d 100644
--- a/iconv/skeleton.c
+++ b/iconv/skeleton.c
@@ -223,11 +223,6 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
}
else
{
- /* This variable is used to count the number of characters we
- actually converted. */
- size_t converted = 0;
- size_t last_converted;
-
/* We preserve the initial values of the pointer variables. */
const char *inptr = *inbuf;
char *outbuf = data->outbuf;
@@ -240,13 +235,15 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
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. */
inptr = *inbuf;
/* The outbuf buffer is empty. */
outptr = outbuf;
- /* Save the state. */
- last_converted = converted;
#ifdef SAVE_RESET_STATE
SAVE_RESET_STATE (1);
#endif
@@ -274,6 +271,10 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
{
/* Store information about how many bytes are available. */
data->outbuf = outbuf;
+
+ /* Remember how many characters we converted. */
+ *written += converted;
+
break;
}
@@ -302,7 +303,6 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
outbuf = outptr;
/* Reset the state. */
- converted = last_converted;
# ifdef SAVE_RESET_STATE
SAVE_RESET_STATE (0);
# endif
@@ -343,9 +343,6 @@ FUNCTION_NAME (struct gconv_step *step, struct gconv_step_data *data,
}
while (status == GCONV_OK);
- /* Remember how many characters we converted. */
- *written += converted;
-
#ifdef END_LOOP
END_LOOP
#endif