diff options
| author | Kenichi Handa | 1998-12-15 04:35:38 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-12-15 04:35:38 +0000 |
| commit | 944bd420048ab53a7c30ecd6a3d7c8cfa516e60e (patch) | |
| tree | a776e524317eb0dfa015eaab99776be28176878c /src | |
| parent | 02a08df0ab3cfbbba735993bd1bb94d02b1fd827 (diff) | |
| download | emacs-944bd420048ab53a7c30ecd6a3d7c8cfa516e60e.tar.gz emacs-944bd420048ab53a7c30ecd6a3d7c8cfa516e60e.zip | |
(DECODE_DESIGNATION): Jump to label_invalid_code if
final_char is invalid.
(decode_coding): If coding->type is coding_type_ccl, call
ccl_coding_driver even if SRC_BYTES is zero.
(code_convert_region): Update `inserted' correctly after calling
coding->post_read_conversion. Even after the code converter
consumed all source text, call it once more if it is
coding_type_ccl to flush out data.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/src/coding.c b/src/coding.c index e9d9b16ba10..5be7095189e 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -937,9 +937,13 @@ detect_coding_iso2022 (src, src_end) | |||
| 937 | /* Set designation state into CODING. */ | 937 | /* Set designation state into CODING. */ |
| 938 | #define DECODE_DESIGNATION(reg, dimension, chars, final_char) \ | 938 | #define DECODE_DESIGNATION(reg, dimension, chars, final_char) \ |
| 939 | do { \ | 939 | do { \ |
| 940 | int charset = ISO_CHARSET_TABLE (make_number (dimension), \ | 940 | int charset; \ |
| 941 | make_number (chars), \ | 941 | \ |
| 942 | make_number (final_char)); \ | 942 | if (final_char < '0' || final_char >= 128) \ |
| 943 | goto label_invalid_code; \ | ||
| 944 | charset = ISO_CHARSET_TABLE (make_number (dimension), \ | ||
| 945 | make_number (chars), \ | ||
| 946 | make_number (final_char)); \ | ||
| 943 | if (charset >= 0 \ | 947 | if (charset >= 0 \ |
| 944 | && (CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) == reg \ | 948 | && (CODING_SPEC_ISO_REQUESTED_DESIGNATION (coding, charset) == reg \ |
| 945 | || coding->safe_charsets[charset])) \ | 949 | || coding->safe_charsets[charset])) \ |
| @@ -3694,6 +3698,7 @@ decode_coding (coding, source, destination, src_bytes, dst_bytes) | |||
| 3694 | int result; | 3698 | int result; |
| 3695 | 3699 | ||
| 3696 | if (src_bytes <= 0 | 3700 | if (src_bytes <= 0 |
| 3701 | && coding->type != coding_type_ccl | ||
| 3697 | && ! (coding->mode & CODING_MODE_LAST_BLOCK | 3702 | && ! (coding->mode & CODING_MODE_LAST_BLOCK |
| 3698 | && CODING_REQUIRE_FLUSHING (coding))) | 3703 | && CODING_REQUIRE_FLUSHING (coding))) |
| 3699 | { | 3704 | { |
| @@ -4310,6 +4315,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 4310 | move_gap_both (from, from_byte); | 4315 | move_gap_both (from, from_byte); |
| 4311 | SHRINK_CONVERSION_REGION (&from_byte, &to_byte, coding, NULL, encodep); | 4316 | SHRINK_CONVERSION_REGION (&from_byte, &to_byte, coding, NULL, encodep); |
| 4312 | if (from_byte == to_byte | 4317 | if (from_byte == to_byte |
| 4318 | && coding->type != coding_type_ccl | ||
| 4313 | && ! (coding->mode & CODING_MODE_LAST_BLOCK | 4319 | && ! (coding->mode & CODING_MODE_LAST_BLOCK |
| 4314 | && CODING_REQUIRE_FLUSHING (coding))) | 4320 | && CODING_REQUIRE_FLUSHING (coding))) |
| 4315 | { | 4321 | { |
| @@ -4452,7 +4458,13 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 4452 | continue; | 4458 | continue; |
| 4453 | } | 4459 | } |
| 4454 | if (len_byte <= 0) | 4460 | if (len_byte <= 0) |
| 4455 | break; | 4461 | { |
| 4462 | if (coding->type != coding_type_ccl | ||
| 4463 | || coding->mode & CODING_MODE_LAST_BLOCK) | ||
| 4464 | break; | ||
| 4465 | coding->mode |= CODING_MODE_LAST_BLOCK; | ||
| 4466 | continue; | ||
| 4467 | } | ||
| 4456 | if (result == CODING_FINISH_INSUFFICIENT_SRC) | 4468 | if (result == CODING_FINISH_INSUFFICIENT_SRC) |
| 4457 | { | 4469 | { |
| 4458 | /* The source text ends in invalid codes. Let's just | 4470 | /* The source text ends in invalid codes. Let's just |
| @@ -4547,7 +4559,7 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 4547 | prev_Z = Z; | 4559 | prev_Z = Z; |
| 4548 | val = call1 (coding->post_read_conversion, make_number (inserted)); | 4560 | val = call1 (coding->post_read_conversion, make_number (inserted)); |
| 4549 | CHECK_NUMBER (val, 0); | 4561 | CHECK_NUMBER (val, 0); |
| 4550 | inserted = Z - prev_Z; | 4562 | inserted += Z - prev_Z; |
| 4551 | } | 4563 | } |
| 4552 | 4564 | ||
| 4553 | if (orig_point >= from) | 4565 | if (orig_point >= from) |