about summary refs log tree commit diff
path: root/iconvdata
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata')
-rw-r--r--iconvdata/euc-jisx0213.c16
-rw-r--r--iconvdata/iso-2022-jp.c4
-rw-r--r--iconvdata/iso-2022-kr.c11
-rw-r--r--iconvdata/johab.c10
-rw-r--r--iconvdata/shift_jisx0213.c13
5 files changed, 26 insertions, 28 deletions
diff --git a/iconvdata/euc-jisx0213.c b/iconvdata/euc-jisx0213.c
index c696f94ee8..a0062c8847 100644
--- a/iconvdata/euc-jisx0213.c
+++ b/iconvdata/euc-jisx0213.c
@@ -366,8 +366,8 @@ static const struct
       }									      \
     else								      \
       {									      \
-	ch = ucs4_to_jisx0213 (ch);					      \
-	if (ch == 0)							      \
+	uint32_t jch = ucs4_to_jisx0213 (ch);				      \
+	if (jch == 0)							      \
 	  {								      \
 	    UNICODE_TAG_HANDLER (ch, 4);				      \
 									      \
@@ -375,19 +375,19 @@ static const struct
 	    STANDARD_ERR_HANDLER (4);					      \
 	  }								      \
 									      \
-	if (ch & 0x0080)						      \
+	if (jch & 0x0080)						      \
 	  {								      \
 	    /* A possible match in comp_table_data.  We have to buffer it.  */\
 									      \
 	    /* We know it's a JISX 0213 plane 1 character.  */		      \
-	    assert ((ch & 0x8000) == 0);				      \
+	    assert ((jch & 0x8000) == 0);				      \
 									      \
-	    *statep = (ch | 0x8080) << 3;				      \
+	    *statep = (jch | 0x8080) << 3;				      \
 	    inptr += 4;							      \
 	    continue;							      \
 	  }								      \
 									      \
-	if (ch & 0x8000)						      \
+	if (jch & 0x8000)						      \
 	  {								      \
 	    /* JISX 0213 plane 2.  */					      \
 	    if (__builtin_expect (outptr + 2 >= outend, 0))		      \
@@ -406,8 +406,8 @@ static const struct
 		break;							      \
 	      }								      \
 	  }								      \
-	*outptr++ = (ch >> 8) | 0x80;					      \
-	*outptr++ = (ch & 0xff) | 0x80;					      \
+	*outptr++ = (jch >> 8) | 0x80;					      \
+	*outptr++ = (jch & 0xff) | 0x80;				      \
       }									      \
 									      \
     inptr += 4;								      \
diff --git a/iconvdata/iso-2022-jp.c b/iconvdata/iso-2022-jp.c
index af840dd0a7..80fd033498 100644
--- a/iconvdata/iso-2022-jp.c
+++ b/iconvdata/iso-2022-jp.c
@@ -1,5 +1,5 @@
 /* Conversion module for ISO-2022-JP and ISO-2022-JP-2.
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -237,7 +237,7 @@ gconv_end (struct __gconv_step *data)
 	      *outbuf++ = '(';						      \
 	      *outbuf++ = 'B';						      \
 	      /* Note that this also clears the G2 designation.  */	      \
-	      data->__statep->__count &= ~7;				      \
+	      data->__statep->__count &= 7;				      \
 	      data->__statep->__count |= ASCII_set;			      \
 	    }								      \
 	}								      \
diff --git a/iconvdata/iso-2022-kr.c b/iconvdata/iso-2022-kr.c
index 9846d920d9..e576e2a083 100644
--- a/iconvdata/iso-2022-kr.c
+++ b/iconvdata/iso-2022-kr.c
@@ -1,5 +1,5 @@
 /* Conversion module for ISO-2022-KR.
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000-2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
 
@@ -40,7 +40,7 @@
 #define FROM_LOOP		from_iso2022kr_loop
 #define TO_LOOP			to_iso2022kr_loop
 #define MIN_NEEDED_FROM		1
-#define MAX_NEEDED_FROM		3
+#define MAX_NEEDED_FROM		4
 #define MIN_NEEDED_TO		4
 #define MAX_NEEDED_TO		4
 #define PREPARE_LOOP \
@@ -139,12 +139,11 @@ enum
 	   switching is done using the SI and SO bytes.  But we have to	      \
 	   recognize `Esc $ ) C' since this is a kind of flag for this	      \
 	   encoding.  We simply ignore it.  */				      \
-	if (__builtin_expect (inptr + 1 > inend, 0)			      \
+	if (__builtin_expect (inptr + 2 > inend, 0)			      \
 	    || (inptr[1] == '$'						      \
-		&& (__builtin_expect (inptr + 2 > inend, 0)		      \
+		&& (__builtin_expect (inptr + 3 > inend, 0)		      \
 		    || (inptr[2] == ')'					      \
-			&& __builtin_expect (inptr + 3 > inend, 0)))))	      \
-									      \
+			&& __builtin_expect (inptr + 4 > inend, 0)))))	      \
 	  {								      \
 	    result = __GCONV_INCOMPLETE_INPUT;				      \
 	    break;							      \
diff --git a/iconvdata/johab.c b/iconvdata/johab.c
index 83a76d1ff0..a94270a1e0 100644
--- a/iconvdata/johab.c
+++ b/iconvdata/johab.c
@@ -215,15 +215,15 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 	    if (__builtin_expect (ch <= 0xd3, 1))			      \
 	      {								      \
 		/* Hangul */						      \
-		uint_fast32_t i, m, f;					      \
+		int_fast32_t i, m, f;					      \
 									      \
 		i = init[(idx & 0x7c00) >> 10];				      \
 		m = mid[(idx & 0x03e0) >> 5];				      \
 		f = final[idx & 0x001f];				      \
 									      \
-		if (__builtin_expect (i, 0) == -1			      \
-		    || __builtin_expect (m, 0) == -1			      \
-		    || __builtin_expect (f, 0) == -1)			      \
+		if (__builtin_expect (i == -1, 0)			      \
+		    || __builtin_expect (m == -1, 0)			      \
+		    || __builtin_expect (f == -1, 0))			      \
 		  {							      \
 		    /* This is illegal.  */				      \
 		    if (! ignore_errors_p ())				      \
@@ -243,7 +243,7 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2)
 		  ch = init_to_ucs[i - 1];				      \
 		else if (i == 0 && m > 0 && f == 0)			      \
 		  ch = 0x314e + m;	/* 0x314f + m - 1 */		      \
-		else if (__builtin_expect (i | m, 0) == 0		      \
+		else if (__builtin_expect ((i | m) == 0, 1)		      \
 			 && __builtin_expect (f > 0, 1))		      \
 		  ch = final_to_ucs[f - 1];	/* round trip?? */	      \
 		else							      \
diff --git a/iconvdata/shift_jisx0213.c b/iconvdata/shift_jisx0213.c
index 0c1ca722c3..ec792009f0 100644
--- a/iconvdata/shift_jisx0213.c
+++ b/iconvdata/shift_jisx0213.c
@@ -352,9 +352,8 @@ static const struct
     else								      \
       {									      \
 	unsigned int s1, s2;						      \
-									      \
-	ch = ucs4_to_jisx0213 (ch);					      \
-	if (ch == 0)							      \
+	uint32_t jch = ucs4_to_jisx0213 (ch);				      \
+	if (jch == 0)							      \
 	  {								      \
 	    UNICODE_TAG_HANDLER (ch, 4);				      \
 									      \
@@ -363,8 +362,8 @@ static const struct
 	  }								      \
 									      \
 	/* Convert it to shifted representation.  */			      \
-	s1 = ch >> 8;							      \
-	s2 = ch & 0x7f;							      \
+	s1 = jch >> 8;							      \
+	s2 = jch & 0x7f;							      \
 	s1 -= 0x21;							      \
 	s2 -= 0x21;							      \
 	if (s1 >= 0x5e)							      \
@@ -390,12 +389,12 @@ static const struct
 	else								      \
 	  s2 += 0x41;							      \
 									      \
-	if (ch & 0x0080)						      \
+	if (jch & 0x0080)						      \
 	  {								      \
 	    /* A possible match in comp_table_data.  We have to buffer it.  */\
 									      \
 	    /* We know it's a JISX 0213 plane 1 character.  */		      \
-	    assert ((ch & 0x8000) == 0);				      \
+	    assert ((jch & 0x8000) == 0);				      \
 									      \
 	    *statep = ((s1 << 8) | s2) << 3;				      \
 	    inptr += 4;							      \