unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#8619: 23.3.50; CCL coding system encoder doesn't run CCL_EOF_CODE on zero length string
@ 2011-05-05  2:35 Kazuhiro Ito
  2011-05-27 21:46 ` Kazuhiro Ito
  0 siblings, 1 reply; 4+ messages in thread
From: Kazuhiro Ito @ 2011-05-05  2:35 UTC (permalink / raw)
  To: 8619

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





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

* bug#8619: 23.3.50; CCL coding system encoder doesn't run CCL_EOF_CODE on zero length string
  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
  2011-05-30 16:07   ` Stefan Monnier
  0 siblings, 1 reply; 4+ messages in thread
From: Kazuhiro Ito @ 2011-05-27 21:46 UTC (permalink / raw)
  To: 8619

[-- 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)
     {

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

* bug#8619: 23.3.50; CCL coding system encoder doesn't run CCL_EOF_CODE on zero length string
  2011-05-27 21:46 ` Kazuhiro Ito
@ 2011-05-30 16:07   ` Stefan Monnier
  2011-12-09  5:26     ` Kenichi Handa
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2011-05-30 16:07 UTC (permalink / raw)
  To: Kenichi Handa; +Cc: Kazuhiro Ito, 8619

> 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.

That sounds right.  Handa, could you confirm?


        Stefan


>> 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






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

* bug#8619: 23.3.50; CCL coding system encoder doesn't run CCL_EOF_CODE on zero length string
  2011-05-30 16:07   ` Stefan Monnier
@ 2011-12-09  5:26     ` Kenichi Handa
  0 siblings, 0 replies; 4+ messages in thread
From: Kenichi Handa @ 2011-12-09  5:26 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: kzhr, 8619

In article <jwvfwnw18dd.fsf-monnier+emacs@gnu.org>, Stefan Monnier <monnier@iro.umontreal.ca> writes:

> > 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.

> That sounds right.  Handa, could you confirm?

Yes, his patch is correct.  I've committed it.

---
Kenichi Handa
handa@m17n.org





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

end of thread, other threads:[~2011-12-09  5:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2011-05-30 16:07   ` Stefan Monnier
2011-12-09  5:26     ` Kenichi Handa

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).