/* Conversion module for ISO-2022-JP and ISO-2022-JP-2.
- Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
+ Copyright (C) 1998-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, write to the Free
- Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307 USA. */
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
#include <assert.h>
#include <dlfcn.h>
\
*outptr++ = ESC; \
*outptr++ = 'N'; \
- *outptr++ = res; \
+ *outptr++ = res & 0x7f; \
written = 3; \
} \
} \
\
/* At the beginning of a line, G2 designation is cleared. */ \
if (var == iso2022jp2 && ch == 0x0a) \
- set2 = UNSPECIFIED_set; \
+ set2 = UNSPECIFIED_set; \
} \
else \
{ \
list that depends on the current language tag. */ \
cvlist_t conversion_list; \
unsigned char buf[2]; \
- \
- result = __GCONV_ILLEGAL_INPUT; \
+ int res = __GCONV_ILLEGAL_INPUT; \
\
if (var == iso2022jp2) \
conversion_list = conversion_lists[tag >> 8]; \
{ \
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
*outptr++ = 'N'; \
*outptr++ = ch - 0x80; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
++rp; \
if (ch >= rp->start) \
{ \
- unsigned char res = \
+ unsigned char ch2 = \
iso88597_from_ucs4[ch - 0xa0 + rp->idx]; \
- if (res != '\0') \
+ if (ch2 != '\0') \
{ \
if (set2 != ISO88597_set) \
{ \
if (__builtin_expect (outptr + 3 > outend, \
0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
*outptr++ = 'N'; \
- *outptr++ = res; \
- result = __GCONV_OK; \
+ *outptr++ = ch2 - 0x80; \
+ res = __GCONV_OK; \
break; \
} \
} \
{ \
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = buf[0]; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
{ \
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 2 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = buf[0]; \
*outptr++ = buf[1]; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
{ \
if (__builtin_expect (outptr + 4 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 2 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = buf[0]; \
*outptr++ = buf[1]; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
{ \
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 2 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = buf[0]; \
*outptr++ = buf[1]; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
{ \
if (__builtin_expect (outptr + 4 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 2 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = buf[0]; \
*outptr++ = buf[1]; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
{ \
if (__builtin_expect (outptr + 3 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = ESC; \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
{ \
- result = __GCONV_FULL_OUTPUT; \
+ res = __GCONV_FULL_OUTPUT; \
break; \
} \
*outptr++ = buf[0] - 0x80; \
- result = __GCONV_OK; \
+ res = __GCONV_OK; \
break; \
} \
\
default: \
abort (); \
} \
- while (result == __GCONV_ILLEGAL_INPUT \
+ while (res == __GCONV_ILLEGAL_INPUT \
&& (conversion_list = CVLIST_REST (conversion_list)) != 0);\
\
- if (result == __GCONV_FULL_OUTPUT) \
- break; \
+ if (res == __GCONV_FULL_OUTPUT) \
+ { \
+ result = res; \
+ break; \
+ } \
\
- if (result == __GCONV_ILLEGAL_INPUT) \
+ if (res == __GCONV_ILLEGAL_INPUT) \
{ \
STANDARD_TO_LOOP_ERR_HANDLER (4); \
} \
#define INIT_PARAMS int set = *setp & CURRENT_SEL_MASK; \
int set2 = *setp & CURRENT_ASSIGN_MASK; \
int tag = *setp & CURRENT_TAG_MASK;
+#define REINIT_PARAMS do \
+ { \
+ set = *setp & CURRENT_SEL_MASK; \
+ set2 = *setp & CURRENT_ASSIGN_MASK; \
+ tag = *setp & CURRENT_TAG_MASK; \
+ } \
+ while (0)
#define UPDATE_PARAMS *setp = set | set2 | tag
#include <iconv/loop.c>