Update.
authorUlrich Drepper <drepper@redhat.com>
Wed, 29 Apr 1998 10:33:09 +0000 (10:33 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 29 Apr 1998 10:33:09 +0000 (10:33 +0000)
* iconv/skeleton.c: Correct counting of actually converted
characters.

ChangeLog
iconv/skeleton.c

index 256bcef84352828bb1f506891738a075b4d76466..0ca80898ddcaffc7a27474498b5cda8759035cea 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 1998-04-29  Ulrich Drepper  <drepper@cygnus.com>
 
+       * iconv/skeleton.c: Correct counting of actually converted
+       characters.
+
        * intl/localealias.c (read_alias_file): Use unsigned char for
        local variables.  Remove unused variable tp.
        * intl/l10nflist.c (_nl_normalize_codeset): Use unsigned char *
index cc090afe759703f487a84608ca9aad7f37bf302c..596838de8beda3a0cdf1e955b09a8aa537da8390 100644 (file)
@@ -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