1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-28 07:45:00 +00:00

Fix decoding DOS EOL in a unibyte buffer

* src/coding.c (decode_eol): Loop over bytes, not characters.
(Bug#5251)
This commit is contained in:
Eli Zaretskii 2016-02-17 17:48:30 +02:00
parent 2abcb06cab
commit 289d5c6e97

View File

@ -6828,11 +6828,11 @@ decode_eol (struct coding_system *coding)
} }
else else
{ {
ptrdiff_t pos_byte = coding->dst_pos_byte;
ptrdiff_t pos = coding->dst_pos; ptrdiff_t pos = coding->dst_pos;
ptrdiff_t pos_end = pos + coding->produced_char - 1; ptrdiff_t pos_byte = coding->dst_pos_byte;
ptrdiff_t pos_end = pos_byte + coding->produced - 1;
while (pos < pos_end) while (pos_byte < pos_end)
{ {
p = BYTE_POS_ADDR (pos_byte); p = BYTE_POS_ADDR (pos_byte);
if (*p == '\r' && p[1] == '\n') if (*p == '\r' && p[1] == '\n')