changeset 66077:68d711d80f2f

(casify_object): Fix for the case that case conversion change the byte length.
author Kenichi Handa <handa@m17n.org>
date Fri, 14 Oct 2005 07:51:51 +0000
parents 33c8db02dc18
children 2fe97fc2ee41
files src/casefiddle.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/casefiddle.c	Thu Oct 13 22:42:01 2005 +0000
+++ b/src/casefiddle.c	Fri Oct 14 07:51:51 2005 +0000
@@ -92,7 +92,8 @@
 	      else if (!UPPERCASEP (c)
 		       && (!inword || flag != CASE_CAPITALIZE_UP))
 		c = UPCASE1 (c);
-	      if (ASCII_BYTE_P (c) || (! multibyte && SINGLE_BYTE_CHAR_P (c)))
+	      if ((ASCII_BYTE_P (c) && from_len == 1)
+		  || (! multibyte && SINGLE_BYTE_CHAR_P (c)))
 		SSET (obj, i, c);
 	      else
 		{
@@ -100,7 +101,10 @@
 		  if (from_len == to_len)
 		    CHAR_STRING (c, SDATA (obj) + i);
 		  else
-		    Faset (obj, make_number (n), make_number (c));
+		    {
+		      Faset (obj, make_number (n), make_number (c));
+		      len += to_len - from_len;
+		    }
 		}
 	      if ((int) flag >= (int) CASE_CAPITALIZE)
 		inword = SYNTAX (c) == Sword;