bug fix in iconv/skeleton.c (2)
Bruno Haible
haible@ilog.fr
Mon Sep 11 09:10:00 GMT 2000
Unaligned accesses are still possible for the "UTF-16" and "UNICODE"
encodings, in the handling of the "we produced more data than the next
step can afford" situation.
2000-09-10 Bruno Haible <haible@clisp.cons.org>
* iconv/skeleton.c (FUNCTION_NAME): Handle unaligned access in
second try as well.
*** glibc-20000831/iconv/skeleton.c.bak Sun Sep 10 01:16:59 2000
--- glibc-20000831/iconv/skeleton.c Sun Sep 10 15:44:19 2000
***************
*** 491,513 ****
SAVE_RESET_STATE (0);
# endif
! /* XXX Handle unaligned access here as well. */
! if (FROM_DIRECTION)
! /* Run the conversion loop. */
! nstatus = FROM_LOOP (step, data,
! (const unsigned char **) inptrp,
! (const unsigned char *) inend,
! (unsigned char **) &outbuf,
! (unsigned char *) outerr,
! lirreversiblep EXTRA_LOOP_ARGS);
else
! /* Run the conversion loop. */
! nstatus = TO_LOOP (step, data,
! (const unsigned char **) inptrp,
! (const unsigned char *) inend,
! (unsigned char **) &outbuf,
! (unsigned char *) outerr,
! lirreversiblep EXTRA_LOOP_ARGS);
/* We must run out of output buffer space in this
rerun. */
--- 497,540 ----
SAVE_RESET_STATE (0);
# endif
! if (__builtin_expect (!unaligned, 1))
! {
! if (FROM_DIRECTION)
! /* Run the conversion loop. */
! nstatus = FROM_LOOP (step, data, inptrp, inend,
! &outbuf,
! (unsigned char *) outerr,
! lirreversiblep
! EXTRA_LOOP_ARGS);
! else
! /* Run the conversion loop. */
! nstatus = TO_LOOP (step, data, inptrp, inend,
! &outbuf,
! (unsigned char *) outerr,
! lirreversiblep
! EXTRA_LOOP_ARGS);
! }
! # 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
else
! {
! if (FROM_DIRECTION)
! /* Run the conversion loop. */
! nstatus = GEN_unaligned (FROM_LOOP) (step, data,
! inptrp, inend,
! (unsigned char *) outerr,
! lirreversiblep
! EXTRA_LOOP_ARGS);
! else
! /* Run the conversion loop. */
! nstatus = GEN_unaligned (TO_LOOP) (step, data,
! inptrp, inend,
! (unsigned char *) outerr,
! lirreversiblep
! EXTRA_LOOP_ARGS);
! }
! # endif
/* We must run out of output buffer space in this
rerun. */
More information about the Libc-alpha
mailing list