[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 2021680: ; Restore some of the recent deletions in
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 2021680: ; Restore some of the recent deletions in fileio.c |
Date: |
Sun, 04 Oct 2015 09:24:55 +0000 |
branch: master
commit 2021680e9dcd277a4ebbdb613d535e6edc86f384
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
; Restore some of the recent deletions in fileio.c
* src/fileio.c (Finsert_file_contents, choose_write_coding_system):
Restore some of the recently deleted calls to CHECK_CODING_SYSTEM.
---
src/fileio.c | 21 ++++++++++++++++-----
1 files changed, 16 insertions(+), 5 deletions(-)
diff --git a/src/fileio.c b/src/fileio.c
index b82b7d3..3155ef0 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3470,7 +3470,11 @@ by calling `format-decode', which see. */)
mtime = time_error_value (save_errno);
st.st_size = -1;
if (!NILP (Vcoding_system_for_read))
- Fset (Qbuffer_file_coding_system, Vcoding_system_for_read);
+ {
+ /* Don't let invalid values into buffer-file-coding-system. */
+ CHECK_CODING_SYSTEM (Vcoding_system_for_read);
+ Fset (Qbuffer_file_coding_system, Vcoding_system_for_read);
+ }
goto notfound;
}
@@ -4569,7 +4573,7 @@ choose_write_coding_system (Lisp_Object start,
Lisp_Object end, Lisp_Object file
if (NILP (val))
{
/* If we still have not decided a coding system, use the
- default value of buffer-file-coding-system. */
+ current buffer's value of buffer-file-coding-system. */
val = BVAR (current_buffer, buffer_file_coding_system);
using_default_coding = 1;
}
@@ -4587,9 +4591,16 @@ choose_write_coding_system (Lisp_Object start,
Lisp_Object end, Lisp_Object file
if (!force_raw_text
&& !NILP (Ffboundp (Vselect_safe_coding_system_function)))
- /* Confirm that VAL can surely encode the current region. */
- val = call5 (Vselect_safe_coding_system_function,
- start, end, val, Qnil, filename);
+ {
+ /* Confirm that VAL can surely encode the current region. */
+ val = call5 (Vselect_safe_coding_system_function,
+ start, end, val, Qnil, filename);
+ /* As the function specified by select-safe-coding-system-function
+ is out of our control, make sure we are not fed by bogus
+ values. */
+ if (!NILP (val))
+ CHECK_CODING_SYSTEM (val);
+ }
/* If the decided coding-system doesn't specify end-of-line
format, we use that of
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 2021680: ; Restore some of the recent deletions in fileio.c,
Eli Zaretskii <=