aboutsummaryrefslogtreecommitdiffstats
path: root/src/coding.c
diff options
context:
space:
mode:
authorRichard M. Stallman1998-06-16 04:50:57 +0000
committerRichard M. Stallman1998-06-16 04:50:57 +0000
commit993824c9b3251048a492a57c382790ca0224a43a (patch)
treedcb2a04b600a5f560c3287512c930bfa8fde2223 /src/coding.c
parentf313ee82af3fb95f4da38ec4483c61f774241255 (diff)
downloademacs-993824c9b3251048a492a57c382790ca0224a43a.tar.gz
emacs-993824c9b3251048a492a57c382790ca0224a43a.zip
(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).
Diffstat (limited to 'src/coding.c')
-rw-r--r--src/coding.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/coding.c b/src/coding.c
index 36376b83ede..f6945d07308 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -2595,7 +2595,7 @@ decode_eol (coding, source, destination, src_bytes, dst_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 }
@@ -2662,18 +2662,16 @@ encode_eol (coding, source, destination, src_bytes, dst_bytes)
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