aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorPaul Eggert2011-04-14 13:16:48 -0700
committerPaul Eggert2011-04-14 13:16:48 -0700
commit8bd7b8304a41da5dc0c8a11967c1a6005e9465d0 (patch)
tree145588110166df723c31f3fceaa00c190b77aa8c /src/fileio.c
parentcd64ea1d0df393beb93d1bdf19bd3990e3378f85 (diff)
parent9024ff7943e9529ec38a80aaaa0db43224c1e885 (diff)
downloademacs-8bd7b8304a41da5dc0c8a11967c1a6005e9465d0.tar.gz
emacs-8bd7b8304a41da5dc0c8a11967c1a6005e9465d0.zip
Merge from mainline.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 7f749536d56..b8c5e796db4 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -146,8 +146,10 @@ static Lisp_Object Qcar_less_than_car;
146 146
147static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object); 147static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object);
148static int a_write (int, Lisp_Object, int, int, 148static int a_write (int, Lisp_Object, int, int,
149static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT,
149 Lisp_Object *, struct coding_system *); 150 Lisp_Object *, struct coding_system *);
150static int e_write (int, Lisp_Object, int, int, struct coding_system *); 151static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT,
152 struct coding_system *);
151 153
152 154
153void 155void
@@ -1808,7 +1810,8 @@ If PRESERVE-SELINUX-CONTEXT is non-nil and SELinux is enabled
1808on the system, we copy the SELinux context of FILE to NEWNAME. */) 1810on the system, we copy the SELinux context of FILE to NEWNAME. */)
1809 (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context) 1811 (Lisp_Object file, Lisp_Object newname, Lisp_Object ok_if_already_exists, Lisp_Object keep_time, Lisp_Object preserve_uid_gid, Lisp_Object preserve_selinux_context)
1810{ 1812{
1811 int ifd, ofd, n; 1813 int ifd, ofd;
1814 EMACS_INT n;
1812 char buf[16 * 1024]; 1815 char buf[16 * 1024];
1813 struct stat st, out_st; 1816 struct stat st, out_st;
1814 Lisp_Object handler; 1817 Lisp_Object handler;
@@ -3802,9 +3805,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3802 /* For a special file, all we can do is guess. */ 3805 /* For a special file, all we can do is guess. */
3803 total = READ_BUF_SIZE; 3806 total = READ_BUF_SIZE;
3804 3807
3805 /* FIXME: This if-statement is a no-op, because 'inserted' must be zero here 3808 if (NILP (visit) && total > 0)
3806 (Bug#8496). */
3807 if (NILP (visit) && inserted > 0)
3808 { 3809 {
3809#ifdef CLASH_DETECTION 3810#ifdef CLASH_DETECTION
3810 if (!NILP (BVAR (current_buffer, file_truename)) 3811 if (!NILP (BVAR (current_buffer, file_truename))
@@ -3914,7 +3915,6 @@ variable `last-coding-system-used' to the coding system actually used. */)
3914 if (inserted == 0) 3915 if (inserted == 0)
3915 { 3916 {
3916#ifdef CLASH_DETECTION 3917#ifdef CLASH_DETECTION
3917 /* FIXME: This code is a no-op, too (Bug#8496). */
3918 if (we_locked_file) 3918 if (we_locked_file)
3919 unlock_file (BVAR (current_buffer, file_truename)); 3919 unlock_file (BVAR (current_buffer, file_truename));
3920#endif 3920#endif
@@ -4799,11 +4799,13 @@ build_annotations (Lisp_Object start, Lisp_Object end)
4799 The return value is negative in case of system call failure. */ 4799 The return value is negative in case of system call failure. */
4800 4800
4801static int 4801static int
4802a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object *annot, struct coding_system *coding) 4802a_write (int desc, Lisp_Object string, EMACS_INT pos,
4803 register EMACS_INT nchars, Lisp_Object *annot,
4804 struct coding_system *coding)
4803{ 4805{
4804 Lisp_Object tem; 4806 Lisp_Object tem;
4805 int nextpos; 4807 EMACS_INT nextpos;
4806 int lastpos = pos + nchars; 4808 EMACS_INT lastpos = pos + nchars;
4807 4809
4808 while (NILP (*annot) || CONSP (*annot)) 4810 while (NILP (*annot) || CONSP (*annot))
4809 { 4811 {
@@ -4843,7 +4845,8 @@ a_write (int desc, Lisp_Object string, int pos, register int nchars, Lisp_Object
4843 are indexes to the string STRING. */ 4845 are indexes to the string STRING. */
4844 4846
4845static int 4847static int
4846e_write (int desc, Lisp_Object string, int start, int end, struct coding_system *coding) 4848e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end,
4849 struct coding_system *coding)
4847{ 4850{
4848 if (STRINGP (string)) 4851 if (STRINGP (string))
4849 { 4852 {
@@ -4874,8 +4877,8 @@ e_write (int desc, Lisp_Object string, int start, int end, struct coding_system
4874 } 4877 }
4875 else 4878 else
4876 { 4879 {
4877 int start_byte = CHAR_TO_BYTE (start); 4880 EMACS_INT start_byte = CHAR_TO_BYTE (start);
4878 int end_byte = CHAR_TO_BYTE (end); 4881 EMACS_INT end_byte = CHAR_TO_BYTE (end);
4879 4882
4880 coding->src_multibyte = (end - start) < (end_byte - start_byte); 4883 coding->src_multibyte = (end - start) < (end_byte - start_byte);
4881 if (CODING_REQUIRE_ENCODING (coding)) 4884 if (CODING_REQUIRE_ENCODING (coding))