diff options
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/coding.c b/src/coding.c index 4b3d22f956c..40e67b9a6c8 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5106,6 +5106,7 @@ decode_coding_ccl (struct coding_system *coding) | |||
| 5106 | while (1) | 5106 | while (1) |
| 5107 | { | 5107 | { |
| 5108 | const unsigned char *p = src; | 5108 | const unsigned char *p = src; |
| 5109 | ptrdiff_t offset; | ||
| 5109 | int i = 0; | 5110 | int i = 0; |
| 5110 | 5111 | ||
| 5111 | if (multibytep) | 5112 | if (multibytep) |
| @@ -5123,8 +5124,17 @@ decode_coding_ccl (struct coding_system *coding) | |||
| 5123 | 5124 | ||
| 5124 | if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) | 5125 | if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) |
| 5125 | ccl->last_block = 1; | 5126 | ccl->last_block = 1; |
| 5127 | /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */ | ||
| 5128 | charset_map_loaded = 0; | ||
| 5126 | ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, | 5129 | ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, |
| 5127 | charset_list); | 5130 | charset_list); |
| 5131 | if (charset_map_loaded | ||
| 5132 | && (offset = coding_change_source (coding))) | ||
| 5133 | { | ||
| 5134 | p += offset; | ||
| 5135 | src += offset; | ||
| 5136 | src_end += offset; | ||
| 5137 | } | ||
| 5128 | charbuf += ccl->produced; | 5138 | charbuf += ccl->produced; |
| 5129 | if (multibytep) | 5139 | if (multibytep) |
| 5130 | src += source_byteidx[ccl->consumed]; | 5140 | src += source_byteidx[ccl->consumed]; |
| @@ -5177,8 +5187,15 @@ encode_coding_ccl (struct coding_system *coding) | |||
| 5177 | 5187 | ||
| 5178 | do | 5188 | do |
| 5179 | { | 5189 | { |
| 5190 | ptrdiff_t offset; | ||
| 5191 | |||
| 5192 | /* As ccl_driver calls DECODE_CHAR, buffer may be relocated. */ | ||
| 5193 | charset_map_loaded = 0; | ||
| 5180 | ccl_driver (ccl, charbuf, destination_charbuf, | 5194 | ccl_driver (ccl, charbuf, destination_charbuf, |
| 5181 | charbuf_end - charbuf, 1024, charset_list); | 5195 | charbuf_end - charbuf, 1024, charset_list); |
| 5196 | if (charset_map_loaded | ||
| 5197 | && (offset = coding_change_destination (coding))) | ||
| 5198 | dst += offset; | ||
| 5182 | if (multibytep) | 5199 | if (multibytep) |
| 5183 | { | 5200 | { |
| 5184 | ASSURE_DESTINATION (ccl->produced * 2); | 5201 | ASSURE_DESTINATION (ccl->produced * 2); |