unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#5251: 23.1; problem in decode_eol of coding.c
@ 2009-12-20  8:57 Toru TSUNEYOSHI
  2016-02-17  3:41 ` Andrew Hyatt
  0 siblings, 1 reply; 6+ messages in thread
From: Toru TSUNEYOSHI @ 2009-12-20  8:57 UTC (permalink / raw)
  To: bug-gnu-emacs

[-- Attachment #1: Type: Text/Plain, Size: 1008 bytes --]

In GNU Emacs 23.1, there is a problem in decode_eol of coding.c.

In buffer of which enable-multibyte-characters is nil,
the function `decode-coding-region' should delete the character '^M'
(code: 0x0d) at the end of line,
in case that the function parameter `coding-system' is *-dos (and
the variable `inhibit-eol-conversion' is nil).
But, in practice, the function doesn't delete all of the character '^M'.

You can watch the problem with the following.

========================================================================
(progn
  (pop-to-buffer (generate-new-buffer-name "*scratch*"))
  (set-buffer-multibyte nil)
  (insert (encode-coding-string "あ" 'euc-jp) "\xd" "\n")
  (read-char "(press any key)")
  (decode-coding-region (point-min) (point-max) 'euc-jp-dos)
  (read-char "doesn't delete all of the character '^M'. (press any key)")
  (set-buffer-multibyte t))
========================================================================

I made a patch to fix the problem. Please check it.

[-- Attachment #2: coding.c__decode_eol.diff --]
[-- Type: Text/X-Patch, Size: 395 bytes --]

--- coding.c.orig	2009-07-08 12:09:16.000000000 +0900
+++ coding.c	2009-12-20 16:36:45.887121600 +0900
@@ -6598,7 +6598,8 @@
 	{
 	  int pos_byte = coding->dst_pos_byte;
 	  int pos = coding->dst_pos;
-	  int pos_end = pos + coding->produced_char - 1;
+	  int pos_end = pos + (coding->dst_multibyte
+			       ? coding->produced_char : coding->produced) - 1;
 
 	  while (pos < pos_end)
 	    {

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-02-18  2:56 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-20  8:57 bug#5251: 23.1; problem in decode_eol of coding.c Toru TSUNEYOSHI
2016-02-17  3:41 ` Andrew Hyatt
2016-02-17 15:53   ` Eli Zaretskii
2016-02-17 17:03     ` Toru TSUNEYOSHI
2016-02-17 19:24       ` Eli Zaretskii
2016-02-18  2:56         ` Toru TSUNEYOSHI

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).