aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2012-09-30 23:44:30 +0900
committerKenichi Handa2012-09-30 23:44:30 +0900
commit163227893c97b5b41039ea9d5ceadb7e5b2d570c (patch)
treedc129a60013f285c27859ae57cc0686f5a1adc5b /src
parentd7e642cc001a237dda8511f99b284e1a22865024 (diff)
parentc194970e15b6d6efa07697679a25dfab3aa76442 (diff)
downloademacs-163227893c97b5b41039ea9d5ceadb7e5b2d570c.tar.gz
emacs-163227893c97b5b41039ea9d5ceadb7e5b2d570c.zip
coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention to the buffer relocation which may be caused by ccl_driver.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/coding.c17
2 files changed, 22 insertions, 0 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 119651e0651..1f5ad1e6d05 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,8 @@
12012-09-30 Kenichi Handa <handa@gnu.org>
2
3 * coding.c (decode_coding_ccl, encode_coding_ccl): Pay attention
4 to the buffer relocation which may be caused by ccl_driver.
5
12012-09-30 Jan Djärv <jan.h.d@swipnet.se> 62012-09-30 Jan Djärv <jan.h.d@swipnet.se>
2 7
3 * xfns.c (Fx_file_dialog): Update comment. 8 * xfns.c (Fx_file_dialog): Update comment.
diff --git a/src/coding.c b/src/coding.c
index 13f53ad5abc..32d300b9923 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -5059,6 +5059,7 @@ decode_coding_ccl (struct coding_system *coding)
5059 while (1) 5059 while (1)
5060 { 5060 {
5061 const unsigned char *p = src; 5061 const unsigned char *p = src;
5062 ptrdiff_t offset;
5062 int i = 0; 5063 int i = 0;
5063 5064
5064 if (multibytep) 5065 if (multibytep)
@@ -5076,8 +5077,17 @@ decode_coding_ccl (struct coding_system *coding)
5076 5077
5077 if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) 5078 if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK)
5078 ccl->last_block = 1; 5079 ccl->last_block = 1;
5080 /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */
5081 charset_map_loaded = 0;
5079 ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, 5082 ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf,
5080 charset_list); 5083 charset_list);
5084 if (charset_map_loaded
5085 && (offset = coding_change_source (coding)))
5086 {
5087 p += offset;
5088 src += offset;
5089 src_end += offset;
5090 }
5081 charbuf += ccl->produced; 5091 charbuf += ccl->produced;
5082 if (multibytep) 5092 if (multibytep)
5083 src += source_byteidx[ccl->consumed]; 5093 src += source_byteidx[ccl->consumed];
@@ -5130,8 +5140,15 @@ encode_coding_ccl (struct coding_system *coding)
5130 5140
5131 do 5141 do
5132 { 5142 {
5143 ptrdiff_t offset;
5144
5145 /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */
5146 charset_map_loaded = 0;
5133 ccl_driver (ccl, charbuf, destination_charbuf, 5147 ccl_driver (ccl, charbuf, destination_charbuf,
5134 charbuf_end - charbuf, 1024, charset_list); 5148 charbuf_end - charbuf, 1024, charset_list);
5149 if (charset_map_loaded
5150 && (offset = coding_change_destination (coding)))
5151 dst += offset;
5135 if (multibytep) 5152 if (multibytep)
5136 { 5153 {
5137 ASSURE_DESTINATION (ccl->produced * 2); 5154 ASSURE_DESTINATION (ccl->produced * 2);