changeset 25504:38c92a68c9e4

(Faset): Adjust the way to check byte-combining possibility for the new handling of multibyte sequence.
author Kenichi Handa <handa@m17n.org>
date Fri, 03 Sep 1999 01:28:42 +0000
parents bbb032f48e20
children 4d5f87073d63
files src/data.c
diffstat 1 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/data.c	Fri Sep 03 01:28:42 1999 +0000
+++ b/src/data.c	Fri Sep 03 01:28:42 1999 +0000
@@ -1859,13 +1859,14 @@
 	error ("Attempt to change byte length of a string");
 
       /* We can't accept a change causing byte combining.  */
-      if ((idxval > 0 && !CHAR_HEAD_P (*str)
-	   && (prev_byte = string_char_to_byte (array, idxval - 1),
-	       (prev_byte + 1 < idxval_byte
-		|| (p[-1] >= 0x80 && p[-1] < 0xA0))))
-	  || (idxval < XSTRING (array)->size - 1
-	      && (*str >=0x80 && *str < 0xA0)
-	      && !CHAR_HEAD_P (p[actual_len])))
+      if (!ASCII_BYTE_P (*str)
+	  && ((idxval > 0 && !CHAR_HEAD_P (*str)
+	       && (prev_byte = string_char_to_byte (array, idxval - 1),
+		   BYTES_BY_CHAR_HEAD (XSTRING (array)->data[prev_byte])
+		   > idxval_byte - prev_byte))
+	      || (idxval < XSTRING (array)->size - 1
+		  && !CHAR_HEAD_P (p[actual_len])
+		  && new_len < BYTES_BY_CHAR_HEAD (*str))))
 	error ("Attempt to change char length of a string");
       while (new_len--)
 	*p++ = *str++;