summaryrefslogtreecommitdiff
path: root/iconvdata/ibm937.c
diff options
context:
space:
mode:
Diffstat (limited to 'iconvdata/ibm937.c')
-rw-r--r--iconvdata/ibm937.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/iconvdata/ibm937.c b/iconvdata/ibm937.c
index 744f32fded..3ed6479366 100644
--- a/iconvdata/ibm937.c
+++ b/iconvdata/ibm937.c
@@ -1,5 +1,5 @@
/* Conversion from and to IBM937.
- Copyright (C) 2000-2015 Free Software Foundation, Inc.
+ Copyright (C) 2000-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Masahide Washizawa <washi@yamato.ibm.co.jp>, 2000.
@@ -17,6 +17,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+/* IBM937 is designed for the representation of Traditional Chinese
+ using a stateful EBCDIC encoding scheme. It is also known as
+ CCSID 937 or CP937. See:
+ https://www-01.ibm.com/software/globalization/ccsid/ccsid937.html */
+
#include <dlfcn.h>
#include <stdint.h>
#include <wchar.h>
@@ -104,24 +109,14 @@ enum
\
if (__builtin_expect (ch, 0) == SO) \
{ \
- /* Shift OUT, change to DBCS converter. */ \
- if (curcs == db) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ /* Shift OUT, change to DBCS converter (redundant escape okay). */ \
curcs = db; \
++inptr; \
continue; \
} \
else if (__builtin_expect (ch, 0) == SI) \
{ \
- /* Shift IN, change to SBCS converter. */ \
- if (curcs == sb) \
- { \
- result = __GCONV_ILLEGAL_INPUT; \
- break; \
- } \
+ /* Shift IN, change to SBCS converter (redundant escape okay). */ \
curcs = sb; \
++inptr; \
continue; \
@@ -255,6 +250,7 @@ enum
break; \
} \
*outptr++ = SI; \
+ curcs = sb; \
} \
\
if (__glibc_unlikely (outptr + 1 > outend)) \
@@ -263,7 +259,6 @@ enum
break; \
} \
*outptr++ = cp[0]; \
- curcs = sb; \
} \
\
/* Now that we wrote the output increment the input pointer. */ \