aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-01-16 18:14:58 +0000
committerRichard M. Stallman1998-01-16 18:14:58 +0000
commit1354debd3fb91420cee66c7c6d2865ee9e673a6a (patch)
treee6bd7ed6fbc2f66fcd4d5c3d43e5cd0f3446b096 /src
parent92432794c1275da935cac061027dbe4b28deeffa (diff)
downloademacs-1354debd3fb91420cee66c7c6d2865ee9e673a6a.tar.gz
emacs-1354debd3fb91420cee66c7c6d2865ee9e673a6a.zip
(Finsert_file_contents): When not decoding,
properly calculate number of chars in the text. Fix error message. (file_name_as_directory): Error if arg is empty. (Fwrite_region): Don't flush the encoding buffer if failure is set.
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 97691a41d3e..a9c58095f4f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -484,6 +484,9 @@ file_name_as_directory (out, in)
484{ 484{
485 int size = strlen (in) - 1; 485 int size = strlen (in) - 1;
486 486
487 if (size < 0)
488 error ("Empty file name");
489
487 strcpy (out, in); 490 strcpy (out, in);
488 491
489#ifdef VMS 492#ifdef VMS
@@ -3731,7 +3734,6 @@ This does code conversion according to the value of\n\
3731 if (! not_regular) 3734 if (! not_regular)
3732 how_much += this; 3735 how_much += this;
3733 3736
3734 this_chars = this;
3735 if (CODING_REQUIRE_DECODING (&coding) 3737 if (CODING_REQUIRE_DECODING (&coding)
3736 || CODING_REQUIRE_DETECTION (&coding)) 3738 || CODING_REQUIRE_DETECTION (&coding))
3737 { 3739 {
@@ -3777,6 +3779,11 @@ This does code conversion according to the value of\n\
3777 this_chars = chars_in_text (BYTE_POS_ADDR (PT_BYTE + inserted - 1) + 1, 3779 this_chars = chars_in_text (BYTE_POS_ADDR (PT_BYTE + inserted - 1) + 1,
3778 produced); 3780 produced);
3779 } 3781 }
3782 else if (! NILP (current_buffer->enable_multibyte_characters))
3783 this_chars = chars_in_text (BYTE_POS_ADDR (PT_BYTE + inserted - 1) + 1,
3784 this);
3785 else
3786 this_chars = this;
3780 3787
3781 GAP_SIZE -= this; 3788 GAP_SIZE -= this;
3782 GPT_BYTE += this; 3789 GPT_BYTE += this;
@@ -3822,7 +3829,7 @@ This does code conversion according to the value of\n\
3822 error ("IO error reading %s: %s", 3829 error ("IO error reading %s: %s",
3823 XSTRING (orig_filename)->data, strerror (errno)); 3830 XSTRING (orig_filename)->data, strerror (errno));
3824 else if (how_much == -2) 3831 else if (how_much == -2)
3825 error ("maximum buffer size exceeded"); 3832 error ("Maximum buffer size exceeded");
3826 3833
3827 set_coding_system = 1; 3834 set_coding_system = 1;
3828 3835
@@ -4278,7 +4285,8 @@ to the file, instead of any buffer contents, and END is ignored.")
4278 save_errno = errno; 4285 save_errno = errno;
4279 } 4286 }
4280 4287
4281 if (CODING_REQUIRE_FLUSHING (&coding) && !coding.last_block) 4288 if (CODING_REQUIRE_FLUSHING (&coding) && !coding.last_block
4289 && ! failure)
4282 { 4290 {
4283 /* We have to flush out a data. */ 4291 /* We have to flush out a data. */
4284 coding.last_block = 1; 4292 coding.last_block = 1;