Mercurial > emacs
comparison src/coding.c @ 22502:627b13315f04
(encode_eol): Fix typo that prevented converting to Mac
line endings. Always update dst_bytes to number of bytes actually copied.
(decode_eol): Fix value of coding->produced when decoding Unix
line endings (in case this function is ever used for that).
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 16 Jun 1998 04:50:57 +0000 |
parents | 7ca919476042 |
children | d9eac134a41b |
comparison
equal
deleted
inserted
replaced
22501:d2edb98d0fa5 | 22502:627b13315f04 |
---|---|
2593 if (dst_bytes) | 2593 if (dst_bytes) |
2594 bcopy (source, destination, src_bytes); | 2594 bcopy (source, destination, src_bytes); |
2595 else | 2595 else |
2596 safe_bcopy (source, destination, src_bytes); | 2596 safe_bcopy (source, destination, src_bytes); |
2597 src += src_bytes; | 2597 src += src_bytes; |
2598 dst += dst_bytes; | 2598 dst += src_bytes; |
2599 coding->fake_multibyte = 1; | 2599 coding->fake_multibyte = 1; |
2600 break; | 2600 break; |
2601 } | 2601 } |
2602 | 2602 |
2603 coding->consumed = coding->consumed_char = src - source; | 2603 coding->consumed = coding->consumed_char = src - source; |
2660 result = CODING_FINISH_INSUFFICIENT_DST; | 2660 result = CODING_FINISH_INSUFFICIENT_DST; |
2661 } | 2661 } |
2662 if (dst_bytes) | 2662 if (dst_bytes) |
2663 bcopy (source, destination, src_bytes); | 2663 bcopy (source, destination, src_bytes); |
2664 else | 2664 else |
2665 { | 2665 safe_bcopy (source, destination, src_bytes); |
2666 safe_bcopy (source, destination, src_bytes); | 2666 dst_bytes = src_bytes; |
2667 dst_bytes = src_bytes; | 2667 if (coding->eol_type == CODING_EOL_CR) |
2668 } | |
2669 if (coding->eol_type == CODING_EOL_CRLF) | |
2670 { | 2668 { |
2671 while (src_bytes--) | 2669 while (src_bytes--) |
2672 { | 2670 { |
2673 if ((c = *dst++) == '\n') | 2671 if ((c = *dst++) == '\n') |
2674 dst[-1] = '\r'; | 2672 dst[-1] = '\r'; |
2675 else if (BASE_LEADING_CODE_P (c)) | 2673 else if (BASE_LEADING_CODE_P (c)) |
2676 coding->fake_multibyte = 1; | 2674 coding->fake_multibyte = 1; |
2677 } | 2675 } |
2678 } | 2676 } |
2679 else | 2677 else |
2680 { | 2678 { |
2681 if (coding->mode & CODING_MODE_SELECTIVE_DISPLAY) | 2679 if (coding->mode & CODING_MODE_SELECTIVE_DISPLAY) |