diff options
| author | Stefan Monnier | 2009-03-28 02:24:22 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2009-03-28 02:24:22 +0000 |
| commit | ae19ba7cfcf14bad68525ba71a88b14f05ab60a6 (patch) | |
| tree | fd7ce1264675becab196e2c80b3602820105cbfa /src/fileio.c | |
| parent | ab226c507517f8ce23daed706f1d6e0b7369cb00 (diff) | |
| download | emacs-ae19ba7cfcf14bad68525ba71a88b14f05ab60a6.tar.gz emacs-ae19ba7cfcf14bad68525ba71a88b14f05ab60a6.zip | |
* 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.
Diffstat (limited to 'src/fileio.c')
| -rw-r--r-- | src/fileio.c | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/src/fileio.c b/src/fileio.c index 93b6a1d8298..0bdbe9f9a46 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -3048,8 +3048,6 @@ Lisp_Object Qfind_buffer_file_type; | |||
| 3048 | #define READ_BUF_SIZE (64 << 10) | 3048 | #define READ_BUF_SIZE (64 << 10) |
| 3049 | #endif | 3049 | #endif |
| 3050 | 3050 | ||
| 3051 | extern void adjust_markers_for_delete P_ ((int, int, int, int)); | ||
| 3052 | |||
| 3053 | /* This function is called after Lisp functions to decide a coding | 3051 | /* This function is called after Lisp functions to decide a coding |
| 3054 | system are called, or when they cause an error. Before they are | 3052 | system are called, or when they cause an error. Before they are |
| 3055 | called, the current buffer is set unibyte and it contains only a | 3053 | called, the current buffer is set unibyte and it contains only a |
| @@ -3094,8 +3092,8 @@ decide_coding_unwind (unwind_data) | |||
| 3094 | /* Used to pass values from insert-file-contents to read_non_regular. */ | 3092 | /* Used to pass values from insert-file-contents to read_non_regular. */ |
| 3095 | 3093 | ||
| 3096 | static int non_regular_fd; | 3094 | static int non_regular_fd; |
| 3097 | static int non_regular_inserted; | 3095 | static EMACS_INT non_regular_inserted; |
| 3098 | static int non_regular_nbytes; | 3096 | static EMACS_INT non_regular_nbytes; |
| 3099 | 3097 | ||
| 3100 | 3098 | ||
| 3101 | /* Read from a non-regular file. | 3099 | /* Read from a non-regular file. |
| @@ -3106,7 +3104,7 @@ static int non_regular_nbytes; | |||
| 3106 | static Lisp_Object | 3104 | static Lisp_Object |
| 3107 | read_non_regular () | 3105 | read_non_regular () |
| 3108 | { | 3106 | { |
| 3109 | int nbytes; | 3107 | EMACS_INT nbytes; |
| 3110 | 3108 | ||
| 3111 | immediate_quit = 1; | 3109 | immediate_quit = 1; |
| 3112 | QUIT; | 3110 | QUIT; |
| @@ -3156,15 +3154,15 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3156 | { | 3154 | { |
| 3157 | struct stat st; | 3155 | struct stat st; |
| 3158 | register int fd; | 3156 | register int fd; |
| 3159 | int inserted = 0; | 3157 | EMACS_INT inserted = 0; |
| 3160 | int nochange = 0; | 3158 | int nochange = 0; |
| 3161 | register int how_much; | 3159 | register EMACS_INT how_much; |
| 3162 | register int unprocessed; | 3160 | register EMACS_INT unprocessed; |
| 3163 | int count = SPECPDL_INDEX (); | 3161 | int count = SPECPDL_INDEX (); |
| 3164 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 3162 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 3165 | Lisp_Object handler, val, insval, orig_filename, old_undo; | 3163 | Lisp_Object handler, val, insval, orig_filename, old_undo; |
| 3166 | Lisp_Object p; | 3164 | Lisp_Object p; |
| 3167 | int total = 0; | 3165 | EMACS_INT total = 0; |
| 3168 | int not_regular = 0; | 3166 | int not_regular = 0; |
| 3169 | unsigned char read_buf[READ_BUF_SIZE]; | 3167 | unsigned char read_buf[READ_BUF_SIZE]; |
| 3170 | struct coding_system coding; | 3168 | struct coding_system coding; |
| @@ -3340,7 +3338,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3340 | We assume that the 1K-byte and 3K-byte for heading | 3338 | We assume that the 1K-byte and 3K-byte for heading |
| 3341 | and tailing respectively are sufficient for this | 3339 | and tailing respectively are sufficient for this |
| 3342 | purpose. */ | 3340 | purpose. */ |
| 3343 | int nread; | 3341 | EMACS_INT nread; |
| 3344 | 3342 | ||
| 3345 | if (st.st_size <= (1024 * 4)) | 3343 | if (st.st_size <= (1024 * 4)) |
| 3346 | nread = emacs_read (fd, read_buf, 1024 * 4); | 3344 | nread = emacs_read (fd, read_buf, 1024 * 4); |
| @@ -3450,9 +3448,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3450 | /* same_at_start and same_at_end count bytes, | 3448 | /* same_at_start and same_at_end count bytes, |
| 3451 | because file access counts bytes | 3449 | because file access counts bytes |
| 3452 | and BEG and END count bytes. */ | 3450 | and BEG and END count bytes. */ |
| 3453 | int same_at_start = BEGV_BYTE; | 3451 | EMACS_INT same_at_start = BEGV_BYTE; |
| 3454 | int same_at_end = ZV_BYTE; | 3452 | EMACS_INT same_at_end = ZV_BYTE; |
| 3455 | int overlap; | 3453 | EMACS_INT overlap; |
| 3456 | /* There is still a possibility we will find the need to do code | 3454 | /* There is still a possibility we will find the need to do code |
| 3457 | conversion. If that happens, we set this variable to 1 to | 3455 | conversion. If that happens, we set this variable to 1 to |
| 3458 | give up on handling REPLACE in the optimized way. */ | 3456 | give up on handling REPLACE in the optimized way. */ |
| @@ -3471,7 +3469,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3471 | match the text at the beginning of the buffer. */ | 3469 | match the text at the beginning of the buffer. */ |
| 3472 | while (1) | 3470 | while (1) |
| 3473 | { | 3471 | { |
| 3474 | int nread, bufpos; | 3472 | EMACS_INT nread, bufpos; |
| 3475 | 3473 | ||
| 3476 | nread = emacs_read (fd, buffer, sizeof buffer); | 3474 | nread = emacs_read (fd, buffer, sizeof buffer); |
| 3477 | if (nread < 0) | 3475 | if (nread < 0) |
| @@ -3522,7 +3520,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3522 | already found that decoding is necessary, don't waste time. */ | 3520 | already found that decoding is necessary, don't waste time. */ |
| 3523 | while (!giveup_match_end) | 3521 | while (!giveup_match_end) |
| 3524 | { | 3522 | { |
| 3525 | int total_read, nread, bufpos, curpos, trial; | 3523 | EMACS_INT total_read, nread, bufpos, curpos, trial; |
| 3526 | 3524 | ||
| 3527 | /* At what file position are we now scanning? */ | 3525 | /* At what file position are we now scanning? */ |
| 3528 | curpos = XINT (end) - (ZV_BYTE - same_at_end); | 3526 | curpos = XINT (end) - (ZV_BYTE - same_at_end); |
| @@ -3578,7 +3576,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3578 | 3576 | ||
| 3579 | if (! giveup_match_end) | 3577 | if (! giveup_match_end) |
| 3580 | { | 3578 | { |
| 3581 | int temp; | 3579 | EMACS_INT temp; |
| 3582 | 3580 | ||
| 3583 | /* We win! We can handle REPLACE the optimized way. */ | 3581 | /* We win! We can handle REPLACE the optimized way. */ |
| 3584 | 3582 | ||
| @@ -3638,7 +3636,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3638 | EMACS_INT overlap; | 3636 | EMACS_INT overlap; |
| 3639 | EMACS_INT bufpos; | 3637 | EMACS_INT bufpos; |
| 3640 | unsigned char *decoded; | 3638 | unsigned char *decoded; |
| 3641 | int temp; | 3639 | EMACS_INT temp; |
| 3642 | int this_count = SPECPDL_INDEX (); | 3640 | int this_count = SPECPDL_INDEX (); |
| 3643 | int multibyte = ! NILP (current_buffer->enable_multibyte_characters); | 3641 | int multibyte = ! NILP (current_buffer->enable_multibyte_characters); |
| 3644 | Lisp_Object conversion_buffer; | 3642 | Lisp_Object conversion_buffer; |
| @@ -3663,8 +3661,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3663 | /* We read one bunch by one (READ_BUF_SIZE bytes) to allow | 3661 | /* We read one bunch by one (READ_BUF_SIZE bytes) to allow |
| 3664 | quitting while reading a huge while. */ | 3662 | quitting while reading a huge while. */ |
| 3665 | /* try is reserved in some compilers (Microsoft C) */ | 3663 | /* try is reserved in some compilers (Microsoft C) */ |
| 3666 | int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed); | 3664 | EMACS_INT trytry = min (total - how_much, |
| 3667 | int this; | 3665 | READ_BUF_SIZE - unprocessed); |
| 3666 | EMACS_INT this; | ||
| 3668 | 3667 | ||
| 3669 | /* Allow quitting out of the actual I/O. */ | 3668 | /* Allow quitting out of the actual I/O. */ |
| 3670 | immediate_quit = 1; | 3669 | immediate_quit = 1; |
| @@ -3867,13 +3866,13 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3867 | /* Here, we don't do code conversion in the loop. It is done by | 3866 | /* Here, we don't do code conversion in the loop. It is done by |
| 3868 | decode_coding_gap after all data are read into the buffer. */ | 3867 | decode_coding_gap after all data are read into the buffer. */ |
| 3869 | { | 3868 | { |
| 3870 | int gap_size = GAP_SIZE; | 3869 | EMACS_INT gap_size = GAP_SIZE; |
| 3871 | 3870 | ||
| 3872 | while (how_much < total) | 3871 | while (how_much < total) |
| 3873 | { | 3872 | { |
| 3874 | /* try is reserved in some compilers (Microsoft C) */ | 3873 | /* try is reserved in some compilers (Microsoft C) */ |
| 3875 | int trytry = min (total - how_much, READ_BUF_SIZE); | 3874 | EMACS_INT trytry = min (total - how_much, READ_BUF_SIZE); |
| 3876 | int this; | 3875 | EMACS_INT this; |
| 3877 | 3876 | ||
| 3878 | if (not_regular) | 3877 | if (not_regular) |
| 3879 | { | 3878 | { |
| @@ -4130,7 +4129,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4130 | { | 4129 | { |
| 4131 | /* Don't run point motion or modification hooks when decoding. */ | 4130 | /* Don't run point motion or modification hooks when decoding. */ |
| 4132 | int count = SPECPDL_INDEX (); | 4131 | int count = SPECPDL_INDEX (); |
| 4133 | int old_inserted = inserted; | 4132 | EMACS_INT old_inserted = inserted; |
| 4134 | specbind (Qinhibit_point_motion_hooks, Qt); | 4133 | specbind (Qinhibit_point_motion_hooks, Qt); |
| 4135 | specbind (Qinhibit_modification_hooks, Qt); | 4134 | specbind (Qinhibit_modification_hooks, Qt); |
| 4136 | 4135 | ||
| @@ -4156,9 +4155,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4156 | Hence we temporarily save `point' and `inserted' here and | 4155 | Hence we temporarily save `point' and `inserted' here and |
| 4157 | restore `point' iff format-decode did not insert or delete | 4156 | restore `point' iff format-decode did not insert or delete |
| 4158 | any text. Otherwise we leave `point' at point-min. */ | 4157 | any text. Otherwise we leave `point' at point-min. */ |
| 4159 | int opoint = PT; | 4158 | EMACS_INT opoint = PT; |
| 4160 | int opoint_byte = PT_BYTE; | 4159 | EMACS_INT opoint_byte = PT_BYTE; |
| 4161 | int oinserted = ZV - BEGV; | 4160 | EMACS_INT oinserted = ZV - BEGV; |
| 4162 | int ochars_modiff = CHARS_MODIFF; | 4161 | int ochars_modiff = CHARS_MODIFF; |
| 4163 | 4162 | ||
| 4164 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4163 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| @@ -4194,9 +4193,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4194 | { | 4193 | { |
| 4195 | /* For the rationale of this see the comment on | 4194 | /* For the rationale of this see the comment on |
| 4196 | format-decode above. */ | 4195 | format-decode above. */ |
| 4197 | int opoint = PT; | 4196 | EMACS_INT opoint = PT; |
| 4198 | int opoint_byte = PT_BYTE; | 4197 | EMACS_INT opoint_byte = PT_BYTE; |
| 4199 | int oinserted = ZV - BEGV; | 4198 | EMACS_INT oinserted = ZV - BEGV; |
| 4200 | int ochars_modiff = CHARS_MODIFF; | 4199 | int ochars_modiff = CHARS_MODIFF; |
| 4201 | 4200 | ||
| 4202 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4201 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |