mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-12-18 10:16:51 +00:00
(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.
This commit is contained in:
parent
1ee0bc0950
commit
9864ebcee4
23
src/coding.c
23
src/coding.c
@ -3625,6 +3625,10 @@ ccl_coding_driver (coding, source, destination, src_bytes, dst_bytes, encodep)
|
||||
case CCL_STAT_SUSPEND_BY_DST:
|
||||
result = CODING_FINISH_INSUFFICIENT_DST;
|
||||
break;
|
||||
case CCL_STAT_QUIT:
|
||||
case CCL_STAT_INVALID_CMD:
|
||||
result = CODING_FINISH_INTERRUPT;
|
||||
break;
|
||||
default:
|
||||
result = CODING_FINISH_NORMAL;
|
||||
break;
|
||||
@ -4253,6 +4257,11 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
|
||||
src += coding->consumed;
|
||||
dst += inserted_byte;
|
||||
|
||||
if (result == CODING_FINISH_NORMAL)
|
||||
{
|
||||
src += len_byte;
|
||||
break;
|
||||
}
|
||||
if (! encodep && result == CODING_FINISH_INCONSISTENT_EOL)
|
||||
{
|
||||
unsigned char *pend = dst, *p = pend - inserted_byte;
|
||||
@ -4320,6 +4329,20 @@ code_convert_region (from, from_byte, to, to_byte, coding, encodep, replace)
|
||||
fake_multibyte = 1;
|
||||
break;
|
||||
}
|
||||
if (result == CODING_FINISH_INTERRUPT)
|
||||
{
|
||||
/* The conversion procedure was interrupted by a user. */
|
||||
fake_multibyte = 1;
|
||||
break;
|
||||
}
|
||||
/* Now RESULT == CODING_FINISH_INSUFFICIENT_DST */
|
||||
if (coding->consumed < 1)
|
||||
{
|
||||
/* It's quite strange to require more memory without
|
||||
consuming any bytes. Perhaps CCL program bug. */
|
||||
fake_multibyte = 1;
|
||||
break;
|
||||
}
|
||||
if (first)
|
||||
{
|
||||
/* We have just done the first batch of conversion which was
|
||||
|
Loading…
Reference in New Issue
Block a user