diff src/coding.c @ 29985:c17e78d8c720

(code_convert_region): Even if the length of text is zero, try to convert it if coding->type is coding_type_ccl. (decode_coding_string, encode_coding_string): Likewise.
author Kenichi Handa <handa@m17n.org>
date Fri, 30 Jun 2000 02:56:45 +0000
parents 37a3b3eae862
children 35aec8514228
line wrap: on
line diff
--- a/src/coding.c	Fri Jun 30 02:56:11 2000 +0000
+++ b/src/coding.c	Fri Jun 30 02:56:45 2000 +0000
@@ -4802,31 +4802,32 @@
     }
 
   /* Try to skip the heading and tailing ASCIIs.  */
-  {
-    int from_byte_orig = from_byte, to_byte_orig = to_byte;
-
-    if (from < GPT && GPT < to)
-      move_gap_both (from, from_byte);
-    SHRINK_CONVERSION_REGION (&from_byte, &to_byte, coding, NULL, encodep);
-    if (from_byte == to_byte
-	&& (encodep || NILP (coding->post_read_conversion))
-	&& ! CODING_REQUIRE_FLUSHING (coding))
-      {
-	coding->produced = len_byte;
-	coding->produced_char = len;
-	if (!replace)
-	  /* We must record and adjust for this new text now.  */
-	  adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len);
-	return 0;
-      }
-
-    head_skip = from_byte - from_byte_orig;
-    tail_skip = to_byte_orig - to_byte;
-    total_skip = head_skip + tail_skip;
-    from += head_skip;
-    to -= tail_skip;
-    len -= total_skip; len_byte -= total_skip;
-  }
+  if (coding->type != coding_type_ccl)
+    {
+      int from_byte_orig = from_byte, to_byte_orig = to_byte;
+
+      if (from < GPT && GPT < to)
+	move_gap_both (from, from_byte);
+      SHRINK_CONVERSION_REGION (&from_byte, &to_byte, coding, NULL, encodep);
+      if (from_byte == to_byte
+	  && (encodep || NILP (coding->post_read_conversion))
+	  && ! CODING_REQUIRE_FLUSHING (coding))
+	{
+	  coding->produced = len_byte;
+	  coding->produced_char = len;
+	  if (!replace)
+	    /* We must record and adjust for this new text now.  */
+	    adjust_after_insert (from, from_byte_orig, to, to_byte_orig, len);
+	  return 0;
+	}
+
+      head_skip = from_byte - from_byte_orig;
+      tail_skip = to_byte_orig - to_byte;
+      total_skip = head_skip + tail_skip;
+      from += head_skip;
+      to -= tail_skip;
+      len -= total_skip; len_byte -= total_skip;
+    }
 
   /* The code conversion routine can not preserve text properties for
      now.  So, we must remove all text properties in the region.
@@ -5227,14 +5228,15 @@
     coding_allocate_composition_data (coding, from);
 
   /* Try to skip the heading and tailing ASCIIs.  */
-  {
-    int from_orig = from;
-
-    SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data,
-			      0);
-    if (from == to_byte)
-      return (nocopy ? str : Fcopy_sequence (str));
-  }
+  if (coding->type != coding_type_ccl)
+    {
+      int from_orig = from;
+
+      SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data,
+				0);
+      if (from == to_byte)
+	return (nocopy ? str : Fcopy_sequence (str));
+    }
 
   len = decoding_buffer_size (coding, to_byte - from);
   len += from + STRING_BYTES (XSTRING (str)) - to_byte;
@@ -5315,14 +5317,15 @@
     coding_save_composition (coding, from, to, str);
 
   /* Try to skip the heading and tailing ASCIIs.  */
-  {
-    int from_orig = from;
-
-    SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data,
-			      1);
-    if (from == to_byte)
-      return (nocopy ? str : Fcopy_sequence (str));
-  }
+  if (coding->type != coding_type_ccl)
+    {
+      int from_orig = from;
+
+      SHRINK_CONVERSION_REGION (&from, &to_byte, coding, XSTRING (str)->data,
+				1);
+      if (from == to_byte)
+	return (nocopy ? str : Fcopy_sequence (str));
+    }
 
   len = encoding_buffer_size (coding, to_byte - from);
   len += from + STRING_BYTES (XSTRING (str)) - to_byte;