summaryrefslogtreecommitdiff
path: root/src/ccl.c
diff options
context:
space:
mode:
authorKenichi Handa <handa@m17n.org>2001-02-15 13:10:38 +0000
committerKenichi Handa <handa@m17n.org>2001-02-15 13:10:38 +0000
commit0fc71a7725067b60f46e9971c34cfccfefd84cea (patch)
treeaca64563f34d911a32e548a198ba2ae25b7c6b2a /src/ccl.c
parent2a55cd3a1385b730d7d348de9cdde5c007ebfa9b (diff)
downloademacs-0fc71a7725067b60f46e9971c34cfccfefd84cea.tar.gz
(ccl_driver) [CCL_ReadMultibyteChar2]: If SRC points an
invalid mulitbyte sequence, treat *SRC as a character of eight-bit-graphic.
Diffstat (limited to 'src/ccl.c')
-rw-r--r--src/ccl.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/ccl.c b/src/ccl.c
index 45cc525112d..fe7faafb9e5 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -1255,21 +1255,27 @@ ccl_driver (ccl, source, destination, src_bytes, dst_bytes, consumed)
reg[rrr] = i;
reg[RRR] = CHARSET_ASCII;
}
- else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION1)
- {
- if (src >= src_end)
- goto ccl_read_multibyte_character_suspend;
- reg[RRR] = i;
- reg[rrr] = (*src++ & 0x7F);
- }
else if (i <= MAX_CHARSET_OFFICIAL_DIMENSION2)
{
- if ((src + 1) >= src_end)
+ int dimension = BYTES_BY_CHAR_HEAD (i) - 1;
+
+ if (dimension == 0)
+ {
+ /* `i' is a leading code for an undefined charset. */
+ reg[RRR] = CHARSET_8_BIT_GRAPHIC;
+ reg[rrr] = i;
+ }
+ else if (src + dimension > src_end)
goto ccl_read_multibyte_character_suspend;
- reg[RRR] = i;
- i = (*src++ & 0x7F);
- reg[rrr] = ((i << 7) | (*src & 0x7F));
- src++;
+ else
+ {
+ reg[RRR] = i;
+ i = (*src++ & 0x7F);
+ if (dimension == 1)
+ reg[rrr] = i;
+ else
+ reg[rrr] = ((i << 7) | (*src++ & 0x7F));
+ }
}
else if ((i == LEADING_CODE_PRIVATE_11)
|| (i == LEADING_CODE_PRIVATE_12))