changeset 23279:ca159e828a68

(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.
author Kenichi Handa <handa@m17n.org>
date Fri, 18 Sep 1998 13:10:40 +0000
parents bad51ca51df3
children b4656367043f
files src/coding.c
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/coding.c	Fri Sep 18 13:10:40 1998 +0000
+++ b/src/coding.c	Fri Sep 18 13:10:40 1998 +0000
@@ -3625,6 +3625,10 @@
     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 @@
       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 @@
 	  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