This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
bug fix in iconv/skeleton.c (1)
- To: libc-alpha at sources dot redhat dot com
- Subject: bug fix in iconv/skeleton.c (1)
- From: Bruno Haible <haible at ilog dot fr>
- Date: Mon, 11 Sep 2000 18:07:24 +0200 (CEST)
There is confusion between RESET_STATE and SAVE_RESET_STATE in skeleton.c.
All stateful modules define SAVE_RESET_STATE, but the comments and some
#ifdefs refer to RESET_STATE.
The visible effect of this is that ISO-2022-CN and ISO-2022-KR get
__stateful set to 0.
Here is a fix, plus a few comments fixes.
2000-09-10 Bruno Haible <haible@clisp.cons.org>
* iconv/skeleton.c (gconv_init): Replace all uses of RESET_STATE with
SAVE_RESET_STATE.
*** 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
***************
*** 57,63 ****
from the current characters.
TO_LOOP likewise for the other direction
! RESET_STATE in case of an error we must reset the state for
the rerun so this macro must be defined for
stateful encodings. It takes an argument which
is nonzero when saving.
--- 57,68 ----
from the current characters.
TO_LOOP likewise for the other direction
! ONE_DIRECTION optional. If defined to 1, only one conversion
! direction is defined instead of two. In this
! case, FROM_DIRECTION should be defined to 1, and
! FROM_LOOP and TO_LOOP should have the same value.
!
! SAVE_RESET_STATE in case of an error we must reset the state for
the rerun so this macro must be defined for
stateful encodings. It takes an argument which
is nonzero when saving.
***************
*** 184,191 ****
#endif
! /* For conversions from a fixed width character sets to another fixed width
! character set we we can define RESET_INPUT_BUFFER is necessary. */
#if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE
# if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO
/* We have to use these `if's here since the compiler cannot know that
--- 189,196 ----
#endif
! /* For conversions from a fixed width character set to another fixed width
! character set we can define RESET_INPUT_BUFFER in a very fast way. */
#if !defined RESET_INPUT_BUFFER && !defined SAVE_RESET_STATE
# if MIN_NEEDED_FROM == MAX_NEEDED_FROM && MIN_NEEDED_TO == MAX_NEEDED_TO
/* We have to use these `if's here since the compiler cannot know that
***************
*** 233,239 ****
else
return __GCONV_NOCONV;
! #ifdef RESET_STATE
step->__stateful = 1;
#else
step->__stateful = 0;
--- 238,244 ----
else
return __GCONV_NOCONV;
! #ifdef SAVE_RESET_STATE
step->__stateful = 1;
#else
step->__stateful = 0;
***************
*** 245,252 ****
/* The default destructor function does nothing in the moment and so
! be define it at all. But we still provide the macro just in case
! we need it some day. */
#if DEFINE_FINI
#endif
--- 250,257 ----
/* The default destructor function does nothing in the moment and so
! we don't define it at all. But we still provide the macro just in
! case we need it some day. */
#if DEFINE_FINI
#endif
***************
*** 580,586 ****
#undef EMIT_SHIFT_TO_INIT
#undef FROM_LOOP
#undef TO_LOOP
! #undef RESET_STATE
#undef RESET_INPUT_BUFFER
#undef FUNCTION_NAME
#undef PREPARE_LOOP
--- 608,614 ----
#undef EMIT_SHIFT_TO_INIT
#undef FROM_LOOP
#undef TO_LOOP
! #undef SAVE_RESET_STATE
#undef RESET_INPUT_BUFFER
#undef FUNCTION_NAME
#undef PREPARE_LOOP
*** glibc-20000831/wcsmbs/wchar.h.bak Fri Aug 25 23:53:44 2000
--- glibc-20000831/wcsmbs/wchar.h Sun Sep 10 02:10:06 2000
***************
*** 61,71 ****
/* Conversion state information. */
typedef struct
{
! int __count;
union
{
! wint_t __wch;
! char __wchb[4];
} __value; /* Value so far. */
} __mbstate_t;
#endif
--- 61,72 ----
/* Conversion state information. */
typedef struct
{
! int __count; /* Bits 2..0: number of input bytes stored in __value.
! Bits 31..3: shift state. */
union
{
! wint_t __wch; /* Used by STORE_REST/UNPACK_BYTES. */
! char __wchb[4]; /* Used when STORE_REST/UNPACK_BYTES aren't defined. */
} __value; /* Value so far. */
} __mbstate_t;
#endif