changeset 26415:bda6a3a2bf96

(Ftranslate_region): Check the buffer multibyteness.
author Kenichi Handa <handa@m17n.org>
date Fri, 12 Nov 1999 00:09:03 +0000
parents 21d5879daa5f
children 1384b7926bb1
files src/editfns.c
diffstat 1 files changed, 5 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Fri Nov 12 00:08:09 1999 +0000
+++ b/src/editfns.c	Fri Nov 12 00:09:03 1999 +0000
@@ -2425,6 +2425,7 @@
   int cnt;			/* Number of changes made. */
   int size;			/* Size of translate table. */
   int pos;
+  int multibyte = !NILP (current_buffer->enable_multibyte_characters);
 
   validate_region (&start, &end);
   CHECK_STRING (table, 2);
@@ -2445,7 +2446,10 @@
       int oc;
       int pos_byte_next;
 
-      oc = STRING_CHAR_AND_LENGTH (p, stop - pos_byte, len);
+      if (multibyte)
+	oc = STRING_CHAR_AND_LENGTH (p, stop - pos_byte, len);
+      else
+	oc = *p, len = 1;
       pos_byte_next = pos_byte + len;
       if (oc < size && len == 1)
 	{