diff options
author | Ulrich Drepper <drepper@redhat.com> | 2008-01-09 20:03:58 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2008-01-09 20:03:58 +0000 |
commit | 4b1b449d1d4fda5658a3eb8378413aa224de0cf6 (patch) | |
tree | 9ab935ce8338639475e800500b66527d0ddfc03f /iconv | |
parent | * sysdeps/unix/sysv/linux/i386/makecontext.S (__makecontext): Avoid (diff) | |
download | glibc-4b1b449d1d4fda5658a3eb8378413aa224de0cf6.tar.gz glibc-4b1b449d1d4fda5658a3eb8378413aa224de0cf6.tar.bz2 glibc-4b1b449d1d4fda5658a3eb8378413aa224de0cf6.zip |
008-01-08 Jakub Jelinek <jakub@redhat.com>
* iconv/loop.c (UPDATE_PARAMS): Define to empty statement if not
defined.
(REINIT_PARAMS): Likewise. Undefine before end of file.
(STANDARD_TO_LOOP_ERR_HANDLER): Use UPDATE_PARAMS before calling
transliteration hooks and REINIT_PARAMS afterwards.
* iconvdata/iso-2022-jp.c (BODY): Use a separate variable for
status.
(REINIT_PARAMS): Define.
* iconvdata/ibm1364.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm930.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm933.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm935.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm937.c (REINIT_PARAMS): Likewise.
* iconvdata/ibm939.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-cn.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-cn-ext.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-jp-3.c (REINIT_PARAMS): Likewise.
* iconvdata/iso-2022-kr.c (REINIT_PARAMS): Likewise.
* iconvdata/Makefile: Add rules to build and run tst-iconv7.c.
* iconvdata/tst-iconv7.c: New test.
Diffstat (limited to 'iconv')
-rw-r--r-- | iconv/loop.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/iconv/loop.c b/iconv/loop.c index df8c8dce9f..da11bc209d 100644 --- a/iconv/loop.c +++ b/iconv/loop.c @@ -1,5 +1,5 @@ /* Conversion loop frame work. - Copyright (C) 1998-2002, 2003, 2005 Free Software Foundation, Inc. + Copyright (C) 1998-2002, 2003, 2005, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998. @@ -174,6 +174,15 @@ # define EXTRA_LOOP_DECLS #endif +/* Allow using UPDATE_PARAMS in macros where #ifdef UPDATE_PARAMS test + isn't possible. */ +#ifndef UPDATE_PARAMS +# define UPDATE_PARAMS do { } while (0) +#endif +#ifndef REINIT_PARAMS +# define REINIT_PARAMS do { } while (0) +#endif + /* To make it easier for the writers of the modules, we define a macro to test whether we have to ignore errors. */ @@ -214,6 +223,10 @@ case we are not doing any error recovery outself. */ \ break; \ \ + /* If needed, flush any conversion state, so that __gconv_transliterate \ + starts with current shift state. */ \ + UPDATE_PARAMS; \ + \ /* First try the transliteration methods. */ \ for (trans = step_data->__trans; trans != NULL; trans = trans->__next) \ { \ @@ -223,6 +236,9 @@ if (result != __GCONV_ILLEGAL_INPUT) \ break; \ } \ + \ + REINIT_PARAMS; \ + \ /* If any of them recognized the input continue with the loop. */ \ if (result != __GCONV_ILLEGAL_INPUT) \ { \ @@ -319,9 +335,7 @@ FCTNAME (LOOPFCT) (struct __gconv_step *step, /* Update the pointers pointed to by the parameters. */ *inptrp = inptr; *outptrp = outptr; -#ifdef UPDATE_PARAMS UPDATE_PARAMS; -#endif return result; } @@ -492,6 +506,7 @@ gconv_btowc (struct __gconv_step *step, unsigned char c) #undef EXTRA_LOOP_DECLS #undef INIT_PARAMS #undef UPDATE_PARAMS +#undef REINIT_PARAMS #undef ONEBYTE_BODY #undef UNPACK_BYTES #undef CLEAR_STATE |