changeset 28358:7ae3851c0a19

(Fsubst_char_in_region): Don't use INC_POS in unibyte buffers because it looks for multibyte character sequences which don't exist in unibyte text.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 27 Mar 2000 15:47:03 +0000
parents f68f2c1b83fa
children 81f630fe3816
files src/editfns.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Mon Mar 27 14:50:47 2000 +0000
+++ b/src/editfns.c	Mon Mar 27 15:47:03 2000 +0000
@@ -2280,12 +2280,13 @@
 #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER)
   int maybe_byte_combining = COMBINING_NO;
   int last_changed;
+  int multibyte_p = !NILP (current_buffer->enable_multibyte_characters);
 
   validate_region (&start, &end);
   CHECK_NUMBER (fromchar, 2);
   CHECK_NUMBER (tochar, 3);
 
-  if (! NILP (current_buffer->enable_multibyte_characters))
+  if (multibyte_p)
     {
       len = CHAR_STRING (XFASTINT (fromchar), fromstr);
       if (CHAR_STRING (XFASTINT (tochar), tostr) != len)
@@ -2341,7 +2342,10 @@
 	  stop = end_byte;
 	}
       p = BYTE_POS_ADDR (pos_byte);
-      INC_POS (pos_byte_next);
+      if (multibyte_p)
+	INC_POS (pos_byte_next);
+      else
+	++pos_byte_next;
       if (pos_byte_next - pos_byte == len
 	  && p[0] == fromstr[0]
 	  && (len == 1