aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/fileio.c b/src/fileio.c
index eb12810eeaa..90856d75555 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4025,6 +4025,8 @@ actually used. */)
4025 { 4025 {
4026 int same_at_start = BEGV_BYTE; 4026 int same_at_start = BEGV_BYTE;
4027 int same_at_end = ZV_BYTE; 4027 int same_at_end = ZV_BYTE;
4028 int same_at_start_charpos;
4029 int inserted_chars;
4028 int overlap; 4030 int overlap;
4029 int bufpos; 4031 int bufpos;
4030 unsigned char *decoded; 4032 unsigned char *decoded;
@@ -4103,7 +4105,8 @@ actually used. */)
4103 } 4105 }
4104 4106
4105 decoded = BUF_BEG_ADDR (XBUFFER (conversion_buffer)); 4107 decoded = BUF_BEG_ADDR (XBUFFER (conversion_buffer));
4106 inserted = BUF_Z_BYTE (XBUFFER (conversion_buffer)); 4108 inserted = (BUF_Z_BYTE (XBUFFER (conversion_buffer))
4109 - BUF_BEG_BYTE (XBUFFER (conversion_buffer)));
4107 4110
4108 /* Compare the beginning of the converted string with the buffer 4111 /* Compare the beginning of the converted string with the buffer
4109 text. */ 4112 text. */
@@ -4176,12 +4179,15 @@ actually used. */)
4176 } 4179 }
4177 /* Insert from the file at the proper position. */ 4180 /* Insert from the file at the proper position. */
4178 SET_PT_BOTH (temp, same_at_start); 4181 SET_PT_BOTH (temp, same_at_start);
4182 same_at_start_charpos
4183 = buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
4184 same_at_start);
4185 inserted_chars
4186 = (buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
4187 same_at_start + inserted)
4188 - same_at_start_charpos);
4179 insert_from_buffer (XBUFFER (conversion_buffer), 4189 insert_from_buffer (XBUFFER (conversion_buffer),
4180 buf_bytepos_to_charpos (XBUFFER (conversion_buffer), 4190 same_at_start_charpos, inserted_chars, 0);
4181 same_at_start),
4182 buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
4183 same_at_start + inserted),
4184 0);
4185 /* Set `inserted' to the number of inserted characters. */ 4191 /* Set `inserted' to the number of inserted characters. */
4186 inserted = PT - temp; 4192 inserted = PT - temp;
4187 4193