(step, step_data, &toinptr,
(const unsigned char *) &to_tbl[idx2 + len],
(unsigned char **) outbufstart,
- irreversible, 0, 0));
+ NULL, 0, 0));
if (res != __GCONV_ILLEGAL_INPUT)
{
/* If the conversion succeeds we have to increment the
(step, step_data, &toinptr,
(const unsigned char *) (default_missing + len),
(unsigned char **) outbufstart,
- irreversible, 0, 0));
+ NULL, 0, 0));
if (res != __GCONV_ILLEGAL_INPUT)
{
/* To make it easier for the writers of the modules, we define a macro
to test whether we have to ignore errors. */
-#define ignore_errors_p() (flags & __GCONV_IGNORE_ERRORS)
+#define ignore_errors_p() \
+ (irreversible != NULL && (flags & __GCONV_IGNORE_ERRORS))
/* Error handling with transliteration/transcription function use and
struct __gconv_trans_data *trans; \
\
result = __GCONV_ILLEGAL_INPUT; \
+ \
+ if (irreversible == NULL) \
+ /* This means we are in call from __gconv_transliterate. In this \
+ case we are not doing any error recovery outself. */ \
+ break; \
+ \
/* First try the transliteration methods. */ \
for (trans = step_data->__trans; trans != NULL; trans = trans->__next) \
{ \
/* Next see whether we have to ignore the error. If not, stop. */ \
if (! ignore_errors_p ()) \
break; \
- \
+ \
/* When we come here it means we ignore the character. */ \
++*irreversible; \
inptr += Incr; \
/* This variable is used to count the number of characters we
actually converted. */
size_t lirreversible = 0;
+ size_t *lirreversiblep = irreversible ? &lirreversible : NULL;
#if defined _STRING_ARCH_unaligned \
|| MIN_NEEDED_FROM == 1 || MAX_NEEDED_FROM % MIN_NEEDED_FROM != 0 \
|| MIN_NEEDED_TO == 1 || MAX_NEEDED_TO % MIN_NEEDED_TO != 0
# if MAX_NEEDED_FROM > 1
if (MAX_NEEDED_TO == 1 || FROM_DIRECTION)
status = SINGLE(FROM_LOOP) (step, data, inptrp, inend, &outbuf,
- outend, &lirreversible
+ outend, lirreversiblep
EXTRA_LOOP_ARGS);
# endif
# if MAX_NEEDED_FROM > 1 && MAX_NEEDED_TO > 1 && !ONE_DIRECTION
# endif
# if MAX_NEEDED_TO > 1 && !ONE_DIRECTION
status = SINGLE(TO_LOOP) (step, data, inptrp, inend, &outbuf,
- outend, &lirreversible EXTRA_LOOP_ARGS);
+ outend, lirreversiblep EXTRA_LOOP_ARGS);
# endif
if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK)
if (FROM_DIRECTION)
/* Run the conversion loop. */
status = FROM_LOOP (step, data, inptrp, inend, &outbuf, outend,
- &lirreversible EXTRA_LOOP_ARGS);
+ lirreversiblep EXTRA_LOOP_ARGS);
else
/* Run the conversion loop. */
status = TO_LOOP (step, data, inptrp, inend, &outbuf, outend,
- &lirreversible EXTRA_LOOP_ARGS);
+ lirreversiblep EXTRA_LOOP_ARGS);
}
#if !defined _STRING_ARCH_unaligned \
&& MIN_NEEDED_FROM != 1 && MAX_NEEDED_FROM % MIN_NEEDED_FROM == 0 \
/* Run the conversion loop. */
status = GEN_unaligned (FROM_LOOP) (step, data, inptrp, inend,
&outbuf, outend,
- &lirreversible
+ lirreversiblep
EXTRA_LOOP_ARGS);
else
/* Run the conversion loop. */
status = GEN_unaligned (TO_LOOP) (step, data, inptrp, inend,
&outbuf, outend,
- &lirreversible
+ lirreversiblep
EXTRA_LOOP_ARGS);
}
#endif
(const unsigned char *) inend,
(unsigned char **) &outbuf,
(unsigned char *) outerr,
- &lirreversible EXTRA_LOOP_ARGS);
+ lirreversiblep EXTRA_LOOP_ARGS);
else
/* Run the conversion loop. */
nstatus = TO_LOOP (step, data,
(const unsigned char *) inend,
(unsigned char **) &outbuf,
(unsigned char *) outerr,
- &lirreversible EXTRA_LOOP_ARGS);
+ lirreversiblep EXTRA_LOOP_ARGS);
/* We must run out of output buffer space in this
rerun. */