diff options
| author | Kenichi Handa | 1998-09-18 13:10:40 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1998-09-18 13:10:40 +0000 |
| commit | 9864ebcee4638bddc1f0ffb4a0742713c5024318 (patch) | |
| tree | 185a0387bb0bb9c0233f748f285f36a7a1ff5e34 /src/coding.c | |
| parent | 1ee0bc0950819fbe4e88b4918b45f53f93f9e7f4 (diff) | |
| download | emacs-9864ebcee4638bddc1f0ffb4a0742713c5024318.tar.gz emacs-9864ebcee4638bddc1f0ffb4a0742713c5024318.zip | |
(ccl_coding_driver): If ccl_driver is interrupted by a
user or the CCL program executed an invalid command, return
CODING_FINISH_INTERRUPT.
(code_convert_region): Pay attention to the converters return
value CODING_FINISH_NORMAL and CODING_FINISH_INTERRUPT.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/coding.c b/src/coding.c index bc6035eb25b..47268d340bf 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -3625,6 +3625,10 @@ ccl_coding_driver (coding, source, destination, src_bytes, dst_bytes, encodep) | |||
| 3625 | case CCL_STAT_SUSPEND_BY_DST: | 3625 | case CCL_STAT_SUSPEND_BY_DST: |
| 3626 | result = CODING_FINISH_INSUFFICIENT_DST; | 3626 | result = CODING_FINISH_INSUFFICIENT_DST; |
| 3627 | break; | 3627 | break; |
| 3628 | case CCL_STAT_QUIT: | ||
| 3629 | case CCL_STAT_INVALID_CMD: | ||
| 3630 | result = CODING_FINISH_INTERRUPT; | ||
| 3631 | break; | ||
| 3628 | default: | 3632 | default: |
| 3629 | result = CODING_FINISH_NORMAL; | 3633 | result = CODING_FINISH_NORMAL; |
| 3630 | break; | 3634 | break; |
| @@ -4253,6 +4257,11 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 4253 | src += coding->consumed; | 4257 | src += coding->consumed; |
| 4254 | dst += inserted_byte; | 4258 | dst += inserted_byte; |
| 4255 | 4259 | ||
| 4260 | if (result == CODING_FINISH_NORMAL) | ||
| 4261 | { | ||
| 4262 | src += len_byte; | ||
| 4263 | break; | ||
| 4264 | } | ||
| 4256 | if (! encodep && result == CODING_FINISH_INCONSISTENT_EOL) | 4265 | if (! encodep && result == CODING_FINISH_INCONSISTENT_EOL) |
| 4257 | { | 4266 | { |
| 4258 | unsigned char *pend = dst, *p = pend - inserted_byte; | 4267 | unsigned char *pend = dst, *p = pend - inserted_byte; |
| @@ -4320,6 +4329,20 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace) | |||
| 4320 | fake_multibyte = 1; | 4329 | fake_multibyte = 1; |
| 4321 | break; | 4330 | break; |
| 4322 | } | 4331 | } |
| 4332 | if (result == CODING_FINISH_INTERRUPT) | ||
| 4333 | { | ||
| 4334 | /* The conversion procedure was interrupted by a user. */ | ||
| 4335 | fake_multibyte = 1; | ||
| 4336 | break; | ||
| 4337 | } | ||
| 4338 | /* Now RESULT == CODING_FINISH_INSUFFICIENT_DST */ | ||
| 4339 | if (coding->consumed < 1) | ||
| 4340 | { | ||
| 4341 | /* It's quite strange to require more memory without | ||
| 4342 | consuming any bytes. Perhaps CCL program bug. */ | ||
| 4343 | fake_multibyte = 1; | ||
| 4344 | break; | ||
| 4345 | } | ||
| 4323 | if (first) | 4346 | if (first) |
| 4324 | { | 4347 | { |
| 4325 | /* We have just done the first batch of conversion which was | 4348 | /* We have just done the first batch of conversion which was |