changeset 21635:83541dfdf8ee

(readchar): Find the previous byte's address properly for the buffer case, as for the marker case.
author Richard M. Stallman <rms@gnu.org>
date Fri, 17 Apr 1998 23:35:14 +0000
parents f1b591066832
children 10d8ced94467
files src/lread.c
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/lread.c	Fri Apr 17 22:53:16 1998 +0000
+++ b/src/lread.c	Fri Apr 17 23:35:14 1998 +0000
@@ -218,8 +218,12 @@
 	  readchar_backlog = bytepos - orig_bytepos;
 	}
 
-      return *(BUF_BEG_ADDR (inbuffer) + XMARKER (readcharfun)->bytepos
-	       - readchar_backlog--);
+      /* We get the address of the byte just passed,
+	 which is the last byte of the character.
+	 The other bytes in this character are consecutive with it,
+	 because the gap can't be in the middle of a character.  */
+      return *(BUF_BYTE_ADDRESS (inbuffer, XMARKER (readcharfun)->bytepos - 1)
+	       - --readchar_backlog);
     }
   if (EQ (readcharfun, Qget_file_char))
     {