diff src/fileio.c @ 102753:b6116169967f

* insdel.c (move_gap, move_gap_both, gap_left, gap_right) (adjust_markers_gap_motion, adjust_markers_for_delete) (adjust_markers_for_insert, adjust_point) (adjust_markers_for_replace, make_gap_larger, make_gap_smaller) (make_gap, copy_text, count_size_as_multibyte, insert) (insert_and_inherit, insert_before_markers) (insert_before_markers_and_inherit, insert_1) (count_combining_before, count_combining_after, insert_1_both) (insert_from_string, insert_from_string_before_markers) (insert_from_string_1, insert_from_gap, insert_from_buffer) (insert_from_buffer_1, adjust_after_replace) (adjust_after_replace_noundo, adjust_after_insert, replace_range) (replace_range_2, del_range, del_range_1, del_range_byte) (del_range_both, del_range_2, modify_region) (prepare_to_modify_buffer, signal_before_change) (signal_after_change, Fcombine_after_change_execute): Use EMACS_INT for buffer positions and sizes. * lisp.h: Adjust prototypes accordingly. * fileio.c (adjust_markers_for_delete): Move declaration to lisp.h. (non_regular_inserted, non_regular_nbytes, read_non_regular) (Finsert_file_contents): Use EMACS_INT for buffer positions.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 28 Mar 2009 02:24:22 +0000
parents 9e5b3ff07060
children 9980dd970cf9
line wrap: on
line diff
--- a/src/fileio.c	Sat Mar 28 02:06:06 2009 +0000
+++ b/src/fileio.c	Sat Mar 28 02:24:22 2009 +0000
@@ -3048,8 +3048,6 @@
 #define READ_BUF_SIZE (64 << 10)
 #endif
 
-extern void adjust_markers_for_delete P_ ((int, int, int, int));
-
 /* This function is called after Lisp functions to decide a coding
    system are called, or when they cause an error.  Before they are
    called, the current buffer is set unibyte and it contains only a
@@ -3094,8 +3092,8 @@
 /* Used to pass values from insert-file-contents to read_non_regular.  */
 
 static int non_regular_fd;
-static int non_regular_inserted;
-static int non_regular_nbytes;
+static EMACS_INT non_regular_inserted;
+static EMACS_INT non_regular_nbytes;
 
 
 /* Read from a non-regular file.
@@ -3106,7 +3104,7 @@
 static Lisp_Object
 read_non_regular ()
 {
-  int nbytes;
+  EMACS_INT nbytes;
 
   immediate_quit = 1;
   QUIT;
@@ -3156,15 +3154,15 @@
 {
   struct stat st;
   register int fd;
-  int inserted = 0;
+  EMACS_INT inserted = 0;
   int nochange = 0;
-  register int how_much;
-  register int unprocessed;
+  register EMACS_INT how_much;
+  register EMACS_INT unprocessed;
   int count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   Lisp_Object handler, val, insval, orig_filename, old_undo;
   Lisp_Object p;
-  int total = 0;
+  EMACS_INT total = 0;
   int not_regular = 0;
   unsigned char read_buf[READ_BUF_SIZE];
   struct coding_system coding;
@@ -3340,7 +3338,7 @@
 		 We assume that the 1K-byte and 3K-byte for heading
 		 and tailing respectively are sufficient for this
 		 purpose.  */
-	      int nread;
+	      EMACS_INT nread;
 
 	      if (st.st_size <= (1024 * 4))
 		nread = emacs_read (fd, read_buf, 1024 * 4);
@@ -3450,9 +3448,9 @@
       /* same_at_start and same_at_end count bytes,
 	 because file access counts bytes
 	 and BEG and END count bytes.  */
-      int same_at_start = BEGV_BYTE;
-      int same_at_end = ZV_BYTE;
-      int overlap;
+      EMACS_INT same_at_start = BEGV_BYTE;
+      EMACS_INT same_at_end = ZV_BYTE;
+      EMACS_INT overlap;
       /* There is still a possibility we will find the need to do code
 	 conversion.  If that happens, we set this variable to 1 to
 	 give up on handling REPLACE in the optimized way.  */
@@ -3471,7 +3469,7 @@
 	 match the text at the beginning of the buffer.  */
       while (1)
 	{
-	  int nread, bufpos;
+	  EMACS_INT nread, bufpos;
 
 	  nread = emacs_read (fd, buffer, sizeof buffer);
 	  if (nread < 0)
@@ -3522,7 +3520,7 @@
 	 already found that decoding is necessary, don't waste time.  */
       while (!giveup_match_end)
 	{
-	  int total_read, nread, bufpos, curpos, trial;
+	  EMACS_INT total_read, nread, bufpos, curpos, trial;
 
 	  /* At what file position are we now scanning?  */
 	  curpos = XINT (end) - (ZV_BYTE - same_at_end);
@@ -3578,7 +3576,7 @@
 
       if (! giveup_match_end)
 	{
-	  int temp;
+	  EMACS_INT temp;
 
 	  /* We win!  We can handle REPLACE the optimized way.  */
 
@@ -3638,7 +3636,7 @@
       EMACS_INT overlap;
       EMACS_INT bufpos;
       unsigned char *decoded;
-      int temp;
+      EMACS_INT temp;
       int this_count = SPECPDL_INDEX ();
       int multibyte = ! NILP (current_buffer->enable_multibyte_characters);
       Lisp_Object conversion_buffer;
@@ -3663,8 +3661,9 @@
 	  /* We read one bunch by one (READ_BUF_SIZE bytes) to allow
 	     quitting while reading a huge while.  */
 	  /* try is reserved in some compilers (Microsoft C) */
-	  int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed);
-	  int this;
+	  EMACS_INT trytry = min (total - how_much,
+				  READ_BUF_SIZE - unprocessed);
+	  EMACS_INT this;
 
 	  /* Allow quitting out of the actual I/O.  */
 	  immediate_quit = 1;
@@ -3867,13 +3866,13 @@
   /* Here, we don't do code conversion in the loop.  It is done by
      decode_coding_gap after all data are read into the buffer.  */
   {
-    int gap_size = GAP_SIZE;
+    EMACS_INT gap_size = GAP_SIZE;
 
     while (how_much < total)
       {
 	/* try is reserved in some compilers (Microsoft C) */
-	int trytry = min (total - how_much, READ_BUF_SIZE);
-	int this;
+	EMACS_INT trytry = min (total - how_much, READ_BUF_SIZE);
+	EMACS_INT this;
 
 	if (not_regular)
 	  {
@@ -4130,7 +4129,7 @@
     {
       /* Don't run point motion or modification hooks when decoding.  */
       int count = SPECPDL_INDEX ();
-      int old_inserted = inserted;
+      EMACS_INT old_inserted = inserted;
       specbind (Qinhibit_point_motion_hooks, Qt);
       specbind (Qinhibit_modification_hooks, Qt);
 
@@ -4156,9 +4155,9 @@
 	     Hence we temporarily save `point' and `inserted' here and
 	     restore `point' iff format-decode did not insert or delete
 	     any text.  Otherwise we leave `point' at point-min.  */
-	  int opoint = PT;
-	  int opoint_byte = PT_BYTE;
-	  int oinserted = ZV - BEGV;
+	  EMACS_INT opoint = PT;
+	  EMACS_INT opoint_byte = PT_BYTE;
+	  EMACS_INT oinserted = ZV - BEGV;
 	  int ochars_modiff = CHARS_MODIFF;
 
 	  TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
@@ -4194,9 +4193,9 @@
 	    {
 	      /* For the rationale of this see the comment on
 		 format-decode above.  */
-	      int opoint = PT;
-	      int opoint_byte = PT_BYTE;
-	      int oinserted = ZV - BEGV;
+	      EMACS_INT opoint = PT;
+	      EMACS_INT opoint_byte = PT_BYTE;
+	      EMACS_INT oinserted = ZV - BEGV;
 	      int ochars_modiff = CHARS_MODIFF;
 
 	      TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);