Mercurial > emacs
comparison src/coding.c @ 107506:cd151730b160
coding.c (decode_coding_ccl): Fix previous change for the multibyte case.
| author | Kenichi Handa <handa@m17n.org> |
|---|---|
| date | Tue, 16 Mar 2010 11:14:40 +0900 |
| parents | ebc10ed88b5c |
| children | 8960853cf85d |
comparison
equal
deleted
inserted
replaced
| 107505:cea18e9685bf | 107506:cd151730b160 |
|---|---|
| 5243 int *charbuf_end = coding->charbuf + coding->charbuf_size; | 5243 int *charbuf_end = coding->charbuf + coding->charbuf_size; |
| 5244 int consumed_chars = 0; | 5244 int consumed_chars = 0; |
| 5245 int multibytep = coding->src_multibyte; | 5245 int multibytep = coding->src_multibyte; |
| 5246 struct ccl_program *ccl = &coding->spec.ccl->ccl; | 5246 struct ccl_program *ccl = &coding->spec.ccl->ccl; |
| 5247 int source_charbuf[1024]; | 5247 int source_charbuf[1024]; |
| 5248 int source_byteidx[1024]; | 5248 int source_byteidx[1025]; |
| 5249 Lisp_Object attrs, charset_list; | 5249 Lisp_Object attrs, charset_list; |
| 5250 | 5250 |
| 5251 CODING_GET_INFO (coding, attrs, charset_list); | 5251 CODING_GET_INFO (coding, attrs, charset_list); |
| 5252 | 5252 |
| 5253 while (1) | 5253 while (1) |
| 5254 { | 5254 { |
| 5255 const unsigned char *p = src; | 5255 const unsigned char *p = src; |
| 5256 int i = 0; | 5256 int i = 0; |
| 5257 | 5257 |
| 5258 if (multibytep) | 5258 if (multibytep) |
| 5259 while (i < 1024 && p < src_end) | 5259 { |
| 5260 { | 5260 while (i < 1024 && p < src_end) |
| 5261 source_byteidx[i] = p - src; | 5261 { |
| 5262 source_charbuf[i++] = STRING_CHAR_ADVANCE (p); | 5262 source_byteidx[i] = p - src; |
| 5263 } | 5263 source_charbuf[i++] = STRING_CHAR_ADVANCE (p); |
| 5264 } | |
| 5265 source_byteidx[i] = p - src; | |
| 5266 } | |
| 5264 else | 5267 else |
| 5265 while (i < 1024 && p < src_end) | 5268 while (i < 1024 && p < src_end) |
| 5266 source_charbuf[i++] = *p++; | 5269 source_charbuf[i++] = *p++; |
| 5267 | 5270 |
| 5268 if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) | 5271 if (p == src_end && coding->mode & CODING_MODE_LAST_BLOCK) |
| 5269 ccl->last_block = 1; | 5272 ccl->last_block = 1; |
| 5270 ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, | 5273 ccl_driver (ccl, source_charbuf, charbuf, i, charbuf_end - charbuf, |
| 5271 charset_list); | 5274 charset_list); |
| 5272 charbuf += ccl->produced; | 5275 charbuf += ccl->produced; |
| 5273 if (multibytep && ccl->consumed < i) | 5276 if (multibytep) |
| 5274 src += source_byteidx[ccl->consumed]; | 5277 src += source_byteidx[ccl->consumed]; |
| 5275 else | 5278 else |
| 5276 src += ccl->consumed; | 5279 src += ccl->consumed; |
| 5277 consumed_chars += ccl->consumed; | 5280 consumed_chars += ccl->consumed; |
| 5278 if (p == src_end || ccl->status != CCL_STAT_SUSPEND_BY_SRC) | 5281 if (p == src_end || ccl->status != CCL_STAT_SUSPEND_BY_SRC) |
