unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kazuhiro Ito <kzhr@d1.dion.ne.jp>
To: 8619@debbugs.gnu.org
Subject: bug#8619: 23.3.50; CCL coding system encoder doesn't run CCL_EOF_CODE on zero length string
Date: Sat, 28 May 2011 06:46:07 +0900	[thread overview]
Message-ID: <20110527214619.7407C360038@msa102.auone-net.jp> (raw)
In-Reply-To: <20110505023551.6981134803A@msa103.auone-net.jp>

[-- Attachment #1: Type: text/plain, Size: 782 bytes --]

I think the cause of the problem is that encode_codin_ccl() does not
call ccl_driver() for zero length string.  Please see the attached
patch.

> When I start emacs (emacs-23 branch and trunk) with -Q and evaluate
> below code, I receive unexpected result.
> 
> (let ((string ""))
>   (define-ccl-program ccl-test
>     '(1
>       ((read r0))
>       ((write "[EOF]"))))
>   (make-coding-system 'ccl-test-cs 4 ?T "CCL_EOF_BLOCK tester"
> 		      '(ccl-test . ccl-test))
>   (list
>    (ccl-execute-on-string 'ccl-test (make-vector 9 0) string)
>    (decode-coding-string string 'ccl-test-cs)
>    (encode-coding-string string 'ccl-test-cs)))
> 
> It returns
>   ("[EOF]" "[EOF]" "")
> But emacs22 returns
>   ("[EOF]" "[EOF]" "[EOF]")
> and I expect such result.

-- 
Kazuhiro Ito

[-- Attachment #2: coding.c.diff --]
[-- Type: application/octet-stream, Size: 516 bytes --]

=== modified file 'src/coding.c'
--- src/coding.c	2011-05-09 09:59:23 +0000
+++ src/coding.c	2011-05-27 12:13:14 +0000
@@ -5325,7 +5325,7 @@
       && coding->mode & CODING_MODE_LAST_BLOCK)
     ccl->last_block = 1;
 
-  while (charbuf < charbuf_end)
+  do
     {
       ccl_driver (ccl, charbuf, destination_charbuf,
 		  charbuf_end - charbuf, 1024, charset_list);
@@ -5347,6 +5347,7 @@
 	  || ccl->status == CCL_STAT_INVALID_CMD)
 	break;
     }
+  while (charbuf < charbuf_end);
 
   switch (ccl->status)
     {

  reply	other threads:[~2011-05-27 21:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-05  2:35 bug#8619: 23.3.50; CCL coding system encoder doesn't run CCL_EOF_CODE on zero length string Kazuhiro Ito
2011-05-27 21:46 ` Kazuhiro Ito [this message]
2011-05-30 16:07   ` Stefan Monnier
2011-12-09  5:26     ` Kenichi Handa

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110527214619.7407C360038@msa102.auone-net.jp \
    --to=kzhr@d1.dion.ne.jp \
    --cc=8619@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).