aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-02 17:32:10 -0700
committerPaul Eggert2011-04-02 17:32:10 -0700
commit43aae36e04fe151c73525ed7f8f55890dced98ae (patch)
treea94e3f57460406bfee438c96cc3c2e5ea18a9596 /src
parent163c5f3291530e9c2fc7487ed11a8127c6c70b5a (diff)
downloademacs-43aae36e04fe151c73525ed7f8f55890dced98ae.tar.gz
emacs-43aae36e04fe151c73525ed7f8f55890dced98ae.zip
* fileio.c (Finsert_file_contents): Make EOF condition clearer.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog4
-rw-r--r--src/fileio.c10
2 files changed, 7 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 0b17cb4c4da..edfce7a9240 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,7 @@
12011-04-03 Paul Eggert <eggert@cs.ucla.edu>
2
3 * fileio.c (Finsert_file_contents): Make EOF condition clearer.
4
12011-04-02 Paul Eggert <eggert@cs.ucla.edu> 52011-04-02 Paul Eggert <eggert@cs.ucla.edu>
2 6
3 * fileio.c (Finsert_file_contents): Avoid signed integer overflow. 7 * fileio.c (Finsert_file_contents): Avoid signed integer overflow.
diff --git a/src/fileio.c b/src/fileio.c
index 18aaf4562da..dec53968947 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3607,6 +3607,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3607 EMACS_INT bufpos; 3607 EMACS_INT bufpos;
3608 unsigned char *decoded; 3608 unsigned char *decoded;
3609 EMACS_INT temp; 3609 EMACS_INT temp;
3610 EMACS_INT this = 0;
3610 int this_count = SPECPDL_INDEX (); 3611 int this_count = SPECPDL_INDEX ();
3611 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); 3612 int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
3612 Lisp_Object conversion_buffer; 3613 Lisp_Object conversion_buffer;
@@ -3633,7 +3634,6 @@ variable `last-coding-system-used' to the coding system actually used. */)
3633 /* try is reserved in some compilers (Microsoft C) */ 3634 /* try is reserved in some compilers (Microsoft C) */
3634 EMACS_INT trytry = min (total - how_much, 3635 EMACS_INT trytry = min (total - how_much,
3635 READ_BUF_SIZE - unprocessed); 3636 READ_BUF_SIZE - unprocessed);
3636 EMACS_INT this;
3637 3637
3638 /* Allow quitting out of the actual I/O. */ 3638 /* Allow quitting out of the actual I/O. */
3639 immediate_quit = 1; 3639 immediate_quit = 1;
@@ -3642,11 +3642,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3642 immediate_quit = 0; 3642 immediate_quit = 0;
3643 3643
3644 if (this <= 0) 3644 if (this <= 0)
3645 { 3645 break;
3646 if (this < 0)
3647 how_much = this;
3648 break;
3649 }
3650 3646
3651 how_much += this; 3647 how_much += this;
3652 3648
@@ -3669,7 +3665,7 @@ variable `last-coding-system-used' to the coding system actually used. */)
3669 /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0 3665 /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0
3670 if we couldn't read the file. */ 3666 if we couldn't read the file. */
3671 3667
3672 if (how_much < 0) 3668 if (this < 0)
3673 error ("IO error reading %s: %s", 3669 error ("IO error reading %s: %s",
3674 SDATA (orig_filename), emacs_strerror (errno)); 3670 SDATA (orig_filename), emacs_strerror (errno));
3675 3671