comparison src/fileio.c @ 38973:64125d607a06

Finsert_file_contents): Allocate, restore, and free composition data in the case of REPLACE not being nil.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 27 Aug 2001 13:50:42 +0000
parents 0c5accb9bd18
children f3d3950ed951
comparison
equal deleted inserted replaced
38972:4459c45545d0 38973:64125d607a06
4014 } 4014 }
4015 4015
4016 /* Convert this batch with results in CONVERSION_BUFFER. */ 4016 /* Convert this batch with results in CONVERSION_BUFFER. */
4017 if (how_much >= total) /* This is the last block. */ 4017 if (how_much >= total) /* This is the last block. */
4018 coding.mode |= CODING_MODE_LAST_BLOCK; 4018 coding.mode |= CODING_MODE_LAST_BLOCK;
4019 if (coding.composing != COMPOSITION_DISABLED)
4020 coding_allocate_composition_data (&coding, BEGV);
4019 result = decode_coding (&coding, read_buf, 4021 result = decode_coding (&coding, read_buf,
4020 conversion_buffer + inserted, 4022 conversion_buffer + inserted,
4021 this, bufsize - inserted); 4023 this, bufsize - inserted);
4022 4024
4023 /* Save for next iteration whatever we didn't convert. */ 4025 /* Save for next iteration whatever we didn't convert. */
4122 } 4124 }
4123 /* Insert from the file at the proper position. */ 4125 /* Insert from the file at the proper position. */
4124 SET_PT_BOTH (temp, same_at_start); 4126 SET_PT_BOTH (temp, same_at_start);
4125 insert_1 (conversion_buffer + same_at_start - BEG_BYTE, inserted, 4127 insert_1 (conversion_buffer + same_at_start - BEG_BYTE, inserted,
4126 0, 0, 0); 4128 0, 0, 0);
4129 if (coding.cmp_data && coding.cmp_data->used)
4130 coding_restore_composition (&coding, Fcurrent_buffer ());
4131 coding_free_composition_data (&coding);
4132
4127 /* Set `inserted' to the number of inserted characters. */ 4133 /* Set `inserted' to the number of inserted characters. */
4128 inserted = PT - temp; 4134 inserted = PT - temp;
4129 4135
4130 xfree (conversion_buffer); 4136 xfree (conversion_buffer);
4131 emacs_close (fd); 4137 emacs_close (fd);