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 *
}
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;
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
{
/* Store information about how many bytes are available. */
data->outbuf = outbuf;
+
+ /* Remember how many characters we converted. */
+ *written += converted;
+
break;
}
outbuf = outptr;
/* Reset the state. */
- converted = last_converted;
# ifdef SAVE_RESET_STATE
SAVE_RESET_STATE (0);
# endif
}
while (status == GCONV_OK);
- /* Remember how many characters we converted. */
- *written += converted;
-
#ifdef END_LOOP
END_LOOP
#endif