emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r110285: coding.c (decode_coding_ccl,


From: Kenichi Handa
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r110285: coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention to the buffer relocation which may be caused by ccl_driver.
Date: Sun, 30 Sep 2012 23:44:30 +0900
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 110285 [merge]
committer: Kenichi Handa <address@hidden>
branch nick: trunk
timestamp: Sun 2012-09-30 23:44:30 +0900
message:
  coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention to the buffer 
relocation which may be caused by ccl_driver.
modified:
  src/ChangeLog
  src/coding.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-09-30 13:43:47 +0000
+++ b/src/ChangeLog     2012-09-30 14:44:30 +0000
@@ -1,3 +1,8 @@
+2012-09-30  Kenichi Handa  <address@hidden>
+
+       * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention
+       to the buffer relocation which may be caused by ccl_driver.
+
 2012-09-30  Jan Djärv  <address@hidden>
 
        * xfns.c (Fx_file_dialog): Update comment.

=== modified file 'src/coding.c'
--- a/src/coding.c      2012-09-25 12:44:13 +0000
+++ b/src/coding.c      2012-09-30 14:39:46 +0000
@@ -5059,6 +5059,7 @@
   while (1)
     {
       const unsigned char *p = src;
+      ptrdiff_t offset;
       int i = 0;
 
       if (multibytep)
@@ -5076,8 +5077,17 @@
 
       if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK)
        ccl->last_block = 1;
+      /* As ccl_driver calls DECODE_CHAR, buffer may be relocated.  */
+      charset_map_loaded = 0;
       ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf,
                  charset_list);
+      if (charset_map_loaded
+         && (offset = coding_change_source (coding)))
+       {
+         p += offset;
+         src += offset;
+         src_end += offset;
+       }
       charbuf += ccl->produced;
       if (multibytep)
        src += source_byteidx[ccl->consumed];
@@ -5130,8 +5140,15 @@
 
   do
     {
+      ptrdiff_t offset;
+
+      /* As ccl_driver calls DECODE_CHAR, buffer may be relocated.  */
+      charset_map_loaded = 0;
       ccl_driver (ccl, charbuf, destination_charbuf,
                  charbuf_end - charbuf, 1024, charset_list);
+      if (charset_map_loaded
+         && (offset = coding_change_destination (coding)))
+       dst += offset;
       if (multibytep)
        {
          ASSURE_DESTINATION (ccl->produced * 2);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]