diff options
| author | Kenichi Handa | 1998-10-28 07:52:13 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-10-28 07:52:13 +0000 |
| commit | d14d03ac4a6509099810cc24f3ea3f57a27c7e6b (patch) | |
| tree | bd367a0aeca074427aeb38040f1d3a93d2235fa0 /src/coding.c | |
| parent | 78859b80333152ba40768dbcfcaa6489ea38ed94 (diff) | |
| download | emacs-d14d03ac4a6509099810cc24f3ea3f57a27c7e6b.tar.gz emacs-d14d03ac4a6509099810cc24f3ea3f57a27c7e6b.zip | |
(DECODE_CHARACTER_ASCII): Check validity of inserted
code.
(DECODE_CHARACTER_DIMENSION1): Likewise.
(DECODE_CHARACTER_DIMENSION2): Likewise.
(decode_coding_sjis_big5): Check the 2nd byte of SJIS correctly.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/coding.c b/src/coding.c index 5ae0d5f4dc4..e9d9b16ba10 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -219,11 +219,15 @@ encode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) | |||
| 219 | { \ | 219 | { \ |
| 220 | *dst++ = 0xA0, *dst++ = (c) | 0x80; \ | 220 | *dst++ = 0xA0, *dst++ = (c) | 0x80; \ |
| 221 | coding->composed_chars++; \ | 221 | coding->composed_chars++; \ |
| 222 | if (((c) | 0x80) < 0xA0) \ | ||
| 223 | coding->fake_multibyte = 1; \ | ||
| 222 | } \ | 224 | } \ |
| 223 | else \ | 225 | else \ |
| 224 | { \ | 226 | { \ |
| 225 | *dst++ = (c); \ | 227 | *dst++ = (c); \ |
| 226 | coding->produced_char++; \ | 228 | coding->produced_char++; \ |
| 229 | if ((c) >= 0x80) \ | ||
| 230 | coding->fake_multibyte = 1; \ | ||
| 227 | } \ | 231 | } \ |
| 228 | } while (0) | 232 | } while (0) |
| 229 | 233 | ||
| @@ -246,6 +250,8 @@ encode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) | |||
| 246 | if (leading_code = CHARSET_LEADING_CODE_EXT (charset)) \ | 250 | if (leading_code = CHARSET_LEADING_CODE_EXT (charset)) \ |
| 247 | *dst++ = leading_code; \ | 251 | *dst++ = leading_code; \ |
| 248 | *dst++ = (c) | 0x80; \ | 252 | *dst++ = (c) | 0x80; \ |
| 253 | if (((c) | 0x80) < 0xA0) \ | ||
| 254 | coding->fake_multibyte = 1; \ | ||
| 249 | } while (0) | 255 | } while (0) |
| 250 | 256 | ||
| 251 | /* Decode one DIMENSION2 character whose charset is CHARSET and whose | 257 | /* Decode one DIMENSION2 character whose charset is CHARSET and whose |
| @@ -255,6 +261,8 @@ encode_coding_XXX (coding, source, destination, src_bytes, dst_bytes) | |||
| 255 | do { \ | 261 | do { \ |
| 256 | DECODE_CHARACTER_DIMENSION1 (charset, c1); \ | 262 | DECODE_CHARACTER_DIMENSION1 (charset, c1); \ |
| 257 | *dst++ = (c2) | 0x80; \ | 263 | *dst++ = (c2) | 0x80; \ |
| 264 | if (((c2) | 0x80) < 0xA0) \ | ||
| 265 | coding->fake_multibyte = 1; \ | ||
| 258 | } while (0) | 266 | } while (0) |
| 259 | 267 | ||
| 260 | 268 | ||
| @@ -2022,7 +2030,7 @@ encode_coding_iso2022 (coding, source, destination, src_bytes, dst_bytes) | |||
| 2022 | ASCII 0x00 .. 0x7F | 2030 | ASCII 0x00 .. 0x7F |
| 2023 | KATAKANA-JISX0201 0xA0 .. 0xDF | 2031 | KATAKANA-JISX0201 0xA0 .. 0xDF |
| 2024 | JISX0208 (1st byte) 0x80 .. 0x9F and 0xE0 .. 0xEF | 2032 | JISX0208 (1st byte) 0x80 .. 0x9F and 0xE0 .. 0xEF |
| 2025 | (2nd byte) 0x40 .. 0xFF | 2033 | (2nd byte) 0x40 .. 0x7E and 0x80 .. 0xFC |
| 2026 | ------------------------------- | 2034 | ------------------------------- |
| 2027 | 2035 | ||
| 2028 | */ | 2036 | */ |
| @@ -2275,7 +2283,7 @@ decode_coding_sjis_big5 (coding, source, destination, | |||
| 2275 | { | 2283 | { |
| 2276 | /* SJIS -> JISX0208 */ | 2284 | /* SJIS -> JISX0208 */ |
| 2277 | ONE_MORE_BYTE (c2); | 2285 | ONE_MORE_BYTE (c2); |
| 2278 | if (c2 >= 0x40) | 2286 | if (c2 >= 0x40 && c2 != 0x7F && c2 <= 0xFC) |
| 2279 | { | 2287 | { |
| 2280 | DECODE_SJIS (c1, c2, c3, c4); | 2288 | DECODE_SJIS (c1, c2, c3, c4); |
| 2281 | DECODE_SJIS_BIG5_CHARACTER (charset_jisx0208, c3, c4); | 2289 | DECODE_SJIS_BIG5_CHARACTER (charset_jisx0208, c3, c4); |