diff options
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/coding.c b/src/coding.c index baf6acf08af..be8051ef456 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -4590,7 +4590,7 @@ decode_eol_post_ccl (coding, ptr, bytes) | |||
| 4590 | { | 4590 | { |
| 4591 | /* If the last character is CR, we can't handle it here | 4591 | /* If the last character is CR, we can't handle it here |
| 4592 | because LF will be in the not-yet-decoded source text. | 4592 | because LF will be in the not-yet-decoded source text. |
| 4593 | Recorded that the CR is not yet processed. */ | 4593 | Record that the CR is not yet processed. */ |
| 4594 | coding->spec.ccl.cr_carryover = 1; | 4594 | coding->spec.ccl.cr_carryover = 1; |
| 4595 | coding->produced--; | 4595 | coding->produced--; |
| 4596 | coding->produced_char--; | 4596 | coding->produced_char--; |
| @@ -4686,6 +4686,8 @@ decode_coding (coding, source, destination, src_bytes, dst_bytes) | |||
| 4686 | unsigned char *source, *destination; | 4686 | unsigned char *source, *destination; |
| 4687 | int src_bytes, dst_bytes; | 4687 | int src_bytes, dst_bytes; |
| 4688 | { | 4688 | { |
| 4689 | int extra = 0; | ||
| 4690 | |||
| 4689 | if (coding->type == coding_type_undecided) | 4691 | if (coding->type == coding_type_undecided) |
| 4690 | detect_coding (coding, source, src_bytes); | 4692 | detect_coding (coding, source, src_bytes); |
| 4691 | 4693 | ||
| @@ -4728,18 +4730,24 @@ decode_coding (coding, source, destination, src_bytes, dst_bytes) | |||
| 4728 | case coding_type_ccl: | 4730 | case coding_type_ccl: |
| 4729 | if (coding->spec.ccl.cr_carryover) | 4731 | if (coding->spec.ccl.cr_carryover) |
| 4730 | { | 4732 | { |
| 4731 | /* Set the CR which is not processed by the previous call of | 4733 | /* Put the CR which was not processed by the previous call |
| 4732 | decode_eol_post_ccl in DESTINATION. */ | 4734 | of decode_eol_post_ccl in DESTINATION. It will be |
| 4735 | decoded together with the following LF by the call to | ||
| 4736 | decode_eol_post_ccl below. */ | ||
| 4733 | *destination = '\r'; | 4737 | *destination = '\r'; |
| 4734 | coding->produced++; | 4738 | coding->produced++; |
| 4735 | coding->produced_char++; | 4739 | coding->produced_char++; |
| 4736 | dst_bytes--; | 4740 | dst_bytes--; |
| 4741 | extra = coding->spec.ccl.cr_carryover; | ||
| 4737 | } | 4742 | } |
| 4738 | ccl_coding_driver (coding, source, | 4743 | ccl_coding_driver (coding, source, destination + extra, |
| 4739 | destination + coding->spec.ccl.cr_carryover, | ||
| 4740 | src_bytes, dst_bytes, 0); | 4744 | src_bytes, dst_bytes, 0); |
| 4741 | if (coding->eol_type != CODING_EOL_LF) | 4745 | if (coding->eol_type != CODING_EOL_LF) |
| 4742 | decode_eol_post_ccl (coding, destination, coding->produced); | 4746 | { |
| 4747 | coding->produced += extra; | ||
| 4748 | coding->produced_char += extra; | ||
| 4749 | decode_eol_post_ccl (coding, destination, coding->produced); | ||
| 4750 | } | ||
| 4743 | break; | 4751 | break; |
| 4744 | 4752 | ||
| 4745 | default: | 4753 | default: |