diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 746 | ||||
| -rw-r--r-- | src/alloc.c | 95 | ||||
| -rw-r--r-- | src/bidi.c | 76 | ||||
| -rw-r--r-- | src/buffer.c | 186 | ||||
| -rw-r--r-- | src/buffer.h | 72 | ||||
| -rw-r--r-- | src/bytecode.c | 22 | ||||
| -rw-r--r-- | src/callint.c | 10 | ||||
| -rw-r--r-- | src/callproc.c | 67 | ||||
| -rw-r--r-- | src/casefiddle.c | 42 | ||||
| -rw-r--r-- | src/casetab.c | 9 | ||||
| -rw-r--r-- | src/category.c | 2 | ||||
| -rw-r--r-- | src/category.h | 3 | ||||
| -rw-r--r-- | src/ccl.c | 107 | ||||
| -rw-r--r-- | src/ccl.h | 2 | ||||
| -rw-r--r-- | src/character.c | 99 | ||||
| -rw-r--r-- | src/character.h | 28 | ||||
| -rw-r--r-- | src/charset.c | 52 | ||||
| -rw-r--r-- | src/chartab.c | 10 | ||||
| -rw-r--r-- | src/cmds.c | 157 | ||||
| -rw-r--r-- | src/coding.c | 268 | ||||
| -rw-r--r-- | src/coding.h | 20 | ||||
| -rw-r--r-- | src/composite.c | 121 | ||||
| -rw-r--r-- | src/composite.h | 22 | ||||
| -rw-r--r-- | src/data.c | 29 | ||||
| -rw-r--r-- | src/dbusbind.c | 16 | ||||
| -rw-r--r-- | src/dired.c | 43 | ||||
| -rw-r--r-- | src/dispextern.h | 114 | ||||
| -rw-r--r-- | src/dispnew.c | 107 | ||||
| -rw-r--r-- | src/doc.c | 24 | ||||
| -rw-r--r-- | src/doprnt.c | 2 | ||||
| -rw-r--r-- | src/editfns.c | 209 | ||||
| -rw-r--r-- | src/emacs.c | 25 | ||||
| -rw-r--r-- | src/eval.c | 48 | ||||
| -rw-r--r-- | src/fileio.c | 135 | ||||
| -rw-r--r-- | src/fns.c | 327 | ||||
| -rw-r--r-- | src/font.c | 65 | ||||
| -rw-r--r-- | src/font.h | 2 | ||||
| -rw-r--r-- | src/fontset.c | 18 | ||||
| -rw-r--r-- | src/frame.c | 61 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/fringe.c | 12 | ||||
| -rw-r--r-- | src/ftfont.c | 9 | ||||
| -rw-r--r-- | src/gnutls.c | 16 | ||||
| -rw-r--r-- | src/gnutls.h | 8 | ||||
| -rw-r--r-- | src/gtkutil.c | 12 | ||||
| -rw-r--r-- | src/image.c | 7 | ||||
| -rw-r--r-- | src/indent.c | 196 | ||||
| -rw-r--r-- | src/indent.h | 50 | ||||
| -rw-r--r-- | src/insdel.c | 254 | ||||
| -rw-r--r-- | src/intervals.c | 136 | ||||
| -rw-r--r-- | src/intervals.h | 34 | ||||
| -rw-r--r-- | src/keyboard.c | 153 | ||||
| -rw-r--r-- | src/keyboard.h | 4 | ||||
| -rw-r--r-- | src/keymap.c | 63 | ||||
| -rw-r--r-- | src/lisp.h | 291 | ||||
| -rw-r--r-- | src/lread.c | 59 | ||||
| -rw-r--r-- | src/macros.c | 15 | ||||
| -rw-r--r-- | src/marker.c | 95 | ||||
| -rw-r--r-- | src/menu.c | 71 | ||||
| -rw-r--r-- | src/minibuf.c | 52 | ||||
| -rw-r--r-- | src/nsfns.m | 14 | ||||
| -rw-r--r-- | src/nsfont.m | 8 | ||||
| -rw-r--r-- | src/nsmenu.m | 8 | ||||
| -rw-r--r-- | src/nsselect.m | 2 | ||||
| -rw-r--r-- | src/print.c | 102 | ||||
| -rw-r--r-- | src/process.c | 131 | ||||
| -rw-r--r-- | src/scroll.c | 8 | ||||
| -rw-r--r-- | src/search.c | 243 | ||||
| -rw-r--r-- | src/sound.c | 26 | ||||
| -rw-r--r-- | src/syntax.c | 192 | ||||
| -rw-r--r-- | src/syntax.h | 14 | ||||
| -rw-r--r-- | src/sysdep.c | 68 | ||||
| -rw-r--r-- | src/term.c | 8 | ||||
| -rw-r--r-- | src/termhooks.h | 2 | ||||
| -rw-r--r-- | src/textprop.c | 49 | ||||
| -rw-r--r-- | src/undo.c | 22 | ||||
| -rw-r--r-- | src/w32fns.c | 10 | ||||
| -rw-r--r-- | src/w32menu.c | 2 | ||||
| -rw-r--r-- | src/window.c | 56 | ||||
| -rw-r--r-- | src/xdisp.c | 684 | ||||
| -rw-r--r-- | src/xfaces.c | 52 | ||||
| -rw-r--r-- | src/xfns.c | 36 | ||||
| -rw-r--r-- | src/xfont.c | 2 | ||||
| -rw-r--r-- | src/xmenu.c | 14 | ||||
| -rw-r--r-- | src/xml.c | 4 | ||||
| -rw-r--r-- | src/xrdb.c | 2 | ||||
| -rw-r--r-- | src/xselect.c | 28 | ||||
| -rw-r--r-- | src/xterm.c | 36 | ||||
| -rw-r--r-- | src/xterm.h | 11 |
89 files changed, 3814 insertions, 3000 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0ea45aed1a3..1f8fd4f6b50 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,749 @@ | |||
| 1 | 2011-09-21 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp): | ||
| 4 | (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE) | ||
| 5 | (string_bytes, check_sblock, allocate_string_data): | ||
| 6 | (compact_small_strings, Fmake_bool_vector, make_string) | ||
| 7 | (make_unibyte_string, make_multibyte_string) | ||
| 8 | (make_string_from_bytes, make_specified_string) | ||
| 9 | (allocate_vectorlike, Fmake_vector, find_string_data_in_pure) | ||
| 10 | (make_pure_string, make_pure_c_string, make_pure_vector, Fpurecopy) | ||
| 11 | (mark_vectorlike): | ||
| 12 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 13 | (allocate_pseudovector): | ||
| 14 | Use int, not EMACS_INT, where int is wide enough. | ||
| 15 | (inhibit_garbage_collection, Fgarbage_collect): | ||
| 16 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 17 | * bidi.c (bidi_mirror_char): Use EMACS_INT, not int, where | ||
| 18 | int might not be wide enough. | ||
| 19 | (bidi_cache_search, bidi_cache_find, bidi_init_it) | ||
| 20 | (bidi_count_bytes, bidi_char_at_pos, bidi_fetch_char) | ||
| 21 | (bidi_at_paragraph_end, bidi_find_paragraph_start) | ||
| 22 | (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak) | ||
| 23 | (bidi_level_of_next_char, bidi_move_to_visually_next): | ||
| 24 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 25 | * buffer.c (copy_overlays, Fgenerate_new_buffer_name) | ||
| 26 | (Fkill_buffer, Fset_buffer_major_mode) | ||
| 27 | (advance_to_char_boundary, Fbuffer_swap_text) | ||
| 28 | (Fset_buffer_multibyte, overlays_at, overlays_in) | ||
| 29 | (overlay_touches_p, struct sortvec, record_overlay_string) | ||
| 30 | (overlay_strings, recenter_overlay_lists) | ||
| 31 | (adjust_overlays_for_insert, adjust_overlays_for_delete) | ||
| 32 | (fix_start_end_in_overlays, fix_overlays_before, modify_overlay) | ||
| 33 | (Fmove_overlay, Fnext_overlay_change, Fprevious_overlay_change) | ||
| 34 | (Foverlay_recenter, last_overlay_modification_hooks_used) | ||
| 35 | (report_overlay_modification, evaporate_overlays, enlarge_buffer_text): | ||
| 36 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 37 | (validate_region): Omit unnecessary test for b <= e, since | ||
| 38 | that's guaranteed by the previous test. | ||
| 39 | (adjust_overlays_for_delete): Avoid pos + length overflow. | ||
| 40 | (Fmove_overlay, Fdelete_overlay, add_overlay_mod_hooklist) | ||
| 41 | (report_overlay_modification): | ||
| 42 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 43 | (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change): | ||
| 44 | Omit pointer cast, which isn't needed anyway, and doesn't work | ||
| 45 | after the EMACS_INT -> ptrdiff_t change. | ||
| 46 | * buffer.h: Adjust decls to match defn changes elsewhere. | ||
| 47 | (struct buffer_text, struct buffer): | ||
| 48 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 49 | Use EMACS_INT, not int, where int might not be wide enough. | ||
| 50 | * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, to avoid | ||
| 51 | needless 32-bit limit on 64-bit hosts. Remove unnecessary | ||
| 52 | memory-full test. Use EMACS_INT, not ptrdiff_t or int, where | ||
| 53 | ptrdiff_t or int might not be wide enough. | ||
| 54 | * callint.c (Fcall_interactively): | ||
| 55 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 56 | * callproc.c (call_process_kill, Fcall_process): | ||
| 57 | Don't assume pid_t fits into an Emacs fixnum. | ||
| 58 | (call_process_cleanup, Fcall_process, child_setup): | ||
| 59 | Don't assume pid_t fits into int. | ||
| 60 | (call_process_cleanup, Fcall_process, delete_temp_file) | ||
| 61 | (Fcall_process_region): | ||
| 62 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 63 | (Fcall_process): Simplify handling of volatile integers. | ||
| 64 | Use int, not EMACS_INT, where int will do. | ||
| 65 | * casefiddle.c (casify_object, casify_region, operate_on_word) | ||
| 66 | (Fupcase_word, Fdowncase_word, Fcapitalize_word): | ||
| 67 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 68 | (casify_object): Avoid integer overflow when overallocating buffer. | ||
| 69 | * casetab.c (set_identity, shuffle): Prefer int to unsigned when | ||
| 70 | either works. | ||
| 71 | * category.c (Fchar_category_set): Don't assume fixnum fits in int. | ||
| 72 | * category.h (CATEGORYP): Don't assume arg is nonnegative. | ||
| 73 | * ccl.c (GET_CCL_INT): Remove; no longer needed, since the | ||
| 74 | integers are now checked earlier. All uses replaced with XINT. | ||
| 75 | (ccl_driver): | ||
| 76 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 77 | For CCL_MapSingle, check that content and value are in int range. | ||
| 78 | (resolve_symbol_ccl_program): Check that vector header is in range. | ||
| 79 | Always copy the vector, so that we can check its contents reliably | ||
| 80 | now rather than having to recheck each instruction as it's being | ||
| 81 | executed. Check that vector words fit in 'int'. | ||
| 82 | (ccl_get_compiled_code, Fregister_ccl_program) | ||
| 83 | (Fregister_code_conversion_map): Use ptrdiff_t, not int, for | ||
| 84 | program indexes, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 85 | (Fccl_execute, Fccl_execute_on_string): Check that initial reg | ||
| 86 | contents are in range. | ||
| 87 | (Fccl_execute_on_string): Check that status is in range. | ||
| 88 | * ccl.h (struct ccl_program.idx): Now ptrdiff_t, not int. | ||
| 89 | * character.c (char_resolve_modifier_mask, Fchar_resolve_modifiers): | ||
| 90 | Accept and return EMACS_INT, not int, because callers can pass values | ||
| 91 | out of 'int' range. | ||
| 92 | (c_string_width, strwidth, lisp_string_width, chars_in_text) | ||
| 93 | (multibyte_chars_in_text, parse_str_as_multibyte) | ||
| 94 | (str_as_multibyte, count_size_as_multibyte, str_to_multibyte) | ||
| 95 | (str_as_unibyte, str_to_unibyte, string_count_byte8) | ||
| 96 | (string_escape_byte8, Fget_byte): | ||
| 97 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 98 | (Funibyte_string): Use CHECK_CHARACTER, not CHECK_NATNUM, to | ||
| 99 | avoid mishandling large integers. | ||
| 100 | * character.h: Adjust decls to match defn changes elsewhere. | ||
| 101 | * charset.c (load_charset_map_from_file, find_charsets_in_text) | ||
| 102 | (Ffind_charset_region): | ||
| 103 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 104 | (load_charset_map_from_file): Redo idx calculation to avoid overflow. | ||
| 105 | (load_charset_map_from_vector, Fdefine_charset_internal): | ||
| 106 | Don't assume fixnum fits in int or unsigned int. | ||
| 107 | (load_charset_map_from_vector, Fmap_charset_chars): | ||
| 108 | Remove now-unnecessary CHECK_NATNUMs. | ||
| 109 | (Fdefine_charset_internal): Check ranges here, more carefully. | ||
| 110 | * chartab.c (Fmake_char_table, Fset_char_table_range) | ||
| 111 | (uniprop_get_decoder, uniprop_get_encoder): | ||
| 112 | Don't assume fixnum fits in int. | ||
| 113 | * cmds.c (move_point): New function, that does the gist of | ||
| 114 | Fforward_char and Fbackward_char, but does so while checking | ||
| 115 | for integer overflow more accurately. | ||
| 116 | (Fforward_char, Fbackward_char, internal_self_insert): Use it. | ||
| 117 | (Fforward_line, Fend_of_line, internal_self_insert) | ||
| 118 | (internal_self_insert): | ||
| 119 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 120 | Fix a FIXME, by checking for integer overflow when calculating | ||
| 121 | target_clm and actual_clm. | ||
| 122 | * coding.c (detect_coding_XXX, encode_coding_XXX, CODING_DECODE_CHAR) | ||
| 123 | (ASSURE_DESTINATION, coding_alloc_by_realloc) | ||
| 124 | (coding_alloc_by_making_gap, alloc_destination) | ||
| 125 | (detect_coding_utf_8, encode_coding_utf_8, decode_coding_utf_16) | ||
| 126 | (encode_coding_utf_16, detect_coding_emacs_mule) | ||
| 127 | (decode_coding_emacs_mule, encode_coding_emacs_mule) | ||
| 128 | (detect_coding_iso_2022, decode_coding_iso_2022) | ||
| 129 | (encode_invocation_designation, encode_designation_at_bol) | ||
| 130 | (encode_coding_iso_2022, detect_coding_sjis, detect_coding_big5) | ||
| 131 | (decode_coding_sjis, decode_coding_big5, encode_coding_sjis) | ||
| 132 | (encode_coding_big5, detect_coding_ccl, decode_coding_ccl) | ||
| 133 | (encode_coding_ccl, encode_coding_raw_text) | ||
| 134 | (detect_coding_charset, decode_coding_charset) | ||
| 135 | (encode_coding_charset, detect_eol, decode_eol, produce_chars) | ||
| 136 | (produce_composition, produce_charset, produce_annotation) | ||
| 137 | (decode_coding, handle_composition_annotation) | ||
| 138 | (handle_charset_annotation, consume_chars, decode_coding_gap) | ||
| 139 | (decode_coding_object, encode_coding_object, detect_coding_system) | ||
| 140 | (Ffind_coding_systems_region_internal, Fcheck_coding_systems_region) | ||
| 141 | (code_convert_region, code_convert_string) | ||
| 142 | (Fdefine_coding_system_internal): | ||
| 143 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 144 | (setup_iso_safe_charsets, consume_chars, Funencodable_char_position) | ||
| 145 | (Fdefine_coding_system_internal): | ||
| 146 | Don't assume fixnums fit in int. | ||
| 147 | (decode_coding_gap, decode_coding_object, encode_coding_object) | ||
| 148 | (Fread_coding_system, Fdetect_coding_region, Funencodable_char_position) | ||
| 149 | (Fcheck_coding_systems_region): | ||
| 150 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 151 | (Ffind_operation_coding_system): NATNUMP can eval its arg twice. | ||
| 152 | (Fdefine_coding_system_internal): Check for charset-id overflow. | ||
| 153 | * coding.h: Adjust decls to match defn changes elsewhere. | ||
| 154 | (struct coding_system): | ||
| 155 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 156 | * composite.c (get_composition_id, find_composition) | ||
| 157 | (run_composition_function, update_compositions) | ||
| 158 | (compose_text, composition_gstring_put_cache) | ||
| 159 | (composition_gstring_p, composition_gstring_width) | ||
| 160 | (fill_gstring_header, fill_gstring_body, autocmp_chars) | ||
| 161 | (composition_compute_stop_pos, composition_reseat_it) | ||
| 162 | (composition_update_it, struct position_record) | ||
| 163 | (find_automatic_composition, composition_adjust_point) | ||
| 164 | (Fcomposition_get_gstring, Ffind_composition_internal): | ||
| 165 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 166 | (update_compositions): | ||
| 167 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 168 | * composite.h: Adjust decls to match defn changes elsewhere. | ||
| 169 | (struct composition): | ||
| 170 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 171 | * data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p): | ||
| 172 | Do not attempt to compute the address of the object just before a | ||
| 173 | buffer; this is not portable. | ||
| 174 | (Faref, Faset): | ||
| 175 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 176 | (Faset): Use int, not EMACS_INT, where int is wide enough. | ||
| 177 | (Fstring_to_number): Don't assume fixnums fit in int. | ||
| 178 | (Frem): Don't assume arg is nonnegative. | ||
| 179 | * dbusbind.c (xd_append_arg): Check for integers out of range. | ||
| 180 | (Fdbus_call_method): Don't overflow the timeout int. | ||
| 181 | * dired.c (directory_files_internal, file_name_completion, scmp) | ||
| 182 | (file_name_completion_stat): | ||
| 183 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 184 | (file_name_completion): Don't overflow matchcount. | ||
| 185 | (file_name_completion_stat): Use SAFE_ALLOCA, not alloca. | ||
| 186 | * dispextern.h: Adjust decls to match defn changes elsewhere. | ||
| 187 | (struct text_pos, struct glyph, struct bidi_saved_info) | ||
| 188 | (struct bidi_string_data, struct bidi_it, struct composition_it) | ||
| 189 | (struct it): | ||
| 190 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 191 | (struct display_pos, struct composition_it, struct it): | ||
| 192 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 193 | * dispnew.c (increment_matrix_positions) | ||
| 194 | (increment_row_positions, mode_line_string) | ||
| 195 | (marginal_area_string): | ||
| 196 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 197 | (change_frame_size_1, Fredisplay): | ||
| 198 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 199 | (duration_to_sec_usec): New function, to check for overflow better. | ||
| 200 | (Fsleep_for, sit_for): Use it. | ||
| 201 | * doc.c (get_doc_string, store_function_docstring): | ||
| 202 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 203 | (get_doc_string, Fsnarf_documentation): | ||
| 204 | Use int, not EMACS_INT, where int is wide enough. | ||
| 205 | (get_doc_string): | ||
| 206 | Use SAFE_ALLOCA, not alloca. | ||
| 207 | Check for overflow when converting EMACS_INT to off_t. | ||
| 208 | * doprnt.c (doprnt): | ||
| 209 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 210 | * editfns.c (init_editfns, Fuser_uid, Fuser_real_uid): | ||
| 211 | Don't assume uid_t fits into fixnum. | ||
| 212 | (buildmark, Fgoto_char, overlays_around, find_field, Fdelete_field) | ||
| 213 | (Ffield_string, Ffield_string_no_properties, Ffield_beginning) | ||
| 214 | (Ffield_end, Fconstrain_to_field, Fline_beginning_position) | ||
| 215 | (Fline_end_position, Fprevious_char, Fchar_after, Fchar_before) | ||
| 216 | (general_insert_function) | ||
| 217 | (Finsert_char, make_buffer_string, make_buffer_string_both) | ||
| 218 | (update_buffer_properties, Fbuffer_substring) | ||
| 219 | (Fbuffer_substring_no_properties, Fcompare_buffer_substrings) | ||
| 220 | (Fsubst_char_in_region, check_translation) | ||
| 221 | (Ftranslate_region_internal, save_restriction_restore, Fformat) | ||
| 222 | (transpose_markers, Ftranspose_regions): | ||
| 223 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 224 | (clip_to_bounds): Move to lisp.h as an inline function). | ||
| 225 | (Fconstrain_to_field): Don't assume integers are nonnegative. | ||
| 226 | (Fline_beginning_position, Fsave_excursion, Fsave_current_buffer): | ||
| 227 | (Fsubst_char_in_region, Fsave_restriction): | ||
| 228 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 229 | (Femacs_pid): Don't assume pid_t fits into fixnum. | ||
| 230 | (lo_time): Use int, not EMACS_INT, when int suffices. | ||
| 231 | (lisp_time_argument): Check for usec out of range. | ||
| 232 | (Fencode_time): Don't assume fixnum fits in int. | ||
| 233 | * emacs.c (gdb_valbits, gdb_gctypebits): Now int, not EMACS_INT. | ||
| 234 | (gdb_data_seg_bits): Now uintptr_t, not EMACS_INT. | ||
| 235 | (PVEC_FLAG, gdb_array_mark_flag): Now ptrdiff_t, not EMACS_INT. | ||
| 236 | (init_cmdargs, Fdump_emacs): | ||
| 237 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 238 | (Fkill_emacs): Don't assume fixnum fits in int; instead, take just | ||
| 239 | the bottom (typically) 32 bits of the fixnum. | ||
| 240 | * eval.c (specpdl_size, call_debugger): | ||
| 241 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 242 | (when_entered_debugger, Fbacktrace_debug): | ||
| 243 | Don't assume fixnum can fit in int. | ||
| 244 | (Fdefvaralias, Fdefvar): Do not attempt to compute the address of | ||
| 245 | the object just before a buffer; this is not portable. | ||
| 246 | (FletX, Flet, Funwind_protect, do_autoload, Feval, funcall_lambda) | ||
| 247 | (grow_specpdl, unbind_to): | ||
| 248 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 249 | (Fapply, apply_lambda): Don't assume ptrdiff_t can hold fixnum. | ||
| 250 | (grow_specpdl): Simplify allocation by using xpalloc. | ||
| 251 | * fileio.c (Ffind_file_name_handler, Fcopy_file, Frename_file) | ||
| 252 | (Finsert_file_contents, Fwrite_region, Fdo_auto_save): | ||
| 253 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 254 | (Ffind_file_name_handler, non_regular_inserted, Finsert_file_contents) | ||
| 255 | (a_write, e_write): | ||
| 256 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 257 | (Fcopy_file, non_regular_nbytes, read_non_regular) | ||
| 258 | (Finsert_file_contents): | ||
| 259 | Use int, not EMACS_INT, where int is wide enough. | ||
| 260 | (READ_BUF_SIZE): Verify that it fits in int. | ||
| 261 | (Finsert_file_contents): Check that counts are in proper range, | ||
| 262 | rather than assuming fixnums fit into ptrdiff_t etc. | ||
| 263 | Don't assume fixnums fit into int. | ||
| 264 | (Fdo_auto_save, Fset_buffer_auto_saved) | ||
| 265 | (Fclear_buffer_auto_save_failure): | ||
| 266 | Don't assume time_t is signed, or that it fits in int. | ||
| 267 | * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec) | ||
| 268 | (concat, string_char_byte_cache_charpos, string_char_byte_cache_bytepos) | ||
| 269 | (string_char_to_byte, string_byte_to_char) | ||
| 270 | (string_make_multibyte, string_to_multibyte) | ||
| 271 | (string_make_unibyte, Fstring_as_unibyte, Fstring_as_multibyte) | ||
| 272 | (Fstring_to_unibyte, Fsubstring, Fsubstring_no_properties) | ||
| 273 | (substring_both, Fdelete, internal_equal, Ffillarray) | ||
| 274 | (Fclear_string, mapcar1) | ||
| 275 | (Fbase64_encode_region, Fbase64_encode_string, base64_encode_1) | ||
| 276 | (Fbase64_decode_region, Fbase64_decode_string, base64_decode_1) | ||
| 277 | (larger_vector, make_hash_table, maybe_resize_hash_table) | ||
| 278 | (hash_lookup, hash_remove_from_table, hash_clear, sweep_weak_table) | ||
| 279 | (Fmaphash, secure_hash): | ||
| 280 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 281 | (concat): Check for string index and length overflow. | ||
| 282 | (Fmapconcat): Don't assume fixnums fit into ptrdiff_t. | ||
| 283 | (Frequire): | ||
| 284 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 285 | (larger_vector): New API (vec, incr_min, size_max) replaces old | ||
| 286 | one (vec, new_size, init). This catches size overflow. | ||
| 287 | INIT was removed because it was always Qnil. | ||
| 288 | All callers changed. | ||
| 289 | (INDEX_SIZE_BOUND): New macro, which calculates more precisely | ||
| 290 | the upper bound on a hash table index size. | ||
| 291 | (make_hash_table, maybe_resize_hash_table): Use it. | ||
| 292 | (secure_hash): Computer start_byte and end_byte only after | ||
| 293 | they're known to be in ptrdiff_t range. | ||
| 294 | * font.c (font_intern_prop, font_at, font_range, Ffont_shape_gstring) | ||
| 295 | (Ffont_get_glyphs, Ffont_at): | ||
| 296 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 297 | (font_style_to_value, font_prop_validate_style, font_expand_wildcards) | ||
| 298 | (Flist_fonts, Fopen_font): | ||
| 299 | Don't assume fixnum can fit in int. | ||
| 300 | (check_gstring): Don't assume index can fit in int. | ||
| 301 | (font_match_p): Check that fixnum is a character, not a nonnegative | ||
| 302 | fixnum, since the later code needs to stuff it into an int. | ||
| 303 | (font_find_for_lface): Use SAFE_ALLOCA_LISP, not alloca. | ||
| 304 | (font_fill_lglyph_metrics): Use unsigned, not EMACS_INT, to avoid | ||
| 305 | conversion overflow issues. | ||
| 306 | (Fopen_font): Check for integer out of range. | ||
| 307 | (Ffont_get_glyphs): Don't assume index can fit in int. | ||
| 308 | * font.h: Adjust decls to match defn changes elsewhere. | ||
| 309 | * fontset.c (reorder_font_vector): Redo score calculation to avoid | ||
| 310 | integer overflow. | ||
| 311 | (num_auto_fontsets, fontset_from_font): Use ptrdiff_t, not | ||
| 312 | printmax_t, where ptrdiff_t is wide enough. | ||
| 313 | (Finternal_char_font): | ||
| 314 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 315 | * frame.c (Fset_mouse_position, Fset_mouse_pixel_position) | ||
| 316 | (Fset_frame_height, Fset_frame_width, Fset_frame_size) | ||
| 317 | (Fset_frame_position, x_set_frame_parameters) | ||
| 318 | (x_set_line_spacing, x_set_border_width) | ||
| 319 | (x_set_internal_border_width, x_set_alpha, x_figure_window_size): | ||
| 320 | Check that fixnums are in proper range for system types. | ||
| 321 | (frame_name_fnn_p, Fframe_parameter, Fmodify_frame_parameters): | ||
| 322 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 323 | (Fmodify_frame_parameters): Don't assume fixnum fits in int. | ||
| 324 | Use SAFE_ALLOCA_LISP, not alloca. | ||
| 325 | * frame.h (struct frame): Use intptr_t, not EMACS_INT, where | ||
| 326 | intptr_t is wide enough. | ||
| 327 | * fringe.c (lookup_fringe_bitmap, get_logical_fringe_bitmap) | ||
| 328 | (Fdefine_fringe_bitmap): Don't assume fixnum fits in int. | ||
| 329 | (Ffringe_bitmaps_at_pos): Don't assume index fits in int. | ||
| 330 | Check for fixnum out of range. | ||
| 331 | * ftfont.c (ftfont_list): Don't assume index fits in int. | ||
| 332 | Check that fixnums are in proper range for system types. | ||
| 333 | (ftfont_shape_by_flt): | ||
| 334 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 335 | Remove no-longer-needed lint_assume. | ||
| 336 | * gnutls.c (emacs_gnutls_write, emacs_gnutls_read): | ||
| 337 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 338 | (Fgnutls_error_fatalp, Fgnutls_error_string, Fgnutls_boot): | ||
| 339 | Check that fixnums are in proper range for system types. | ||
| 340 | * gnutls.h: Adjust decls to match defn changes elsewhere. | ||
| 341 | * gtkutil.c (xg_dialog_run): | ||
| 342 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 343 | (update_frame_tool_bar): | ||
| 344 | Check that fixnums are in proper range for system types. | ||
| 345 | * image.c (parse_image_spec): Redo count calculation to avoid overflow. | ||
| 346 | (lookup_image): Check that fixnums are in proper range for system types. | ||
| 347 | * indent.c (last_known_column, last_known_column_point): | ||
| 348 | (current_column_bol_cache): | ||
| 349 | (skip_invisible, current_column, check_display_width): | ||
| 350 | (check_display_width, scan_for_column, current_column_1) | ||
| 351 | (Findent_to, Fcurrent_indentation, position_indentation) | ||
| 352 | (indented_beyond_p, Fmove_to_column, compute_motion): | ||
| 353 | (Fcompute_motion, Fvertical_motion): | ||
| 354 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 355 | (last_known_column_modified): Use EMACS_INT, not int. | ||
| 356 | (check_display_width): | ||
| 357 | (Fcompute_motion): | ||
| 358 | Check that fixnums and floats are in proper range for system types. | ||
| 359 | (compute_motion): Don't assume index or fixnum fits in int. | ||
| 360 | (compute_motion, Fcompute_motion): | ||
| 361 | Use int, not EMACS_INT, when it is wide enough. | ||
| 362 | (vmotion): Omit local var start_hpos that is always 0; that way | ||
| 363 | we don't need to worry about overflow in expressions involving it. | ||
| 364 | * indent.h: Adjust decls to match defn changes elsewhere. | ||
| 365 | (struct position): | ||
| 366 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 367 | Use int, not EMACS_INT, where int is wide enough. | ||
| 368 | Remove unused members ovstring_chars_done and tab_offset; | ||
| 369 | all uses removed. | ||
| 370 | * insdel.c (move_gap, move_gap_both, gap_left, gap_right) | ||
| 371 | (adjust_markers_for_delete, adjust_markers_for_insert, adjust_point) | ||
| 372 | (adjust_markers_for_replace, make_gap_larger, make_gap_smaller) | ||
| 373 | (make_gap, copy_text, insert, insert_and_inherit) | ||
| 374 | (insert_before_markers, insert_before_markers_and_inherit) | ||
| 375 | (insert_1, count_combining_before, count_combining_after) | ||
| 376 | (insert_1_both, insert_from_string) | ||
| 377 | (insert_from_string_before_markers, insert_from_string_1) | ||
| 378 | (insert_from_gap, insert_from_buffer, insert_from_buffer_1) | ||
| 379 | (adjust_after_replace, adjust_after_insert, replace_range) | ||
| 380 | (replace_range_2, del_range, del_range_1, del_range_byte) | ||
| 381 | (del_range_both, del_range_2, modify_region) | ||
| 382 | (prepare_to_modify_buffer, signal_before_change) | ||
| 383 | (signal_after_change, Fcombine_after_change_execute): | ||
| 384 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 385 | * intervals.c (traverse_intervals, rotate_right, rotate_left) | ||
| 386 | (balance_an_interval, split_interval_right, split_interval_left) | ||
| 387 | (find_interval, next_interval, update_interval) | ||
| 388 | (adjust_intervals_for_insertion, delete_node, delete_interval) | ||
| 389 | (interval_deletion_adjustment, adjust_intervals_for_deletion) | ||
| 390 | (static_offset_intervals, offset_intervals) | ||
| 391 | (merge_interval_right, merge_interval_left, make_new_interval) | ||
| 392 | (graft_intervals_into_buffer, temp_set_point_both) | ||
| 393 | (temp_set_point, set_point, adjust_for_invis_intang) | ||
| 394 | (set_point_both, move_if_not_intangible, get_property_and_range) | ||
| 395 | (get_local_map, copy_intervals, copy_intervals_to_string) | ||
| 396 | (compare_string_intervals, set_intervals_multibyte_1): | ||
| 397 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 398 | * intervals.h: Adjust decls to match defn changes elsewhere. | ||
| 399 | (struct interval): | ||
| 400 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 401 | * keyboard.c (this_command_key_count, this_single_command_key_start) | ||
| 402 | (before_command_key_count, before_command_echo_length, echo_now) | ||
| 403 | (echo_length, recursive_edit_1, Frecursive_edit, Ftrack_mouse) | ||
| 404 | (command_loop_1, safe_run_hooks, read_char, timer_check_2) | ||
| 405 | (menu_item_eval_property, read_key_sequence, Fread_key_sequence) | ||
| 406 | (Fread_key_sequence_vector, Fexecute_extended_command, Fsuspend_emacs): | ||
| 407 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 408 | (last_non_minibuf_size, last_point_position, echo_truncate) | ||
| 409 | (command_loop_1, adjust_point_for_property, read_char, gen_help_event) | ||
| 410 | (make_lispy_position, make_lispy_event, parse_modifiers_uncached) | ||
| 411 | (parse_modifiers, modify_event_symbol, Fexecute_extended_command) | ||
| 412 | (stuff_buffered_input): | ||
| 413 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 414 | (last_auto_save, command_loop_1, read_char): | ||
| 415 | Use EMACS_INT, not int, to avoid integer overflow. | ||
| 416 | (record_char): Avoid overflow in total_keys computation. | ||
| 417 | (parse_modifiers_uncached): Redo index calculation to avoid overflow. | ||
| 418 | * keyboard.h: Adjust decls to match defn changes elsewhere. | ||
| 419 | * keymap.c (Fdefine_key, Fcurrent_active_maps, accessible_keymaps_1) | ||
| 420 | (Fkey_description, Fdescribe_vector, Flookup_key): | ||
| 421 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 422 | (click_position): New function, to check that positions are in range. | ||
| 423 | (Fcurrent_active_maps): | ||
| 424 | (describe_command): | ||
| 425 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 426 | (Faccessible_keymaps, Fkey_description): | ||
| 427 | (preferred_sequence_p): | ||
| 428 | Don't assume fixnum can fit into int. | ||
| 429 | (Fkey_description): Use SAFE_ALLOCA_LISP, not alloca. | ||
| 430 | Check for integer overflow in size calculations. | ||
| 431 | (Ftext_char_description): Use CHECK_CHARACTER, not CHECK_NUMBER, to | ||
| 432 | avoid mishandling large integers. | ||
| 433 | * lisp.h: Adjust decls to match defn changes elsewhere. | ||
| 434 | (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, struct Lisp_String) | ||
| 435 | (struct vectorlike_header, struct Lisp_Subr, struct Lisp_Hash_Table) | ||
| 436 | (struct Lisp_Marker): | ||
| 437 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 438 | (clip_to_bounds): Now an inline function, moved here from editfns.c. | ||
| 439 | (XSETSUBR): Use size of 0 since the actual size doesn't matter, | ||
| 440 | and using 0 avoids overflow. | ||
| 441 | (GLYPH_CODE_P): Check for overflow in system types, subsuming the | ||
| 442 | need for GLYPH_CODE_CHAR_VALID_P and doing proper checking ourselves. | ||
| 443 | All callers changed. | ||
| 444 | (GLYPH_CODE_CHAR, GLYPH_CODE_FACE): | ||
| 445 | Assume the arg has valid form, since it always does. | ||
| 446 | (TYPE_RANGED_INTEGERP): Avoid bug when checking against a wide | ||
| 447 | unsigned integer system type. | ||
| 448 | (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER): New macros. | ||
| 449 | (struct catchtag, specpdl_size, SPECPDL_INDEX, USE_SAFE_ALLOCA): | ||
| 450 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 451 | (struct catchtag): Use EMACS_INT, not int, since it may be a fixnum. | ||
| 452 | (duration_to_sec_usec): New decl. | ||
| 453 | * lread.c (read_from_string_index, read_from_string_index_byte) | ||
| 454 | (read_from_string_limit, readchar, unreadchar, openp) | ||
| 455 | (read_internal_start, read1, oblookup): | ||
| 456 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 457 | (Fload, readevalloop, Feval_buffer, Feval_region): | ||
| 458 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 459 | (openp): Check for out-of-range argument to 'access'. | ||
| 460 | (read1): Use int, not EMACS_INT, where int is wide enough. | ||
| 461 | Don't assume fixnum fits into int. | ||
| 462 | * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow | ||
| 463 | in size calculation. | ||
| 464 | (Fexecute_kbd_macro): | ||
| 465 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 466 | * marker.c (cached_charpos, cached_bytepos, CONSIDER) | ||
| 467 | (byte_char_debug_check, buf_charpos_to_bytepos, verify_bytepos) | ||
| 468 | (buf_bytepos_to_charpos, Fset_marker, set_marker_restricted) | ||
| 469 | (set_marker_both, set_marker_restricted_both, marker_position) | ||
| 470 | (marker_byte_position, Fbuffer_has_markers_at): | ||
| 471 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 472 | (Fset_marker, set_marker_restricted): Don't assume fixnum fits in int. | ||
| 473 | * menu.c (ensure_menu_items): Renamed from grow_menu_items. | ||
| 474 | It now merely ensures that the menu is large enough, without | ||
| 475 | necessarily growing it, as this avoids some integer overflow issues. | ||
| 476 | All callers changed. | ||
| 477 | (keymap_panes, parse_single_submenu, Fx_popup_menu): | ||
| 478 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 479 | (parse_single_submenu, Fx_popup_menu): Don't assume fixnum fits in int. | ||
| 480 | Use SAFE_ALLOCA_LISP, not alloca. | ||
| 481 | (find_and_return_menu_selection): Avoid unnecessary casts of pointers | ||
| 482 | to EMACS_INT. Check that fixnums are in proper range for system types. | ||
| 483 | * minibuf.c (minibuf_prompt_width, string_to_object) | ||
| 484 | (Fminibuffer_contents, Fminibuffer_contents_no_properties) | ||
| 485 | (Fminibuffer_completion_contents, Ftry_completion, Fall_completions): | ||
| 486 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 487 | (get_minibuffer, read_minibuf_unwind): | ||
| 488 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 489 | (read_minibuf): Omit unnecessary arg BACKUP_N, which is always nil; | ||
| 490 | this simplifies overflow checking. All callers changed. | ||
| 491 | (read_minibuf, Fread_buffer, Ftry_completion, Fall_completions) | ||
| 492 | (Ftest_completion): | ||
| 493 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 494 | * nsfns.m (check_ns_display_info): Don't assume fixnum fits in long. | ||
| 495 | (x_set_menu_bar_lines, x_set_tool_bar_lines, Fx_create_frame): | ||
| 496 | Check that fixnums are in proper range for system types. | ||
| 497 | (Fx_create_frame, Fx_show_tip): | ||
| 498 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 499 | * nsfont.m (ns_findfonts, nsfont_list_family): | ||
| 500 | Don't assume fixnum fits in long. | ||
| 501 | * nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog): | ||
| 502 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 503 | (ns_update_menubar): Use intptr_t, not EMACS_INT, when intptr_t is | ||
| 504 | wide enough. | ||
| 505 | * nsselect.m (ns_get_local_selection): | ||
| 506 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 507 | * print.c (print_buffer_size, print_buffer_pos, print_buffer_pos_byte) | ||
| 508 | (PRINTDECLARE, PRINTPREPARE): | ||
| 509 | (strout, print_string): | ||
| 510 | (print, print_preprocess, print_check_string_charset_prop) | ||
| 511 | (print_object): | ||
| 512 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 513 | (PRINTDECLARE): | ||
| 514 | (temp_output_buffer_setup, Fprin1_to_string, print_object): | ||
| 515 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 516 | (PRINTPREPARE): Use int, not ptrdiff_t, where int is wide enough. | ||
| 517 | (PRINTFINISH): Use SAFE_ALLOCA, not alloca. | ||
| 518 | (printchar, strout): Use xpalloc to catch size calculation overflow. | ||
| 519 | (Fexternal_debugging_output): Use CHECK_CHARACTER, not CHECK_NUMBER, | ||
| 520 | to avoid mishandling large integers. | ||
| 521 | (print_error_message): Use SAFE_ALLOCA, not alloca. | ||
| 522 | (print_object): Use int, not EMACS_INT, where int is wide enough. | ||
| 523 | * process.c (Fdelete_process): Don't assume pid fits into EMACS_INT. | ||
| 524 | (Fset_process_window_size, Fformat_network_address) | ||
| 525 | (get_lisp_to_sockaddr_size, set_socket_option, Fmake_network_process) | ||
| 526 | (Fsignal_process, sigchld_handler): | ||
| 527 | Check that fixnums are in proper range for system types. | ||
| 528 | (Fformat_network_address, read_process_output, send_process) | ||
| 529 | (Fprocess_send_region, status_notify): | ||
| 530 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 531 | (Fformat_network_address, Fmake_serial_process, Fmake_network_process) | ||
| 532 | (wait_reading_process_output, read_process_output, exec_sentinel): | ||
| 533 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 534 | (conv_lisp_to_sockaddr): Don't assume fixnums fit into int. | ||
| 535 | (Faccept_process_output): Use duration_to_sec_usec to do proper | ||
| 536 | overflow checking on durations. | ||
| 537 | * scroll.c (calculate_scrolling, calculate_direct_scrolling) | ||
| 538 | (line_ins_del): Use int, not EMACS_INT, where int is wide enough. | ||
| 539 | * search.c (looking_at_1, string_match_1): | ||
| 540 | (fast_string_match, fast_c_string_match_ignore_case) | ||
| 541 | (fast_string_match_ignore_case, fast_looking_at, scan_buffer) | ||
| 542 | (scan_newline, find_before_next_newline, search_command) | ||
| 543 | (trivial_regexp_p, search_buffer, simple_search, boyer_moore) | ||
| 544 | (set_search_regs, wordify): | ||
| 545 | (Freplace_match): | ||
| 546 | (Fmatch_data): | ||
| 547 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 548 | (string_match_1, search_buffer, set_search_regs): | ||
| 549 | (Fmatch_data): | ||
| 550 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 551 | (wordify): Check for overflow in size calculation. | ||
| 552 | (Freplace_match): Avoid potential buffer overflow in search_regs.start. | ||
| 553 | (Fset_match_data): Don't assume fixnum fits in ptrdiff_t. | ||
| 554 | Check that fixnums are in proper range for system types. | ||
| 555 | * sound.c (struct sound_device) | ||
| 556 | (wav_play, au_play, vox_write, alsa_period_size, alsa_write): | ||
| 557 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 558 | (Fplay_sound_internal): | ||
| 559 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 560 | * syntax.c (ST_COMMENT_STYLE, ST_STRING_STYLE): | ||
| 561 | In definitions, make it clearer that these values must be out of range | ||
| 562 | for the respective integer ranges. This fixes a bug with ST_STRING_STYLE | ||
| 563 | and non-ASCII characters. | ||
| 564 | (struct lisp_parse_state, find_start_modiff) | ||
| 565 | (Finternal_describe_syntax_value, scan_lists, scan_sexps_forward): | ||
| 566 | (Fparse_partial_sexp): | ||
| 567 | Don't assume fixnums can fit in int. | ||
| 568 | (struct lisp_parse_state, find_start_pos, find_start_value) | ||
| 569 | (find_start_value_byte, find_start_begv) | ||
| 570 | (update_syntax_table, char_quoted, dec_bytepos) | ||
| 571 | (find_defun_start, prev_char_comend_first, back_comment): | ||
| 572 | (scan_words, skip_chars, skip_syntaxes, forw_comment, Fforward_comment) | ||
| 573 | (scan_lists, Fbackward_prefix_chars, scan_sexps_forward): | ||
| 574 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 575 | (Finternal_describe_syntax_value): Check that match_lisp is a | ||
| 576 | character, not an integer, since the code stuffs it into int. | ||
| 577 | (scan_words, scan_sexps_forward): | ||
| 578 | Check that fixnums are in proper range for system types. | ||
| 579 | (Fforward_word): | ||
| 580 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 581 | (scan_sexps_forward): | ||
| 582 | Use CHARACTERP, not INTEGERP, since the value must fit into int. | ||
| 583 | (Fparse_partial_sexp): Fix doc; element 8 is not ignored. | ||
| 584 | * syntax.h: Adjust decls to match defn changes elsewhere. | ||
| 585 | (struct gl_state_s): | ||
| 586 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 587 | * sysdep.c (wait_for_termination_1, wait_for_termination) | ||
| 588 | (interruptible_wait_for_termination, mkdir): | ||
| 589 | Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit. | ||
| 590 | (emacs_read, emacs_write): | ||
| 591 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 592 | (system_process_attributes): Don't assume uid_t, gid_t, and | ||
| 593 | double all fit in int or even EMACS_INT. | ||
| 594 | * term.c (set_tty_color_mode): | ||
| 595 | Check that fixnums are in proper range for system types. | ||
| 596 | * termhooks.h (struct input_event): | ||
| 597 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 598 | * textprop.c (validate_interval_range, interval_of) | ||
| 599 | (Fadd_text_properties, set_text_properties_1) | ||
| 600 | (Fremove_text_properties, Fremove_list_of_text_properties) | ||
| 601 | (Ftext_property_any, Ftext_property_not_all) | ||
| 602 | (copy_text_properties, text_property_list, extend_property_ranges) | ||
| 603 | (verify_interval_modification): | ||
| 604 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 605 | (Fnext_single_char_property_change) | ||
| 606 | (Fprevious_single_char_property_change): | ||
| 607 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 608 | (copy_text_properties): Check for integer overflow in index calculation. | ||
| 609 | * undo.c (last_boundary_position, record_point, record_insert) | ||
| 610 | (record_delete, record_marker_adjustment, record_change) | ||
| 611 | (record_property_change): | ||
| 612 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 613 | (truncate_undo_list, Fprimitive_undo): Don't assume fixnum fits in int. | ||
| 614 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 615 | * w32fns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip) | ||
| 616 | (Fx_hide_tip, Fx_file_dialog): | ||
| 617 | * w32menu.c (set_frame_menubar): | ||
| 618 | Use ptrdiff_t, not int, for consistency with rest of code. | ||
| 619 | * window.c (window_scroll_preserve_hpos, window_scroll_preserve_vpos) | ||
| 620 | (select_window, Fdelete_other_windows_internal) | ||
| 621 | (window_scroll_pixel_based, window_scroll_line_based) | ||
| 622 | (Frecenter, Fset_window_configuration): | ||
| 623 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 624 | (Fset_window_hscroll, run_window_configuration_change_hook) | ||
| 625 | (set_window_buffer, temp_output_buffer_show, scroll_command) | ||
| 626 | (Fscroll_other_window): | ||
| 627 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 628 | (Fwindow_line_height, window_scroll, Fscroll_left, Fscroll_right): | ||
| 629 | Don't assume fixnum fits in int. | ||
| 630 | (Fset_window_scroll_bars): | ||
| 631 | Check that fixnums are in proper range for system types. | ||
| 632 | * xdisp.c (help_echo_pos, pos_visible_p, string_pos_nchars_ahead) | ||
| 633 | (string_pos, c_string_pos, number_of_chars, init_iterator) | ||
| 634 | (in_ellipses_for_invisible_text_p, init_from_display_pos) | ||
| 635 | (compute_stop_pos, next_overlay_change, compute_display_string_pos) | ||
| 636 | (compute_display_string_end, handle_face_prop) | ||
| 637 | (face_before_or_after_it_pos, handle_invisible_prop, handle_display_prop) | ||
| 638 | (handle_display_spec, handle_single_display_spec) | ||
| 639 | (display_prop_intangible_p, string_buffer_position_lim) | ||
| 640 | (string_buffer_position, handle_composition_prop, load_overlay_strings) | ||
| 641 | (get_overlay_strings_1, get_overlay_strings) | ||
| 642 | (iterate_out_of_display_property, forward_to_next_line_start) | ||
| 643 | (back_to_previous_visible_line_start, reseat, reseat_to_string) | ||
| 644 | (get_next_display_element, set_iterator_to_next) | ||
| 645 | (get_visually_first_element, compute_stop_pos_backwards) | ||
| 646 | (handle_stop_backwards, next_element_from_buffer) | ||
| 647 | (move_it_in_display_line_to, move_it_in_display_line) | ||
| 648 | (move_it_to, move_it_vertically_backward, move_it_by_lines) | ||
| 649 | (add_to_log, message_dolog, message_log_check_duplicate) | ||
| 650 | (message2, message2_nolog, message3, message3_nolog | ||
| 651 | (with_echo_area_buffer, display_echo_area_1, resize_mini_window_1) | ||
| 652 | (current_message_1, truncate_echo_area, truncate_message_1) | ||
| 653 | (set_message, set_message_1, store_mode_line_noprop) | ||
| 654 | (hscroll_window_tree, debug_delta, debug_delta_bytes, debug_end_vpos) | ||
| 655 | (text_outside_line_unchanged_p, check_point_in_composition) | ||
| 656 | (reconsider_clip_changes) | ||
| 657 | (redisplay_internal, set_cursor_from_row, try_scrolling) | ||
| 658 | (try_cursor_movement, set_vertical_scroll_bar, redisplay_window) | ||
| 659 | (redisplay_window, find_last_unchanged_at_beg_row) | ||
| 660 | (find_first_unchanged_at_end_row, row_containing_pos, try_window_id) | ||
| 661 | (trailing_whitespace_p, find_row_edges, display_line) | ||
| 662 | (RECORD_MAX_MIN_POS, Fcurrent_bidi_paragraph_direction) | ||
| 663 | (display_mode_element, store_mode_line_string) | ||
| 664 | (pint2str, pint2hrstr, decode_mode_spec) | ||
| 665 | (display_count_lines, display_string, draw_glyphs) | ||
| 666 | (x_produce_glyphs, x_insert_glyphs) | ||
| 667 | (rows_from_pos_range, mouse_face_from_buffer_pos) | ||
| 668 | (fast_find_string_pos, mouse_face_from_string_pos) | ||
| 669 | (note_mode_line_or_margin_highlight, note_mouse_highlight): | ||
| 670 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 671 | (safe_call, init_from_display_pos, handle_fontified_prop) | ||
| 672 | (handle_single_display_spec, load_overlay_strings) | ||
| 673 | (with_echo_area_buffer, setup_echo_area_for_printing) | ||
| 674 | (display_echo_area, echo_area_display) | ||
| 675 | (x_consider_frame_title, prepare_menu_bars, update_menu_bar) | ||
| 676 | (update_tool_bar, hscroll_window_tree, redisplay_internal) | ||
| 677 | (redisplay_window, dump_glyph_row, display_mode_line, Fformat_mode_line) | ||
| 678 | (decode_mode_spec, on_hot_spot_p): | ||
| 679 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 680 | (handle_single_display_spec, build_desired_tool_bar_string) | ||
| 681 | (redisplay_tool_bar, scroll_window_tree, Fdump_glyph_matrix) | ||
| 682 | (get_specified_cursor_type): | ||
| 683 | Check that fixnums are in proper range for system types. | ||
| 684 | (struct overlay_entry, resize_mini_window, Fdump_glyph_row) | ||
| 685 | (Flookup_image_map): | ||
| 686 | Don't assume fixnums fit in int. | ||
| 687 | (compare_overlay_entries): | ||
| 688 | Avoid mishandling comparisons due to subtraction overflow. | ||
| 689 | (load_overlay_strings): Use SAFE_NALLOCA, not alloca. | ||
| 690 | (last_escape_glyph_face_id, last_glyphless_glyph_face_id): | ||
| 691 | (handle_tool_bar_click): | ||
| 692 | Use int, not unsigned, since we prefer signed and the signedness | ||
| 693 | doesn't matter here. | ||
| 694 | (get_next_display_element, next_element_from_display_vector): | ||
| 695 | Use int, not EMACS_INT, when int is wide enough. | ||
| 696 | (start_hourglass): Use duration_to_sec_usec to do proper | ||
| 697 | overflow checking on durations. | ||
| 698 | * xfaces.c (Fbitmap_spec_p): | ||
| 699 | Check that fixnums are in proper range for system types. | ||
| 700 | (compare_fonts_by_sort_order): | ||
| 701 | Avoid mishandling comparisons due to subtraction overflow. | ||
| 702 | (Fx_family_fonts, realize_basic_faces): | ||
| 703 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 704 | (Fx_family_fonts): | ||
| 705 | Don't assume fixnum fits in int. | ||
| 706 | Use SAFE_ALLOCA_LISP, not alloca. | ||
| 707 | (merge_face_heights): Remove unnecessary cast to EMACS_INT. | ||
| 708 | (Finternal_make_lisp_face): Don't allocate more than MAX_FACE_ID. | ||
| 709 | (face_at_buffer_position, face_for_overlay_string) | ||
| 710 | (face_at_string_position): | ||
| 711 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 712 | (merge_faces): Use int, not EMACS_INT, where int is wide enough. | ||
| 713 | * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines, x_icon_verify) | ||
| 714 | (Fx_show_tip): | ||
| 715 | Check that fixnums are in proper range for system types. | ||
| 716 | (Fx_create_frame, x_create_tip_frame, Fx_show_tip) | ||
| 717 | (Fx_hide_tip, Fx_file_dialog, Fx_select_font): | ||
| 718 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 719 | (Fx_change_window_property): Don't assume fixnums fit in int. | ||
| 720 | * xfont.c (xfont_chars_supported): | ||
| 721 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 722 | * xmenu.c (Fx_popup_dialog, set_frame_menubar) | ||
| 723 | (create_and_show_popup_menu, create_and_show_dialog, xmenu_show): | ||
| 724 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 725 | * xml.c (parse_region): | ||
| 726 | * xrdb.c (magic_file_p): | ||
| 727 | Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough. | ||
| 728 | * xselect.c (TRACE1): Don't assume pid_t promotes to int. | ||
| 729 | (x_get_local_selection, x_reply_selection_request) | ||
| 730 | (x_handle_selection_request, wait_for_property_change): | ||
| 731 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 732 | (selection_data_to_lisp_data): Use short, not EMACS_INT, where | ||
| 733 | short is wide enough. | ||
| 734 | (x_send_client_event): Don't assume fixnum fits in int. | ||
| 735 | * xterm.c (x_x_to_emacs_modifiers): | ||
| 736 | Don't assume EMACS_INT overflows nicely into int. | ||
| 737 | (x_emacs_to_x_modifiers): Use EMACS_INT, not int, because values | ||
| 738 | may come from Lisp. | ||
| 739 | (handle_one_xevent): NATNUMP can eval its arg twice. | ||
| 740 | (x_connection_closed): | ||
| 741 | Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts. | ||
| 742 | * xterm.h: Adjust decls to match defn changes elsewhere. | ||
| 743 | (struct scroll_bar): Use struct vectorlike_header | ||
| 744 | rather than rolling our own approximation. | ||
| 745 | (SCROLL_BAR_VEC_SIZE): Remove; not used. | ||
| 746 | |||
| 1 | 2011-09-16 Paul Eggert <eggert@cs.ucla.edu> | 747 | 2011-09-16 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 748 | ||
| 3 | * xselect.c: Relax test for outgoing X longs (Bug#9498). | 749 | * xselect.c: Relax test for outgoing X longs (Bug#9498). |
diff --git a/src/alloc.c b/src/alloc.c index ad1741e308f..6bcb216bb5e 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -229,11 +229,11 @@ static ptrdiff_t pure_bytes_used_before_overflow; | |||
| 229 | 229 | ||
| 230 | /* Index in pure at which next pure Lisp object will be allocated.. */ | 230 | /* Index in pure at which next pure Lisp object will be allocated.. */ |
| 231 | 231 | ||
| 232 | static EMACS_INT pure_bytes_used_lisp; | 232 | static ptrdiff_t pure_bytes_used_lisp; |
| 233 | 233 | ||
| 234 | /* Number of bytes allocated for non-Lisp objects in pure storage. */ | 234 | /* Number of bytes allocated for non-Lisp objects in pure storage. */ |
| 235 | 235 | ||
| 236 | static EMACS_INT pure_bytes_used_non_lisp; | 236 | static ptrdiff_t pure_bytes_used_non_lisp; |
| 237 | 237 | ||
| 238 | /* If nonzero, this is a warning delivered by malloc and not yet | 238 | /* If nonzero, this is a warning delivered by malloc and not yet |
| 239 | displayed. */ | 239 | displayed. */ |
| @@ -382,7 +382,7 @@ static void *min_heap_address, *max_heap_address; | |||
| 382 | static struct mem_node mem_z; | 382 | static struct mem_node mem_z; |
| 383 | #define MEM_NIL &mem_z | 383 | #define MEM_NIL &mem_z |
| 384 | 384 | ||
| 385 | static struct Lisp_Vector *allocate_vectorlike (EMACS_INT); | 385 | static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t); |
| 386 | static void lisp_free (POINTER_TYPE *); | 386 | static void lisp_free (POINTER_TYPE *); |
| 387 | static void mark_stack (void); | 387 | static void mark_stack (void); |
| 388 | static int live_vector_p (struct mem_node *, void *); | 388 | static int live_vector_p (struct mem_node *, void *); |
| @@ -464,7 +464,7 @@ display_malloc_warning (void) | |||
| 464 | /* Called if we can't allocate relocatable space for a buffer. */ | 464 | /* Called if we can't allocate relocatable space for a buffer. */ |
| 465 | 465 | ||
| 466 | void | 466 | void |
| 467 | buffer_memory_full (EMACS_INT nbytes) | 467 | buffer_memory_full (ptrdiff_t nbytes) |
| 468 | { | 468 | { |
| 469 | /* If buffers use the relocating allocator, no need to free | 469 | /* If buffers use the relocating allocator, no need to free |
| 470 | spare_memory, because we may have plenty of malloc space left | 470 | spare_memory, because we may have plenty of malloc space left |
| @@ -1608,7 +1608,7 @@ struct sdata | |||
| 1608 | 1608 | ||
| 1609 | #ifdef GC_CHECK_STRING_BYTES | 1609 | #ifdef GC_CHECK_STRING_BYTES |
| 1610 | 1610 | ||
| 1611 | EMACS_INT nbytes; | 1611 | ptrdiff_t nbytes; |
| 1612 | unsigned char data[1]; | 1612 | unsigned char data[1]; |
| 1613 | 1613 | ||
| 1614 | #define SDATA_NBYTES(S) (S)->nbytes | 1614 | #define SDATA_NBYTES(S) (S)->nbytes |
| @@ -1623,7 +1623,7 @@ struct sdata | |||
| 1623 | unsigned char data[1]; | 1623 | unsigned char data[1]; |
| 1624 | 1624 | ||
| 1625 | /* When STRING is null. */ | 1625 | /* When STRING is null. */ |
| 1626 | EMACS_INT nbytes; | 1626 | ptrdiff_t nbytes; |
| 1627 | } u; | 1627 | } u; |
| 1628 | 1628 | ||
| 1629 | #define SDATA_NBYTES(S) (S)->u.nbytes | 1629 | #define SDATA_NBYTES(S) (S)->u.nbytes |
| @@ -1733,24 +1733,24 @@ static char const string_overrun_cookie[GC_STRING_OVERRUN_COOKIE_SIZE] = | |||
| 1733 | #define SDATA_SIZE(NBYTES) \ | 1733 | #define SDATA_SIZE(NBYTES) \ |
| 1734 | ((SDATA_DATA_OFFSET \ | 1734 | ((SDATA_DATA_OFFSET \ |
| 1735 | + (NBYTES) + 1 \ | 1735 | + (NBYTES) + 1 \ |
| 1736 | + sizeof (EMACS_INT) - 1) \ | 1736 | + sizeof (ptrdiff_t) - 1) \ |
| 1737 | & ~(sizeof (EMACS_INT) - 1)) | 1737 | & ~(sizeof (ptrdiff_t) - 1)) |
| 1738 | 1738 | ||
| 1739 | #else /* not GC_CHECK_STRING_BYTES */ | 1739 | #else /* not GC_CHECK_STRING_BYTES */ |
| 1740 | 1740 | ||
| 1741 | /* The 'max' reserves space for the nbytes union member even when NBYTES + 1 is | 1741 | /* The 'max' reserves space for the nbytes union member even when NBYTES + 1 is |
| 1742 | less than the size of that member. The 'max' is not needed when | 1742 | less than the size of that member. The 'max' is not needed when |
| 1743 | SDATA_DATA_OFFSET is a multiple of sizeof (EMACS_INT), because then the | 1743 | SDATA_DATA_OFFSET is a multiple of sizeof (ptrdiff_t), because then the |
| 1744 | alignment code reserves enough space. */ | 1744 | alignment code reserves enough space. */ |
| 1745 | 1745 | ||
| 1746 | #define SDATA_SIZE(NBYTES) \ | 1746 | #define SDATA_SIZE(NBYTES) \ |
| 1747 | ((SDATA_DATA_OFFSET \ | 1747 | ((SDATA_DATA_OFFSET \ |
| 1748 | + (SDATA_DATA_OFFSET % sizeof (EMACS_INT) == 0 \ | 1748 | + (SDATA_DATA_OFFSET % sizeof (ptrdiff_t) == 0 \ |
| 1749 | ? NBYTES \ | 1749 | ? NBYTES \ |
| 1750 | : max (NBYTES, sizeof (EMACS_INT) - 1)) \ | 1750 | : max (NBYTES, sizeof (ptrdiff_t) - 1)) \ |
| 1751 | + 1 \ | 1751 | + 1 \ |
| 1752 | + sizeof (EMACS_INT) - 1) \ | 1752 | + sizeof (ptrdiff_t) - 1) \ |
| 1753 | & ~(sizeof (EMACS_INT) - 1)) | 1753 | & ~(sizeof (ptrdiff_t) - 1)) |
| 1754 | 1754 | ||
| 1755 | #endif /* not GC_CHECK_STRING_BYTES */ | 1755 | #endif /* not GC_CHECK_STRING_BYTES */ |
| 1756 | 1756 | ||
| @@ -1794,10 +1794,10 @@ static int check_string_bytes_count; | |||
| 1794 | 1794 | ||
| 1795 | /* Like GC_STRING_BYTES, but with debugging check. */ | 1795 | /* Like GC_STRING_BYTES, but with debugging check. */ |
| 1796 | 1796 | ||
| 1797 | EMACS_INT | 1797 | ptrdiff_t |
| 1798 | string_bytes (struct Lisp_String *s) | 1798 | string_bytes (struct Lisp_String *s) |
| 1799 | { | 1799 | { |
| 1800 | EMACS_INT nbytes = | 1800 | ptrdiff_t nbytes = |
| 1801 | (s->size_byte < 0 ? s->size & ~ARRAY_MARK_FLAG : s->size_byte); | 1801 | (s->size_byte < 0 ? s->size & ~ARRAY_MARK_FLAG : s->size_byte); |
| 1802 | 1802 | ||
| 1803 | if (!PURE_POINTER_P (s) | 1803 | if (!PURE_POINTER_P (s) |
| @@ -1820,7 +1820,7 @@ check_sblock (struct sblock *b) | |||
| 1820 | { | 1820 | { |
| 1821 | /* Compute the next FROM here because copying below may | 1821 | /* Compute the next FROM here because copying below may |
| 1822 | overwrite data we need to compute it. */ | 1822 | overwrite data we need to compute it. */ |
| 1823 | EMACS_INT nbytes; | 1823 | ptrdiff_t nbytes; |
| 1824 | 1824 | ||
| 1825 | /* Check that the string size recorded in the string is the | 1825 | /* Check that the string size recorded in the string is the |
| 1826 | same as the one recorded in the sdata structure. */ | 1826 | same as the one recorded in the sdata structure. */ |
| @@ -1966,7 +1966,7 @@ allocate_string_data (struct Lisp_String *s, | |||
| 1966 | { | 1966 | { |
| 1967 | struct sdata *data, *old_data; | 1967 | struct sdata *data, *old_data; |
| 1968 | struct sblock *b; | 1968 | struct sblock *b; |
| 1969 | EMACS_INT needed, old_nbytes; | 1969 | ptrdiff_t needed, old_nbytes; |
| 1970 | 1970 | ||
| 1971 | if (STRING_BYTES_MAX < nbytes) | 1971 | if (STRING_BYTES_MAX < nbytes) |
| 1972 | string_overflow (); | 1972 | string_overflow (); |
| @@ -2211,7 +2211,7 @@ compact_small_strings (void) | |||
| 2211 | { | 2211 | { |
| 2212 | /* Compute the next FROM here because copying below may | 2212 | /* Compute the next FROM here because copying below may |
| 2213 | overwrite data we need to compute it. */ | 2213 | overwrite data we need to compute it. */ |
| 2214 | EMACS_INT nbytes; | 2214 | ptrdiff_t nbytes; |
| 2215 | 2215 | ||
| 2216 | #ifdef GC_CHECK_STRING_BYTES | 2216 | #ifdef GC_CHECK_STRING_BYTES |
| 2217 | /* Check that the string size recorded in the string is the | 2217 | /* Check that the string size recorded in the string is the |
| @@ -2341,7 +2341,8 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2341 | { | 2341 | { |
| 2342 | register Lisp_Object val; | 2342 | register Lisp_Object val; |
| 2343 | struct Lisp_Bool_Vector *p; | 2343 | struct Lisp_Bool_Vector *p; |
| 2344 | EMACS_INT length_in_chars, length_in_elts; | 2344 | ptrdiff_t length_in_chars; |
| 2345 | EMACS_INT length_in_elts; | ||
| 2345 | int bits_per_value; | 2346 | int bits_per_value; |
| 2346 | 2347 | ||
| 2347 | CHECK_NATNUM (length); | 2348 | CHECK_NATNUM (length); |
| @@ -2349,8 +2350,6 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2349 | bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR; | 2350 | bits_per_value = sizeof (EMACS_INT) * BOOL_VECTOR_BITS_PER_CHAR; |
| 2350 | 2351 | ||
| 2351 | length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; | 2352 | length_in_elts = (XFASTINT (length) + bits_per_value - 1) / bits_per_value; |
| 2352 | length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 2353 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2354 | 2353 | ||
| 2355 | /* We must allocate one more elements than LENGTH_IN_ELTS for the | 2354 | /* We must allocate one more elements than LENGTH_IN_ELTS for the |
| 2356 | slot `size' of the struct Lisp_Bool_Vector. */ | 2355 | slot `size' of the struct Lisp_Bool_Vector. */ |
| @@ -2362,6 +2361,8 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2362 | p = XBOOL_VECTOR (val); | 2361 | p = XBOOL_VECTOR (val); |
| 2363 | p->size = XFASTINT (length); | 2362 | p->size = XFASTINT (length); |
| 2364 | 2363 | ||
| 2364 | length_in_chars = ((XFASTINT (length) + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 2365 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2365 | if (length_in_chars) | 2366 | if (length_in_chars) |
| 2366 | { | 2367 | { |
| 2367 | memset (p->data, ! NILP (init) ? -1 : 0, length_in_chars); | 2368 | memset (p->data, ! NILP (init) ? -1 : 0, length_in_chars); |
| @@ -2380,10 +2381,10 @@ LENGTH must be a number. INIT matters only in whether it is t or nil. */) | |||
| 2380 | multibyte, depending on the contents. */ | 2381 | multibyte, depending on the contents. */ |
| 2381 | 2382 | ||
| 2382 | Lisp_Object | 2383 | Lisp_Object |
| 2383 | make_string (const char *contents, EMACS_INT nbytes) | 2384 | make_string (const char *contents, ptrdiff_t nbytes) |
| 2384 | { | 2385 | { |
| 2385 | register Lisp_Object val; | 2386 | register Lisp_Object val; |
| 2386 | EMACS_INT nchars, multibyte_nbytes; | 2387 | ptrdiff_t nchars, multibyte_nbytes; |
| 2387 | 2388 | ||
| 2388 | parse_str_as_multibyte ((const unsigned char *) contents, nbytes, | 2389 | parse_str_as_multibyte ((const unsigned char *) contents, nbytes, |
| 2389 | &nchars, &multibyte_nbytes); | 2390 | &nchars, &multibyte_nbytes); |
| @@ -2400,7 +2401,7 @@ make_string (const char *contents, EMACS_INT nbytes) | |||
| 2400 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ | 2401 | /* Make an unibyte string from LENGTH bytes at CONTENTS. */ |
| 2401 | 2402 | ||
| 2402 | Lisp_Object | 2403 | Lisp_Object |
| 2403 | make_unibyte_string (const char *contents, EMACS_INT length) | 2404 | make_unibyte_string (const char *contents, ptrdiff_t length) |
| 2404 | { | 2405 | { |
| 2405 | register Lisp_Object val; | 2406 | register Lisp_Object val; |
| 2406 | val = make_uninit_string (length); | 2407 | val = make_uninit_string (length); |
| @@ -2414,7 +2415,7 @@ make_unibyte_string (const char *contents, EMACS_INT length) | |||
| 2414 | 2415 | ||
| 2415 | Lisp_Object | 2416 | Lisp_Object |
| 2416 | make_multibyte_string (const char *contents, | 2417 | make_multibyte_string (const char *contents, |
| 2417 | EMACS_INT nchars, EMACS_INT nbytes) | 2418 | ptrdiff_t nchars, ptrdiff_t nbytes) |
| 2418 | { | 2419 | { |
| 2419 | register Lisp_Object val; | 2420 | register Lisp_Object val; |
| 2420 | val = make_uninit_multibyte_string (nchars, nbytes); | 2421 | val = make_uninit_multibyte_string (nchars, nbytes); |
| @@ -2428,7 +2429,7 @@ make_multibyte_string (const char *contents, | |||
| 2428 | 2429 | ||
| 2429 | Lisp_Object | 2430 | Lisp_Object |
| 2430 | make_string_from_bytes (const char *contents, | 2431 | make_string_from_bytes (const char *contents, |
| 2431 | EMACS_INT nchars, EMACS_INT nbytes) | 2432 | ptrdiff_t nchars, ptrdiff_t nbytes) |
| 2432 | { | 2433 | { |
| 2433 | register Lisp_Object val; | 2434 | register Lisp_Object val; |
| 2434 | val = make_uninit_multibyte_string (nchars, nbytes); | 2435 | val = make_uninit_multibyte_string (nchars, nbytes); |
| @@ -2446,7 +2447,7 @@ make_string_from_bytes (const char *contents, | |||
| 2446 | 2447 | ||
| 2447 | Lisp_Object | 2448 | Lisp_Object |
| 2448 | make_specified_string (const char *contents, | 2449 | make_specified_string (const char *contents, |
| 2449 | EMACS_INT nchars, EMACS_INT nbytes, int multibyte) | 2450 | ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) |
| 2450 | { | 2451 | { |
| 2451 | register Lisp_Object val; | 2452 | register Lisp_Object val; |
| 2452 | 2453 | ||
| @@ -2885,7 +2886,7 @@ enum | |||
| 2885 | with room for LEN Lisp_Objects. */ | 2886 | with room for LEN Lisp_Objects. */ |
| 2886 | 2887 | ||
| 2887 | static struct Lisp_Vector * | 2888 | static struct Lisp_Vector * |
| 2888 | allocate_vectorlike (EMACS_INT len) | 2889 | allocate_vectorlike (ptrdiff_t len) |
| 2889 | { | 2890 | { |
| 2890 | struct Lisp_Vector *p; | 2891 | struct Lisp_Vector *p; |
| 2891 | size_t nbytes; | 2892 | size_t nbytes; |
| @@ -2941,7 +2942,7 @@ allocate_vector (EMACS_INT len) | |||
| 2941 | /* Allocate other vector-like structures. */ | 2942 | /* Allocate other vector-like structures. */ |
| 2942 | 2943 | ||
| 2943 | struct Lisp_Vector * | 2944 | struct Lisp_Vector * |
| 2944 | allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag) | 2945 | allocate_pseudovector (int memlen, int lisplen, int tag) |
| 2945 | { | 2946 | { |
| 2946 | struct Lisp_Vector *v = allocate_vectorlike (memlen); | 2947 | struct Lisp_Vector *v = allocate_vectorlike (memlen); |
| 2947 | int i; | 2948 | int i; |
| @@ -3005,14 +3006,14 @@ See also the function `vector'. */) | |||
| 3005 | (register Lisp_Object length, Lisp_Object init) | 3006 | (register Lisp_Object length, Lisp_Object init) |
| 3006 | { | 3007 | { |
| 3007 | Lisp_Object vector; | 3008 | Lisp_Object vector; |
| 3008 | register EMACS_INT sizei; | 3009 | register ptrdiff_t sizei; |
| 3009 | register EMACS_INT i; | 3010 | register ptrdiff_t i; |
| 3010 | register struct Lisp_Vector *p; | 3011 | register struct Lisp_Vector *p; |
| 3011 | 3012 | ||
| 3012 | CHECK_NATNUM (length); | 3013 | CHECK_NATNUM (length); |
| 3013 | sizei = XFASTINT (length); | ||
| 3014 | 3014 | ||
| 3015 | p = allocate_vector (sizei); | 3015 | p = allocate_vector (XFASTINT (length)); |
| 3016 | sizei = XFASTINT (length); | ||
| 3016 | for (i = 0; i < sizei; i++) | 3017 | for (i = 0; i < sizei; i++) |
| 3017 | p->contents[i] = init; | 3018 | p->contents[i] = init; |
| 3018 | 3019 | ||
| @@ -4696,14 +4697,14 @@ check_pure_size (void) | |||
| 4696 | address. Return NULL if not found. */ | 4697 | address. Return NULL if not found. */ |
| 4697 | 4698 | ||
| 4698 | static char * | 4699 | static char * |
| 4699 | find_string_data_in_pure (const char *data, EMACS_INT nbytes) | 4700 | find_string_data_in_pure (const char *data, ptrdiff_t nbytes) |
| 4700 | { | 4701 | { |
| 4701 | int i; | 4702 | int i; |
| 4702 | EMACS_INT skip, bm_skip[256], last_char_skip, infinity, start, start_max; | 4703 | ptrdiff_t skip, bm_skip[256], last_char_skip, infinity, start, start_max; |
| 4703 | const unsigned char *p; | 4704 | const unsigned char *p; |
| 4704 | char *non_lisp_beg; | 4705 | char *non_lisp_beg; |
| 4705 | 4706 | ||
| 4706 | if (pure_bytes_used_non_lisp < nbytes + 1) | 4707 | if (pure_bytes_used_non_lisp <= nbytes) |
| 4707 | return NULL; | 4708 | return NULL; |
| 4708 | 4709 | ||
| 4709 | /* Set up the Boyer-Moore table. */ | 4710 | /* Set up the Boyer-Moore table. */ |
| @@ -4767,7 +4768,7 @@ find_string_data_in_pure (const char *data, EMACS_INT nbytes) | |||
| 4767 | 4768 | ||
| 4768 | Lisp_Object | 4769 | Lisp_Object |
| 4769 | make_pure_string (const char *data, | 4770 | make_pure_string (const char *data, |
| 4770 | EMACS_INT nchars, EMACS_INT nbytes, int multibyte) | 4771 | ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) |
| 4771 | { | 4772 | { |
| 4772 | Lisp_Object string; | 4773 | Lisp_Object string; |
| 4773 | struct Lisp_String *s; | 4774 | struct Lisp_String *s; |
| @@ -4795,7 +4796,7 @@ make_pure_c_string (const char *data) | |||
| 4795 | { | 4796 | { |
| 4796 | Lisp_Object string; | 4797 | Lisp_Object string; |
| 4797 | struct Lisp_String *s; | 4798 | struct Lisp_String *s; |
| 4798 | EMACS_INT nchars = strlen (data); | 4799 | ptrdiff_t nchars = strlen (data); |
| 4799 | 4800 | ||
| 4800 | s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String); | 4801 | s = (struct Lisp_String *) pure_alloc (sizeof *s, Lisp_String); |
| 4801 | s->size = nchars; | 4802 | s->size = nchars; |
| @@ -4842,7 +4843,7 @@ make_pure_float (double num) | |||
| 4842 | pure space. */ | 4843 | pure space. */ |
| 4843 | 4844 | ||
| 4844 | Lisp_Object | 4845 | Lisp_Object |
| 4845 | make_pure_vector (EMACS_INT len) | 4846 | make_pure_vector (ptrdiff_t len) |
| 4846 | { | 4847 | { |
| 4847 | Lisp_Object new; | 4848 | Lisp_Object new; |
| 4848 | struct Lisp_Vector *p; | 4849 | struct Lisp_Vector *p; |
| @@ -4886,8 +4887,8 @@ Does not copy symbols. Copies strings without text properties. */) | |||
| 4886 | else if (COMPILEDP (obj) || VECTORP (obj)) | 4887 | else if (COMPILEDP (obj) || VECTORP (obj)) |
| 4887 | { | 4888 | { |
| 4888 | register struct Lisp_Vector *vec; | 4889 | register struct Lisp_Vector *vec; |
| 4889 | register EMACS_INT i; | 4890 | register ptrdiff_t i; |
| 4890 | EMACS_INT size; | 4891 | ptrdiff_t size; |
| 4891 | 4892 | ||
| 4892 | size = ASIZE (obj); | 4893 | size = ASIZE (obj); |
| 4893 | if (size & PSEUDOVECTOR_FLAG) | 4894 | if (size & PSEUDOVECTOR_FLAG) |
| @@ -4939,10 +4940,10 @@ staticpro (Lisp_Object *varaddress) | |||
| 4939 | 4940 | ||
| 4940 | /* Temporarily prevent garbage collection. */ | 4941 | /* Temporarily prevent garbage collection. */ |
| 4941 | 4942 | ||
| 4942 | int | 4943 | ptrdiff_t |
| 4943 | inhibit_garbage_collection (void) | 4944 | inhibit_garbage_collection (void) |
| 4944 | { | 4945 | { |
| 4945 | int count = SPECPDL_INDEX (); | 4946 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4946 | 4947 | ||
| 4947 | specbind (Qgc_cons_threshold, make_number (MOST_POSITIVE_FIXNUM)); | 4948 | specbind (Qgc_cons_threshold, make_number (MOST_POSITIVE_FIXNUM)); |
| 4948 | return count; | 4949 | return count; |
| @@ -4967,7 +4968,7 @@ returns nil, because real GC can't be done. */) | |||
| 4967 | ptrdiff_t i; | 4968 | ptrdiff_t i; |
| 4968 | int message_p; | 4969 | int message_p; |
| 4969 | Lisp_Object total[8]; | 4970 | Lisp_Object total[8]; |
| 4970 | int count = SPECPDL_INDEX (); | 4971 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4971 | EMACS_TIME t1, t2, t3; | 4972 | EMACS_TIME t1, t2, t3; |
| 4972 | 4973 | ||
| 4973 | if (abort_on_gc) | 4974 | if (abort_on_gc) |
| @@ -5262,7 +5263,7 @@ returns nil, because real GC can't be done. */) | |||
| 5262 | 5263 | ||
| 5263 | if (!NILP (Vpost_gc_hook)) | 5264 | if (!NILP (Vpost_gc_hook)) |
| 5264 | { | 5265 | { |
| 5265 | int gc_count = inhibit_garbage_collection (); | 5266 | ptrdiff_t gc_count = inhibit_garbage_collection (); |
| 5266 | safe_run_hooks (Qpost_gc_hook); | 5267 | safe_run_hooks (Qpost_gc_hook); |
| 5267 | unbind_to (gc_count, Qnil); | 5268 | unbind_to (gc_count, Qnil); |
| 5268 | } | 5269 | } |
| @@ -5347,8 +5348,8 @@ ptrdiff_t mark_object_loop_halt EXTERNALLY_VISIBLE; | |||
| 5347 | static void | 5348 | static void |
| 5348 | mark_vectorlike (struct Lisp_Vector *ptr) | 5349 | mark_vectorlike (struct Lisp_Vector *ptr) |
| 5349 | { | 5350 | { |
| 5350 | EMACS_INT size = ptr->header.size; | 5351 | ptrdiff_t size = ptr->header.size; |
| 5351 | EMACS_INT i; | 5352 | ptrdiff_t i; |
| 5352 | 5353 | ||
| 5353 | eassert (!VECTOR_MARKED_P (ptr)); | 5354 | eassert (!VECTOR_MARKED_P (ptr)); |
| 5354 | VECTOR_MARK (ptr); /* Else mark it */ | 5355 | VECTOR_MARK (ptr); /* Else mark it */ |
diff --git a/src/bidi.c b/src/bidi.c index bb29647ea88..11013edc70d 100644 --- a/src/bidi.c +++ b/src/bidi.c | |||
| @@ -204,7 +204,7 @@ bidi_mirror_char (int c) | |||
| 204 | val = CHAR_TABLE_REF (bidi_mirror_table, c); | 204 | val = CHAR_TABLE_REF (bidi_mirror_table, c); |
| 205 | if (INTEGERP (val)) | 205 | if (INTEGERP (val)) |
| 206 | { | 206 | { |
| 207 | int v = XINT (val); | 207 | EMACS_INT v = XINT (val); |
| 208 | 208 | ||
| 209 | if (v < 0 || v > MAX_CHAR) | 209 | if (v < 0 || v > MAX_CHAR) |
| 210 | abort (); | 210 | abort (); |
| @@ -378,7 +378,7 @@ bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it) | |||
| 378 | resolved levels in cached states. DIR, if non-zero, means search | 378 | resolved levels in cached states. DIR, if non-zero, means search |
| 379 | in that direction from the last cache hit. */ | 379 | in that direction from the last cache hit. */ |
| 380 | static inline ptrdiff_t | 380 | static inline ptrdiff_t |
| 381 | bidi_cache_search (EMACS_INT charpos, int level, int dir) | 381 | bidi_cache_search (ptrdiff_t charpos, int level, int dir) |
| 382 | { | 382 | { |
| 383 | ptrdiff_t i, i_start; | 383 | ptrdiff_t i, i_start; |
| 384 | 384 | ||
| @@ -562,7 +562,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved) | |||
| 562 | } | 562 | } |
| 563 | 563 | ||
| 564 | static inline bidi_type_t | 564 | static inline bidi_type_t |
| 565 | bidi_cache_find (EMACS_INT charpos, int level, struct bidi_it *bidi_it) | 565 | bidi_cache_find (ptrdiff_t charpos, int level, struct bidi_it *bidi_it) |
| 566 | { | 566 | { |
| 567 | ptrdiff_t i = bidi_cache_search (charpos, level, bidi_it->scan_dir); | 567 | ptrdiff_t i = bidi_cache_search (charpos, level, bidi_it->scan_dir); |
| 568 | 568 | ||
| @@ -794,7 +794,7 @@ bidi_set_paragraph_end (struct bidi_it *bidi_it) | |||
| 794 | 794 | ||
| 795 | /* Initialize the bidi iterator from buffer/string position CHARPOS. */ | 795 | /* Initialize the bidi iterator from buffer/string position CHARPOS. */ |
| 796 | void | 796 | void |
| 797 | bidi_init_it (EMACS_INT charpos, EMACS_INT bytepos, int frame_window_p, | 797 | bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, int frame_window_p, |
| 798 | struct bidi_it *bidi_it) | 798 | struct bidi_it *bidi_it) |
| 799 | { | 799 | { |
| 800 | if (! bidi_initialized) | 800 | if (! bidi_initialized) |
| @@ -863,11 +863,11 @@ bidi_line_init (struct bidi_it *bidi_it) | |||
| 863 | are zero-based character positions in S, BEGBYTE is byte position | 863 | are zero-based character positions in S, BEGBYTE is byte position |
| 864 | corresponding to BEG. UNIBYTE, if non-zero, means S is a unibyte | 864 | corresponding to BEG. UNIBYTE, if non-zero, means S is a unibyte |
| 865 | string. */ | 865 | string. */ |
| 866 | static inline EMACS_INT | 866 | static inline ptrdiff_t |
| 867 | bidi_count_bytes (const unsigned char *s, const EMACS_INT beg, | 867 | bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg, |
| 868 | const EMACS_INT begbyte, const EMACS_INT end, int unibyte) | 868 | const ptrdiff_t begbyte, const ptrdiff_t end, int unibyte) |
| 869 | { | 869 | { |
| 870 | EMACS_INT pos = beg; | 870 | ptrdiff_t pos = beg; |
| 871 | const unsigned char *p = s + begbyte, *start = p; | 871 | const unsigned char *p = s + begbyte, *start = p; |
| 872 | 872 | ||
| 873 | if (unibyte) | 873 | if (unibyte) |
| @@ -892,7 +892,7 @@ bidi_count_bytes (const unsigned char *s, const EMACS_INT beg, | |||
| 892 | character from the current buffer. UNIBYTE non-zero means S is a | 892 | character from the current buffer. UNIBYTE non-zero means S is a |
| 893 | unibyte string. */ | 893 | unibyte string. */ |
| 894 | static inline int | 894 | static inline int |
| 895 | bidi_char_at_pos (EMACS_INT bytepos, const unsigned char *s, int unibyte) | 895 | bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte) |
| 896 | { | 896 | { |
| 897 | if (s) | 897 | if (s) |
| 898 | { | 898 | { |
| @@ -920,12 +920,12 @@ bidi_char_at_pos (EMACS_INT bytepos, const unsigned char *s, int unibyte) | |||
| 920 | string to iterate, or NULL if iterating over a buffer or a Lisp | 920 | string to iterate, or NULL if iterating over a buffer or a Lisp |
| 921 | string; in the latter case, STRING->lstring is the Lisp string. */ | 921 | string; in the latter case, STRING->lstring is the Lisp string. */ |
| 922 | static inline int | 922 | static inline int |
| 923 | bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | 923 | bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, |
| 924 | int *disp_prop, struct bidi_string_data *string, | 924 | int *disp_prop, struct bidi_string_data *string, |
| 925 | int frame_window_p, EMACS_INT *ch_len, EMACS_INT *nchars) | 925 | int frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars) |
| 926 | { | 926 | { |
| 927 | int ch; | 927 | int ch; |
| 928 | EMACS_INT endpos = | 928 | ptrdiff_t endpos = |
| 929 | (string->s || STRINGP (string->lstring)) ? string->schars : ZV; | 929 | (string->s || STRINGP (string->lstring)) ? string->schars : ZV; |
| 930 | struct text_pos pos; | 930 | struct text_pos pos; |
| 931 | 931 | ||
| @@ -949,7 +949,7 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 949 | } | 949 | } |
| 950 | else if (charpos >= *disp_pos && *disp_prop) | 950 | else if (charpos >= *disp_pos && *disp_prop) |
| 951 | { | 951 | { |
| 952 | EMACS_INT disp_end_pos; | 952 | ptrdiff_t disp_end_pos; |
| 953 | 953 | ||
| 954 | /* We don't expect to find ourselves in the middle of a display | 954 | /* We don't expect to find ourselves in the middle of a display |
| 955 | property. Hopefully, it will never be needed. */ | 955 | property. Hopefully, it will never be needed. */ |
| @@ -1049,12 +1049,12 @@ bidi_fetch_char (EMACS_INT bytepos, EMACS_INT charpos, EMACS_INT *disp_pos, | |||
| 1049 | following the buffer position, -1 if position is at the beginning | 1049 | following the buffer position, -1 if position is at the beginning |
| 1050 | of a new paragraph, or -2 if position is neither at beginning nor | 1050 | of a new paragraph, or -2 if position is neither at beginning nor |
| 1051 | at end of a paragraph. */ | 1051 | at end of a paragraph. */ |
| 1052 | static EMACS_INT | 1052 | static ptrdiff_t |
| 1053 | bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) | 1053 | bidi_at_paragraph_end (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 1054 | { | 1054 | { |
| 1055 | Lisp_Object sep_re; | 1055 | Lisp_Object sep_re; |
| 1056 | Lisp_Object start_re; | 1056 | Lisp_Object start_re; |
| 1057 | EMACS_INT val; | 1057 | ptrdiff_t val; |
| 1058 | 1058 | ||
| 1059 | sep_re = paragraph_separate_re; | 1059 | sep_re = paragraph_separate_re; |
| 1060 | start_re = paragraph_start_re; | 1060 | start_re = paragraph_start_re; |
| @@ -1073,11 +1073,11 @@ bidi_at_paragraph_end (EMACS_INT charpos, EMACS_INT bytepos) | |||
| 1073 | 1073 | ||
| 1074 | /* Find the beginning of this paragraph by looking back in the buffer. | 1074 | /* Find the beginning of this paragraph by looking back in the buffer. |
| 1075 | Value is the byte position of the paragraph's beginning. */ | 1075 | Value is the byte position of the paragraph's beginning. */ |
| 1076 | static EMACS_INT | 1076 | static ptrdiff_t |
| 1077 | bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte) | 1077 | bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte) |
| 1078 | { | 1078 | { |
| 1079 | Lisp_Object re = paragraph_start_re; | 1079 | Lisp_Object re = paragraph_start_re; |
| 1080 | EMACS_INT limit = ZV, limit_byte = ZV_BYTE; | 1080 | ptrdiff_t limit = ZV, limit_byte = ZV_BYTE; |
| 1081 | 1081 | ||
| 1082 | while (pos_byte > BEGV_BYTE | 1082 | while (pos_byte > BEGV_BYTE |
| 1083 | && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) | 1083 | && fast_looking_at (re, pos, pos_byte, limit, limit_byte, Qnil) < 0) |
| @@ -1110,14 +1110,14 @@ bidi_find_paragraph_start (EMACS_INT pos, EMACS_INT pos_byte) | |||
| 1110 | void | 1110 | void |
| 1111 | bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) | 1111 | bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) |
| 1112 | { | 1112 | { |
| 1113 | EMACS_INT bytepos = bidi_it->bytepos; | 1113 | ptrdiff_t bytepos = bidi_it->bytepos; |
| 1114 | int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring); | 1114 | int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring); |
| 1115 | EMACS_INT pstartbyte; | 1115 | ptrdiff_t pstartbyte; |
| 1116 | /* Note that begbyte is a byte position, while end is a character | 1116 | /* Note that begbyte is a byte position, while end is a character |
| 1117 | position. Yes, this is ugly, but we are trying to avoid costly | 1117 | position. Yes, this is ugly, but we are trying to avoid costly |
| 1118 | calls to BYTE_TO_CHAR and its ilk. */ | 1118 | calls to BYTE_TO_CHAR and its ilk. */ |
| 1119 | EMACS_INT begbyte = string_p ? 0 : BEGV_BYTE; | 1119 | ptrdiff_t begbyte = string_p ? 0 : BEGV_BYTE; |
| 1120 | EMACS_INT end = string_p ? bidi_it->string.schars : ZV; | 1120 | ptrdiff_t end = string_p ? bidi_it->string.schars : ZV; |
| 1121 | 1121 | ||
| 1122 | /* Special case for an empty buffer. */ | 1122 | /* Special case for an empty buffer. */ |
| 1123 | if (bytepos == begbyte && bidi_it->charpos == end) | 1123 | if (bytepos == begbyte && bidi_it->charpos == end) |
| @@ -1139,8 +1139,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) | |||
| 1139 | else if (dir == NEUTRAL_DIR) /* P2 */ | 1139 | else if (dir == NEUTRAL_DIR) /* P2 */ |
| 1140 | { | 1140 | { |
| 1141 | int ch; | 1141 | int ch; |
| 1142 | EMACS_INT ch_len, nchars; | 1142 | ptrdiff_t ch_len, nchars; |
| 1143 | EMACS_INT pos, disp_pos = -1; | 1143 | ptrdiff_t pos, disp_pos = -1; |
| 1144 | int disp_prop = 0; | 1144 | int disp_prop = 0; |
| 1145 | bidi_type_t type; | 1145 | bidi_type_t type; |
| 1146 | const unsigned char *s; | 1146 | const unsigned char *s; |
| @@ -1235,8 +1235,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p) | |||
| 1235 | bidi_it->paragraph_dir = L2R; /* P3 and HL1 */ | 1235 | bidi_it->paragraph_dir = L2R; /* P3 and HL1 */ |
| 1236 | else | 1236 | else |
| 1237 | { | 1237 | { |
| 1238 | EMACS_INT prevpbyte = pstartbyte; | 1238 | ptrdiff_t prevpbyte = pstartbyte; |
| 1239 | EMACS_INT p = BYTE_TO_CHAR (pstartbyte), pbyte = pstartbyte; | 1239 | ptrdiff_t p = BYTE_TO_CHAR (pstartbyte), pbyte = pstartbyte; |
| 1240 | 1240 | ||
| 1241 | /* Find the beginning of the previous paragraph, if any. */ | 1241 | /* Find the beginning of the previous paragraph, if any. */ |
| 1242 | while (pbyte > BEGV_BYTE && prevpbyte >= pstartbyte) | 1242 | while (pbyte > BEGV_BYTE && prevpbyte >= pstartbyte) |
| @@ -1496,7 +1496,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it) | |||
| 1496 | { | 1496 | { |
| 1497 | int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; | 1497 | int prev_level = bidi_it->level_stack[bidi_it->stack_idx].level; |
| 1498 | int new_level = bidi_resolve_explicit_1 (bidi_it); | 1498 | int new_level = bidi_resolve_explicit_1 (bidi_it); |
| 1499 | EMACS_INT eob = bidi_it->string.s ? bidi_it->string.schars : ZV; | 1499 | ptrdiff_t eob = bidi_it->string.s ? bidi_it->string.schars : ZV; |
| 1500 | const unsigned char *s = STRINGP (bidi_it->string.lstring) | 1500 | const unsigned char *s = STRINGP (bidi_it->string.lstring) |
| 1501 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1501 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; |
| 1502 | 1502 | ||
| @@ -1582,7 +1582,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 1582 | int next_char; | 1582 | int next_char; |
| 1583 | bidi_type_t type_of_next; | 1583 | bidi_type_t type_of_next; |
| 1584 | struct bidi_it saved_it; | 1584 | struct bidi_it saved_it; |
| 1585 | EMACS_INT eob = | 1585 | ptrdiff_t eob = |
| 1586 | (STRINGP (bidi_it->string.lstring) || bidi_it->string.s) | 1586 | (STRINGP (bidi_it->string.lstring) || bidi_it->string.s) |
| 1587 | ? bidi_it->string.schars : ZV; | 1587 | ? bidi_it->string.schars : ZV; |
| 1588 | 1588 | ||
| @@ -1707,7 +1707,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) | |||
| 1707 | type = WEAK_EN; | 1707 | type = WEAK_EN; |
| 1708 | else /* W5: ET/BN with EN after it. */ | 1708 | else /* W5: ET/BN with EN after it. */ |
| 1709 | { | 1709 | { |
| 1710 | EMACS_INT en_pos = bidi_it->charpos + bidi_it->nchars; | 1710 | ptrdiff_t en_pos = bidi_it->charpos + bidi_it->nchars; |
| 1711 | const unsigned char *s = | 1711 | const unsigned char *s = |
| 1712 | STRINGP (bidi_it->string.lstring) | 1712 | STRINGP (bidi_it->string.lstring) |
| 1713 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; | 1713 | ? SDATA (bidi_it->string.lstring) : bidi_it->string.s; |
| @@ -1955,11 +1955,11 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 1955 | bidi_type_t type; | 1955 | bidi_type_t type; |
| 1956 | int level, prev_level = -1; | 1956 | int level, prev_level = -1; |
| 1957 | struct bidi_saved_info next_for_neutral; | 1957 | struct bidi_saved_info next_for_neutral; |
| 1958 | EMACS_INT next_char_pos = -2; | 1958 | ptrdiff_t next_char_pos = -2; |
| 1959 | 1959 | ||
| 1960 | if (bidi_it->scan_dir == 1) | 1960 | if (bidi_it->scan_dir == 1) |
| 1961 | { | 1961 | { |
| 1962 | EMACS_INT eob = | 1962 | ptrdiff_t eob = |
| 1963 | (bidi_it->string.s || STRINGP (bidi_it->string.lstring)) | 1963 | (bidi_it->string.s || STRINGP (bidi_it->string.lstring)) |
| 1964 | ? bidi_it->string.schars : ZV; | 1964 | ? bidi_it->string.schars : ZV; |
| 1965 | 1965 | ||
| @@ -2086,11 +2086,11 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) | |||
| 2086 | && bidi_it->next_for_ws.type == UNKNOWN_BT) | 2086 | && bidi_it->next_for_ws.type == UNKNOWN_BT) |
| 2087 | { | 2087 | { |
| 2088 | int ch; | 2088 | int ch; |
| 2089 | EMACS_INT clen = bidi_it->ch_len; | 2089 | ptrdiff_t clen = bidi_it->ch_len; |
| 2090 | EMACS_INT bpos = bidi_it->bytepos; | 2090 | ptrdiff_t bpos = bidi_it->bytepos; |
| 2091 | EMACS_INT cpos = bidi_it->charpos; | 2091 | ptrdiff_t cpos = bidi_it->charpos; |
| 2092 | EMACS_INT disp_pos = bidi_it->disp_pos; | 2092 | ptrdiff_t disp_pos = bidi_it->disp_pos; |
| 2093 | EMACS_INT nc = bidi_it->nchars; | 2093 | ptrdiff_t nc = bidi_it->nchars; |
| 2094 | struct bidi_string_data bs = bidi_it->string; | 2094 | struct bidi_string_data bs = bidi_it->string; |
| 2095 | bidi_type_t chtype; | 2095 | bidi_type_t chtype; |
| 2096 | int fwp = bidi_it->frame_window_p; | 2096 | int fwp = bidi_it->frame_window_p; |
| @@ -2331,7 +2331,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) | |||
| 2331 | bidi_it->separator_limit = bidi_it->string.schars; | 2331 | bidi_it->separator_limit = bidi_it->string.schars; |
| 2332 | else if (bidi_it->bytepos < ZV_BYTE) | 2332 | else if (bidi_it->bytepos < ZV_BYTE) |
| 2333 | { | 2333 | { |
| 2334 | EMACS_INT sep_len = | 2334 | ptrdiff_t sep_len = |
| 2335 | bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, | 2335 | bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, |
| 2336 | bidi_it->bytepos + bidi_it->ch_len); | 2336 | bidi_it->bytepos + bidi_it->ch_len); |
| 2337 | if (bidi_it->nchars <= 0) | 2337 | if (bidi_it->nchars <= 0) |
diff --git a/src/buffer.c b/src/buffer.c index 37d2975c8c7..564dab689cd 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -155,7 +155,7 @@ Lisp_Object Qinsert_behind_hooks; | |||
| 155 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); | 155 | static void alloc_buffer_text (struct buffer *, ptrdiff_t); |
| 156 | static void free_buffer_text (struct buffer *b); | 156 | static void free_buffer_text (struct buffer *b); |
| 157 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); | 157 | static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *); |
| 158 | static void modify_overlay (struct buffer *, EMACS_INT, EMACS_INT); | 158 | static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 159 | static Lisp_Object buffer_lisp_local_variables (struct buffer *); | 159 | static Lisp_Object buffer_lisp_local_variables (struct buffer *); |
| 160 | 160 | ||
| 161 | /* For debugging; temporary. See set_buffer_internal. */ | 161 | /* For debugging; temporary. See set_buffer_internal. */ |
| @@ -423,7 +423,7 @@ copy_overlays (struct buffer *b, struct Lisp_Overlay *list) | |||
| 423 | for (; list; list = list->next) | 423 | for (; list; list = list->next) |
| 424 | { | 424 | { |
| 425 | Lisp_Object overlay, start, end, old_overlay; | 425 | Lisp_Object overlay, start, end, old_overlay; |
| 426 | EMACS_INT charpos; | 426 | ptrdiff_t charpos; |
| 427 | 427 | ||
| 428 | XSETMISC (old_overlay, list); | 428 | XSETMISC (old_overlay, list); |
| 429 | charpos = marker_position (OVERLAY_START (old_overlay)); | 429 | charpos = marker_position (OVERLAY_START (old_overlay)); |
| @@ -724,7 +724,7 @@ reset_buffer (register struct buffer *b) | |||
| 724 | b->prevent_redisplay_optimizations_p = 1; | 724 | b->prevent_redisplay_optimizations_p = 1; |
| 725 | BVAR (b, backed_up) = Qnil; | 725 | BVAR (b, backed_up) = Qnil; |
| 726 | BUF_AUTOSAVE_MODIFF (b) = 0; | 726 | BUF_AUTOSAVE_MODIFF (b) = 0; |
| 727 | b->auto_save_failure_time = -1; | 727 | b->auto_save_failure_time = 0; |
| 728 | BVAR (b, auto_save_file_name) = Qnil; | 728 | BVAR (b, auto_save_file_name) = Qnil; |
| 729 | BVAR (b, read_only) = Qnil; | 729 | BVAR (b, read_only) = Qnil; |
| 730 | b->overlays_before = NULL; | 730 | b->overlays_before = NULL; |
| @@ -858,8 +858,8 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) | |||
| 858 | (register Lisp_Object name, Lisp_Object ignore) | 858 | (register Lisp_Object name, Lisp_Object ignore) |
| 859 | { | 859 | { |
| 860 | register Lisp_Object gentemp, tem; | 860 | register Lisp_Object gentemp, tem; |
| 861 | EMACS_INT count; | 861 | ptrdiff_t count; |
| 862 | char number[INT_BUFSIZE_BOUND (EMACS_INT) + sizeof "<>"]; | 862 | char number[INT_BUFSIZE_BOUND (ptrdiff_t) + sizeof "<>"]; |
| 863 | 863 | ||
| 864 | CHECK_STRING (name); | 864 | CHECK_STRING (name); |
| 865 | 865 | ||
| @@ -873,7 +873,7 @@ it is in the sequence to be tried) even if a buffer with that name exists. */) | |||
| 873 | count = 1; | 873 | count = 1; |
| 874 | while (1) | 874 | while (1) |
| 875 | { | 875 | { |
| 876 | sprintf (number, "<%"pI"d>", ++count); | 876 | sprintf (number, "<%"pD"d>", ++count); |
| 877 | gentemp = concat2 (name, build_string (number)); | 877 | gentemp = concat2 (name, build_string (number)); |
| 878 | tem = Fstring_equal (gentemp, ignore); | 878 | tem = Fstring_equal (gentemp, ignore); |
| 879 | if (!NILP (tem)) | 879 | if (!NILP (tem)) |
| @@ -1475,7 +1475,7 @@ with SIGHUP. */) | |||
| 1475 | 1475 | ||
| 1476 | /* Run hooks with the buffer to be killed the current buffer. */ | 1476 | /* Run hooks with the buffer to be killed the current buffer. */ |
| 1477 | { | 1477 | { |
| 1478 | int count = SPECPDL_INDEX (); | 1478 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1479 | Lisp_Object arglist[1]; | 1479 | Lisp_Object arglist[1]; |
| 1480 | 1480 | ||
| 1481 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1481 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| @@ -1746,7 +1746,7 @@ Use this function before selecting the buffer, since it may need to inspect | |||
| 1746 | the current buffer's major mode. */) | 1746 | the current buffer's major mode. */) |
| 1747 | (Lisp_Object buffer) | 1747 | (Lisp_Object buffer) |
| 1748 | { | 1748 | { |
| 1749 | int count; | 1749 | ptrdiff_t count; |
| 1750 | Lisp_Object function; | 1750 | Lisp_Object function; |
| 1751 | 1751 | ||
| 1752 | CHECK_BUFFER (buffer); | 1752 | CHECK_BUFFER (buffer); |
| @@ -1958,16 +1958,15 @@ validate_region (register Lisp_Object *b, register Lisp_Object *e) | |||
| 1958 | tem = *b; *b = *e; *e = tem; | 1958 | tem = *b; *b = *e; *e = tem; |
| 1959 | } | 1959 | } |
| 1960 | 1960 | ||
| 1961 | if (!(BEGV <= XINT (*b) && XINT (*b) <= XINT (*e) | 1961 | if (! (BEGV <= XINT (*b) && XINT (*e) <= ZV)) |
| 1962 | && XINT (*e) <= ZV)) | ||
| 1963 | args_out_of_range (*b, *e); | 1962 | args_out_of_range (*b, *e); |
| 1964 | } | 1963 | } |
| 1965 | 1964 | ||
| 1966 | /* Advance BYTE_POS up to a character boundary | 1965 | /* Advance BYTE_POS up to a character boundary |
| 1967 | and return the adjusted position. */ | 1966 | and return the adjusted position. */ |
| 1968 | 1967 | ||
| 1969 | static EMACS_INT | 1968 | static ptrdiff_t |
| 1970 | advance_to_char_boundary (EMACS_INT byte_pos) | 1969 | advance_to_char_boundary (ptrdiff_t byte_pos) |
| 1971 | { | 1970 | { |
| 1972 | int c; | 1971 | int c; |
| 1973 | 1972 | ||
| @@ -1980,7 +1979,7 @@ advance_to_char_boundary (EMACS_INT byte_pos) | |||
| 1980 | { | 1979 | { |
| 1981 | /* We should advance BYTE_POS only when C is a constituent of a | 1980 | /* We should advance BYTE_POS only when C is a constituent of a |
| 1982 | multibyte sequence. */ | 1981 | multibyte sequence. */ |
| 1983 | EMACS_INT orig_byte_pos = byte_pos; | 1982 | ptrdiff_t orig_byte_pos = byte_pos; |
| 1984 | 1983 | ||
| 1985 | do | 1984 | do |
| 1986 | { | 1985 | { |
| @@ -2056,12 +2055,12 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2056 | (POINTER_TYPE **) ¤t_buffer->own_text.beg); | 2055 | (POINTER_TYPE **) ¤t_buffer->own_text.beg); |
| 2057 | #endif /* REL_ALLOC */ | 2056 | #endif /* REL_ALLOC */ |
| 2058 | 2057 | ||
| 2059 | swapfield (pt, EMACS_INT); | 2058 | swapfield (pt, ptrdiff_t); |
| 2060 | swapfield (pt_byte, EMACS_INT); | 2059 | swapfield (pt_byte, ptrdiff_t); |
| 2061 | swapfield (begv, EMACS_INT); | 2060 | swapfield (begv, ptrdiff_t); |
| 2062 | swapfield (begv_byte, EMACS_INT); | 2061 | swapfield (begv_byte, ptrdiff_t); |
| 2063 | swapfield (zv, EMACS_INT); | 2062 | swapfield (zv, ptrdiff_t); |
| 2064 | swapfield (zv_byte, EMACS_INT); | 2063 | swapfield (zv_byte, ptrdiff_t); |
| 2065 | eassert (!current_buffer->base_buffer); | 2064 | eassert (!current_buffer->base_buffer); |
| 2066 | eassert (!other_buffer->base_buffer); | 2065 | eassert (!other_buffer->base_buffer); |
| 2067 | current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; | 2066 | current_buffer->clip_changed = 1; other_buffer->clip_changed = 1; |
| @@ -2071,7 +2070,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2071 | other_buffer->prevent_redisplay_optimizations_p = 1; | 2070 | other_buffer->prevent_redisplay_optimizations_p = 1; |
| 2072 | swapfield (overlays_before, struct Lisp_Overlay *); | 2071 | swapfield (overlays_before, struct Lisp_Overlay *); |
| 2073 | swapfield (overlays_after, struct Lisp_Overlay *); | 2072 | swapfield (overlays_after, struct Lisp_Overlay *); |
| 2074 | swapfield (overlay_center, EMACS_INT); | 2073 | swapfield (overlay_center, ptrdiff_t); |
| 2075 | swapfield_ (undo_list, Lisp_Object); | 2074 | swapfield_ (undo_list, Lisp_Object); |
| 2076 | swapfield_ (mark, Lisp_Object); | 2075 | swapfield_ (mark, Lisp_Object); |
| 2077 | swapfield_ (enable_multibyte_characters, Lisp_Object); | 2076 | swapfield_ (enable_multibyte_characters, Lisp_Object); |
| @@ -2154,7 +2153,7 @@ current buffer is cleared. */) | |||
| 2154 | { | 2153 | { |
| 2155 | struct Lisp_Marker *tail, *markers; | 2154 | struct Lisp_Marker *tail, *markers; |
| 2156 | struct buffer *other; | 2155 | struct buffer *other; |
| 2157 | EMACS_INT begv, zv; | 2156 | ptrdiff_t begv, zv; |
| 2158 | int narrowed = (BEG != BEGV || Z != ZV); | 2157 | int narrowed = (BEG != BEGV || Z != ZV); |
| 2159 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); | 2158 | int modified_p = !NILP (Fbuffer_modified_p (Qnil)); |
| 2160 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); | 2159 | Lisp_Object old_undo = BVAR (current_buffer, undo_list); |
| @@ -2186,7 +2185,7 @@ current buffer is cleared. */) | |||
| 2186 | 2185 | ||
| 2187 | if (NILP (flag)) | 2186 | if (NILP (flag)) |
| 2188 | { | 2187 | { |
| 2189 | EMACS_INT pos, stop; | 2188 | ptrdiff_t pos, stop; |
| 2190 | unsigned char *p; | 2189 | unsigned char *p; |
| 2191 | 2190 | ||
| 2192 | /* Do this first, so it can use CHAR_TO_BYTE | 2191 | /* Do this first, so it can use CHAR_TO_BYTE |
| @@ -2250,8 +2249,8 @@ current buffer is cleared. */) | |||
| 2250 | } | 2249 | } |
| 2251 | else | 2250 | else |
| 2252 | { | 2251 | { |
| 2253 | EMACS_INT pt = PT; | 2252 | ptrdiff_t pt = PT; |
| 2254 | EMACS_INT pos, stop; | 2253 | ptrdiff_t pos, stop; |
| 2255 | unsigned char *p, *pend; | 2254 | unsigned char *p, *pend; |
| 2256 | 2255 | ||
| 2257 | /* Be sure not to have a multibyte sequence striding over the GAP. | 2256 | /* Be sure not to have a multibyte sequence striding over the GAP. |
| @@ -2267,7 +2266,7 @@ current buffer is cleared. */) | |||
| 2267 | while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; | 2266 | while (! CHAR_HEAD_P (*q) && q > BEG_ADDR) q--; |
| 2268 | if (LEADING_CODE_P (*q)) | 2267 | if (LEADING_CODE_P (*q)) |
| 2269 | { | 2268 | { |
| 2270 | EMACS_INT new_gpt = GPT_BYTE - (GPT_ADDR - q); | 2269 | ptrdiff_t new_gpt = GPT_BYTE - (GPT_ADDR - q); |
| 2271 | 2270 | ||
| 2272 | move_gap_both (new_gpt, new_gpt); | 2271 | move_gap_both (new_gpt, new_gpt); |
| 2273 | } | 2272 | } |
| @@ -2351,8 +2350,8 @@ current buffer is cleared. */) | |||
| 2351 | ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; | 2350 | ZV = chars_in_text (BEG_ADDR, ZV_BYTE - BEG_BYTE) + BEG; |
| 2352 | 2351 | ||
| 2353 | { | 2352 | { |
| 2354 | EMACS_INT byte = advance_to_char_boundary (PT_BYTE); | 2353 | ptrdiff_t byte = advance_to_char_boundary (PT_BYTE); |
| 2355 | EMACS_INT position; | 2354 | ptrdiff_t position; |
| 2356 | 2355 | ||
| 2357 | if (byte > GPT_BYTE) | 2356 | if (byte > GPT_BYTE) |
| 2358 | position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; | 2357 | position = chars_in_text (GAP_END_ADDR, byte - GPT_BYTE) + GPT; |
| @@ -2516,20 +2515,20 @@ swap_out_buffer_local_variables (struct buffer *b) | |||
| 2516 | ptrdiff_t | 2515 | ptrdiff_t |
| 2517 | overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | 2516 | overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, |
| 2518 | ptrdiff_t *len_ptr, | 2517 | ptrdiff_t *len_ptr, |
| 2519 | EMACS_INT *next_ptr, EMACS_INT *prev_ptr, int change_req) | 2518 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, int change_req) |
| 2520 | { | 2519 | { |
| 2521 | Lisp_Object overlay, start, end; | 2520 | Lisp_Object overlay, start, end; |
| 2522 | struct Lisp_Overlay *tail; | 2521 | struct Lisp_Overlay *tail; |
| 2523 | ptrdiff_t idx = 0; | 2522 | ptrdiff_t idx = 0; |
| 2524 | ptrdiff_t len = *len_ptr; | 2523 | ptrdiff_t len = *len_ptr; |
| 2525 | Lisp_Object *vec = *vec_ptr; | 2524 | Lisp_Object *vec = *vec_ptr; |
| 2526 | EMACS_INT next = ZV; | 2525 | ptrdiff_t next = ZV; |
| 2527 | EMACS_INT prev = BEGV; | 2526 | ptrdiff_t prev = BEGV; |
| 2528 | int inhibit_storing = 0; | 2527 | int inhibit_storing = 0; |
| 2529 | 2528 | ||
| 2530 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2529 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2531 | { | 2530 | { |
| 2532 | EMACS_INT startpos, endpos; | 2531 | ptrdiff_t startpos, endpos; |
| 2533 | 2532 | ||
| 2534 | XSETMISC (overlay, tail); | 2533 | XSETMISC (overlay, tail); |
| 2535 | 2534 | ||
| @@ -2577,7 +2576,7 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | |||
| 2577 | 2576 | ||
| 2578 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 2577 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 2579 | { | 2578 | { |
| 2580 | EMACS_INT startpos, endpos; | 2579 | ptrdiff_t startpos, endpos; |
| 2581 | 2580 | ||
| 2582 | XSETMISC (overlay, tail); | 2581 | XSETMISC (overlay, tail); |
| 2583 | 2582 | ||
| @@ -2650,21 +2649,21 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | |||
| 2650 | static ptrdiff_t | 2649 | static ptrdiff_t |
| 2651 | overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | 2650 | overlays_in (EMACS_INT beg, EMACS_INT end, int extend, |
| 2652 | Lisp_Object **vec_ptr, ptrdiff_t *len_ptr, | 2651 | Lisp_Object **vec_ptr, ptrdiff_t *len_ptr, |
| 2653 | EMACS_INT *next_ptr, EMACS_INT *prev_ptr) | 2652 | ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr) |
| 2654 | { | 2653 | { |
| 2655 | Lisp_Object overlay, ostart, oend; | 2654 | Lisp_Object overlay, ostart, oend; |
| 2656 | struct Lisp_Overlay *tail; | 2655 | struct Lisp_Overlay *tail; |
| 2657 | ptrdiff_t idx = 0; | 2656 | ptrdiff_t idx = 0; |
| 2658 | ptrdiff_t len = *len_ptr; | 2657 | ptrdiff_t len = *len_ptr; |
| 2659 | Lisp_Object *vec = *vec_ptr; | 2658 | Lisp_Object *vec = *vec_ptr; |
| 2660 | EMACS_INT next = ZV; | 2659 | ptrdiff_t next = ZV; |
| 2661 | EMACS_INT prev = BEGV; | 2660 | ptrdiff_t prev = BEGV; |
| 2662 | int inhibit_storing = 0; | 2661 | int inhibit_storing = 0; |
| 2663 | int end_is_Z = end == Z; | 2662 | int end_is_Z = end == Z; |
| 2664 | 2663 | ||
| 2665 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2664 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2666 | { | 2665 | { |
| 2667 | EMACS_INT startpos, endpos; | 2666 | ptrdiff_t startpos, endpos; |
| 2668 | 2667 | ||
| 2669 | XSETMISC (overlay, tail); | 2668 | XSETMISC (overlay, tail); |
| 2670 | 2669 | ||
| @@ -2711,7 +2710,7 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | |||
| 2711 | 2710 | ||
| 2712 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 2711 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 2713 | { | 2712 | { |
| 2714 | EMACS_INT startpos, endpos; | 2713 | ptrdiff_t startpos, endpos; |
| 2715 | 2714 | ||
| 2716 | XSETMISC (overlay, tail); | 2715 | XSETMISC (overlay, tail); |
| 2717 | 2716 | ||
| @@ -2767,8 +2766,8 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend, | |||
| 2767 | int | 2766 | int |
| 2768 | mouse_face_overlay_overlaps (Lisp_Object overlay) | 2767 | mouse_face_overlay_overlaps (Lisp_Object overlay) |
| 2769 | { | 2768 | { |
| 2770 | EMACS_INT start = OVERLAY_POSITION (OVERLAY_START (overlay)); | 2769 | ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 2771 | EMACS_INT end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 2770 | ptrdiff_t end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 2772 | ptrdiff_t n, i, size; | 2771 | ptrdiff_t n, i, size; |
| 2773 | Lisp_Object *v, tem; | 2772 | Lisp_Object *v, tem; |
| 2774 | 2773 | ||
| @@ -2794,14 +2793,14 @@ mouse_face_overlay_overlaps (Lisp_Object overlay) | |||
| 2794 | 2793 | ||
| 2795 | /* Fast function to just test if we're at an overlay boundary. */ | 2794 | /* Fast function to just test if we're at an overlay boundary. */ |
| 2796 | int | 2795 | int |
| 2797 | overlay_touches_p (EMACS_INT pos) | 2796 | overlay_touches_p (ptrdiff_t pos) |
| 2798 | { | 2797 | { |
| 2799 | Lisp_Object overlay; | 2798 | Lisp_Object overlay; |
| 2800 | struct Lisp_Overlay *tail; | 2799 | struct Lisp_Overlay *tail; |
| 2801 | 2800 | ||
| 2802 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 2801 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 2803 | { | 2802 | { |
| 2804 | EMACS_INT endpos; | 2803 | ptrdiff_t endpos; |
| 2805 | 2804 | ||
| 2806 | XSETMISC (overlay ,tail); | 2805 | XSETMISC (overlay ,tail); |
| 2807 | if (!OVERLAYP (overlay)) | 2806 | if (!OVERLAYP (overlay)) |
| @@ -2816,7 +2815,7 @@ overlay_touches_p (EMACS_INT pos) | |||
| 2816 | 2815 | ||
| 2817 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 2816 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 2818 | { | 2817 | { |
| 2819 | EMACS_INT startpos; | 2818 | ptrdiff_t startpos; |
| 2820 | 2819 | ||
| 2821 | XSETMISC (overlay, tail); | 2820 | XSETMISC (overlay, tail); |
| 2822 | if (!OVERLAYP (overlay)) | 2821 | if (!OVERLAYP (overlay)) |
| @@ -2834,7 +2833,7 @@ overlay_touches_p (EMACS_INT pos) | |||
| 2834 | struct sortvec | 2833 | struct sortvec |
| 2835 | { | 2834 | { |
| 2836 | Lisp_Object overlay; | 2835 | Lisp_Object overlay; |
| 2837 | EMACS_INT beg, end; | 2836 | ptrdiff_t beg, end; |
| 2838 | EMACS_INT priority; | 2837 | EMACS_INT priority; |
| 2839 | }; | 2838 | }; |
| 2840 | 2839 | ||
| @@ -2951,7 +2950,7 @@ static void | |||
| 2951 | record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, | 2950 | record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, |
| 2952 | Lisp_Object str2, Lisp_Object pri, ptrdiff_t size) | 2951 | Lisp_Object str2, Lisp_Object pri, ptrdiff_t size) |
| 2953 | { | 2952 | { |
| 2954 | EMACS_INT nbytes; | 2953 | ptrdiff_t nbytes; |
| 2955 | 2954 | ||
| 2956 | if (ssl->used == ssl->size) | 2955 | if (ssl->used == ssl->size) |
| 2957 | ssl->buf = xpalloc (ssl->buf, &ssl->size, 5, -1, sizeof *ssl->buf); | 2956 | ssl->buf = xpalloc (ssl->buf, &ssl->size, 5, -1, sizeof *ssl->buf); |
| @@ -3001,12 +3000,12 @@ record_overlay_string (struct sortstrlist *ssl, Lisp_Object str, | |||
| 3001 | PSTR, if that variable is non-null. The string may be overwritten by | 3000 | PSTR, if that variable is non-null. The string may be overwritten by |
| 3002 | subsequent calls. */ | 3001 | subsequent calls. */ |
| 3003 | 3002 | ||
| 3004 | EMACS_INT | 3003 | ptrdiff_t |
| 3005 | overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | 3004 | overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) |
| 3006 | { | 3005 | { |
| 3007 | Lisp_Object overlay, window, str; | 3006 | Lisp_Object overlay, window, str; |
| 3008 | struct Lisp_Overlay *ov; | 3007 | struct Lisp_Overlay *ov; |
| 3009 | EMACS_INT startpos, endpos; | 3008 | ptrdiff_t startpos, endpos; |
| 3010 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3009 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3011 | 3010 | ||
| 3012 | overlay_heads.used = overlay_heads.bytes = 0; | 3011 | overlay_heads.used = overlay_heads.bytes = 0; |
| @@ -3076,7 +3075,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3076 | if (overlay_heads.bytes || overlay_tails.bytes) | 3075 | if (overlay_heads.bytes || overlay_tails.bytes) |
| 3077 | { | 3076 | { |
| 3078 | Lisp_Object tem; | 3077 | Lisp_Object tem; |
| 3079 | EMACS_INT i; | 3078 | ptrdiff_t i; |
| 3080 | unsigned char *p; | 3079 | unsigned char *p; |
| 3081 | ptrdiff_t total; | 3080 | ptrdiff_t total; |
| 3082 | 3081 | ||
| @@ -3090,7 +3089,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3090 | p = overlay_str_buf; | 3089 | p = overlay_str_buf; |
| 3091 | for (i = overlay_tails.used; --i >= 0;) | 3090 | for (i = overlay_tails.used; --i >= 0;) |
| 3092 | { | 3091 | { |
| 3093 | EMACS_INT nbytes; | 3092 | ptrdiff_t nbytes; |
| 3094 | tem = overlay_tails.buf[i].string; | 3093 | tem = overlay_tails.buf[i].string; |
| 3095 | nbytes = copy_text (SDATA (tem), p, | 3094 | nbytes = copy_text (SDATA (tem), p, |
| 3096 | SBYTES (tem), | 3095 | SBYTES (tem), |
| @@ -3099,7 +3098,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3099 | } | 3098 | } |
| 3100 | for (i = 0; i < overlay_heads.used; ++i) | 3099 | for (i = 0; i < overlay_heads.used; ++i) |
| 3101 | { | 3100 | { |
| 3102 | EMACS_INT nbytes; | 3101 | ptrdiff_t nbytes; |
| 3103 | tem = overlay_heads.buf[i].string; | 3102 | tem = overlay_heads.buf[i].string; |
| 3104 | nbytes = copy_text (SDATA (tem), p, | 3103 | nbytes = copy_text (SDATA (tem), p, |
| 3105 | SBYTES (tem), | 3104 | SBYTES (tem), |
| @@ -3126,7 +3125,7 @@ overlay_strings (EMACS_INT pos, struct window *w, unsigned char **pstr) | |||
| 3126 | /* Shift overlays in BUF's overlay lists, to center the lists at POS. */ | 3125 | /* Shift overlays in BUF's overlay lists, to center the lists at POS. */ |
| 3127 | 3126 | ||
| 3128 | void | 3127 | void |
| 3129 | recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | 3128 | recenter_overlay_lists (struct buffer *buf, ptrdiff_t pos) |
| 3130 | { | 3129 | { |
| 3131 | Lisp_Object overlay, beg, end; | 3130 | Lisp_Object overlay, beg, end; |
| 3132 | struct Lisp_Overlay *prev, *tail, *next; | 3131 | struct Lisp_Overlay *prev, *tail, *next; |
| @@ -3164,7 +3163,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | |||
| 3164 | if (OVERLAY_POSITION (end) > pos) | 3163 | if (OVERLAY_POSITION (end) > pos) |
| 3165 | { | 3164 | { |
| 3166 | /* OVERLAY needs to be moved. */ | 3165 | /* OVERLAY needs to be moved. */ |
| 3167 | EMACS_INT where = OVERLAY_POSITION (beg); | 3166 | ptrdiff_t where = OVERLAY_POSITION (beg); |
| 3168 | struct Lisp_Overlay *other, *other_prev; | 3167 | struct Lisp_Overlay *other, *other_prev; |
| 3169 | 3168 | ||
| 3170 | /* Splice the cons cell TAIL out of overlays_before. */ | 3169 | /* Splice the cons cell TAIL out of overlays_before. */ |
| @@ -3237,7 +3236,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | |||
| 3237 | if (OVERLAY_POSITION (end) <= pos) | 3236 | if (OVERLAY_POSITION (end) <= pos) |
| 3238 | { | 3237 | { |
| 3239 | /* OVERLAY needs to be moved. */ | 3238 | /* OVERLAY needs to be moved. */ |
| 3240 | EMACS_INT where = OVERLAY_POSITION (end); | 3239 | ptrdiff_t where = OVERLAY_POSITION (end); |
| 3241 | struct Lisp_Overlay *other, *other_prev; | 3240 | struct Lisp_Overlay *other, *other_prev; |
| 3242 | 3241 | ||
| 3243 | /* Splice the cons cell TAIL out of overlays_after. */ | 3242 | /* Splice the cons cell TAIL out of overlays_after. */ |
| @@ -3275,7 +3274,7 @@ recenter_overlay_lists (struct buffer *buf, EMACS_INT pos) | |||
| 3275 | } | 3274 | } |
| 3276 | 3275 | ||
| 3277 | void | 3276 | void |
| 3278 | adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length) | 3277 | adjust_overlays_for_insert (ptrdiff_t pos, ptrdiff_t length) |
| 3279 | { | 3278 | { |
| 3280 | /* After an insertion, the lists are still sorted properly, | 3279 | /* After an insertion, the lists are still sorted properly, |
| 3281 | but we may need to update the value of the overlay center. */ | 3280 | but we may need to update the value of the overlay center. */ |
| @@ -3284,13 +3283,13 @@ adjust_overlays_for_insert (EMACS_INT pos, EMACS_INT length) | |||
| 3284 | } | 3283 | } |
| 3285 | 3284 | ||
| 3286 | void | 3285 | void |
| 3287 | adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length) | 3286 | adjust_overlays_for_delete (ptrdiff_t pos, ptrdiff_t length) |
| 3288 | { | 3287 | { |
| 3289 | if (current_buffer->overlay_center < pos) | 3288 | if (current_buffer->overlay_center < pos) |
| 3290 | /* The deletion was to our right. No change needed; the before- and | 3289 | /* The deletion was to our right. No change needed; the before- and |
| 3291 | after-lists are still consistent. */ | 3290 | after-lists are still consistent. */ |
| 3292 | ; | 3291 | ; |
| 3293 | else if (current_buffer->overlay_center > pos + length) | 3292 | else if (current_buffer->overlay_center - pos > length) |
| 3294 | /* The deletion was to our left. We need to adjust the center value | 3293 | /* The deletion was to our left. We need to adjust the center value |
| 3295 | to account for the change in position, but the lists are consistent | 3294 | to account for the change in position, but the lists are consistent |
| 3296 | given the new value. */ | 3295 | given the new value. */ |
| @@ -3309,7 +3308,7 @@ adjust_overlays_for_delete (EMACS_INT pos, EMACS_INT length) | |||
| 3309 | Such an overlay might even have negative size at this point. | 3308 | Such an overlay might even have negative size at this point. |
| 3310 | If so, we'll make the overlay empty. */ | 3309 | If so, we'll make the overlay empty. */ |
| 3311 | void | 3310 | void |
| 3312 | fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | 3311 | fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end) |
| 3313 | { | 3312 | { |
| 3314 | Lisp_Object overlay; | 3313 | Lisp_Object overlay; |
| 3315 | struct Lisp_Overlay *before_list IF_LINT (= NULL); | 3314 | struct Lisp_Overlay *before_list IF_LINT (= NULL); |
| @@ -3322,7 +3321,7 @@ fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | |||
| 3322 | current_buffer->overlays_before or overlays_after, depending | 3321 | current_buffer->overlays_before or overlays_after, depending |
| 3323 | which loop we're in. */ | 3322 | which loop we're in. */ |
| 3324 | struct Lisp_Overlay *tail, *parent; | 3323 | struct Lisp_Overlay *tail, *parent; |
| 3325 | EMACS_INT startpos, endpos; | 3324 | ptrdiff_t startpos, endpos; |
| 3326 | 3325 | ||
| 3327 | /* This algorithm shifts links around instead of consing and GCing. | 3326 | /* This algorithm shifts links around instead of consing and GCing. |
| 3328 | The loop invariant is that before_list (resp. after_list) is a | 3327 | The loop invariant is that before_list (resp. after_list) is a |
| @@ -3456,12 +3455,12 @@ fix_start_end_in_overlays (register EMACS_INT start, register EMACS_INT end) | |||
| 3456 | was at PREV, and now is at POS. */ | 3455 | was at PREV, and now is at POS. */ |
| 3457 | 3456 | ||
| 3458 | void | 3457 | void |
| 3459 | fix_overlays_before (struct buffer *bp, EMACS_INT prev, EMACS_INT pos) | 3458 | fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos) |
| 3460 | { | 3459 | { |
| 3461 | /* If parent is nil, replace overlays_before; otherwise, parent->next. */ | 3460 | /* If parent is nil, replace overlays_before; otherwise, parent->next. */ |
| 3462 | struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; | 3461 | struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair; |
| 3463 | Lisp_Object tem; | 3462 | Lisp_Object tem; |
| 3464 | EMACS_INT end IF_LINT (= 0); | 3463 | ptrdiff_t end IF_LINT (= 0); |
| 3465 | 3464 | ||
| 3466 | /* After the insertion, the several overlays may be in incorrect | 3465 | /* After the insertion, the several overlays may be in incorrect |
| 3467 | order. The possibility is that, in the list `overlays_before', | 3466 | order. The possibility is that, in the list `overlays_before', |
| @@ -3619,11 +3618,11 @@ for the rear of the overlay advance when text is inserted there | |||
| 3619 | /* Mark a section of BUF as needing redisplay because of overlays changes. */ | 3618 | /* Mark a section of BUF as needing redisplay because of overlays changes. */ |
| 3620 | 3619 | ||
| 3621 | static void | 3620 | static void |
| 3622 | modify_overlay (struct buffer *buf, EMACS_INT start, EMACS_INT end) | 3621 | modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) |
| 3623 | { | 3622 | { |
| 3624 | if (start > end) | 3623 | if (start > end) |
| 3625 | { | 3624 | { |
| 3626 | EMACS_INT temp = start; | 3625 | ptrdiff_t temp = start; |
| 3627 | start = end; | 3626 | start = end; |
| 3628 | end = temp; | 3627 | end = temp; |
| 3629 | } | 3628 | } |
| @@ -3672,7 +3671,7 @@ buffer. */) | |||
| 3672 | { | 3671 | { |
| 3673 | struct buffer *b, *ob; | 3672 | struct buffer *b, *ob; |
| 3674 | Lisp_Object obuffer; | 3673 | Lisp_Object obuffer; |
| 3675 | int count = SPECPDL_INDEX (); | 3674 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3676 | 3675 | ||
| 3677 | CHECK_OVERLAY (overlay); | 3676 | CHECK_OVERLAY (overlay); |
| 3678 | if (NILP (buffer)) | 3677 | if (NILP (buffer)) |
| @@ -3691,19 +3690,22 @@ buffer. */) | |||
| 3691 | CHECK_NUMBER_COERCE_MARKER (beg); | 3690 | CHECK_NUMBER_COERCE_MARKER (beg); |
| 3692 | CHECK_NUMBER_COERCE_MARKER (end); | 3691 | CHECK_NUMBER_COERCE_MARKER (end); |
| 3693 | 3692 | ||
| 3694 | if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate))) | ||
| 3695 | return Fdelete_overlay (overlay); | ||
| 3696 | |||
| 3697 | if (XINT (beg) > XINT (end)) | 3693 | if (XINT (beg) > XINT (end)) |
| 3698 | { | 3694 | { |
| 3699 | Lisp_Object temp; | 3695 | Lisp_Object temp; |
| 3700 | temp = beg; beg = end; end = temp; | 3696 | temp = beg; beg = end; end = temp; |
| 3701 | } | 3697 | } |
| 3702 | 3698 | ||
| 3699 | b = XBUFFER (buffer); | ||
| 3700 | if (! (BUF_BEGV (b) <= XINT (beg) && XINT (end) <= BUF_ZV (b))) | ||
| 3701 | args_out_of_range (beg, end); | ||
| 3702 | |||
| 3703 | if (XINT (beg) == XINT (end) && ! NILP (Foverlay_get (overlay, Qevaporate))) | ||
| 3704 | return Fdelete_overlay (overlay); | ||
| 3705 | |||
| 3703 | specbind (Qinhibit_quit, Qt); | 3706 | specbind (Qinhibit_quit, Qt); |
| 3704 | 3707 | ||
| 3705 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); | 3708 | obuffer = Fmarker_buffer (OVERLAY_START (overlay)); |
| 3706 | b = XBUFFER (buffer); | ||
| 3707 | ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; | 3709 | ob = BUFFERP (obuffer) ? XBUFFER (obuffer) : (struct buffer *) 0; |
| 3708 | 3710 | ||
| 3709 | /* If the overlay has changed buffers, do a thorough redisplay. */ | 3711 | /* If the overlay has changed buffers, do a thorough redisplay. */ |
| @@ -3712,8 +3714,8 @@ buffer. */) | |||
| 3712 | /* Redisplay where the overlay was. */ | 3714 | /* Redisplay where the overlay was. */ |
| 3713 | if (!NILP (obuffer)) | 3715 | if (!NILP (obuffer)) |
| 3714 | { | 3716 | { |
| 3715 | EMACS_INT o_beg; | 3717 | ptrdiff_t o_beg; |
| 3716 | EMACS_INT o_end; | 3718 | ptrdiff_t o_end; |
| 3717 | 3719 | ||
| 3718 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3720 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 3719 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3721 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| @@ -3727,7 +3729,7 @@ buffer. */) | |||
| 3727 | else | 3729 | else |
| 3728 | /* Redisplay the area the overlay has just left, or just enclosed. */ | 3730 | /* Redisplay the area the overlay has just left, or just enclosed. */ |
| 3729 | { | 3731 | { |
| 3730 | EMACS_INT o_beg, o_end; | 3732 | ptrdiff_t o_beg, o_end; |
| 3731 | 3733 | ||
| 3732 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); | 3734 | o_beg = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 3733 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); | 3735 | o_end = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| @@ -3781,7 +3783,7 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, | |||
| 3781 | { | 3783 | { |
| 3782 | Lisp_Object buffer; | 3784 | Lisp_Object buffer; |
| 3783 | struct buffer *b; | 3785 | struct buffer *b; |
| 3784 | int count = SPECPDL_INDEX (); | 3786 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3785 | 3787 | ||
| 3786 | CHECK_OVERLAY (overlay); | 3788 | CHECK_OVERLAY (overlay); |
| 3787 | 3789 | ||
| @@ -3872,7 +3874,7 @@ DEFUN ("overlays-at", Foverlays_at, Soverlays_at, 1, 1, 0, | |||
| 3872 | /* Put all the overlays we want in a vector in overlay_vec. | 3874 | /* Put all the overlays we want in a vector in overlay_vec. |
| 3873 | Store the length in len. */ | 3875 | Store the length in len. */ |
| 3874 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3876 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 3875 | (EMACS_INT *) 0, (EMACS_INT *) 0, 0); | 3877 | 0, 0, 0); |
| 3876 | 3878 | ||
| 3877 | /* Make a list of them all. */ | 3879 | /* Make a list of them all. */ |
| 3878 | result = Flist (noverlays, overlay_vec); | 3880 | result = Flist (noverlays, overlay_vec); |
| @@ -3920,7 +3922,7 @@ the value is (point-max). */) | |||
| 3920 | (Lisp_Object pos) | 3922 | (Lisp_Object pos) |
| 3921 | { | 3923 | { |
| 3922 | ptrdiff_t i, len, noverlays; | 3924 | ptrdiff_t i, len, noverlays; |
| 3923 | EMACS_INT endpos; | 3925 | ptrdiff_t endpos; |
| 3924 | Lisp_Object *overlay_vec; | 3926 | Lisp_Object *overlay_vec; |
| 3925 | 3927 | ||
| 3926 | CHECK_NUMBER_COERCE_MARKER (pos); | 3928 | CHECK_NUMBER_COERCE_MARKER (pos); |
| @@ -3932,14 +3934,14 @@ the value is (point-max). */) | |||
| 3932 | Store the length in len. | 3934 | Store the length in len. |
| 3933 | endpos gets the position where the next overlay starts. */ | 3935 | endpos gets the position where the next overlay starts. */ |
| 3934 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3936 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 3935 | &endpos, (EMACS_INT *) 0, 1); | 3937 | &endpos, 0, 1); |
| 3936 | 3938 | ||
| 3937 | /* If any of these overlays ends before endpos, | 3939 | /* If any of these overlays ends before endpos, |
| 3938 | use its ending point instead. */ | 3940 | use its ending point instead. */ |
| 3939 | for (i = 0; i < noverlays; i++) | 3941 | for (i = 0; i < noverlays; i++) |
| 3940 | { | 3942 | { |
| 3941 | Lisp_Object oend; | 3943 | Lisp_Object oend; |
| 3942 | EMACS_INT oendpos; | 3944 | ptrdiff_t oendpos; |
| 3943 | 3945 | ||
| 3944 | oend = OVERLAY_END (overlay_vec[i]); | 3946 | oend = OVERLAY_END (overlay_vec[i]); |
| 3945 | oendpos = OVERLAY_POSITION (oend); | 3947 | oendpos = OVERLAY_POSITION (oend); |
| @@ -3958,7 +3960,7 @@ If there are no overlay boundaries from (point-min) to POS, | |||
| 3958 | the value is (point-min). */) | 3960 | the value is (point-min). */) |
| 3959 | (Lisp_Object pos) | 3961 | (Lisp_Object pos) |
| 3960 | { | 3962 | { |
| 3961 | EMACS_INT prevpos; | 3963 | ptrdiff_t prevpos; |
| 3962 | Lisp_Object *overlay_vec; | 3964 | Lisp_Object *overlay_vec; |
| 3963 | ptrdiff_t len; | 3965 | ptrdiff_t len; |
| 3964 | 3966 | ||
| @@ -3976,7 +3978,7 @@ the value is (point-min). */) | |||
| 3976 | Store the length in len. | 3978 | Store the length in len. |
| 3977 | prevpos gets the position of the previous change. */ | 3979 | prevpos gets the position of the previous change. */ |
| 3978 | overlays_at (XINT (pos), 1, &overlay_vec, &len, | 3980 | overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 3979 | (EMACS_INT *) 0, &prevpos, 1); | 3981 | 0, &prevpos, 1); |
| 3980 | 3982 | ||
| 3981 | xfree (overlay_vec); | 3983 | xfree (overlay_vec); |
| 3982 | return make_number (prevpos); | 3984 | return make_number (prevpos); |
| @@ -4014,9 +4016,11 @@ That makes overlay lookup faster for positions near POS (but perhaps slower | |||
| 4014 | for positions far away from POS). */) | 4016 | for positions far away from POS). */) |
| 4015 | (Lisp_Object pos) | 4017 | (Lisp_Object pos) |
| 4016 | { | 4018 | { |
| 4019 | ptrdiff_t p; | ||
| 4017 | CHECK_NUMBER_COERCE_MARKER (pos); | 4020 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 4018 | 4021 | ||
| 4019 | recenter_overlay_lists (current_buffer, XINT (pos)); | 4022 | p = clip_to_bounds (PTRDIFF_MIN, XINT (pos), PTRDIFF_MAX); |
| 4023 | recenter_overlay_lists (current_buffer, p); | ||
| 4020 | return Qnil; | 4024 | return Qnil; |
| 4021 | } | 4025 | } |
| 4022 | 4026 | ||
| @@ -4083,7 +4087,7 @@ VALUE will be returned.*/) | |||
| 4083 | static Lisp_Object last_overlay_modification_hooks; | 4087 | static Lisp_Object last_overlay_modification_hooks; |
| 4084 | 4088 | ||
| 4085 | /* Number of elements actually used in last_overlay_modification_hooks. */ | 4089 | /* Number of elements actually used in last_overlay_modification_hooks. */ |
| 4086 | static int last_overlay_modification_hooks_used; | 4090 | static ptrdiff_t last_overlay_modification_hooks_used; |
| 4087 | 4091 | ||
| 4088 | /* Add one functionlist/overlay pair | 4092 | /* Add one functionlist/overlay pair |
| 4089 | to the end of last_overlay_modification_hooks. */ | 4093 | to the end of last_overlay_modification_hooks. */ |
| @@ -4091,11 +4095,11 @@ static int last_overlay_modification_hooks_used; | |||
| 4091 | static void | 4095 | static void |
| 4092 | add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) | 4096 | add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay) |
| 4093 | { | 4097 | { |
| 4094 | int oldsize = ASIZE (last_overlay_modification_hooks); | 4098 | ptrdiff_t oldsize = ASIZE (last_overlay_modification_hooks); |
| 4095 | 4099 | ||
| 4096 | if (last_overlay_modification_hooks_used == oldsize) | 4100 | if (oldsize - 1 <= last_overlay_modification_hooks_used) |
| 4097 | last_overlay_modification_hooks = larger_vector | 4101 | last_overlay_modification_hooks = |
| 4098 | (last_overlay_modification_hooks, oldsize * 2, Qnil); | 4102 | larger_vector (last_overlay_modification_hooks, 2, -1); |
| 4099 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, | 4103 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, |
| 4100 | functionlist); last_overlay_modification_hooks_used++; | 4104 | functionlist); last_overlay_modification_hooks_used++; |
| 4101 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, | 4105 | ASET (last_overlay_modification_hooks, last_overlay_modification_hooks_used, |
| @@ -4144,7 +4148,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4144 | last_overlay_modification_hooks_used = 0; | 4148 | last_overlay_modification_hooks_used = 0; |
| 4145 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 4149 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 4146 | { | 4150 | { |
| 4147 | EMACS_INT startpos, endpos; | 4151 | ptrdiff_t startpos, endpos; |
| 4148 | Lisp_Object ostart, oend; | 4152 | Lisp_Object ostart, oend; |
| 4149 | 4153 | ||
| 4150 | XSETMISC (overlay, tail); | 4154 | XSETMISC (overlay, tail); |
| @@ -4181,7 +4185,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4181 | 4185 | ||
| 4182 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 4186 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 4183 | { | 4187 | { |
| 4184 | EMACS_INT startpos, endpos; | 4188 | ptrdiff_t startpos, endpos; |
| 4185 | Lisp_Object ostart, oend; | 4189 | Lisp_Object ostart, oend; |
| 4186 | 4190 | ||
| 4187 | XSETMISC (overlay, tail); | 4191 | XSETMISC (overlay, tail); |
| @@ -4222,9 +4226,9 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after, | |||
| 4222 | /* Call the functions recorded in last_overlay_modification_hooks. | 4226 | /* Call the functions recorded in last_overlay_modification_hooks. |
| 4223 | First copy the vector contents, in case some of these hooks | 4227 | First copy the vector contents, in case some of these hooks |
| 4224 | do subsequent modification of the buffer. */ | 4228 | do subsequent modification of the buffer. */ |
| 4225 | int size = last_overlay_modification_hooks_used; | 4229 | ptrdiff_t size = last_overlay_modification_hooks_used; |
| 4226 | Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); | 4230 | Lisp_Object *copy = (Lisp_Object *) alloca (size * sizeof (Lisp_Object)); |
| 4227 | int i; | 4231 | ptrdiff_t i; |
| 4228 | 4232 | ||
| 4229 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, | 4233 | memcpy (copy, XVECTOR (last_overlay_modification_hooks)->contents, |
| 4230 | size * sizeof (Lisp_Object)); | 4234 | size * sizeof (Lisp_Object)); |
| @@ -4264,7 +4268,7 @@ call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after, | |||
| 4264 | /* Delete any zero-sized overlays at position POS, if the `evaporate' | 4268 | /* Delete any zero-sized overlays at position POS, if the `evaporate' |
| 4265 | property is set. */ | 4269 | property is set. */ |
| 4266 | void | 4270 | void |
| 4267 | evaporate_overlays (EMACS_INT pos) | 4271 | evaporate_overlays (ptrdiff_t pos) |
| 4268 | { | 4272 | { |
| 4269 | Lisp_Object overlay, hit_list; | 4273 | Lisp_Object overlay, hit_list; |
| 4270 | struct Lisp_Overlay *tail; | 4274 | struct Lisp_Overlay *tail; |
| @@ -4273,7 +4277,7 @@ evaporate_overlays (EMACS_INT pos) | |||
| 4273 | if (pos <= current_buffer->overlay_center) | 4277 | if (pos <= current_buffer->overlay_center) |
| 4274 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 4278 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| 4275 | { | 4279 | { |
| 4276 | EMACS_INT endpos; | 4280 | ptrdiff_t endpos; |
| 4277 | XSETMISC (overlay, tail); | 4281 | XSETMISC (overlay, tail); |
| 4278 | endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); | 4282 | endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 4279 | if (endpos < pos) | 4283 | if (endpos < pos) |
| @@ -4285,7 +4289,7 @@ evaporate_overlays (EMACS_INT pos) | |||
| 4285 | else | 4289 | else |
| 4286 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) | 4290 | for (tail = current_buffer->overlays_after; tail; tail = tail->next) |
| 4287 | { | 4291 | { |
| 4288 | EMACS_INT startpos; | 4292 | ptrdiff_t startpos; |
| 4289 | XSETMISC (overlay, tail); | 4293 | XSETMISC (overlay, tail); |
| 4290 | startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); | 4294 | startpos = OVERLAY_POSITION (OVERLAY_START (overlay)); |
| 4291 | if (startpos > pos) | 4295 | if (startpos > pos) |
| @@ -4795,7 +4799,7 @@ alloc_buffer_text (struct buffer *b, ptrdiff_t nbytes) | |||
| 4795 | shrink it. */ | 4799 | shrink it. */ |
| 4796 | 4800 | ||
| 4797 | void | 4801 | void |
| 4798 | enlarge_buffer_text (struct buffer *b, EMACS_INT delta) | 4802 | enlarge_buffer_text (struct buffer *b, ptrdiff_t delta) |
| 4799 | { | 4803 | { |
| 4800 | POINTER_TYPE *p; | 4804 | POINTER_TYPE *p; |
| 4801 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 | 4805 | ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 |
diff --git a/src/buffer.h b/src/buffer.h index 73628fe6dfc..323c85a0c77 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -245,12 +245,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 245 | #define BUF_TEMP_SET_PT(buffer, position) \ | 245 | #define BUF_TEMP_SET_PT(buffer, position) \ |
| 246 | (temp_set_point ((buffer), (position))) | 246 | (temp_set_point ((buffer), (position))) |
| 247 | 247 | ||
| 248 | extern void set_point (EMACS_INT); | 248 | extern void set_point (ptrdiff_t); |
| 249 | extern void temp_set_point (struct buffer *, EMACS_INT); | 249 | extern void temp_set_point (struct buffer *, ptrdiff_t); |
| 250 | extern void set_point_both (EMACS_INT, EMACS_INT); | 250 | extern void set_point_both (ptrdiff_t, ptrdiff_t); |
| 251 | extern void temp_set_point_both (struct buffer *, | 251 | extern void temp_set_point_both (struct buffer *, |
| 252 | EMACS_INT, EMACS_INT); | 252 | ptrdiff_t, ptrdiff_t); |
| 253 | extern void enlarge_buffer_text (struct buffer *, EMACS_INT); | 253 | extern void enlarge_buffer_text (struct buffer *, ptrdiff_t); |
| 254 | 254 | ||
| 255 | 255 | ||
| 256 | /* Macros for setting the BEGV, ZV or PT of a given buffer. | 256 | /* Macros for setting the BEGV, ZV or PT of a given buffer. |
| @@ -438,38 +438,38 @@ struct buffer_text | |||
| 438 | into a buffer's text to functions that malloc. */ | 438 | into a buffer's text to functions that malloc. */ |
| 439 | unsigned char *beg; | 439 | unsigned char *beg; |
| 440 | 440 | ||
| 441 | EMACS_INT gpt; /* Char pos of gap in buffer. */ | 441 | ptrdiff_t gpt; /* Char pos of gap in buffer. */ |
| 442 | EMACS_INT z; /* Char pos of end of buffer. */ | 442 | ptrdiff_t z; /* Char pos of end of buffer. */ |
| 443 | EMACS_INT gpt_byte; /* Byte pos of gap in buffer. */ | 443 | ptrdiff_t gpt_byte; /* Byte pos of gap in buffer. */ |
| 444 | EMACS_INT z_byte; /* Byte pos of end of buffer. */ | 444 | ptrdiff_t z_byte; /* Byte pos of end of buffer. */ |
| 445 | EMACS_INT gap_size; /* Size of buffer's gap. */ | 445 | ptrdiff_t gap_size; /* Size of buffer's gap. */ |
| 446 | int modiff; /* This counts buffer-modification events | 446 | EMACS_INT modiff; /* This counts buffer-modification events |
| 447 | for this buffer. It is incremented for | 447 | for this buffer. It is incremented for |
| 448 | each such event, and never otherwise | 448 | each such event, and never otherwise |
| 449 | changed. */ | 449 | changed. */ |
| 450 | int chars_modiff; /* This is modified with character change | 450 | EMACS_INT chars_modiff; /* This is modified with character change |
| 451 | events for this buffer. It is set to | 451 | events for this buffer. It is set to |
| 452 | modiff for each such event, and never | 452 | modiff for each such event, and never |
| 453 | otherwise changed. */ | 453 | otherwise changed. */ |
| 454 | int save_modiff; /* Previous value of modiff, as of last | 454 | EMACS_INT save_modiff; /* Previous value of modiff, as of last |
| 455 | time buffer visited or saved a file. */ | 455 | time buffer visited or saved a file. */ |
| 456 | 456 | ||
| 457 | int overlay_modiff; /* Counts modifications to overlays. */ | 457 | EMACS_INT overlay_modiff; /* Counts modifications to overlays. */ |
| 458 | 458 | ||
| 459 | /* Minimum value of GPT - BEG since last redisplay that finished. */ | 459 | /* Minimum value of GPT - BEG since last redisplay that finished. */ |
| 460 | EMACS_INT beg_unchanged; | 460 | ptrdiff_t beg_unchanged; |
| 461 | 461 | ||
| 462 | /* Minimum value of Z - GPT since last redisplay that finished. */ | 462 | /* Minimum value of Z - GPT since last redisplay that finished. */ |
| 463 | EMACS_INT end_unchanged; | 463 | ptrdiff_t end_unchanged; |
| 464 | 464 | ||
| 465 | /* MODIFF as of last redisplay that finished; if it matches MODIFF, | 465 | /* MODIFF as of last redisplay that finished; if it matches MODIFF, |
| 466 | beg_unchanged and end_unchanged contain no useful information. */ | 466 | beg_unchanged and end_unchanged contain no useful information. */ |
| 467 | int unchanged_modified; | 467 | EMACS_INT unchanged_modified; |
| 468 | 468 | ||
| 469 | /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that | 469 | /* BUF_OVERLAY_MODIFF of current buffer, as of last redisplay that |
| 470 | finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and | 470 | finished; if it matches BUF_OVERLAY_MODIFF, beg_unchanged and |
| 471 | end_unchanged contain no useful information. */ | 471 | end_unchanged contain no useful information. */ |
| 472 | int overlay_unchanged_modified; | 472 | EMACS_INT overlay_unchanged_modified; |
| 473 | 473 | ||
| 474 | /* Properties of this buffer's text. */ | 474 | /* Properties of this buffer's text. */ |
| 475 | INTERVAL intervals; | 475 | INTERVAL intervals; |
| @@ -525,17 +525,17 @@ struct buffer | |||
| 525 | struct buffer_text *text; | 525 | struct buffer_text *text; |
| 526 | 526 | ||
| 527 | /* Char position of point in buffer. */ | 527 | /* Char position of point in buffer. */ |
| 528 | EMACS_INT pt; | 528 | ptrdiff_t pt; |
| 529 | /* Byte position of point in buffer. */ | 529 | /* Byte position of point in buffer. */ |
| 530 | EMACS_INT pt_byte; | 530 | ptrdiff_t pt_byte; |
| 531 | /* Char position of beginning of accessible range. */ | 531 | /* Char position of beginning of accessible range. */ |
| 532 | EMACS_INT begv; | 532 | ptrdiff_t begv; |
| 533 | /* Byte position of beginning of accessible range. */ | 533 | /* Byte position of beginning of accessible range. */ |
| 534 | EMACS_INT begv_byte; | 534 | ptrdiff_t begv_byte; |
| 535 | /* Char position of end of accessible range. */ | 535 | /* Char position of end of accessible range. */ |
| 536 | EMACS_INT zv; | 536 | ptrdiff_t zv; |
| 537 | /* Byte position of end of accessible range. */ | 537 | /* Byte position of end of accessible range. */ |
| 538 | EMACS_INT zv_byte; | 538 | ptrdiff_t zv_byte; |
| 539 | 539 | ||
| 540 | /* In an indirect buffer, this points to the base buffer. | 540 | /* In an indirect buffer, this points to the base buffer. |
| 541 | In an ordinary buffer, it is 0. */ | 541 | In an ordinary buffer, it is 0. */ |
| @@ -561,16 +561,16 @@ struct buffer | |||
| 561 | modtime is actually set. */ | 561 | modtime is actually set. */ |
| 562 | off_t modtime_size; | 562 | off_t modtime_size; |
| 563 | /* The value of text->modiff at the last auto-save. */ | 563 | /* The value of text->modiff at the last auto-save. */ |
| 564 | int auto_save_modified; | 564 | EMACS_INT auto_save_modified; |
| 565 | /* The value of text->modiff at the last display error. | 565 | /* The value of text->modiff at the last display error. |
| 566 | Redisplay of this buffer is inhibited until it changes again. */ | 566 | Redisplay of this buffer is inhibited until it changes again. */ |
| 567 | int display_error_modiff; | 567 | EMACS_INT display_error_modiff; |
| 568 | /* The time at which we detected a failure to auto-save, | 568 | /* The time at which we detected a failure to auto-save, |
| 569 | Or -1 if we didn't have a failure. */ | 569 | Or 0 if we didn't have a failure. */ |
| 570 | int auto_save_failure_time; | 570 | time_t auto_save_failure_time; |
| 571 | /* Position in buffer at which display started | 571 | /* Position in buffer at which display started |
| 572 | the last time this buffer was displayed. */ | 572 | the last time this buffer was displayed. */ |
| 573 | EMACS_INT last_window_start; | 573 | ptrdiff_t last_window_start; |
| 574 | 574 | ||
| 575 | /* Set nonzero whenever the narrowing is changed in this buffer. */ | 575 | /* Set nonzero whenever the narrowing is changed in this buffer. */ |
| 576 | int clip_changed; | 576 | int clip_changed; |
| @@ -607,7 +607,7 @@ struct buffer | |||
| 607 | struct Lisp_Overlay *overlays_after; | 607 | struct Lisp_Overlay *overlays_after; |
| 608 | 608 | ||
| 609 | /* Position where the overlay lists are centered. */ | 609 | /* Position where the overlay lists are centered. */ |
| 610 | EMACS_INT overlay_center; | 610 | ptrdiff_t overlay_center; |
| 611 | 611 | ||
| 612 | /* Everything from here down must be a Lisp_Object. */ | 612 | /* Everything from here down must be a Lisp_Object. */ |
| 613 | /* buffer-local Lisp variables start at `undo_list', | 613 | /* buffer-local Lisp variables start at `undo_list', |
| @@ -890,20 +890,20 @@ extern struct buffer buffer_local_symbols; | |||
| 890 | 890 | ||
| 891 | extern void delete_all_overlays (struct buffer *); | 891 | extern void delete_all_overlays (struct buffer *); |
| 892 | extern void reset_buffer (struct buffer *); | 892 | extern void reset_buffer (struct buffer *); |
| 893 | extern void evaporate_overlays (EMACS_INT); | 893 | extern void evaporate_overlays (ptrdiff_t); |
| 894 | extern ptrdiff_t overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, | 894 | extern ptrdiff_t overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr, |
| 895 | ptrdiff_t *len_ptr, EMACS_INT *next_ptr, | 895 | ptrdiff_t *len_ptr, ptrdiff_t *next_ptr, |
| 896 | EMACS_INT *prev_ptr, int change_req); | 896 | ptrdiff_t *prev_ptr, int change_req); |
| 897 | extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *); | 897 | extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *); |
| 898 | extern void recenter_overlay_lists (struct buffer *, EMACS_INT); | 898 | extern void recenter_overlay_lists (struct buffer *, ptrdiff_t); |
| 899 | extern EMACS_INT overlay_strings (EMACS_INT, struct window *, unsigned char **); | 899 | extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **); |
| 900 | extern void validate_region (Lisp_Object *, Lisp_Object *); | 900 | extern void validate_region (Lisp_Object *, Lisp_Object *); |
| 901 | extern void set_buffer_internal (struct buffer *); | 901 | extern void set_buffer_internal (struct buffer *); |
| 902 | extern void set_buffer_internal_1 (struct buffer *); | 902 | extern void set_buffer_internal_1 (struct buffer *); |
| 903 | extern void set_buffer_temp (struct buffer *); | 903 | extern void set_buffer_temp (struct buffer *); |
| 904 | extern void record_buffer (Lisp_Object); | 904 | extern void record_buffer (Lisp_Object); |
| 905 | extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN; | 905 | extern void buffer_slot_type_mismatch (Lisp_Object, int) NO_RETURN; |
| 906 | extern void fix_overlays_before (struct buffer *, EMACS_INT, EMACS_INT); | 906 | extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 907 | extern void mmap_set_vars (int); | 907 | extern void mmap_set_vars (int); |
| 908 | 908 | ||
| 909 | /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements. | 909 | /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements. |
diff --git a/src/bytecode.c b/src/bytecode.c index 9ed29e94b54..b6ac6c51bed 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -435,7 +435,7 @@ Lisp_Object | |||
| 435 | exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | 435 | exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, |
| 436 | Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) | 436 | Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args) |
| 437 | { | 437 | { |
| 438 | int count = SPECPDL_INDEX (); | 438 | ptrdiff_t count = SPECPDL_INDEX (); |
| 439 | #ifdef BYTE_CODE_METER | 439 | #ifdef BYTE_CODE_METER |
| 440 | int this_op = 0; | 440 | int this_op = 0; |
| 441 | int prev_op; | 441 | int prev_op; |
| @@ -486,8 +486,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 486 | stack.byte_string = bytestr; | 486 | stack.byte_string = bytestr; |
| 487 | stack.pc = stack.byte_string_start = SDATA (bytestr); | 487 | stack.pc = stack.byte_string_start = SDATA (bytestr); |
| 488 | stack.constants = vector; | 488 | stack.constants = vector; |
| 489 | if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) < XFASTINT (maxdepth)) | ||
| 490 | memory_full (SIZE_MAX); | ||
| 491 | top = (Lisp_Object *) alloca (XFASTINT (maxdepth) | 489 | top = (Lisp_Object *) alloca (XFASTINT (maxdepth) |
| 492 | * sizeof (Lisp_Object)); | 490 | * sizeof (Lisp_Object)); |
| 493 | #if BYTE_MAINTAIN_TOP | 491 | #if BYTE_MAINTAIN_TOP |
| @@ -504,14 +502,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 504 | 502 | ||
| 505 | if (INTEGERP (args_template)) | 503 | if (INTEGERP (args_template)) |
| 506 | { | 504 | { |
| 507 | ptrdiff_t at = XINT (args_template); | 505 | EMACS_INT at = XINT (args_template); |
| 508 | int rest = at & 128; | 506 | int rest = at & 128; |
| 509 | int mandatory = at & 127; | 507 | int mandatory = at & 127; |
| 510 | ptrdiff_t nonrest = at >> 8; | 508 | EMACS_INT nonrest = at >> 8; |
| 511 | eassert (mandatory <= nonrest); | 509 | eassert (mandatory <= nonrest); |
| 512 | if (nargs <= nonrest) | 510 | if (nargs <= nonrest) |
| 513 | { | 511 | { |
| 514 | ptrdiff_t i; | 512 | EMACS_INT i; |
| 515 | for (i = 0 ; i < nargs; i++, args++) | 513 | for (i = 0 ; i < nargs; i++, args++) |
| 516 | PUSH (*args); | 514 | PUSH (*args); |
| 517 | if (nargs < mandatory) | 515 | if (nargs < mandatory) |
| @@ -943,7 +941,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 943 | 941 | ||
| 944 | case Bsave_window_excursion: /* Obsolete since 24.1. */ | 942 | case Bsave_window_excursion: /* Obsolete since 24.1. */ |
| 945 | { | 943 | { |
| 946 | register int count1 = SPECPDL_INDEX (); | 944 | register ptrdiff_t count1 = SPECPDL_INDEX (); |
| 947 | record_unwind_protect (Fset_window_configuration, | 945 | record_unwind_protect (Fset_window_configuration, |
| 948 | Fcurrent_window_configuration (Qnil)); | 946 | Fcurrent_window_configuration (Qnil)); |
| 949 | BEFORE_POTENTIAL_GC (); | 947 | BEFORE_POTENTIAL_GC (); |
| @@ -1007,13 +1005,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1007 | case Bnth: | 1005 | case Bnth: |
| 1008 | { | 1006 | { |
| 1009 | Lisp_Object v1, v2; | 1007 | Lisp_Object v1, v2; |
| 1008 | EMACS_INT n; | ||
| 1010 | BEFORE_POTENTIAL_GC (); | 1009 | BEFORE_POTENTIAL_GC (); |
| 1011 | v1 = POP; | 1010 | v1 = POP; |
| 1012 | v2 = TOP; | 1011 | v2 = TOP; |
| 1013 | CHECK_NUMBER (v2); | 1012 | CHECK_NUMBER (v2); |
| 1014 | op = XINT (v2); | 1013 | n = XINT (v2); |
| 1015 | immediate_quit = 1; | 1014 | immediate_quit = 1; |
| 1016 | while (--op >= 0 && CONSP (v1)) | 1015 | while (--n >= 0 && CONSP (v1)) |
| 1017 | v1 = XCDR (v1); | 1016 | v1 = XCDR (v1); |
| 1018 | immediate_quit = 0; | 1017 | immediate_quit = 0; |
| 1019 | TOP = CAR (v1); | 1018 | TOP = CAR (v1); |
| @@ -1640,14 +1639,15 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 1640 | if (CONSP (TOP)) | 1639 | if (CONSP (TOP)) |
| 1641 | { | 1640 | { |
| 1642 | /* Exchange args and then do nth. */ | 1641 | /* Exchange args and then do nth. */ |
| 1642 | EMACS_INT n; | ||
| 1643 | BEFORE_POTENTIAL_GC (); | 1643 | BEFORE_POTENTIAL_GC (); |
| 1644 | v2 = POP; | 1644 | v2 = POP; |
| 1645 | v1 = TOP; | 1645 | v1 = TOP; |
| 1646 | CHECK_NUMBER (v2); | 1646 | CHECK_NUMBER (v2); |
| 1647 | AFTER_POTENTIAL_GC (); | 1647 | AFTER_POTENTIAL_GC (); |
| 1648 | op = XINT (v2); | 1648 | n = XINT (v2); |
| 1649 | immediate_quit = 1; | 1649 | immediate_quit = 1; |
| 1650 | while (--op >= 0 && CONSP (v1)) | 1650 | while (--n >= 0 && CONSP (v1)) |
| 1651 | v1 = XCDR (v1); | 1651 | v1 = XCDR (v1); |
| 1652 | immediate_quit = 0; | 1652 | immediate_quit = 0; |
| 1653 | TOP = CAR (v1); | 1653 | TOP = CAR (v1); |
diff --git a/src/callint.c b/src/callint.c index 5cf99495671..c2a43f0f8f9 100644 --- a/src/callint.c +++ b/src/callint.c | |||
| @@ -257,11 +257,11 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 257 | Lisp_Object teml; | 257 | Lisp_Object teml; |
| 258 | Lisp_Object up_event; | 258 | Lisp_Object up_event; |
| 259 | Lisp_Object enable; | 259 | Lisp_Object enable; |
| 260 | int speccount = SPECPDL_INDEX (); | 260 | ptrdiff_t speccount = SPECPDL_INDEX (); |
| 261 | 261 | ||
| 262 | /* The index of the next element of this_command_keys to examine for | 262 | /* The index of the next element of this_command_keys to examine for |
| 263 | the 'e' interactive code. */ | 263 | the 'e' interactive code. */ |
| 264 | int next_event; | 264 | ptrdiff_t next_event; |
| 265 | 265 | ||
| 266 | Lisp_Object prefix_arg; | 266 | Lisp_Object prefix_arg; |
| 267 | char *string; | 267 | char *string; |
| @@ -278,7 +278,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 278 | char *tem1; | 278 | char *tem1; |
| 279 | int arg_from_tty = 0; | 279 | int arg_from_tty = 0; |
| 280 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 280 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 281 | int key_count; | 281 | ptrdiff_t key_count; |
| 282 | int record_then_fail = 0; | 282 | int record_then_fail = 0; |
| 283 | 283 | ||
| 284 | Lisp_Object save_this_command, save_last_command; | 284 | Lisp_Object save_this_command, save_last_command; |
| @@ -582,7 +582,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 582 | 582 | ||
| 583 | case 'k': /* Key sequence. */ | 583 | case 'k': /* Key sequence. */ |
| 584 | { | 584 | { |
| 585 | int speccount1 = SPECPDL_INDEX (); | 585 | ptrdiff_t speccount1 = SPECPDL_INDEX (); |
| 586 | specbind (Qcursor_in_echo_area, Qt); | 586 | specbind (Qcursor_in_echo_area, Qt); |
| 587 | /* Prompt in `minibuffer-prompt' face. */ | 587 | /* Prompt in `minibuffer-prompt' face. */ |
| 588 | Fput_text_property (make_number (0), | 588 | Fput_text_property (make_number (0), |
| @@ -614,7 +614,7 @@ invoke it. If KEYS is omitted or nil, the return value of | |||
| 614 | 614 | ||
| 615 | case 'K': /* Key sequence to be defined. */ | 615 | case 'K': /* Key sequence to be defined. */ |
| 616 | { | 616 | { |
| 617 | int speccount1 = SPECPDL_INDEX (); | 617 | ptrdiff_t speccount1 = SPECPDL_INDEX (); |
| 618 | specbind (Qcursor_in_echo_area, Qt); | 618 | specbind (Qcursor_in_echo_area, Qt); |
| 619 | /* Prompt in `minibuffer-prompt' face. */ | 619 | /* Prompt in `minibuffer-prompt' face. */ |
| 620 | Fput_text_property (make_number (0), | 620 | Fput_text_property (make_number (0), |
diff --git a/src/callproc.c b/src/callproc.c index 97531f73848..4eb83824b83 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -102,8 +102,12 @@ static Lisp_Object Fgetenv_internal (Lisp_Object, Lisp_Object); | |||
| 102 | static Lisp_Object | 102 | static Lisp_Object |
| 103 | call_process_kill (Lisp_Object fdpid) | 103 | call_process_kill (Lisp_Object fdpid) |
| 104 | { | 104 | { |
| 105 | emacs_close (XFASTINT (Fcar (fdpid))); | 105 | int fd; |
| 106 | EMACS_KILLPG (XFASTINT (Fcdr (fdpid)), SIGKILL); | 106 | pid_t pid; |
| 107 | CONS_TO_INTEGER (Fcar (fdpid), int, fd); | ||
| 108 | CONS_TO_INTEGER (Fcdr (fdpid), pid_t, pid); | ||
| 109 | emacs_close (fd); | ||
| 110 | EMACS_KILLPG (pid, SIGKILL); | ||
| 107 | synch_process_alive = 0; | 111 | synch_process_alive = 0; |
| 108 | return Qnil; | 112 | return Qnil; |
| 109 | } | 113 | } |
| @@ -112,18 +116,18 @@ static Lisp_Object | |||
| 112 | call_process_cleanup (Lisp_Object arg) | 116 | call_process_cleanup (Lisp_Object arg) |
| 113 | { | 117 | { |
| 114 | Lisp_Object fdpid = Fcdr (arg); | 118 | Lisp_Object fdpid = Fcdr (arg); |
| 119 | int fd; | ||
| 115 | #if defined (MSDOS) | 120 | #if defined (MSDOS) |
| 116 | Lisp_Object file; | 121 | Lisp_Object file; |
| 117 | int fd; | ||
| 118 | #else | 122 | #else |
| 119 | int pid; | 123 | pid_t pid; |
| 120 | #endif | 124 | #endif |
| 121 | 125 | ||
| 122 | Fset_buffer (Fcar (arg)); | 126 | Fset_buffer (Fcar (arg)); |
| 127 | CONS_TO_INTEGER (Fcar (fdpid), int, fd); | ||
| 123 | 128 | ||
| 124 | #if defined (MSDOS) | 129 | #if defined (MSDOS) |
| 125 | /* for MSDOS fdpid is really (fd . tempfile) */ | 130 | /* for MSDOS fdpid is really (fd . tempfile) */ |
| 126 | fd = XFASTINT (Fcar (fdpid)); | ||
| 127 | file = Fcdr (fdpid); | 131 | file = Fcdr (fdpid); |
| 128 | /* FD is -1 and FILE is "" when we didn't actually create a | 132 | /* FD is -1 and FILE is "" when we didn't actually create a |
| 129 | temporary file in call-process. */ | 133 | temporary file in call-process. */ |
| @@ -132,17 +136,17 @@ call_process_cleanup (Lisp_Object arg) | |||
| 132 | if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0')) | 136 | if (!(strcmp (SDATA (file), NULL_DEVICE) == 0 || SREF (file, 0) == '\0')) |
| 133 | unlink (SDATA (file)); | 137 | unlink (SDATA (file)); |
| 134 | #else /* not MSDOS */ | 138 | #else /* not MSDOS */ |
| 135 | pid = XFASTINT (Fcdr (fdpid)); | 139 | CONS_TO_INTEGER (Fcdr (fdpid), pid_t, pid); |
| 136 | 140 | ||
| 137 | if (call_process_exited) | 141 | if (call_process_exited) |
| 138 | { | 142 | { |
| 139 | emacs_close (XFASTINT (Fcar (fdpid))); | 143 | emacs_close (fd); |
| 140 | return Qnil; | 144 | return Qnil; |
| 141 | } | 145 | } |
| 142 | 146 | ||
| 143 | if (EMACS_KILLPG (pid, SIGINT) == 0) | 147 | if (EMACS_KILLPG (pid, SIGINT) == 0) |
| 144 | { | 148 | { |
| 145 | int count = SPECPDL_INDEX (); | 149 | ptrdiff_t count = SPECPDL_INDEX (); |
| 146 | record_unwind_protect (call_process_kill, fdpid); | 150 | record_unwind_protect (call_process_kill, fdpid); |
| 147 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); | 151 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); |
| 148 | immediate_quit = 1; | 152 | immediate_quit = 1; |
| @@ -153,7 +157,7 @@ call_process_cleanup (Lisp_Object arg) | |||
| 153 | message1 ("Waiting for process to die...done"); | 157 | message1 ("Waiting for process to die...done"); |
| 154 | } | 158 | } |
| 155 | synch_process_alive = 0; | 159 | synch_process_alive = 0; |
| 156 | emacs_close (XFASTINT (Fcar (fdpid))); | 160 | emacs_close (fd); |
| 157 | #endif /* not MSDOS */ | 161 | #endif /* not MSDOS */ |
| 158 | return Qnil; | 162 | return Qnil; |
| 159 | } | 163 | } |
| @@ -186,17 +190,16 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. | |||
| 186 | usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | 190 | usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) |
| 187 | (ptrdiff_t nargs, Lisp_Object *args) | 191 | (ptrdiff_t nargs, Lisp_Object *args) |
| 188 | { | 192 | { |
| 189 | Lisp_Object infile, buffer, current_dir, path; | 193 | Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail; |
| 190 | volatile int display_p_volatile; | 194 | int display_p; |
| 191 | int fd[2]; | 195 | int fd[2]; |
| 192 | int filefd; | 196 | int filefd; |
| 193 | register int pid; | ||
| 194 | #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) | 197 | #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) |
| 195 | #define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN) | 198 | #define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN) |
| 196 | char buf[CALLPROC_BUFFER_SIZE_MAX]; | 199 | char buf[CALLPROC_BUFFER_SIZE_MAX]; |
| 197 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; | 200 | int bufsize = CALLPROC_BUFFER_SIZE_MIN; |
| 198 | int count = SPECPDL_INDEX (); | 201 | ptrdiff_t count = SPECPDL_INDEX (); |
| 199 | volatile USE_SAFE_ALLOCA; | 202 | USE_SAFE_ALLOCA; |
| 200 | 203 | ||
| 201 | register const unsigned char **new_argv; | 204 | register const unsigned char **new_argv; |
| 202 | /* File to use for stderr in the child. | 205 | /* File to use for stderr in the child. |
| @@ -206,6 +209,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 206 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 209 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
| 207 | char *outf, *tempfile = NULL; | 210 | char *outf, *tempfile = NULL; |
| 208 | int outfilefd; | 211 | int outfilefd; |
| 212 | int pid; | ||
| 213 | #else | ||
| 214 | pid_t pid; | ||
| 209 | #endif | 215 | #endif |
| 210 | int fd_output = -1; | 216 | int fd_output = -1; |
| 211 | struct coding_system process_coding; /* coding-system of process output */ | 217 | struct coding_system process_coding; /* coding-system of process output */ |
| @@ -370,7 +376,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 370 | UNGCPRO; | 376 | UNGCPRO; |
| 371 | } | 377 | } |
| 372 | 378 | ||
| 373 | display_p_volatile = INTERACTIVE && nargs >= 4 && !NILP (args[3]); | 379 | display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); |
| 374 | 380 | ||
| 375 | filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); | 381 | filefd = emacs_open (SSDATA (infile), O_RDONLY, 0); |
| 376 | if (filefd < 0) | 382 | if (filefd < 0) |
| @@ -606,10 +612,13 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 606 | Lisp_Object volatile buffer_volatile = buffer; | 612 | Lisp_Object volatile buffer_volatile = buffer; |
| 607 | Lisp_Object volatile coding_systems_volatile = coding_systems; | 613 | Lisp_Object volatile coding_systems_volatile = coding_systems; |
| 608 | Lisp_Object volatile current_dir_volatile = current_dir; | 614 | Lisp_Object volatile current_dir_volatile = current_dir; |
| 615 | int volatile display_p_volatile = display_p; | ||
| 609 | int volatile fd1_volatile = fd1; | 616 | int volatile fd1_volatile = fd1; |
| 610 | int volatile fd_error_volatile = fd_error; | 617 | int volatile fd_error_volatile = fd_error; |
| 611 | int volatile fd_output_volatile = fd_output; | 618 | int volatile fd_output_volatile = fd_output; |
| 612 | int volatile output_to_buffer_volatile = output_to_buffer; | 619 | int volatile output_to_buffer_volatile = output_to_buffer; |
| 620 | int volatile sa_must_free_volatile = sa_must_free; | ||
| 621 | ptrdiff_t volatile sa_count_volatile = sa_count; | ||
| 613 | unsigned char const **volatile new_argv_volatile = new_argv; | 622 | unsigned char const **volatile new_argv_volatile = new_argv; |
| 614 | 623 | ||
| 615 | pid = vfork (); | 624 | pid = vfork (); |
| @@ -617,10 +626,13 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 617 | buffer = buffer_volatile; | 626 | buffer = buffer_volatile; |
| 618 | coding_systems = coding_systems_volatile; | 627 | coding_systems = coding_systems_volatile; |
| 619 | current_dir = current_dir_volatile; | 628 | current_dir = current_dir_volatile; |
| 629 | display_p = display_p_volatile; | ||
| 620 | fd1 = fd1_volatile; | 630 | fd1 = fd1_volatile; |
| 621 | fd_error = fd_error_volatile; | 631 | fd_error = fd_error_volatile; |
| 622 | fd_output = fd_output_volatile; | 632 | fd_output = fd_output_volatile; |
| 623 | output_to_buffer = output_to_buffer_volatile; | 633 | output_to_buffer = output_to_buffer_volatile; |
| 634 | sa_must_free_volatile = sa_must_free; | ||
| 635 | sa_count = sa_count_volatile; | ||
| 624 | new_argv = new_argv_volatile; | 636 | new_argv = new_argv_volatile; |
| 625 | } | 637 | } |
| 626 | 638 | ||
| @@ -693,16 +705,14 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 693 | 705 | ||
| 694 | #if defined (MSDOS) | 706 | #if defined (MSDOS) |
| 695 | /* MSDOS needs different cleanup information. */ | 707 | /* MSDOS needs different cleanup information. */ |
| 696 | record_unwind_protect (call_process_cleanup, | 708 | cleanup_info_tail = build_string (tempfile ? tempfile : ""); |
| 697 | Fcons (Fcurrent_buffer (), | ||
| 698 | Fcons (make_number (fd[0]), | ||
| 699 | build_string (tempfile ? tempfile : "")))); | ||
| 700 | #else | 709 | #else |
| 710 | cleanup_info_tail = INTEGER_TO_CONS (pid); | ||
| 711 | #endif /* not MSDOS */ | ||
| 701 | record_unwind_protect (call_process_cleanup, | 712 | record_unwind_protect (call_process_cleanup, |
| 702 | Fcons (Fcurrent_buffer (), | 713 | Fcons (Fcurrent_buffer (), |
| 703 | Fcons (make_number (fd[0]), make_number (pid)))); | 714 | Fcons (INTEGER_TO_CONS (fd[0]), |
| 704 | #endif /* not MSDOS */ | 715 | cleanup_info_tail))); |
| 705 | |||
| 706 | 716 | ||
| 707 | if (BUFFERP (buffer)) | 717 | if (BUFFERP (buffer)) |
| 708 | Fset_buffer (buffer); | 718 | Fset_buffer (buffer); |
| @@ -754,11 +764,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 754 | 764 | ||
| 755 | if (output_to_buffer) | 765 | if (output_to_buffer) |
| 756 | { | 766 | { |
| 757 | register EMACS_INT nread; | 767 | register int nread; |
| 758 | int first = 1; | 768 | int first = 1; |
| 759 | EMACS_INT total_read = 0; | 769 | EMACS_INT total_read = 0; |
| 760 | int carryover = 0; | 770 | int carryover = 0; |
| 761 | int display_p = display_p_volatile; | ||
| 762 | int display_on_the_fly = display_p; | 771 | int display_on_the_fly = display_p; |
| 763 | struct coding_system saved_coding; | 772 | struct coding_system saved_coding; |
| 764 | 773 | ||
| @@ -801,7 +810,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 801 | else | 810 | else |
| 802 | { /* We have to decode the input. */ | 811 | { /* We have to decode the input. */ |
| 803 | Lisp_Object curbuf; | 812 | Lisp_Object curbuf; |
| 804 | int count1 = SPECPDL_INDEX (); | 813 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 805 | 814 | ||
| 806 | XSETBUFFER (curbuf, current_buffer); | 815 | XSETBUFFER (curbuf, current_buffer); |
| 807 | /* We cannot allow after-change-functions be run | 816 | /* We cannot allow after-change-functions be run |
| @@ -920,7 +929,7 @@ static Lisp_Object | |||
| 920 | delete_temp_file (Lisp_Object name) | 929 | delete_temp_file (Lisp_Object name) |
| 921 | { | 930 | { |
| 922 | /* Suppress jka-compr handling, etc. */ | 931 | /* Suppress jka-compr handling, etc. */ |
| 923 | int count = SPECPDL_INDEX (); | 932 | ptrdiff_t count = SPECPDL_INDEX (); |
| 924 | specbind (intern ("file-name-handler-alist"), Qnil); | 933 | specbind (intern ("file-name-handler-alist"), Qnil); |
| 925 | internal_delete_file (name); | 934 | internal_delete_file (name); |
| 926 | unbind_to (count, Qnil); | 935 | unbind_to (count, Qnil); |
| @@ -957,7 +966,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 957 | struct gcpro gcpro1; | 966 | struct gcpro gcpro1; |
| 958 | Lisp_Object filename_string; | 967 | Lisp_Object filename_string; |
| 959 | register Lisp_Object start, end; | 968 | register Lisp_Object start, end; |
| 960 | int count = SPECPDL_INDEX (); | 969 | ptrdiff_t count = SPECPDL_INDEX (); |
| 961 | /* Qt denotes we have not yet called Ffind_operation_coding_system. */ | 970 | /* Qt denotes we have not yet called Ffind_operation_coding_system. */ |
| 962 | Lisp_Object coding_systems; | 971 | Lisp_Object coding_systems; |
| 963 | Lisp_Object val, *args2; | 972 | Lisp_Object val, *args2; |
| @@ -1034,7 +1043,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r | |||
| 1034 | val = complement_process_encoding_system (val); | 1043 | val = complement_process_encoding_system (val); |
| 1035 | 1044 | ||
| 1036 | { | 1045 | { |
| 1037 | int count1 = SPECPDL_INDEX (); | 1046 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 1038 | 1047 | ||
| 1039 | specbind (intern ("coding-system-for-write"), val); | 1048 | specbind (intern ("coding-system-for-write"), val); |
| 1040 | /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we | 1049 | /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we |
| @@ -1134,7 +1143,7 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1134 | HANDLE handles[3]; | 1143 | HANDLE handles[3]; |
| 1135 | #endif /* WINDOWSNT */ | 1144 | #endif /* WINDOWSNT */ |
| 1136 | 1145 | ||
| 1137 | int pid = getpid (); | 1146 | pid_t pid = getpid (); |
| 1138 | 1147 | ||
| 1139 | /* Close Emacs's descriptors that this process should not have. */ | 1148 | /* Close Emacs's descriptors that this process should not have. */ |
| 1140 | close_process_descs (); | 1149 | close_process_descs (); |
diff --git a/src/casefiddle.c b/src/casefiddle.c index 77222c9e0a3..05d689a9eef 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -82,8 +82,8 @@ casify_object (enum case_action flag, Lisp_Object obj) | |||
| 82 | wrong_type_argument (Qchar_or_string_p, obj); | 82 | wrong_type_argument (Qchar_or_string_p, obj); |
| 83 | else if (!STRING_MULTIBYTE (obj)) | 83 | else if (!STRING_MULTIBYTE (obj)) |
| 84 | { | 84 | { |
| 85 | EMACS_INT i; | 85 | ptrdiff_t i; |
| 86 | EMACS_INT size = SCHARS (obj); | 86 | ptrdiff_t size = SCHARS (obj); |
| 87 | 87 | ||
| 88 | obj = Fcopy_sequence (obj); | 88 | obj = Fcopy_sequence (obj); |
| 89 | for (i = 0; i < size; i++) | 89 | for (i = 0; i < size; i++) |
| @@ -111,26 +111,20 @@ casify_object (enum case_action flag, Lisp_Object obj) | |||
| 111 | } | 111 | } |
| 112 | else | 112 | else |
| 113 | { | 113 | { |
| 114 | EMACS_INT i, i_byte, size = SCHARS (obj); | 114 | ptrdiff_t i, i_byte, size = SCHARS (obj); |
| 115 | int len; | 115 | int len; |
| 116 | USE_SAFE_ALLOCA; | 116 | USE_SAFE_ALLOCA; |
| 117 | unsigned char *dst, *o; | 117 | unsigned char *dst, *o; |
| 118 | /* Over-allocate by 12%: this is a minor overhead, but should be | 118 | ptrdiff_t o_size = (size < STRING_BYTES_BOUND / MAX_MULTIBYTE_LENGTH |
| 119 | sufficient in 99.999% of the cases to avoid a reallocation. */ | 119 | ? size * MAX_MULTIBYTE_LENGTH |
| 120 | EMACS_INT o_size = SBYTES (obj) + SBYTES (obj) / 8 + MAX_MULTIBYTE_LENGTH; | 120 | : STRING_BYTES_BOUND); |
| 121 | SAFE_ALLOCA (dst, void *, o_size); | 121 | SAFE_ALLOCA (dst, void *, o_size); |
| 122 | o = dst; | 122 | o = dst; |
| 123 | 123 | ||
| 124 | for (i = i_byte = 0; i < size; i++, i_byte += len) | 124 | for (i = i_byte = 0; i < size; i++, i_byte += len) |
| 125 | { | 125 | { |
| 126 | if ((o - dst) + MAX_MULTIBYTE_LENGTH > o_size) | 126 | if (o_size - (o - dst) < MAX_MULTIBYTE_LENGTH) |
| 127 | { /* Not enough space for the next char: grow the destination. */ | 127 | string_overflow (); |
| 128 | unsigned char *old_dst = dst; | ||
| 129 | o_size += o_size; /* Probably overkill, but extremely rare. */ | ||
| 130 | SAFE_ALLOCA (dst, void *, o_size); | ||
| 131 | memcpy (dst, old_dst, o - old_dst); | ||
| 132 | o = dst + (o - old_dst); | ||
| 133 | } | ||
| 134 | c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); | 128 | c = STRING_CHAR_AND_LENGTH (SDATA (obj) + i_byte, len); |
| 135 | if (inword && flag != CASE_CAPITALIZE_UP) | 129 | if (inword && flag != CASE_CAPITALIZE_UP) |
| 136 | c = downcase (c); | 130 | c = downcase (c); |
| @@ -199,14 +193,14 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) | |||
| 199 | register int c; | 193 | register int c; |
| 200 | register int inword = flag == CASE_DOWN; | 194 | register int inword = flag == CASE_DOWN; |
| 201 | register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 195 | register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 202 | EMACS_INT start, end; | 196 | ptrdiff_t start, end; |
| 203 | EMACS_INT start_byte; | 197 | ptrdiff_t start_byte; |
| 204 | 198 | ||
| 205 | /* Position of first and last changes. */ | 199 | /* Position of first and last changes. */ |
| 206 | EMACS_INT first = -1, last IF_LINT (= 0); | 200 | ptrdiff_t first = -1, last IF_LINT (= 0); |
| 207 | 201 | ||
| 208 | EMACS_INT opoint = PT; | 202 | ptrdiff_t opoint = PT; |
| 209 | EMACS_INT opoint_byte = PT_BYTE; | 203 | ptrdiff_t opoint_byte = PT_BYTE; |
| 210 | 204 | ||
| 211 | if (EQ (b, e)) | 205 | if (EQ (b, e)) |
| 212 | /* Not modifying because nothing marked */ | 206 | /* Not modifying because nothing marked */ |
| @@ -351,10 +345,10 @@ character positions to operate on. */) | |||
| 351 | } | 345 | } |
| 352 | 346 | ||
| 353 | static Lisp_Object | 347 | static Lisp_Object |
| 354 | operate_on_word (Lisp_Object arg, EMACS_INT *newpoint) | 348 | operate_on_word (Lisp_Object arg, ptrdiff_t *newpoint) |
| 355 | { | 349 | { |
| 356 | Lisp_Object val; | 350 | Lisp_Object val; |
| 357 | EMACS_INT farend; | 351 | ptrdiff_t farend; |
| 358 | EMACS_INT iarg; | 352 | EMACS_INT iarg; |
| 359 | 353 | ||
| 360 | CHECK_NUMBER (arg); | 354 | CHECK_NUMBER (arg); |
| @@ -376,7 +370,7 @@ See also `capitalize-word'. */) | |||
| 376 | (Lisp_Object arg) | 370 | (Lisp_Object arg) |
| 377 | { | 371 | { |
| 378 | Lisp_Object beg, end; | 372 | Lisp_Object beg, end; |
| 379 | EMACS_INT newpoint; | 373 | ptrdiff_t newpoint; |
| 380 | XSETFASTINT (beg, PT); | 374 | XSETFASTINT (beg, PT); |
| 381 | end = operate_on_word (arg, &newpoint); | 375 | end = operate_on_word (arg, &newpoint); |
| 382 | casify_region (CASE_UP, beg, end); | 376 | casify_region (CASE_UP, beg, end); |
| @@ -390,7 +384,7 @@ With negative argument, convert previous words but do not move. */) | |||
| 390 | (Lisp_Object arg) | 384 | (Lisp_Object arg) |
| 391 | { | 385 | { |
| 392 | Lisp_Object beg, end; | 386 | Lisp_Object beg, end; |
| 393 | EMACS_INT newpoint; | 387 | ptrdiff_t newpoint; |
| 394 | XSETFASTINT (beg, PT); | 388 | XSETFASTINT (beg, PT); |
| 395 | end = operate_on_word (arg, &newpoint); | 389 | end = operate_on_word (arg, &newpoint); |
| 396 | casify_region (CASE_DOWN, beg, end); | 390 | casify_region (CASE_DOWN, beg, end); |
| @@ -406,7 +400,7 @@ With negative argument, capitalize previous words but do not move. */) | |||
| 406 | (Lisp_Object arg) | 400 | (Lisp_Object arg) |
| 407 | { | 401 | { |
| 408 | Lisp_Object beg, end; | 402 | Lisp_Object beg, end; |
| 409 | EMACS_INT newpoint; | 403 | ptrdiff_t newpoint; |
| 410 | XSETFASTINT (beg, PT); | 404 | XSETFASTINT (beg, PT); |
| 411 | end = operate_on_word (arg, &newpoint); | 405 | end = operate_on_word (arg, &newpoint); |
| 412 | casify_region (CASE_CAPITALIZE, beg, end); | 406 | casify_region (CASE_CAPITALIZE, beg, end); |
diff --git a/src/casetab.c b/src/casetab.c index 3433b313c03..6b639147b7b 100644 --- a/src/casetab.c +++ b/src/casetab.c | |||
| @@ -195,7 +195,7 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 195 | if (NATNUMP (elt)) | 195 | if (NATNUMP (elt)) |
| 196 | { | 196 | { |
| 197 | int from; | 197 | int from; |
| 198 | unsigned to; | 198 | int to; |
| 199 | 199 | ||
| 200 | if (CONSP (c)) | 200 | if (CONSP (c)) |
| 201 | { | 201 | { |
| @@ -204,7 +204,7 @@ set_identity (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 204 | } | 204 | } |
| 205 | else | 205 | else |
| 206 | from = to = XINT (c); | 206 | from = to = XINT (c); |
| 207 | for (to++; from < to; from++) | 207 | for (; from <= to; from++) |
| 208 | CHAR_TABLE_SET (table, from, make_number (from)); | 208 | CHAR_TABLE_SET (table, from, make_number (from)); |
| 209 | } | 209 | } |
| 210 | } | 210 | } |
| @@ -219,8 +219,7 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 219 | { | 219 | { |
| 220 | if (NATNUMP (elt)) | 220 | if (NATNUMP (elt)) |
| 221 | { | 221 | { |
| 222 | int from; | 222 | int from, to; |
| 223 | unsigned to; | ||
| 224 | 223 | ||
| 225 | if (CONSP (c)) | 224 | if (CONSP (c)) |
| 226 | { | 225 | { |
| @@ -230,7 +229,7 @@ shuffle (Lisp_Object table, Lisp_Object c, Lisp_Object elt) | |||
| 230 | else | 229 | else |
| 231 | from = to = XINT (c); | 230 | from = to = XINT (c); |
| 232 | 231 | ||
| 233 | for (to++; from < to; from++) | 232 | for (; from <= to; from++) |
| 234 | { | 233 | { |
| 235 | Lisp_Object tem = Faref (table, elt); | 234 | Lisp_Object tem = Faref (table, elt); |
| 236 | Faset (table, elt, make_number (from)); | 235 | Faset (table, elt, make_number (from)); |
diff --git a/src/category.c b/src/category.c index a822bb654b0..0ab2a70f8a4 100644 --- a/src/category.c +++ b/src/category.c | |||
| @@ -304,7 +304,7 @@ DEFUN ("char-category-set", Fchar_category_set, Schar_category_set, 1, 1, 0, | |||
| 304 | usage: (char-category-set CHAR) */) | 304 | usage: (char-category-set CHAR) */) |
| 305 | (Lisp_Object ch) | 305 | (Lisp_Object ch) |
| 306 | { | 306 | { |
| 307 | CHECK_NUMBER (ch); | 307 | CHECK_CHARACTER (ch); |
| 308 | return CATEGORY_SET (XFASTINT (ch)); | 308 | return CATEGORY_SET (XFASTINT (ch)); |
| 309 | } | 309 | } |
| 310 | 310 | ||
diff --git a/src/category.h b/src/category.h index 737198cc964..423270100b3 100644 --- a/src/category.h +++ b/src/category.h | |||
| @@ -53,8 +53,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 53 | The second extra slot is a version number of the category table. | 53 | The second extra slot is a version number of the category table. |
| 54 | But, for the moment, we are not using this slot. */ | 54 | But, for the moment, we are not using this slot. */ |
| 55 | 55 | ||
| 56 | #define CATEGORYP(x) \ | 56 | #define CATEGORYP(x) RANGED_INTEGERP (0x20, x, 0x7E) |
| 57 | (INTEGERP ((x)) && XFASTINT ((x)) >= 0x20 && XFASTINT ((x)) <= 0x7E) | ||
| 58 | 57 | ||
| 59 | #define CHECK_CATEGORY(x) \ | 58 | #define CHECK_CATEGORY(x) \ |
| 60 | CHECK_TYPE (CATEGORYP (x), Qcategoryp, x) | 59 | CHECK_TYPE (CATEGORYP (x), Qcategoryp, x) |
| @@ -762,9 +762,6 @@ while (0) | |||
| 762 | #define GET_CCL_CODE(code, ccl_prog, ic) \ | 762 | #define GET_CCL_CODE(code, ccl_prog, ic) \ |
| 763 | GET_CCL_RANGE (code, ccl_prog, ic, CCL_CODE_MIN, CCL_CODE_MAX) | 763 | GET_CCL_RANGE (code, ccl_prog, ic, CCL_CODE_MIN, CCL_CODE_MAX) |
| 764 | 764 | ||
| 765 | #define GET_CCL_INT(var, ccl_prog, ic) \ | ||
| 766 | GET_CCL_RANGE (var, ccl_prog, ic, INT_MIN, INT_MAX) | ||
| 767 | |||
| 768 | #define IN_INT_RANGE(val) ASCENDING_ORDER (INT_MIN, val, INT_MAX) | 765 | #define IN_INT_RANGE(val) ASCENDING_ORDER (INT_MIN, val, INT_MAX) |
| 769 | 766 | ||
| 770 | /* Encode one character CH to multibyte form and write to the current | 767 | /* Encode one character CH to multibyte form and write to the current |
| @@ -945,14 +942,14 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 945 | break; | 942 | break; |
| 946 | 943 | ||
| 947 | case CCL_SetConst: /* 00000000000000000000rrrXXXXX */ | 944 | case CCL_SetConst: /* 00000000000000000000rrrXXXXX */ |
| 948 | GET_CCL_INT (reg[rrr], ccl_prog, ic++); | 945 | reg[rrr] = XINT (ccl_prog[ic++]); |
| 949 | break; | 946 | break; |
| 950 | 947 | ||
| 951 | case CCL_SetArray: /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */ | 948 | case CCL_SetArray: /* CCCCCCCCCCCCCCCCCCCCRRRrrrXXXXX */ |
| 952 | i = reg[RRR]; | 949 | i = reg[RRR]; |
| 953 | j = field1 >> 3; | 950 | j = field1 >> 3; |
| 954 | if (0 <= i && i < j) | 951 | if (0 <= i && i < j) |
| 955 | GET_CCL_INT (reg[rrr], ccl_prog, ic + i); | 952 | reg[rrr] = XINT (ccl_prog[ic + i]); |
| 956 | ic += j; | 953 | ic += j; |
| 957 | break; | 954 | break; |
| 958 | 955 | ||
| @@ -980,13 +977,13 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 980 | break; | 977 | break; |
| 981 | 978 | ||
| 982 | case CCL_WriteConstJump: /* A--D--D--R--E--S--S-000XXXXX */ | 979 | case CCL_WriteConstJump: /* A--D--D--R--E--S--S-000XXXXX */ |
| 983 | GET_CCL_INT (i, ccl_prog, ic); | 980 | i = XINT (ccl_prog[ic]); |
| 984 | CCL_WRITE_CHAR (i); | 981 | CCL_WRITE_CHAR (i); |
| 985 | ic += ADDR; | 982 | ic += ADDR; |
| 986 | break; | 983 | break; |
| 987 | 984 | ||
| 988 | case CCL_WriteConstReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ | 985 | case CCL_WriteConstReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ |
| 989 | GET_CCL_INT (i, ccl_prog, ic); | 986 | i = XINT (ccl_prog[ic]); |
| 990 | CCL_WRITE_CHAR (i); | 987 | CCL_WRITE_CHAR (i); |
| 991 | ic++; | 988 | ic++; |
| 992 | CCL_READ_CHAR (reg[rrr]); | 989 | CCL_READ_CHAR (reg[rrr]); |
| @@ -994,17 +991,17 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 994 | break; | 991 | break; |
| 995 | 992 | ||
| 996 | case CCL_WriteStringJump: /* A--D--D--R--E--S--S-000XXXXX */ | 993 | case CCL_WriteStringJump: /* A--D--D--R--E--S--S-000XXXXX */ |
| 997 | GET_CCL_INT (j, ccl_prog, ic++); | 994 | j = XINT (ccl_prog[ic++]); |
| 998 | CCL_WRITE_STRING (j); | 995 | CCL_WRITE_STRING (j); |
| 999 | ic += ADDR - 1; | 996 | ic += ADDR - 1; |
| 1000 | break; | 997 | break; |
| 1001 | 998 | ||
| 1002 | case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ | 999 | case CCL_WriteArrayReadJump: /* A--D--D--R--E--S--S-rrrXXXXX */ |
| 1003 | i = reg[rrr]; | 1000 | i = reg[rrr]; |
| 1004 | GET_CCL_INT (j, ccl_prog, ic); | 1001 | j = XINT (ccl_prog[ic]); |
| 1005 | if (0 <= i && i < j) | 1002 | if (0 <= i && i < j) |
| 1006 | { | 1003 | { |
| 1007 | GET_CCL_INT (i, ccl_prog, ic + 1 + i); | 1004 | i = XINT (ccl_prog[ic + 1 + i]); |
| 1008 | CCL_WRITE_CHAR (i); | 1005 | CCL_WRITE_CHAR (i); |
| 1009 | } | 1006 | } |
| 1010 | ic += j + 2; | 1007 | ic += j + 2; |
| @@ -1022,11 +1019,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1022 | /* fall through ... */ | 1019 | /* fall through ... */ |
| 1023 | case CCL_Branch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ | 1020 | case CCL_Branch: /* CCCCCCCCCCCCCCCCCCCCrrrXXXXX */ |
| 1024 | { | 1021 | { |
| 1025 | int incr; | 1022 | int ioff = 0 <= reg[rrr] && reg[rrr] < field1 ? reg[rrr] : field1; |
| 1026 | GET_CCL_INT (incr, ccl_prog, | 1023 | int incr = XINT (ccl_prog[ic + ioff]); |
| 1027 | ic + (0 <= reg[rrr] && reg[rrr] < field1 | ||
| 1028 | ? reg[rrr] | ||
| 1029 | : field1)); | ||
| 1030 | ic += incr; | 1024 | ic += incr; |
| 1031 | } | 1025 | } |
| 1032 | break; | 1026 | break; |
| @@ -1045,7 +1039,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1045 | case CCL_WriteExprConst: /* 1:00000OPERATION000RRR000XXXXX */ | 1039 | case CCL_WriteExprConst: /* 1:00000OPERATION000RRR000XXXXX */ |
| 1046 | rrr = 7; | 1040 | rrr = 7; |
| 1047 | i = reg[RRR]; | 1041 | i = reg[RRR]; |
| 1048 | GET_CCL_INT (j, ccl_prog, ic); | 1042 | j = XINT (ccl_prog[ic]); |
| 1049 | op = field1 >> 6; | 1043 | op = field1 >> 6; |
| 1050 | jump_address = ic + 1; | 1044 | jump_address = ic + 1; |
| 1051 | goto ccl_set_expr; | 1045 | goto ccl_set_expr; |
| @@ -1078,7 +1072,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1078 | /* If FFF is nonzero, the CCL program ID is in the | 1072 | /* If FFF is nonzero, the CCL program ID is in the |
| 1079 | following code. */ | 1073 | following code. */ |
| 1080 | if (rrr) | 1074 | if (rrr) |
| 1081 | GET_CCL_INT (prog_id, ccl_prog, ic++); | 1075 | prog_id = XINT (ccl_prog[ic++]); |
| 1082 | else | 1076 | else |
| 1083 | prog_id = field1; | 1077 | prog_id = field1; |
| 1084 | 1078 | ||
| @@ -1121,7 +1115,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1121 | i = reg[rrr]; | 1115 | i = reg[rrr]; |
| 1122 | if (0 <= i && i < field1) | 1116 | if (0 <= i && i < field1) |
| 1123 | { | 1117 | { |
| 1124 | GET_CCL_INT (j, ccl_prog, ic + i); | 1118 | j = XINT (ccl_prog[ic + i]); |
| 1125 | CCL_WRITE_CHAR (j); | 1119 | CCL_WRITE_CHAR (j); |
| 1126 | } | 1120 | } |
| 1127 | ic += field1; | 1121 | ic += field1; |
| @@ -1146,7 +1140,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1146 | CCL_SUCCESS; | 1140 | CCL_SUCCESS; |
| 1147 | 1141 | ||
| 1148 | case CCL_ExprSelfConst: /* 00000OPERATION000000rrrXXXXX */ | 1142 | case CCL_ExprSelfConst: /* 00000OPERATION000000rrrXXXXX */ |
| 1149 | GET_CCL_INT (i, ccl_prog, ic++); | 1143 | i = XINT (ccl_prog[ic++]); |
| 1150 | op = field1 >> 6; | 1144 | op = field1 >> 6; |
| 1151 | goto ccl_expr_self; | 1145 | goto ccl_expr_self; |
| 1152 | 1146 | ||
| @@ -1182,7 +1176,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1182 | 1176 | ||
| 1183 | case CCL_SetExprConst: /* 00000OPERATION000RRRrrrXXXXX */ | 1177 | case CCL_SetExprConst: /* 00000OPERATION000RRRrrrXXXXX */ |
| 1184 | i = reg[RRR]; | 1178 | i = reg[RRR]; |
| 1185 | GET_CCL_INT (j, ccl_prog, ic++); | 1179 | j = XINT (ccl_prog[ic++]); |
| 1186 | op = field1 >> 6; | 1180 | op = field1 >> 6; |
| 1187 | jump_address = ic; | 1181 | jump_address = ic; |
| 1188 | goto ccl_set_expr; | 1182 | goto ccl_set_expr; |
| @@ -1199,8 +1193,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1199 | case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */ | 1193 | case CCL_JumpCondExprConst: /* A--D--D--R--E--S--S-rrrXXXXX */ |
| 1200 | i = reg[rrr]; | 1194 | i = reg[rrr]; |
| 1201 | jump_address = ic + ADDR; | 1195 | jump_address = ic + ADDR; |
| 1202 | GET_CCL_INT (op, ccl_prog, ic++); | 1196 | op = XINT (ccl_prog[ic++]); |
| 1203 | GET_CCL_INT (j, ccl_prog, ic++); | 1197 | j = XINT (ccl_prog[ic++]); |
| 1204 | rrr = 7; | 1198 | rrr = 7; |
| 1205 | goto ccl_set_expr; | 1199 | goto ccl_set_expr; |
| 1206 | 1200 | ||
| @@ -1209,7 +1203,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1209 | case CCL_JumpCondExprReg: | 1203 | case CCL_JumpCondExprReg: |
| 1210 | i = reg[rrr]; | 1204 | i = reg[rrr]; |
| 1211 | jump_address = ic + ADDR; | 1205 | jump_address = ic + ADDR; |
| 1212 | GET_CCL_INT (op, ccl_prog, ic++); | 1206 | op = XINT (ccl_prog[ic++]); |
| 1213 | GET_CCL_RANGE (j, ccl_prog, ic++, 0, 7); | 1207 | GET_CCL_RANGE (j, ccl_prog, ic++, 0, 7); |
| 1214 | j = reg[j]; | 1208 | j = reg[j]; |
| 1215 | rrr = 7; | 1209 | rrr = 7; |
| @@ -1290,7 +1284,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1290 | 1284 | ||
| 1291 | case CCL_TranslateCharacterConstTbl: | 1285 | case CCL_TranslateCharacterConstTbl: |
| 1292 | { | 1286 | { |
| 1293 | EMACS_INT eop; | 1287 | ptrdiff_t eop; |
| 1294 | GET_CCL_RANGE (eop, ccl_prog, ic++, 0, | 1288 | GET_CCL_RANGE (eop, ccl_prog, ic++, 0, |
| 1295 | (VECTORP (Vtranslation_table_vector) | 1289 | (VECTORP (Vtranslation_table_vector) |
| 1296 | ? ASIZE (Vtranslation_table_vector) | 1290 | ? ASIZE (Vtranslation_table_vector) |
| @@ -1356,10 +1350,11 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1356 | case CCL_IterateMultipleMap: | 1350 | case CCL_IterateMultipleMap: |
| 1357 | { | 1351 | { |
| 1358 | Lisp_Object map, content, attrib, value; | 1352 | Lisp_Object map, content, attrib, value; |
| 1359 | EMACS_INT point, size; | 1353 | EMACS_INT point; |
| 1354 | ptrdiff_t size; | ||
| 1360 | int fin_ic; | 1355 | int fin_ic; |
| 1361 | 1356 | ||
| 1362 | GET_CCL_INT (j, ccl_prog, ic++); /* number of maps. */ | 1357 | j = XINT (ccl_prog[ic++]); /* number of maps. */ |
| 1363 | fin_ic = ic + j; | 1358 | fin_ic = ic + j; |
| 1364 | op = reg[rrr]; | 1359 | op = reg[rrr]; |
| 1365 | if ((j > reg[RRR]) && (j >= 0)) | 1360 | if ((j > reg[RRR]) && (j >= 0)) |
| @@ -1471,7 +1466,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1471 | stack_idx_of_map_multiple = 0; | 1466 | stack_idx_of_map_multiple = 0; |
| 1472 | 1467 | ||
| 1473 | /* Get number of maps and separators. */ | 1468 | /* Get number of maps and separators. */ |
| 1474 | GET_CCL_INT (map_set_rest_length, ccl_prog, ic++); | 1469 | map_set_rest_length = XINT (ccl_prog[ic++]); |
| 1475 | 1470 | ||
| 1476 | fin_ic = ic + map_set_rest_length; | 1471 | fin_ic = ic + map_set_rest_length; |
| 1477 | op = reg[rrr]; | 1472 | op = reg[rrr]; |
| @@ -1540,7 +1535,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1540 | do { | 1535 | do { |
| 1541 | for (;map_set_rest_length > 0;i++, ic++, map_set_rest_length--) | 1536 | for (;map_set_rest_length > 0;i++, ic++, map_set_rest_length--) |
| 1542 | { | 1537 | { |
| 1543 | GET_CCL_INT (point, ccl_prog, ic); | 1538 | point = XINT (ccl_prog[ic]); |
| 1544 | if (point < 0) | 1539 | if (point < 0) |
| 1545 | { | 1540 | { |
| 1546 | /* +1 is for including separator. */ | 1541 | /* +1 is for including separator. */ |
| @@ -1677,20 +1672,20 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1677 | reg[RRR] = -1; | 1672 | reg[RRR] = -1; |
| 1678 | break; | 1673 | break; |
| 1679 | } | 1674 | } |
| 1680 | point = XINT (AREF (map, 0)); | 1675 | point = op - XINT (AREF (map, 0)) + 1; |
| 1681 | point = op - point + 1; | ||
| 1682 | reg[RRR] = 0; | 1676 | reg[RRR] = 0; |
| 1683 | content = AREF (map, point); | 1677 | content = AREF (map, point); |
| 1684 | if (NILP (content)) | 1678 | if (NILP (content)) |
| 1685 | reg[RRR] = -1; | 1679 | reg[RRR] = -1; |
| 1686 | else if (INTEGERP (content)) | 1680 | else if (TYPE_RANGED_INTEGERP (int, content)) |
| 1687 | reg[rrr] = XINT (content); | 1681 | reg[rrr] = XINT (content); |
| 1688 | else if (EQ (content, Qt)); | 1682 | else if (EQ (content, Qt)); |
| 1689 | else if (CONSP (content)) | 1683 | else if (CONSP (content)) |
| 1690 | { | 1684 | { |
| 1691 | attrib = XCAR (content); | 1685 | attrib = XCAR (content); |
| 1692 | value = XCDR (content); | 1686 | value = XCDR (content); |
| 1693 | if (!INTEGERP (attrib) || !INTEGERP (value)) | 1687 | if (!INTEGERP (attrib) |
| 1688 | || !TYPE_RANGED_INTEGERP (int, value)) | ||
| 1694 | continue; | 1689 | continue; |
| 1695 | reg[rrr] = XINT (value); | 1690 | reg[rrr] = XINT (value); |
| 1696 | break; | 1691 | break; |
| @@ -1810,8 +1805,8 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size | |||
| 1810 | function converts symbols of code conversion maps and character | 1805 | function converts symbols of code conversion maps and character |
| 1811 | translation tables embeded in the CCL code into their ID numbers. | 1806 | translation tables embeded in the CCL code into their ID numbers. |
| 1812 | 1807 | ||
| 1813 | The return value is a vector (CCL itself or a new vector in which | 1808 | The return value is a new vector in which all symbols are resolved, |
| 1814 | all symbols are resolved), Qt if resolving of some symbol failed, | 1809 | Qt if resolving of some symbol failed, |
| 1815 | or nil if CCL contains invalid data. */ | 1810 | or nil if CCL contains invalid data. */ |
| 1816 | 1811 | ||
| 1817 | static Lisp_Object | 1812 | static Lisp_Object |
| @@ -1820,13 +1815,15 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1820 | int i, veclen, unresolved = 0; | 1815 | int i, veclen, unresolved = 0; |
| 1821 | Lisp_Object result, contents, val; | 1816 | Lisp_Object result, contents, val; |
| 1822 | 1817 | ||
| 1823 | result = ccl; | 1818 | if (! (CCL_HEADER_MAIN < ASIZE (ccl) && ASIZE (ccl) <= INT_MAX)) |
| 1819 | return Qnil; | ||
| 1820 | result = Fcopy_sequence (ccl); | ||
| 1824 | veclen = ASIZE (result); | 1821 | veclen = ASIZE (result); |
| 1825 | 1822 | ||
| 1826 | for (i = 0; i < veclen; i++) | 1823 | for (i = 0; i < veclen; i++) |
| 1827 | { | 1824 | { |
| 1828 | contents = AREF (result, i); | 1825 | contents = AREF (result, i); |
| 1829 | if (INTEGERP (contents)) | 1826 | if (TYPE_RANGED_INTEGERP (int, contents)) |
| 1830 | continue; | 1827 | continue; |
| 1831 | else if (CONSP (contents) | 1828 | else if (CONSP (contents) |
| 1832 | && SYMBOLP (XCAR (contents)) | 1829 | && SYMBOLP (XCAR (contents)) |
| @@ -1835,12 +1832,8 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1835 | /* This is the new style for embedding symbols. The form is | 1832 | /* This is the new style for embedding symbols. The form is |
| 1836 | (SYMBOL . PROPERTY). (get SYMBOL PROPERTY) should give | 1833 | (SYMBOL . PROPERTY). (get SYMBOL PROPERTY) should give |
| 1837 | an index number. */ | 1834 | an index number. */ |
| 1838 | |||
| 1839 | if (EQ (result, ccl)) | ||
| 1840 | result = Fcopy_sequence (ccl); | ||
| 1841 | |||
| 1842 | val = Fget (XCAR (contents), XCDR (contents)); | 1835 | val = Fget (XCAR (contents), XCDR (contents)); |
| 1843 | if (NATNUMP (val)) | 1836 | if (RANGED_INTEGERP (0, val, INT_MAX)) |
| 1844 | ASET (result, i, val); | 1837 | ASET (result, i, val); |
| 1845 | else | 1838 | else |
| 1846 | unresolved = 1; | 1839 | unresolved = 1; |
| @@ -1851,21 +1844,18 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1851 | /* This is the old style for embedding symbols. This style | 1844 | /* This is the old style for embedding symbols. This style |
| 1852 | may lead to a bug if, for instance, a translation table | 1845 | may lead to a bug if, for instance, a translation table |
| 1853 | and a code conversion map have the same name. */ | 1846 | and a code conversion map have the same name. */ |
| 1854 | if (EQ (result, ccl)) | ||
| 1855 | result = Fcopy_sequence (ccl); | ||
| 1856 | |||
| 1857 | val = Fget (contents, Qtranslation_table_id); | 1847 | val = Fget (contents, Qtranslation_table_id); |
| 1858 | if (NATNUMP (val)) | 1848 | if (RANGED_INTEGERP (0, val, INT_MAX)) |
| 1859 | ASET (result, i, val); | 1849 | ASET (result, i, val); |
| 1860 | else | 1850 | else |
| 1861 | { | 1851 | { |
| 1862 | val = Fget (contents, Qcode_conversion_map_id); | 1852 | val = Fget (contents, Qcode_conversion_map_id); |
| 1863 | if (NATNUMP (val)) | 1853 | if (RANGED_INTEGERP (0, val, INT_MAX)) |
| 1864 | ASET (result, i, val); | 1854 | ASET (result, i, val); |
| 1865 | else | 1855 | else |
| 1866 | { | 1856 | { |
| 1867 | val = Fget (contents, Qccl_program_idx); | 1857 | val = Fget (contents, Qccl_program_idx); |
| 1868 | if (NATNUMP (val)) | 1858 | if (RANGED_INTEGERP (0, val, INT_MAX)) |
| 1869 | ASET (result, i, val); | 1859 | ASET (result, i, val); |
| 1870 | else | 1860 | else |
| 1871 | unresolved = 1; | 1861 | unresolved = 1; |
| @@ -1876,6 +1866,11 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1876 | return Qnil; | 1866 | return Qnil; |
| 1877 | } | 1867 | } |
| 1878 | 1868 | ||
| 1869 | if (! (0 <= XINT (AREF (result, CCL_HEADER_BUF_MAG)) | ||
| 1870 | && ASCENDING_ORDER (0, XINT (AREF (result, CCL_HEADER_EOF)), | ||
| 1871 | ASIZE (ccl)))) | ||
| 1872 | return Qnil; | ||
| 1873 | |||
| 1879 | return (unresolved ? Qt : result); | 1874 | return (unresolved ? Qt : result); |
| 1880 | } | 1875 | } |
| 1881 | 1876 | ||
| @@ -1886,7 +1881,7 @@ resolve_symbol_ccl_program (Lisp_Object ccl) | |||
| 1886 | symbols, return Qnil. */ | 1881 | symbols, return Qnil. */ |
| 1887 | 1882 | ||
| 1888 | static Lisp_Object | 1883 | static Lisp_Object |
| 1889 | ccl_get_compiled_code (Lisp_Object ccl_prog, int *idx) | 1884 | ccl_get_compiled_code (Lisp_Object ccl_prog, ptrdiff_t *idx) |
| 1890 | { | 1885 | { |
| 1891 | Lisp_Object val, slot; | 1886 | Lisp_Object val, slot; |
| 1892 | 1887 | ||
| @@ -2015,7 +2010,7 @@ programs. */) | |||
| 2015 | error ("Length of vector REGISTERS is not 8"); | 2010 | error ("Length of vector REGISTERS is not 8"); |
| 2016 | 2011 | ||
| 2017 | for (i = 0; i < 8; i++) | 2012 | for (i = 0; i < 8; i++) |
| 2018 | ccl.reg[i] = (INTEGERP (AREF (reg, i)) | 2013 | ccl.reg[i] = (TYPE_RANGED_INTEGERP (int, AREF (reg, i)) |
| 2019 | ? XINT (AREF (reg, i)) | 2014 | ? XINT (AREF (reg, i)) |
| 2020 | : 0); | 2015 | : 0); |
| 2021 | 2016 | ||
| @@ -2084,7 +2079,7 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY | |||
| 2084 | { | 2079 | { |
| 2085 | if (NILP (AREF (status, i))) | 2080 | if (NILP (AREF (status, i))) |
| 2086 | ASET (status, i, make_number (0)); | 2081 | ASET (status, i, make_number (0)); |
| 2087 | if (INTEGERP (AREF (status, i))) | 2082 | if (TYPE_RANGED_INTEGERP (int, AREF (status, i))) |
| 2088 | ccl.reg[i] = XINT (AREF (status, i)); | 2083 | ccl.reg[i] = XINT (AREF (status, i)); |
| 2089 | } | 2084 | } |
| 2090 | if (INTEGERP (AREF (status, i))) | 2085 | if (INTEGERP (AREF (status, i))) |
| @@ -2187,8 +2182,8 @@ If it is nil, just reserve NAME as a CCL program name. | |||
| 2187 | Return index number of the registered CCL program. */) | 2182 | Return index number of the registered CCL program. */) |
| 2188 | (Lisp_Object name, Lisp_Object ccl_prog) | 2183 | (Lisp_Object name, Lisp_Object ccl_prog) |
| 2189 | { | 2184 | { |
| 2190 | int len = ASIZE (Vccl_program_table); | 2185 | ptrdiff_t len = ASIZE (Vccl_program_table); |
| 2191 | int idx; | 2186 | ptrdiff_t idx; |
| 2192 | Lisp_Object resolved; | 2187 | Lisp_Object resolved; |
| 2193 | 2188 | ||
| 2194 | CHECK_SYMBOL (name); | 2189 | CHECK_SYMBOL (name); |
| @@ -2229,7 +2224,7 @@ Return index number of the registered CCL program. */) | |||
| 2229 | 2224 | ||
| 2230 | if (idx == len) | 2225 | if (idx == len) |
| 2231 | /* Extend the table. */ | 2226 | /* Extend the table. */ |
| 2232 | Vccl_program_table = larger_vector (Vccl_program_table, len * 2, Qnil); | 2227 | Vccl_program_table = larger_vector (Vccl_program_table, 1, -1); |
| 2233 | 2228 | ||
| 2234 | { | 2229 | { |
| 2235 | Lisp_Object elt; | 2230 | Lisp_Object elt; |
| @@ -2262,8 +2257,8 @@ DEFUN ("register-code-conversion-map", Fregister_code_conversion_map, | |||
| 2262 | Return index number of the registered map. */) | 2257 | Return index number of the registered map. */) |
| 2263 | (Lisp_Object symbol, Lisp_Object map) | 2258 | (Lisp_Object symbol, Lisp_Object map) |
| 2264 | { | 2259 | { |
| 2265 | int len = ASIZE (Vcode_conversion_map_vector); | 2260 | ptrdiff_t len = ASIZE (Vcode_conversion_map_vector); |
| 2266 | int i; | 2261 | ptrdiff_t i; |
| 2267 | Lisp_Object idx; | 2262 | Lisp_Object idx; |
| 2268 | 2263 | ||
| 2269 | CHECK_SYMBOL (symbol); | 2264 | CHECK_SYMBOL (symbol); |
| @@ -2288,7 +2283,7 @@ Return index number of the registered map. */) | |||
| 2288 | 2283 | ||
| 2289 | if (i == len) | 2284 | if (i == len) |
| 2290 | Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector, | 2285 | Vcode_conversion_map_vector = larger_vector (Vcode_conversion_map_vector, |
| 2291 | len * 2, Qnil); | 2286 | 1, -1); |
| 2292 | 2287 | ||
| 2293 | idx = make_number (i); | 2288 | idx = make_number (i); |
| 2294 | Fput (symbol, Qcode_conversion_map, map); | 2289 | Fput (symbol, Qcode_conversion_map, map); |
| @@ -37,7 +37,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 37 | /* Structure to hold information about running CCL code. Read | 37 | /* Structure to hold information about running CCL code. Read |
| 38 | comments in the file ccl.c for the detail of each field. */ | 38 | comments in the file ccl.c for the detail of each field. */ |
| 39 | struct ccl_program { | 39 | struct ccl_program { |
| 40 | int idx; /* Index number of the CCL program. | 40 | ptrdiff_t idx; /* Index number of the CCL program. |
| 41 | -1 means that the program was given | 41 | -1 means that the program was given |
| 42 | by a vector, not by a program | 42 | by a vector, not by a program |
| 43 | name. */ | 43 | name. */ |
diff --git a/src/character.c b/src/character.c index fb9b8a9b93e..1e8c75d2597 100644 --- a/src/character.c +++ b/src/character.c | |||
| @@ -67,8 +67,8 @@ static Lisp_Object Qchar_script_table; | |||
| 67 | /* If character code C has modifier masks, reflect them to the | 67 | /* If character code C has modifier masks, reflect them to the |
| 68 | character code if possible. Return the resulting code. */ | 68 | character code if possible. Return the resulting code. */ |
| 69 | 69 | ||
| 70 | int | 70 | EMACS_INT |
| 71 | char_resolve_modifier_mask (int c) | 71 | char_resolve_modifier_mask (EMACS_INT c) |
| 72 | { | 72 | { |
| 73 | /* A non-ASCII character can't reflect modifier bits to the code. */ | 73 | /* A non-ASCII character can't reflect modifier bits to the code. */ |
| 74 | if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) | 74 | if (! ASCII_CHAR_P ((c & ~CHAR_MODIFIER_MASK))) |
| @@ -340,12 +340,12 @@ usage: (char-width CHAR) */) | |||
| 340 | characters and bytes of the substring in *NCHARS and *NBYTES | 340 | characters and bytes of the substring in *NCHARS and *NBYTES |
| 341 | respectively. */ | 341 | respectively. */ |
| 342 | 342 | ||
| 343 | EMACS_INT | 343 | ptrdiff_t |
| 344 | c_string_width (const unsigned char *str, EMACS_INT len, int precision, | 344 | c_string_width (const unsigned char *str, ptrdiff_t len, int precision, |
| 345 | EMACS_INT *nchars, EMACS_INT *nbytes) | 345 | ptrdiff_t *nchars, ptrdiff_t *nbytes) |
| 346 | { | 346 | { |
| 347 | EMACS_INT i = 0, i_byte = 0; | 347 | ptrdiff_t i = 0, i_byte = 0; |
| 348 | EMACS_INT width = 0; | 348 | ptrdiff_t width = 0; |
| 349 | struct Lisp_Char_Table *dp = buffer_display_table (); | 349 | struct Lisp_Char_Table *dp = buffer_display_table (); |
| 350 | 350 | ||
| 351 | while (i_byte < len) | 351 | while (i_byte < len) |
| @@ -392,8 +392,8 @@ c_string_width (const unsigned char *str, EMACS_INT len, int precision, | |||
| 392 | current buffer. The width is measured by how many columns it | 392 | current buffer. The width is measured by how many columns it |
| 393 | occupies on the screen. */ | 393 | occupies on the screen. */ |
| 394 | 394 | ||
| 395 | EMACS_INT | 395 | ptrdiff_t |
| 396 | strwidth (const char *str, EMACS_INT len) | 396 | strwidth (const char *str, ptrdiff_t len) |
| 397 | { | 397 | { |
| 398 | return c_string_width ((const unsigned char *) str, len, -1, NULL, NULL); | 398 | return c_string_width ((const unsigned char *) str, len, -1, NULL, NULL); |
| 399 | } | 399 | } |
| @@ -405,26 +405,26 @@ strwidth (const char *str, EMACS_INT len) | |||
| 405 | PRECISION, and set number of characters and bytes of the substring | 405 | PRECISION, and set number of characters and bytes of the substring |
| 406 | in *NCHARS and *NBYTES respectively. */ | 406 | in *NCHARS and *NBYTES respectively. */ |
| 407 | 407 | ||
| 408 | EMACS_INT | 408 | ptrdiff_t |
| 409 | lisp_string_width (Lisp_Object string, EMACS_INT precision, | 409 | lisp_string_width (Lisp_Object string, ptrdiff_t precision, |
| 410 | EMACS_INT *nchars, EMACS_INT *nbytes) | 410 | ptrdiff_t *nchars, ptrdiff_t *nbytes) |
| 411 | { | 411 | { |
| 412 | EMACS_INT len = SCHARS (string); | 412 | ptrdiff_t len = SCHARS (string); |
| 413 | /* This set multibyte to 0 even if STRING is multibyte when it | 413 | /* This set multibyte to 0 even if STRING is multibyte when it |
| 414 | contains only ascii and eight-bit-graphic, but that's | 414 | contains only ascii and eight-bit-graphic, but that's |
| 415 | intentional. */ | 415 | intentional. */ |
| 416 | int multibyte = len < SBYTES (string); | 416 | int multibyte = len < SBYTES (string); |
| 417 | unsigned char *str = SDATA (string); | 417 | unsigned char *str = SDATA (string); |
| 418 | EMACS_INT i = 0, i_byte = 0; | 418 | ptrdiff_t i = 0, i_byte = 0; |
| 419 | EMACS_INT width = 0; | 419 | ptrdiff_t width = 0; |
| 420 | struct Lisp_Char_Table *dp = buffer_display_table (); | 420 | struct Lisp_Char_Table *dp = buffer_display_table (); |
| 421 | 421 | ||
| 422 | while (i < len) | 422 | while (i < len) |
| 423 | { | 423 | { |
| 424 | EMACS_INT chars, bytes, thiswidth; | 424 | ptrdiff_t chars, bytes, thiswidth; |
| 425 | Lisp_Object val; | 425 | Lisp_Object val; |
| 426 | ptrdiff_t cmp_id; | 426 | ptrdiff_t cmp_id; |
| 427 | EMACS_INT ignore, end; | 427 | ptrdiff_t ignore, end; |
| 428 | 428 | ||
| 429 | if (find_composition (i, -1, &ignore, &end, &val, string) | 429 | if (find_composition (i, -1, &ignore, &end, &val, string) |
| 430 | && ((cmp_id = get_composition_id (i, i_byte, end - i, val, string)) | 430 | && ((cmp_id = get_composition_id (i, i_byte, end - i, val, string)) |
| @@ -511,8 +511,8 @@ usage: (string-width STRING) */) | |||
| 511 | However, if the current buffer has enable-multibyte-characters = | 511 | However, if the current buffer has enable-multibyte-characters = |
| 512 | nil, we treat each byte as a character. */ | 512 | nil, we treat each byte as a character. */ |
| 513 | 513 | ||
| 514 | EMACS_INT | 514 | ptrdiff_t |
| 515 | chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) | 515 | chars_in_text (const unsigned char *ptr, ptrdiff_t nbytes) |
| 516 | { | 516 | { |
| 517 | /* current_buffer is null at early stages of Emacs initialization. */ | 517 | /* current_buffer is null at early stages of Emacs initialization. */ |
| 518 | if (current_buffer == 0 | 518 | if (current_buffer == 0 |
| @@ -527,15 +527,15 @@ chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) | |||
| 527 | sequences while assuming that there's no invalid sequence. It | 527 | sequences while assuming that there's no invalid sequence. It |
| 528 | ignores enable-multibyte-characters. */ | 528 | ignores enable-multibyte-characters. */ |
| 529 | 529 | ||
| 530 | EMACS_INT | 530 | ptrdiff_t |
| 531 | multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) | 531 | multibyte_chars_in_text (const unsigned char *ptr, ptrdiff_t nbytes) |
| 532 | { | 532 | { |
| 533 | const unsigned char *endp = ptr + nbytes; | 533 | const unsigned char *endp = ptr + nbytes; |
| 534 | EMACS_INT chars = 0; | 534 | ptrdiff_t chars = 0; |
| 535 | 535 | ||
| 536 | while (ptr < endp) | 536 | while (ptr < endp) |
| 537 | { | 537 | { |
| 538 | EMACS_INT len = MULTIBYTE_LENGTH (ptr, endp); | 538 | int len = MULTIBYTE_LENGTH (ptr, endp); |
| 539 | 539 | ||
| 540 | if (len == 0) | 540 | if (len == 0) |
| 541 | abort (); | 541 | abort (); |
| @@ -553,11 +553,12 @@ multibyte_chars_in_text (const unsigned char *ptr, EMACS_INT nbytes) | |||
| 553 | represented by 2-byte in a multibyte text. */ | 553 | represented by 2-byte in a multibyte text. */ |
| 554 | 554 | ||
| 555 | void | 555 | void |
| 556 | parse_str_as_multibyte (const unsigned char *str, EMACS_INT len, | 556 | parse_str_as_multibyte (const unsigned char *str, ptrdiff_t len, |
| 557 | EMACS_INT *nchars, EMACS_INT *nbytes) | 557 | ptrdiff_t *nchars, ptrdiff_t *nbytes) |
| 558 | { | 558 | { |
| 559 | const unsigned char *endp = str + len; | 559 | const unsigned char *endp = str + len; |
| 560 | EMACS_INT n, chars = 0, bytes = 0; | 560 | int n; |
| 561 | ptrdiff_t chars = 0, bytes = 0; | ||
| 561 | 562 | ||
| 562 | if (len >= MAX_MULTIBYTE_LENGTH) | 563 | if (len >= MAX_MULTIBYTE_LENGTH) |
| 563 | { | 564 | { |
| @@ -595,13 +596,13 @@ parse_str_as_multibyte (const unsigned char *str, EMACS_INT len, | |||
| 595 | area and that is enough. Return the number of bytes of the | 596 | area and that is enough. Return the number of bytes of the |
| 596 | resulting text. */ | 597 | resulting text. */ |
| 597 | 598 | ||
| 598 | EMACS_INT | 599 | ptrdiff_t |
| 599 | str_as_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT nbytes, | 600 | str_as_multibyte (unsigned char *str, ptrdiff_t len, ptrdiff_t nbytes, |
| 600 | EMACS_INT *nchars) | 601 | ptrdiff_t *nchars) |
| 601 | { | 602 | { |
| 602 | unsigned char *p = str, *endp = str + nbytes; | 603 | unsigned char *p = str, *endp = str + nbytes; |
| 603 | unsigned char *to; | 604 | unsigned char *to; |
| 604 | EMACS_INT chars = 0; | 605 | ptrdiff_t chars = 0; |
| 605 | int n; | 606 | int n; |
| 606 | 607 | ||
| 607 | if (nbytes >= MAX_MULTIBYTE_LENGTH) | 608 | if (nbytes >= MAX_MULTIBYTE_LENGTH) |
| @@ -672,11 +673,11 @@ str_as_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT nbytes, | |||
| 672 | bytes it may ocupy when converted to multibyte string by | 673 | bytes it may ocupy when converted to multibyte string by |
| 673 | `str_to_multibyte'. */ | 674 | `str_to_multibyte'. */ |
| 674 | 675 | ||
| 675 | EMACS_INT | 676 | ptrdiff_t |
| 676 | count_size_as_multibyte (const unsigned char *str, EMACS_INT len) | 677 | count_size_as_multibyte (const unsigned char *str, ptrdiff_t len) |
| 677 | { | 678 | { |
| 678 | const unsigned char *endp = str + len; | 679 | const unsigned char *endp = str + len; |
| 679 | EMACS_INT bytes; | 680 | ptrdiff_t bytes; |
| 680 | 681 | ||
| 681 | for (bytes = 0; str < endp; str++) | 682 | for (bytes = 0; str < endp; str++) |
| 682 | { | 683 | { |
| @@ -695,8 +696,8 @@ count_size_as_multibyte (const unsigned char *str, EMACS_INT len) | |||
| 695 | that we can use LEN bytes at STR as a work area and that is | 696 | that we can use LEN bytes at STR as a work area and that is |
| 696 | enough. */ | 697 | enough. */ |
| 697 | 698 | ||
| 698 | EMACS_INT | 699 | ptrdiff_t |
| 699 | str_to_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT bytes) | 700 | str_to_multibyte (unsigned char *str, ptrdiff_t len, ptrdiff_t bytes) |
| 700 | { | 701 | { |
| 701 | unsigned char *p = str, *endp = str + bytes; | 702 | unsigned char *p = str, *endp = str + bytes; |
| 702 | unsigned char *to; | 703 | unsigned char *to; |
| @@ -724,8 +725,8 @@ str_to_multibyte (unsigned char *str, EMACS_INT len, EMACS_INT bytes) | |||
| 724 | actually converts characters in the range 0x80..0xFF to | 725 | actually converts characters in the range 0x80..0xFF to |
| 725 | unibyte. */ | 726 | unibyte. */ |
| 726 | 727 | ||
| 727 | EMACS_INT | 728 | ptrdiff_t |
| 728 | str_as_unibyte (unsigned char *str, EMACS_INT bytes) | 729 | str_as_unibyte (unsigned char *str, ptrdiff_t bytes) |
| 729 | { | 730 | { |
| 730 | const unsigned char *p = str, *endp = str + bytes; | 731 | const unsigned char *p = str, *endp = str + bytes; |
| 731 | unsigned char *to; | 732 | unsigned char *to; |
| @@ -766,10 +767,10 @@ str_as_unibyte (unsigned char *str, EMACS_INT bytes) | |||
| 766 | of that character code. | 767 | of that character code. |
| 767 | Note: Currently the arg ACCEPT_LATIN_1 is not used. */ | 768 | Note: Currently the arg ACCEPT_LATIN_1 is not used. */ |
| 768 | 769 | ||
| 769 | EMACS_INT | 770 | ptrdiff_t |
| 770 | str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, int accept_latin_1) | 771 | str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, int accept_latin_1) |
| 771 | { | 772 | { |
| 772 | EMACS_INT i; | 773 | ptrdiff_t i; |
| 773 | 774 | ||
| 774 | for (i = 0; i < chars; i++) | 775 | for (i = 0; i < chars; i++) |
| 775 | { | 776 | { |
| @@ -786,14 +787,14 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, EMACS_INT chars, i | |||
| 786 | } | 787 | } |
| 787 | 788 | ||
| 788 | 789 | ||
| 789 | static EMACS_INT | 790 | static ptrdiff_t |
| 790 | string_count_byte8 (Lisp_Object string) | 791 | string_count_byte8 (Lisp_Object string) |
| 791 | { | 792 | { |
| 792 | int multibyte = STRING_MULTIBYTE (string); | 793 | int multibyte = STRING_MULTIBYTE (string); |
| 793 | EMACS_INT nbytes = SBYTES (string); | 794 | ptrdiff_t nbytes = SBYTES (string); |
| 794 | unsigned char *p = SDATA (string); | 795 | unsigned char *p = SDATA (string); |
| 795 | unsigned char *pend = p + nbytes; | 796 | unsigned char *pend = p + nbytes; |
| 796 | EMACS_INT count = 0; | 797 | ptrdiff_t count = 0; |
| 797 | int c, len; | 798 | int c, len; |
| 798 | 799 | ||
| 799 | if (multibyte) | 800 | if (multibyte) |
| @@ -819,10 +820,10 @@ string_count_byte8 (Lisp_Object string) | |||
| 819 | Lisp_Object | 820 | Lisp_Object |
| 820 | string_escape_byte8 (Lisp_Object string) | 821 | string_escape_byte8 (Lisp_Object string) |
| 821 | { | 822 | { |
| 822 | EMACS_INT nchars = SCHARS (string); | 823 | ptrdiff_t nchars = SCHARS (string); |
| 823 | EMACS_INT nbytes = SBYTES (string); | 824 | ptrdiff_t nbytes = SBYTES (string); |
| 824 | int multibyte = STRING_MULTIBYTE (string); | 825 | int multibyte = STRING_MULTIBYTE (string); |
| 825 | EMACS_INT byte8_count; | 826 | ptrdiff_t byte8_count; |
| 826 | const unsigned char *src, *src_end; | 827 | const unsigned char *src, *src_end; |
| 827 | unsigned char *dst; | 828 | unsigned char *dst; |
| 828 | Lisp_Object val; | 829 | Lisp_Object val; |
| @@ -933,7 +934,7 @@ usage: (unibyte-string &rest BYTES) */) | |||
| 933 | 934 | ||
| 934 | for (i = 0; i < n; i++) | 935 | for (i = 0; i < n; i++) |
| 935 | { | 936 | { |
| 936 | CHECK_NATNUM (args[i]); | 937 | CHECK_CHARACTER (args[i]); |
| 937 | c = XFASTINT (args[i]); | 938 | c = XFASTINT (args[i]); |
| 938 | if (c >= 256) | 939 | if (c >= 256) |
| 939 | args_out_of_range_3 (args[i], make_number (0), make_number (255)); | 940 | args_out_of_range_3 (args[i], make_number (0), make_number (255)); |
| @@ -953,7 +954,7 @@ code. Unresolved modifiers are kept in the value. | |||
| 953 | usage: (char-resolve-modifiers CHAR) */) | 954 | usage: (char-resolve-modifiers CHAR) */) |
| 954 | (Lisp_Object character) | 955 | (Lisp_Object character) |
| 955 | { | 956 | { |
| 956 | int c; | 957 | EMACS_INT c; |
| 957 | 958 | ||
| 958 | CHECK_NUMBER (character); | 959 | CHECK_NUMBER (character); |
| 959 | c = XINT (character); | 960 | c = XINT (character); |
| @@ -973,7 +974,7 @@ character is not ASCII nor 8-bit character, an error is signalled. */) | |||
| 973 | (Lisp_Object position, Lisp_Object string) | 974 | (Lisp_Object position, Lisp_Object string) |
| 974 | { | 975 | { |
| 975 | int c; | 976 | int c; |
| 976 | EMACS_INT pos; | 977 | ptrdiff_t pos; |
| 977 | unsigned char *p; | 978 | unsigned char *p; |
| 978 | 979 | ||
| 979 | if (NILP (string)) | 980 | if (NILP (string)) |
diff --git a/src/character.h b/src/character.h index 09bcf17ab96..2e1372eaf94 100644 --- a/src/character.h +++ b/src/character.h | |||
| @@ -655,7 +655,7 @@ typedef enum { | |||
| 655 | UNICODE_CATEGORY_Cn | 655 | UNICODE_CATEGORY_Cn |
| 656 | } unicode_category_t; | 656 | } unicode_category_t; |
| 657 | 657 | ||
| 658 | extern int char_resolve_modifier_mask (int); | 658 | extern EMACS_INT char_resolve_modifier_mask (EMACS_INT); |
| 659 | extern int char_string (unsigned, unsigned char *); | 659 | extern int char_string (unsigned, unsigned char *); |
| 660 | extern int string_char (const unsigned char *, | 660 | extern int string_char (const unsigned char *, |
| 661 | const unsigned char **, int *); | 661 | const unsigned char **, int *); |
| @@ -663,19 +663,19 @@ extern int string_char (const unsigned char *, | |||
| 663 | extern int translate_char (Lisp_Object, int c); | 663 | extern int translate_char (Lisp_Object, int c); |
| 664 | extern int char_printable_p (int c); | 664 | extern int char_printable_p (int c); |
| 665 | extern void parse_str_as_multibyte (const unsigned char *, | 665 | extern void parse_str_as_multibyte (const unsigned char *, |
| 666 | EMACS_INT, EMACS_INT *, EMACS_INT *); | 666 | ptrdiff_t, ptrdiff_t *, ptrdiff_t *); |
| 667 | extern EMACS_INT count_size_as_multibyte (const unsigned char *, EMACS_INT); | 667 | extern ptrdiff_t count_size_as_multibyte (const unsigned char *, ptrdiff_t); |
| 668 | extern EMACS_INT str_as_multibyte (unsigned char *, EMACS_INT, EMACS_INT, | 668 | extern ptrdiff_t str_as_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t, |
| 669 | EMACS_INT *); | 669 | ptrdiff_t *); |
| 670 | extern EMACS_INT str_to_multibyte (unsigned char *, EMACS_INT, EMACS_INT); | 670 | extern ptrdiff_t str_to_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t); |
| 671 | extern EMACS_INT str_as_unibyte (unsigned char *, EMACS_INT); | 671 | extern ptrdiff_t str_as_unibyte (unsigned char *, ptrdiff_t); |
| 672 | extern EMACS_INT str_to_unibyte (const unsigned char *, unsigned char *, | 672 | extern ptrdiff_t str_to_unibyte (const unsigned char *, unsigned char *, |
| 673 | EMACS_INT, int); | 673 | ptrdiff_t, int); |
| 674 | extern EMACS_INT strwidth (const char *, EMACS_INT); | 674 | extern ptrdiff_t strwidth (const char *, ptrdiff_t); |
| 675 | extern EMACS_INT c_string_width (const unsigned char *, EMACS_INT, int, | 675 | extern ptrdiff_t c_string_width (const unsigned char *, ptrdiff_t, int, |
| 676 | EMACS_INT *, EMACS_INT *); | 676 | ptrdiff_t *, ptrdiff_t *); |
| 677 | extern EMACS_INT lisp_string_width (Lisp_Object, EMACS_INT, | 677 | extern ptrdiff_t lisp_string_width (Lisp_Object, ptrdiff_t, |
| 678 | EMACS_INT *, EMACS_INT *); | 678 | ptrdiff_t *, ptrdiff_t *); |
| 679 | 679 | ||
| 680 | extern Lisp_Object Qcharacterp; | 680 | extern Lisp_Object Qcharacterp; |
| 681 | extern Lisp_Object Vchar_unify_table; | 681 | extern Lisp_Object Vchar_unify_table; |
diff --git a/src/charset.c b/src/charset.c index 6967b9df611..9d58d29d05c 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -482,7 +482,8 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co | |||
| 482 | FILE *fp; | 482 | FILE *fp; |
| 483 | Lisp_Object suffixes; | 483 | Lisp_Object suffixes; |
| 484 | struct charset_map_entries *head, *entries; | 484 | struct charset_map_entries *head, *entries; |
| 485 | int n_entries, count; | 485 | int n_entries; |
| 486 | ptrdiff_t count; | ||
| 486 | USE_SAFE_ALLOCA; | 487 | USE_SAFE_ALLOCA; |
| 487 | 488 | ||
| 488 | suffixes = Fcons (build_string (".map"), | 489 | suffixes = Fcons (build_string (".map"), |
| @@ -534,8 +535,9 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co | |||
| 534 | sizeof (struct charset_map_entries)); | 535 | sizeof (struct charset_map_entries)); |
| 535 | entries = entries->next; | 536 | entries = entries->next; |
| 536 | memset (entries, 0, sizeof (struct charset_map_entries)); | 537 | memset (entries, 0, sizeof (struct charset_map_entries)); |
| 538 | n_entries = 0; | ||
| 537 | } | 539 | } |
| 538 | idx = n_entries % 0x10000; | 540 | idx = n_entries; |
| 539 | entries->entry[idx].from = from; | 541 | entries->entry[idx].from = from; |
| 540 | entries->entry[idx].to = to; | 542 | entries->entry[idx].to = to; |
| 541 | entries->entry[idx].c = c; | 543 | entries->entry[idx].c = c; |
| @@ -576,7 +578,7 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont | |||
| 576 | { | 578 | { |
| 577 | Lisp_Object val, val2; | 579 | Lisp_Object val, val2; |
| 578 | unsigned from, to; | 580 | unsigned from, to; |
| 579 | int c; | 581 | EMACS_INT c; |
| 580 | int idx; | 582 | int idx; |
| 581 | 583 | ||
| 582 | val = AREF (vec, i); | 584 | val = AREF (vec, i); |
| @@ -584,16 +586,11 @@ load_charset_map_from_vector (struct charset *charset, Lisp_Object vec, int cont | |||
| 584 | { | 586 | { |
| 585 | val2 = XCDR (val); | 587 | val2 = XCDR (val); |
| 586 | val = XCAR (val); | 588 | val = XCAR (val); |
| 587 | CHECK_NATNUM (val); | ||
| 588 | CHECK_NATNUM (val2); | ||
| 589 | from = XFASTINT (val); | 589 | from = XFASTINT (val); |
| 590 | to = XFASTINT (val2); | 590 | to = XFASTINT (val2); |
| 591 | } | 591 | } |
| 592 | else | 592 | else |
| 593 | { | 593 | from = to = XFASTINT (val); |
| 594 | CHECK_NATNUM (val); | ||
| 595 | from = to = XFASTINT (val); | ||
| 596 | } | ||
| 597 | val = AREF (vec, i + 1); | 594 | val = AREF (vec, i + 1); |
| 598 | CHECK_NATNUM (val); | 595 | CHECK_NATNUM (val); |
| 599 | c = XFASTINT (val); | 596 | c = XFASTINT (val); |
| @@ -821,7 +818,6 @@ range of code points (in CHARSET) of target characters. */) | |||
| 821 | from = CHARSET_MIN_CODE (cs); | 818 | from = CHARSET_MIN_CODE (cs); |
| 822 | else | 819 | else |
| 823 | { | 820 | { |
| 824 | CHECK_NATNUM (from_code); | ||
| 825 | from = XINT (from_code); | 821 | from = XINT (from_code); |
| 826 | if (from < CHARSET_MIN_CODE (cs)) | 822 | if (from < CHARSET_MIN_CODE (cs)) |
| 827 | from = CHARSET_MIN_CODE (cs); | 823 | from = CHARSET_MIN_CODE (cs); |
| @@ -830,7 +826,6 @@ range of code points (in CHARSET) of target characters. */) | |||
| 830 | to = CHARSET_MAX_CODE (cs); | 826 | to = CHARSET_MAX_CODE (cs); |
| 831 | else | 827 | else |
| 832 | { | 828 | { |
| 833 | CHECK_NATNUM (to_code); | ||
| 834 | to = XINT (to_code); | 829 | to = XINT (to_code); |
| 835 | if (to > CHARSET_MAX_CODE (cs)) | 830 | if (to > CHARSET_MAX_CODE (cs)) |
| 836 | to = CHARSET_MAX_CODE (cs); | 831 | to = CHARSET_MAX_CODE (cs); |
| @@ -876,12 +871,15 @@ usage: (define-charset-internal ...) */) | |||
| 876 | val = args[charset_arg_code_space]; | 871 | val = args[charset_arg_code_space]; |
| 877 | for (i = 0, dimension = 0, nchars = 1; ; i++) | 872 | for (i = 0, dimension = 0, nchars = 1; ; i++) |
| 878 | { | 873 | { |
| 874 | Lisp_Object min_byte_obj, max_byte_obj; | ||
| 879 | int min_byte, max_byte; | 875 | int min_byte, max_byte; |
| 880 | 876 | ||
| 881 | min_byte = XINT (Faref (val, make_number (i * 2))); | 877 | min_byte_obj = Faref (val, make_number (i * 2)); |
| 882 | max_byte = XINT (Faref (val, make_number (i * 2 + 1))); | 878 | max_byte_obj = Faref (val, make_number (i * 2 + 1)); |
| 883 | if (min_byte < 0 || min_byte > max_byte || max_byte >= 256) | 879 | CHECK_RANGED_INTEGER (0, min_byte_obj, 255); |
| 884 | error ("Invalid :code-space value"); | 880 | min_byte = XINT (min_byte_obj); |
| 881 | CHECK_RANGED_INTEGER (min_byte, max_byte_obj, 255); | ||
| 882 | max_byte = XINT (max_byte_obj); | ||
| 885 | charset.code_space[i * 4] = min_byte; | 883 | charset.code_space[i * 4] = min_byte; |
| 886 | charset.code_space[i * 4 + 1] = max_byte; | 884 | charset.code_space[i * 4 + 1] = max_byte; |
| 887 | charset.code_space[i * 4 + 2] = max_byte - min_byte + 1; | 885 | charset.code_space[i * 4 + 2] = max_byte - min_byte + 1; |
| @@ -898,10 +896,8 @@ usage: (define-charset-internal ...) */) | |||
| 898 | charset.dimension = dimension; | 896 | charset.dimension = dimension; |
| 899 | else | 897 | else |
| 900 | { | 898 | { |
| 901 | CHECK_NATNUM (val); | 899 | CHECK_RANGED_INTEGER (1, val, 4); |
| 902 | charset.dimension = XINT (val); | 900 | charset.dimension = XINT (val); |
| 903 | if (charset.dimension < 1 || charset.dimension > 4) | ||
| 904 | args_out_of_range_3 (val, make_number (1), make_number (4)); | ||
| 905 | } | 901 | } |
| 906 | 902 | ||
| 907 | charset.code_linear_p | 903 | charset.code_linear_p |
| @@ -968,18 +964,14 @@ usage: (define-charset-internal ...) */) | |||
| 968 | charset.invalid_code = 0; | 964 | charset.invalid_code = 0; |
| 969 | else | 965 | else |
| 970 | { | 966 | { |
| 971 | XSETINT (val, charset.max_code + 1); | 967 | if (charset.max_code < min (UINT_MAX, MOST_POSITIVE_FIXNUM)) |
| 972 | if (XINT (val) == charset.max_code + 1) | ||
| 973 | charset.invalid_code = charset.max_code + 1; | 968 | charset.invalid_code = charset.max_code + 1; |
| 974 | else | 969 | else |
| 975 | error ("Attribute :invalid-code must be specified"); | 970 | error ("Attribute :invalid-code must be specified"); |
| 976 | } | 971 | } |
| 977 | } | 972 | } |
| 978 | else | 973 | else |
| 979 | { | 974 | charset.invalid_code = XFASTINT (val); |
| 980 | CHECK_NATNUM (val); | ||
| 981 | charset.invalid_code = XFASTINT (val); | ||
| 982 | } | ||
| 983 | 975 | ||
| 984 | val = args[charset_arg_iso_final]; | 976 | val = args[charset_arg_iso_final]; |
| 985 | if (NILP (val)) | 977 | if (NILP (val)) |
| @@ -997,9 +989,7 @@ usage: (define-charset-internal ...) */) | |||
| 997 | charset.iso_revision = -1; | 989 | charset.iso_revision = -1; |
| 998 | else | 990 | else |
| 999 | { | 991 | { |
| 1000 | CHECK_NUMBER (val); | 992 | CHECK_RANGED_INTEGER (-1, val, 63); |
| 1001 | if (XINT (val) > 63) | ||
| 1002 | args_out_of_range (make_number (63), val); | ||
| 1003 | charset.iso_revision = XINT (val); | 993 | charset.iso_revision = XINT (val); |
| 1004 | } | 994 | } |
| 1005 | 995 | ||
| @@ -1025,7 +1015,7 @@ usage: (define-charset-internal ...) */) | |||
| 1025 | if (! NILP (args[charset_arg_code_offset])) | 1015 | if (! NILP (args[charset_arg_code_offset])) |
| 1026 | { | 1016 | { |
| 1027 | val = args[charset_arg_code_offset]; | 1017 | val = args[charset_arg_code_offset]; |
| 1028 | CHECK_NUMBER (val); | 1018 | CHECK_TYPE_RANGED_INTEGER (int, val); |
| 1029 | 1019 | ||
| 1030 | charset.method = CHARSET_METHOD_OFFSET; | 1020 | charset.method = CHARSET_METHOD_OFFSET; |
| 1031 | charset.code_offset = XINT (val); | 1021 | charset.code_offset = XINT (val); |
| @@ -1106,7 +1096,7 @@ usage: (define-charset-internal ...) */) | |||
| 1106 | car_part = XCAR (elt); | 1096 | car_part = XCAR (elt); |
| 1107 | cdr_part = XCDR (elt); | 1097 | cdr_part = XCDR (elt); |
| 1108 | CHECK_CHARSET_GET_ID (car_part, this_id); | 1098 | CHECK_CHARSET_GET_ID (car_part, this_id); |
| 1109 | CHECK_NUMBER (cdr_part); | 1099 | CHECK_TYPE_RANGED_INTEGER (int, cdr_part); |
| 1110 | offset = XINT (cdr_part); | 1100 | offset = XINT (cdr_part); |
| 1111 | } | 1101 | } |
| 1112 | else | 1102 | else |
| @@ -1511,7 +1501,7 @@ string_xstring_p (Lisp_Object string) | |||
| 1511 | It may lookup a translation table TABLE if supplied. */ | 1501 | It may lookup a translation table TABLE if supplied. */ |
| 1512 | 1502 | ||
| 1513 | static void | 1503 | static void |
| 1514 | find_charsets_in_text (const unsigned char *ptr, EMACS_INT nchars, EMACS_INT nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte) | 1504 | find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte) |
| 1515 | { | 1505 | { |
| 1516 | const unsigned char *pend = ptr + nbytes; | 1506 | const unsigned char *pend = ptr + nbytes; |
| 1517 | 1507 | ||
| @@ -1558,7 +1548,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'. */) | |||
| 1558 | (Lisp_Object beg, Lisp_Object end, Lisp_Object table) | 1548 | (Lisp_Object beg, Lisp_Object end, Lisp_Object table) |
| 1559 | { | 1549 | { |
| 1560 | Lisp_Object charsets; | 1550 | Lisp_Object charsets; |
| 1561 | EMACS_INT from, from_byte, to, stop, stop_byte; | 1551 | ptrdiff_t from, from_byte, to, stop, stop_byte; |
| 1562 | int i; | 1552 | int i; |
| 1563 | Lisp_Object val; | 1553 | Lisp_Object val; |
| 1564 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 1554 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
diff --git a/src/chartab.c b/src/chartab.c index 1d4ac04312a..06def16e795 100644 --- a/src/chartab.c +++ b/src/chartab.c | |||
| @@ -107,9 +107,9 @@ the char-table has no extra slot. */) | |||
| 107 | else | 107 | else |
| 108 | { | 108 | { |
| 109 | CHECK_NATNUM (n); | 109 | CHECK_NATNUM (n); |
| 110 | n_extras = XINT (n); | 110 | if (XINT (n) > 10) |
| 111 | if (n_extras > 10) | ||
| 112 | args_out_of_range (n, Qnil); | 111 | args_out_of_range (n, Qnil); |
| 112 | n_extras = XINT (n); | ||
| 113 | } | 113 | } |
| 114 | 114 | ||
| 115 | size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras; | 115 | size = VECSIZE (struct Lisp_Char_Table) - 1 + n_extras; |
| @@ -646,7 +646,7 @@ or a character code. Return VALUE. */) | |||
| 646 | } | 646 | } |
| 647 | else if (EQ (range, Qnil)) | 647 | else if (EQ (range, Qnil)) |
| 648 | XCHAR_TABLE (char_table)->defalt = value; | 648 | XCHAR_TABLE (char_table)->defalt = value; |
| 649 | else if (INTEGERP (range)) | 649 | else if (CHARACTERP (range)) |
| 650 | char_table_set (char_table, XINT (range), value); | 650 | char_table_set (char_table, XINT (range), value); |
| 651 | else if (CONSP (range)) | 651 | else if (CONSP (range)) |
| 652 | { | 652 | { |
| @@ -1223,7 +1223,7 @@ static int uniprop_decoder_count | |||
| 1223 | static uniprop_decoder_t | 1223 | static uniprop_decoder_t |
| 1224 | uniprop_get_decoder (Lisp_Object table) | 1224 | uniprop_get_decoder (Lisp_Object table) |
| 1225 | { | 1225 | { |
| 1226 | int i; | 1226 | EMACS_INT i; |
| 1227 | 1227 | ||
| 1228 | if (! INTEGERP (XCHAR_TABLE (table)->extras[1])) | 1228 | if (! INTEGERP (XCHAR_TABLE (table)->extras[1])) |
| 1229 | return NULL; | 1229 | return NULL; |
| @@ -1303,7 +1303,7 @@ static int uniprop_encoder_count | |||
| 1303 | static uniprop_decoder_t | 1303 | static uniprop_decoder_t |
| 1304 | uniprop_get_encoder (Lisp_Object table) | 1304 | uniprop_get_encoder (Lisp_Object table) |
| 1305 | { | 1305 | { |
| 1306 | int i; | 1306 | EMACS_INT i; |
| 1307 | 1307 | ||
| 1308 | if (! INTEGERP (XCHAR_TABLE (table)->extras[2])) | 1308 | if (! INTEGERP (XCHAR_TABLE (table)->extras[2])) |
| 1309 | return NULL; | 1309 | return NULL; |
diff --git a/src/cmds.c b/src/cmds.c index 5a155ac77a5..ed5bf5d282e 100644 --- a/src/cmds.c +++ b/src/cmds.c | |||
| @@ -47,6 +47,41 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0, | |||
| 47 | return make_number (PT + XINT (n)); | 47 | return make_number (PT + XINT (n)); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | /* Add N to point; or subtract N if FORWARD is zero. N defaults to 1. | ||
| 51 | Validate the new location. Return nil. */ | ||
| 52 | static Lisp_Object | ||
| 53 | move_point (Lisp_Object n, int forward) | ||
| 54 | { | ||
| 55 | /* This used to just set point to point + XINT (n), and then check | ||
| 56 | to see if it was within boundaries. But now that SET_PT can | ||
| 57 | potentially do a lot of stuff (calling entering and exiting | ||
| 58 | hooks, etcetera), that's not a good approach. So we validate the | ||
| 59 | proposed position, then set point. */ | ||
| 60 | |||
| 61 | EMACS_INT new_point; | ||
| 62 | |||
| 63 | if (NILP (n)) | ||
| 64 | XSETFASTINT (n, 1); | ||
| 65 | else | ||
| 66 | CHECK_NUMBER (n); | ||
| 67 | |||
| 68 | new_point = PT + (forward ? XINT (n) : - XINT (n)); | ||
| 69 | |||
| 70 | if (new_point < BEGV) | ||
| 71 | { | ||
| 72 | SET_PT (BEGV); | ||
| 73 | xsignal0 (Qbeginning_of_buffer); | ||
| 74 | } | ||
| 75 | if (new_point > ZV) | ||
| 76 | { | ||
| 77 | SET_PT (ZV); | ||
| 78 | xsignal0 (Qend_of_buffer); | ||
| 79 | } | ||
| 80 | |||
| 81 | SET_PT (new_point); | ||
| 82 | return Qnil; | ||
| 83 | } | ||
| 84 | |||
| 50 | DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p", | 85 | DEFUN ("forward-char", Fforward_char, Sforward_char, 0, 1, "^p", |
| 51 | doc: /* Move point N characters forward (backward if N is negative). | 86 | doc: /* Move point N characters forward (backward if N is negative). |
| 52 | On reaching end or beginning of buffer, stop and signal error. | 87 | On reaching end or beginning of buffer, stop and signal error. |
| @@ -56,34 +91,7 @@ right or to the left on the screen. This is in contrast with | |||
| 56 | \\[right-char], which see. */) | 91 | \\[right-char], which see. */) |
| 57 | (Lisp_Object n) | 92 | (Lisp_Object n) |
| 58 | { | 93 | { |
| 59 | if (NILP (n)) | 94 | return move_point (n, 1); |
| 60 | XSETFASTINT (n, 1); | ||
| 61 | else | ||
| 62 | CHECK_NUMBER (n); | ||
| 63 | |||
| 64 | /* This used to just set point to point + XINT (n), and then check | ||
| 65 | to see if it was within boundaries. But now that SET_PT can | ||
| 66 | potentially do a lot of stuff (calling entering and exiting | ||
| 67 | hooks, etcetera), that's not a good approach. So we validate the | ||
| 68 | proposed position, then set point. */ | ||
| 69 | { | ||
| 70 | EMACS_INT new_point = PT + XINT (n); | ||
| 71 | |||
| 72 | if (new_point < BEGV) | ||
| 73 | { | ||
| 74 | SET_PT (BEGV); | ||
| 75 | xsignal0 (Qbeginning_of_buffer); | ||
| 76 | } | ||
| 77 | if (new_point > ZV) | ||
| 78 | { | ||
| 79 | SET_PT (ZV); | ||
| 80 | xsignal0 (Qend_of_buffer); | ||
| 81 | } | ||
| 82 | |||
| 83 | SET_PT (new_point); | ||
| 84 | } | ||
| 85 | |||
| 86 | return Qnil; | ||
| 87 | } | 95 | } |
| 88 | 96 | ||
| 89 | DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p", | 97 | DEFUN ("backward-char", Fbackward_char, Sbackward_char, 0, 1, "^p", |
| @@ -95,13 +103,7 @@ right or to the left on the screen. This is in contrast with | |||
| 95 | \\[left-char], which see. */) | 103 | \\[left-char], which see. */) |
| 96 | (Lisp_Object n) | 104 | (Lisp_Object n) |
| 97 | { | 105 | { |
| 98 | if (NILP (n)) | 106 | return move_point (n, 0); |
| 99 | XSETFASTINT (n, 1); | ||
| 100 | else | ||
| 101 | CHECK_NUMBER (n); | ||
| 102 | |||
| 103 | XSETINT (n, - XINT (n)); | ||
| 104 | return Fforward_char (n); | ||
| 105 | } | 107 | } |
| 106 | 108 | ||
| 107 | DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p", | 109 | DEFUN ("forward-line", Fforward_line, Sforward_line, 0, 1, "^p", |
| @@ -115,8 +117,8 @@ With positive N, a non-empty line at the end counts as one line | |||
| 115 | successfully moved (for the return value). */) | 117 | successfully moved (for the return value). */) |
| 116 | (Lisp_Object n) | 118 | (Lisp_Object n) |
| 117 | { | 119 | { |
| 118 | EMACS_INT opoint = PT, opoint_byte = PT_BYTE; | 120 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 119 | EMACS_INT pos, pos_byte; | 121 | ptrdiff_t pos, pos_byte; |
| 120 | EMACS_INT count, shortage; | 122 | EMACS_INT count, shortage; |
| 121 | 123 | ||
| 122 | if (NILP (n)) | 124 | if (NILP (n)) |
| @@ -187,7 +189,7 @@ not move. To ignore field boundaries bind `inhibit-field-text-motion' | |||
| 187 | to t. */) | 189 | to t. */) |
| 188 | (Lisp_Object n) | 190 | (Lisp_Object n) |
| 189 | { | 191 | { |
| 190 | EMACS_INT newpos; | 192 | ptrdiff_t newpos; |
| 191 | 193 | ||
| 192 | if (NILP (n)) | 194 | if (NILP (n)) |
| 193 | XSETFASTINT (n, 1); | 195 | XSETFASTINT (n, 1); |
| @@ -303,7 +305,7 @@ At the end, it runs `post-self-insert-hook'. */) | |||
| 303 | bitch_at_user (); | 305 | bitch_at_user (); |
| 304 | { | 306 | { |
| 305 | int character = translate_char (Vtranslation_table_for_input, | 307 | int character = translate_char (Vtranslation_table_for_input, |
| 306 | (int) XINT (last_command_event)); | 308 | XINT (last_command_event)); |
| 307 | int val = internal_self_insert (character, XFASTINT (n)); | 309 | int val = internal_self_insert (character, XFASTINT (n)); |
| 308 | if (val == 2) | 310 | if (val == 2) |
| 309 | nonundocount = 0; | 311 | nonundocount = 0; |
| @@ -333,8 +335,8 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 333 | int len; | 335 | int len; |
| 334 | /* Working buffer and pointer for multi-byte form of C. */ | 336 | /* Working buffer and pointer for multi-byte form of C. */ |
| 335 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | 337 | unsigned char str[MAX_MULTIBYTE_LENGTH]; |
| 336 | EMACS_INT chars_to_delete = 0; | 338 | ptrdiff_t chars_to_delete = 0; |
| 337 | EMACS_INT spaces_to_insert = 0; | 339 | ptrdiff_t spaces_to_insert = 0; |
| 338 | 340 | ||
| 339 | overwrite = BVAR (current_buffer, overwrite_mode); | 341 | overwrite = BVAR (current_buffer, overwrite_mode); |
| 340 | if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) | 342 | if (!NILP (Vbefore_change_functions) || !NILP (Vafter_change_functions)) |
| @@ -371,50 +373,53 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 371 | /* This is the character after point. */ | 373 | /* This is the character after point. */ |
| 372 | int c2 = FETCH_CHAR (PT_BYTE); | 374 | int c2 = FETCH_CHAR (PT_BYTE); |
| 373 | 375 | ||
| 376 | int cwidth; | ||
| 377 | |||
| 374 | /* Overwriting in binary-mode always replaces C2 by C. | 378 | /* Overwriting in binary-mode always replaces C2 by C. |
| 375 | Overwriting in textual-mode doesn't always do that. | 379 | Overwriting in textual-mode doesn't always do that. |
| 376 | It inserts newlines in the usual way, | 380 | It inserts newlines in the usual way, |
| 377 | and inserts any character at end of line | 381 | and inserts any character at end of line |
| 378 | or before a tab if it doesn't use the whole width of the tab. */ | 382 | or before a tab if it doesn't use the whole width of the tab. */ |
| 379 | if (EQ (overwrite, Qoverwrite_mode_binary)) | 383 | if (EQ (overwrite, Qoverwrite_mode_binary)) |
| 380 | chars_to_delete = n; | 384 | chars_to_delete = min (n, PTRDIFF_MAX); |
| 381 | else if (c != '\n' && c2 != '\n') | 385 | else if (c != '\n' && c2 != '\n' |
| 386 | && (cwidth = XFASTINT (Fchar_width (make_number (c)))) != 0) | ||
| 382 | { | 387 | { |
| 383 | EMACS_INT pos = PT; | 388 | ptrdiff_t pos = PT; |
| 384 | EMACS_INT pos_byte = PT_BYTE; | 389 | ptrdiff_t pos_byte = PT_BYTE; |
| 390 | ptrdiff_t curcol = current_column (); | ||
| 385 | 391 | ||
| 386 | /* FIXME: Check for integer overflow when calculating | 392 | if (n <= (min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX) - curcol) / cwidth) |
| 387 | target_clm and actual_clm. */ | ||
| 388 | |||
| 389 | /* Column the cursor should be placed at after this insertion. | ||
| 390 | The correct value should be calculated only when necessary. */ | ||
| 391 | EMACS_INT target_clm = (current_column () | ||
| 392 | + n * XINT (Fchar_width (make_number (c)))); | ||
| 393 | |||
| 394 | /* The actual cursor position after the trial of moving | ||
| 395 | to column TARGET_CLM. It is greater than TARGET_CLM | ||
| 396 | if the TARGET_CLM is middle of multi-column | ||
| 397 | character. In that case, the new point is set after | ||
| 398 | that character. */ | ||
| 399 | EMACS_INT actual_clm | ||
| 400 | = XFASTINT (Fmove_to_column (make_number (target_clm), Qnil)); | ||
| 401 | |||
| 402 | chars_to_delete = PT - pos; | ||
| 403 | |||
| 404 | if (actual_clm > target_clm) | ||
| 405 | { | 393 | { |
| 406 | /* We will delete too many columns. Let's fill columns | 394 | /* Column the cursor should be placed at after this insertion. |
| 407 | by spaces so that the remaining text won't move. */ | 395 | The value should be calculated only when necessary. */ |
| 408 | EMACS_INT actual = PT_BYTE; | 396 | ptrdiff_t target_clm = curcol + n * cwidth; |
| 409 | DEC_POS (actual); | 397 | |
| 410 | if (FETCH_CHAR (actual) == '\t') | 398 | /* The actual cursor position after the trial of moving |
| 411 | /* Rather than add spaces, let's just keep the tab. */ | 399 | to column TARGET_CLM. It is greater than TARGET_CLM |
| 412 | chars_to_delete--; | 400 | if the TARGET_CLM is middle of multi-column |
| 413 | else | 401 | character. In that case, the new point is set after |
| 414 | spaces_to_insert = actual_clm - target_clm; | 402 | that character. */ |
| 403 | ptrdiff_t actual_clm | ||
| 404 | = XFASTINT (Fmove_to_column (make_number (target_clm), Qnil)); | ||
| 405 | |||
| 406 | chars_to_delete = PT - pos; | ||
| 407 | |||
| 408 | if (actual_clm > target_clm) | ||
| 409 | { | ||
| 410 | /* We will delete too many columns. Let's fill columns | ||
| 411 | by spaces so that the remaining text won't move. */ | ||
| 412 | ptrdiff_t actual = PT_BYTE; | ||
| 413 | DEC_POS (actual); | ||
| 414 | if (FETCH_CHAR (actual) == '\t') | ||
| 415 | /* Rather than add spaces, let's just keep the tab. */ | ||
| 416 | chars_to_delete--; | ||
| 417 | else | ||
| 418 | spaces_to_insert = actual_clm - target_clm; | ||
| 419 | } | ||
| 420 | |||
| 421 | SET_PT_BOTH (pos, pos_byte); | ||
| 415 | } | 422 | } |
| 416 | |||
| 417 | SET_PT_BOTH (pos, pos_byte); | ||
| 418 | } | 423 | } |
| 419 | hairy = 2; | 424 | hairy = 2; |
| 420 | } | 425 | } |
| @@ -466,7 +471,7 @@ internal_self_insert (int c, EMACS_INT n) | |||
| 466 | } | 471 | } |
| 467 | 472 | ||
| 468 | replace_range (PT, PT + chars_to_delete, string, 1, 1, 1); | 473 | replace_range (PT, PT + chars_to_delete, string, 1, 1, 1); |
| 469 | Fforward_char (make_number (n + spaces_to_insert)); | 474 | move_point (n + spaces_to_insert, 1); |
| 470 | } | 475 | } |
| 471 | else if (n > 1) | 476 | else if (n > 1) |
| 472 | { | 477 | { |
diff --git a/src/coding.c b/src/coding.c index 5fd59d394d9..704d26f3f9b 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -159,7 +159,7 @@ detect_coding_XXX (struct coding_system *coding, | |||
| 159 | const unsigned char *src = coding->source; | 159 | const unsigned char *src = coding->source; |
| 160 | const unsigned char *src_end = coding->source + coding->src_bytes; | 160 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 161 | int multibytep = coding->src_multibyte; | 161 | int multibytep = coding->src_multibyte; |
| 162 | EMACS_INT consumed_chars = 0; | 162 | ptrdiff_t consumed_chars = 0; |
| 163 | int found = 0; | 163 | int found = 0; |
| 164 | ...; | 164 | ...; |
| 165 | 165 | ||
| @@ -266,7 +266,7 @@ encode_coding_XXX (struct coding_system *coding) | |||
| 266 | unsigned char *dst = coding->destination + coding->produced; | 266 | unsigned char *dst = coding->destination + coding->produced; |
| 267 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 267 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 268 | unsigned char *adjusted_dst_end = dst_end - _MAX_BYTES_PRODUCED_IN_LOOP_; | 268 | unsigned char *adjusted_dst_end = dst_end - _MAX_BYTES_PRODUCED_IN_LOOP_; |
| 269 | EMACS_INT produced_chars = 0; | 269 | ptrdiff_t produced_chars = 0; |
| 270 | 270 | ||
| 271 | for (; charbuf < charbuf_end && dst < adjusted_dst_end; charbuf++) | 271 | for (; charbuf < charbuf_end && dst < adjusted_dst_end; charbuf++) |
| 272 | { | 272 | { |
| @@ -849,31 +849,31 @@ static int encode_coding_raw_text (struct coding_system *); | |||
| 849 | 849 | ||
| 850 | static void coding_set_source (struct coding_system *); | 850 | static void coding_set_source (struct coding_system *); |
| 851 | static void coding_set_destination (struct coding_system *); | 851 | static void coding_set_destination (struct coding_system *); |
| 852 | static void coding_alloc_by_realloc (struct coding_system *, EMACS_INT); | 852 | static void coding_alloc_by_realloc (struct coding_system *, ptrdiff_t); |
| 853 | static void coding_alloc_by_making_gap (struct coding_system *, | 853 | static void coding_alloc_by_making_gap (struct coding_system *, |
| 854 | EMACS_INT, EMACS_INT); | 854 | ptrdiff_t, ptrdiff_t); |
| 855 | static unsigned char *alloc_destination (struct coding_system *, | 855 | static unsigned char *alloc_destination (struct coding_system *, |
| 856 | EMACS_INT, unsigned char *); | 856 | ptrdiff_t, unsigned char *); |
| 857 | static void setup_iso_safe_charsets (Lisp_Object); | 857 | static void setup_iso_safe_charsets (Lisp_Object); |
| 858 | static unsigned char *encode_designation_at_bol (struct coding_system *, | 858 | static unsigned char *encode_designation_at_bol (struct coding_system *, |
| 859 | int *, unsigned char *); | 859 | int *, unsigned char *); |
| 860 | static int detect_eol (const unsigned char *, | 860 | static int detect_eol (const unsigned char *, |
| 861 | EMACS_INT, enum coding_category); | 861 | ptrdiff_t, enum coding_category); |
| 862 | static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); | 862 | static Lisp_Object adjust_coding_eol_type (struct coding_system *, int); |
| 863 | static void decode_eol (struct coding_system *); | 863 | static void decode_eol (struct coding_system *); |
| 864 | static Lisp_Object get_translation_table (Lisp_Object, int, int *); | 864 | static Lisp_Object get_translation_table (Lisp_Object, int, int *); |
| 865 | static Lisp_Object get_translation (Lisp_Object, int *, int *); | 865 | static Lisp_Object get_translation (Lisp_Object, int *, int *); |
| 866 | static int produce_chars (struct coding_system *, Lisp_Object, int); | 866 | static int produce_chars (struct coding_system *, Lisp_Object, int); |
| 867 | static inline void produce_charset (struct coding_system *, int *, | 867 | static inline void produce_charset (struct coding_system *, int *, |
| 868 | EMACS_INT); | 868 | ptrdiff_t); |
| 869 | static void produce_annotation (struct coding_system *, EMACS_INT); | 869 | static void produce_annotation (struct coding_system *, ptrdiff_t); |
| 870 | static int decode_coding (struct coding_system *); | 870 | static int decode_coding (struct coding_system *); |
| 871 | static inline int *handle_composition_annotation (EMACS_INT, EMACS_INT, | 871 | static inline int *handle_composition_annotation (ptrdiff_t, ptrdiff_t, |
| 872 | struct coding_system *, | 872 | struct coding_system *, |
| 873 | int *, EMACS_INT *); | 873 | int *, ptrdiff_t *); |
| 874 | static inline int *handle_charset_annotation (EMACS_INT, EMACS_INT, | 874 | static inline int *handle_charset_annotation (ptrdiff_t, ptrdiff_t, |
| 875 | struct coding_system *, | 875 | struct coding_system *, |
| 876 | int *, EMACS_INT *); | 876 | int *, ptrdiff_t *); |
| 877 | static void consume_chars (struct coding_system *, Lisp_Object, int); | 877 | static void consume_chars (struct coding_system *, Lisp_Object, int); |
| 878 | static int encode_coding (struct coding_system *); | 878 | static int encode_coding (struct coding_system *); |
| 879 | static Lisp_Object make_conversion_work_buffer (int); | 879 | static Lisp_Object make_conversion_work_buffer (int); |
| @@ -926,7 +926,7 @@ record_conversion_result (struct coding_system *coding, | |||
| 926 | if (charset_map_loaded) \ | 926 | if (charset_map_loaded) \ |
| 927 | { \ | 927 | { \ |
| 928 | const unsigned char *orig = coding->source; \ | 928 | const unsigned char *orig = coding->source; \ |
| 929 | EMACS_INT offset; \ | 929 | ptrdiff_t offset; \ |
| 930 | \ | 930 | \ |
| 931 | coding_set_source (coding); \ | 931 | coding_set_source (coding); \ |
| 932 | offset = coding->source - orig; \ | 932 | offset = coding->source - orig; \ |
| @@ -946,7 +946,7 @@ record_conversion_result (struct coding_system *coding, | |||
| 946 | do { \ | 946 | do { \ |
| 947 | if (dst + (bytes) >= dst_end) \ | 947 | if (dst + (bytes) >= dst_end) \ |
| 948 | { \ | 948 | { \ |
| 949 | EMACS_INT more_bytes = charbuf_end - charbuf + (bytes); \ | 949 | ptrdiff_t more_bytes = charbuf_end - charbuf + (bytes); \ |
| 950 | \ | 950 | \ |
| 951 | dst = alloc_destination (coding, more_bytes, dst); \ | 951 | dst = alloc_destination (coding, more_bytes, dst); \ |
| 952 | dst_end = coding->destination + coding->dst_bytes; \ | 952 | dst_end = coding->destination + coding->dst_bytes; \ |
| @@ -1069,7 +1069,7 @@ coding_set_destination (struct coding_system *coding) | |||
| 1069 | 1069 | ||
| 1070 | 1070 | ||
| 1071 | static void | 1071 | static void |
| 1072 | coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes) | 1072 | coding_alloc_by_realloc (struct coding_system *coding, ptrdiff_t bytes) |
| 1073 | { | 1073 | { |
| 1074 | if (STRING_BYTES_BOUND - coding->dst_bytes < bytes) | 1074 | if (STRING_BYTES_BOUND - coding->dst_bytes < bytes) |
| 1075 | string_overflow (); | 1075 | string_overflow (); |
| @@ -1080,7 +1080,7 @@ coding_alloc_by_realloc (struct coding_system *coding, EMACS_INT bytes) | |||
| 1080 | 1080 | ||
| 1081 | static void | 1081 | static void |
| 1082 | coding_alloc_by_making_gap (struct coding_system *coding, | 1082 | coding_alloc_by_making_gap (struct coding_system *coding, |
| 1083 | EMACS_INT gap_head_used, EMACS_INT bytes) | 1083 | ptrdiff_t gap_head_used, ptrdiff_t bytes) |
| 1084 | { | 1084 | { |
| 1085 | if (EQ (coding->src_object, coding->dst_object)) | 1085 | if (EQ (coding->src_object, coding->dst_object)) |
| 1086 | { | 1086 | { |
| @@ -1088,7 +1088,7 @@ coding_alloc_by_making_gap (struct coding_system *coding, | |||
| 1088 | consumed data at the tail. To preserve those data, we at | 1088 | consumed data at the tail. To preserve those data, we at |
| 1089 | first make the gap size to zero, then increase the gap | 1089 | first make the gap size to zero, then increase the gap |
| 1090 | size. */ | 1090 | size. */ |
| 1091 | EMACS_INT add = GAP_SIZE; | 1091 | ptrdiff_t add = GAP_SIZE; |
| 1092 | 1092 | ||
| 1093 | GPT += gap_head_used, GPT_BYTE += gap_head_used; | 1093 | GPT += gap_head_used, GPT_BYTE += gap_head_used; |
| 1094 | GAP_SIZE = 0; ZV += add; Z += add; ZV_BYTE += add; Z_BYTE += add; | 1094 | GAP_SIZE = 0; ZV += add; Z += add; ZV_BYTE += add; Z_BYTE += add; |
| @@ -1109,10 +1109,10 @@ coding_alloc_by_making_gap (struct coding_system *coding, | |||
| 1109 | 1109 | ||
| 1110 | 1110 | ||
| 1111 | static unsigned char * | 1111 | static unsigned char * |
| 1112 | alloc_destination (struct coding_system *coding, EMACS_INT nbytes, | 1112 | alloc_destination (struct coding_system *coding, ptrdiff_t nbytes, |
| 1113 | unsigned char *dst) | 1113 | unsigned char *dst) |
| 1114 | { | 1114 | { |
| 1115 | EMACS_INT offset = dst - coding->destination; | 1115 | ptrdiff_t offset = dst - coding->destination; |
| 1116 | 1116 | ||
| 1117 | if (BUFFERP (coding->dst_object)) | 1117 | if (BUFFERP (coding->dst_object)) |
| 1118 | { | 1118 | { |
| @@ -1213,7 +1213,7 @@ detect_coding_utf_8 (struct coding_system *coding, | |||
| 1213 | const unsigned char *src = coding->source, *src_base; | 1213 | const unsigned char *src = coding->source, *src_base; |
| 1214 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1214 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 1215 | int multibytep = coding->src_multibyte; | 1215 | int multibytep = coding->src_multibyte; |
| 1216 | EMACS_INT consumed_chars = 0; | 1216 | ptrdiff_t consumed_chars = 0; |
| 1217 | int bom_found = 0; | 1217 | int bom_found = 0; |
| 1218 | int found = 0; | 1218 | int found = 0; |
| 1219 | 1219 | ||
| @@ -1298,7 +1298,7 @@ decode_coding_utf_8 (struct coding_system *coding) | |||
| 1298 | const unsigned char *src_base; | 1298 | const unsigned char *src_base; |
| 1299 | int *charbuf = coding->charbuf + coding->charbuf_used; | 1299 | int *charbuf = coding->charbuf + coding->charbuf_used; |
| 1300 | int *charbuf_end = coding->charbuf + coding->charbuf_size; | 1300 | int *charbuf_end = coding->charbuf + coding->charbuf_size; |
| 1301 | EMACS_INT consumed_chars = 0, consumed_chars_base = 0; | 1301 | ptrdiff_t consumed_chars = 0, consumed_chars_base = 0; |
| 1302 | int multibytep = coding->src_multibyte; | 1302 | int multibytep = coding->src_multibyte; |
| 1303 | enum utf_bom_type bom = CODING_UTF_8_BOM (coding); | 1303 | enum utf_bom_type bom = CODING_UTF_8_BOM (coding); |
| 1304 | int eol_dos = | 1304 | int eol_dos = |
| @@ -1449,7 +1449,7 @@ encode_coding_utf_8 (struct coding_system *coding) | |||
| 1449 | int *charbuf_end = charbuf + coding->charbuf_used; | 1449 | int *charbuf_end = charbuf + coding->charbuf_used; |
| 1450 | unsigned char *dst = coding->destination + coding->produced; | 1450 | unsigned char *dst = coding->destination + coding->produced; |
| 1451 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 1451 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 1452 | EMACS_INT produced_chars = 0; | 1452 | ptrdiff_t produced_chars = 0; |
| 1453 | int c; | 1453 | int c; |
| 1454 | 1454 | ||
| 1455 | if (CODING_UTF_8_BOM (coding) == utf_with_bom) | 1455 | if (CODING_UTF_8_BOM (coding) == utf_with_bom) |
| @@ -1607,7 +1607,7 @@ decode_coding_utf_16 (struct coding_system *coding) | |||
| 1607 | int *charbuf = coding->charbuf + coding->charbuf_used; | 1607 | int *charbuf = coding->charbuf + coding->charbuf_used; |
| 1608 | /* We may produces at most 3 chars in one loop. */ | 1608 | /* We may produces at most 3 chars in one loop. */ |
| 1609 | int *charbuf_end = coding->charbuf + coding->charbuf_size - 2; | 1609 | int *charbuf_end = coding->charbuf + coding->charbuf_size - 2; |
| 1610 | EMACS_INT consumed_chars = 0, consumed_chars_base = 0; | 1610 | ptrdiff_t consumed_chars = 0, consumed_chars_base = 0; |
| 1611 | int multibytep = coding->src_multibyte; | 1611 | int multibytep = coding->src_multibyte; |
| 1612 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); | 1612 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); |
| 1613 | enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); | 1613 | enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); |
| @@ -1734,7 +1734,7 @@ encode_coding_utf_16 (struct coding_system *coding) | |||
| 1734 | int safe_room = 8; | 1734 | int safe_room = 8; |
| 1735 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); | 1735 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); |
| 1736 | int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian; | 1736 | int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian; |
| 1737 | EMACS_INT produced_chars = 0; | 1737 | ptrdiff_t produced_chars = 0; |
| 1738 | int c; | 1738 | int c; |
| 1739 | 1739 | ||
| 1740 | if (bom != utf_without_bom) | 1740 | if (bom != utf_without_bom) |
| @@ -1868,7 +1868,7 @@ detect_coding_emacs_mule (struct coding_system *coding, | |||
| 1868 | const unsigned char *src = coding->source, *src_base; | 1868 | const unsigned char *src = coding->source, *src_base; |
| 1869 | const unsigned char *src_end = coding->source + coding->src_bytes; | 1869 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 1870 | int multibytep = coding->src_multibyte; | 1870 | int multibytep = coding->src_multibyte; |
| 1871 | EMACS_INT consumed_chars = 0; | 1871 | ptrdiff_t consumed_chars = 0; |
| 1872 | int c; | 1872 | int c; |
| 1873 | int found = 0; | 1873 | int found = 0; |
| 1874 | 1874 | ||
| @@ -2338,10 +2338,10 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2338 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3) | 2338 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3) |
| 2339 | /* We can produce up to 2 characters in a loop. */ | 2339 | /* We can produce up to 2 characters in a loop. */ |
| 2340 | - 1; | 2340 | - 1; |
| 2341 | EMACS_INT consumed_chars = 0, consumed_chars_base; | 2341 | ptrdiff_t consumed_chars = 0, consumed_chars_base; |
| 2342 | int multibytep = coding->src_multibyte; | 2342 | int multibytep = coding->src_multibyte; |
| 2343 | EMACS_INT char_offset = coding->produced_char; | 2343 | ptrdiff_t char_offset = coding->produced_char; |
| 2344 | EMACS_INT last_offset = char_offset; | 2344 | ptrdiff_t last_offset = char_offset; |
| 2345 | int last_id = charset_ascii; | 2345 | int last_id = charset_ascii; |
| 2346 | int eol_dos = | 2346 | int eol_dos = |
| 2347 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 2347 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| @@ -2413,7 +2413,7 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2413 | original pointer to buffer text, and fix up all related | 2413 | original pointer to buffer text, and fix up all related |
| 2414 | pointers after the call. */ | 2414 | pointers after the call. */ |
| 2415 | const unsigned char *orig = coding->source; | 2415 | const unsigned char *orig = coding->source; |
| 2416 | EMACS_INT offset; | 2416 | ptrdiff_t offset; |
| 2417 | 2417 | ||
| 2418 | c = emacs_mule_char (coding, src_base, &nbytes, &nchars, &id, | 2418 | c = emacs_mule_char (coding, src_base, &nbytes, &nchars, &id, |
| 2419 | cmp_status); | 2419 | cmp_status); |
| @@ -2594,7 +2594,7 @@ encode_coding_emacs_mule (struct coding_system *coding) | |||
| 2594 | unsigned char *dst = coding->destination + coding->produced; | 2594 | unsigned char *dst = coding->destination + coding->produced; |
| 2595 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 2595 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 2596 | int safe_room = 8; | 2596 | int safe_room = 8; |
| 2597 | EMACS_INT produced_chars = 0; | 2597 | ptrdiff_t produced_chars = 0; |
| 2598 | Lisp_Object attrs, charset_list; | 2598 | Lisp_Object attrs, charset_list; |
| 2599 | int c; | 2599 | int c; |
| 2600 | int preferred_charset_id = -1; | 2600 | int preferred_charset_id = -1; |
| @@ -2881,7 +2881,7 @@ setup_iso_safe_charsets (Lisp_Object attrs) | |||
| 2881 | Lisp_Object request; | 2881 | Lisp_Object request; |
| 2882 | Lisp_Object reg_usage; | 2882 | Lisp_Object reg_usage; |
| 2883 | Lisp_Object tail; | 2883 | Lisp_Object tail; |
| 2884 | int reg94, reg96; | 2884 | EMACS_INT reg94, reg96; |
| 2885 | int flags = XINT (AREF (attrs, coding_attr_iso_flags)); | 2885 | int flags = XINT (AREF (attrs, coding_attr_iso_flags)); |
| 2886 | int max_charset_id; | 2886 | int max_charset_id; |
| 2887 | 2887 | ||
| @@ -2952,7 +2952,7 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 2952 | int single_shifting = 0; | 2952 | int single_shifting = 0; |
| 2953 | int id; | 2953 | int id; |
| 2954 | int c, c1; | 2954 | int c, c1; |
| 2955 | EMACS_INT consumed_chars = 0; | 2955 | ptrdiff_t consumed_chars = 0; |
| 2956 | int i; | 2956 | int i; |
| 2957 | int rejected = 0; | 2957 | int rejected = 0; |
| 2958 | int found = 0; | 2958 | int found = 0; |
| @@ -3462,7 +3462,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3462 | loop and one more charset annotation at the end. */ | 3462 | loop and one more charset annotation at the end. */ |
| 3463 | int *charbuf_end | 3463 | int *charbuf_end |
| 3464 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); | 3464 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); |
| 3465 | EMACS_INT consumed_chars = 0, consumed_chars_base; | 3465 | ptrdiff_t consumed_chars = 0, consumed_chars_base; |
| 3466 | int multibytep = coding->src_multibyte; | 3466 | int multibytep = coding->src_multibyte; |
| 3467 | /* Charsets invoked to graphic plane 0 and 1 respectively. */ | 3467 | /* Charsets invoked to graphic plane 0 and 1 respectively. */ |
| 3468 | int charset_id_0 = CODING_ISO_INVOKED_CHARSET (coding, 0); | 3468 | int charset_id_0 = CODING_ISO_INVOKED_CHARSET (coding, 0); |
| @@ -3472,8 +3472,8 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3472 | int c; | 3472 | int c; |
| 3473 | struct composition_status *cmp_status = CODING_ISO_CMP_STATUS (coding); | 3473 | struct composition_status *cmp_status = CODING_ISO_CMP_STATUS (coding); |
| 3474 | Lisp_Object attrs = CODING_ID_ATTRS (coding->id); | 3474 | Lisp_Object attrs = CODING_ID_ATTRS (coding->id); |
| 3475 | EMACS_INT char_offset = coding->produced_char; | 3475 | ptrdiff_t char_offset = coding->produced_char; |
| 3476 | EMACS_INT last_offset = char_offset; | 3476 | ptrdiff_t last_offset = char_offset; |
| 3477 | int last_id = charset_ascii; | 3477 | int last_id = charset_ascii; |
| 3478 | int eol_dos = | 3478 | int eol_dos = |
| 3479 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 3479 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| @@ -4201,10 +4201,10 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 4201 | static unsigned char * | 4201 | static unsigned char * |
| 4202 | encode_invocation_designation (struct charset *charset, | 4202 | encode_invocation_designation (struct charset *charset, |
| 4203 | struct coding_system *coding, | 4203 | struct coding_system *coding, |
| 4204 | unsigned char *dst, EMACS_INT *p_nchars) | 4204 | unsigned char *dst, ptrdiff_t *p_nchars) |
| 4205 | { | 4205 | { |
| 4206 | int multibytep = coding->dst_multibyte; | 4206 | int multibytep = coding->dst_multibyte; |
| 4207 | EMACS_INT produced_chars = *p_nchars; | 4207 | ptrdiff_t produced_chars = *p_nchars; |
| 4208 | int reg; /* graphic register number */ | 4208 | int reg; /* graphic register number */ |
| 4209 | int id = CHARSET_ID (charset); | 4209 | int id = CHARSET_ID (charset); |
| 4210 | 4210 | ||
| @@ -4296,7 +4296,7 @@ encode_designation_at_bol (struct coding_system *coding, int *charbuf, | |||
| 4296 | /* Table of charsets to be designated to each graphic register. */ | 4296 | /* Table of charsets to be designated to each graphic register. */ |
| 4297 | int r[4]; | 4297 | int r[4]; |
| 4298 | int c, found = 0, reg; | 4298 | int c, found = 0, reg; |
| 4299 | EMACS_INT produced_chars = 0; | 4299 | ptrdiff_t produced_chars = 0; |
| 4300 | int multibytep = coding->dst_multibyte; | 4300 | int multibytep = coding->dst_multibyte; |
| 4301 | Lisp_Object attrs; | 4301 | Lisp_Object attrs; |
| 4302 | Lisp_Object charset_list; | 4302 | Lisp_Object charset_list; |
| @@ -4351,7 +4351,7 @@ encode_coding_iso_2022 (struct coding_system *coding) | |||
| 4351 | int bol_designation | 4351 | int bol_designation |
| 4352 | = (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL | 4352 | = (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL |
| 4353 | && CODING_ISO_BOL (coding)); | 4353 | && CODING_ISO_BOL (coding)); |
| 4354 | EMACS_INT produced_chars = 0; | 4354 | ptrdiff_t produced_chars = 0; |
| 4355 | Lisp_Object attrs, eol_type, charset_list; | 4355 | Lisp_Object attrs, eol_type, charset_list; |
| 4356 | int ascii_compatible; | 4356 | int ascii_compatible; |
| 4357 | int c; | 4357 | int c; |
| @@ -4539,7 +4539,7 @@ detect_coding_sjis (struct coding_system *coding, | |||
| 4539 | const unsigned char *src = coding->source, *src_base; | 4539 | const unsigned char *src = coding->source, *src_base; |
| 4540 | const unsigned char *src_end = coding->source + coding->src_bytes; | 4540 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 4541 | int multibytep = coding->src_multibyte; | 4541 | int multibytep = coding->src_multibyte; |
| 4542 | EMACS_INT consumed_chars = 0; | 4542 | ptrdiff_t consumed_chars = 0; |
| 4543 | int found = 0; | 4543 | int found = 0; |
| 4544 | int c; | 4544 | int c; |
| 4545 | Lisp_Object attrs, charset_list; | 4545 | Lisp_Object attrs, charset_list; |
| @@ -4596,7 +4596,7 @@ detect_coding_big5 (struct coding_system *coding, | |||
| 4596 | const unsigned char *src = coding->source, *src_base; | 4596 | const unsigned char *src = coding->source, *src_base; |
| 4597 | const unsigned char *src_end = coding->source + coding->src_bytes; | 4597 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 4598 | int multibytep = coding->src_multibyte; | 4598 | int multibytep = coding->src_multibyte; |
| 4599 | EMACS_INT consumed_chars = 0; | 4599 | ptrdiff_t consumed_chars = 0; |
| 4600 | int found = 0; | 4600 | int found = 0; |
| 4601 | int c; | 4601 | int c; |
| 4602 | 4602 | ||
| @@ -4647,13 +4647,13 @@ decode_coding_sjis (struct coding_system *coding) | |||
| 4647 | the end. */ | 4647 | the end. */ |
| 4648 | int *charbuf_end | 4648 | int *charbuf_end |
| 4649 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); | 4649 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); |
| 4650 | EMACS_INT consumed_chars = 0, consumed_chars_base; | 4650 | ptrdiff_t consumed_chars = 0, consumed_chars_base; |
| 4651 | int multibytep = coding->src_multibyte; | 4651 | int multibytep = coding->src_multibyte; |
| 4652 | struct charset *charset_roman, *charset_kanji, *charset_kana; | 4652 | struct charset *charset_roman, *charset_kanji, *charset_kana; |
| 4653 | struct charset *charset_kanji2; | 4653 | struct charset *charset_kanji2; |
| 4654 | Lisp_Object attrs, charset_list, val; | 4654 | Lisp_Object attrs, charset_list, val; |
| 4655 | EMACS_INT char_offset = coding->produced_char; | 4655 | ptrdiff_t char_offset = coding->produced_char; |
| 4656 | EMACS_INT last_offset = char_offset; | 4656 | ptrdiff_t last_offset = char_offset; |
| 4657 | int last_id = charset_ascii; | 4657 | int last_id = charset_ascii; |
| 4658 | int eol_dos = | 4658 | int eol_dos = |
| 4659 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 4659 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| @@ -4765,12 +4765,12 @@ decode_coding_big5 (struct coding_system *coding) | |||
| 4765 | the end. */ | 4765 | the end. */ |
| 4766 | int *charbuf_end | 4766 | int *charbuf_end |
| 4767 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); | 4767 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); |
| 4768 | EMACS_INT consumed_chars = 0, consumed_chars_base; | 4768 | ptrdiff_t consumed_chars = 0, consumed_chars_base; |
| 4769 | int multibytep = coding->src_multibyte; | 4769 | int multibytep = coding->src_multibyte; |
| 4770 | struct charset *charset_roman, *charset_big5; | 4770 | struct charset *charset_roman, *charset_big5; |
| 4771 | Lisp_Object attrs, charset_list, val; | 4771 | Lisp_Object attrs, charset_list, val; |
| 4772 | EMACS_INT char_offset = coding->produced_char; | 4772 | ptrdiff_t char_offset = coding->produced_char; |
| 4773 | EMACS_INT last_offset = char_offset; | 4773 | ptrdiff_t last_offset = char_offset; |
| 4774 | int last_id = charset_ascii; | 4774 | int last_id = charset_ascii; |
| 4775 | int eol_dos = | 4775 | int eol_dos = |
| 4776 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 4776 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| @@ -4867,7 +4867,7 @@ encode_coding_sjis (struct coding_system *coding) | |||
| 4867 | unsigned char *dst = coding->destination + coding->produced; | 4867 | unsigned char *dst = coding->destination + coding->produced; |
| 4868 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 4868 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 4869 | int safe_room = 4; | 4869 | int safe_room = 4; |
| 4870 | EMACS_INT produced_chars = 0; | 4870 | ptrdiff_t produced_chars = 0; |
| 4871 | Lisp_Object attrs, charset_list, val; | 4871 | Lisp_Object attrs, charset_list, val; |
| 4872 | int ascii_compatible; | 4872 | int ascii_compatible; |
| 4873 | struct charset *charset_kanji, *charset_kana; | 4873 | struct charset *charset_kanji, *charset_kana; |
| @@ -4958,7 +4958,7 @@ encode_coding_big5 (struct coding_system *coding) | |||
| 4958 | unsigned char *dst = coding->destination + coding->produced; | 4958 | unsigned char *dst = coding->destination + coding->produced; |
| 4959 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 4959 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 4960 | int safe_room = 4; | 4960 | int safe_room = 4; |
| 4961 | EMACS_INT produced_chars = 0; | 4961 | ptrdiff_t produced_chars = 0; |
| 4962 | Lisp_Object attrs, charset_list, val; | 4962 | Lisp_Object attrs, charset_list, val; |
| 4963 | int ascii_compatible; | 4963 | int ascii_compatible; |
| 4964 | struct charset *charset_big5; | 4964 | struct charset *charset_big5; |
| @@ -5033,10 +5033,10 @@ detect_coding_ccl (struct coding_system *coding, | |||
| 5033 | const unsigned char *src = coding->source, *src_base; | 5033 | const unsigned char *src = coding->source, *src_base; |
| 5034 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5034 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 5035 | int multibytep = coding->src_multibyte; | 5035 | int multibytep = coding->src_multibyte; |
| 5036 | EMACS_INT consumed_chars = 0; | 5036 | ptrdiff_t consumed_chars = 0; |
| 5037 | int found = 0; | 5037 | int found = 0; |
| 5038 | unsigned char *valids; | 5038 | unsigned char *valids; |
| 5039 | EMACS_INT head_ascii = coding->head_ascii; | 5039 | ptrdiff_t head_ascii = coding->head_ascii; |
| 5040 | Lisp_Object attrs; | 5040 | Lisp_Object attrs; |
| 5041 | 5041 | ||
| 5042 | detect_info->checked |= CATEGORY_MASK_CCL; | 5042 | detect_info->checked |= CATEGORY_MASK_CCL; |
| @@ -5073,7 +5073,7 @@ decode_coding_ccl (struct coding_system *coding) | |||
| 5073 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5073 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 5074 | int *charbuf = coding->charbuf + coding->charbuf_used; | 5074 | int *charbuf = coding->charbuf + coding->charbuf_used; |
| 5075 | int *charbuf_end = coding->charbuf + coding->charbuf_size; | 5075 | int *charbuf_end = coding->charbuf + coding->charbuf_size; |
| 5076 | EMACS_INT consumed_chars = 0; | 5076 | ptrdiff_t consumed_chars = 0; |
| 5077 | int multibytep = coding->src_multibyte; | 5077 | int multibytep = coding->src_multibyte; |
| 5078 | struct ccl_program *ccl = &coding->spec.ccl->ccl; | 5078 | struct ccl_program *ccl = &coding->spec.ccl->ccl; |
| 5079 | int source_charbuf[1024]; | 5079 | int source_charbuf[1024]; |
| @@ -5145,7 +5145,7 @@ encode_coding_ccl (struct coding_system *coding) | |||
| 5145 | unsigned char *dst = coding->destination + coding->produced; | 5145 | unsigned char *dst = coding->destination + coding->produced; |
| 5146 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 5146 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 5147 | int destination_charbuf[1024]; | 5147 | int destination_charbuf[1024]; |
| 5148 | EMACS_INT produced_chars = 0; | 5148 | ptrdiff_t produced_chars = 0; |
| 5149 | int i; | 5149 | int i; |
| 5150 | Lisp_Object attrs, charset_list; | 5150 | Lisp_Object attrs, charset_list; |
| 5151 | 5151 | ||
| @@ -5232,7 +5232,7 @@ encode_coding_raw_text (struct coding_system *coding) | |||
| 5232 | int *charbuf_end = coding->charbuf + coding->charbuf_used; | 5232 | int *charbuf_end = coding->charbuf + coding->charbuf_used; |
| 5233 | unsigned char *dst = coding->destination + coding->produced; | 5233 | unsigned char *dst = coding->destination + coding->produced; |
| 5234 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 5234 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 5235 | EMACS_INT produced_chars = 0; | 5235 | ptrdiff_t produced_chars = 0; |
| 5236 | int c; | 5236 | int c; |
| 5237 | 5237 | ||
| 5238 | if (multibytep) | 5238 | if (multibytep) |
| @@ -5315,10 +5315,10 @@ detect_coding_charset (struct coding_system *coding, | |||
| 5315 | const unsigned char *src = coding->source, *src_base; | 5315 | const unsigned char *src = coding->source, *src_base; |
| 5316 | const unsigned char *src_end = coding->source + coding->src_bytes; | 5316 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 5317 | int multibytep = coding->src_multibyte; | 5317 | int multibytep = coding->src_multibyte; |
| 5318 | EMACS_INT consumed_chars = 0; | 5318 | ptrdiff_t consumed_chars = 0; |
| 5319 | Lisp_Object attrs, valids, name; | 5319 | Lisp_Object attrs, valids, name; |
| 5320 | int found = 0; | 5320 | int found = 0; |
| 5321 | EMACS_INT head_ascii = coding->head_ascii; | 5321 | ptrdiff_t head_ascii = coding->head_ascii; |
| 5322 | int check_latin_extra = 0; | 5322 | int check_latin_extra = 0; |
| 5323 | 5323 | ||
| 5324 | detect_info->checked |= CATEGORY_MASK_CHARSET; | 5324 | detect_info->checked |= CATEGORY_MASK_CHARSET; |
| @@ -5422,12 +5422,12 @@ decode_coding_charset (struct coding_system *coding) | |||
| 5422 | the end. */ | 5422 | the end. */ |
| 5423 | int *charbuf_end | 5423 | int *charbuf_end |
| 5424 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); | 5424 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); |
| 5425 | EMACS_INT consumed_chars = 0, consumed_chars_base; | 5425 | ptrdiff_t consumed_chars = 0, consumed_chars_base; |
| 5426 | int multibytep = coding->src_multibyte; | 5426 | int multibytep = coding->src_multibyte; |
| 5427 | Lisp_Object attrs = CODING_ID_ATTRS (coding->id); | 5427 | Lisp_Object attrs = CODING_ID_ATTRS (coding->id); |
| 5428 | Lisp_Object valids; | 5428 | Lisp_Object valids; |
| 5429 | EMACS_INT char_offset = coding->produced_char; | 5429 | ptrdiff_t char_offset = coding->produced_char; |
| 5430 | EMACS_INT last_offset = char_offset; | 5430 | ptrdiff_t last_offset = char_offset; |
| 5431 | int last_id = charset_ascii; | 5431 | int last_id = charset_ascii; |
| 5432 | int eol_dos = | 5432 | int eol_dos = |
| 5433 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 5433 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| @@ -5548,7 +5548,7 @@ encode_coding_charset (struct coding_system *coding) | |||
| 5548 | unsigned char *dst = coding->destination + coding->produced; | 5548 | unsigned char *dst = coding->destination + coding->produced; |
| 5549 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 5549 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 5550 | int safe_room = MAX_MULTIBYTE_LENGTH; | 5550 | int safe_room = MAX_MULTIBYTE_LENGTH; |
| 5551 | EMACS_INT produced_chars = 0; | 5551 | ptrdiff_t produced_chars = 0; |
| 5552 | Lisp_Object attrs, charset_list; | 5552 | Lisp_Object attrs, charset_list; |
| 5553 | int ascii_compatible; | 5553 | int ascii_compatible; |
| 5554 | int c; | 5554 | int c; |
| @@ -6095,7 +6095,7 @@ complement_process_encoding_system (Lisp_Object coding_system) | |||
| 6095 | #define MAX_EOL_CHECK_COUNT 3 | 6095 | #define MAX_EOL_CHECK_COUNT 3 |
| 6096 | 6096 | ||
| 6097 | static int | 6097 | static int |
| 6098 | detect_eol (const unsigned char *source, EMACS_INT src_bytes, | 6098 | detect_eol (const unsigned char *source, ptrdiff_t src_bytes, |
| 6099 | enum coding_category category) | 6099 | enum coding_category category) |
| 6100 | { | 6100 | { |
| 6101 | const unsigned char *src = source, *src_end = src + src_bytes; | 6101 | const unsigned char *src = source, *src_end = src + src_bytes; |
| @@ -6456,7 +6456,7 @@ decode_eol (struct coding_system *coding) | |||
| 6456 | } | 6456 | } |
| 6457 | else if (EQ (eol_type, Qdos)) | 6457 | else if (EQ (eol_type, Qdos)) |
| 6458 | { | 6458 | { |
| 6459 | EMACS_INT n = 0; | 6459 | ptrdiff_t n = 0; |
| 6460 | 6460 | ||
| 6461 | if (NILP (coding->dst_object)) | 6461 | if (NILP (coding->dst_object)) |
| 6462 | { | 6462 | { |
| @@ -6471,9 +6471,9 @@ decode_eol (struct coding_system *coding) | |||
| 6471 | } | 6471 | } |
| 6472 | else | 6472 | else |
| 6473 | { | 6473 | { |
| 6474 | EMACS_INT pos_byte = coding->dst_pos_byte; | 6474 | ptrdiff_t pos_byte = coding->dst_pos_byte; |
| 6475 | EMACS_INT pos = coding->dst_pos; | 6475 | ptrdiff_t pos = coding->dst_pos; |
| 6476 | EMACS_INT pos_end = pos + coding->produced_char - 1; | 6476 | ptrdiff_t pos_end = pos + coding->produced_char - 1; |
| 6477 | 6477 | ||
| 6478 | while (pos < pos_end) | 6478 | while (pos < pos_end) |
| 6479 | { | 6479 | { |
| @@ -6636,8 +6636,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6636 | { | 6636 | { |
| 6637 | unsigned char *dst = coding->destination + coding->produced; | 6637 | unsigned char *dst = coding->destination + coding->produced; |
| 6638 | unsigned char *dst_end = coding->destination + coding->dst_bytes; | 6638 | unsigned char *dst_end = coding->destination + coding->dst_bytes; |
| 6639 | EMACS_INT produced; | 6639 | ptrdiff_t produced; |
| 6640 | EMACS_INT produced_chars = 0; | 6640 | ptrdiff_t produced_chars = 0; |
| 6641 | int carryover = 0; | 6641 | int carryover = 0; |
| 6642 | 6642 | ||
| 6643 | if (! coding->chars_at_source) | 6643 | if (! coding->chars_at_source) |
| @@ -6658,7 +6658,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6658 | 6658 | ||
| 6659 | if (c >= 0) | 6659 | if (c >= 0) |
| 6660 | { | 6660 | { |
| 6661 | EMACS_INT from_nchars = 1, to_nchars = 1; | 6661 | ptrdiff_t from_nchars = 1, to_nchars = 1; |
| 6662 | Lisp_Object trans = Qnil; | 6662 | Lisp_Object trans = Qnil; |
| 6663 | 6663 | ||
| 6664 | LOOKUP_TRANSLATION_TABLE (translation_table, c, trans); | 6664 | LOOKUP_TRANSLATION_TABLE (translation_table, c, trans); |
| @@ -6735,7 +6735,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6735 | if (coding->src_multibyte) | 6735 | if (coding->src_multibyte) |
| 6736 | { | 6736 | { |
| 6737 | int multibytep = 1; | 6737 | int multibytep = 1; |
| 6738 | EMACS_INT consumed_chars = 0; | 6738 | ptrdiff_t consumed_chars = 0; |
| 6739 | 6739 | ||
| 6740 | while (1) | 6740 | while (1) |
| 6741 | { | 6741 | { |
| @@ -6749,7 +6749,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6749 | dst_end = (unsigned char *) src; | 6749 | dst_end = (unsigned char *) src; |
| 6750 | if (dst == dst_end) | 6750 | if (dst == dst_end) |
| 6751 | { | 6751 | { |
| 6752 | EMACS_INT offset = src - coding->source; | 6752 | ptrdiff_t offset = src - coding->source; |
| 6753 | 6753 | ||
| 6754 | dst = alloc_destination (coding, src_end - src + 1, | 6754 | dst = alloc_destination (coding, src_end - src + 1, |
| 6755 | dst); | 6755 | dst); |
| @@ -6779,8 +6779,8 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6779 | dst_end = (unsigned char *) src; | 6779 | dst_end = (unsigned char *) src; |
| 6780 | if (dst >= dst_end - 1) | 6780 | if (dst >= dst_end - 1) |
| 6781 | { | 6781 | { |
| 6782 | EMACS_INT offset = src - coding->source; | 6782 | ptrdiff_t offset = src - coding->source; |
| 6783 | EMACS_INT more_bytes; | 6783 | ptrdiff_t more_bytes; |
| 6784 | 6784 | ||
| 6785 | if (EQ (coding->src_object, coding->dst_object)) | 6785 | if (EQ (coding->src_object, coding->dst_object)) |
| 6786 | more_bytes = ((src_end - src) / 2) + 2; | 6786 | more_bytes = ((src_end - src) / 2) + 2; |
| @@ -6802,11 +6802,11 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6802 | { | 6802 | { |
| 6803 | if (!EQ (coding->src_object, coding->dst_object)) | 6803 | if (!EQ (coding->src_object, coding->dst_object)) |
| 6804 | { | 6804 | { |
| 6805 | EMACS_INT require = coding->src_bytes - coding->dst_bytes; | 6805 | ptrdiff_t require = coding->src_bytes - coding->dst_bytes; |
| 6806 | 6806 | ||
| 6807 | if (require > 0) | 6807 | if (require > 0) |
| 6808 | { | 6808 | { |
| 6809 | EMACS_INT offset = src - coding->source; | 6809 | ptrdiff_t offset = src - coding->source; |
| 6810 | 6810 | ||
| 6811 | dst = alloc_destination (coding, require, dst); | 6811 | dst = alloc_destination (coding, require, dst); |
| 6812 | coding_set_source (coding); | 6812 | coding_set_source (coding); |
| @@ -6834,10 +6834,10 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 6834 | */ | 6834 | */ |
| 6835 | 6835 | ||
| 6836 | static inline void | 6836 | static inline void |
| 6837 | produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos) | 6837 | produce_composition (struct coding_system *coding, int *charbuf, ptrdiff_t pos) |
| 6838 | { | 6838 | { |
| 6839 | int len; | 6839 | int len; |
| 6840 | EMACS_INT to; | 6840 | ptrdiff_t to; |
| 6841 | enum composition_method method; | 6841 | enum composition_method method; |
| 6842 | Lisp_Object components; | 6842 | Lisp_Object components; |
| 6843 | 6843 | ||
| @@ -6878,9 +6878,9 @@ produce_composition (struct coding_system *coding, int *charbuf, EMACS_INT pos) | |||
| 6878 | */ | 6878 | */ |
| 6879 | 6879 | ||
| 6880 | static inline void | 6880 | static inline void |
| 6881 | produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos) | 6881 | produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos) |
| 6882 | { | 6882 | { |
| 6883 | EMACS_INT from = pos - charbuf[2]; | 6883 | ptrdiff_t from = pos - charbuf[2]; |
| 6884 | struct charset *charset = CHARSET_FROM_ID (charbuf[3]); | 6884 | struct charset *charset = CHARSET_FROM_ID (charbuf[3]); |
| 6885 | 6885 | ||
| 6886 | Fput_text_property (make_number (from), make_number (pos), | 6886 | Fput_text_property (make_number (from), make_number (pos), |
| @@ -6913,7 +6913,7 @@ produce_charset (struct coding_system *coding, int *charbuf, EMACS_INT pos) | |||
| 6913 | 6913 | ||
| 6914 | 6914 | ||
| 6915 | static void | 6915 | static void |
| 6916 | produce_annotation (struct coding_system *coding, EMACS_INT pos) | 6916 | produce_annotation (struct coding_system *coding, ptrdiff_t pos) |
| 6917 | { | 6917 | { |
| 6918 | int *charbuf = coding->charbuf; | 6918 | int *charbuf = coding->charbuf; |
| 6919 | int *charbuf_end = charbuf + coding->charbuf_used; | 6919 | int *charbuf_end = charbuf + coding->charbuf_used; |
| @@ -7013,7 +7013,7 @@ decode_coding (struct coding_system *coding) | |||
| 7013 | } | 7013 | } |
| 7014 | do | 7014 | do |
| 7015 | { | 7015 | { |
| 7016 | EMACS_INT pos = coding->dst_pos + coding->produced_char; | 7016 | ptrdiff_t pos = coding->dst_pos + coding->produced_char; |
| 7017 | 7017 | ||
| 7018 | coding_set_source (coding); | 7018 | coding_set_source (coding); |
| 7019 | coding->annotated = 0; | 7019 | coding->annotated = 0; |
| @@ -7106,11 +7106,11 @@ decode_coding (struct coding_system *coding) | |||
| 7106 | return BUF. */ | 7106 | return BUF. */ |
| 7107 | 7107 | ||
| 7108 | static inline int * | 7108 | static inline int * |
| 7109 | handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, | 7109 | handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit, |
| 7110 | struct coding_system *coding, int *buf, | 7110 | struct coding_system *coding, int *buf, |
| 7111 | EMACS_INT *stop) | 7111 | ptrdiff_t *stop) |
| 7112 | { | 7112 | { |
| 7113 | EMACS_INT start, end; | 7113 | ptrdiff_t start, end; |
| 7114 | Lisp_Object prop; | 7114 | Lisp_Object prop; |
| 7115 | 7115 | ||
| 7116 | if (! find_composition (pos, limit, &start, &end, &prop, coding->src_object) | 7116 | if (! find_composition (pos, limit, &start, &end, &prop, coding->src_object) |
| @@ -7189,9 +7189,9 @@ handle_composition_annotation (EMACS_INT pos, EMACS_INT limit, | |||
| 7189 | property value is non-nil (limiting by LIMIT), and return BUF. */ | 7189 | property value is non-nil (limiting by LIMIT), and return BUF. */ |
| 7190 | 7190 | ||
| 7191 | static inline int * | 7191 | static inline int * |
| 7192 | handle_charset_annotation (EMACS_INT pos, EMACS_INT limit, | 7192 | handle_charset_annotation (ptrdiff_t pos, ptrdiff_t limit, |
| 7193 | struct coding_system *coding, int *buf, | 7193 | struct coding_system *coding, int *buf, |
| 7194 | EMACS_INT *stop) | 7194 | ptrdiff_t *stop) |
| 7195 | { | 7195 | { |
| 7196 | Lisp_Object val, next; | 7196 | Lisp_Object val, next; |
| 7197 | int id; | 7197 | int id; |
| @@ -7218,12 +7218,12 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 7218 | int *buf_end = coding->charbuf + coding->charbuf_size; | 7218 | int *buf_end = coding->charbuf + coding->charbuf_size; |
| 7219 | const unsigned char *src = coding->source + coding->consumed; | 7219 | const unsigned char *src = coding->source + coding->consumed; |
| 7220 | const unsigned char *src_end = coding->source + coding->src_bytes; | 7220 | const unsigned char *src_end = coding->source + coding->src_bytes; |
| 7221 | EMACS_INT pos = coding->src_pos + coding->consumed_char; | 7221 | ptrdiff_t pos = coding->src_pos + coding->consumed_char; |
| 7222 | EMACS_INT end_pos = coding->src_pos + coding->src_chars; | 7222 | ptrdiff_t end_pos = coding->src_pos + coding->src_chars; |
| 7223 | int multibytep = coding->src_multibyte; | 7223 | int multibytep = coding->src_multibyte; |
| 7224 | Lisp_Object eol_type; | 7224 | Lisp_Object eol_type; |
| 7225 | int c; | 7225 | int c; |
| 7226 | EMACS_INT stop, stop_composition, stop_charset; | 7226 | ptrdiff_t stop, stop_composition, stop_charset; |
| 7227 | int *lookup_buf = NULL; | 7227 | int *lookup_buf = NULL; |
| 7228 | 7228 | ||
| 7229 | if (! NILP (translation_table)) | 7229 | if (! NILP (translation_table)) |
| @@ -7272,7 +7272,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table, | |||
| 7272 | 7272 | ||
| 7273 | if (! multibytep) | 7273 | if (! multibytep) |
| 7274 | { | 7274 | { |
| 7275 | EMACS_INT bytes; | 7275 | int bytes; |
| 7276 | 7276 | ||
| 7277 | if (coding->encoder == encode_coding_raw_text | 7277 | if (coding->encoder == encode_coding_raw_text |
| 7278 | || coding->encoder == encode_coding_ccl) | 7278 | || coding->encoder == encode_coding_ccl) |
| @@ -7498,9 +7498,9 @@ code_conversion_save (int with_work_buf, int multibyte) | |||
| 7498 | 7498 | ||
| 7499 | int | 7499 | int |
| 7500 | decode_coding_gap (struct coding_system *coding, | 7500 | decode_coding_gap (struct coding_system *coding, |
| 7501 | EMACS_INT chars, EMACS_INT bytes) | 7501 | ptrdiff_t chars, ptrdiff_t bytes) |
| 7502 | { | 7502 | { |
| 7503 | int count = SPECPDL_INDEX (); | 7503 | ptrdiff_t count = SPECPDL_INDEX (); |
| 7504 | Lisp_Object attrs; | 7504 | Lisp_Object attrs; |
| 7505 | 7505 | ||
| 7506 | code_conversion_save (0, 0); | 7506 | code_conversion_save (0, 0); |
| @@ -7527,7 +7527,7 @@ decode_coding_gap (struct coding_system *coding, | |||
| 7527 | attrs = CODING_ID_ATTRS (coding->id); | 7527 | attrs = CODING_ID_ATTRS (coding->id); |
| 7528 | if (! NILP (CODING_ATTR_POST_READ (attrs))) | 7528 | if (! NILP (CODING_ATTR_POST_READ (attrs))) |
| 7529 | { | 7529 | { |
| 7530 | EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE; | 7530 | ptrdiff_t prev_Z = Z, prev_Z_BYTE = Z_BYTE; |
| 7531 | Lisp_Object val; | 7531 | Lisp_Object val; |
| 7532 | 7532 | ||
| 7533 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); | 7533 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); |
| @@ -7575,15 +7575,15 @@ decode_coding_gap (struct coding_system *coding, | |||
| 7575 | void | 7575 | void |
| 7576 | decode_coding_object (struct coding_system *coding, | 7576 | decode_coding_object (struct coding_system *coding, |
| 7577 | Lisp_Object src_object, | 7577 | Lisp_Object src_object, |
| 7578 | EMACS_INT from, EMACS_INT from_byte, | 7578 | ptrdiff_t from, ptrdiff_t from_byte, |
| 7579 | EMACS_INT to, EMACS_INT to_byte, | 7579 | ptrdiff_t to, ptrdiff_t to_byte, |
| 7580 | Lisp_Object dst_object) | 7580 | Lisp_Object dst_object) |
| 7581 | { | 7581 | { |
| 7582 | int count = SPECPDL_INDEX (); | 7582 | ptrdiff_t count = SPECPDL_INDEX (); |
| 7583 | unsigned char *destination IF_LINT (= NULL); | 7583 | unsigned char *destination IF_LINT (= NULL); |
| 7584 | EMACS_INT dst_bytes IF_LINT (= 0); | 7584 | ptrdiff_t dst_bytes IF_LINT (= 0); |
| 7585 | EMACS_INT chars = to - from; | 7585 | ptrdiff_t chars = to - from; |
| 7586 | EMACS_INT bytes = to_byte - from_byte; | 7586 | ptrdiff_t bytes = to_byte - from_byte; |
| 7587 | Lisp_Object attrs; | 7587 | Lisp_Object attrs; |
| 7588 | int saved_pt = -1, saved_pt_byte IF_LINT (= 0); | 7588 | int saved_pt = -1, saved_pt_byte IF_LINT (= 0); |
| 7589 | int need_marker_adjustment = 0; | 7589 | int need_marker_adjustment = 0; |
| @@ -7676,7 +7676,7 @@ decode_coding_object (struct coding_system *coding, | |||
| 7676 | if (! NILP (CODING_ATTR_POST_READ (attrs))) | 7676 | if (! NILP (CODING_ATTR_POST_READ (attrs))) |
| 7677 | { | 7677 | { |
| 7678 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 7678 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 7679 | EMACS_INT prev_Z = Z, prev_Z_BYTE = Z_BYTE; | 7679 | ptrdiff_t prev_Z = Z, prev_Z_BYTE = Z_BYTE; |
| 7680 | Lisp_Object val; | 7680 | Lisp_Object val; |
| 7681 | 7681 | ||
| 7682 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); | 7682 | TEMP_SET_PT_BOTH (coding->dst_pos, coding->dst_pos_byte); |
| @@ -7765,13 +7765,13 @@ decode_coding_object (struct coding_system *coding, | |||
| 7765 | void | 7765 | void |
| 7766 | encode_coding_object (struct coding_system *coding, | 7766 | encode_coding_object (struct coding_system *coding, |
| 7767 | Lisp_Object src_object, | 7767 | Lisp_Object src_object, |
| 7768 | EMACS_INT from, EMACS_INT from_byte, | 7768 | ptrdiff_t from, ptrdiff_t from_byte, |
| 7769 | EMACS_INT to, EMACS_INT to_byte, | 7769 | ptrdiff_t to, ptrdiff_t to_byte, |
| 7770 | Lisp_Object dst_object) | 7770 | Lisp_Object dst_object) |
| 7771 | { | 7771 | { |
| 7772 | int count = SPECPDL_INDEX (); | 7772 | ptrdiff_t count = SPECPDL_INDEX (); |
| 7773 | EMACS_INT chars = to - from; | 7773 | ptrdiff_t chars = to - from; |
| 7774 | EMACS_INT bytes = to_byte - from_byte; | 7774 | ptrdiff_t bytes = to_byte - from_byte; |
| 7775 | Lisp_Object attrs; | 7775 | Lisp_Object attrs; |
| 7776 | int saved_pt = -1, saved_pt_byte IF_LINT (= 0); | 7776 | int saved_pt = -1, saved_pt_byte IF_LINT (= 0); |
| 7777 | int need_marker_adjustment = 0; | 7777 | int need_marker_adjustment = 0; |
| @@ -8019,7 +8019,7 @@ are lower-case). */) | |||
| 8019 | (Lisp_Object prompt, Lisp_Object default_coding_system) | 8019 | (Lisp_Object prompt, Lisp_Object default_coding_system) |
| 8020 | { | 8020 | { |
| 8021 | Lisp_Object val; | 8021 | Lisp_Object val; |
| 8022 | int count = SPECPDL_INDEX (); | 8022 | ptrdiff_t count = SPECPDL_INDEX (); |
| 8023 | 8023 | ||
| 8024 | if (SYMBOLP (default_coding_system)) | 8024 | if (SYMBOLP (default_coding_system)) |
| 8025 | default_coding_system = SYMBOL_NAME (default_coding_system); | 8025 | default_coding_system = SYMBOL_NAME (default_coding_system); |
| @@ -8071,7 +8071,7 @@ function `define-coding-system'. */) | |||
| 8071 | 8071 | ||
| 8072 | Lisp_Object | 8072 | Lisp_Object |
| 8073 | detect_coding_system (const unsigned char *src, | 8073 | detect_coding_system (const unsigned char *src, |
| 8074 | EMACS_INT src_chars, EMACS_INT src_bytes, | 8074 | ptrdiff_t src_chars, ptrdiff_t src_bytes, |
| 8075 | int highest, int multibytep, | 8075 | int highest, int multibytep, |
| 8076 | Lisp_Object coding_system) | 8076 | Lisp_Object coding_system) |
| 8077 | { | 8077 | { |
| @@ -8391,8 +8391,8 @@ If optional argument HIGHEST is non-nil, return the coding system of | |||
| 8391 | highest priority. */) | 8391 | highest priority. */) |
| 8392 | (Lisp_Object start, Lisp_Object end, Lisp_Object highest) | 8392 | (Lisp_Object start, Lisp_Object end, Lisp_Object highest) |
| 8393 | { | 8393 | { |
| 8394 | int from, to; | 8394 | ptrdiff_t from, to; |
| 8395 | int from_byte, to_byte; | 8395 | ptrdiff_t from_byte, to_byte; |
| 8396 | 8396 | ||
| 8397 | CHECK_NUMBER_COERCE_MARKER (start); | 8397 | CHECK_NUMBER_COERCE_MARKER (start); |
| 8398 | CHECK_NUMBER_COERCE_MARKER (end); | 8398 | CHECK_NUMBER_COERCE_MARKER (end); |
| @@ -8472,7 +8472,7 @@ DEFUN ("find-coding-systems-region-internal", | |||
| 8472 | (Lisp_Object start, Lisp_Object end, Lisp_Object exclude) | 8472 | (Lisp_Object start, Lisp_Object end, Lisp_Object exclude) |
| 8473 | { | 8473 | { |
| 8474 | Lisp_Object coding_attrs_list, safe_codings; | 8474 | Lisp_Object coding_attrs_list, safe_codings; |
| 8475 | EMACS_INT start_byte, end_byte; | 8475 | ptrdiff_t start_byte, end_byte; |
| 8476 | const unsigned char *p, *pbeg, *pend; | 8476 | const unsigned char *p, *pbeg, *pend; |
| 8477 | int c; | 8477 | int c; |
| 8478 | Lisp_Object tail, elt, work_table; | 8478 | Lisp_Object tail, elt, work_table; |
| @@ -8566,7 +8566,7 @@ DEFUN ("find-coding-systems-region-internal", | |||
| 8566 | } | 8566 | } |
| 8567 | if (charset_map_loaded) | 8567 | if (charset_map_loaded) |
| 8568 | { | 8568 | { |
| 8569 | EMACS_INT p_offset = p - pbeg, pend_offset = pend - pbeg; | 8569 | ptrdiff_t p_offset = p - pbeg, pend_offset = pend - pbeg; |
| 8570 | 8570 | ||
| 8571 | if (STRINGP (start)) | 8571 | if (STRINGP (start)) |
| 8572 | pbeg = SDATA (start); | 8572 | pbeg = SDATA (start); |
| @@ -8604,11 +8604,11 @@ for un-encodable characters. In that case, START and END are indexes | |||
| 8604 | to the string. */) | 8604 | to the string. */) |
| 8605 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string) | 8605 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string) |
| 8606 | { | 8606 | { |
| 8607 | int n; | 8607 | EMACS_INT n; |
| 8608 | struct coding_system coding; | 8608 | struct coding_system coding; |
| 8609 | Lisp_Object attrs, charset_list, translation_table; | 8609 | Lisp_Object attrs, charset_list, translation_table; |
| 8610 | Lisp_Object positions; | 8610 | Lisp_Object positions; |
| 8611 | int from, to; | 8611 | ptrdiff_t from, to; |
| 8612 | const unsigned char *p, *stop, *pend; | 8612 | const unsigned char *p, *stop, *pend; |
| 8613 | int ascii_compatible; | 8613 | int ascii_compatible; |
| 8614 | 8614 | ||
| @@ -8641,11 +8641,10 @@ to the string. */) | |||
| 8641 | CHECK_STRING (string); | 8641 | CHECK_STRING (string); |
| 8642 | CHECK_NATNUM (start); | 8642 | CHECK_NATNUM (start); |
| 8643 | CHECK_NATNUM (end); | 8643 | CHECK_NATNUM (end); |
| 8644 | if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string))) | ||
| 8645 | args_out_of_range_3 (string, start, end); | ||
| 8644 | from = XINT (start); | 8646 | from = XINT (start); |
| 8645 | to = XINT (end); | 8647 | to = XINT (end); |
| 8646 | if (from > to | ||
| 8647 | || to > SCHARS (string)) | ||
| 8648 | args_out_of_range_3 (string, start, end); | ||
| 8649 | if (! STRING_MULTIBYTE (string)) | 8648 | if (! STRING_MULTIBYTE (string)) |
| 8650 | return Qnil; | 8649 | return Qnil; |
| 8651 | p = SDATA (string) + string_char_to_byte (string, from); | 8650 | p = SDATA (string) + string_char_to_byte (string, from); |
| @@ -8720,8 +8719,8 @@ is nil. */) | |||
| 8720 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list) | 8719 | (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system_list) |
| 8721 | { | 8720 | { |
| 8722 | Lisp_Object list; | 8721 | Lisp_Object list; |
| 8723 | EMACS_INT start_byte, end_byte; | 8722 | ptrdiff_t start_byte, end_byte; |
| 8724 | int pos; | 8723 | ptrdiff_t pos; |
| 8725 | const unsigned char *p, *pbeg, *pend; | 8724 | const unsigned char *p, *pbeg, *pend; |
| 8726 | int c; | 8725 | int c; |
| 8727 | Lisp_Object tail, elt, attrs; | 8726 | Lisp_Object tail, elt, attrs; |
| @@ -8794,7 +8793,7 @@ is nil. */) | |||
| 8794 | } | 8793 | } |
| 8795 | if (charset_map_loaded) | 8794 | if (charset_map_loaded) |
| 8796 | { | 8795 | { |
| 8797 | EMACS_INT p_offset = p - pbeg, pend_offset = pend - pbeg; | 8796 | ptrdiff_t p_offset = p - pbeg, pend_offset = pend - pbeg; |
| 8798 | 8797 | ||
| 8799 | if (STRINGP (start)) | 8798 | if (STRINGP (start)) |
| 8800 | pbeg = SDATA (start); | 8799 | pbeg = SDATA (start); |
| @@ -8827,7 +8826,7 @@ code_convert_region (Lisp_Object start, Lisp_Object end, | |||
| 8827 | int encodep, int norecord) | 8826 | int encodep, int norecord) |
| 8828 | { | 8827 | { |
| 8829 | struct coding_system coding; | 8828 | struct coding_system coding; |
| 8830 | EMACS_INT from, from_byte, to, to_byte; | 8829 | ptrdiff_t from, from_byte, to, to_byte; |
| 8831 | Lisp_Object src_object; | 8830 | Lisp_Object src_object; |
| 8832 | 8831 | ||
| 8833 | CHECK_NUMBER_COERCE_MARKER (start); | 8832 | CHECK_NUMBER_COERCE_MARKER (start); |
| @@ -8915,7 +8914,7 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system, | |||
| 8915 | Lisp_Object dst_object, int encodep, int nocopy, int norecord) | 8914 | Lisp_Object dst_object, int encodep, int nocopy, int norecord) |
| 8916 | { | 8915 | { |
| 8917 | struct coding_system coding; | 8916 | struct coding_system coding; |
| 8918 | EMACS_INT chars, bytes; | 8917 | ptrdiff_t chars, bytes; |
| 8919 | 8918 | ||
| 8920 | CHECK_STRING (string); | 8919 | CHECK_STRING (string); |
| 8921 | if (NILP (coding_system)) | 8920 | if (NILP (coding_system)) |
| @@ -9290,7 +9289,7 @@ usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) | |||
| 9290 | error ("Too few arguments"); | 9289 | error ("Too few arguments"); |
| 9291 | operation = args[0]; | 9290 | operation = args[0]; |
| 9292 | if (!SYMBOLP (operation) | 9291 | if (!SYMBOLP (operation) |
| 9293 | || !NATNUMP (target_idx = Fget (operation, Qtarget_idx))) | 9292 | || (target_idx = Fget (operation, Qtarget_idx), !NATNUMP (target_idx))) |
| 9294 | error ("Invalid first argument"); | 9293 | error ("Invalid first argument"); |
| 9295 | if (nargs < 1 + XFASTINT (target_idx)) | 9294 | if (nargs < 1 + XFASTINT (target_idx)) |
| 9296 | error ("Too few arguments for operation `%s'", | 9295 | error ("Too few arguments for operation `%s'", |
| @@ -9511,8 +9510,12 @@ usage: (define-coding-system-internal ...) */) | |||
| 9511 | charset_list = Vemacs_mule_charset_list; | 9510 | charset_list = Vemacs_mule_charset_list; |
| 9512 | } | 9511 | } |
| 9513 | for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) | 9512 | for (tail = charset_list; CONSP (tail); tail = XCDR (tail)) |
| 9514 | if (max_charset_id < XFASTINT (XCAR (tail))) | 9513 | { |
| 9515 | max_charset_id = XFASTINT (XCAR (tail)); | 9514 | if (! RANGED_INTEGERP (0, XCAR (tail), INT_MAX - 1)) |
| 9515 | error ("Invalid charset-list"); | ||
| 9516 | if (max_charset_id < XFASTINT (XCAR (tail))) | ||
| 9517 | max_charset_id = XFASTINT (XCAR (tail)); | ||
| 9518 | } | ||
| 9516 | } | 9519 | } |
| 9517 | else | 9520 | else |
| 9518 | { | 9521 | { |
| @@ -9672,23 +9675,23 @@ usage: (define-coding-system-internal ...) */) | |||
| 9672 | val = Fcar (tail); | 9675 | val = Fcar (tail); |
| 9673 | if (INTEGERP (val)) | 9676 | if (INTEGERP (val)) |
| 9674 | { | 9677 | { |
| 9675 | from = to = XINT (val); | 9678 | if (! (0 <= XINT (val) && XINT (val) <= 255)) |
| 9676 | if (from < 0 || from > 255) | ||
| 9677 | args_out_of_range_3 (val, make_number (0), make_number (255)); | 9679 | args_out_of_range_3 (val, make_number (0), make_number (255)); |
| 9680 | from = to = XINT (val); | ||
| 9678 | } | 9681 | } |
| 9679 | else | 9682 | else |
| 9680 | { | 9683 | { |
| 9681 | CHECK_CONS (val); | 9684 | CHECK_CONS (val); |
| 9682 | CHECK_NATNUM_CAR (val); | 9685 | CHECK_NATNUM_CAR (val); |
| 9683 | CHECK_NATNUM_CDR (val); | 9686 | CHECK_NUMBER_CDR (val); |
| 9684 | from = XINT (XCAR (val)); | 9687 | if (XINT (XCAR (val)) > 255) |
| 9685 | if (from > 255) | ||
| 9686 | args_out_of_range_3 (XCAR (val), | 9688 | args_out_of_range_3 (XCAR (val), |
| 9687 | make_number (0), make_number (255)); | 9689 | make_number (0), make_number (255)); |
| 9688 | to = XINT (XCDR (val)); | 9690 | from = XINT (XCAR (val)); |
| 9689 | if (to < from || to > 255) | 9691 | if (! (from <= XINT (XCDR (val)) && XINT (XCDR (val)) <= 255)) |
| 9690 | args_out_of_range_3 (XCDR (val), | 9692 | args_out_of_range_3 (XCDR (val), |
| 9691 | XCAR (val), make_number (255)); | 9693 | XCAR (val), make_number (255)); |
| 9694 | to = XINT (XCDR (val)); | ||
| 9692 | } | 9695 | } |
| 9693 | for (i = from; i <= to; i++) | 9696 | for (i = from; i <= to; i++) |
| 9694 | SSET (valids, i, 1); | 9697 | SSET (valids, i, 1); |
| @@ -9783,9 +9786,10 @@ usage: (define-coding-system-internal ...) */) | |||
| 9783 | 9786 | ||
| 9784 | flags = args[coding_arg_iso2022_flags]; | 9787 | flags = args[coding_arg_iso2022_flags]; |
| 9785 | CHECK_NATNUM (flags); | 9788 | CHECK_NATNUM (flags); |
| 9786 | i = XINT (flags); | 9789 | i = XINT (flags) & INT_MAX; |
| 9787 | if (EQ (args[coding_arg_charset_list], Qiso_2022)) | 9790 | if (EQ (args[coding_arg_charset_list], Qiso_2022)) |
| 9788 | flags = make_number (i | CODING_ISO_FLAG_FULL_SUPPORT); | 9791 | i |= CODING_ISO_FLAG_FULL_SUPPORT; |
| 9792 | flags = make_number (i); | ||
| 9789 | 9793 | ||
| 9790 | ASET (attrs, coding_attr_iso_initial, initial); | 9794 | ASET (attrs, coding_attr_iso_initial, initial); |
| 9791 | ASET (attrs, coding_attr_iso_usage, reg_usage); | 9795 | ASET (attrs, coding_attr_iso_usage, reg_usage); |
diff --git a/src/coding.h b/src/coding.h index fdf9b762e75..3cf28fb2458 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -449,25 +449,25 @@ struct coding_system | |||
| 449 | -1 in setup_coding_system, and updated by detect_coding. So, | 449 | -1 in setup_coding_system, and updated by detect_coding. So, |
| 450 | when this is equal to the byte length of the text being | 450 | when this is equal to the byte length of the text being |
| 451 | converted, we can skip the actual conversion process. */ | 451 | converted, we can skip the actual conversion process. */ |
| 452 | EMACS_INT head_ascii; | 452 | ptrdiff_t head_ascii; |
| 453 | 453 | ||
| 454 | /* The following members are set by encoding/decoding routine. */ | 454 | /* The following members are set by encoding/decoding routine. */ |
| 455 | EMACS_INT produced, produced_char, consumed, consumed_char; | 455 | ptrdiff_t produced, produced_char, consumed, consumed_char; |
| 456 | 456 | ||
| 457 | /* Number of error source data found in a decoding routine. */ | 457 | /* Number of error source data found in a decoding routine. */ |
| 458 | int errors; | 458 | int errors; |
| 459 | 459 | ||
| 460 | /* Store the positions of error source data. */ | 460 | /* Store the positions of error source data. */ |
| 461 | EMACS_INT *error_positions; | 461 | ptrdiff_t *error_positions; |
| 462 | 462 | ||
| 463 | /* Finish status of code conversion. */ | 463 | /* Finish status of code conversion. */ |
| 464 | enum coding_result_code result; | 464 | enum coding_result_code result; |
| 465 | 465 | ||
| 466 | EMACS_INT src_pos, src_pos_byte, src_chars, src_bytes; | 466 | ptrdiff_t src_pos, src_pos_byte, src_chars, src_bytes; |
| 467 | Lisp_Object src_object; | 467 | Lisp_Object src_object; |
| 468 | const unsigned char *source; | 468 | const unsigned char *source; |
| 469 | 469 | ||
| 470 | EMACS_INT dst_pos, dst_pos_byte, dst_bytes; | 470 | ptrdiff_t dst_pos, dst_pos_byte, dst_bytes; |
| 471 | Lisp_Object dst_object; | 471 | Lisp_Object dst_object; |
| 472 | unsigned char *destination; | 472 | unsigned char *destination; |
| 473 | 473 | ||
| @@ -704,13 +704,13 @@ extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object); | |||
| 704 | extern Lisp_Object complement_process_encoding_system (Lisp_Object); | 704 | extern Lisp_Object complement_process_encoding_system (Lisp_Object); |
| 705 | 705 | ||
| 706 | extern int decode_coding_gap (struct coding_system *, | 706 | extern int decode_coding_gap (struct coding_system *, |
| 707 | EMACS_INT, EMACS_INT); | 707 | ptrdiff_t, ptrdiff_t); |
| 708 | extern void decode_coding_object (struct coding_system *, | 708 | extern void decode_coding_object (struct coding_system *, |
| 709 | Lisp_Object, EMACS_INT, EMACS_INT, | 709 | Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 710 | EMACS_INT, EMACS_INT, Lisp_Object); | 710 | ptrdiff_t, ptrdiff_t, Lisp_Object); |
| 711 | extern void encode_coding_object (struct coding_system *, | 711 | extern void encode_coding_object (struct coding_system *, |
| 712 | Lisp_Object, EMACS_INT, EMACS_INT, | 712 | Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 713 | EMACS_INT, EMACS_INT, Lisp_Object); | 713 | ptrdiff_t, ptrdiff_t, Lisp_Object); |
| 714 | 714 | ||
| 715 | /* Macros for backward compatibility. */ | 715 | /* Macros for backward compatibility. */ |
| 716 | 716 | ||
diff --git a/src/composite.c b/src/composite.c index c8e4dd082ae..90a239281fe 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -173,7 +173,7 @@ Lisp_Object composition_temp; | |||
| 173 | If the composition is invalid, return -1. */ | 173 | If the composition is invalid, return -1. */ |
| 174 | 174 | ||
| 175 | ptrdiff_t | 175 | ptrdiff_t |
| 176 | get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | 176 | get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars, |
| 177 | Lisp_Object prop, Lisp_Object string) | 177 | Lisp_Object prop, Lisp_Object string) |
| 178 | { | 178 | { |
| 179 | Lisp_Object id, length, components, key, *key_contents; | 179 | Lisp_Object id, length, components, key, *key_contents; |
| @@ -183,7 +183,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 183 | EMACS_UINT hash_code; | 183 | EMACS_UINT hash_code; |
| 184 | enum composition_method method; | 184 | enum composition_method method; |
| 185 | struct composition *cmp; | 185 | struct composition *cmp; |
| 186 | EMACS_INT i; | 186 | ptrdiff_t i; |
| 187 | int ch; | 187 | int ch; |
| 188 | 188 | ||
| 189 | /* Maximum length of a string of glyphs. XftGlyphExtents limits | 189 | /* Maximum length of a string of glyphs. XftGlyphExtents limits |
| @@ -284,7 +284,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 284 | && VECTORP (AREF (components, 0))) | 284 | && VECTORP (AREF (components, 0))) |
| 285 | { | 285 | { |
| 286 | /* COMPONENTS is a glyph-string. */ | 286 | /* COMPONENTS is a glyph-string. */ |
| 287 | EMACS_INT len = ASIZE (key); | 287 | ptrdiff_t len = ASIZE (key); |
| 288 | 288 | ||
| 289 | for (i = 1; i < len; i++) | 289 | for (i = 1; i < len; i++) |
| 290 | if (! VECTORP (AREF (key, i))) | 290 | if (! VECTORP (AREF (key, i))) |
| @@ -292,7 +292,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 292 | } | 292 | } |
| 293 | else if (VECTORP (components) || CONSP (components)) | 293 | else if (VECTORP (components) || CONSP (components)) |
| 294 | { | 294 | { |
| 295 | EMACS_INT len = ASIZE (key); | 295 | ptrdiff_t len = ASIZE (key); |
| 296 | 296 | ||
| 297 | /* The number of elements should be odd. */ | 297 | /* The number of elements should be odd. */ |
| 298 | if ((len % 2) == 0) | 298 | if ((len % 2) == 0) |
| @@ -429,8 +429,8 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 429 | This doesn't check the validity of composition. */ | 429 | This doesn't check the validity of composition. */ |
| 430 | 430 | ||
| 431 | int | 431 | int |
| 432 | find_composition (EMACS_INT pos, EMACS_INT limit, | 432 | find_composition (ptrdiff_t pos, ptrdiff_t limit, |
| 433 | EMACS_INT *start, EMACS_INT *end, | 433 | ptrdiff_t *start, ptrdiff_t *end, |
| 434 | Lisp_Object *prop, Lisp_Object object) | 434 | Lisp_Object *prop, Lisp_Object object) |
| 435 | { | 435 | { |
| 436 | Lisp_Object val; | 436 | Lisp_Object val; |
| @@ -469,10 +469,10 @@ find_composition (EMACS_INT pos, EMACS_INT limit, | |||
| 469 | FROM and TO with property PROP. */ | 469 | FROM and TO with property PROP. */ |
| 470 | 470 | ||
| 471 | static void | 471 | static void |
| 472 | run_composition_function (EMACS_INT from, EMACS_INT to, Lisp_Object prop) | 472 | run_composition_function (ptrdiff_t from, ptrdiff_t to, Lisp_Object prop) |
| 473 | { | 473 | { |
| 474 | Lisp_Object func; | 474 | Lisp_Object func; |
| 475 | EMACS_INT start, end; | 475 | ptrdiff_t start, end; |
| 476 | 476 | ||
| 477 | func = COMPOSITION_MODIFICATION_FUNC (prop); | 477 | func = COMPOSITION_MODIFICATION_FUNC (prop); |
| 478 | /* If an invalid composition precedes or follows, try to make them | 478 | /* If an invalid composition precedes or follows, try to make them |
| @@ -501,13 +501,13 @@ run_composition_function (EMACS_INT from, EMACS_INT to, Lisp_Object prop) | |||
| 501 | change is deletion, FROM == TO. Otherwise, FROM < TO. */ | 501 | change is deletion, FROM == TO. Otherwise, FROM < TO. */ |
| 502 | 502 | ||
| 503 | void | 503 | void |
| 504 | update_compositions (EMACS_INT from, EMACS_INT to, int check_mask) | 504 | update_compositions (ptrdiff_t from, ptrdiff_t to, int check_mask) |
| 505 | { | 505 | { |
| 506 | Lisp_Object prop; | 506 | Lisp_Object prop; |
| 507 | EMACS_INT start, end; | 507 | ptrdiff_t start, end; |
| 508 | /* The beginning and end of the region to set the property | 508 | /* The beginning and end of the region to set the property |
| 509 | `auto-composed' to nil. */ | 509 | `auto-composed' to nil. */ |
| 510 | EMACS_INT min_pos = from, max_pos = to; | 510 | ptrdiff_t min_pos = from, max_pos = to; |
| 511 | 511 | ||
| 512 | if (inhibit_modification_hooks) | 512 | if (inhibit_modification_hooks) |
| 513 | return; | 513 | return; |
| @@ -589,7 +589,7 @@ update_compositions (EMACS_INT from, EMACS_INT to, int check_mask) | |||
| 589 | } | 589 | } |
| 590 | if (min_pos < max_pos) | 590 | if (min_pos < max_pos) |
| 591 | { | 591 | { |
| 592 | int count = SPECPDL_INDEX (); | 592 | ptrdiff_t count = SPECPDL_INDEX (); |
| 593 | 593 | ||
| 594 | specbind (Qinhibit_read_only, Qt); | 594 | specbind (Qinhibit_read_only, Qt); |
| 595 | specbind (Qinhibit_modification_hooks, Qt); | 595 | specbind (Qinhibit_modification_hooks, Qt); |
| @@ -632,7 +632,7 @@ make_composition_value_copy (Lisp_Object list) | |||
| 632 | indices START and END in STRING. */ | 632 | indices START and END in STRING. */ |
| 633 | 633 | ||
| 634 | void | 634 | void |
| 635 | compose_text (EMACS_INT start, EMACS_INT end, Lisp_Object components, | 635 | compose_text (ptrdiff_t start, ptrdiff_t end, Lisp_Object components, |
| 636 | Lisp_Object modification_func, Lisp_Object string) | 636 | Lisp_Object modification_func, Lisp_Object string) |
| 637 | { | 637 | { |
| 638 | Lisp_Object prop; | 638 | Lisp_Object prop; |
| @@ -644,8 +644,8 @@ compose_text (EMACS_INT start, EMACS_INT end, Lisp_Object components, | |||
| 644 | } | 644 | } |
| 645 | 645 | ||
| 646 | 646 | ||
| 647 | static Lisp_Object autocmp_chars (Lisp_Object, EMACS_INT, EMACS_INT, | 647 | static Lisp_Object autocmp_chars (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 648 | EMACS_INT, struct window *, | 648 | ptrdiff_t, struct window *, |
| 649 | struct face *, Lisp_Object); | 649 | struct face *, Lisp_Object); |
| 650 | 650 | ||
| 651 | 651 | ||
| @@ -669,25 +669,25 @@ gstring_lookup_cache (Lisp_Object header) | |||
| 669 | } | 669 | } |
| 670 | 670 | ||
| 671 | Lisp_Object | 671 | Lisp_Object |
| 672 | composition_gstring_put_cache (Lisp_Object gstring, EMACS_INT len) | 672 | composition_gstring_put_cache (Lisp_Object gstring, ptrdiff_t len) |
| 673 | { | 673 | { |
| 674 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); | 674 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); |
| 675 | EMACS_UINT hash; | 675 | EMACS_UINT hash; |
| 676 | Lisp_Object header, copy; | 676 | Lisp_Object header, copy; |
| 677 | EMACS_INT i; | 677 | ptrdiff_t i; |
| 678 | 678 | ||
| 679 | header = LGSTRING_HEADER (gstring); | 679 | header = LGSTRING_HEADER (gstring); |
| 680 | hash = h->hashfn (h, header); | 680 | hash = h->hashfn (h, header); |
| 681 | if (len < 0) | 681 | if (len < 0) |
| 682 | { | 682 | { |
| 683 | EMACS_INT j, glyph_len = LGSTRING_GLYPH_LEN (gstring); | 683 | ptrdiff_t j, glyph_len = LGSTRING_GLYPH_LEN (gstring); |
| 684 | for (j = 0; j < glyph_len; j++) | 684 | for (j = 0; j < glyph_len; j++) |
| 685 | if (NILP (LGSTRING_GLYPH (gstring, j))) | 685 | if (NILP (LGSTRING_GLYPH (gstring, j))) |
| 686 | break; | 686 | break; |
| 687 | len = j; | 687 | len = j; |
| 688 | } | 688 | } |
| 689 | 689 | ||
| 690 | lint_assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2); | 690 | lint_assume (len <= TYPE_MAXIMUM (ptrdiff_t) - 2); |
| 691 | copy = Fmake_vector (make_number (len + 2), Qnil); | 691 | copy = Fmake_vector (make_number (len + 2), Qnil); |
| 692 | LGSTRING_SET_HEADER (copy, Fcopy_sequence (header)); | 692 | LGSTRING_SET_HEADER (copy, Fcopy_sequence (header)); |
| 693 | for (i = 0; i < len; i++) | 693 | for (i = 0; i < len; i++) |
| @@ -713,7 +713,7 @@ int | |||
| 713 | composition_gstring_p (Lisp_Object gstring) | 713 | composition_gstring_p (Lisp_Object gstring) |
| 714 | { | 714 | { |
| 715 | Lisp_Object header; | 715 | Lisp_Object header; |
| 716 | EMACS_INT i; | 716 | ptrdiff_t i; |
| 717 | 717 | ||
| 718 | if (! VECTORP (gstring) || ASIZE (gstring) < 2) | 718 | if (! VECTORP (gstring) || ASIZE (gstring) < 2) |
| 719 | return 0; | 719 | return 0; |
| @@ -741,7 +741,7 @@ composition_gstring_p (Lisp_Object gstring) | |||
| 741 | } | 741 | } |
| 742 | 742 | ||
| 743 | int | 743 | int |
| 744 | composition_gstring_width (Lisp_Object gstring, EMACS_INT from, EMACS_INT to, | 744 | composition_gstring_width (Lisp_Object gstring, ptrdiff_t from, ptrdiff_t to, |
| 745 | struct font_metrics *metrics) | 745 | struct font_metrics *metrics) |
| 746 | { | 746 | { |
| 747 | Lisp_Object *glyph; | 747 | Lisp_Object *glyph; |
| @@ -800,8 +800,8 @@ static Lisp_Object gstring_work_headers; | |||
| 800 | static Lisp_Object | 800 | static Lisp_Object |
| 801 | fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lisp_Object font_object, Lisp_Object string) | 801 | fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lisp_Object font_object, Lisp_Object string) |
| 802 | { | 802 | { |
| 803 | EMACS_INT from, to, from_byte; | 803 | ptrdiff_t from, to, from_byte; |
| 804 | EMACS_INT len, i; | 804 | ptrdiff_t len, i; |
| 805 | 805 | ||
| 806 | if (NILP (string)) | 806 | if (NILP (string)) |
| 807 | { | 807 | { |
| @@ -817,11 +817,11 @@ fill_gstring_header (Lisp_Object header, Lisp_Object start, Lisp_Object end, Lis | |||
| 817 | CHECK_STRING (string); | 817 | CHECK_STRING (string); |
| 818 | if (! STRING_MULTIBYTE (string)) | 818 | if (! STRING_MULTIBYTE (string)) |
| 819 | error ("Attempt to shape unibyte text"); | 819 | error ("Attempt to shape unibyte text"); |
| 820 | /* FROM and TO are checked by the caller. */ | 820 | /* The caller checks that START and END are nonnegative integers. */ |
| 821 | if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string))) | ||
| 822 | args_out_of_range_3 (string, start, end); | ||
| 821 | from = XINT (start); | 823 | from = XINT (start); |
| 822 | to = XINT (end); | 824 | to = XINT (end); |
| 823 | if (from < 0 || from > to || to > SCHARS (string)) | ||
| 824 | args_out_of_range_3 (string, start, end); | ||
| 825 | from_byte = string_char_to_byte (string, from); | 825 | from_byte = string_char_to_byte (string, from); |
| 826 | } | 826 | } |
| 827 | 827 | ||
| @@ -860,8 +860,8 @@ fill_gstring_body (Lisp_Object gstring) | |||
| 860 | { | 860 | { |
| 861 | Lisp_Object font_object = LGSTRING_FONT (gstring); | 861 | Lisp_Object font_object = LGSTRING_FONT (gstring); |
| 862 | Lisp_Object header = AREF (gstring, 0); | 862 | Lisp_Object header = AREF (gstring, 0); |
| 863 | EMACS_INT len = LGSTRING_CHAR_LEN (gstring); | 863 | ptrdiff_t len = LGSTRING_CHAR_LEN (gstring); |
| 864 | EMACS_INT i; | 864 | ptrdiff_t i; |
| 865 | 865 | ||
| 866 | for (i = 0; i < len; i++) | 866 | for (i = 0; i < len; i++) |
| 867 | { | 867 | { |
| @@ -906,15 +906,15 @@ fill_gstring_body (Lisp_Object gstring) | |||
| 906 | object. Otherwise return nil. */ | 906 | object. Otherwise return nil. */ |
| 907 | 907 | ||
| 908 | static Lisp_Object | 908 | static Lisp_Object |
| 909 | autocmp_chars (Lisp_Object rule, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT limit, struct window *win, struct face *face, Lisp_Object string) | 909 | autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string) |
| 910 | { | 910 | { |
| 911 | int count = SPECPDL_INDEX (); | 911 | ptrdiff_t count = SPECPDL_INDEX (); |
| 912 | FRAME_PTR f = XFRAME (win->frame); | 912 | FRAME_PTR f = XFRAME (win->frame); |
| 913 | Lisp_Object pos = make_number (charpos); | 913 | Lisp_Object pos = make_number (charpos); |
| 914 | EMACS_INT to; | 914 | ptrdiff_t to; |
| 915 | EMACS_INT pt = PT, pt_byte = PT_BYTE; | 915 | ptrdiff_t pt = PT, pt_byte = PT_BYTE; |
| 916 | Lisp_Object re, font_object, lgstring; | 916 | Lisp_Object re, font_object, lgstring; |
| 917 | EMACS_INT len; | 917 | ptrdiff_t len; |
| 918 | 918 | ||
| 919 | record_unwind_save_match_data (); | 919 | record_unwind_save_match_data (); |
| 920 | re = AREF (rule, 0); | 920 | re = AREF (rule, 0); |
| @@ -997,9 +997,9 @@ static Lisp_Object _work_val; | |||
| 997 | composition. */ | 997 | composition. */ |
| 998 | 998 | ||
| 999 | void | 999 | void |
| 1000 | composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, Lisp_Object string) | 1000 | composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, Lisp_Object string) |
| 1001 | { | 1001 | { |
| 1002 | EMACS_INT start, end; | 1002 | ptrdiff_t start, end; |
| 1003 | int c; | 1003 | int c; |
| 1004 | Lisp_Object prop, val; | 1004 | Lisp_Object prop, val; |
| 1005 | /* This is from forward_to_next_line_start in xdisp.c. */ | 1005 | /* This is from forward_to_next_line_start in xdisp.c. */ |
| @@ -1109,7 +1109,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1109 | int len; | 1109 | int len; |
| 1110 | /* Limit byte position used in fast_looking_at. This is the | 1110 | /* Limit byte position used in fast_looking_at. This is the |
| 1111 | byte position of the character after START. */ | 1111 | byte position of the character after START. */ |
| 1112 | EMACS_INT limit; | 1112 | ptrdiff_t limit; |
| 1113 | 1113 | ||
| 1114 | if (NILP (string)) | 1114 | if (NILP (string)) |
| 1115 | p = BYTE_POS_ADDR (bytepos); | 1115 | p = BYTE_POS_ADDR (bytepos); |
| @@ -1123,16 +1123,17 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1123 | if (! NILP (val)) | 1123 | if (! NILP (val)) |
| 1124 | { | 1124 | { |
| 1125 | Lisp_Object elt; | 1125 | Lisp_Object elt; |
| 1126 | int ridx, back, blen; | 1126 | int ridx, blen; |
| 1127 | 1127 | ||
| 1128 | for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) | 1128 | for (ridx = 0; CONSP (val); val = XCDR (val), ridx++) |
| 1129 | { | 1129 | { |
| 1130 | elt = XCAR (val); | 1130 | elt = XCAR (val); |
| 1131 | if (VECTORP (elt) && ASIZE (elt) == 3 | 1131 | if (VECTORP (elt) && ASIZE (elt) == 3 |
| 1132 | && NATNUMP (AREF (elt, 1)) | 1132 | && NATNUMP (AREF (elt, 1)) |
| 1133 | && charpos - (back = XFASTINT (AREF (elt, 1))) > endpos) | 1133 | && charpos - XFASTINT (AREF (elt, 1)) > endpos) |
| 1134 | { | 1134 | { |
| 1135 | EMACS_INT cpos = charpos - back, bpos; | 1135 | ptrdiff_t back = XFASTINT (AREF (elt, 1)); |
| 1136 | ptrdiff_t cpos = charpos - back, bpos; | ||
| 1136 | 1137 | ||
| 1137 | if (back == 0) | 1138 | if (back == 0) |
| 1138 | bpos = bytepos; | 1139 | bpos = bytepos; |
| @@ -1226,7 +1227,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, EMACS_INT charpos, | |||
| 1226 | CMP_IT->stop_pos, and return 0. */ | 1227 | CMP_IT->stop_pos, and return 0. */ |
| 1227 | 1228 | ||
| 1228 | int | 1229 | int |
| 1229 | composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT endpos, struct window *w, struct face *face, Lisp_Object string) | 1230 | composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, struct face *face, Lisp_Object string) |
| 1230 | { | 1231 | { |
| 1231 | if (endpos < 0) | 1232 | if (endpos < 0) |
| 1232 | endpos = NILP (string) ? BEGV : 0; | 1233 | endpos = NILP (string) ? BEGV : 0; |
| @@ -1242,7 +1243,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1242 | if (cmp_it->ch < 0) | 1243 | if (cmp_it->ch < 0) |
| 1243 | { | 1244 | { |
| 1244 | /* We are looking at a static composition. */ | 1245 | /* We are looking at a static composition. */ |
| 1245 | EMACS_INT start, end; | 1246 | ptrdiff_t start, end; |
| 1246 | Lisp_Object prop; | 1247 | Lisp_Object prop; |
| 1247 | 1248 | ||
| 1248 | find_composition (charpos, -1, &start, &end, &prop, string); | 1249 | find_composition (charpos, -1, &start, &end, &prop, string); |
| @@ -1257,7 +1258,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1257 | { | 1258 | { |
| 1258 | Lisp_Object lgstring = Qnil; | 1259 | Lisp_Object lgstring = Qnil; |
| 1259 | Lisp_Object val, elt; | 1260 | Lisp_Object val, elt; |
| 1260 | EMACS_INT i; | 1261 | ptrdiff_t i; |
| 1261 | 1262 | ||
| 1262 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); | 1263 | val = CHAR_TABLE_REF (Vcomposition_function_table, cmp_it->ch); |
| 1263 | for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); | 1264 | for (i = 0; i < cmp_it->rule_idx; i++, val = XCDR (val)); |
| @@ -1284,7 +1285,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1284 | } | 1285 | } |
| 1285 | else | 1286 | else |
| 1286 | { | 1287 | { |
| 1287 | EMACS_INT cpos = charpos, bpos = bytepos; | 1288 | ptrdiff_t cpos = charpos, bpos = bytepos; |
| 1288 | 1289 | ||
| 1289 | while (1) | 1290 | while (1) |
| 1290 | { | 1291 | { |
| @@ -1370,7 +1371,7 @@ composition_reseat_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1370 | the cluster, or -1 if the composition is somehow broken. */ | 1371 | the cluster, or -1 if the composition is somehow broken. */ |
| 1371 | 1372 | ||
| 1372 | int | 1373 | int |
| 1373 | composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_INT bytepos, Lisp_Object string) | 1374 | composition_update_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, Lisp_Object string) |
| 1374 | { | 1375 | { |
| 1375 | int i, c IF_LINT (= 0); | 1376 | int i, c IF_LINT (= 0); |
| 1376 | 1377 | ||
| @@ -1405,7 +1406,7 @@ composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1405 | /* automatic composition */ | 1406 | /* automatic composition */ |
| 1406 | Lisp_Object gstring = composition_gstring_from_id (cmp_it->id); | 1407 | Lisp_Object gstring = composition_gstring_from_id (cmp_it->id); |
| 1407 | Lisp_Object glyph; | 1408 | Lisp_Object glyph; |
| 1408 | EMACS_INT from; | 1409 | ptrdiff_t from; |
| 1409 | 1410 | ||
| 1410 | if (cmp_it->nglyphs == 0) | 1411 | if (cmp_it->nglyphs == 0) |
| 1411 | { | 1412 | { |
| @@ -1457,7 +1458,7 @@ composition_update_it (struct composition_it *cmp_it, EMACS_INT charpos, EMACS_I | |||
| 1457 | 1458 | ||
| 1458 | struct position_record | 1459 | struct position_record |
| 1459 | { | 1460 | { |
| 1460 | EMACS_INT pos, pos_byte; | 1461 | ptrdiff_t pos, pos_byte; |
| 1461 | unsigned char *p; | 1462 | unsigned char *p; |
| 1462 | }; | 1463 | }; |
| 1463 | 1464 | ||
| @@ -1496,14 +1497,14 @@ struct position_record | |||
| 1496 | Qnil, and return 0. */ | 1497 | Qnil, and return 0. */ |
| 1497 | 1498 | ||
| 1498 | static int | 1499 | static int |
| 1499 | find_automatic_composition (EMACS_INT pos, EMACS_INT limit, | 1500 | find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, |
| 1500 | EMACS_INT *start, EMACS_INT *end, | 1501 | ptrdiff_t *start, ptrdiff_t *end, |
| 1501 | Lisp_Object *gstring, Lisp_Object string) | 1502 | Lisp_Object *gstring, Lisp_Object string) |
| 1502 | { | 1503 | { |
| 1503 | EMACS_INT head, tail, stop; | 1504 | ptrdiff_t head, tail, stop; |
| 1504 | /* Forward limit position of checking a composition taking a | 1505 | /* Forward limit position of checking a composition taking a |
| 1505 | looking-back count into account. */ | 1506 | looking-back count into account. */ |
| 1506 | EMACS_INT fore_check_limit; | 1507 | ptrdiff_t fore_check_limit; |
| 1507 | struct position_record cur, prev; | 1508 | struct position_record cur, prev; |
| 1508 | int c; | 1509 | int c; |
| 1509 | Lisp_Object window; | 1510 | Lisp_Object window; |
| @@ -1688,10 +1689,10 @@ find_automatic_composition (EMACS_INT pos, EMACS_INT limit, | |||
| 1688 | /* Return the adjusted point provided that point is moved from LAST_PT | 1689 | /* Return the adjusted point provided that point is moved from LAST_PT |
| 1689 | to NEW_PT. */ | 1690 | to NEW_PT. */ |
| 1690 | 1691 | ||
| 1691 | EMACS_INT | 1692 | ptrdiff_t |
| 1692 | composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) | 1693 | composition_adjust_point (ptrdiff_t last_pt, ptrdiff_t new_pt) |
| 1693 | { | 1694 | { |
| 1694 | EMACS_INT i, beg, end; | 1695 | ptrdiff_t i, beg, end; |
| 1695 | Lisp_Object val; | 1696 | Lisp_Object val; |
| 1696 | 1697 | ||
| 1697 | if (new_pt == BEGV || new_pt == ZV) | 1698 | if (new_pt == BEGV || new_pt == ZV) |
| @@ -1712,7 +1713,7 @@ composition_adjust_point (EMACS_INT last_pt, EMACS_INT new_pt) | |||
| 1712 | return new_pt; | 1713 | return new_pt; |
| 1713 | 1714 | ||
| 1714 | /* Next check the automatic composition. */ | 1715 | /* Next check the automatic composition. */ |
| 1715 | if (! find_automatic_composition (new_pt, (EMACS_INT) -1, &beg, &end, &val, | 1716 | if (! find_automatic_composition (new_pt, (ptrdiff_t) -1, &beg, &end, &val, |
| 1716 | Qnil) | 1717 | Qnil) |
| 1717 | || beg == new_pt) | 1718 | || beg == new_pt) |
| 1718 | return new_pt; | 1719 | return new_pt; |
| @@ -1773,7 +1774,7 @@ should be ignored. */) | |||
| 1773 | (Lisp_Object from, Lisp_Object to, Lisp_Object font_object, Lisp_Object string) | 1774 | (Lisp_Object from, Lisp_Object to, Lisp_Object font_object, Lisp_Object string) |
| 1774 | { | 1775 | { |
| 1775 | Lisp_Object gstring, header; | 1776 | Lisp_Object gstring, header; |
| 1776 | EMACS_INT frompos, topos; | 1777 | ptrdiff_t frompos, topos; |
| 1777 | 1778 | ||
| 1778 | CHECK_NATNUM (from); | 1779 | CHECK_NATNUM (from); |
| 1779 | CHECK_NATNUM (to); | 1780 | CHECK_NATNUM (to); |
| @@ -1857,15 +1858,14 @@ See `find-composition' for more details. */) | |||
| 1857 | (Lisp_Object pos, Lisp_Object limit, Lisp_Object string, Lisp_Object detail_p) | 1858 | (Lisp_Object pos, Lisp_Object limit, Lisp_Object string, Lisp_Object detail_p) |
| 1858 | { | 1859 | { |
| 1859 | Lisp_Object prop, tail, gstring; | 1860 | Lisp_Object prop, tail, gstring; |
| 1860 | EMACS_INT start, end, from, to; | 1861 | ptrdiff_t start, end, from, to; |
| 1861 | int id; | 1862 | int id; |
| 1862 | 1863 | ||
| 1863 | CHECK_NUMBER_COERCE_MARKER (pos); | 1864 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1864 | from = XINT (pos); | ||
| 1865 | if (!NILP (limit)) | 1865 | if (!NILP (limit)) |
| 1866 | { | 1866 | { |
| 1867 | CHECK_NUMBER_COERCE_MARKER (limit); | 1867 | CHECK_NUMBER_COERCE_MARKER (limit); |
| 1868 | to = XINT (limit); | 1868 | to = min (XINT (limit), ZV); |
| 1869 | } | 1869 | } |
| 1870 | else | 1870 | else |
| 1871 | to = -1; | 1871 | to = -1; |
| @@ -1881,6 +1881,7 @@ See `find-composition' for more details. */) | |||
| 1881 | if (XINT (pos) < BEGV || XINT (pos) > ZV) | 1881 | if (XINT (pos) < BEGV || XINT (pos) > ZV) |
| 1882 | args_out_of_range (Fcurrent_buffer (), pos); | 1882 | args_out_of_range (Fcurrent_buffer (), pos); |
| 1883 | } | 1883 | } |
| 1884 | from = XINT (pos); | ||
| 1884 | 1885 | ||
| 1885 | if (!find_composition (from, to, &start, &end, &prop, string)) | 1886 | if (!find_composition (from, to, &start, &end, &prop, string)) |
| 1886 | { | 1887 | { |
| @@ -1893,7 +1894,7 @@ See `find-composition' for more details. */) | |||
| 1893 | } | 1894 | } |
| 1894 | if ((end <= XINT (pos) || start > XINT (pos))) | 1895 | if ((end <= XINT (pos) || start > XINT (pos))) |
| 1895 | { | 1896 | { |
| 1896 | EMACS_INT s, e; | 1897 | ptrdiff_t s, e; |
| 1897 | 1898 | ||
| 1898 | if (find_automatic_composition (from, to, &s, &e, &gstring, string) | 1899 | if (find_automatic_composition (from, to, &s, &e, &gstring, string) |
| 1899 | && (e <= XINT (pos) ? e > end : s < start)) | 1900 | && (e <= XINT (pos) ? e > end : s < start)) |
| @@ -1910,7 +1911,7 @@ See `find-composition' for more details. */) | |||
| 1910 | id = COMPOSITION_ID (prop); | 1911 | id = COMPOSITION_ID (prop); |
| 1911 | else | 1912 | else |
| 1912 | { | 1913 | { |
| 1913 | EMACS_INT start_byte = (NILP (string) | 1914 | ptrdiff_t start_byte = (NILP (string) |
| 1914 | ? CHAR_TO_BYTE (start) | 1915 | ? CHAR_TO_BYTE (start) |
| 1915 | : string_char_to_byte (string, start)); | 1916 | : string_char_to_byte (string, start)); |
| 1916 | id = get_composition_id (start, start_byte, end - start, prop, string); | 1917 | id = get_composition_id (start, start_byte, end - start, prop, string); |
diff --git a/src/composite.h b/src/composite.h index c57e2a0e9b3..b21994e5e3c 100644 --- a/src/composite.h +++ b/src/composite.h | |||
| @@ -186,7 +186,7 @@ struct composition { | |||
| 186 | enum composition_method method; | 186 | enum composition_method method; |
| 187 | 187 | ||
| 188 | /* Index to the composition hash table. */ | 188 | /* Index to the composition hash table. */ |
| 189 | EMACS_INT hash_index; | 189 | ptrdiff_t hash_index; |
| 190 | 190 | ||
| 191 | /* For which font we have calculated the remaining members. The | 191 | /* For which font we have calculated the remaining members. The |
| 192 | actual type is device dependent. */ | 192 | actual type is device dependent. */ |
| @@ -216,16 +216,16 @@ extern ptrdiff_t n_compositions; | |||
| 216 | 216 | ||
| 217 | extern Lisp_Object Qcomposition; | 217 | extern Lisp_Object Qcomposition; |
| 218 | extern Lisp_Object composition_hash_table; | 218 | extern Lisp_Object composition_hash_table; |
| 219 | extern ptrdiff_t get_composition_id (EMACS_INT, EMACS_INT, EMACS_INT, | 219 | extern ptrdiff_t get_composition_id (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 220 | Lisp_Object, Lisp_Object); | 220 | Lisp_Object, Lisp_Object); |
| 221 | extern int find_composition (EMACS_INT, EMACS_INT, EMACS_INT *, EMACS_INT *, | 221 | extern int find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *, |
| 222 | Lisp_Object *, Lisp_Object); | 222 | Lisp_Object *, Lisp_Object); |
| 223 | extern void update_compositions (EMACS_INT, EMACS_INT, int); | 223 | extern void update_compositions (ptrdiff_t, ptrdiff_t, int); |
| 224 | extern void make_composition_value_copy (Lisp_Object); | 224 | extern void make_composition_value_copy (Lisp_Object); |
| 225 | extern void compose_region (int, int, Lisp_Object, Lisp_Object, | 225 | extern void compose_region (int, int, Lisp_Object, Lisp_Object, |
| 226 | Lisp_Object); | 226 | Lisp_Object); |
| 227 | extern void syms_of_composite (void); | 227 | extern void syms_of_composite (void); |
| 228 | extern void compose_text (EMACS_INT, EMACS_INT, Lisp_Object, Lisp_Object, | 228 | extern void compose_text (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object, |
| 229 | Lisp_Object); | 229 | Lisp_Object); |
| 230 | 230 | ||
| 231 | /* Macros for lispy glyph-string. This is completely different from | 231 | /* Macros for lispy glyph-string. This is completely different from |
| @@ -298,22 +298,22 @@ struct composition_it; | |||
| 298 | struct face; | 298 | struct face; |
| 299 | struct font_metrics; | 299 | struct font_metrics; |
| 300 | 300 | ||
| 301 | extern Lisp_Object composition_gstring_put_cache (Lisp_Object, EMACS_INT); | 301 | extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t); |
| 302 | extern Lisp_Object composition_gstring_from_id (ptrdiff_t); | 302 | extern Lisp_Object composition_gstring_from_id (ptrdiff_t); |
| 303 | extern int composition_gstring_p (Lisp_Object); | 303 | extern int composition_gstring_p (Lisp_Object); |
| 304 | extern int composition_gstring_width (Lisp_Object, EMACS_INT, EMACS_INT, | 304 | extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 305 | struct font_metrics *); | 305 | struct font_metrics *); |
| 306 | 306 | ||
| 307 | extern void composition_compute_stop_pos (struct composition_it *, | 307 | extern void composition_compute_stop_pos (struct composition_it *, |
| 308 | EMACS_INT, EMACS_INT, EMACS_INT, | 308 | ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 309 | Lisp_Object); | 309 | Lisp_Object); |
| 310 | extern int composition_reseat_it (struct composition_it *, | 310 | extern int composition_reseat_it (struct composition_it *, |
| 311 | EMACS_INT, EMACS_INT, EMACS_INT, | 311 | ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 312 | struct window *, struct face *, | 312 | struct window *, struct face *, |
| 313 | Lisp_Object); | 313 | Lisp_Object); |
| 314 | extern int composition_update_it (struct composition_it *, | 314 | extern int composition_update_it (struct composition_it *, |
| 315 | EMACS_INT, EMACS_INT, Lisp_Object); | 315 | ptrdiff_t, ptrdiff_t, Lisp_Object); |
| 316 | 316 | ||
| 317 | extern EMACS_INT composition_adjust_point (EMACS_INT, EMACS_INT); | 317 | extern ptrdiff_t composition_adjust_point (ptrdiff_t, ptrdiff_t); |
| 318 | 318 | ||
| 319 | #endif /* not EMACS_COMPOSITE_H */ | 319 | #endif /* not EMACS_COMPOSITE_H */ |
diff --git a/src/data.c b/src/data.c index 76a54547a5d..211a64661ac 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -1075,18 +1075,18 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol) | |||
| 1075 | { | 1075 | { |
| 1076 | struct specbinding *p; | 1076 | struct specbinding *p; |
| 1077 | 1077 | ||
| 1078 | for (p = specpdl_ptr - 1; p >= specpdl; p--) | 1078 | for (p = specpdl_ptr; p > specpdl; ) |
| 1079 | if (p->func == NULL | 1079 | if ((--p)->func == NULL |
| 1080 | && CONSP (p->symbol)) | 1080 | && CONSP (p->symbol)) |
| 1081 | { | 1081 | { |
| 1082 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); | 1082 | struct Lisp_Symbol *let_bound_symbol = XSYMBOL (XCAR (p->symbol)); |
| 1083 | eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); | 1083 | eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS); |
| 1084 | if (symbol == let_bound_symbol | 1084 | if (symbol == let_bound_symbol |
| 1085 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) | 1085 | && XBUFFER (XCDR (XCDR (p->symbol))) == current_buffer) |
| 1086 | break; | 1086 | return 1; |
| 1087 | } | 1087 | } |
| 1088 | 1088 | ||
| 1089 | return p >= specpdl; | 1089 | return 0; |
| 1090 | } | 1090 | } |
| 1091 | 1091 | ||
| 1092 | static int | 1092 | static int |
| @@ -1094,11 +1094,11 @@ let_shadows_global_binding_p (Lisp_Object symbol) | |||
| 1094 | { | 1094 | { |
| 1095 | struct specbinding *p; | 1095 | struct specbinding *p; |
| 1096 | 1096 | ||
| 1097 | for (p = specpdl_ptr - 1; p >= specpdl; p--) | 1097 | for (p = specpdl_ptr; p > specpdl; p) |
| 1098 | if (p->func == NULL && EQ (p->symbol, symbol)) | 1098 | if ((--p)->func == NULL && EQ (p->symbol, symbol)) |
| 1099 | break; | 1099 | return 1; |
| 1100 | 1100 | ||
| 1101 | return p >= specpdl; | 1101 | return 0; |
| 1102 | } | 1102 | } |
| 1103 | 1103 | ||
| 1104 | /* Store the value NEWVAL into SYMBOL. | 1104 | /* Store the value NEWVAL into SYMBOL. |
| @@ -2064,7 +2064,7 @@ or a byte-code object. IDX starts at 0. */) | |||
| 2064 | if (STRINGP (array)) | 2064 | if (STRINGP (array)) |
| 2065 | { | 2065 | { |
| 2066 | int c; | 2066 | int c; |
| 2067 | EMACS_INT idxval_byte; | 2067 | ptrdiff_t idxval_byte; |
| 2068 | 2068 | ||
| 2069 | if (idxval < 0 || idxval >= SCHARS (array)) | 2069 | if (idxval < 0 || idxval >= SCHARS (array)) |
| 2070 | args_out_of_range (array, idx); | 2070 | args_out_of_range (array, idx); |
| @@ -2156,7 +2156,8 @@ bool-vector. IDX starts at 0. */) | |||
| 2156 | 2156 | ||
| 2157 | if (STRING_MULTIBYTE (array)) | 2157 | if (STRING_MULTIBYTE (array)) |
| 2158 | { | 2158 | { |
| 2159 | EMACS_INT idxval_byte, prev_bytes, new_bytes, nbytes; | 2159 | ptrdiff_t idxval_byte, nbytes; |
| 2160 | int prev_bytes, new_bytes; | ||
| 2160 | unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; | 2161 | unsigned char workbuf[MAX_MULTIBYTE_LENGTH], *p0 = workbuf, *p1; |
| 2161 | 2162 | ||
| 2162 | nbytes = SBYTES (array); | 2163 | nbytes = SBYTES (array); |
| @@ -2167,7 +2168,7 @@ bool-vector. IDX starts at 0. */) | |||
| 2167 | if (prev_bytes != new_bytes) | 2168 | if (prev_bytes != new_bytes) |
| 2168 | { | 2169 | { |
| 2169 | /* We must relocate the string data. */ | 2170 | /* We must relocate the string data. */ |
| 2170 | EMACS_INT nchars = SCHARS (array); | 2171 | ptrdiff_t nchars = SCHARS (array); |
| 2171 | unsigned char *str; | 2172 | unsigned char *str; |
| 2172 | USE_SAFE_ALLOCA; | 2173 | USE_SAFE_ALLOCA; |
| 2173 | 2174 | ||
| @@ -2474,9 +2475,9 @@ If the base used is not 10, STRING is always parsed as integer. */) | |||
| 2474 | else | 2475 | else |
| 2475 | { | 2476 | { |
| 2476 | CHECK_NUMBER (base); | 2477 | CHECK_NUMBER (base); |
| 2477 | b = XINT (base); | 2478 | if (! (2 <= XINT (base) && XINT (base) <= 16)) |
| 2478 | if (b < 2 || b > 16) | ||
| 2479 | xsignal1 (Qargs_out_of_range, base); | 2479 | xsignal1 (Qargs_out_of_range, base); |
| 2480 | b = XINT (base); | ||
| 2480 | } | 2481 | } |
| 2481 | 2482 | ||
| 2482 | p = SSDATA (string); | 2483 | p = SSDATA (string); |
| @@ -2724,7 +2725,7 @@ Both must be integers or markers. */) | |||
| 2724 | CHECK_NUMBER_COERCE_MARKER (x); | 2725 | CHECK_NUMBER_COERCE_MARKER (x); |
| 2725 | CHECK_NUMBER_COERCE_MARKER (y); | 2726 | CHECK_NUMBER_COERCE_MARKER (y); |
| 2726 | 2727 | ||
| 2727 | if (XFASTINT (y) == 0) | 2728 | if (XINT (y) == 0) |
| 2728 | xsignal0 (Qarith_error); | 2729 | xsignal0 (Qarith_error); |
| 2729 | 2730 | ||
| 2730 | XSETINT (val, XINT (x) % XINT (y)); | 2731 | XSETINT (val, XINT (x) % XINT (y)); |
diff --git a/src/dbusbind.c b/src/dbusbind.c index 227d4e647e9..72cef0cbc86 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c | |||
| @@ -485,7 +485,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 485 | } | 485 | } |
| 486 | 486 | ||
| 487 | case DBUS_TYPE_INT16: | 487 | case DBUS_TYPE_INT16: |
| 488 | CHECK_NUMBER (object); | 488 | CHECK_TYPE_RANGED_INTEGER (dbus_int16_t, object); |
| 489 | { | 489 | { |
| 490 | dbus_int16_t val = XINT (object); | 490 | dbus_int16_t val = XINT (object); |
| 491 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); | 491 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
| @@ -495,7 +495,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 495 | } | 495 | } |
| 496 | 496 | ||
| 497 | case DBUS_TYPE_UINT16: | 497 | case DBUS_TYPE_UINT16: |
| 498 | CHECK_NATNUM (object); | 498 | CHECK_TYPE_RANGED_INTEGER (dbus_uint16_t, object); |
| 499 | { | 499 | { |
| 500 | dbus_uint16_t val = XFASTINT (object); | 500 | dbus_uint16_t val = XFASTINT (object); |
| 501 | XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); | 501 | XD_DEBUG_MESSAGE ("%c %u", dtype, (unsigned int) val); |
| @@ -505,7 +505,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 505 | } | 505 | } |
| 506 | 506 | ||
| 507 | case DBUS_TYPE_INT32: | 507 | case DBUS_TYPE_INT32: |
| 508 | CHECK_NUMBER (object); | 508 | CHECK_TYPE_RANGED_INTEGER (dbus_int32_t, object); |
| 509 | { | 509 | { |
| 510 | dbus_int32_t val = XINT (object); | 510 | dbus_int32_t val = XINT (object); |
| 511 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); | 511 | XD_DEBUG_MESSAGE ("%c %d", dtype, val); |
| @@ -518,7 +518,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 518 | #ifdef DBUS_TYPE_UNIX_FD | 518 | #ifdef DBUS_TYPE_UNIX_FD |
| 519 | case DBUS_TYPE_UNIX_FD: | 519 | case DBUS_TYPE_UNIX_FD: |
| 520 | #endif | 520 | #endif |
| 521 | CHECK_NATNUM (object); | 521 | CHECK_TYPE_RANGED_INTEGER (dbus_uint32_t, object); |
| 522 | { | 522 | { |
| 523 | dbus_uint32_t val = XFASTINT (object); | 523 | dbus_uint32_t val = XFASTINT (object); |
| 524 | XD_DEBUG_MESSAGE ("%c %u", dtype, val); | 524 | XD_DEBUG_MESSAGE ("%c %u", dtype, val); |
| @@ -528,7 +528,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 528 | } | 528 | } |
| 529 | 529 | ||
| 530 | case DBUS_TYPE_INT64: | 530 | case DBUS_TYPE_INT64: |
| 531 | CHECK_NUMBER (object); | 531 | CHECK_TYPE_RANGED_INTEGER (dbus_int64_t, object); |
| 532 | { | 532 | { |
| 533 | dbus_int64_t val = XINT (object); | 533 | dbus_int64_t val = XINT (object); |
| 534 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); | 534 | XD_DEBUG_MESSAGE ("%c %d", dtype, (int) val); |
| @@ -538,7 +538,7 @@ xd_append_arg (unsigned int dtype, Lisp_Object object, DBusMessageIter *iter) | |||
| 538 | } | 538 | } |
| 539 | 539 | ||
| 540 | case DBUS_TYPE_UINT64: | 540 | case DBUS_TYPE_UINT64: |
| 541 | CHECK_NATNUM (object); | 541 | CHECK_TYPE_RANGED_INTEGER (dbus_uint64_t, object); |
| 542 | { | 542 | { |
| 543 | dbus_uint64_t val = XFASTINT (object); | 543 | dbus_uint64_t val = XFASTINT (object); |
| 544 | XD_DEBUG_MESSAGE ("%c %"pI"d", dtype, XFASTINT (object)); | 544 | XD_DEBUG_MESSAGE ("%c %"pI"d", dtype, XFASTINT (object)); |
| @@ -1145,7 +1145,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI | |||
| 1145 | if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout))) | 1145 | if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout))) |
| 1146 | { | 1146 | { |
| 1147 | CHECK_NATNUM (args[i+1]); | 1147 | CHECK_NATNUM (args[i+1]); |
| 1148 | timeout = XFASTINT (args[i+1]); | 1148 | timeout = min (XFASTINT (args[i+1]), INT_MAX); |
| 1149 | i = i+2; | 1149 | i = i+2; |
| 1150 | } | 1150 | } |
| 1151 | 1151 | ||
| @@ -1328,7 +1328,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE | |||
| 1328 | if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout))) | 1328 | if ((i+2 <= nargs) && (EQ ((args[i]), QCdbus_timeout))) |
| 1329 | { | 1329 | { |
| 1330 | CHECK_NATNUM (args[i+1]); | 1330 | CHECK_NATNUM (args[i+1]); |
| 1331 | timeout = XFASTINT (args[i+1]); | 1331 | timeout = min (XFASTINT (args[i+1]), INT_MAX); |
| 1332 | i = i+2; | 1332 | i = i+2; |
| 1333 | } | 1333 | } |
| 1334 | 1334 | ||
diff --git a/src/dired.c b/src/dired.c index be94b16cf75..d1b4d410428 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -86,7 +86,7 @@ static Lisp_Object Qfile_name_all_completions; | |||
| 86 | static Lisp_Object Qfile_attributes; | 86 | static Lisp_Object Qfile_attributes; |
| 87 | static Lisp_Object Qfile_attributes_lessp; | 87 | static Lisp_Object Qfile_attributes_lessp; |
| 88 | 88 | ||
| 89 | static int scmp (const char *, const char *, int); | 89 | static ptrdiff_t scmp (const char *, const char *, ptrdiff_t); |
| 90 | static Lisp_Object Ffile_attributes (Lisp_Object, Lisp_Object); | 90 | static Lisp_Object Ffile_attributes (Lisp_Object, Lisp_Object); |
| 91 | 91 | ||
| 92 | #ifdef WINDOWSNT | 92 | #ifdef WINDOWSNT |
| @@ -117,11 +117,11 @@ Lisp_Object | |||
| 117 | directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format) | 117 | directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format) |
| 118 | { | 118 | { |
| 119 | DIR *d; | 119 | DIR *d; |
| 120 | int directory_nbytes; | 120 | ptrdiff_t directory_nbytes; |
| 121 | Lisp_Object list, dirfilename, encoded_directory; | 121 | Lisp_Object list, dirfilename, encoded_directory; |
| 122 | struct re_pattern_buffer *bufp = NULL; | 122 | struct re_pattern_buffer *bufp = NULL; |
| 123 | int needsep = 0; | 123 | int needsep = 0; |
| 124 | int count = SPECPDL_INDEX (); | 124 | ptrdiff_t count = SPECPDL_INDEX (); |
| 125 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 125 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 126 | DIRENTRY *dp; | 126 | DIRENTRY *dp; |
| 127 | #ifdef WINDOWSNT | 127 | #ifdef WINDOWSNT |
| @@ -226,7 +226,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 226 | 226 | ||
| 227 | if (DIRENTRY_NONEMPTY (dp)) | 227 | if (DIRENTRY_NONEMPTY (dp)) |
| 228 | { | 228 | { |
| 229 | int len; | 229 | ptrdiff_t len; |
| 230 | int wanted = 0; | 230 | int wanted = 0; |
| 231 | Lisp_Object name, finalname; | 231 | Lisp_Object name, finalname; |
| 232 | struct gcpro inner_gcpro1, inner_gcpro2; | 232 | struct gcpro inner_gcpro1, inner_gcpro2; |
| @@ -256,8 +256,8 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m | |||
| 256 | if (!NILP (full)) | 256 | if (!NILP (full)) |
| 257 | { | 257 | { |
| 258 | Lisp_Object fullname; | 258 | Lisp_Object fullname; |
| 259 | int nbytes = len + directory_nbytes + needsep; | 259 | ptrdiff_t nbytes = len + directory_nbytes + needsep; |
| 260 | int nchars; | 260 | ptrdiff_t nchars; |
| 261 | 261 | ||
| 262 | fullname = make_uninit_multibyte_string (nbytes, nbytes); | 262 | fullname = make_uninit_multibyte_string (nbytes, nbytes); |
| 263 | memcpy (SDATA (fullname), SDATA (directory), | 263 | memcpy (SDATA (fullname), SDATA (directory), |
| @@ -447,7 +447,7 @@ static Lisp_Object | |||
| 447 | file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate) | 447 | file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate) |
| 448 | { | 448 | { |
| 449 | DIR *d; | 449 | DIR *d; |
| 450 | int bestmatchsize = 0; | 450 | ptrdiff_t bestmatchsize = 0; |
| 451 | int matchcount = 0; | 451 | int matchcount = 0; |
| 452 | /* If ALL_FLAG is 1, BESTMATCH is the list of all matches, decoded. | 452 | /* If ALL_FLAG is 1, BESTMATCH is the list of all matches, decoded. |
| 453 | If ALL_FLAG is 0, BESTMATCH is either nil | 453 | If ALL_FLAG is 0, BESTMATCH is either nil |
| @@ -461,7 +461,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 461 | well as "." and "..". Until shown otherwise, assume we can't exclude | 461 | well as "." and "..". Until shown otherwise, assume we can't exclude |
| 462 | anything. */ | 462 | anything. */ |
| 463 | int includeall = 1; | 463 | int includeall = 1; |
| 464 | int count = SPECPDL_INDEX (); | 464 | ptrdiff_t count = SPECPDL_INDEX (); |
| 465 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 465 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 466 | 466 | ||
| 467 | elt = Qnil; | 467 | elt = Qnil; |
| @@ -501,7 +501,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 501 | while (1) | 501 | while (1) |
| 502 | { | 502 | { |
| 503 | DIRENTRY *dp; | 503 | DIRENTRY *dp; |
| 504 | int len; | 504 | ptrdiff_t len; |
| 505 | int canexclude = 0; | 505 | int canexclude = 0; |
| 506 | 506 | ||
| 507 | errno = 0; | 507 | errno = 0; |
| @@ -537,7 +537,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 537 | completions when making a list of them. */ | 537 | completions when making a list of them. */ |
| 538 | if (!all_flag) | 538 | if (!all_flag) |
| 539 | { | 539 | { |
| 540 | int skip; | 540 | ptrdiff_t skip; |
| 541 | 541 | ||
| 542 | #if 0 /* FIXME: The `scmp' call compares an encoded and a decoded string. */ | 542 | #if 0 /* FIXME: The `scmp' call compares an encoded and a decoded string. */ |
| 543 | /* If this entry matches the current bestmatch, the only | 543 | /* If this entry matches the current bestmatch, the only |
| @@ -567,7 +567,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 567 | for (tem = Vcompletion_ignored_extensions; | 567 | for (tem = Vcompletion_ignored_extensions; |
| 568 | CONSP (tem); tem = XCDR (tem)) | 568 | CONSP (tem); tem = XCDR (tem)) |
| 569 | { | 569 | { |
| 570 | int elt_len; | 570 | ptrdiff_t elt_len; |
| 571 | char *p1; | 571 | char *p1; |
| 572 | 572 | ||
| 573 | elt = XCAR (tem); | 573 | elt = XCAR (tem); |
| @@ -684,7 +684,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 684 | 684 | ||
| 685 | /* Suitably record this match. */ | 685 | /* Suitably record this match. */ |
| 686 | 686 | ||
| 687 | matchcount++; | 687 | matchcount += matchcount <= 1; |
| 688 | 688 | ||
| 689 | if (all_flag) | 689 | if (all_flag) |
| 690 | bestmatch = Fcons (name, bestmatch); | 690 | bestmatch = Fcons (name, bestmatch); |
| @@ -697,14 +697,14 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 697 | { | 697 | { |
| 698 | Lisp_Object zero = make_number (0); | 698 | Lisp_Object zero = make_number (0); |
| 699 | /* FIXME: This is a copy of the code in Ftry_completion. */ | 699 | /* FIXME: This is a copy of the code in Ftry_completion. */ |
| 700 | int compare = min (bestmatchsize, SCHARS (name)); | 700 | ptrdiff_t compare = min (bestmatchsize, SCHARS (name)); |
| 701 | Lisp_Object cmp | 701 | Lisp_Object cmp |
| 702 | = Fcompare_strings (bestmatch, zero, | 702 | = Fcompare_strings (bestmatch, zero, |
| 703 | make_number (compare), | 703 | make_number (compare), |
| 704 | name, zero, | 704 | name, zero, |
| 705 | make_number (compare), | 705 | make_number (compare), |
| 706 | completion_ignore_case ? Qt : Qnil); | 706 | completion_ignore_case ? Qt : Qnil); |
| 707 | int matchsize | 707 | ptrdiff_t matchsize |
| 708 | = (EQ (cmp, Qt) ? compare | 708 | = (EQ (cmp, Qt) ? compare |
| 709 | : XINT (cmp) < 0 ? - XINT (cmp) - 1 | 709 | : XINT (cmp) < 0 ? - XINT (cmp) - 1 |
| 710 | : XINT (cmp) - 1); | 710 | : XINT (cmp) - 1); |
| @@ -783,10 +783,10 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 783 | Return -1 if strings match, | 783 | Return -1 if strings match, |
| 784 | else number of chars that match at the beginning. */ | 784 | else number of chars that match at the beginning. */ |
| 785 | 785 | ||
| 786 | static int | 786 | static ptrdiff_t |
| 787 | scmp (const char *s1, const char *s2, int len) | 787 | scmp (const char *s1, const char *s2, ptrdiff_t len) |
| 788 | { | 788 | { |
| 789 | register int l = len; | 789 | register ptrdiff_t l = len; |
| 790 | 790 | ||
| 791 | if (completion_ignore_case) | 791 | if (completion_ignore_case) |
| 792 | { | 792 | { |
| @@ -809,10 +809,12 @@ scmp (const char *s1, const char *s2, int len) | |||
| 809 | static int | 809 | static int |
| 810 | file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) | 810 | file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr) |
| 811 | { | 811 | { |
| 812 | int len = NAMLEN (dp); | 812 | ptrdiff_t len = NAMLEN (dp); |
| 813 | int pos = SCHARS (dirname); | 813 | ptrdiff_t pos = SCHARS (dirname); |
| 814 | int value; | 814 | int value; |
| 815 | char *fullname = (char *) alloca (len + pos + 2); | 815 | char *fullname; |
| 816 | USE_SAFE_ALLOCA; | ||
| 817 | SAFE_ALLOCA (fullname, char *, len + pos + 2); | ||
| 816 | 818 | ||
| 817 | #ifdef MSDOS | 819 | #ifdef MSDOS |
| 818 | /* Some fields of struct stat are *very* expensive to compute on MS-DOS, | 820 | /* Some fields of struct stat are *very* expensive to compute on MS-DOS, |
| @@ -841,6 +843,7 @@ file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_ad | |||
| 841 | #ifdef MSDOS | 843 | #ifdef MSDOS |
| 842 | _djstat_flags = save_djstat_flags; | 844 | _djstat_flags = save_djstat_flags; |
| 843 | #endif /* MSDOS */ | 845 | #endif /* MSDOS */ |
| 846 | SAFE_FREE (); | ||
| 844 | return value; | 847 | return value; |
| 845 | } | 848 | } |
| 846 | 849 | ||
diff --git a/src/dispextern.h b/src/dispextern.h index 65284121588..76f3686c37a 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -179,10 +179,10 @@ extern int trace_redisplay_p EXTERNALLY_VISIBLE; | |||
| 179 | struct text_pos | 179 | struct text_pos |
| 180 | { | 180 | { |
| 181 | /* Character position. */ | 181 | /* Character position. */ |
| 182 | EMACS_INT charpos; | 182 | ptrdiff_t charpos; |
| 183 | 183 | ||
| 184 | /* Corresponding byte position. */ | 184 | /* Corresponding byte position. */ |
| 185 | EMACS_INT bytepos; | 185 | ptrdiff_t bytepos; |
| 186 | }; | 186 | }; |
| 187 | 187 | ||
| 188 | /* Access character and byte position of POS in a functional form. */ | 188 | /* Access character and byte position of POS in a functional form. */ |
| @@ -253,7 +253,7 @@ struct display_pos | |||
| 253 | is the index of that overlay string in the sequence of overlay | 253 | is the index of that overlay string in the sequence of overlay |
| 254 | strings at `pos' in the order redisplay processes them. A value | 254 | strings at `pos' in the order redisplay processes them. A value |
| 255 | < 0 means that this is not a position in an overlay string. */ | 255 | < 0 means that this is not a position in an overlay string. */ |
| 256 | int overlay_string_index; | 256 | ptrdiff_t overlay_string_index; |
| 257 | 257 | ||
| 258 | /* If this is a position in an overlay string, string_pos is the | 258 | /* If this is a position in an overlay string, string_pos is the |
| 259 | position within that string. */ | 259 | position within that string. */ |
| @@ -320,7 +320,7 @@ struct glyph | |||
| 320 | buffer, this is a position in that buffer. A value of -1 | 320 | buffer, this is a position in that buffer. A value of -1 |
| 321 | together with a null object means glyph is a truncation glyph at | 321 | together with a null object means glyph is a truncation glyph at |
| 322 | the start of a row. */ | 322 | the start of a row. */ |
| 323 | EMACS_INT charpos; | 323 | ptrdiff_t charpos; |
| 324 | 324 | ||
| 325 | /* Lisp object source of this glyph. Currently either a buffer or | 325 | /* Lisp object source of this glyph. Currently either a buffer or |
| 326 | a string, if the glyph was produced from characters which came from | 326 | a string, if the glyph was produced from characters which came from |
| @@ -1808,7 +1808,7 @@ typedef enum { NEUTRAL_DIR, L2R, R2L } bidi_dir_t; | |||
| 1808 | /* Data type for storing information about characters we need to | 1808 | /* Data type for storing information about characters we need to |
| 1809 | remember. */ | 1809 | remember. */ |
| 1810 | struct bidi_saved_info { | 1810 | struct bidi_saved_info { |
| 1811 | EMACS_INT bytepos, charpos; /* character's buffer position */ | 1811 | ptrdiff_t bytepos, charpos; /* character's buffer position */ |
| 1812 | bidi_type_t type; /* character's resolved bidi type */ | 1812 | bidi_type_t type; /* character's resolved bidi type */ |
| 1813 | bidi_type_t type_after_w1; /* original type of the character, after W1 */ | 1813 | bidi_type_t type_after_w1; /* original type of the character, after W1 */ |
| 1814 | bidi_type_t orig_type; /* type as we found it in the buffer */ | 1814 | bidi_type_t orig_type; /* type as we found it in the buffer */ |
| @@ -1825,9 +1825,9 @@ struct bidi_stack { | |||
| 1825 | struct bidi_string_data { | 1825 | struct bidi_string_data { |
| 1826 | Lisp_Object lstring; /* Lisp string to reorder, or nil */ | 1826 | Lisp_Object lstring; /* Lisp string to reorder, or nil */ |
| 1827 | const unsigned char *s; /* string data, or NULL if reordering buffer */ | 1827 | const unsigned char *s; /* string data, or NULL if reordering buffer */ |
| 1828 | EMACS_INT schars; /* the number of characters in the string, | 1828 | ptrdiff_t schars; /* the number of characters in the string, |
| 1829 | excluding the terminating null */ | 1829 | excluding the terminating null */ |
| 1830 | EMACS_INT bufpos; /* buffer position of lstring, or 0 if N/A */ | 1830 | ptrdiff_t bufpos; /* buffer position of lstring, or 0 if N/A */ |
| 1831 | unsigned from_disp_str : 1; /* 1 means the string comes from a | 1831 | unsigned from_disp_str : 1; /* 1 means the string comes from a |
| 1832 | display property */ | 1832 | display property */ |
| 1833 | unsigned unibyte : 1; /* 1 means the string is unibyte */ | 1833 | unsigned unibyte : 1; /* 1 means the string is unibyte */ |
| @@ -1835,14 +1835,14 @@ struct bidi_string_data { | |||
| 1835 | 1835 | ||
| 1836 | /* Data type for reordering bidirectional text. */ | 1836 | /* Data type for reordering bidirectional text. */ |
| 1837 | struct bidi_it { | 1837 | struct bidi_it { |
| 1838 | EMACS_INT bytepos; /* iterator's position in buffer/string */ | 1838 | ptrdiff_t bytepos; /* iterator's position in buffer/string */ |
| 1839 | EMACS_INT charpos; | 1839 | ptrdiff_t charpos; |
| 1840 | int ch; /* character at that position, or u+FFFC | 1840 | int ch; /* character at that position, or u+FFFC |
| 1841 | ("object replacement character") for a run | 1841 | ("object replacement character") for a run |
| 1842 | of characters covered by a display string */ | 1842 | of characters covered by a display string */ |
| 1843 | EMACS_INT nchars; /* its "length", usually 1; it's > 1 for a run | 1843 | ptrdiff_t nchars; /* its "length", usually 1; it's > 1 for a run |
| 1844 | of characters covered by a display string */ | 1844 | of characters covered by a display string */ |
| 1845 | EMACS_INT ch_len; /* its length in bytes */ | 1845 | ptrdiff_t ch_len; /* its length in bytes */ |
| 1846 | bidi_type_t type; /* bidi type of this character, after | 1846 | bidi_type_t type; /* bidi type of this character, after |
| 1847 | resolving weak and neutral types */ | 1847 | resolving weak and neutral types */ |
| 1848 | bidi_type_t type_after_w1; /* original type, after overrides and W1 */ | 1848 | bidi_type_t type_after_w1; /* original type, after overrides and W1 */ |
| @@ -1856,11 +1856,11 @@ struct bidi_it { | |||
| 1856 | struct bidi_saved_info next_for_neutral; /* surrounding characters for... */ | 1856 | struct bidi_saved_info next_for_neutral; /* surrounding characters for... */ |
| 1857 | struct bidi_saved_info prev_for_neutral; /* ...resolving neutrals */ | 1857 | struct bidi_saved_info prev_for_neutral; /* ...resolving neutrals */ |
| 1858 | struct bidi_saved_info next_for_ws; /* character after sequence of ws */ | 1858 | struct bidi_saved_info next_for_ws; /* character after sequence of ws */ |
| 1859 | EMACS_INT next_en_pos; /* position of next EN char for ET */ | 1859 | ptrdiff_t next_en_pos; /* position of next EN char for ET */ |
| 1860 | EMACS_INT ignore_bn_limit; /* position until which to ignore BNs */ | 1860 | ptrdiff_t ignore_bn_limit; /* position until which to ignore BNs */ |
| 1861 | bidi_dir_t sor; /* direction of start-of-run in effect */ | 1861 | bidi_dir_t sor; /* direction of start-of-run in effect */ |
| 1862 | int scan_dir; /* direction of text scan, 1: forw, -1: back */ | 1862 | int scan_dir; /* direction of text scan, 1: forw, -1: back */ |
| 1863 | EMACS_INT disp_pos; /* position of display string after ch */ | 1863 | ptrdiff_t disp_pos; /* position of display string after ch */ |
| 1864 | int disp_prop; /* if non-zero, there really is a | 1864 | int disp_prop; /* if non-zero, there really is a |
| 1865 | `display' property/string at disp_pos; | 1865 | `display' property/string at disp_pos; |
| 1866 | if 2, the property is a `space' spec */ | 1866 | if 2, the property is a `space' spec */ |
| @@ -1871,7 +1871,7 @@ struct bidi_it { | |||
| 1871 | struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ | 1871 | struct bidi_stack level_stack[BIDI_MAXLEVEL]; /* stack of embedding levels */ |
| 1872 | struct bidi_string_data string; /* string to reorder */ | 1872 | struct bidi_string_data string; /* string to reorder */ |
| 1873 | bidi_dir_t paragraph_dir; /* current paragraph direction */ | 1873 | bidi_dir_t paragraph_dir; /* current paragraph direction */ |
| 1874 | EMACS_INT separator_limit; /* where paragraph separator should end */ | 1874 | ptrdiff_t separator_limit; /* where paragraph separator should end */ |
| 1875 | unsigned first_elt : 1; /* if non-zero, examine current char first */ | 1875 | unsigned first_elt : 1; /* if non-zero, examine current char first */ |
| 1876 | unsigned new_paragraph : 1; /* if non-zero, we expect a new paragraph */ | 1876 | unsigned new_paragraph : 1; /* if non-zero, we expect a new paragraph */ |
| 1877 | unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */ | 1877 | unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */ |
| @@ -2057,7 +2057,7 @@ enum it_method { | |||
| 2057 | struct composition_it | 2057 | struct composition_it |
| 2058 | { | 2058 | { |
| 2059 | /* Next position at which to check the composition. */ | 2059 | /* Next position at which to check the composition. */ |
| 2060 | EMACS_INT stop_pos; | 2060 | ptrdiff_t stop_pos; |
| 2061 | /* ID number of the composition or glyph-string. If negative, we | 2061 | /* ID number of the composition or glyph-string. If negative, we |
| 2062 | are not iterating over a composition now. */ | 2062 | are not iterating over a composition now. */ |
| 2063 | ptrdiff_t id; | 2063 | ptrdiff_t id; |
| @@ -2075,7 +2075,7 @@ struct composition_it | |||
| 2075 | /* If this is an automatic composition, how many characters to look | 2075 | /* If this is an automatic composition, how many characters to look |
| 2076 | back from the position where a character triggering the | 2076 | back from the position where a character triggering the |
| 2077 | composition exists. */ | 2077 | composition exists. */ |
| 2078 | int lookback; | 2078 | ptrdiff_t lookback; |
| 2079 | /* If non-negative, number of glyphs of the glyph-string. */ | 2079 | /* If non-negative, number of glyphs of the glyph-string. */ |
| 2080 | int nglyphs; | 2080 | int nglyphs; |
| 2081 | /* Nonzero iff the composition is created while buffer is scanned in | 2081 | /* Nonzero iff the composition is created while buffer is scanned in |
| @@ -2086,7 +2086,7 @@ struct composition_it | |||
| 2086 | /** The following members contain information about the current | 2086 | /** The following members contain information about the current |
| 2087 | grapheme cluster. */ | 2087 | grapheme cluster. */ |
| 2088 | /* Position of the first character of the current grapheme cluster. */ | 2088 | /* Position of the first character of the current grapheme cluster. */ |
| 2089 | EMACS_INT charpos; | 2089 | ptrdiff_t charpos; |
| 2090 | /* Number of characters and bytes of the current grapheme cluster. */ | 2090 | /* Number of characters and bytes of the current grapheme cluster. */ |
| 2091 | int nchars, nbytes; | 2091 | int nchars, nbytes; |
| 2092 | /* Indices of the glyphs for the current grapheme cluster. */ | 2092 | /* Indices of the glyphs for the current grapheme cluster. */ |
| @@ -2111,19 +2111,19 @@ struct it | |||
| 2111 | 2111 | ||
| 2112 | /* The next position at which to check for face changes, invisible | 2112 | /* The next position at which to check for face changes, invisible |
| 2113 | text, overlay strings, end of text etc., which see. */ | 2113 | text, overlay strings, end of text etc., which see. */ |
| 2114 | EMACS_INT stop_charpos; | 2114 | ptrdiff_t stop_charpos; |
| 2115 | 2115 | ||
| 2116 | /* Previous stop position, i.e. the last one before the current | 2116 | /* Previous stop position, i.e. the last one before the current |
| 2117 | iterator position in `current'. */ | 2117 | iterator position in `current'. */ |
| 2118 | EMACS_INT prev_stop; | 2118 | ptrdiff_t prev_stop; |
| 2119 | 2119 | ||
| 2120 | /* Last stop position iterated across whose bidi embedding level is | 2120 | /* Last stop position iterated across whose bidi embedding level is |
| 2121 | equal to the current paragraph's base embedding level. */ | 2121 | equal to the current paragraph's base embedding level. */ |
| 2122 | EMACS_INT base_level_stop; | 2122 | ptrdiff_t base_level_stop; |
| 2123 | 2123 | ||
| 2124 | /* Maximum string or buffer position + 1. ZV when iterating over | 2124 | /* Maximum string or buffer position + 1. ZV when iterating over |
| 2125 | current_buffer. */ | 2125 | current_buffer. */ |
| 2126 | EMACS_INT end_charpos; | 2126 | ptrdiff_t end_charpos; |
| 2127 | 2127 | ||
| 2128 | /* C string to iterate over. Non-null means get characters from | 2128 | /* C string to iterate over. Non-null means get characters from |
| 2129 | this string, otherwise characters are read from current_buffer | 2129 | this string, otherwise characters are read from current_buffer |
| @@ -2132,14 +2132,14 @@ struct it | |||
| 2132 | 2132 | ||
| 2133 | /* Number of characters in the string (s, or it->string) we iterate | 2133 | /* Number of characters in the string (s, or it->string) we iterate |
| 2134 | over. */ | 2134 | over. */ |
| 2135 | EMACS_INT string_nchars; | 2135 | ptrdiff_t string_nchars; |
| 2136 | 2136 | ||
| 2137 | /* Start and end of a visible region; -1 if the region is not | 2137 | /* Start and end of a visible region; -1 if the region is not |
| 2138 | visible in the window. */ | 2138 | visible in the window. */ |
| 2139 | EMACS_INT region_beg_charpos, region_end_charpos; | 2139 | ptrdiff_t region_beg_charpos, region_end_charpos; |
| 2140 | 2140 | ||
| 2141 | /* Position at which redisplay end trigger functions should be run. */ | 2141 | /* Position at which redisplay end trigger functions should be run. */ |
| 2142 | EMACS_INT redisplay_end_trigger_charpos; | 2142 | ptrdiff_t redisplay_end_trigger_charpos; |
| 2143 | 2143 | ||
| 2144 | /* 1 means multibyte characters are enabled. */ | 2144 | /* 1 means multibyte characters are enabled. */ |
| 2145 | unsigned multibyte_p : 1; | 2145 | unsigned multibyte_p : 1; |
| @@ -2204,13 +2204,13 @@ struct it | |||
| 2204 | 2204 | ||
| 2205 | /* Total number of overlay strings to process. This can be > | 2205 | /* Total number of overlay strings to process. This can be > |
| 2206 | OVERLAY_STRING_CHUNK_SIZE. */ | 2206 | OVERLAY_STRING_CHUNK_SIZE. */ |
| 2207 | int n_overlay_strings; | 2207 | ptrdiff_t n_overlay_strings; |
| 2208 | 2208 | ||
| 2209 | /* The charpos where n_overlay_strings was calculated. This should | 2209 | /* The charpos where n_overlay_strings was calculated. This should |
| 2210 | be set at the same time as n_overlay_strings. It is needed | 2210 | be set at the same time as n_overlay_strings. It is needed |
| 2211 | because we show before-strings at the start of invisible text; | 2211 | because we show before-strings at the start of invisible text; |
| 2212 | see handle_invisible_prop in xdisp.c. */ | 2212 | see handle_invisible_prop in xdisp.c. */ |
| 2213 | EMACS_INT overlay_strings_charpos; | 2213 | ptrdiff_t overlay_strings_charpos; |
| 2214 | 2214 | ||
| 2215 | /* Vector of overlays to process. Overlay strings are processed | 2215 | /* Vector of overlays to process. Overlay strings are processed |
| 2216 | OVERLAY_STRING_CHUNK_SIZE at a time. */ | 2216 | OVERLAY_STRING_CHUNK_SIZE at a time. */ |
| @@ -2237,10 +2237,10 @@ struct it | |||
| 2237 | { | 2237 | { |
| 2238 | Lisp_Object string; | 2238 | Lisp_Object string; |
| 2239 | int string_nchars; | 2239 | int string_nchars; |
| 2240 | EMACS_INT end_charpos; | 2240 | ptrdiff_t end_charpos; |
| 2241 | EMACS_INT stop_charpos; | 2241 | ptrdiff_t stop_charpos; |
| 2242 | EMACS_INT prev_stop; | 2242 | ptrdiff_t prev_stop; |
| 2243 | EMACS_INT base_level_stop; | 2243 | ptrdiff_t base_level_stop; |
| 2244 | struct composition_it cmp_it; | 2244 | struct composition_it cmp_it; |
| 2245 | int face_id; | 2245 | int face_id; |
| 2246 | 2246 | ||
| @@ -2289,7 +2289,7 @@ struct it | |||
| 2289 | 2289 | ||
| 2290 | /* -1 means selective display hides everything between a \r and the | 2290 | /* -1 means selective display hides everything between a \r and the |
| 2291 | next newline; > 0 means hide lines indented more than that value. */ | 2291 | next newline; > 0 means hide lines indented more than that value. */ |
| 2292 | EMACS_INT selective; | 2292 | ptrdiff_t selective; |
| 2293 | 2293 | ||
| 2294 | /* An enumeration describing what the next display element is | 2294 | /* An enumeration describing what the next display element is |
| 2295 | after a call to get_next_display_element. */ | 2295 | after a call to get_next_display_element. */ |
| @@ -2973,7 +2973,7 @@ enum tool_bar_item_image | |||
| 2973 | 2973 | ||
| 2974 | /* Defined in bidi.c */ | 2974 | /* Defined in bidi.c */ |
| 2975 | 2975 | ||
| 2976 | extern void bidi_init_it (EMACS_INT, EMACS_INT, int, struct bidi_it *); | 2976 | extern void bidi_init_it (ptrdiff_t, ptrdiff_t, int, struct bidi_it *); |
| 2977 | extern void bidi_move_to_visually_next (struct bidi_it *); | 2977 | extern void bidi_move_to_visually_next (struct bidi_it *); |
| 2978 | extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int); | 2978 | extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int); |
| 2979 | extern int bidi_mirror_char (int); | 2979 | extern int bidi_mirror_char (int); |
| @@ -2984,11 +2984,11 @@ extern void bidi_unshelve_cache (void *, int); | |||
| 2984 | 2984 | ||
| 2985 | /* Defined in xdisp.c */ | 2985 | /* Defined in xdisp.c */ |
| 2986 | 2986 | ||
| 2987 | struct glyph_row *row_containing_pos (struct window *, EMACS_INT, | 2987 | struct glyph_row *row_containing_pos (struct window *, ptrdiff_t, |
| 2988 | struct glyph_row *, | 2988 | struct glyph_row *, |
| 2989 | struct glyph_row *, int); | 2989 | struct glyph_row *, int); |
| 2990 | int line_bottom_y (struct it *); | 2990 | int line_bottom_y (struct it *); |
| 2991 | int display_prop_intangible_p (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); | 2991 | int display_prop_intangible_p (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 2992 | void resize_echo_area_exactly (void); | 2992 | void resize_echo_area_exactly (void); |
| 2993 | int resize_mini_window (struct window *, int); | 2993 | int resize_mini_window (struct window *, int); |
| 2994 | #if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK | 2994 | #if defined USE_TOOLKIT_SCROLL_BARS && !defined USE_GTK |
| @@ -3010,18 +3010,18 @@ void remember_mouse_glyph (struct frame *, int, int, NativeRectangle *); | |||
| 3010 | 3010 | ||
| 3011 | void mark_window_display_accurate (Lisp_Object, int); | 3011 | void mark_window_display_accurate (Lisp_Object, int); |
| 3012 | void redisplay_preserve_echo_area (int); | 3012 | void redisplay_preserve_echo_area (int); |
| 3013 | void init_iterator (struct it *, struct window *, EMACS_INT, | 3013 | void init_iterator (struct it *, struct window *, ptrdiff_t, |
| 3014 | EMACS_INT, struct glyph_row *, enum face_id); | 3014 | ptrdiff_t, struct glyph_row *, enum face_id); |
| 3015 | void init_iterator_to_row_start (struct it *, struct window *, | 3015 | void init_iterator_to_row_start (struct it *, struct window *, |
| 3016 | struct glyph_row *); | 3016 | struct glyph_row *); |
| 3017 | void start_display (struct it *, struct window *, struct text_pos); | 3017 | void start_display (struct it *, struct window *, struct text_pos); |
| 3018 | void move_it_to (struct it *, EMACS_INT, int, int, int, int); | 3018 | void move_it_to (struct it *, ptrdiff_t, int, int, int, int); |
| 3019 | void move_it_vertically (struct it *, int); | 3019 | void move_it_vertically (struct it *, int); |
| 3020 | void move_it_vertically_backward (struct it *, int); | 3020 | void move_it_vertically_backward (struct it *, int); |
| 3021 | void move_it_by_lines (struct it *, int); | 3021 | void move_it_by_lines (struct it *, ptrdiff_t); |
| 3022 | void move_it_past_eol (struct it *); | 3022 | void move_it_past_eol (struct it *); |
| 3023 | void move_it_in_display_line (struct it *it, | 3023 | void move_it_in_display_line (struct it *it, |
| 3024 | EMACS_INT to_charpos, int to_x, | 3024 | ptrdiff_t to_charpos, int to_x, |
| 3025 | enum move_operation_enum op); | 3025 | enum move_operation_enum op); |
| 3026 | int in_display_vector_p (struct it *); | 3026 | int in_display_vector_p (struct it *); |
| 3027 | int frame_mode_line_height (struct frame *); | 3027 | int frame_mode_line_height (struct frame *); |
| @@ -3031,15 +3031,15 @@ extern int help_echo_showing_p; | |||
| 3031 | extern int current_mode_line_height, current_header_line_height; | 3031 | extern int current_mode_line_height, current_header_line_height; |
| 3032 | extern Lisp_Object help_echo_string, help_echo_window; | 3032 | extern Lisp_Object help_echo_string, help_echo_window; |
| 3033 | extern Lisp_Object help_echo_object, previous_help_echo_string; | 3033 | extern Lisp_Object help_echo_object, previous_help_echo_string; |
| 3034 | extern EMACS_INT help_echo_pos; | 3034 | extern ptrdiff_t help_echo_pos; |
| 3035 | extern struct frame *last_mouse_frame; | 3035 | extern struct frame *last_mouse_frame; |
| 3036 | extern int last_tool_bar_item; | 3036 | extern int last_tool_bar_item; |
| 3037 | extern void reseat_at_previous_visible_line_start (struct it *); | 3037 | extern void reseat_at_previous_visible_line_start (struct it *); |
| 3038 | extern Lisp_Object lookup_glyphless_char_display (int, struct it *); | 3038 | extern Lisp_Object lookup_glyphless_char_display (int, struct it *); |
| 3039 | extern EMACS_INT compute_display_string_pos (struct text_pos *, | 3039 | extern ptrdiff_t compute_display_string_pos (struct text_pos *, |
| 3040 | struct bidi_string_data *, | 3040 | struct bidi_string_data *, |
| 3041 | int, int *); | 3041 | int, int *); |
| 3042 | extern EMACS_INT compute_display_string_end (EMACS_INT, | 3042 | extern ptrdiff_t compute_display_string_end (ptrdiff_t, |
| 3043 | struct bidi_string_data *); | 3043 | struct bidi_string_data *); |
| 3044 | extern void produce_stretch_glyph (struct it *); | 3044 | extern void produce_stretch_glyph (struct it *); |
| 3045 | 3045 | ||
| @@ -3085,7 +3085,7 @@ extern void get_glyph_string_clip_rect (struct glyph_string *, | |||
| 3085 | extern Lisp_Object find_hot_spot (Lisp_Object, int, int); | 3085 | extern Lisp_Object find_hot_spot (Lisp_Object, int, int); |
| 3086 | 3086 | ||
| 3087 | extern void handle_tool_bar_click (struct frame *, | 3087 | extern void handle_tool_bar_click (struct frame *, |
| 3088 | int, int, int, unsigned int); | 3088 | int, int, int, int); |
| 3089 | 3089 | ||
| 3090 | extern void expose_frame (struct frame *, int, int, int, int); | 3090 | extern void expose_frame (struct frame *, int, int, int, int); |
| 3091 | extern int x_intersect_rectangles (XRectangle *, XRectangle *, | 3091 | extern int x_intersect_rectangles (XRectangle *, XRectangle *, |
| @@ -3188,19 +3188,19 @@ int lookup_derived_face (struct frame *, Lisp_Object, int, int); | |||
| 3188 | void init_frame_faces (struct frame *); | 3188 | void init_frame_faces (struct frame *); |
| 3189 | void free_frame_faces (struct frame *); | 3189 | void free_frame_faces (struct frame *); |
| 3190 | void recompute_basic_faces (struct frame *); | 3190 | void recompute_basic_faces (struct frame *); |
| 3191 | int face_at_buffer_position (struct window *w, EMACS_INT pos, | 3191 | int face_at_buffer_position (struct window *w, ptrdiff_t pos, |
| 3192 | EMACS_INT region_beg, EMACS_INT region_end, | 3192 | ptrdiff_t region_beg, ptrdiff_t region_end, |
| 3193 | EMACS_INT *endptr, EMACS_INT limit, | 3193 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 3194 | int mouse, int base_face_id); | 3194 | int mouse, int base_face_id); |
| 3195 | int face_for_overlay_string (struct window *w, EMACS_INT pos, | 3195 | int face_for_overlay_string (struct window *w, ptrdiff_t pos, |
| 3196 | EMACS_INT region_beg, EMACS_INT region_end, | 3196 | ptrdiff_t region_beg, ptrdiff_t region_end, |
| 3197 | EMACS_INT *endptr, EMACS_INT limit, | 3197 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 3198 | int mouse, Lisp_Object overlay); | 3198 | int mouse, Lisp_Object overlay); |
| 3199 | int face_at_string_position (struct window *w, Lisp_Object string, | 3199 | int face_at_string_position (struct window *w, Lisp_Object string, |
| 3200 | EMACS_INT pos, EMACS_INT bufpos, | 3200 | ptrdiff_t pos, ptrdiff_t bufpos, |
| 3201 | EMACS_INT region_beg, EMACS_INT region_end, | 3201 | ptrdiff_t region_beg, ptrdiff_t region_end, |
| 3202 | EMACS_INT *endptr, enum face_id, int mouse); | 3202 | ptrdiff_t *endptr, enum face_id, int mouse); |
| 3203 | int merge_faces (struct frame *, Lisp_Object, EMACS_INT, int); | 3203 | int merge_faces (struct frame *, Lisp_Object, int, int); |
| 3204 | int compute_char_face (struct frame *, int, Lisp_Object); | 3204 | int compute_char_face (struct frame *, int, Lisp_Object); |
| 3205 | void free_all_realized_faces (Lisp_Object); | 3205 | void free_all_realized_faces (Lisp_Object); |
| 3206 | extern Lisp_Object Qforeground_color, Qbackground_color; | 3206 | extern Lisp_Object Qforeground_color, Qbackground_color; |
| @@ -3266,11 +3266,11 @@ extern Lisp_Object buffer_posn_from_coords (struct window *, | |||
| 3266 | Lisp_Object *, | 3266 | Lisp_Object *, |
| 3267 | int *, int *, int *, int *); | 3267 | int *, int *, int *, int *); |
| 3268 | extern Lisp_Object mode_line_string (struct window *, enum window_part, | 3268 | extern Lisp_Object mode_line_string (struct window *, enum window_part, |
| 3269 | int *, int *, EMACS_INT *, | 3269 | int *, int *, ptrdiff_t *, |
| 3270 | Lisp_Object *, | 3270 | Lisp_Object *, |
| 3271 | int *, int *, int *, int *); | 3271 | int *, int *, int *, int *); |
| 3272 | extern Lisp_Object marginal_area_string (struct window *, enum window_part, | 3272 | extern Lisp_Object marginal_area_string (struct window *, enum window_part, |
| 3273 | int *, int *, EMACS_INT *, | 3273 | int *, int *, ptrdiff_t *, |
| 3274 | Lisp_Object *, | 3274 | Lisp_Object *, |
| 3275 | int *, int *, int *, int *); | 3275 | int *, int *, int *, int *); |
| 3276 | extern void redraw_frame (struct frame *); | 3276 | extern void redraw_frame (struct frame *); |
| @@ -3290,7 +3290,7 @@ void shift_glyph_matrix (struct window *, struct glyph_matrix *, | |||
| 3290 | int, int, int); | 3290 | int, int, int); |
| 3291 | void rotate_matrix (struct glyph_matrix *, int, int, int); | 3291 | void rotate_matrix (struct glyph_matrix *, int, int, int); |
| 3292 | void increment_matrix_positions (struct glyph_matrix *, | 3292 | void increment_matrix_positions (struct glyph_matrix *, |
| 3293 | int, int, EMACS_INT, EMACS_INT); | 3293 | int, int, ptrdiff_t, ptrdiff_t); |
| 3294 | void blank_row (struct window *, struct glyph_row *, int); | 3294 | void blank_row (struct window *, struct glyph_row *, int); |
| 3295 | void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int); | 3295 | void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int); |
| 3296 | void clear_glyph_row (struct glyph_row *); | 3296 | void clear_glyph_row (struct glyph_row *); |
diff --git a/src/dispnew.c b/src/dispnew.c index 958420d3081..7e1273ac34b 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -108,7 +108,7 @@ static int required_matrix_height (struct window *); | |||
| 108 | static int required_matrix_width (struct window *); | 108 | static int required_matrix_width (struct window *); |
| 109 | static void adjust_frame_glyphs (struct frame *); | 109 | static void adjust_frame_glyphs (struct frame *); |
| 110 | static void change_frame_size_1 (struct frame *, int, int, int, int, int); | 110 | static void change_frame_size_1 (struct frame *, int, int, int, int, int); |
| 111 | static void increment_row_positions (struct glyph_row *, EMACS_INT, EMACS_INT); | 111 | static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t); |
| 112 | static void fill_up_frame_row_with_spaces (struct glyph_row *, int); | 112 | static void fill_up_frame_row_with_spaces (struct glyph_row *, int); |
| 113 | static void build_frame_matrix_from_window_tree (struct glyph_matrix *, | 113 | static void build_frame_matrix_from_window_tree (struct glyph_matrix *, |
| 114 | struct window *); | 114 | struct window *); |
| @@ -750,7 +750,7 @@ rotate_matrix (struct glyph_matrix *matrix, int first, int last, int by) | |||
| 750 | 750 | ||
| 751 | void | 751 | void |
| 752 | increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, | 752 | increment_matrix_positions (struct glyph_matrix *matrix, int start, int end, |
| 753 | EMACS_INT delta, EMACS_INT delta_bytes) | 753 | ptrdiff_t delta, ptrdiff_t delta_bytes) |
| 754 | { | 754 | { |
| 755 | /* Check that START and END are reasonable values. */ | 755 | /* Check that START and END are reasonable values. */ |
| 756 | xassert (start >= 0 && start <= matrix->nrows); | 756 | xassert (start >= 0 && start <= matrix->nrows); |
| @@ -992,7 +992,7 @@ blank_row (struct window *w, struct glyph_row *row, int y) | |||
| 992 | 992 | ||
| 993 | static void | 993 | static void |
| 994 | increment_row_positions (struct glyph_row *row, | 994 | increment_row_positions (struct glyph_row *row, |
| 995 | EMACS_INT delta, EMACS_INT delta_bytes) | 995 | ptrdiff_t delta, ptrdiff_t delta_bytes) |
| 996 | { | 996 | { |
| 997 | int area, i; | 997 | int area, i; |
| 998 | 998 | ||
| @@ -2513,8 +2513,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w | |||
| 2513 | 2513 | ||
| 2514 | SET_GLYPH_FROM_CHAR (right_border_glyph, '|'); | 2514 | SET_GLYPH_FROM_CHAR (right_border_glyph, '|'); |
| 2515 | if (dp | 2515 | if (dp |
| 2516 | && (gc = DISP_BORDER_GLYPH (dp), GLYPH_CODE_P (gc)) | 2516 | && (gc = DISP_BORDER_GLYPH (dp), GLYPH_CODE_P (gc))) |
| 2517 | && GLYPH_CODE_CHAR_VALID_P (gc)) | ||
| 2518 | { | 2517 | { |
| 2519 | SET_GLYPH_FROM_GLYPH_CODE (right_border_glyph, gc); | 2518 | SET_GLYPH_FROM_GLYPH_CODE (right_border_glyph, gc); |
| 2520 | spec_glyph_lookup_face (w, &right_border_glyph); | 2519 | spec_glyph_lookup_face (w, &right_border_glyph); |
| @@ -5381,7 +5380,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p | |||
| 5381 | 5380 | ||
| 5382 | Lisp_Object | 5381 | Lisp_Object |
| 5383 | mode_line_string (struct window *w, enum window_part part, | 5382 | mode_line_string (struct window *w, enum window_part part, |
| 5384 | int *x, int *y, EMACS_INT *charpos, Lisp_Object *object, | 5383 | int *x, int *y, ptrdiff_t *charpos, Lisp_Object *object, |
| 5385 | int *dx, int *dy, int *width, int *height) | 5384 | int *dx, int *dy, int *width, int *height) |
| 5386 | { | 5385 | { |
| 5387 | struct glyph_row *row; | 5386 | struct glyph_row *row; |
| @@ -5450,7 +5449,7 @@ mode_line_string (struct window *w, enum window_part part, | |||
| 5450 | 5449 | ||
| 5451 | Lisp_Object | 5450 | Lisp_Object |
| 5452 | marginal_area_string (struct window *w, enum window_part part, | 5451 | marginal_area_string (struct window *w, enum window_part part, |
| 5453 | int *x, int *y, EMACS_INT *charpos, Lisp_Object *object, | 5452 | int *x, int *y, ptrdiff_t *charpos, Lisp_Object *object, |
| 5454 | int *dx, int *dy, int *width, int *height) | 5453 | int *dx, int *dy, int *width, int *height) |
| 5455 | { | 5454 | { |
| 5456 | struct glyph_row *row = w->current_matrix->rows; | 5455 | struct glyph_row *row = w->current_matrix->rows; |
| @@ -5647,7 +5646,7 @@ static void | |||
| 5647 | change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe) | 5646 | change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe) |
| 5648 | { | 5647 | { |
| 5649 | int new_frame_total_cols; | 5648 | int new_frame_total_cols; |
| 5650 | int count = SPECPDL_INDEX (); | 5649 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5651 | 5650 | ||
| 5652 | /* If we can't deal with the change now, queue it for later. */ | 5651 | /* If we can't deal with the change now, queue it for later. */ |
| 5653 | if (delay || (redisplaying_p && !safe)) | 5652 | if (delay || (redisplaying_p && !safe)) |
| @@ -5865,6 +5864,38 @@ bitch_at_user (void) | |||
| 5865 | Sleeping, Waiting | 5864 | Sleeping, Waiting |
| 5866 | ***********************************************************************/ | 5865 | ***********************************************************************/ |
| 5867 | 5866 | ||
| 5867 | /* Convert a positive value DURATION to a seconds count *PSEC plus a | ||
| 5868 | microseconds count *PUSEC, rounding up. On overflow return the | ||
| 5869 | maximal value. */ | ||
| 5870 | void | ||
| 5871 | duration_to_sec_usec (double duration, int *psec, int *pusec) | ||
| 5872 | { | ||
| 5873 | int MILLION = 1000000; | ||
| 5874 | int sec = INT_MAX, usec = MILLION - 1; | ||
| 5875 | |||
| 5876 | if (duration < INT_MAX + 1.0) | ||
| 5877 | { | ||
| 5878 | int s = duration; | ||
| 5879 | double usdouble = (duration - s) * MILLION; | ||
| 5880 | int usfloor = usdouble; | ||
| 5881 | int usceil = usfloor + (usfloor < usdouble); | ||
| 5882 | |||
| 5883 | if (usceil < MILLION) | ||
| 5884 | { | ||
| 5885 | sec = s; | ||
| 5886 | usec = usceil; | ||
| 5887 | } | ||
| 5888 | else if (sec < INT_MAX) | ||
| 5889 | { | ||
| 5890 | sec = s + 1; | ||
| 5891 | usec = 0; | ||
| 5892 | } | ||
| 5893 | } | ||
| 5894 | |||
| 5895 | *psec = sec; | ||
| 5896 | *pusec = usec; | ||
| 5897 | } | ||
| 5898 | |||
| 5868 | DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0, | 5899 | DEFUN ("sleep-for", Fsleep_for, Ssleep_for, 1, 2, 0, |
| 5869 | doc: /* Pause, without updating display, for SECONDS seconds. | 5900 | doc: /* Pause, without updating display, for SECONDS seconds. |
| 5870 | SECONDS may be a floating-point value, meaning that you can wait for a | 5901 | SECONDS may be a floating-point value, meaning that you can wait for a |
| @@ -5875,39 +5906,24 @@ Emacs was built without floating point support. | |||
| 5875 | (Lisp_Object seconds, Lisp_Object milliseconds) | 5906 | (Lisp_Object seconds, Lisp_Object milliseconds) |
| 5876 | { | 5907 | { |
| 5877 | int sec, usec; | 5908 | int sec, usec; |
| 5909 | double duration = extract_float (seconds); | ||
| 5878 | 5910 | ||
| 5879 | if (NILP (milliseconds)) | 5911 | if (!NILP (milliseconds)) |
| 5880 | XSETINT (milliseconds, 0); | 5912 | { |
| 5881 | else | 5913 | CHECK_NUMBER (milliseconds); |
| 5882 | CHECK_NUMBER (milliseconds); | 5914 | duration += XINT (milliseconds) / 1000.0; |
| 5883 | usec = XINT (milliseconds) * 1000; | 5915 | } |
| 5884 | 5916 | ||
| 5885 | { | 5917 | if (! (0 < duration)) |
| 5886 | double duration = extract_float (seconds); | 5918 | return Qnil; |
| 5887 | sec = (int) duration; | 5919 | |
| 5888 | usec += (duration - sec) * 1000000; | 5920 | duration_to_sec_usec (duration, &sec, &usec); |
| 5889 | } | ||
| 5890 | 5921 | ||
| 5891 | #ifndef EMACS_HAS_USECS | 5922 | #ifndef EMACS_HAS_USECS |
| 5892 | if (sec == 0 && usec != 0) | 5923 | if (sec == 0 && usec != 0) |
| 5893 | error ("Millisecond `sleep-for' not supported on %s", SYSTEM_TYPE); | 5924 | error ("Millisecond `sleep-for' not supported on %s", SYSTEM_TYPE); |
| 5894 | #endif | 5925 | #endif |
| 5895 | 5926 | ||
| 5896 | /* Assure that 0 <= usec < 1000000. */ | ||
| 5897 | if (usec < 0) | ||
| 5898 | { | ||
| 5899 | /* We can't rely on the rounding being correct if usec is negative. */ | ||
| 5900 | if (-1000000 < usec) | ||
| 5901 | sec--, usec += 1000000; | ||
| 5902 | else | ||
| 5903 | sec -= -usec / 1000000, usec = 1000000 - (-usec % 1000000); | ||
| 5904 | } | ||
| 5905 | else | ||
| 5906 | sec += usec / 1000000, usec %= 1000000; | ||
| 5907 | |||
| 5908 | if (sec < 0 || (sec == 0 && usec == 0)) | ||
| 5909 | return Qnil; | ||
| 5910 | |||
| 5911 | wait_reading_process_output (sec, usec, 0, 0, Qnil, NULL, 0); | 5927 | wait_reading_process_output (sec, usec, 0, 0, Qnil, NULL, 0); |
| 5912 | 5928 | ||
| 5913 | return Qnil; | 5929 | return Qnil; |
| @@ -5938,27 +5954,20 @@ sit_for (Lisp_Object timeout, int reading, int do_display) | |||
| 5938 | if (do_display >= 2) | 5954 | if (do_display >= 2) |
| 5939 | redisplay_preserve_echo_area (2); | 5955 | redisplay_preserve_echo_area (2); |
| 5940 | 5956 | ||
| 5941 | if (INTEGERP (timeout)) | 5957 | if (EQ (timeout, Qt)) |
| 5942 | { | ||
| 5943 | sec = XINT (timeout); | ||
| 5944 | usec = 0; | ||
| 5945 | } | ||
| 5946 | else if (FLOATP (timeout)) | ||
| 5947 | { | ||
| 5948 | double seconds = XFLOAT_DATA (timeout); | ||
| 5949 | sec = (int) seconds; | ||
| 5950 | usec = (int) ((seconds - sec) * 1000000); | ||
| 5951 | } | ||
| 5952 | else if (EQ (timeout, Qt)) | ||
| 5953 | { | 5958 | { |
| 5954 | sec = 0; | 5959 | sec = 0; |
| 5955 | usec = 0; | 5960 | usec = 0; |
| 5956 | } | 5961 | } |
| 5957 | else | 5962 | else |
| 5958 | wrong_type_argument (Qnumberp, timeout); | 5963 | { |
| 5964 | double duration = extract_float (timeout); | ||
| 5959 | 5965 | ||
| 5960 | if (sec == 0 && usec == 0 && !EQ (timeout, Qt)) | 5966 | if (! (0 < duration)) |
| 5961 | return Qt; | 5967 | return Qt; |
| 5968 | |||
| 5969 | duration_to_sec_usec (duration, &sec, &usec); | ||
| 5970 | } | ||
| 5962 | 5971 | ||
| 5963 | #ifdef SIGIO | 5972 | #ifdef SIGIO |
| 5964 | gobble_input (0); | 5973 | gobble_input (0); |
| @@ -5978,7 +5987,7 @@ perform a full redisplay even if input is available. | |||
| 5978 | Return t if redisplay was performed, nil otherwise. */) | 5987 | Return t if redisplay was performed, nil otherwise. */) |
| 5979 | (Lisp_Object force) | 5988 | (Lisp_Object force) |
| 5980 | { | 5989 | { |
| 5981 | int count; | 5990 | ptrdiff_t count; |
| 5982 | 5991 | ||
| 5983 | swallow_events (1); | 5992 | swallow_events (1); |
| 5984 | if ((detect_input_pending_run_timers (1) | 5993 | if ((detect_input_pending_run_timers (1) |
| @@ -86,9 +86,11 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) | |||
| 86 | register int fd; | 86 | register int fd; |
| 87 | register char *name; | 87 | register char *name; |
| 88 | register char *p, *p1; | 88 | register char *p, *p1; |
| 89 | EMACS_INT minsize; | 89 | ptrdiff_t minsize; |
| 90 | EMACS_INT offset, position; | 90 | int offset; |
| 91 | EMACS_INT position; | ||
| 91 | Lisp_Object file, tem; | 92 | Lisp_Object file, tem; |
| 93 | USE_SAFE_ALLOCA; | ||
| 92 | 94 | ||
| 93 | if (INTEGERP (filepos)) | 95 | if (INTEGERP (filepos)) |
| 94 | { | 96 | { |
| @@ -122,7 +124,7 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) | |||
| 122 | /* sizeof ("../etc/") == 8 */ | 124 | /* sizeof ("../etc/") == 8 */ |
| 123 | if (minsize < 8) | 125 | if (minsize < 8) |
| 124 | minsize = 8; | 126 | minsize = 8; |
| 125 | name = (char *) alloca (minsize + SCHARS (file) + 8); | 127 | SAFE_ALLOCA (name, char *, minsize + SCHARS (file) + 8); |
| 126 | strcpy (name, SSDATA (Vdoc_directory)); | 128 | strcpy (name, SSDATA (Vdoc_directory)); |
| 127 | strcat (name, SSDATA (file)); | 129 | strcat (name, SSDATA (file)); |
| 128 | } | 130 | } |
| @@ -153,13 +155,16 @@ get_doc_string (Lisp_Object filepos, int unibyte, int definition) | |||
| 153 | /* Make sure we read at least 1024 bytes before `position' | 155 | /* Make sure we read at least 1024 bytes before `position' |
| 154 | so we can check the leading text for consistency. */ | 156 | so we can check the leading text for consistency. */ |
| 155 | offset = min (position, max (1024, position % (8 * 1024))); | 157 | offset = min (position, max (1024, position % (8 * 1024))); |
| 156 | if (0 > lseek (fd, position - offset, 0)) | 158 | if (TYPE_MAXIMUM (off_t) < position |
| 159 | || lseek (fd, position - offset, 0) < 0) | ||
| 157 | { | 160 | { |
| 158 | emacs_close (fd); | 161 | emacs_close (fd); |
| 159 | error ("Position %"pI"d out of range in doc string file \"%s\"", | 162 | error ("Position %"pI"d out of range in doc string file \"%s\"", |
| 160 | position, name); | 163 | position, name); |
| 161 | } | 164 | } |
| 162 | 165 | ||
| 166 | SAFE_FREE (); | ||
| 167 | |||
| 163 | /* Read the doc string into get_doc_string_buffer. | 168 | /* Read the doc string into get_doc_string_buffer. |
| 164 | P points beyond the data just read. */ | 169 | P points beyond the data just read. */ |
| 165 | 170 | ||
| @@ -277,7 +282,7 @@ Invalid data in documentation file -- %c followed by code %03o", | |||
| 277 | else | 282 | else |
| 278 | { | 283 | { |
| 279 | /* The data determines whether the string is multibyte. */ | 284 | /* The data determines whether the string is multibyte. */ |
| 280 | EMACS_INT nchars = | 285 | ptrdiff_t nchars = |
| 281 | multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer | 286 | multibyte_chars_in_text (((unsigned char *) get_doc_string_buffer |
| 282 | + offset), | 287 | + offset), |
| 283 | to - (get_doc_string_buffer + offset)); | 288 | to - (get_doc_string_buffer + offset)); |
| @@ -500,8 +505,7 @@ aren't strings. */) | |||
| 500 | /* Scanning the DOC files and placing docstring offsets into functions. */ | 505 | /* Scanning the DOC files and placing docstring offsets into functions. */ |
| 501 | 506 | ||
| 502 | static void | 507 | static void |
| 503 | store_function_docstring (Lisp_Object fun, EMACS_INT offset) | 508 | store_function_docstring (Lisp_Object fun, ptrdiff_t offset) |
| 504 | /* Use EMACS_INT because we get offset from pointer subtraction. */ | ||
| 505 | { | 509 | { |
| 506 | fun = indirect_function (fun); | 510 | fun = indirect_function (fun); |
| 507 | 511 | ||
| @@ -556,7 +560,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 556 | { | 560 | { |
| 557 | int fd; | 561 | int fd; |
| 558 | char buf[1024 + 1]; | 562 | char buf[1024 + 1]; |
| 559 | register EMACS_INT filled; | 563 | register int filled; |
| 560 | register EMACS_INT pos; | 564 | register EMACS_INT pos; |
| 561 | register char *p; | 565 | register char *p; |
| 562 | Lisp_Object sym; | 566 | Lisp_Object sym; |
| @@ -591,7 +595,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 591 | 595 | ||
| 592 | for (beg = buildobj; *beg; beg = end) | 596 | for (beg = buildobj; *beg; beg = end) |
| 593 | { | 597 | { |
| 594 | EMACS_INT len; | 598 | ptrdiff_t len; |
| 595 | 599 | ||
| 596 | while (*beg && isspace (*beg)) ++beg; | 600 | while (*beg && isspace (*beg)) ++beg; |
| 597 | 601 | ||
| @@ -639,7 +643,7 @@ the same file name is found in the `doc-directory'. */) | |||
| 639 | if (end - p > 4 && end[-2] == '.' | 643 | if (end - p > 4 && end[-2] == '.' |
| 640 | && (end[-1] == 'o' || end[-1] == 'c')) | 644 | && (end[-1] == 'o' || end[-1] == 'c')) |
| 641 | { | 645 | { |
| 642 | EMACS_INT len = end - p - 2; | 646 | ptrdiff_t len = end - p - 2; |
| 643 | char *fromfile = alloca (len + 1); | 647 | char *fromfile = alloca (len + 1); |
| 644 | strncpy (fromfile, &p[2], len); | 648 | strncpy (fromfile, &p[2], len); |
| 645 | fromfile[len] = 0; | 649 | fromfile[len] = 0; |
diff --git a/src/doprnt.c b/src/doprnt.c index b4d13c59137..b7c1e4e68e2 100644 --- a/src/doprnt.c +++ b/src/doprnt.c | |||
| @@ -174,7 +174,7 @@ doprnt (char *buffer, ptrdiff_t bufsize, const char *format, | |||
| 174 | if (*fmt == '%') /* Check for a '%' character */ | 174 | if (*fmt == '%') /* Check for a '%' character */ |
| 175 | { | 175 | { |
| 176 | ptrdiff_t size_bound = 0; | 176 | ptrdiff_t size_bound = 0; |
| 177 | EMACS_INT width; /* Columns occupied by STRING on display. */ | 177 | ptrdiff_t width; /* Columns occupied by STRING on display. */ |
| 178 | enum { | 178 | enum { |
| 179 | pDlen = sizeof pD - 1, | 179 | pDlen = sizeof pD - 1, |
| 180 | pIlen = sizeof pI - 1, | 180 | pIlen = sizeof pI - 1, |
diff --git a/src/editfns.c b/src/editfns.c index 3dd58377ada..ac9c20ced65 100644 --- a/src/editfns.c +++ b/src/editfns.c | |||
| @@ -86,7 +86,7 @@ extern Lisp_Object w32_get_internal_run_time (void); | |||
| 86 | 86 | ||
| 87 | static void time_overflow (void) NO_RETURN; | 87 | static void time_overflow (void) NO_RETURN; |
| 88 | static int tm_diff (struct tm *, struct tm *); | 88 | static int tm_diff (struct tm *, struct tm *); |
| 89 | static void update_buffer_properties (EMACS_INT, EMACS_INT); | 89 | static void update_buffer_properties (ptrdiff_t, ptrdiff_t); |
| 90 | 90 | ||
| 91 | static Lisp_Object Qbuffer_access_fontify_functions; | 91 | static Lisp_Object Qbuffer_access_fontify_functions; |
| 92 | static Lisp_Object Fuser_full_name (Lisp_Object); | 92 | static Lisp_Object Fuser_full_name (Lisp_Object); |
| @@ -146,8 +146,14 @@ init_editfns (void) | |||
| 146 | /* If the user name claimed in the environment vars differs from | 146 | /* If the user name claimed in the environment vars differs from |
| 147 | the real uid, use the claimed name to find the full name. */ | 147 | the real uid, use the claimed name to find the full name. */ |
| 148 | tem = Fstring_equal (Vuser_login_name, Vuser_real_login_name); | 148 | tem = Fstring_equal (Vuser_login_name, Vuser_real_login_name); |
| 149 | Vuser_full_name = Fuser_full_name (NILP (tem)? make_number (geteuid ()) | 149 | if (! NILP (tem)) |
| 150 | : Vuser_login_name); | 150 | tem = Vuser_login_name; |
| 151 | else | ||
| 152 | { | ||
| 153 | uid_t euid = geteuid (); | ||
| 154 | tem = make_fixnum_or_float (euid); | ||
| 155 | } | ||
| 156 | Vuser_full_name = Fuser_full_name (tem); | ||
| 151 | 157 | ||
| 152 | p = getenv ("NAME"); | 158 | p = getenv ("NAME"); |
| 153 | if (p) | 159 | if (p) |
| @@ -212,7 +218,7 @@ DEFUN ("string-to-char", Fstring_to_char, Sstring_to_char, 1, 1, 0, | |||
| 212 | } | 218 | } |
| 213 | 219 | ||
| 214 | static Lisp_Object | 220 | static Lisp_Object |
| 215 | buildmark (EMACS_INT charpos, EMACS_INT bytepos) | 221 | buildmark (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 216 | { | 222 | { |
| 217 | register Lisp_Object mark; | 223 | register Lisp_Object mark; |
| 218 | mark = Fmake_marker (); | 224 | mark = Fmake_marker (); |
| @@ -237,17 +243,6 @@ DEFUN ("point-marker", Fpoint_marker, Spoint_marker, 0, 0, 0, | |||
| 237 | return buildmark (PT, PT_BYTE); | 243 | return buildmark (PT, PT_BYTE); |
| 238 | } | 244 | } |
| 239 | 245 | ||
| 240 | EMACS_INT | ||
| 241 | clip_to_bounds (EMACS_INT lower, EMACS_INT num, EMACS_INT upper) | ||
| 242 | { | ||
| 243 | if (num < lower) | ||
| 244 | return lower; | ||
| 245 | else if (num > upper) | ||
| 246 | return upper; | ||
| 247 | else | ||
| 248 | return num; | ||
| 249 | } | ||
| 250 | |||
| 251 | DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", | 246 | DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", |
| 252 | doc: /* Set point to POSITION, a number or marker. | 247 | doc: /* Set point to POSITION, a number or marker. |
| 253 | Beginning of buffer is position (point-min), end is (point-max). | 248 | Beginning of buffer is position (point-min), end is (point-max). |
| @@ -255,7 +250,7 @@ Beginning of buffer is position (point-min), end is (point-max). | |||
| 255 | The return value is POSITION. */) | 250 | The return value is POSITION. */) |
| 256 | (register Lisp_Object position) | 251 | (register Lisp_Object position) |
| 257 | { | 252 | { |
| 258 | EMACS_INT pos; | 253 | ptrdiff_t pos; |
| 259 | 254 | ||
| 260 | if (MARKERP (position) | 255 | if (MARKERP (position) |
| 261 | && current_buffer == XMARKER (position)->buffer) | 256 | && current_buffer == XMARKER (position)->buffer) |
| @@ -335,7 +330,7 @@ overlays_around (EMACS_INT pos, Lisp_Object *vec, ptrdiff_t len) | |||
| 335 | { | 330 | { |
| 336 | Lisp_Object overlay, start, end; | 331 | Lisp_Object overlay, start, end; |
| 337 | struct Lisp_Overlay *tail; | 332 | struct Lisp_Overlay *tail; |
| 338 | EMACS_INT startpos, endpos; | 333 | ptrdiff_t startpos, endpos; |
| 339 | ptrdiff_t idx = 0; | 334 | ptrdiff_t idx = 0; |
| 340 | 335 | ||
| 341 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) | 336 | for (tail = current_buffer->overlays_before; tail; tail = tail->next) |
| @@ -484,7 +479,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o | |||
| 484 | static void | 479 | static void |
| 485 | find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, | 480 | find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, |
| 486 | Lisp_Object beg_limit, | 481 | Lisp_Object beg_limit, |
| 487 | EMACS_INT *beg, Lisp_Object end_limit, EMACS_INT *end) | 482 | ptrdiff_t *beg, Lisp_Object end_limit, ptrdiff_t *end) |
| 488 | { | 483 | { |
| 489 | /* Fields right before and after the point. */ | 484 | /* Fields right before and after the point. */ |
| 490 | Lisp_Object before_field, after_field; | 485 | Lisp_Object before_field, after_field; |
| @@ -600,7 +595,7 @@ A field is a region of text with the same `field' property. | |||
| 600 | If POS is nil, the value of point is used for POS. */) | 595 | If POS is nil, the value of point is used for POS. */) |
| 601 | (Lisp_Object pos) | 596 | (Lisp_Object pos) |
| 602 | { | 597 | { |
| 603 | EMACS_INT beg, end; | 598 | ptrdiff_t beg, end; |
| 604 | find_field (pos, Qnil, Qnil, &beg, Qnil, &end); | 599 | find_field (pos, Qnil, Qnil, &beg, Qnil, &end); |
| 605 | if (beg != end) | 600 | if (beg != end) |
| 606 | del_range (beg, end); | 601 | del_range (beg, end); |
| @@ -613,7 +608,7 @@ A field is a region of text with the same `field' property. | |||
| 613 | If POS is nil, the value of point is used for POS. */) | 608 | If POS is nil, the value of point is used for POS. */) |
| 614 | (Lisp_Object pos) | 609 | (Lisp_Object pos) |
| 615 | { | 610 | { |
| 616 | EMACS_INT beg, end; | 611 | ptrdiff_t beg, end; |
| 617 | find_field (pos, Qnil, Qnil, &beg, Qnil, &end); | 612 | find_field (pos, Qnil, Qnil, &beg, Qnil, &end); |
| 618 | return make_buffer_string (beg, end, 1); | 613 | return make_buffer_string (beg, end, 1); |
| 619 | } | 614 | } |
| @@ -624,7 +619,7 @@ A field is a region of text with the same `field' property. | |||
| 624 | If POS is nil, the value of point is used for POS. */) | 619 | If POS is nil, the value of point is used for POS. */) |
| 625 | (Lisp_Object pos) | 620 | (Lisp_Object pos) |
| 626 | { | 621 | { |
| 627 | EMACS_INT beg, end; | 622 | ptrdiff_t beg, end; |
| 628 | find_field (pos, Qnil, Qnil, &beg, Qnil, &end); | 623 | find_field (pos, Qnil, Qnil, &beg, Qnil, &end); |
| 629 | return make_buffer_string (beg, end, 0); | 624 | return make_buffer_string (beg, end, 0); |
| 630 | } | 625 | } |
| @@ -639,7 +634,7 @@ If LIMIT is non-nil, it is a buffer position; if the beginning of the field | |||
| 639 | is before LIMIT, then LIMIT will be returned instead. */) | 634 | is before LIMIT, then LIMIT will be returned instead. */) |
| 640 | (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) | 635 | (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) |
| 641 | { | 636 | { |
| 642 | EMACS_INT beg; | 637 | ptrdiff_t beg; |
| 643 | find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); | 638 | find_field (pos, escape_from_edge, limit, &beg, Qnil, 0); |
| 644 | return make_number (beg); | 639 | return make_number (beg); |
| 645 | } | 640 | } |
| @@ -654,7 +649,7 @@ If LIMIT is non-nil, it is a buffer position; if the end of the field | |||
| 654 | is after LIMIT, then LIMIT will be returned instead. */) | 649 | is after LIMIT, then LIMIT will be returned instead. */) |
| 655 | (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) | 650 | (Lisp_Object pos, Lisp_Object escape_from_edge, Lisp_Object limit) |
| 656 | { | 651 | { |
| 657 | EMACS_INT end; | 652 | ptrdiff_t end; |
| 658 | find_field (pos, escape_from_edge, Qnil, 0, limit, &end); | 653 | find_field (pos, escape_from_edge, Qnil, 0, limit, &end); |
| 659 | return make_number (end); | 654 | return make_number (end); |
| 660 | } | 655 | } |
| @@ -689,7 +684,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) | |||
| 689 | (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) | 684 | (Lisp_Object new_pos, Lisp_Object old_pos, Lisp_Object escape_from_edge, Lisp_Object only_in_line, Lisp_Object inhibit_capture_property) |
| 690 | { | 685 | { |
| 691 | /* If non-zero, then the original point, before re-positioning. */ | 686 | /* If non-zero, then the original point, before re-positioning. */ |
| 692 | EMACS_INT orig_point = 0; | 687 | ptrdiff_t orig_point = 0; |
| 693 | int fwd; | 688 | int fwd; |
| 694 | Lisp_Object prev_old, prev_new; | 689 | Lisp_Object prev_old, prev_new; |
| 695 | 690 | ||
| @@ -703,10 +698,10 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) | |||
| 703 | CHECK_NUMBER_COERCE_MARKER (new_pos); | 698 | CHECK_NUMBER_COERCE_MARKER (new_pos); |
| 704 | CHECK_NUMBER_COERCE_MARKER (old_pos); | 699 | CHECK_NUMBER_COERCE_MARKER (old_pos); |
| 705 | 700 | ||
| 706 | fwd = (XFASTINT (new_pos) > XFASTINT (old_pos)); | 701 | fwd = (XINT (new_pos) > XINT (old_pos)); |
| 707 | 702 | ||
| 708 | prev_old = make_number (XFASTINT (old_pos) - 1); | 703 | prev_old = make_number (XINT (old_pos) - 1); |
| 709 | prev_new = make_number (XFASTINT (new_pos) - 1); | 704 | prev_new = make_number (XINT (new_pos) - 1); |
| 710 | 705 | ||
| 711 | if (NILP (Vinhibit_field_text_motion) | 706 | if (NILP (Vinhibit_field_text_motion) |
| 712 | && !EQ (new_pos, old_pos) | 707 | && !EQ (new_pos, old_pos) |
| @@ -731,7 +726,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) | |||
| 731 | /* It is possible that NEW_POS is not within the same field as | 726 | /* It is possible that NEW_POS is not within the same field as |
| 732 | OLD_POS; try to move NEW_POS so that it is. */ | 727 | OLD_POS; try to move NEW_POS so that it is. */ |
| 733 | { | 728 | { |
| 734 | EMACS_INT shortage; | 729 | ptrdiff_t shortage; |
| 735 | Lisp_Object field_bound; | 730 | Lisp_Object field_bound; |
| 736 | 731 | ||
| 737 | if (fwd) | 732 | if (fwd) |
| @@ -786,8 +781,8 @@ boundaries bind `inhibit-field-text-motion' to t. | |||
| 786 | This function does not move point. */) | 781 | This function does not move point. */) |
| 787 | (Lisp_Object n) | 782 | (Lisp_Object n) |
| 788 | { | 783 | { |
| 789 | EMACS_INT orig, orig_byte, end; | 784 | ptrdiff_t orig, orig_byte, end; |
| 790 | int count = SPECPDL_INDEX (); | 785 | ptrdiff_t count = SPECPDL_INDEX (); |
| 791 | specbind (Qinhibit_point_motion_hooks, Qt); | 786 | specbind (Qinhibit_point_motion_hooks, Qt); |
| 792 | 787 | ||
| 793 | if (NILP (n)) | 788 | if (NILP (n)) |
| @@ -827,15 +822,17 @@ boundaries bind `inhibit-field-text-motion' to t. | |||
| 827 | This function does not move point. */) | 822 | This function does not move point. */) |
| 828 | (Lisp_Object n) | 823 | (Lisp_Object n) |
| 829 | { | 824 | { |
| 830 | EMACS_INT end_pos; | 825 | ptrdiff_t clipped_n; |
| 831 | EMACS_INT orig = PT; | 826 | ptrdiff_t end_pos; |
| 827 | ptrdiff_t orig = PT; | ||
| 832 | 828 | ||
| 833 | if (NILP (n)) | 829 | if (NILP (n)) |
| 834 | XSETFASTINT (n, 1); | 830 | XSETFASTINT (n, 1); |
| 835 | else | 831 | else |
| 836 | CHECK_NUMBER (n); | 832 | CHECK_NUMBER (n); |
| 837 | 833 | ||
| 838 | end_pos = find_before_next_newline (orig, 0, XINT (n) - (XINT (n) <= 0)); | 834 | clipped_n = clip_to_bounds (PTRDIFF_MIN + 1, XINT (n), PTRDIFF_MAX); |
| 835 | end_pos = find_before_next_newline (orig, 0, clipped_n - (clipped_n <= 0)); | ||
| 839 | 836 | ||
| 840 | /* Return END_POS constrained to the current input field. */ | 837 | /* Return END_POS constrained to the current input field. */ |
| 841 | return Fconstrain_to_field (make_number (end_pos), make_number (orig), | 838 | return Fconstrain_to_field (make_number (end_pos), make_number (orig), |
| @@ -962,7 +959,7 @@ usage: (save-excursion &rest BODY) */) | |||
| 962 | (Lisp_Object args) | 959 | (Lisp_Object args) |
| 963 | { | 960 | { |
| 964 | register Lisp_Object val; | 961 | register Lisp_Object val; |
| 965 | int count = SPECPDL_INDEX (); | 962 | ptrdiff_t count = SPECPDL_INDEX (); |
| 966 | 963 | ||
| 967 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 964 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 968 | 965 | ||
| @@ -977,7 +974,7 @@ usage: (save-current-buffer &rest BODY) */) | |||
| 977 | (Lisp_Object args) | 974 | (Lisp_Object args) |
| 978 | { | 975 | { |
| 979 | Lisp_Object val; | 976 | Lisp_Object val; |
| 980 | int count = SPECPDL_INDEX (); | 977 | ptrdiff_t count = SPECPDL_INDEX (); |
| 981 | 978 | ||
| 982 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); | 979 | record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ()); |
| 983 | 980 | ||
| @@ -1103,7 +1100,7 @@ At the beginning of the buffer or accessible region, return 0. */) | |||
| 1103 | XSETFASTINT (temp, 0); | 1100 | XSETFASTINT (temp, 0); |
| 1104 | else if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) | 1101 | else if (!NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 1105 | { | 1102 | { |
| 1106 | EMACS_INT pos = PT_BYTE; | 1103 | ptrdiff_t pos = PT_BYTE; |
| 1107 | DEC_POS (pos); | 1104 | DEC_POS (pos); |
| 1108 | XSETFASTINT (temp, FETCH_CHAR (pos)); | 1105 | XSETFASTINT (temp, FETCH_CHAR (pos)); |
| 1109 | } | 1106 | } |
| @@ -1157,7 +1154,7 @@ POS is an integer or a marker and defaults to point. | |||
| 1157 | If POS is out of range, the value is nil. */) | 1154 | If POS is out of range, the value is nil. */) |
| 1158 | (Lisp_Object pos) | 1155 | (Lisp_Object pos) |
| 1159 | { | 1156 | { |
| 1160 | register EMACS_INT pos_byte; | 1157 | register ptrdiff_t pos_byte; |
| 1161 | 1158 | ||
| 1162 | if (NILP (pos)) | 1159 | if (NILP (pos)) |
| 1163 | { | 1160 | { |
| @@ -1190,7 +1187,7 @@ If POS is out of range, the value is nil. */) | |||
| 1190 | (Lisp_Object pos) | 1187 | (Lisp_Object pos) |
| 1191 | { | 1188 | { |
| 1192 | register Lisp_Object val; | 1189 | register Lisp_Object val; |
| 1193 | register EMACS_INT pos_byte; | 1190 | register ptrdiff_t pos_byte; |
| 1194 | 1191 | ||
| 1195 | if (NILP (pos)) | 1192 | if (NILP (pos)) |
| 1196 | { | 1193 | { |
| @@ -1277,14 +1274,7 @@ DEFUN ("user-uid", Fuser_uid, Suser_uid, 0, 0, 0, | |||
| 1277 | Value is an integer or a float, depending on the value. */) | 1274 | Value is an integer or a float, depending on the value. */) |
| 1278 | (void) | 1275 | (void) |
| 1279 | { | 1276 | { |
| 1280 | /* Assignment to EMACS_INT stops GCC whining about limited range of | 1277 | uid_t euid = geteuid (); |
| 1281 | data type. */ | ||
| 1282 | EMACS_INT euid = geteuid (); | ||
| 1283 | |||
| 1284 | /* Make sure we don't produce a negative UID due to signed integer | ||
| 1285 | overflow. */ | ||
| 1286 | if (euid < 0) | ||
| 1287 | return make_float (geteuid ()); | ||
| 1288 | return make_fixnum_or_float (euid); | 1278 | return make_fixnum_or_float (euid); |
| 1289 | } | 1279 | } |
| 1290 | 1280 | ||
| @@ -1293,14 +1283,7 @@ DEFUN ("user-real-uid", Fuser_real_uid, Suser_real_uid, 0, 0, 0, | |||
| 1293 | Value is an integer or a float, depending on the value. */) | 1283 | Value is an integer or a float, depending on the value. */) |
| 1294 | (void) | 1284 | (void) |
| 1295 | { | 1285 | { |
| 1296 | /* Assignment to EMACS_INT stops GCC whining about limited range of | 1286 | uid_t uid = getuid (); |
| 1297 | data type. */ | ||
| 1298 | EMACS_INT uid = getuid (); | ||
| 1299 | |||
| 1300 | /* Make sure we don't produce a negative UID due to signed integer | ||
| 1301 | overflow. */ | ||
| 1302 | if (uid < 0) | ||
| 1303 | return make_float (getuid ()); | ||
| 1304 | return make_fixnum_or_float (uid); | 1287 | return make_fixnum_or_float (uid); |
| 1305 | } | 1288 | } |
| 1306 | 1289 | ||
| @@ -1385,10 +1368,11 @@ get_system_name (void) | |||
| 1385 | } | 1368 | } |
| 1386 | 1369 | ||
| 1387 | DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, | 1370 | DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0, |
| 1388 | doc: /* Return the process ID of Emacs, as an integer. */) | 1371 | doc: /* Return the process ID of Emacs, as a number. */) |
| 1389 | (void) | 1372 | (void) |
| 1390 | { | 1373 | { |
| 1391 | return make_number (getpid ()); | 1374 | pid_t pid = getpid (); |
| 1375 | return make_fixnum_or_float (pid); | ||
| 1392 | } | 1376 | } |
| 1393 | 1377 | ||
| 1394 | 1378 | ||
| @@ -1428,7 +1412,7 @@ hi_time (time_t t) | |||
| 1428 | } | 1412 | } |
| 1429 | 1413 | ||
| 1430 | /* Return the bottom 16 bits of the time T. */ | 1414 | /* Return the bottom 16 bits of the time T. */ |
| 1431 | static EMACS_INT | 1415 | static int |
| 1432 | lo_time (time_t t) | 1416 | lo_time (time_t t) |
| 1433 | { | 1417 | { |
| 1434 | return t & ((1 << 16) - 1); | 1418 | return t & ((1 << 16) - 1); |
| @@ -1546,6 +1530,8 @@ lisp_time_argument (Lisp_Object specified_time, time_t *result, int *usec) | |||
| 1546 | else | 1530 | else |
| 1547 | { | 1531 | { |
| 1548 | CHECK_NUMBER (usec_l); | 1532 | CHECK_NUMBER (usec_l); |
| 1533 | if (! (0 <= XINT (usec_l) && XINT (usec_l) < 1000000)) | ||
| 1534 | return 0; | ||
| 1549 | *usec = XINT (usec_l); | 1535 | *usec = XINT (usec_l); |
| 1550 | } | 1536 | } |
| 1551 | } | 1537 | } |
| @@ -1883,9 +1869,12 @@ usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */) | |||
| 1883 | tzstring = SSDATA (zone); | 1869 | tzstring = SSDATA (zone); |
| 1884 | else if (INTEGERP (zone)) | 1870 | else if (INTEGERP (zone)) |
| 1885 | { | 1871 | { |
| 1886 | int abszone = eabs (XINT (zone)); | 1872 | EMACS_INT abszone = eabs (XINT (zone)); |
| 1887 | sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0), | 1873 | EMACS_INT zone_hr = abszone / (60*60); |
| 1888 | abszone / (60*60), (abszone/60) % 60, abszone % 60); | 1874 | int zone_min = (abszone/60) % 60; |
| 1875 | int zone_sec = abszone % 60; | ||
| 1876 | sprintf (tzbuf, "XXX%s%"pI"d:%02d:%02d", "-" + (XINT (zone) < 0), | ||
| 1877 | zone_hr, zone_min, zone_sec); | ||
| 1889 | tzstring = tzbuf; | 1878 | tzstring = tzbuf; |
| 1890 | } | 1879 | } |
| 1891 | else | 1880 | else |
| @@ -2187,10 +2176,10 @@ set_time_zone_rule (const char *tzstring) | |||
| 2187 | 2176 | ||
| 2188 | static void | 2177 | static void |
| 2189 | general_insert_function (void (*insert_func) | 2178 | general_insert_function (void (*insert_func) |
| 2190 | (const char *, EMACS_INT), | 2179 | (const char *, ptrdiff_t), |
| 2191 | void (*insert_from_string_func) | 2180 | void (*insert_from_string_func) |
| 2192 | (Lisp_Object, EMACS_INT, EMACS_INT, | 2181 | (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 2193 | EMACS_INT, EMACS_INT, int), | 2182 | ptrdiff_t, ptrdiff_t, int), |
| 2194 | int inherit, ptrdiff_t nargs, Lisp_Object *args) | 2183 | int inherit, ptrdiff_t nargs, Lisp_Object *args) |
| 2195 | { | 2184 | { |
| 2196 | ptrdiff_t argnum; | 2185 | ptrdiff_t argnum; |
| @@ -2326,7 +2315,7 @@ from adjoining text, if those properties are sticky. */) | |||
| 2326 | (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) | 2315 | (Lisp_Object character, Lisp_Object count, Lisp_Object inherit) |
| 2327 | { | 2316 | { |
| 2328 | int i, stringlen; | 2317 | int i, stringlen; |
| 2329 | register EMACS_INT n; | 2318 | register ptrdiff_t n; |
| 2330 | int c, len; | 2319 | int c, len; |
| 2331 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | 2320 | unsigned char str[MAX_MULTIBYTE_LENGTH]; |
| 2332 | char string[4000]; | 2321 | char string[4000]; |
| @@ -2402,10 +2391,10 @@ from adjoining text, if those properties are sticky. */) | |||
| 2402 | buffer substrings. */ | 2391 | buffer substrings. */ |
| 2403 | 2392 | ||
| 2404 | Lisp_Object | 2393 | Lisp_Object |
| 2405 | make_buffer_string (EMACS_INT start, EMACS_INT end, int props) | 2394 | make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props) |
| 2406 | { | 2395 | { |
| 2407 | EMACS_INT start_byte = CHAR_TO_BYTE (start); | 2396 | ptrdiff_t start_byte = CHAR_TO_BYTE (start); |
| 2408 | EMACS_INT end_byte = CHAR_TO_BYTE (end); | 2397 | ptrdiff_t end_byte = CHAR_TO_BYTE (end); |
| 2409 | 2398 | ||
| 2410 | return make_buffer_string_both (start, start_byte, end, end_byte, props); | 2399 | return make_buffer_string_both (start, start_byte, end, end_byte, props); |
| 2411 | } | 2400 | } |
| @@ -2426,8 +2415,8 @@ make_buffer_string (EMACS_INT start, EMACS_INT end, int props) | |||
| 2426 | buffer substrings. */ | 2415 | buffer substrings. */ |
| 2427 | 2416 | ||
| 2428 | Lisp_Object | 2417 | Lisp_Object |
| 2429 | make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte, | 2418 | make_buffer_string_both (ptrdiff_t start, ptrdiff_t start_byte, |
| 2430 | EMACS_INT end, EMACS_INT end_byte, int props) | 2419 | ptrdiff_t end, ptrdiff_t end_byte, int props) |
| 2431 | { | 2420 | { |
| 2432 | Lisp_Object result, tem, tem1; | 2421 | Lisp_Object result, tem, tem1; |
| 2433 | 2422 | ||
| @@ -2460,7 +2449,7 @@ make_buffer_string_both (EMACS_INT start, EMACS_INT start_byte, | |||
| 2460 | in the current buffer, if necessary. */ | 2449 | in the current buffer, if necessary. */ |
| 2461 | 2450 | ||
| 2462 | static void | 2451 | static void |
| 2463 | update_buffer_properties (EMACS_INT start, EMACS_INT end) | 2452 | update_buffer_properties (ptrdiff_t start, ptrdiff_t end) |
| 2464 | { | 2453 | { |
| 2465 | /* If this buffer has some access functions, | 2454 | /* If this buffer has some access functions, |
| 2466 | call them, specifying the range of the buffer being accessed. */ | 2455 | call them, specifying the range of the buffer being accessed. */ |
| @@ -2499,7 +2488,7 @@ into the result string; if you don't want the text properties, | |||
| 2499 | use `buffer-substring-no-properties' instead. */) | 2488 | use `buffer-substring-no-properties' instead. */) |
| 2500 | (Lisp_Object start, Lisp_Object end) | 2489 | (Lisp_Object start, Lisp_Object end) |
| 2501 | { | 2490 | { |
| 2502 | register EMACS_INT b, e; | 2491 | register ptrdiff_t b, e; |
| 2503 | 2492 | ||
| 2504 | validate_region (&start, &end); | 2493 | validate_region (&start, &end); |
| 2505 | b = XINT (start); | 2494 | b = XINT (start); |
| @@ -2515,7 +2504,7 @@ The two arguments START and END are character positions; | |||
| 2515 | they can be in either order. */) | 2504 | they can be in either order. */) |
| 2516 | (Lisp_Object start, Lisp_Object end) | 2505 | (Lisp_Object start, Lisp_Object end) |
| 2517 | { | 2506 | { |
| 2518 | register EMACS_INT b, e; | 2507 | register ptrdiff_t b, e; |
| 2519 | 2508 | ||
| 2520 | validate_region (&start, &end); | 2509 | validate_region (&start, &end); |
| 2521 | b = XINT (start); | 2510 | b = XINT (start); |
| @@ -2599,8 +2588,8 @@ determines whether case is significant or ignored. */) | |||
| 2599 | register Lisp_Object trt | 2588 | register Lisp_Object trt |
| 2600 | = (!NILP (BVAR (current_buffer, case_fold_search)) | 2589 | = (!NILP (BVAR (current_buffer, case_fold_search)) |
| 2601 | ? BVAR (current_buffer, case_canon_table) : Qnil); | 2590 | ? BVAR (current_buffer, case_canon_table) : Qnil); |
| 2602 | EMACS_INT chars = 0; | 2591 | ptrdiff_t chars = 0; |
| 2603 | EMACS_INT i1, i2, i1_byte, i2_byte; | 2592 | ptrdiff_t i1, i2, i1_byte, i2_byte; |
| 2604 | 2593 | ||
| 2605 | /* Find the first buffer and its substring. */ | 2594 | /* Find the first buffer and its substring. */ |
| 2606 | 2595 | ||
| @@ -2761,21 +2750,21 @@ and don't mark the buffer as really changed. | |||
| 2761 | Both characters must have the same length of multi-byte form. */) | 2750 | Both characters must have the same length of multi-byte form. */) |
| 2762 | (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo) | 2751 | (Lisp_Object start, Lisp_Object end, Lisp_Object fromchar, Lisp_Object tochar, Lisp_Object noundo) |
| 2763 | { | 2752 | { |
| 2764 | register EMACS_INT pos, pos_byte, stop, i, len, end_byte; | 2753 | register ptrdiff_t pos, pos_byte, stop, i, len, end_byte; |
| 2765 | /* Keep track of the first change in the buffer: | 2754 | /* Keep track of the first change in the buffer: |
| 2766 | if 0 we haven't found it yet. | 2755 | if 0 we haven't found it yet. |
| 2767 | if < 0 we've found it and we've run the before-change-function. | 2756 | if < 0 we've found it and we've run the before-change-function. |
| 2768 | if > 0 we've actually performed it and the value is its position. */ | 2757 | if > 0 we've actually performed it and the value is its position. */ |
| 2769 | EMACS_INT changed = 0; | 2758 | ptrdiff_t changed = 0; |
| 2770 | unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; | 2759 | unsigned char fromstr[MAX_MULTIBYTE_LENGTH], tostr[MAX_MULTIBYTE_LENGTH]; |
| 2771 | unsigned char *p; | 2760 | unsigned char *p; |
| 2772 | int count = SPECPDL_INDEX (); | 2761 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2773 | #define COMBINING_NO 0 | 2762 | #define COMBINING_NO 0 |
| 2774 | #define COMBINING_BEFORE 1 | 2763 | #define COMBINING_BEFORE 1 |
| 2775 | #define COMBINING_AFTER 2 | 2764 | #define COMBINING_AFTER 2 |
| 2776 | #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) | 2765 | #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) |
| 2777 | int maybe_byte_combining = COMBINING_NO; | 2766 | int maybe_byte_combining = COMBINING_NO; |
| 2778 | EMACS_INT last_changed = 0; | 2767 | ptrdiff_t last_changed = 0; |
| 2779 | int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 2768 | int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 2780 | int fromc, toc; | 2769 | int fromc, toc; |
| 2781 | 2770 | ||
| @@ -2835,7 +2824,7 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2835 | stop = min (stop, GPT_BYTE); | 2824 | stop = min (stop, GPT_BYTE); |
| 2836 | while (1) | 2825 | while (1) |
| 2837 | { | 2826 | { |
| 2838 | EMACS_INT pos_byte_next = pos_byte; | 2827 | ptrdiff_t pos_byte_next = pos_byte; |
| 2839 | 2828 | ||
| 2840 | if (pos_byte >= stop) | 2829 | if (pos_byte >= stop) |
| 2841 | { | 2830 | { |
| @@ -2938,7 +2927,7 @@ Both characters must have the same length of multi-byte form. */) | |||
| 2938 | } | 2927 | } |
| 2939 | 2928 | ||
| 2940 | 2929 | ||
| 2941 | static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT, | 2930 | static Lisp_Object check_translation (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 2942 | Lisp_Object); | 2931 | Lisp_Object); |
| 2943 | 2932 | ||
| 2944 | /* Helper function for Ftranslate_region_internal. | 2933 | /* Helper function for Ftranslate_region_internal. |
| @@ -2948,7 +2937,7 @@ static Lisp_Object check_translation (EMACS_INT, EMACS_INT, EMACS_INT, | |||
| 2948 | element is found, return it. Otherwise return Qnil. */ | 2937 | element is found, return it. Otherwise return Qnil. */ |
| 2949 | 2938 | ||
| 2950 | static Lisp_Object | 2939 | static Lisp_Object |
| 2951 | check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end, | 2940 | check_translation (ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t end, |
| 2952 | Lisp_Object val) | 2941 | Lisp_Object val) |
| 2953 | { | 2942 | { |
| 2954 | int buf_size = 16, buf_used = 0; | 2943 | int buf_size = 16, buf_used = 0; |
| @@ -2957,7 +2946,7 @@ check_translation (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT end, | |||
| 2957 | for (; CONSP (val); val = XCDR (val)) | 2946 | for (; CONSP (val); val = XCDR (val)) |
| 2958 | { | 2947 | { |
| 2959 | Lisp_Object elt; | 2948 | Lisp_Object elt; |
| 2960 | EMACS_INT len, i; | 2949 | ptrdiff_t len, i; |
| 2961 | 2950 | ||
| 2962 | elt = XCAR (val); | 2951 | elt = XCAR (val); |
| 2963 | if (! CONSP (elt)) | 2952 | if (! CONSP (elt)) |
| @@ -3010,8 +2999,8 @@ It returns the number of characters changed. */) | |||
| 3010 | register unsigned char *tt; /* Trans table. */ | 2999 | register unsigned char *tt; /* Trans table. */ |
| 3011 | register int nc; /* New character. */ | 3000 | register int nc; /* New character. */ |
| 3012 | int cnt; /* Number of changes made. */ | 3001 | int cnt; /* Number of changes made. */ |
| 3013 | EMACS_INT size; /* Size of translate table. */ | 3002 | ptrdiff_t size; /* Size of translate table. */ |
| 3014 | EMACS_INT pos, pos_byte, end_pos; | 3003 | ptrdiff_t pos, pos_byte, end_pos; |
| 3015 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3004 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3016 | int string_multibyte IF_LINT (= 0); | 3005 | int string_multibyte IF_LINT (= 0); |
| 3017 | 3006 | ||
| @@ -3289,7 +3278,7 @@ save_restriction_restore (Lisp_Object data) | |||
| 3289 | /* The restriction has changed from the saved one, so restore | 3278 | /* The restriction has changed from the saved one, so restore |
| 3290 | the saved restriction. */ | 3279 | the saved restriction. */ |
| 3291 | { | 3280 | { |
| 3292 | EMACS_INT pt = BUF_PT (buf); | 3281 | ptrdiff_t pt = BUF_PT (buf); |
| 3293 | 3282 | ||
| 3294 | SET_BUF_BEGV_BOTH (buf, beg->charpos, beg->bytepos); | 3283 | SET_BUF_BEGV_BOTH (buf, beg->charpos, beg->bytepos); |
| 3295 | SET_BUF_ZV_BOTH (buf, end->charpos, end->bytepos); | 3284 | SET_BUF_ZV_BOTH (buf, end->charpos, end->bytepos); |
| @@ -3347,7 +3336,7 @@ usage: (save-restriction &rest BODY) */) | |||
| 3347 | (Lisp_Object body) | 3336 | (Lisp_Object body) |
| 3348 | { | 3337 | { |
| 3349 | register Lisp_Object val; | 3338 | register Lisp_Object val; |
| 3350 | int count = SPECPDL_INDEX (); | 3339 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3351 | 3340 | ||
| 3352 | record_unwind_protect (save_restriction_restore, save_restriction_save ()); | 3341 | record_unwind_protect (save_restriction_restore, save_restriction_save ()); |
| 3353 | val = Fprogn (body); | 3342 | val = Fprogn (body); |
| @@ -3565,12 +3554,12 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3565 | ptrdiff_t n; /* The number of the next arg to substitute */ | 3554 | ptrdiff_t n; /* The number of the next arg to substitute */ |
| 3566 | char initial_buffer[4000]; | 3555 | char initial_buffer[4000]; |
| 3567 | char *buf = initial_buffer; | 3556 | char *buf = initial_buffer; |
| 3568 | EMACS_INT bufsize = sizeof initial_buffer; | 3557 | ptrdiff_t bufsize = sizeof initial_buffer; |
| 3569 | EMACS_INT max_bufsize = STRING_BYTES_BOUND + 1; | 3558 | ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1; |
| 3570 | char *p; | 3559 | char *p; |
| 3571 | Lisp_Object buf_save_value IF_LINT (= {0}); | 3560 | Lisp_Object buf_save_value IF_LINT (= {0}); |
| 3572 | register char *format, *end, *format_start; | 3561 | register char *format, *end, *format_start; |
| 3573 | EMACS_INT formatlen, nchars; | 3562 | ptrdiff_t formatlen, nchars; |
| 3574 | /* Nonzero if the format is multibyte. */ | 3563 | /* Nonzero if the format is multibyte. */ |
| 3575 | int multibyte_format = 0; | 3564 | int multibyte_format = 0; |
| 3576 | /* Nonzero if the output should be a multibyte string, | 3565 | /* Nonzero if the output should be a multibyte string, |
| @@ -3597,7 +3586,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3597 | info[0] is unused. Unused elements have -1 for start. */ | 3586 | info[0] is unused. Unused elements have -1 for start. */ |
| 3598 | struct info | 3587 | struct info |
| 3599 | { | 3588 | { |
| 3600 | EMACS_INT start, end; | 3589 | ptrdiff_t start, end; |
| 3601 | int converted_to_string; | 3590 | int converted_to_string; |
| 3602 | int intervals; | 3591 | int intervals; |
| 3603 | } *info = 0; | 3592 | } *info = 0; |
| @@ -3654,7 +3643,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3654 | char *format0 = format; | 3643 | char *format0 = format; |
| 3655 | 3644 | ||
| 3656 | /* Bytes needed to represent the output of this conversion. */ | 3645 | /* Bytes needed to represent the output of this conversion. */ |
| 3657 | EMACS_INT convbytes; | 3646 | ptrdiff_t convbytes; |
| 3658 | 3647 | ||
| 3659 | if (*format == '%') | 3648 | if (*format == '%') |
| 3660 | { | 3649 | { |
| @@ -3681,7 +3670,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3681 | int space_flag = 0; | 3670 | int space_flag = 0; |
| 3682 | int sharp_flag = 0; | 3671 | int sharp_flag = 0; |
| 3683 | int zero_flag = 0; | 3672 | int zero_flag = 0; |
| 3684 | EMACS_INT field_width; | 3673 | ptrdiff_t field_width; |
| 3685 | int precision_given; | 3674 | int precision_given; |
| 3686 | uintmax_t precision = UINTMAX_MAX; | 3675 | uintmax_t precision = UINTMAX_MAX; |
| 3687 | char *num_end; | 3676 | char *num_end; |
| @@ -3788,11 +3777,11 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3788 | { | 3777 | { |
| 3789 | /* handle case (precision[n] >= 0) */ | 3778 | /* handle case (precision[n] >= 0) */ |
| 3790 | 3779 | ||
| 3791 | EMACS_INT width, padding, nbytes; | 3780 | ptrdiff_t width, padding, nbytes; |
| 3792 | EMACS_INT nchars_string; | 3781 | ptrdiff_t nchars_string; |
| 3793 | 3782 | ||
| 3794 | EMACS_INT prec = -1; | 3783 | ptrdiff_t prec = -1; |
| 3795 | if (precision_given && precision <= TYPE_MAXIMUM (EMACS_INT)) | 3784 | if (precision_given && precision <= TYPE_MAXIMUM (ptrdiff_t)) |
| 3796 | prec = precision; | 3785 | prec = precision; |
| 3797 | 3786 | ||
| 3798 | /* lisp_string_width ignores a precision of 0, but GNU | 3787 | /* lisp_string_width ignores a precision of 0, but GNU |
| @@ -3805,7 +3794,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3805 | width = nchars_string = nbytes = 0; | 3794 | width = nchars_string = nbytes = 0; |
| 3806 | else | 3795 | else |
| 3807 | { | 3796 | { |
| 3808 | EMACS_INT nch, nby; | 3797 | ptrdiff_t nch, nby; |
| 3809 | width = lisp_string_width (args[n], prec, &nch, &nby); | 3798 | width = lisp_string_width (args[n], prec, &nch, &nby); |
| 3810 | if (prec < 0) | 3799 | if (prec < 0) |
| 3811 | { | 3800 | { |
| @@ -3902,7 +3891,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 3902 | verify (0 < USEFUL_PRECISION_MAX); | 3891 | verify (0 < USEFUL_PRECISION_MAX); |
| 3903 | 3892 | ||
| 3904 | int prec; | 3893 | int prec; |
| 3905 | EMACS_INT padding, sprintf_bytes; | 3894 | ptrdiff_t padding, sprintf_bytes; |
| 3906 | uintmax_t excess_precision, numwidth; | 3895 | uintmax_t excess_precision, numwidth; |
| 3907 | uintmax_t leading_zeros = 0, trailing_zeros = 0; | 3896 | uintmax_t leading_zeros = 0, trailing_zeros = 0; |
| 3908 | 3897 | ||
| @@ -4217,8 +4206,8 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 4217 | 4206 | ||
| 4218 | if (CONSP (props)) | 4207 | if (CONSP (props)) |
| 4219 | { | 4208 | { |
| 4220 | EMACS_INT bytepos = 0, position = 0, translated = 0; | 4209 | ptrdiff_t bytepos = 0, position = 0, translated = 0; |
| 4221 | EMACS_INT argn = 1; | 4210 | ptrdiff_t argn = 1; |
| 4222 | Lisp_Object list; | 4211 | Lisp_Object list; |
| 4223 | 4212 | ||
| 4224 | /* Adjust the bounds of each text property | 4213 | /* Adjust the bounds of each text property |
| @@ -4236,7 +4225,7 @@ usage: (format STRING &rest OBJECTS) */) | |||
| 4236 | for (list = props; CONSP (list); list = XCDR (list)) | 4225 | for (list = props; CONSP (list); list = XCDR (list)) |
| 4237 | { | 4226 | { |
| 4238 | Lisp_Object item; | 4227 | Lisp_Object item; |
| 4239 | EMACS_INT pos; | 4228 | ptrdiff_t pos; |
| 4240 | 4229 | ||
| 4241 | item = XCAR (list); | 4230 | item = XCAR (list); |
| 4242 | 4231 | ||
| @@ -4367,12 +4356,12 @@ Case is ignored if `case-fold-search' is non-nil in the current buffer. */) | |||
| 4367 | It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */ | 4356 | It's the caller's job to ensure that START1 <= END1 <= START2 <= END2. */ |
| 4368 | 4357 | ||
| 4369 | static void | 4358 | static void |
| 4370 | transpose_markers (EMACS_INT start1, EMACS_INT end1, | 4359 | transpose_markers (ptrdiff_t start1, ptrdiff_t end1, |
| 4371 | EMACS_INT start2, EMACS_INT end2, | 4360 | ptrdiff_t start2, ptrdiff_t end2, |
| 4372 | EMACS_INT start1_byte, EMACS_INT end1_byte, | 4361 | ptrdiff_t start1_byte, ptrdiff_t end1_byte, |
| 4373 | EMACS_INT start2_byte, EMACS_INT end2_byte) | 4362 | ptrdiff_t start2_byte, ptrdiff_t end2_byte) |
| 4374 | { | 4363 | { |
| 4375 | register EMACS_INT amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos; | 4364 | register ptrdiff_t amt1, amt1_byte, amt2, amt2_byte, diff, diff_byte, mpos; |
| 4376 | register struct Lisp_Marker *marker; | 4365 | register struct Lisp_Marker *marker; |
| 4377 | 4366 | ||
| 4378 | /* Update point as if it were a marker. */ | 4367 | /* Update point as if it were a marker. */ |
| @@ -4446,9 +4435,9 @@ any markers that happen to be located in the regions. | |||
| 4446 | Transposing beyond buffer boundaries is an error. */) | 4435 | Transposing beyond buffer boundaries is an error. */) |
| 4447 | (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers) | 4436 | (Lisp_Object startr1, Lisp_Object endr1, Lisp_Object startr2, Lisp_Object endr2, Lisp_Object leave_markers) |
| 4448 | { | 4437 | { |
| 4449 | register EMACS_INT start1, end1, start2, end2; | 4438 | register ptrdiff_t start1, end1, start2, end2; |
| 4450 | EMACS_INT start1_byte, start2_byte, len1_byte, len2_byte; | 4439 | ptrdiff_t start1_byte, start2_byte, len1_byte, len2_byte; |
| 4451 | EMACS_INT gap, len1, len_mid, len2; | 4440 | ptrdiff_t gap, len1, len_mid, len2; |
| 4452 | unsigned char *start1_addr, *start2_addr, *temp; | 4441 | unsigned char *start1_addr, *start2_addr, *temp; |
| 4453 | 4442 | ||
| 4454 | INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; | 4443 | INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; |
| @@ -4469,7 +4458,7 @@ Transposing beyond buffer boundaries is an error. */) | |||
| 4469 | /* Swap the regions if they're reversed. */ | 4458 | /* Swap the regions if they're reversed. */ |
| 4470 | if (start2 < end1) | 4459 | if (start2 < end1) |
| 4471 | { | 4460 | { |
| 4472 | register EMACS_INT glumph = start1; | 4461 | register ptrdiff_t glumph = start1; |
| 4473 | start1 = start2; | 4462 | start1 = start2; |
| 4474 | start2 = glumph; | 4463 | start2 = glumph; |
| 4475 | glumph = end1; | 4464 | glumph = end1; |
diff --git a/src/emacs.c b/src/emacs.c index 321e7919c93..d9b60b27129 100644 --- a/src/emacs.c +++ b/src/emacs.c | |||
| @@ -112,15 +112,15 @@ int gdb_use_union EXTERNALLY_VISIBLE = 0; | |||
| 112 | #else | 112 | #else |
| 113 | int gdb_use_union EXTERNALLY_VISIBLE = 1; | 113 | int gdb_use_union EXTERNALLY_VISIBLE = 1; |
| 114 | #endif | 114 | #endif |
| 115 | EMACS_INT gdb_valbits EXTERNALLY_VISIBLE = VALBITS; | 115 | int gdb_valbits EXTERNALLY_VISIBLE = VALBITS; |
| 116 | EMACS_INT gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; | 116 | int gdb_gctypebits EXTERNALLY_VISIBLE = GCTYPEBITS; |
| 117 | #if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) | 117 | #if defined (DATA_SEG_BITS) && ! defined (USE_LSB_TAG) |
| 118 | EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; | 118 | uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = DATA_SEG_BITS; |
| 119 | #else | 119 | #else |
| 120 | EMACS_INT gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; | 120 | uintptr_t gdb_data_seg_bits EXTERNALLY_VISIBLE = 0; |
| 121 | #endif | 121 | #endif |
| 122 | EMACS_INT PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG; | 122 | ptrdiff_t PVEC_FLAG EXTERNALLY_VISIBLE = PSEUDOVECTOR_FLAG; |
| 123 | EMACS_INT gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG; | 123 | ptrdiff_t gdb_array_mark_flag EXTERNALLY_VISIBLE = ARRAY_MARK_FLAG; |
| 124 | /* GDB might say "No enum type named pvec_type" if we don't have at | 124 | /* GDB might say "No enum type named pvec_type" if we don't have at |
| 125 | least one symbol with that type, and then xbacktrace could fail. */ | 125 | least one symbol with that type, and then xbacktrace could fail. */ |
| 126 | enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; | 126 | enum pvec_type gdb_pvec_type EXTERNALLY_VISIBLE = PVEC_TYPE_MASK; |
| @@ -397,7 +397,7 @@ init_cmdargs (int argc, char **argv, int skip_args) | |||
| 397 | { | 397 | { |
| 398 | register int i; | 398 | register int i; |
| 399 | Lisp_Object name, dir, handler; | 399 | Lisp_Object name, dir, handler; |
| 400 | int count = SPECPDL_INDEX (); | 400 | ptrdiff_t count = SPECPDL_INDEX (); |
| 401 | Lisp_Object raw_name; | 401 | Lisp_Object raw_name; |
| 402 | 402 | ||
| 403 | initial_argv = argv; | 403 | initial_argv = argv; |
| @@ -1993,6 +1993,7 @@ all of which are called before Emacs is actually killed. */) | |||
| 1993 | { | 1993 | { |
| 1994 | struct gcpro gcpro1; | 1994 | struct gcpro gcpro1; |
| 1995 | Lisp_Object hook; | 1995 | Lisp_Object hook; |
| 1996 | int status; | ||
| 1996 | 1997 | ||
| 1997 | GCPRO1 (arg); | 1998 | GCPRO1 (arg); |
| 1998 | 1999 | ||
| @@ -2017,7 +2018,13 @@ all of which are called before Emacs is actually killed. */) | |||
| 2017 | if (STRINGP (Vauto_save_list_file_name)) | 2018 | if (STRINGP (Vauto_save_list_file_name)) |
| 2018 | unlink (SSDATA (Vauto_save_list_file_name)); | 2019 | unlink (SSDATA (Vauto_save_list_file_name)); |
| 2019 | 2020 | ||
| 2020 | exit (INTEGERP (arg) ? XINT (arg) : EXIT_SUCCESS); | 2021 | if (! INTEGERP (arg)) |
| 2022 | status = EXIT_SUCCESS; | ||
| 2023 | else if (XINT (arg) < 0) | ||
| 2024 | status = XINT (arg) | INT_MIN; | ||
| 2025 | else | ||
| 2026 | status = XINT (arg) & INT_MAX; | ||
| 2027 | exit (status); | ||
| 2021 | } | 2028 | } |
| 2022 | 2029 | ||
| 2023 | 2030 | ||
| @@ -2127,7 +2134,7 @@ You must run Emacs in batch mode in order to dump it. */) | |||
| 2127 | { | 2134 | { |
| 2128 | Lisp_Object tem; | 2135 | Lisp_Object tem; |
| 2129 | Lisp_Object symbol; | 2136 | Lisp_Object symbol; |
| 2130 | int count = SPECPDL_INDEX (); | 2137 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2131 | 2138 | ||
| 2132 | check_pure_size (); | 2139 | check_pure_size (); |
| 2133 | 2140 | ||
diff --git a/src/eval.c b/src/eval.c index 32b9d366fc3..5fa9a945ef5 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -90,7 +90,7 @@ Lisp_Object Vautoload_queue; | |||
| 90 | 90 | ||
| 91 | /* Current number of specbindings allocated in specpdl. */ | 91 | /* Current number of specbindings allocated in specpdl. */ |
| 92 | 92 | ||
| 93 | EMACS_INT specpdl_size; | 93 | ptrdiff_t specpdl_size; |
| 94 | 94 | ||
| 95 | /* Pointer to beginning of specpdl. */ | 95 | /* Pointer to beginning of specpdl. */ |
| 96 | 96 | ||
| @@ -111,7 +111,7 @@ static EMACS_INT lisp_eval_depth; | |||
| 111 | signal the error instead of entering an infinite loop of debugger | 111 | signal the error instead of entering an infinite loop of debugger |
| 112 | invocations. */ | 112 | invocations. */ |
| 113 | 113 | ||
| 114 | static int when_entered_debugger; | 114 | static EMACS_INT when_entered_debugger; |
| 115 | 115 | ||
| 116 | /* The function from which the last `signal' was called. Set in | 116 | /* The function from which the last `signal' was called. Set in |
| 117 | Fsignal. */ | 117 | Fsignal. */ |
| @@ -177,7 +177,7 @@ static Lisp_Object | |||
| 177 | call_debugger (Lisp_Object arg) | 177 | call_debugger (Lisp_Object arg) |
| 178 | { | 178 | { |
| 179 | int debug_while_redisplaying; | 179 | int debug_while_redisplaying; |
| 180 | int count = SPECPDL_INDEX (); | 180 | ptrdiff_t count = SPECPDL_INDEX (); |
| 181 | Lisp_Object val; | 181 | Lisp_Object val; |
| 182 | EMACS_INT old_max = max_specpdl_size; | 182 | EMACS_INT old_max = max_specpdl_size; |
| 183 | 183 | ||
| @@ -758,8 +758,8 @@ The return value is BASE-VARIABLE. */) | |||
| 758 | { | 758 | { |
| 759 | struct specbinding *p; | 759 | struct specbinding *p; |
| 760 | 760 | ||
| 761 | for (p = specpdl_ptr - 1; p >= specpdl; p--) | 761 | for (p = specpdl_ptr; p > specpdl; p) |
| 762 | if (p->func == NULL | 762 | if ((--p)->func == NULL |
| 763 | && (EQ (new_alias, | 763 | && (EQ (new_alias, |
| 764 | CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol))) | 764 | CONSP (p->symbol) ? XCAR (p->symbol) : p->symbol))) |
| 765 | error ("Don't know how to make a let-bound variable an alias"); | 765 | error ("Don't know how to make a let-bound variable an alias"); |
| @@ -833,9 +833,9 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 833 | { /* Check if there is really a global binding rather than just a let | 833 | { /* Check if there is really a global binding rather than just a let |
| 834 | binding that shadows the global unboundness of the var. */ | 834 | binding that shadows the global unboundness of the var. */ |
| 835 | volatile struct specbinding *pdl = specpdl_ptr; | 835 | volatile struct specbinding *pdl = specpdl_ptr; |
| 836 | while (--pdl >= specpdl) | 836 | while (pdl > specpdl) |
| 837 | { | 837 | { |
| 838 | if (EQ (pdl->symbol, sym) && !pdl->func | 838 | if (EQ ((--pdl)->symbol, sym) && !pdl->func |
| 839 | && EQ (pdl->old_value, Qunbound)) | 839 | && EQ (pdl->old_value, Qunbound)) |
| 840 | { | 840 | { |
| 841 | message_with_string ("Warning: defvar ignored because %s is let-bound", | 841 | message_with_string ("Warning: defvar ignored because %s is let-bound", |
| @@ -983,7 +983,7 @@ usage: (let* VARLIST BODY...) */) | |||
| 983 | (Lisp_Object args) | 983 | (Lisp_Object args) |
| 984 | { | 984 | { |
| 985 | Lisp_Object varlist, var, val, elt, lexenv; | 985 | Lisp_Object varlist, var, val, elt, lexenv; |
| 986 | int count = SPECPDL_INDEX (); | 986 | ptrdiff_t count = SPECPDL_INDEX (); |
| 987 | struct gcpro gcpro1, gcpro2, gcpro3; | 987 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 988 | 988 | ||
| 989 | GCPRO3 (args, elt, varlist); | 989 | GCPRO3 (args, elt, varlist); |
| @@ -1046,7 +1046,7 @@ usage: (let VARLIST BODY...) */) | |||
| 1046 | { | 1046 | { |
| 1047 | Lisp_Object *temps, tem, lexenv; | 1047 | Lisp_Object *temps, tem, lexenv; |
| 1048 | register Lisp_Object elt, varlist; | 1048 | register Lisp_Object elt, varlist; |
| 1049 | int count = SPECPDL_INDEX (); | 1049 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1050 | ptrdiff_t argnum; | 1050 | ptrdiff_t argnum; |
| 1051 | struct gcpro gcpro1, gcpro2; | 1051 | struct gcpro gcpro1, gcpro2; |
| 1052 | USE_SAFE_ALLOCA; | 1052 | USE_SAFE_ALLOCA; |
| @@ -1349,7 +1349,7 @@ usage: (unwind-protect BODYFORM UNWINDFORMS...) */) | |||
| 1349 | (Lisp_Object args) | 1349 | (Lisp_Object args) |
| 1350 | { | 1350 | { |
| 1351 | Lisp_Object val; | 1351 | Lisp_Object val; |
| 1352 | int count = SPECPDL_INDEX (); | 1352 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1353 | 1353 | ||
| 1354 | record_unwind_protect (Fprogn, Fcdr (args)); | 1354 | record_unwind_protect (Fprogn, Fcdr (args)); |
| 1355 | val = eval_sub (Fcar (args)); | 1355 | val = eval_sub (Fcar (args)); |
| @@ -2123,7 +2123,7 @@ un_autoload (Lisp_Object oldqueue) | |||
| 2123 | void | 2123 | void |
| 2124 | do_autoload (Lisp_Object fundef, Lisp_Object funname) | 2124 | do_autoload (Lisp_Object fundef, Lisp_Object funname) |
| 2125 | { | 2125 | { |
| 2126 | int count = SPECPDL_INDEX (); | 2126 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2127 | Lisp_Object fun; | 2127 | Lisp_Object fun; |
| 2128 | struct gcpro gcpro1, gcpro2, gcpro3; | 2128 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 2129 | 2129 | ||
| @@ -2170,7 +2170,7 @@ DEFUN ("eval", Feval, Seval, 1, 2, 0, | |||
| 2170 | If LEXICAL is t, evaluate using lexical scoping. */) | 2170 | If LEXICAL is t, evaluate using lexical scoping. */) |
| 2171 | (Lisp_Object form, Lisp_Object lexical) | 2171 | (Lisp_Object form, Lisp_Object lexical) |
| 2172 | { | 2172 | { |
| 2173 | int count = SPECPDL_INDEX (); | 2173 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2174 | specbind (Qinternal_interpreter_environment, | 2174 | specbind (Qinternal_interpreter_environment, |
| 2175 | NILP (lexical) ? Qnil : Fcons (Qt, Qnil)); | 2175 | NILP (lexical) ? Qnil : Fcons (Qt, Qnil)); |
| 2176 | return unbind_to (count, eval_sub (form)); | 2176 | return unbind_to (count, eval_sub (form)); |
| @@ -2404,7 +2404,8 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10. | |||
| 2404 | usage: (apply FUNCTION &rest ARGUMENTS) */) | 2404 | usage: (apply FUNCTION &rest ARGUMENTS) */) |
| 2405 | (ptrdiff_t nargs, Lisp_Object *args) | 2405 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2406 | { | 2406 | { |
| 2407 | ptrdiff_t i, numargs; | 2407 | ptrdiff_t i; |
| 2408 | EMACS_INT numargs; | ||
| 2408 | register Lisp_Object spread_arg; | 2409 | register Lisp_Object spread_arg; |
| 2409 | register Lisp_Object *funcall_args; | 2410 | register Lisp_Object *funcall_args; |
| 2410 | Lisp_Object fun, retval; | 2411 | Lisp_Object fun, retval; |
| @@ -3054,7 +3055,8 @@ static Lisp_Object | |||
| 3054 | apply_lambda (Lisp_Object fun, Lisp_Object args) | 3055 | apply_lambda (Lisp_Object fun, Lisp_Object args) |
| 3055 | { | 3056 | { |
| 3056 | Lisp_Object args_left; | 3057 | Lisp_Object args_left; |
| 3057 | ptrdiff_t i, numargs; | 3058 | ptrdiff_t i; |
| 3059 | EMACS_INT numargs; | ||
| 3058 | register Lisp_Object *arg_vector; | 3060 | register Lisp_Object *arg_vector; |
| 3059 | struct gcpro gcpro1, gcpro2, gcpro3; | 3061 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 3060 | register Lisp_Object tem; | 3062 | register Lisp_Object tem; |
| @@ -3099,7 +3101,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, | |||
| 3099 | register Lisp_Object *arg_vector) | 3101 | register Lisp_Object *arg_vector) |
| 3100 | { | 3102 | { |
| 3101 | Lisp_Object val, syms_left, next, lexenv; | 3103 | Lisp_Object val, syms_left, next, lexenv; |
| 3102 | int count = SPECPDL_INDEX (); | 3104 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3103 | ptrdiff_t i; | 3105 | ptrdiff_t i; |
| 3104 | int optional, rest; | 3106 | int optional, rest; |
| 3105 | 3107 | ||
| @@ -3238,12 +3240,8 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode, | |||
| 3238 | static void | 3240 | static void |
| 3239 | grow_specpdl (void) | 3241 | grow_specpdl (void) |
| 3240 | { | 3242 | { |
| 3241 | register int count = SPECPDL_INDEX (); | 3243 | register ptrdiff_t count = SPECPDL_INDEX (); |
| 3242 | int max_size = | 3244 | ptrdiff_t max_size = min (max_specpdl_size, PTRDIFF_MAX); |
| 3243 | min (max_specpdl_size, | ||
| 3244 | min (max (PTRDIFF_MAX, SIZE_MAX) / sizeof (struct specbinding), | ||
| 3245 | INT_MAX)); | ||
| 3246 | int size; | ||
| 3247 | if (max_size <= specpdl_size) | 3245 | if (max_size <= specpdl_size) |
| 3248 | { | 3246 | { |
| 3249 | if (max_specpdl_size < 400) | 3247 | if (max_specpdl_size < 400) |
| @@ -3251,9 +3249,7 @@ grow_specpdl (void) | |||
| 3251 | if (max_size <= specpdl_size) | 3249 | if (max_size <= specpdl_size) |
| 3252 | signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); | 3250 | signal_error ("Variable binding depth exceeds max-specpdl-size", Qnil); |
| 3253 | } | 3251 | } |
| 3254 | size = specpdl_size < max_size / 2 ? 2 * specpdl_size : max_size; | 3252 | specpdl = xpalloc (specpdl, &specpdl_size, 1, max_size, sizeof *specpdl); |
| 3255 | specpdl = xnrealloc (specpdl, size, sizeof *specpdl); | ||
| 3256 | specpdl_size = size; | ||
| 3257 | specpdl_ptr = specpdl + count; | 3253 | specpdl_ptr = specpdl + count; |
| 3258 | } | 3254 | } |
| 3259 | 3255 | ||
| @@ -3383,7 +3379,7 @@ record_unwind_protect (Lisp_Object (*function) (Lisp_Object), Lisp_Object arg) | |||
| 3383 | } | 3379 | } |
| 3384 | 3380 | ||
| 3385 | Lisp_Object | 3381 | Lisp_Object |
| 3386 | unbind_to (int count, Lisp_Object value) | 3382 | unbind_to (ptrdiff_t count, Lisp_Object value) |
| 3387 | { | 3383 | { |
| 3388 | Lisp_Object quitf = Vquit_flag; | 3384 | Lisp_Object quitf = Vquit_flag; |
| 3389 | struct gcpro gcpro1, gcpro2; | 3385 | struct gcpro gcpro1, gcpro2; |
| @@ -3463,7 +3459,7 @@ The debugger is entered when that frame exits, if the flag is non-nil. */) | |||
| 3463 | (Lisp_Object level, Lisp_Object flag) | 3459 | (Lisp_Object level, Lisp_Object flag) |
| 3464 | { | 3460 | { |
| 3465 | register struct backtrace *backlist = backtrace_list; | 3461 | register struct backtrace *backlist = backtrace_list; |
| 3466 | register int i; | 3462 | register EMACS_INT i; |
| 3467 | 3463 | ||
| 3468 | CHECK_NUMBER (level); | 3464 | CHECK_NUMBER (level); |
| 3469 | 3465 | ||
diff --git a/src/fileio.c b/src/fileio.c index 08be41f9fe4..486c3d4c175 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -145,9 +145,9 @@ Lisp_Object Qfile_name_history; | |||
| 145 | static Lisp_Object Qcar_less_than_car; | 145 | static Lisp_Object Qcar_less_than_car; |
| 146 | 146 | ||
| 147 | static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object); | 147 | static Lisp_Object Fmake_symbolic_link (Lisp_Object, Lisp_Object, Lisp_Object); |
| 148 | static int a_write (int, Lisp_Object, EMACS_INT, EMACS_INT, | 148 | static int a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 149 | Lisp_Object *, struct coding_system *); | 149 | Lisp_Object *, struct coding_system *); |
| 150 | static int e_write (int, Lisp_Object, EMACS_INT, EMACS_INT, | 150 | static int e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 151 | struct coding_system *); | 151 | struct coding_system *); |
| 152 | 152 | ||
| 153 | 153 | ||
| @@ -257,7 +257,7 @@ use the standard functions without calling themselves recursively. */) | |||
| 257 | { | 257 | { |
| 258 | /* This function must not munge the match data. */ | 258 | /* This function must not munge the match data. */ |
| 259 | Lisp_Object chain, inhibited_handlers, result; | 259 | Lisp_Object chain, inhibited_handlers, result; |
| 260 | int pos = -1; | 260 | ptrdiff_t pos = -1; |
| 261 | 261 | ||
| 262 | result = Qnil; | 262 | result = Qnil; |
| 263 | CHECK_STRING (filename); | 263 | CHECK_STRING (filename); |
| @@ -275,7 +275,7 @@ use the standard functions without calling themselves recursively. */) | |||
| 275 | if (CONSP (elt)) | 275 | if (CONSP (elt)) |
| 276 | { | 276 | { |
| 277 | Lisp_Object string = XCAR (elt); | 277 | Lisp_Object string = XCAR (elt); |
| 278 | EMACS_INT match_pos; | 278 | ptrdiff_t match_pos; |
| 279 | Lisp_Object handler = XCDR (elt); | 279 | Lisp_Object handler = XCDR (elt); |
| 280 | Lisp_Object operations = Qnil; | 280 | Lisp_Object operations = Qnil; |
| 281 | 281 | ||
| @@ -1813,12 +1813,12 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) | |||
| 1813 | (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) | 1813 | (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) |
| 1814 | { | 1814 | { |
| 1815 | int ifd, ofd; | 1815 | int ifd, ofd; |
| 1816 | EMACS_INT n; | 1816 | int n; |
| 1817 | char buf[16 * 1024]; | 1817 | char buf[16 * 1024]; |
| 1818 | struct stat st, out_st; | 1818 | struct stat st, out_st; |
| 1819 | Lisp_Object handler; | 1819 | Lisp_Object handler; |
| 1820 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1820 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 1821 | int count = SPECPDL_INDEX (); | 1821 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1822 | int input_file_statable_p; | 1822 | int input_file_statable_p; |
| 1823 | Lisp_Object encoded_file, encoded_newname; | 1823 | Lisp_Object encoded_file, encoded_newname; |
| 1824 | #if HAVE_LIBSELINUX | 1824 | #if HAVE_LIBSELINUX |
| @@ -2210,7 +2210,7 @@ This is what happens in interactive use with M-x. */) | |||
| 2210 | { | 2210 | { |
| 2211 | if (errno == EXDEV) | 2211 | if (errno == EXDEV) |
| 2212 | { | 2212 | { |
| 2213 | int count; | 2213 | ptrdiff_t count; |
| 2214 | symlink_target = Ffile_symlink_p (file); | 2214 | symlink_target = Ffile_symlink_p (file); |
| 2215 | if (! NILP (symlink_target)) | 2215 | if (! NILP (symlink_target)) |
| 2216 | Fmake_symbolic_link (symlink_target, newname, | 2216 | Fmake_symbolic_link (symlink_target, newname, |
| @@ -3055,6 +3055,8 @@ otherwise, if FILE2 does not exist, the answer is t. */) | |||
| 3055 | #ifndef READ_BUF_SIZE | 3055 | #ifndef READ_BUF_SIZE |
| 3056 | #define READ_BUF_SIZE (64 << 10) | 3056 | #define READ_BUF_SIZE (64 << 10) |
| 3057 | #endif | 3057 | #endif |
| 3058 | /* Some buffer offsets are stored in 'int' variables. */ | ||
| 3059 | verify (READ_BUF_SIZE <= INT_MAX); | ||
| 3058 | 3060 | ||
| 3059 | /* This function is called after Lisp functions to decide a coding | 3061 | /* This function is called after Lisp functions to decide a coding |
| 3060 | system are called, or when they cause an error. Before they are | 3062 | system are called, or when they cause an error. Before they are |
| @@ -3099,8 +3101,8 @@ decide_coding_unwind (Lisp_Object unwind_data) | |||
| 3099 | /* Used to pass values from insert-file-contents to read_non_regular. */ | 3101 | /* Used to pass values from insert-file-contents to read_non_regular. */ |
| 3100 | 3102 | ||
| 3101 | static int non_regular_fd; | 3103 | static int non_regular_fd; |
| 3102 | static EMACS_INT non_regular_inserted; | 3104 | static ptrdiff_t non_regular_inserted; |
| 3103 | static EMACS_INT non_regular_nbytes; | 3105 | static int non_regular_nbytes; |
| 3104 | 3106 | ||
| 3105 | 3107 | ||
| 3106 | /* Read from a non-regular file. | 3108 | /* Read from a non-regular file. |
| @@ -3111,7 +3113,7 @@ static EMACS_INT non_regular_nbytes; | |||
| 3111 | static Lisp_Object | 3113 | static Lisp_Object |
| 3112 | read_non_regular (Lisp_Object ignore) | 3114 | read_non_regular (Lisp_Object ignore) |
| 3113 | { | 3115 | { |
| 3114 | EMACS_INT nbytes; | 3116 | int nbytes; |
| 3115 | 3117 | ||
| 3116 | immediate_quit = 1; | 3118 | immediate_quit = 1; |
| 3117 | QUIT; | 3119 | QUIT; |
| @@ -3176,16 +3178,16 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3176 | { | 3178 | { |
| 3177 | struct stat st; | 3179 | struct stat st; |
| 3178 | register int fd; | 3180 | register int fd; |
| 3179 | EMACS_INT inserted = 0; | 3181 | ptrdiff_t inserted = 0; |
| 3180 | int nochange = 0; | 3182 | int nochange = 0; |
| 3181 | register EMACS_INT how_much; | 3183 | register ptrdiff_t how_much; |
| 3182 | off_t beg_offset, end_offset; | 3184 | off_t beg_offset, end_offset; |
| 3183 | register EMACS_INT unprocessed; | 3185 | register int unprocessed; |
| 3184 | int count = SPECPDL_INDEX (); | 3186 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3185 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 3187 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 3186 | Lisp_Object handler, val, insval, orig_filename, old_undo; | 3188 | Lisp_Object handler, val, insval, orig_filename, old_undo; |
| 3187 | Lisp_Object p; | 3189 | Lisp_Object p; |
| 3188 | EMACS_INT total = 0; | 3190 | ptrdiff_t total = 0; |
| 3189 | int not_regular = 0; | 3191 | int not_regular = 0; |
| 3190 | char read_buf[READ_BUF_SIZE]; | 3192 | char read_buf[READ_BUF_SIZE]; |
| 3191 | struct coding_system coding; | 3193 | struct coding_system coding; |
| @@ -3225,7 +3227,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3225 | { | 3227 | { |
| 3226 | val = call6 (handler, Qinsert_file_contents, filename, | 3228 | val = call6 (handler, Qinsert_file_contents, filename, |
| 3227 | visit, beg, end, replace); | 3229 | visit, beg, end, replace); |
| 3228 | if (CONSP (val) && CONSP (XCDR (val))) | 3230 | if (CONSP (val) && CONSP (XCDR (val)) |
| 3231 | && RANGED_INTEGERP (0, XCAR (XCDR (val)), ZV - PT)) | ||
| 3229 | inserted = XINT (XCAR (XCDR (val))); | 3232 | inserted = XINT (XCAR (XCDR (val))); |
| 3230 | goto handled; | 3233 | goto handled; |
| 3231 | } | 3234 | } |
| @@ -3378,7 +3381,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3378 | We assume that the 1K-byte and 3K-byte for heading | 3381 | We assume that the 1K-byte and 3K-byte for heading |
| 3379 | and tailing respectively are sufficient for this | 3382 | and tailing respectively are sufficient for this |
| 3380 | purpose. */ | 3383 | purpose. */ |
| 3381 | EMACS_INT nread; | 3384 | int nread; |
| 3382 | 3385 | ||
| 3383 | if (st.st_size <= (1024 * 4)) | 3386 | if (st.st_size <= (1024 * 4)) |
| 3384 | nread = emacs_read (fd, read_buf, 1024 * 4); | 3387 | nread = emacs_read (fd, read_buf, 1024 * 4); |
| @@ -3488,9 +3491,9 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3488 | /* same_at_start and same_at_end count bytes, | 3491 | /* same_at_start and same_at_end count bytes, |
| 3489 | because file access counts bytes | 3492 | because file access counts bytes |
| 3490 | and BEG and END count bytes. */ | 3493 | and BEG and END count bytes. */ |
| 3491 | EMACS_INT same_at_start = BEGV_BYTE; | 3494 | ptrdiff_t same_at_start = BEGV_BYTE; |
| 3492 | EMACS_INT same_at_end = ZV_BYTE; | 3495 | ptrdiff_t same_at_end = ZV_BYTE; |
| 3493 | EMACS_INT overlap; | 3496 | ptrdiff_t overlap; |
| 3494 | /* There is still a possibility we will find the need to do code | 3497 | /* There is still a possibility we will find the need to do code |
| 3495 | conversion. If that happens, we set this variable to 1 to | 3498 | conversion. If that happens, we set this variable to 1 to |
| 3496 | give up on handling REPLACE in the optimized way. */ | 3499 | give up on handling REPLACE in the optimized way. */ |
| @@ -3509,7 +3512,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3509 | match the text at the beginning of the buffer. */ | 3512 | match the text at the beginning of the buffer. */ |
| 3510 | while (1) | 3513 | while (1) |
| 3511 | { | 3514 | { |
| 3512 | EMACS_INT nread, bufpos; | 3515 | int nread, bufpos; |
| 3513 | 3516 | ||
| 3514 | nread = emacs_read (fd, buffer, sizeof buffer); | 3517 | nread = emacs_read (fd, buffer, sizeof buffer); |
| 3515 | if (nread < 0) | 3518 | if (nread < 0) |
| @@ -3618,7 +3621,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3618 | 3621 | ||
| 3619 | if (! giveup_match_end) | 3622 | if (! giveup_match_end) |
| 3620 | { | 3623 | { |
| 3621 | EMACS_INT temp; | 3624 | ptrdiff_t temp; |
| 3622 | 3625 | ||
| 3623 | /* We win! We can handle REPLACE the optimized way. */ | 3626 | /* We win! We can handle REPLACE the optimized way. */ |
| 3624 | 3627 | ||
| @@ -3672,16 +3675,16 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3672 | in a more optimized way. */ | 3675 | in a more optimized way. */ |
| 3673 | if (!NILP (replace) && ! replace_handled && BEGV < ZV) | 3676 | if (!NILP (replace) && ! replace_handled && BEGV < ZV) |
| 3674 | { | 3677 | { |
| 3675 | EMACS_INT same_at_start = BEGV_BYTE; | 3678 | ptrdiff_t same_at_start = BEGV_BYTE; |
| 3676 | EMACS_INT same_at_end = ZV_BYTE; | 3679 | ptrdiff_t same_at_end = ZV_BYTE; |
| 3677 | EMACS_INT same_at_start_charpos; | 3680 | ptrdiff_t same_at_start_charpos; |
| 3678 | EMACS_INT inserted_chars; | 3681 | ptrdiff_t inserted_chars; |
| 3679 | EMACS_INT overlap; | 3682 | ptrdiff_t overlap; |
| 3680 | EMACS_INT bufpos; | 3683 | ptrdiff_t bufpos; |
| 3681 | unsigned char *decoded; | 3684 | unsigned char *decoded; |
| 3682 | EMACS_INT temp; | 3685 | ptrdiff_t temp; |
| 3683 | EMACS_INT this = 0; | 3686 | ptrdiff_t this = 0; |
| 3684 | int this_count = SPECPDL_INDEX (); | 3687 | ptrdiff_t this_count = SPECPDL_INDEX (); |
| 3685 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3688 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3686 | Lisp_Object conversion_buffer; | 3689 | Lisp_Object conversion_buffer; |
| 3687 | 3690 | ||
| @@ -3705,8 +3708,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3705 | /* We read one bunch by one (READ_BUF_SIZE bytes) to allow | 3708 | /* We read one bunch by one (READ_BUF_SIZE bytes) to allow |
| 3706 | quitting while reading a huge while. */ | 3709 | quitting while reading a huge while. */ |
| 3707 | /* try is reserved in some compilers (Microsoft C) */ | 3710 | /* try is reserved in some compilers (Microsoft C) */ |
| 3708 | EMACS_INT trytry = min (total - how_much, | 3711 | int trytry = min (total - how_much, READ_BUF_SIZE - unprocessed); |
| 3709 | READ_BUF_SIZE - unprocessed); | ||
| 3710 | 3712 | ||
| 3711 | /* Allow quitting out of the actual I/O. */ | 3713 | /* Allow quitting out of the actual I/O. */ |
| 3712 | immediate_quit = 1; | 3714 | immediate_quit = 1; |
| @@ -3897,13 +3899,13 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3897 | /* Here, we don't do code conversion in the loop. It is done by | 3899 | /* Here, we don't do code conversion in the loop. It is done by |
| 3898 | decode_coding_gap after all data are read into the buffer. */ | 3900 | decode_coding_gap after all data are read into the buffer. */ |
| 3899 | { | 3901 | { |
| 3900 | EMACS_INT gap_size = GAP_SIZE; | 3902 | ptrdiff_t gap_size = GAP_SIZE; |
| 3901 | 3903 | ||
| 3902 | while (how_much < total) | 3904 | while (how_much < total) |
| 3903 | { | 3905 | { |
| 3904 | /* try is reserved in some compilers (Microsoft C) */ | 3906 | /* try is reserved in some compilers (Microsoft C) */ |
| 3905 | EMACS_INT trytry = min (total - how_much, READ_BUF_SIZE); | 3907 | int trytry = min (total - how_much, READ_BUF_SIZE); |
| 3906 | EMACS_INT this; | 3908 | ptrdiff_t this; |
| 3907 | 3909 | ||
| 3908 | if (not_regular) | 3910 | if (not_regular) |
| 3909 | { | 3911 | { |
| @@ -4022,7 +4024,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4022 | care of marker adjustment. By this way, we can run Lisp | 4024 | care of marker adjustment. By this way, we can run Lisp |
| 4023 | program safely before decoding the inserted text. */ | 4025 | program safely before decoding the inserted text. */ |
| 4024 | Lisp_Object unwind_data; | 4026 | Lisp_Object unwind_data; |
| 4025 | int count1 = SPECPDL_INDEX (); | 4027 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 4026 | 4028 | ||
| 4027 | unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), | 4029 | unwind_data = Fcons (BVAR (current_buffer, enable_multibyte_characters), |
| 4028 | Fcons (BVAR (current_buffer, undo_list), | 4030 | Fcons (BVAR (current_buffer, undo_list), |
| @@ -4143,7 +4145,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4143 | visit); | 4145 | visit); |
| 4144 | if (! NILP (insval)) | 4146 | if (! NILP (insval)) |
| 4145 | { | 4147 | { |
| 4146 | CHECK_NUMBER (insval); | 4148 | if (! RANGED_INTEGERP (0, insval, ZV - PT)) |
| 4149 | wrong_type_argument (intern ("inserted-chars"), insval); | ||
| 4147 | inserted = XFASTINT (insval); | 4150 | inserted = XFASTINT (insval); |
| 4148 | } | 4151 | } |
| 4149 | } | 4152 | } |
| @@ -4152,8 +4155,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4152 | if (inserted > 0) | 4155 | if (inserted > 0) |
| 4153 | { | 4156 | { |
| 4154 | /* Don't run point motion or modification hooks when decoding. */ | 4157 | /* Don't run point motion or modification hooks when decoding. */ |
| 4155 | int count1 = SPECPDL_INDEX (); | 4158 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 4156 | EMACS_INT old_inserted = inserted; | 4159 | ptrdiff_t old_inserted = inserted; |
| 4157 | specbind (Qinhibit_point_motion_hooks, Qt); | 4160 | specbind (Qinhibit_point_motion_hooks, Qt); |
| 4158 | specbind (Qinhibit_modification_hooks, Qt); | 4161 | specbind (Qinhibit_modification_hooks, Qt); |
| 4159 | 4162 | ||
| @@ -4165,7 +4168,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4165 | { | 4168 | { |
| 4166 | insval = call3 (Qformat_decode, | 4169 | insval = call3 (Qformat_decode, |
| 4167 | Qnil, make_number (inserted), visit); | 4170 | Qnil, make_number (inserted), visit); |
| 4168 | CHECK_NUMBER (insval); | 4171 | if (! RANGED_INTEGERP (0, insval, ZV - PT)) |
| 4172 | wrong_type_argument (intern ("inserted-chars"), insval); | ||
| 4169 | inserted = XFASTINT (insval); | 4173 | inserted = XFASTINT (insval); |
| 4170 | } | 4174 | } |
| 4171 | else | 4175 | else |
| @@ -4179,15 +4183,16 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4179 | Hence we temporarily save `point' and `inserted' here and | 4183 | Hence we temporarily save `point' and `inserted' here and |
| 4180 | restore `point' iff format-decode did not insert or delete | 4184 | restore `point' iff format-decode did not insert or delete |
| 4181 | any text. Otherwise we leave `point' at point-min. */ | 4185 | any text. Otherwise we leave `point' at point-min. */ |
| 4182 | EMACS_INT opoint = PT; | 4186 | ptrdiff_t opoint = PT; |
| 4183 | EMACS_INT opoint_byte = PT_BYTE; | 4187 | ptrdiff_t opoint_byte = PT_BYTE; |
| 4184 | EMACS_INT oinserted = ZV - BEGV; | 4188 | ptrdiff_t oinserted = ZV - BEGV; |
| 4185 | int ochars_modiff = CHARS_MODIFF; | 4189 | EMACS_INT ochars_modiff = CHARS_MODIFF; |
| 4186 | 4190 | ||
| 4187 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4191 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| 4188 | insval = call3 (Qformat_decode, | 4192 | insval = call3 (Qformat_decode, |
| 4189 | Qnil, make_number (oinserted), visit); | 4193 | Qnil, make_number (oinserted), visit); |
| 4190 | CHECK_NUMBER (insval); | 4194 | if (! RANGED_INTEGERP (0, insval, ZV - PT)) |
| 4195 | wrong_type_argument (intern ("inserted-chars"), insval); | ||
| 4191 | if (ochars_modiff == CHARS_MODIFF) | 4196 | if (ochars_modiff == CHARS_MODIFF) |
| 4192 | /* format_decode didn't modify buffer's characters => move | 4197 | /* format_decode didn't modify buffer's characters => move |
| 4193 | point back to position before inserted text and leave | 4198 | point back to position before inserted text and leave |
| @@ -4209,7 +4214,8 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4209 | insval = call1 (XCAR (p), make_number (inserted)); | 4214 | insval = call1 (XCAR (p), make_number (inserted)); |
| 4210 | if (!NILP (insval)) | 4215 | if (!NILP (insval)) |
| 4211 | { | 4216 | { |
| 4212 | CHECK_NUMBER (insval); | 4217 | if (! RANGED_INTEGERP (0, insval, ZV - PT)) |
| 4218 | wrong_type_argument (intern ("inserted-chars"), insval); | ||
| 4213 | inserted = XFASTINT (insval); | 4219 | inserted = XFASTINT (insval); |
| 4214 | } | 4220 | } |
| 4215 | } | 4221 | } |
| @@ -4217,16 +4223,17 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4217 | { | 4223 | { |
| 4218 | /* For the rationale of this see the comment on | 4224 | /* For the rationale of this see the comment on |
| 4219 | format-decode above. */ | 4225 | format-decode above. */ |
| 4220 | EMACS_INT opoint = PT; | 4226 | ptrdiff_t opoint = PT; |
| 4221 | EMACS_INT opoint_byte = PT_BYTE; | 4227 | ptrdiff_t opoint_byte = PT_BYTE; |
| 4222 | EMACS_INT oinserted = ZV - BEGV; | 4228 | ptrdiff_t oinserted = ZV - BEGV; |
| 4223 | int ochars_modiff = CHARS_MODIFF; | 4229 | EMACS_INT ochars_modiff = CHARS_MODIFF; |
| 4224 | 4230 | ||
| 4225 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4231 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| 4226 | insval = call1 (XCAR (p), make_number (oinserted)); | 4232 | insval = call1 (XCAR (p), make_number (oinserted)); |
| 4227 | if (!NILP (insval)) | 4233 | if (!NILP (insval)) |
| 4228 | { | 4234 | { |
| 4229 | CHECK_NUMBER (insval); | 4235 | if (! RANGED_INTEGERP (0, insval, ZV - PT)) |
| 4236 | wrong_type_argument (intern ("inserted-chars"), insval); | ||
| 4230 | if (ochars_modiff == CHARS_MODIFF) | 4237 | if (ochars_modiff == CHARS_MODIFF) |
| 4231 | /* after_insert_file_functions didn't modify | 4238 | /* after_insert_file_functions didn't modify |
| 4232 | buffer's characters => move point back to | 4239 | buffer's characters => move point back to |
| @@ -4458,7 +4465,7 @@ This calls `write-region-annotate-functions' at the start, and | |||
| 4458 | int save_errno = 0; | 4465 | int save_errno = 0; |
| 4459 | const char *fn; | 4466 | const char *fn; |
| 4460 | struct stat st; | 4467 | struct stat st; |
| 4461 | int count = SPECPDL_INDEX (); | 4468 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4462 | int count1; | 4469 | int count1; |
| 4463 | Lisp_Object handler; | 4470 | Lisp_Object handler; |
| 4464 | Lisp_Object visit_file; | 4471 | Lisp_Object visit_file; |
| @@ -4856,13 +4863,13 @@ build_annotations (Lisp_Object start, Lisp_Object end) | |||
| 4856 | The return value is negative in case of system call failure. */ | 4863 | The return value is negative in case of system call failure. */ |
| 4857 | 4864 | ||
| 4858 | static int | 4865 | static int |
| 4859 | a_write (int desc, Lisp_Object string, EMACS_INT pos, | 4866 | a_write (int desc, Lisp_Object string, ptrdiff_t pos, |
| 4860 | register EMACS_INT nchars, Lisp_Object *annot, | 4867 | register ptrdiff_t nchars, Lisp_Object *annot, |
| 4861 | struct coding_system *coding) | 4868 | struct coding_system *coding) |
| 4862 | { | 4869 | { |
| 4863 | Lisp_Object tem; | 4870 | Lisp_Object tem; |
| 4864 | EMACS_INT nextpos; | 4871 | ptrdiff_t nextpos; |
| 4865 | EMACS_INT lastpos = pos + nchars; | 4872 | ptrdiff_t lastpos = pos + nchars; |
| 4866 | 4873 | ||
| 4867 | while (NILP (*annot) || CONSP (*annot)) | 4874 | while (NILP (*annot) || CONSP (*annot)) |
| 4868 | { | 4875 | { |
| @@ -4902,7 +4909,7 @@ a_write (int desc, Lisp_Object string, EMACS_INT pos, | |||
| 4902 | are indexes to the string STRING. */ | 4909 | are indexes to the string STRING. */ |
| 4903 | 4910 | ||
| 4904 | static int | 4911 | static int |
| 4905 | e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end, | 4912 | e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end, |
| 4906 | struct coding_system *coding) | 4913 | struct coding_system *coding) |
| 4907 | { | 4914 | { |
| 4908 | if (STRINGP (string)) | 4915 | if (STRINGP (string)) |
| @@ -4934,8 +4941,8 @@ e_write (int desc, Lisp_Object string, EMACS_INT start, EMACS_INT end, | |||
| 4934 | } | 4941 | } |
| 4935 | else | 4942 | else |
| 4936 | { | 4943 | { |
| 4937 | EMACS_INT start_byte = CHAR_TO_BYTE (start); | 4944 | ptrdiff_t start_byte = CHAR_TO_BYTE (start); |
| 4938 | EMACS_INT end_byte = CHAR_TO_BYTE (end); | 4945 | ptrdiff_t end_byte = CHAR_TO_BYTE (end); |
| 4939 | 4946 | ||
| 4940 | coding->src_multibyte = (end - start) < (end_byte - start_byte); | 4947 | coding->src_multibyte = (end - start) < (end_byte - start_byte); |
| 4941 | if (CODING_REQUIRE_ENCODING (coding)) | 4948 | if (CODING_REQUIRE_ENCODING (coding)) |
| @@ -5219,7 +5226,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5219 | int do_handled_files; | 5226 | int do_handled_files; |
| 5220 | Lisp_Object oquit; | 5227 | Lisp_Object oquit; |
| 5221 | FILE *stream = NULL; | 5228 | FILE *stream = NULL; |
| 5222 | int count = SPECPDL_INDEX (); | 5229 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5223 | int orig_minibuffer_auto_raise = minibuffer_auto_raise; | 5230 | int orig_minibuffer_auto_raise = minibuffer_auto_raise; |
| 5224 | int old_message_p = 0; | 5231 | int old_message_p = 0; |
| 5225 | struct gcpro gcpro1, gcpro2; | 5232 | struct gcpro gcpro1, gcpro2; |
| @@ -5339,7 +5346,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) | |||
| 5339 | EMACS_GET_TIME (before_time); | 5346 | EMACS_GET_TIME (before_time); |
| 5340 | 5347 | ||
| 5341 | /* If we had a failure, don't try again for 20 minutes. */ | 5348 | /* If we had a failure, don't try again for 20 minutes. */ |
| 5342 | if (b->auto_save_failure_time >= 0 | 5349 | if (b->auto_save_failure_time > 0 |
| 5343 | && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) | 5350 | && EMACS_SECS (before_time) - b->auto_save_failure_time < 1200) |
| 5344 | continue; | 5351 | continue; |
| 5345 | 5352 | ||
| @@ -5418,7 +5425,7 @@ No auto-save file will be written until the buffer changes again. */) | |||
| 5418 | they're not autosaved. */ | 5425 | they're not autosaved. */ |
| 5419 | BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; | 5426 | BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF; |
| 5420 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); | 5427 | XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); |
| 5421 | current_buffer->auto_save_failure_time = -1; | 5428 | current_buffer->auto_save_failure_time = 0; |
| 5422 | return Qnil; | 5429 | return Qnil; |
| 5423 | } | 5430 | } |
| 5424 | 5431 | ||
| @@ -5427,7 +5434,7 @@ DEFUN ("clear-buffer-auto-save-failure", Fclear_buffer_auto_save_failure, | |||
| 5427 | doc: /* Clear any record of a recent auto-save failure in the current buffer. */) | 5434 | doc: /* Clear any record of a recent auto-save failure in the current buffer. */) |
| 5428 | (void) | 5435 | (void) |
| 5429 | { | 5436 | { |
| 5430 | current_buffer->auto_save_failure_time = -1; | 5437 | current_buffer->auto_save_failure_time = 0; |
| 5431 | return Qnil; | 5438 | return Qnil; |
| 5432 | } | 5439 | } |
| 5433 | 5440 | ||
| @@ -250,8 +250,8 @@ If string STR1 is greater, the value is a positive number N; | |||
| 250 | N - 1 is the number of characters that match at the beginning. */) | 250 | N - 1 is the number of characters that match at the beginning. */) |
| 251 | (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case) | 251 | (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case) |
| 252 | { | 252 | { |
| 253 | register EMACS_INT end1_char, end2_char; | 253 | register ptrdiff_t end1_char, end2_char; |
| 254 | register EMACS_INT i1, i1_byte, i2, i2_byte; | 254 | register ptrdiff_t i1, i1_byte, i2, i2_byte; |
| 255 | 255 | ||
| 256 | CHECK_STRING (str1); | 256 | CHECK_STRING (str1); |
| 257 | CHECK_STRING (str2); | 257 | CHECK_STRING (str2); |
| @@ -266,19 +266,23 @@ If string STR1 is greater, the value is a positive number N; | |||
| 266 | if (! NILP (end2)) | 266 | if (! NILP (end2)) |
| 267 | CHECK_NATNUM (end2); | 267 | CHECK_NATNUM (end2); |
| 268 | 268 | ||
| 269 | i1 = XINT (start1); | ||
| 270 | i2 = XINT (start2); | ||
| 271 | |||
| 272 | i1_byte = string_char_to_byte (str1, i1); | ||
| 273 | i2_byte = string_char_to_byte (str2, i2); | ||
| 274 | |||
| 275 | end1_char = SCHARS (str1); | 269 | end1_char = SCHARS (str1); |
| 276 | if (! NILP (end1) && end1_char > XINT (end1)) | 270 | if (! NILP (end1) && end1_char > XINT (end1)) |
| 277 | end1_char = XINT (end1); | 271 | end1_char = XINT (end1); |
| 272 | if (end1_char < XINT (start1)) | ||
| 273 | args_out_of_range (str1, start1); | ||
| 278 | 274 | ||
| 279 | end2_char = SCHARS (str2); | 275 | end2_char = SCHARS (str2); |
| 280 | if (! NILP (end2) && end2_char > XINT (end2)) | 276 | if (! NILP (end2) && end2_char > XINT (end2)) |
| 281 | end2_char = XINT (end2); | 277 | end2_char = XINT (end2); |
| 278 | if (end2_char < XINT (start2)) | ||
| 279 | args_out_of_range (str2, start2); | ||
| 280 | |||
| 281 | i1 = XINT (start1); | ||
| 282 | i2 = XINT (start2); | ||
| 283 | |||
| 284 | i1_byte = string_char_to_byte (str1, i1); | ||
| 285 | i2_byte = string_char_to_byte (str2, i2); | ||
| 282 | 286 | ||
| 283 | while (i1 < end1_char && i2 < end2_char) | 287 | while (i1 < end1_char && i2 < end2_char) |
| 284 | { | 288 | { |
| @@ -341,8 +345,8 @@ Case is significant. | |||
| 341 | Symbols are also allowed; their print names are used instead. */) | 345 | Symbols are also allowed; their print names are used instead. */) |
| 342 | (register Lisp_Object s1, Lisp_Object s2) | 346 | (register Lisp_Object s1, Lisp_Object s2) |
| 343 | { | 347 | { |
| 344 | register EMACS_INT end; | 348 | register ptrdiff_t end; |
| 345 | register EMACS_INT i1, i1_byte, i2, i2_byte; | 349 | register ptrdiff_t i1, i1_byte, i2, i2_byte; |
| 346 | 350 | ||
| 347 | if (SYMBOLP (s1)) | 351 | if (SYMBOLP (s1)) |
| 348 | s1 = SYMBOL_NAME (s1); | 352 | s1 = SYMBOL_NAME (s1); |
| @@ -465,8 +469,8 @@ with the original. */) | |||
| 465 | struct textprop_rec | 469 | struct textprop_rec |
| 466 | { | 470 | { |
| 467 | ptrdiff_t argnum; /* refer to ARGS (arguments of `concat') */ | 471 | ptrdiff_t argnum; /* refer to ARGS (arguments of `concat') */ |
| 468 | EMACS_INT from; /* refer to ARGS[argnum] (argument string) */ | 472 | ptrdiff_t from; /* refer to ARGS[argnum] (argument string) */ |
| 469 | EMACS_INT to; /* refer to VAL (the target string) */ | 473 | ptrdiff_t to; /* refer to VAL (the target string) */ |
| 470 | }; | 474 | }; |
| 471 | 475 | ||
| 472 | static Lisp_Object | 476 | static Lisp_Object |
| @@ -476,8 +480,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 476 | Lisp_Object val; | 480 | Lisp_Object val; |
| 477 | register Lisp_Object tail; | 481 | register Lisp_Object tail; |
| 478 | register Lisp_Object this; | 482 | register Lisp_Object this; |
| 479 | EMACS_INT toindex; | 483 | ptrdiff_t toindex; |
| 480 | EMACS_INT toindex_byte = 0; | 484 | ptrdiff_t toindex_byte = 0; |
| 481 | register EMACS_INT result_len; | 485 | register EMACS_INT result_len; |
| 482 | register EMACS_INT result_len_byte; | 486 | register EMACS_INT result_len_byte; |
| 483 | ptrdiff_t argnum; | 487 | ptrdiff_t argnum; |
| @@ -530,10 +534,10 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 530 | { | 534 | { |
| 531 | /* We must count the number of bytes needed in the string | 535 | /* We must count the number of bytes needed in the string |
| 532 | as well as the number of characters. */ | 536 | as well as the number of characters. */ |
| 533 | EMACS_INT i; | 537 | ptrdiff_t i; |
| 534 | Lisp_Object ch; | 538 | Lisp_Object ch; |
| 535 | int c; | 539 | int c; |
| 536 | EMACS_INT this_len_byte; | 540 | ptrdiff_t this_len_byte; |
| 537 | 541 | ||
| 538 | if (VECTORP (this) || COMPILEDP (this)) | 542 | if (VECTORP (this) || COMPILEDP (this)) |
| 539 | for (i = 0; i < len; i++) | 543 | for (i = 0; i < len; i++) |
| @@ -542,6 +546,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 542 | CHECK_CHARACTER (ch); | 546 | CHECK_CHARACTER (ch); |
| 543 | c = XFASTINT (ch); | 547 | c = XFASTINT (ch); |
| 544 | this_len_byte = CHAR_BYTES (c); | 548 | this_len_byte = CHAR_BYTES (c); |
| 549 | if (STRING_BYTES_BOUND - result_len_byte < this_len_byte) | ||
| 550 | string_overflow (); | ||
| 545 | result_len_byte += this_len_byte; | 551 | result_len_byte += this_len_byte; |
| 546 | if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c)) | 552 | if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c)) |
| 547 | some_multibyte = 1; | 553 | some_multibyte = 1; |
| @@ -555,6 +561,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 555 | CHECK_CHARACTER (ch); | 561 | CHECK_CHARACTER (ch); |
| 556 | c = XFASTINT (ch); | 562 | c = XFASTINT (ch); |
| 557 | this_len_byte = CHAR_BYTES (c); | 563 | this_len_byte = CHAR_BYTES (c); |
| 564 | if (STRING_BYTES_BOUND - result_len_byte < this_len_byte) | ||
| 565 | string_overflow (); | ||
| 558 | result_len_byte += this_len_byte; | 566 | result_len_byte += this_len_byte; |
| 559 | if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c)) | 567 | if (! ASCII_CHAR_P (c) && ! CHAR_BYTE8_P (c)) |
| 560 | some_multibyte = 1; | 568 | some_multibyte = 1; |
| @@ -564,17 +572,20 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 564 | if (STRING_MULTIBYTE (this)) | 572 | if (STRING_MULTIBYTE (this)) |
| 565 | { | 573 | { |
| 566 | some_multibyte = 1; | 574 | some_multibyte = 1; |
| 567 | result_len_byte += SBYTES (this); | 575 | this_len_byte = SBYTES (this); |
| 568 | } | 576 | } |
| 569 | else | 577 | else |
| 570 | result_len_byte += count_size_as_multibyte (SDATA (this), | 578 | this_len_byte = count_size_as_multibyte (SDATA (this), |
| 571 | SCHARS (this)); | 579 | SCHARS (this)); |
| 580 | if (STRING_BYTES_BOUND - result_len_byte < this_len_byte) | ||
| 581 | string_overflow (); | ||
| 582 | result_len_byte += this_len_byte; | ||
| 572 | } | 583 | } |
| 573 | } | 584 | } |
| 574 | 585 | ||
| 575 | result_len += len; | 586 | result_len += len; |
| 576 | if (STRING_BYTES_BOUND < result_len) | 587 | if (MOST_POSITIVE_FIXNUM < result_len) |
| 577 | string_overflow (); | 588 | memory_full (SIZE_MAX); |
| 578 | } | 589 | } |
| 579 | 590 | ||
| 580 | if (! some_multibyte) | 591 | if (! some_multibyte) |
| @@ -607,9 +618,9 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 607 | for (argnum = 0; argnum < nargs; argnum++) | 618 | for (argnum = 0; argnum < nargs; argnum++) |
| 608 | { | 619 | { |
| 609 | Lisp_Object thislen; | 620 | Lisp_Object thislen; |
| 610 | EMACS_INT thisleni = 0; | 621 | ptrdiff_t thisleni = 0; |
| 611 | register EMACS_INT thisindex = 0; | 622 | register ptrdiff_t thisindex = 0; |
| 612 | register EMACS_INT thisindex_byte = 0; | 623 | register ptrdiff_t thisindex_byte = 0; |
| 613 | 624 | ||
| 614 | this = args[argnum]; | 625 | this = args[argnum]; |
| 615 | if (!CONSP (this)) | 626 | if (!CONSP (this)) |
| @@ -619,7 +630,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 619 | if (STRINGP (this) && STRINGP (val) | 630 | if (STRINGP (this) && STRINGP (val) |
| 620 | && STRING_MULTIBYTE (this) == some_multibyte) | 631 | && STRING_MULTIBYTE (this) == some_multibyte) |
| 621 | { | 632 | { |
| 622 | EMACS_INT thislen_byte = SBYTES (this); | 633 | ptrdiff_t thislen_byte = SBYTES (this); |
| 623 | 634 | ||
| 624 | memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); | 635 | memcpy (SDATA (val) + toindex_byte, SDATA (this), SBYTES (this)); |
| 625 | if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) | 636 | if (! NULL_INTERVAL_P (STRING_INTERVALS (this))) |
| @@ -720,7 +731,7 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 720 | if (num_textprops > 0) | 731 | if (num_textprops > 0) |
| 721 | { | 732 | { |
| 722 | Lisp_Object props; | 733 | Lisp_Object props; |
| 723 | EMACS_INT last_to_end = -1; | 734 | ptrdiff_t last_to_end = -1; |
| 724 | 735 | ||
| 725 | for (argnum = 0; argnum < num_textprops; argnum++) | 736 | for (argnum = 0; argnum < num_textprops; argnum++) |
| 726 | { | 737 | { |
| @@ -744,8 +755,8 @@ concat (ptrdiff_t nargs, Lisp_Object *args, | |||
| 744 | } | 755 | } |
| 745 | 756 | ||
| 746 | static Lisp_Object string_char_byte_cache_string; | 757 | static Lisp_Object string_char_byte_cache_string; |
| 747 | static EMACS_INT string_char_byte_cache_charpos; | 758 | static ptrdiff_t string_char_byte_cache_charpos; |
| 748 | static EMACS_INT string_char_byte_cache_bytepos; | 759 | static ptrdiff_t string_char_byte_cache_bytepos; |
| 749 | 760 | ||
| 750 | void | 761 | void |
| 751 | clear_string_char_byte_cache (void) | 762 | clear_string_char_byte_cache (void) |
| @@ -755,12 +766,12 @@ clear_string_char_byte_cache (void) | |||
| 755 | 766 | ||
| 756 | /* Return the byte index corresponding to CHAR_INDEX in STRING. */ | 767 | /* Return the byte index corresponding to CHAR_INDEX in STRING. */ |
| 757 | 768 | ||
| 758 | EMACS_INT | 769 | ptrdiff_t |
| 759 | string_char_to_byte (Lisp_Object string, EMACS_INT char_index) | 770 | string_char_to_byte (Lisp_Object string, ptrdiff_t char_index) |
| 760 | { | 771 | { |
| 761 | EMACS_INT i_byte; | 772 | ptrdiff_t i_byte; |
| 762 | EMACS_INT best_below, best_below_byte; | 773 | ptrdiff_t best_below, best_below_byte; |
| 763 | EMACS_INT best_above, best_above_byte; | 774 | ptrdiff_t best_above, best_above_byte; |
| 764 | 775 | ||
| 765 | best_below = best_below_byte = 0; | 776 | best_below = best_below_byte = 0; |
| 766 | best_above = SCHARS (string); | 777 | best_above = SCHARS (string); |
| @@ -815,12 +826,12 @@ string_char_to_byte (Lisp_Object string, EMACS_INT char_index) | |||
| 815 | 826 | ||
| 816 | /* Return the character index corresponding to BYTE_INDEX in STRING. */ | 827 | /* Return the character index corresponding to BYTE_INDEX in STRING. */ |
| 817 | 828 | ||
| 818 | EMACS_INT | 829 | ptrdiff_t |
| 819 | string_byte_to_char (Lisp_Object string, EMACS_INT byte_index) | 830 | string_byte_to_char (Lisp_Object string, ptrdiff_t byte_index) |
| 820 | { | 831 | { |
| 821 | EMACS_INT i, i_byte; | 832 | ptrdiff_t i, i_byte; |
| 822 | EMACS_INT best_below, best_below_byte; | 833 | ptrdiff_t best_below, best_below_byte; |
| 823 | EMACS_INT best_above, best_above_byte; | 834 | ptrdiff_t best_above, best_above_byte; |
| 824 | 835 | ||
| 825 | best_below = best_below_byte = 0; | 836 | best_below = best_below_byte = 0; |
| 826 | best_above = SCHARS (string); | 837 | best_above = SCHARS (string); |
| @@ -883,7 +894,7 @@ static Lisp_Object | |||
| 883 | string_make_multibyte (Lisp_Object string) | 894 | string_make_multibyte (Lisp_Object string) |
| 884 | { | 895 | { |
| 885 | unsigned char *buf; | 896 | unsigned char *buf; |
| 886 | EMACS_INT nbytes; | 897 | ptrdiff_t nbytes; |
| 887 | Lisp_Object ret; | 898 | Lisp_Object ret; |
| 888 | USE_SAFE_ALLOCA; | 899 | USE_SAFE_ALLOCA; |
| 889 | 900 | ||
| @@ -916,7 +927,7 @@ Lisp_Object | |||
| 916 | string_to_multibyte (Lisp_Object string) | 927 | string_to_multibyte (Lisp_Object string) |
| 917 | { | 928 | { |
| 918 | unsigned char *buf; | 929 | unsigned char *buf; |
| 919 | EMACS_INT nbytes; | 930 | ptrdiff_t nbytes; |
| 920 | Lisp_Object ret; | 931 | Lisp_Object ret; |
| 921 | USE_SAFE_ALLOCA; | 932 | USE_SAFE_ALLOCA; |
| 922 | 933 | ||
| @@ -945,7 +956,7 @@ string_to_multibyte (Lisp_Object string) | |||
| 945 | Lisp_Object | 956 | Lisp_Object |
| 946 | string_make_unibyte (Lisp_Object string) | 957 | string_make_unibyte (Lisp_Object string) |
| 947 | { | 958 | { |
| 948 | EMACS_INT nchars; | 959 | ptrdiff_t nchars; |
| 949 | unsigned char *buf; | 960 | unsigned char *buf; |
| 950 | Lisp_Object ret; | 961 | Lisp_Object ret; |
| 951 | USE_SAFE_ALLOCA; | 962 | USE_SAFE_ALLOCA; |
| @@ -1010,7 +1021,7 @@ If STRING is multibyte and contains a character of charset | |||
| 1010 | 1021 | ||
| 1011 | if (STRING_MULTIBYTE (string)) | 1022 | if (STRING_MULTIBYTE (string)) |
| 1012 | { | 1023 | { |
| 1013 | EMACS_INT bytes = SBYTES (string); | 1024 | ptrdiff_t bytes = SBYTES (string); |
| 1014 | unsigned char *str = (unsigned char *) xmalloc (bytes); | 1025 | unsigned char *str = (unsigned char *) xmalloc (bytes); |
| 1015 | 1026 | ||
| 1016 | memcpy (str, SDATA (string), bytes); | 1027 | memcpy (str, SDATA (string), bytes); |
| @@ -1043,7 +1054,7 @@ If you're not sure, whether to use `string-as-multibyte' or | |||
| 1043 | if (! STRING_MULTIBYTE (string)) | 1054 | if (! STRING_MULTIBYTE (string)) |
| 1044 | { | 1055 | { |
| 1045 | Lisp_Object new_string; | 1056 | Lisp_Object new_string; |
| 1046 | EMACS_INT nchars, nbytes; | 1057 | ptrdiff_t nchars, nbytes; |
| 1047 | 1058 | ||
| 1048 | parse_str_as_multibyte (SDATA (string), | 1059 | parse_str_as_multibyte (SDATA (string), |
| 1049 | SBYTES (string), | 1060 | SBYTES (string), |
| @@ -1092,9 +1103,9 @@ an error is signaled. */) | |||
| 1092 | 1103 | ||
| 1093 | if (STRING_MULTIBYTE (string)) | 1104 | if (STRING_MULTIBYTE (string)) |
| 1094 | { | 1105 | { |
| 1095 | EMACS_INT chars = SCHARS (string); | 1106 | ptrdiff_t chars = SCHARS (string); |
| 1096 | unsigned char *str = (unsigned char *) xmalloc (chars); | 1107 | unsigned char *str = (unsigned char *) xmalloc (chars); |
| 1097 | EMACS_INT converted = str_to_unibyte (SDATA (string), str, chars, 0); | 1108 | ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars, 0); |
| 1098 | 1109 | ||
| 1099 | if (converted < chars) | 1110 | if (converted < chars) |
| 1100 | error ("Can't convert the %"pI"dth character to unibyte", converted); | 1111 | error ("Can't convert the %"pI"dth character to unibyte", converted); |
| @@ -1145,27 +1156,19 @@ value is a new vector that contains the elements between index FROM | |||
| 1145 | (Lisp_Object string, register Lisp_Object from, Lisp_Object to) | 1156 | (Lisp_Object string, register Lisp_Object from, Lisp_Object to) |
| 1146 | { | 1157 | { |
| 1147 | Lisp_Object res; | 1158 | Lisp_Object res; |
| 1148 | EMACS_INT size; | 1159 | ptrdiff_t size; |
| 1149 | EMACS_INT size_byte = 0; | ||
| 1150 | EMACS_INT from_char, to_char; | 1160 | EMACS_INT from_char, to_char; |
| 1151 | EMACS_INT from_byte = 0, to_byte = 0; | ||
| 1152 | 1161 | ||
| 1153 | CHECK_VECTOR_OR_STRING (string); | 1162 | CHECK_VECTOR_OR_STRING (string); |
| 1154 | CHECK_NUMBER (from); | 1163 | CHECK_NUMBER (from); |
| 1155 | 1164 | ||
| 1156 | if (STRINGP (string)) | 1165 | if (STRINGP (string)) |
| 1157 | { | 1166 | size = SCHARS (string); |
| 1158 | size = SCHARS (string); | ||
| 1159 | size_byte = SBYTES (string); | ||
| 1160 | } | ||
| 1161 | else | 1167 | else |
| 1162 | size = ASIZE (string); | 1168 | size = ASIZE (string); |
| 1163 | 1169 | ||
| 1164 | if (NILP (to)) | 1170 | if (NILP (to)) |
| 1165 | { | 1171 | to_char = size; |
| 1166 | to_char = size; | ||
| 1167 | to_byte = size_byte; | ||
| 1168 | } | ||
| 1169 | else | 1172 | else |
| 1170 | { | 1173 | { |
| 1171 | CHECK_NUMBER (to); | 1174 | CHECK_NUMBER (to); |
| @@ -1173,23 +1176,19 @@ value is a new vector that contains the elements between index FROM | |||
| 1173 | to_char = XINT (to); | 1176 | to_char = XINT (to); |
| 1174 | if (to_char < 0) | 1177 | if (to_char < 0) |
| 1175 | to_char += size; | 1178 | to_char += size; |
| 1176 | |||
| 1177 | if (STRINGP (string)) | ||
| 1178 | to_byte = string_char_to_byte (string, to_char); | ||
| 1179 | } | 1179 | } |
| 1180 | 1180 | ||
| 1181 | from_char = XINT (from); | 1181 | from_char = XINT (from); |
| 1182 | if (from_char < 0) | 1182 | if (from_char < 0) |
| 1183 | from_char += size; | 1183 | from_char += size; |
| 1184 | if (STRINGP (string)) | ||
| 1185 | from_byte = string_char_to_byte (string, from_char); | ||
| 1186 | |||
| 1187 | if (!(0 <= from_char && from_char <= to_char && to_char <= size)) | 1184 | if (!(0 <= from_char && from_char <= to_char && to_char <= size)) |
| 1188 | args_out_of_range_3 (string, make_number (from_char), | 1185 | args_out_of_range_3 (string, make_number (from_char), |
| 1189 | make_number (to_char)); | 1186 | make_number (to_char)); |
| 1190 | |||
| 1191 | if (STRINGP (string)) | 1187 | if (STRINGP (string)) |
| 1192 | { | 1188 | { |
| 1189 | ptrdiff_t to_byte = | ||
| 1190 | (NILP (to) ? SBYTES (string) : string_char_to_byte (string, to_char)); | ||
| 1191 | ptrdiff_t from_byte = string_char_to_byte (string, from_char); | ||
| 1193 | res = make_specified_string (SSDATA (string) + from_byte, | 1192 | res = make_specified_string (SSDATA (string) + from_byte, |
| 1194 | to_char - from_char, to_byte - from_byte, | 1193 | to_char - from_char, to_byte - from_byte, |
| 1195 | STRING_MULTIBYTE (string)); | 1194 | STRING_MULTIBYTE (string)); |
| @@ -1213,47 +1212,41 @@ If FROM or TO is negative, it counts from the end. | |||
| 1213 | With one argument, just copy STRING without its properties. */) | 1212 | With one argument, just copy STRING without its properties. */) |
| 1214 | (Lisp_Object string, register Lisp_Object from, Lisp_Object to) | 1213 | (Lisp_Object string, register Lisp_Object from, Lisp_Object to) |
| 1215 | { | 1214 | { |
| 1216 | EMACS_INT size, size_byte; | 1215 | ptrdiff_t size; |
| 1217 | EMACS_INT from_char, to_char; | 1216 | EMACS_INT from_char, to_char; |
| 1218 | EMACS_INT from_byte, to_byte; | 1217 | ptrdiff_t from_byte, to_byte; |
| 1219 | 1218 | ||
| 1220 | CHECK_STRING (string); | 1219 | CHECK_STRING (string); |
| 1221 | 1220 | ||
| 1222 | size = SCHARS (string); | 1221 | size = SCHARS (string); |
| 1223 | size_byte = SBYTES (string); | ||
| 1224 | 1222 | ||
| 1225 | if (NILP (from)) | 1223 | if (NILP (from)) |
| 1226 | from_char = from_byte = 0; | 1224 | from_char = 0; |
| 1227 | else | 1225 | else |
| 1228 | { | 1226 | { |
| 1229 | CHECK_NUMBER (from); | 1227 | CHECK_NUMBER (from); |
| 1230 | from_char = XINT (from); | 1228 | from_char = XINT (from); |
| 1231 | if (from_char < 0) | 1229 | if (from_char < 0) |
| 1232 | from_char += size; | 1230 | from_char += size; |
| 1233 | |||
| 1234 | from_byte = string_char_to_byte (string, from_char); | ||
| 1235 | } | 1231 | } |
| 1236 | 1232 | ||
| 1237 | if (NILP (to)) | 1233 | if (NILP (to)) |
| 1238 | { | 1234 | to_char = size; |
| 1239 | to_char = size; | ||
| 1240 | to_byte = size_byte; | ||
| 1241 | } | ||
| 1242 | else | 1235 | else |
| 1243 | { | 1236 | { |
| 1244 | CHECK_NUMBER (to); | 1237 | CHECK_NUMBER (to); |
| 1245 | |||
| 1246 | to_char = XINT (to); | 1238 | to_char = XINT (to); |
| 1247 | if (to_char < 0) | 1239 | if (to_char < 0) |
| 1248 | to_char += size; | 1240 | to_char += size; |
| 1249 | |||
| 1250 | to_byte = string_char_to_byte (string, to_char); | ||
| 1251 | } | 1241 | } |
| 1252 | 1242 | ||
| 1253 | if (!(0 <= from_char && from_char <= to_char && to_char <= size)) | 1243 | if (!(0 <= from_char && from_char <= to_char && to_char <= size)) |
| 1254 | args_out_of_range_3 (string, make_number (from_char), | 1244 | args_out_of_range_3 (string, make_number (from_char), |
| 1255 | make_number (to_char)); | 1245 | make_number (to_char)); |
| 1256 | 1246 | ||
| 1247 | from_byte = NILP (from) ? 0 : string_char_to_byte (string, from_char); | ||
| 1248 | to_byte = | ||
| 1249 | NILP (to) ? SBYTES (string) : string_char_to_byte (string, to_char); | ||
| 1257 | return make_specified_string (SSDATA (string) + from_byte, | 1250 | return make_specified_string (SSDATA (string) + from_byte, |
| 1258 | to_char - from_char, to_byte - from_byte, | 1251 | to_char - from_char, to_byte - from_byte, |
| 1259 | STRING_MULTIBYTE (string)); | 1252 | STRING_MULTIBYTE (string)); |
| @@ -1263,11 +1256,11 @@ With one argument, just copy STRING without its properties. */) | |||
| 1263 | both in characters and in bytes. */ | 1256 | both in characters and in bytes. */ |
| 1264 | 1257 | ||
| 1265 | Lisp_Object | 1258 | Lisp_Object |
| 1266 | substring_both (Lisp_Object string, EMACS_INT from, EMACS_INT from_byte, | 1259 | substring_both (Lisp_Object string, ptrdiff_t from, ptrdiff_t from_byte, |
| 1267 | EMACS_INT to, EMACS_INT to_byte) | 1260 | ptrdiff_t to, ptrdiff_t to_byte) |
| 1268 | { | 1261 | { |
| 1269 | Lisp_Object res; | 1262 | Lisp_Object res; |
| 1270 | EMACS_INT size; | 1263 | ptrdiff_t size; |
| 1271 | 1264 | ||
| 1272 | CHECK_VECTOR_OR_STRING (string); | 1265 | CHECK_VECTOR_OR_STRING (string); |
| 1273 | 1266 | ||
| @@ -1601,7 +1594,7 @@ to be sure of changing the value of `foo'. */) | |||
| 1601 | { | 1594 | { |
| 1602 | if (VECTORP (seq)) | 1595 | if (VECTORP (seq)) |
| 1603 | { | 1596 | { |
| 1604 | EMACS_INT i, n; | 1597 | ptrdiff_t i, n; |
| 1605 | 1598 | ||
| 1606 | for (i = n = 0; i < ASIZE (seq); ++i) | 1599 | for (i = n = 0; i < ASIZE (seq); ++i) |
| 1607 | if (NILP (Fequal (AREF (seq, i), elt))) | 1600 | if (NILP (Fequal (AREF (seq, i), elt))) |
| @@ -1620,7 +1613,7 @@ to be sure of changing the value of `foo'. */) | |||
| 1620 | } | 1613 | } |
| 1621 | else if (STRINGP (seq)) | 1614 | else if (STRINGP (seq)) |
| 1622 | { | 1615 | { |
| 1623 | EMACS_INT i, ibyte, nchars, nbytes, cbytes; | 1616 | ptrdiff_t i, ibyte, nchars, nbytes, cbytes; |
| 1624 | int c; | 1617 | int c; |
| 1625 | 1618 | ||
| 1626 | for (i = nchars = nbytes = ibyte = 0; | 1619 | for (i = nchars = nbytes = ibyte = 0; |
| @@ -1672,7 +1665,7 @@ to be sure of changing the value of `foo'. */) | |||
| 1672 | { | 1665 | { |
| 1673 | unsigned char *from = SDATA (seq) + ibyte; | 1666 | unsigned char *from = SDATA (seq) + ibyte; |
| 1674 | unsigned char *to = SDATA (tem) + nbytes; | 1667 | unsigned char *to = SDATA (tem) + nbytes; |
| 1675 | EMACS_INT n; | 1668 | ptrdiff_t n; |
| 1676 | 1669 | ||
| 1677 | ++nchars; | 1670 | ++nchars; |
| 1678 | nbytes += cbytes; | 1671 | nbytes += cbytes; |
| @@ -2079,7 +2072,7 @@ internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int | |||
| 2079 | case Lisp_Vectorlike: | 2072 | case Lisp_Vectorlike: |
| 2080 | { | 2073 | { |
| 2081 | register int i; | 2074 | register int i; |
| 2082 | EMACS_INT size = ASIZE (o1); | 2075 | ptrdiff_t size = ASIZE (o1); |
| 2083 | /* Pseudovectors have the type encoded in the size field, so this test | 2076 | /* Pseudovectors have the type encoded in the size field, so this test |
| 2084 | actually checks that the objects have the same type as well as the | 2077 | actually checks that the objects have the same type as well as the |
| 2085 | same size. */ | 2078 | same size. */ |
| @@ -2146,7 +2139,7 @@ DEFUN ("fillarray", Ffillarray, Sfillarray, 2, 2, 0, | |||
| 2146 | ARRAY is a vector, string, char-table, or bool-vector. */) | 2139 | ARRAY is a vector, string, char-table, or bool-vector. */) |
| 2147 | (Lisp_Object array, Lisp_Object item) | 2140 | (Lisp_Object array, Lisp_Object item) |
| 2148 | { | 2141 | { |
| 2149 | register EMACS_INT size, idx; | 2142 | register ptrdiff_t size, idx; |
| 2150 | 2143 | ||
| 2151 | if (VECTORP (array)) | 2144 | if (VECTORP (array)) |
| 2152 | { | 2145 | { |
| @@ -2174,7 +2167,7 @@ ARRAY is a vector, string, char-table, or bool-vector. */) | |||
| 2174 | { | 2167 | { |
| 2175 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | 2168 | unsigned char str[MAX_MULTIBYTE_LENGTH]; |
| 2176 | int len = CHAR_STRING (charval, str); | 2169 | int len = CHAR_STRING (charval, str); |
| 2177 | EMACS_INT size_byte = SBYTES (array); | 2170 | ptrdiff_t size_byte = SBYTES (array); |
| 2178 | 2171 | ||
| 2179 | if (INT_MULTIPLY_OVERFLOW (SCHARS (array), len) | 2172 | if (INT_MULTIPLY_OVERFLOW (SCHARS (array), len) |
| 2180 | || SCHARS (array) * len != size_byte) | 2173 | || SCHARS (array) * len != size_byte) |
| @@ -2189,18 +2182,16 @@ ARRAY is a vector, string, char-table, or bool-vector. */) | |||
| 2189 | else if (BOOL_VECTOR_P (array)) | 2182 | else if (BOOL_VECTOR_P (array)) |
| 2190 | { | 2183 | { |
| 2191 | register unsigned char *p = XBOOL_VECTOR (array)->data; | 2184 | register unsigned char *p = XBOOL_VECTOR (array)->data; |
| 2192 | EMACS_INT size_in_chars; | 2185 | size = |
| 2193 | size = XBOOL_VECTOR (array)->size; | 2186 | ((XBOOL_VECTOR (array)->size + BOOL_VECTOR_BITS_PER_CHAR - 1) |
| 2194 | size_in_chars | 2187 | / BOOL_VECTOR_BITS_PER_CHAR); |
| 2195 | = ((size + BOOL_VECTOR_BITS_PER_CHAR - 1) | ||
| 2196 | / BOOL_VECTOR_BITS_PER_CHAR); | ||
| 2197 | 2188 | ||
| 2198 | if (size_in_chars) | 2189 | if (size) |
| 2199 | { | 2190 | { |
| 2200 | memset (p, ! NILP (item) ? -1 : 0, size_in_chars); | 2191 | memset (p, ! NILP (item) ? -1 : 0, size); |
| 2201 | 2192 | ||
| 2202 | /* Clear any extraneous bits in the last byte. */ | 2193 | /* Clear any extraneous bits in the last byte. */ |
| 2203 | p[size_in_chars - 1] &= (1 << (size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; | 2194 | p[size - 1] &= (1 << (size % BOOL_VECTOR_BITS_PER_CHAR)) - 1; |
| 2204 | } | 2195 | } |
| 2205 | } | 2196 | } |
| 2206 | else | 2197 | else |
| @@ -2214,7 +2205,7 @@ DEFUN ("clear-string", Fclear_string, Sclear_string, | |||
| 2214 | This makes STRING unibyte and may change its length. */) | 2205 | This makes STRING unibyte and may change its length. */) |
| 2215 | (Lisp_Object string) | 2206 | (Lisp_Object string) |
| 2216 | { | 2207 | { |
| 2217 | EMACS_INT len; | 2208 | ptrdiff_t len; |
| 2218 | CHECK_STRING (string); | 2209 | CHECK_STRING (string); |
| 2219 | len = SBYTES (string); | 2210 | len = SBYTES (string); |
| 2220 | memset (SDATA (string), 0, len); | 2211 | memset (SDATA (string), 0, len); |
| @@ -2324,12 +2315,12 @@ mapcar1 (EMACS_INT leni, Lisp_Object *vals, Lisp_Object fn, Lisp_Object seq) | |||
| 2324 | } | 2315 | } |
| 2325 | else if (STRINGP (seq)) | 2316 | else if (STRINGP (seq)) |
| 2326 | { | 2317 | { |
| 2327 | EMACS_INT i_byte; | 2318 | ptrdiff_t i_byte; |
| 2328 | 2319 | ||
| 2329 | for (i = 0, i_byte = 0; i < leni;) | 2320 | for (i = 0, i_byte = 0; i < leni;) |
| 2330 | { | 2321 | { |
| 2331 | int c; | 2322 | int c; |
| 2332 | EMACS_INT i_before = i; | 2323 | ptrdiff_t i_before = i; |
| 2333 | 2324 | ||
| 2334 | FETCH_STRING_CHAR_ADVANCE (c, seq, i, i_byte); | 2325 | FETCH_STRING_CHAR_ADVANCE (c, seq, i, i_byte); |
| 2335 | XSETFASTINT (dummy, c); | 2326 | XSETFASTINT (dummy, c); |
| @@ -2362,7 +2353,8 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string. */) | |||
| 2362 | { | 2353 | { |
| 2363 | Lisp_Object len; | 2354 | Lisp_Object len; |
| 2364 | register EMACS_INT leni; | 2355 | register EMACS_INT leni; |
| 2365 | ptrdiff_t i, nargs; | 2356 | EMACS_INT nargs; |
| 2357 | ptrdiff_t i; | ||
| 2366 | register Lisp_Object *args; | 2358 | register Lisp_Object *args; |
| 2367 | struct gcpro gcpro1; | 2359 | struct gcpro gcpro1; |
| 2368 | Lisp_Object ret; | 2360 | Lisp_Object ret; |
| @@ -2649,7 +2641,7 @@ The normal messages at start and end of loading FILENAME are suppressed. */) | |||
| 2649 | 2641 | ||
| 2650 | if (NILP (tem)) | 2642 | if (NILP (tem)) |
| 2651 | { | 2643 | { |
| 2652 | int count = SPECPDL_INDEX (); | 2644 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2653 | int nesting = 0; | 2645 | int nesting = 0; |
| 2654 | 2646 | ||
| 2655 | /* This is to make sure that loadup.el gives a clear picture | 2647 | /* This is to make sure that loadup.el gives a clear picture |
| @@ -2952,9 +2944,9 @@ static const short base64_char_to_value[128] = | |||
| 2952 | base64 characters. */ | 2944 | base64 characters. */ |
| 2953 | 2945 | ||
| 2954 | 2946 | ||
| 2955 | static EMACS_INT base64_encode_1 (const char *, char *, EMACS_INT, int, int); | 2947 | static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int); |
| 2956 | static EMACS_INT base64_decode_1 (const char *, char *, EMACS_INT, int, | 2948 | static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int, |
| 2957 | EMACS_INT *); | 2949 | ptrdiff_t *); |
| 2958 | 2950 | ||
| 2959 | DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region, | 2951 | DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region, |
| 2960 | 2, 3, "r", | 2952 | 2, 3, "r", |
| @@ -2965,9 +2957,9 @@ into shorter lines. */) | |||
| 2965 | (Lisp_Object beg, Lisp_Object end, Lisp_Object no_line_break) | 2957 | (Lisp_Object beg, Lisp_Object end, Lisp_Object no_line_break) |
| 2966 | { | 2958 | { |
| 2967 | char *encoded; | 2959 | char *encoded; |
| 2968 | EMACS_INT allength, length; | 2960 | ptrdiff_t allength, length; |
| 2969 | EMACS_INT ibeg, iend, encoded_length; | 2961 | ptrdiff_t ibeg, iend, encoded_length; |
| 2970 | EMACS_INT old_pos = PT; | 2962 | ptrdiff_t old_pos = PT; |
| 2971 | USE_SAFE_ALLOCA; | 2963 | USE_SAFE_ALLOCA; |
| 2972 | 2964 | ||
| 2973 | validate_region (&beg, &end); | 2965 | validate_region (&beg, &end); |
| @@ -3023,7 +3015,7 @@ Optional second argument NO-LINE-BREAK means do not break long lines | |||
| 3023 | into shorter lines. */) | 3015 | into shorter lines. */) |
| 3024 | (Lisp_Object string, Lisp_Object no_line_break) | 3016 | (Lisp_Object string, Lisp_Object no_line_break) |
| 3025 | { | 3017 | { |
| 3026 | EMACS_INT allength, length, encoded_length; | 3018 | ptrdiff_t allength, length, encoded_length; |
| 3027 | char *encoded; | 3019 | char *encoded; |
| 3028 | Lisp_Object encoded_string; | 3020 | Lisp_Object encoded_string; |
| 3029 | USE_SAFE_ALLOCA; | 3021 | USE_SAFE_ALLOCA; |
| @@ -3059,12 +3051,12 @@ into shorter lines. */) | |||
| 3059 | return encoded_string; | 3051 | return encoded_string; |
| 3060 | } | 3052 | } |
| 3061 | 3053 | ||
| 3062 | static EMACS_INT | 3054 | static ptrdiff_t |
| 3063 | base64_encode_1 (const char *from, char *to, EMACS_INT length, | 3055 | base64_encode_1 (const char *from, char *to, ptrdiff_t length, |
| 3064 | int line_break, int multibyte) | 3056 | int line_break, int multibyte) |
| 3065 | { | 3057 | { |
| 3066 | int counter = 0; | 3058 | int counter = 0; |
| 3067 | EMACS_INT i = 0; | 3059 | ptrdiff_t i = 0; |
| 3068 | char *e = to; | 3060 | char *e = to; |
| 3069 | int c; | 3061 | int c; |
| 3070 | unsigned int value; | 3062 | unsigned int value; |
| @@ -3163,11 +3155,11 @@ Return the length of the decoded text. | |||
| 3163 | If the region can't be decoded, signal an error and don't modify the buffer. */) | 3155 | If the region can't be decoded, signal an error and don't modify the buffer. */) |
| 3164 | (Lisp_Object beg, Lisp_Object end) | 3156 | (Lisp_Object beg, Lisp_Object end) |
| 3165 | { | 3157 | { |
| 3166 | EMACS_INT ibeg, iend, length, allength; | 3158 | ptrdiff_t ibeg, iend, length, allength; |
| 3167 | char *decoded; | 3159 | char *decoded; |
| 3168 | EMACS_INT old_pos = PT; | 3160 | ptrdiff_t old_pos = PT; |
| 3169 | EMACS_INT decoded_length; | 3161 | ptrdiff_t decoded_length; |
| 3170 | EMACS_INT inserted_chars; | 3162 | ptrdiff_t inserted_chars; |
| 3171 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3163 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3172 | USE_SAFE_ALLOCA; | 3164 | USE_SAFE_ALLOCA; |
| 3173 | 3165 | ||
| @@ -3225,7 +3217,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, | |||
| 3225 | (Lisp_Object string) | 3217 | (Lisp_Object string) |
| 3226 | { | 3218 | { |
| 3227 | char *decoded; | 3219 | char *decoded; |
| 3228 | EMACS_INT length, decoded_length; | 3220 | ptrdiff_t length, decoded_length; |
| 3229 | Lisp_Object decoded_string; | 3221 | Lisp_Object decoded_string; |
| 3230 | USE_SAFE_ALLOCA; | 3222 | USE_SAFE_ALLOCA; |
| 3231 | 3223 | ||
| @@ -3257,15 +3249,15 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, | |||
| 3257 | form. If NCHARS_RETRUN is not NULL, store the number of produced | 3249 | form. If NCHARS_RETRUN is not NULL, store the number of produced |
| 3258 | characters in *NCHARS_RETURN. */ | 3250 | characters in *NCHARS_RETURN. */ |
| 3259 | 3251 | ||
| 3260 | static EMACS_INT | 3252 | static ptrdiff_t |
| 3261 | base64_decode_1 (const char *from, char *to, EMACS_INT length, | 3253 | base64_decode_1 (const char *from, char *to, ptrdiff_t length, |
| 3262 | int multibyte, EMACS_INT *nchars_return) | 3254 | int multibyte, ptrdiff_t *nchars_return) |
| 3263 | { | 3255 | { |
| 3264 | EMACS_INT i = 0; /* Used inside READ_QUADRUPLET_BYTE */ | 3256 | ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */ |
| 3265 | char *e = to; | 3257 | char *e = to; |
| 3266 | unsigned char c; | 3258 | unsigned char c; |
| 3267 | unsigned long value; | 3259 | unsigned long value; |
| 3268 | EMACS_INT nchars = 0; | 3260 | ptrdiff_t nchars = 0; |
| 3269 | 3261 | ||
| 3270 | while (1) | 3262 | while (1) |
| 3271 | { | 3263 | { |
| @@ -3432,23 +3424,31 @@ get_key_arg (Lisp_Object key, ptrdiff_t nargs, Lisp_Object *args, char *used) | |||
| 3432 | 3424 | ||
| 3433 | 3425 | ||
| 3434 | /* Return a Lisp vector which has the same contents as VEC but has | 3426 | /* Return a Lisp vector which has the same contents as VEC but has |
| 3435 | size NEW_SIZE, NEW_SIZE >= VEC->size. Entries in the resulting | 3427 | at least INCR_MIN more entries, where INCR_MIN is positive. |
| 3436 | vector that are not copied from VEC are set to INIT. */ | 3428 | If NITEMS_MAX is not -1, do not grow the vector to be any larger |
| 3429 | than NITEMS_MAX. Entries in the resulting | ||
| 3430 | vector that are not copied from VEC are set to nil. */ | ||
| 3437 | 3431 | ||
| 3438 | Lisp_Object | 3432 | Lisp_Object |
| 3439 | larger_vector (Lisp_Object vec, EMACS_INT new_size, Lisp_Object init) | 3433 | larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t size_max) |
| 3440 | { | 3434 | { |
| 3441 | struct Lisp_Vector *v; | 3435 | struct Lisp_Vector *v; |
| 3442 | EMACS_INT i, old_size; | 3436 | ptrdiff_t i, incr, incr_max, old_size, new_size; |
| 3443 | 3437 | ptrdiff_t C_language_max = min (PTRDIFF_MAX, SIZE_MAX) / sizeof *v->contents; | |
| 3438 | ptrdiff_t n_max = (0 <= size_max && size_max < C_language_max | ||
| 3439 | ? size_max : C_language_max); | ||
| 3444 | xassert (VECTORP (vec)); | 3440 | xassert (VECTORP (vec)); |
| 3441 | xassert (0 < incr_min && -1 <= size_max); | ||
| 3445 | old_size = ASIZE (vec); | 3442 | old_size = ASIZE (vec); |
| 3446 | xassert (new_size >= old_size); | 3443 | incr_max = n_max - old_size; |
| 3447 | 3444 | incr = max (incr_min, min (old_size >> 1, incr_max)); | |
| 3445 | if (incr_max < incr) | ||
| 3446 | memory_full (SIZE_MAX); | ||
| 3447 | new_size = old_size + incr; | ||
| 3448 | v = allocate_vector (new_size); | 3448 | v = allocate_vector (new_size); |
| 3449 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); | 3449 | memcpy (v->contents, XVECTOR (vec)->contents, old_size * sizeof *v->contents); |
| 3450 | for (i = old_size; i < new_size; ++i) | 3450 | for (i = old_size; i < new_size; ++i) |
| 3451 | v->contents[i] = init; | 3451 | v->contents[i] = Qnil; |
| 3452 | XSETVECTOR (vec, v); | 3452 | XSETVECTOR (vec, v); |
| 3453 | return vec; | 3453 | return vec; |
| 3454 | } | 3454 | } |
| @@ -3569,6 +3569,10 @@ hashfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 3569 | return XUINT (hash); | 3569 | return XUINT (hash); |
| 3570 | } | 3570 | } |
| 3571 | 3571 | ||
| 3572 | /* An upper bound on the size of a hash table index. It must fit in | ||
| 3573 | ptrdiff_t and be a valid Emacs fixnum. */ | ||
| 3574 | #define INDEX_SIZE_BOUND \ | ||
| 3575 | ((ptrdiff_t) min (MOST_POSITIVE_FIXNUM, PTRDIFF_MAX / sizeof (Lisp_Object))) | ||
| 3572 | 3576 | ||
| 3573 | /* Create and initialize a new hash table. | 3577 | /* Create and initialize a new hash table. |
| 3574 | 3578 | ||
| @@ -3599,7 +3603,8 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size, | |||
| 3599 | { | 3603 | { |
| 3600 | struct Lisp_Hash_Table *h; | 3604 | struct Lisp_Hash_Table *h; |
| 3601 | Lisp_Object table; | 3605 | Lisp_Object table; |
| 3602 | EMACS_INT index_size, i, sz; | 3606 | EMACS_INT index_size, sz; |
| 3607 | ptrdiff_t i; | ||
| 3603 | double index_float; | 3608 | double index_float; |
| 3604 | 3609 | ||
| 3605 | /* Preconditions. */ | 3610 | /* Preconditions. */ |
| @@ -3616,10 +3621,10 @@ make_hash_table (Lisp_Object test, Lisp_Object size, Lisp_Object rehash_size, | |||
| 3616 | 3621 | ||
| 3617 | sz = XFASTINT (size); | 3622 | sz = XFASTINT (size); |
| 3618 | index_float = sz / XFLOAT_DATA (rehash_threshold); | 3623 | index_float = sz / XFLOAT_DATA (rehash_threshold); |
| 3619 | index_size = (index_float < MOST_POSITIVE_FIXNUM + 1 | 3624 | index_size = (index_float < INDEX_SIZE_BOUND + 1 |
| 3620 | ? next_almost_prime (index_float) | 3625 | ? next_almost_prime (index_float) |
| 3621 | : MOST_POSITIVE_FIXNUM + 1); | 3626 | : INDEX_SIZE_BOUND + 1); |
| 3622 | if (MOST_POSITIVE_FIXNUM < max (index_size, 2 * sz)) | 3627 | if (INDEX_SIZE_BOUND < max (index_size, 2 * sz)) |
| 3623 | error ("Hash table too large"); | 3628 | error ("Hash table too large"); |
| 3624 | 3629 | ||
| 3625 | /* Allocate a table and initialize it. */ | 3630 | /* Allocate a table and initialize it. */ |
| @@ -3720,9 +3725,9 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3720 | { | 3725 | { |
| 3721 | if (NILP (h->next_free)) | 3726 | if (NILP (h->next_free)) |
| 3722 | { | 3727 | { |
| 3723 | EMACS_INT old_size = HASH_TABLE_SIZE (h); | 3728 | ptrdiff_t old_size = HASH_TABLE_SIZE (h); |
| 3724 | EMACS_INT i, new_size, index_size; | 3729 | EMACS_INT new_size, index_size, nsize; |
| 3725 | EMACS_INT nsize; | 3730 | ptrdiff_t i; |
| 3726 | double index_float; | 3731 | double index_float; |
| 3727 | 3732 | ||
| 3728 | if (INTEGERP (h->rehash_size)) | 3733 | if (INTEGERP (h->rehash_size)) |
| @@ -3730,26 +3735,27 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3730 | else | 3735 | else |
| 3731 | { | 3736 | { |
| 3732 | double float_new_size = old_size * XFLOAT_DATA (h->rehash_size); | 3737 | double float_new_size = old_size * XFLOAT_DATA (h->rehash_size); |
| 3733 | if (float_new_size < MOST_POSITIVE_FIXNUM + 1) | 3738 | if (float_new_size < INDEX_SIZE_BOUND + 1) |
| 3734 | { | 3739 | { |
| 3735 | new_size = float_new_size; | 3740 | new_size = float_new_size; |
| 3736 | if (new_size <= old_size) | 3741 | if (new_size <= old_size) |
| 3737 | new_size = old_size + 1; | 3742 | new_size = old_size + 1; |
| 3738 | } | 3743 | } |
| 3739 | else | 3744 | else |
| 3740 | new_size = MOST_POSITIVE_FIXNUM + 1; | 3745 | new_size = INDEX_SIZE_BOUND + 1; |
| 3741 | } | 3746 | } |
| 3742 | index_float = new_size / XFLOAT_DATA (h->rehash_threshold); | 3747 | index_float = new_size / XFLOAT_DATA (h->rehash_threshold); |
| 3743 | index_size = (index_float < MOST_POSITIVE_FIXNUM + 1 | 3748 | index_size = (index_float < INDEX_SIZE_BOUND + 1 |
| 3744 | ? next_almost_prime (index_float) | 3749 | ? next_almost_prime (index_float) |
| 3745 | : MOST_POSITIVE_FIXNUM + 1); | 3750 | : INDEX_SIZE_BOUND + 1); |
| 3746 | nsize = max (index_size, 2 * new_size); | 3751 | nsize = max (index_size, 2 * new_size); |
| 3747 | if (nsize > MOST_POSITIVE_FIXNUM) | 3752 | if (INDEX_SIZE_BOUND < nsize) |
| 3748 | error ("Hash table too large to resize"); | 3753 | error ("Hash table too large to resize"); |
| 3749 | 3754 | ||
| 3750 | h->key_and_value = larger_vector (h->key_and_value, 2 * new_size, Qnil); | 3755 | h->key_and_value = larger_vector (h->key_and_value, |
| 3751 | h->next = larger_vector (h->next, new_size, Qnil); | 3756 | 2 * (new_size - old_size), -1); |
| 3752 | h->hash = larger_vector (h->hash, new_size, Qnil); | 3757 | h->next = larger_vector (h->next, new_size - old_size, -1); |
| 3758 | h->hash = larger_vector (h->hash, new_size - old_size, -1); | ||
| 3753 | h->index = Fmake_vector (make_number (index_size), Qnil); | 3759 | h->index = Fmake_vector (make_number (index_size), Qnil); |
| 3754 | 3760 | ||
| 3755 | /* Update the free list. Do it so that new entries are added at | 3761 | /* Update the free list. Do it so that new entries are added at |
| @@ -3777,7 +3783,7 @@ maybe_resize_hash_table (struct Lisp_Hash_Table *h) | |||
| 3777 | if (!NILP (HASH_HASH (h, i))) | 3783 | if (!NILP (HASH_HASH (h, i))) |
| 3778 | { | 3784 | { |
| 3779 | EMACS_UINT hash_code = XUINT (HASH_HASH (h, i)); | 3785 | EMACS_UINT hash_code = XUINT (HASH_HASH (h, i)); |
| 3780 | EMACS_INT start_of_bucket = hash_code % ASIZE (h->index); | 3786 | ptrdiff_t start_of_bucket = hash_code % ASIZE (h->index); |
| 3781 | HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); | 3787 | HASH_NEXT (h, i) = HASH_INDEX (h, start_of_bucket); |
| 3782 | HASH_INDEX (h, start_of_bucket) = make_number (i); | 3788 | HASH_INDEX (h, start_of_bucket) = make_number (i); |
| 3783 | } | 3789 | } |
| @@ -3806,7 +3812,7 @@ hash_lookup (struct Lisp_Hash_Table *h, Lisp_Object key, EMACS_UINT *hash) | |||
| 3806 | /* We need not gcpro idx since it's either an integer or nil. */ | 3812 | /* We need not gcpro idx since it's either an integer or nil. */ |
| 3807 | while (!NILP (idx)) | 3813 | while (!NILP (idx)) |
| 3808 | { | 3814 | { |
| 3809 | EMACS_INT i = XFASTINT (idx); | 3815 | ptrdiff_t i = XFASTINT (idx); |
| 3810 | if (EQ (key, HASH_KEY (h, i)) | 3816 | if (EQ (key, HASH_KEY (h, i)) |
| 3811 | || (h->cmpfn | 3817 | || (h->cmpfn |
| 3812 | && h->cmpfn (h, key, hash_code, | 3818 | && h->cmpfn (h, key, hash_code, |
| @@ -3858,7 +3864,7 @@ static void | |||
| 3858 | hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) | 3864 | hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) |
| 3859 | { | 3865 | { |
| 3860 | EMACS_UINT hash_code; | 3866 | EMACS_UINT hash_code; |
| 3861 | EMACS_INT start_of_bucket; | 3867 | ptrdiff_t start_of_bucket; |
| 3862 | Lisp_Object idx, prev; | 3868 | Lisp_Object idx, prev; |
| 3863 | 3869 | ||
| 3864 | hash_code = h->hashfn (h, key); | 3870 | hash_code = h->hashfn (h, key); |
| @@ -3869,7 +3875,7 @@ hash_remove_from_table (struct Lisp_Hash_Table *h, Lisp_Object key) | |||
| 3869 | /* We need not gcpro idx, prev since they're either integers or nil. */ | 3875 | /* We need not gcpro idx, prev since they're either integers or nil. */ |
| 3870 | while (!NILP (idx)) | 3876 | while (!NILP (idx)) |
| 3871 | { | 3877 | { |
| 3872 | EMACS_INT i = XFASTINT (idx); | 3878 | ptrdiff_t i = XFASTINT (idx); |
| 3873 | 3879 | ||
| 3874 | if (EQ (key, HASH_KEY (h, i)) | 3880 | if (EQ (key, HASH_KEY (h, i)) |
| 3875 | || (h->cmpfn | 3881 | || (h->cmpfn |
| @@ -3907,7 +3913,7 @@ hash_clear (struct Lisp_Hash_Table *h) | |||
| 3907 | { | 3913 | { |
| 3908 | if (h->count > 0) | 3914 | if (h->count > 0) |
| 3909 | { | 3915 | { |
| 3910 | EMACS_INT i, size = HASH_TABLE_SIZE (h); | 3916 | ptrdiff_t i, size = HASH_TABLE_SIZE (h); |
| 3911 | 3917 | ||
| 3912 | for (i = 0; i < size; ++i) | 3918 | for (i = 0; i < size; ++i) |
| 3913 | { | 3919 | { |
| @@ -3945,7 +3951,7 @@ init_weak_hash_tables (void) | |||
| 3945 | static int | 3951 | static int |
| 3946 | sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) | 3952 | sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) |
| 3947 | { | 3953 | { |
| 3948 | EMACS_INT bucket, n; | 3954 | ptrdiff_t bucket, n; |
| 3949 | int marked; | 3955 | int marked; |
| 3950 | 3956 | ||
| 3951 | n = ASIZE (h->index) & ~ARRAY_MARK_FLAG; | 3957 | n = ASIZE (h->index) & ~ARRAY_MARK_FLAG; |
| @@ -3960,7 +3966,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) | |||
| 3960 | prev = Qnil; | 3966 | prev = Qnil; |
| 3961 | for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) | 3967 | for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) |
| 3962 | { | 3968 | { |
| 3963 | EMACS_INT i = XFASTINT (idx); | 3969 | ptrdiff_t i = XFASTINT (idx); |
| 3964 | int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); | 3970 | int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); |
| 3965 | int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); | 3971 | int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); |
| 3966 | int remove_p; | 3972 | int remove_p; |
| @@ -4526,7 +4532,7 @@ FUNCTION is called with two arguments, KEY and VALUE. */) | |||
| 4526 | { | 4532 | { |
| 4527 | struct Lisp_Hash_Table *h = check_hash_table (table); | 4533 | struct Lisp_Hash_Table *h = check_hash_table (table); |
| 4528 | Lisp_Object args[3]; | 4534 | Lisp_Object args[3]; |
| 4529 | EMACS_INT i; | 4535 | ptrdiff_t i; |
| 4530 | 4536 | ||
| 4531 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 4537 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 4532 | if (!NILP (HASH_HASH (h, i))) | 4538 | if (!NILP (HASH_HASH (h, i))) |
| @@ -4575,10 +4581,9 @@ static Lisp_Object | |||
| 4575 | secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary) | 4581 | secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary) |
| 4576 | { | 4582 | { |
| 4577 | int i; | 4583 | int i; |
| 4578 | EMACS_INT size; | 4584 | ptrdiff_t size; |
| 4579 | EMACS_INT size_byte = 0; | ||
| 4580 | EMACS_INT start_char = 0, end_char = 0; | 4585 | EMACS_INT start_char = 0, end_char = 0; |
| 4581 | EMACS_INT start_byte = 0, end_byte = 0; | 4586 | ptrdiff_t start_byte, end_byte; |
| 4582 | register EMACS_INT b, e; | 4587 | register EMACS_INT b, e; |
| 4583 | register struct buffer *bp; | 4588 | register struct buffer *bp; |
| 4584 | EMACS_INT temp; | 4589 | EMACS_INT temp; |
| @@ -4615,7 +4620,6 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4615 | object = code_convert_string (object, coding_system, Qnil, 1, 0, 1); | 4620 | object = code_convert_string (object, coding_system, Qnil, 1, 0, 1); |
| 4616 | 4621 | ||
| 4617 | size = SCHARS (object); | 4622 | size = SCHARS (object); |
| 4618 | size_byte = SBYTES (object); | ||
| 4619 | 4623 | ||
| 4620 | if (!NILP (start)) | 4624 | if (!NILP (start)) |
| 4621 | { | 4625 | { |
| @@ -4625,15 +4629,10 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4625 | 4629 | ||
| 4626 | if (start_char < 0) | 4630 | if (start_char < 0) |
| 4627 | start_char += size; | 4631 | start_char += size; |
| 4628 | |||
| 4629 | start_byte = string_char_to_byte (object, start_char); | ||
| 4630 | } | 4632 | } |
| 4631 | 4633 | ||
| 4632 | if (NILP (end)) | 4634 | if (NILP (end)) |
| 4633 | { | 4635 | end_char = size; |
| 4634 | end_char = size; | ||
| 4635 | end_byte = size_byte; | ||
| 4636 | } | ||
| 4637 | else | 4636 | else |
| 4638 | { | 4637 | { |
| 4639 | CHECK_NUMBER (end); | 4638 | CHECK_NUMBER (end); |
| @@ -4642,13 +4641,15 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4642 | 4641 | ||
| 4643 | if (end_char < 0) | 4642 | if (end_char < 0) |
| 4644 | end_char += size; | 4643 | end_char += size; |
| 4645 | |||
| 4646 | end_byte = string_char_to_byte (object, end_char); | ||
| 4647 | } | 4644 | } |
| 4648 | 4645 | ||
| 4649 | if (!(0 <= start_char && start_char <= end_char && end_char <= size)) | 4646 | if (!(0 <= start_char && start_char <= end_char && end_char <= size)) |
| 4650 | args_out_of_range_3 (object, make_number (start_char), | 4647 | args_out_of_range_3 (object, make_number (start_char), |
| 4651 | make_number (end_char)); | 4648 | make_number (end_char)); |
| 4649 | |||
| 4650 | start_byte = NILP (start) ? 0 : string_char_to_byte (object, start_char); | ||
| 4651 | end_byte = | ||
| 4652 | NILP (end) ? SBYTES (object) : string_char_to_byte (object, end_char); | ||
| 4652 | } | 4653 | } |
| 4653 | else | 4654 | else |
| 4654 | { | 4655 | { |
| @@ -4755,6 +4756,8 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4755 | 4756 | ||
| 4756 | if (STRING_MULTIBYTE (object)) | 4757 | if (STRING_MULTIBYTE (object)) |
| 4757 | object = code_convert_string (object, coding_system, Qnil, 1, 0, 0); | 4758 | object = code_convert_string (object, coding_system, Qnil, 1, 0, 0); |
| 4759 | start_byte = 0; | ||
| 4760 | end_byte = SBYTES (object); | ||
| 4758 | } | 4761 | } |
| 4759 | 4762 | ||
| 4760 | if (EQ (algorithm, Qmd5)) | 4763 | if (EQ (algorithm, Qmd5)) |
| @@ -4795,7 +4798,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ | |||
| 4795 | digest = make_uninit_string (digest_size * 2); | 4798 | digest = make_uninit_string (digest_size * 2); |
| 4796 | 4799 | ||
| 4797 | hash_func (SSDATA (object) + start_byte, | 4800 | hash_func (SSDATA (object) + start_byte, |
| 4798 | SBYTES (object) - (size_byte - end_byte), | 4801 | end_byte - start_byte, |
| 4799 | SSDATA (digest)); | 4802 | SSDATA (digest)); |
| 4800 | 4803 | ||
| 4801 | if (NILP (binary)) | 4804 | if (NILP (binary)) |
diff --git a/src/font.c b/src/font.c index 1a4742ba959..30c39771fd6 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -238,7 +238,7 @@ font_intern_prop (const char *str, ptrdiff_t len, int force_symbol) | |||
| 238 | ptrdiff_t i; | 238 | ptrdiff_t i; |
| 239 | Lisp_Object tem; | 239 | Lisp_Object tem; |
| 240 | Lisp_Object obarray; | 240 | Lisp_Object obarray; |
| 241 | EMACS_INT nbytes, nchars; | 241 | ptrdiff_t nbytes, nchars; |
| 242 | 242 | ||
| 243 | if (len == 1 && *str == '*') | 243 | if (len == 1 && *str == '*') |
| 244 | return Qnil; | 244 | return Qnil; |
| @@ -364,7 +364,7 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror | |||
| 364 | else | 364 | else |
| 365 | { | 365 | { |
| 366 | int i, last_n; | 366 | int i, last_n; |
| 367 | int numeric = XINT (val); | 367 | EMACS_INT numeric = XINT (val); |
| 368 | 368 | ||
| 369 | for (i = 0, last_n = -1; i < len; i++) | 369 | for (i = 0, last_n = -1; i < len; i++) |
| 370 | { | 370 | { |
| @@ -518,7 +518,7 @@ font_prop_validate_style (Lisp_Object style, Lisp_Object val) | |||
| 518 | : FONT_WIDTH_INDEX); | 518 | : FONT_WIDTH_INDEX); |
| 519 | if (INTEGERP (val)) | 519 | if (INTEGERP (val)) |
| 520 | { | 520 | { |
| 521 | int n = XINT (val); | 521 | EMACS_INT n = XINT (val); |
| 522 | if (((n >> 4) & 0xF) | 522 | if (((n >> 4) & 0xF) |
| 523 | >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) | 523 | >= ASIZE (AREF (font_style_table, prop - FONT_WEIGHT_INDEX))) |
| 524 | val = Qerror; | 524 | val = Qerror; |
| @@ -848,7 +848,7 @@ font_expand_wildcards (Lisp_Object *field, int n) | |||
| 848 | 848 | ||
| 849 | if (INTEGERP (val)) | 849 | if (INTEGERP (val)) |
| 850 | { | 850 | { |
| 851 | int numeric = XINT (val); | 851 | EMACS_INT numeric = XINT (val); |
| 852 | 852 | ||
| 853 | if (i + 1 == n) | 853 | if (i + 1 == n) |
| 854 | from = to = XLFD_ENCODING_INDEX, | 854 | from = to = XLFD_ENCODING_INDEX, |
| @@ -1740,7 +1740,8 @@ static int | |||
| 1740 | check_gstring (Lisp_Object gstring) | 1740 | check_gstring (Lisp_Object gstring) |
| 1741 | { | 1741 | { |
| 1742 | Lisp_Object val; | 1742 | Lisp_Object val; |
| 1743 | int i, j; | 1743 | ptrdiff_t i; |
| 1744 | int j; | ||
| 1744 | 1745 | ||
| 1745 | CHECK_VECTOR (gstring); | 1746 | CHECK_VECTOR (gstring); |
| 1746 | val = AREF (gstring, 0); | 1747 | val = AREF (gstring, 0); |
| @@ -2433,7 +2434,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font) | |||
| 2433 | /* All characters in the list must be supported. */ | 2434 | /* All characters in the list must be supported. */ |
| 2434 | for (; CONSP (val2); val2 = XCDR (val2)) | 2435 | for (; CONSP (val2); val2 = XCDR (val2)) |
| 2435 | { | 2436 | { |
| 2436 | if (! NATNUMP (XCAR (val2))) | 2437 | if (! CHARACTERP (XCAR (val2))) |
| 2437 | continue; | 2438 | continue; |
| 2438 | if (font_encode_char (font, XFASTINT (XCAR (val2))) | 2439 | if (font_encode_char (font, XFASTINT (XCAR (val2))) |
| 2439 | == FONT_INVALID_CODE) | 2440 | == FONT_INVALID_CODE) |
| @@ -2445,7 +2446,7 @@ font_match_p (Lisp_Object spec, Lisp_Object font) | |||
| 2445 | /* At most one character in the vector must be supported. */ | 2446 | /* At most one character in the vector must be supported. */ |
| 2446 | for (i = 0; i < ASIZE (val2); i++) | 2447 | for (i = 0; i < ASIZE (val2); i++) |
| 2447 | { | 2448 | { |
| 2448 | if (! NATNUMP (AREF (val2, i))) | 2449 | if (! CHARACTERP (AREF (val2, i))) |
| 2449 | continue; | 2450 | continue; |
| 2450 | if (font_encode_char (font, XFASTINT (AREF (val2, i))) | 2451 | if (font_encode_char (font, XFASTINT (AREF (val2, i))) |
| 2451 | != FONT_INVALID_CODE) | 2452 | != FONT_INVALID_CODE) |
| @@ -3076,6 +3077,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) | |||
| 3076 | Lisp_Object foundry[3], *family, registry[3], adstyle[3]; | 3077 | Lisp_Object foundry[3], *family, registry[3], adstyle[3]; |
| 3077 | int pixel_size; | 3078 | int pixel_size; |
| 3078 | int i, j, k, l; | 3079 | int i, j, k, l; |
| 3080 | USE_SAFE_ALLOCA; | ||
| 3079 | 3081 | ||
| 3080 | registry[0] = AREF (spec, FONT_REGISTRY_INDEX); | 3082 | registry[0] = AREF (spec, FONT_REGISTRY_INDEX); |
| 3081 | if (NILP (registry[0])) | 3083 | if (NILP (registry[0])) |
| @@ -3171,7 +3173,8 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) | |||
| 3171 | 3173 | ||
| 3172 | if (! NILP (alters)) | 3174 | if (! NILP (alters)) |
| 3173 | { | 3175 | { |
| 3174 | family = alloca ((sizeof family[0]) * (XINT (Flength (alters)) + 2)); | 3176 | EMACS_INT alterslen = XFASTINT (Flength (alters)); |
| 3177 | SAFE_ALLOCA_LISP (family, alterslen + 2); | ||
| 3175 | for (i = 0; CONSP (alters); i++, alters = XCDR (alters)) | 3178 | for (i = 0; CONSP (alters); i++, alters = XCDR (alters)) |
| 3176 | family[i] = XCAR (alters); | 3179 | family[i] = XCAR (alters); |
| 3177 | if (NILP (AREF (spec, FONT_FAMILY_INDEX))) | 3180 | if (NILP (AREF (spec, FONT_FAMILY_INDEX))) |
| @@ -3213,6 +3216,8 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) | |||
| 3213 | } | 3216 | } |
| 3214 | } | 3217 | } |
| 3215 | } | 3218 | } |
| 3219 | |||
| 3220 | SAFE_FREE (); | ||
| 3216 | return Qnil; | 3221 | return Qnil; |
| 3217 | } | 3222 | } |
| 3218 | 3223 | ||
| @@ -3611,7 +3616,7 @@ font_filter_properties (Lisp_Object font, | |||
| 3611 | STRING. */ | 3616 | STRING. */ |
| 3612 | 3617 | ||
| 3613 | static Lisp_Object | 3618 | static Lisp_Object |
| 3614 | font_at (int c, EMACS_INT pos, struct face *face, struct window *w, | 3619 | font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, |
| 3615 | Lisp_Object string) | 3620 | Lisp_Object string) |
| 3616 | { | 3621 | { |
| 3617 | FRAME_PTR f; | 3622 | FRAME_PTR f; |
| @@ -3627,7 +3632,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w, | |||
| 3627 | { | 3632 | { |
| 3628 | if (multibyte) | 3633 | if (multibyte) |
| 3629 | { | 3634 | { |
| 3630 | EMACS_INT pos_byte = CHAR_TO_BYTE (pos); | 3635 | ptrdiff_t pos_byte = CHAR_TO_BYTE (pos); |
| 3631 | 3636 | ||
| 3632 | c = FETCH_CHAR (pos_byte); | 3637 | c = FETCH_CHAR (pos_byte); |
| 3633 | } | 3638 | } |
| @@ -3641,7 +3646,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w, | |||
| 3641 | multibyte = STRING_MULTIBYTE (string); | 3646 | multibyte = STRING_MULTIBYTE (string); |
| 3642 | if (multibyte) | 3647 | if (multibyte) |
| 3643 | { | 3648 | { |
| 3644 | EMACS_INT pos_byte = string_char_to_byte (string, pos); | 3649 | ptrdiff_t pos_byte = string_char_to_byte (string, pos); |
| 3645 | 3650 | ||
| 3646 | str = SDATA (string) + pos_byte; | 3651 | str = SDATA (string) + pos_byte; |
| 3647 | c = STRING_CHAR (str); | 3652 | c = STRING_CHAR (str); |
| @@ -3657,7 +3662,7 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w, | |||
| 3657 | if (! face) | 3662 | if (! face) |
| 3658 | { | 3663 | { |
| 3659 | int face_id; | 3664 | int face_id; |
| 3660 | EMACS_INT endptr; | 3665 | ptrdiff_t endptr; |
| 3661 | 3666 | ||
| 3662 | if (STRINGP (string)) | 3667 | if (STRINGP (string)) |
| 3663 | face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, | 3668 | face_id = face_at_string_position (w, string, pos, 0, -1, -1, &endptr, |
| @@ -3694,9 +3699,9 @@ font_at (int c, EMACS_INT pos, struct face *face, struct window *w, | |||
| 3694 | It is assured that the current buffer (or STRING) is multibyte. */ | 3699 | It is assured that the current buffer (or STRING) is multibyte. */ |
| 3695 | 3700 | ||
| 3696 | Lisp_Object | 3701 | Lisp_Object |
| 3697 | font_range (EMACS_INT pos, EMACS_INT *limit, struct window *w, struct face *face, Lisp_Object string) | 3702 | font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face, Lisp_Object string) |
| 3698 | { | 3703 | { |
| 3699 | EMACS_INT pos_byte, ignore; | 3704 | ptrdiff_t pos_byte, ignore; |
| 3700 | int c; | 3705 | int c; |
| 3701 | Lisp_Object font_object = Qnil; | 3706 | Lisp_Object font_object = Qnil; |
| 3702 | 3707 | ||
| @@ -4102,7 +4107,7 @@ how close they are to PREFER. */) | |||
| 4102 | (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) | 4107 | (Lisp_Object font_spec, Lisp_Object frame, Lisp_Object num, Lisp_Object prefer) |
| 4103 | { | 4108 | { |
| 4104 | Lisp_Object vec, list; | 4109 | Lisp_Object vec, list; |
| 4105 | int n = 0; | 4110 | EMACS_INT n = 0; |
| 4106 | 4111 | ||
| 4107 | if (NILP (frame)) | 4112 | if (NILP (frame)) |
| 4108 | frame = selected_frame; | 4113 | frame = selected_frame; |
| @@ -4269,13 +4274,10 @@ void | |||
| 4269 | font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object) | 4274 | font_fill_lglyph_metrics (Lisp_Object glyph, Lisp_Object font_object) |
| 4270 | { | 4275 | { |
| 4271 | struct font *font = XFONT_OBJECT (font_object); | 4276 | struct font *font = XFONT_OBJECT (font_object); |
| 4272 | unsigned code; | 4277 | unsigned code = font->driver->encode_char (font, LGLYPH_CHAR (glyph)); |
| 4273 | /* ecode used in LGLYPH_SET_CODE to avoid compiler warnings. */ | ||
| 4274 | EMACS_INT ecode = font->driver->encode_char (font, LGLYPH_CHAR (glyph)); | ||
| 4275 | struct font_metrics metrics; | 4278 | struct font_metrics metrics; |
| 4276 | 4279 | ||
| 4277 | LGLYPH_SET_CODE (glyph, ecode); | 4280 | LGLYPH_SET_CODE (glyph, code); |
| 4278 | code = ecode; | ||
| 4279 | font->driver->text_extents (font, &code, 1, &metrics); | 4281 | font->driver->text_extents (font, &code, 1, &metrics); |
| 4280 | LGLYPH_SET_LBEARING (glyph, metrics.lbearing); | 4282 | LGLYPH_SET_LBEARING (glyph, metrics.lbearing); |
| 4281 | LGLYPH_SET_RBEARING (glyph, metrics.rbearing); | 4283 | LGLYPH_SET_RBEARING (glyph, metrics.rbearing); |
| @@ -4297,7 +4299,7 @@ created glyph-string. Otherwise, the value is nil. */) | |||
| 4297 | { | 4299 | { |
| 4298 | struct font *font; | 4300 | struct font *font; |
| 4299 | Lisp_Object font_object, n, glyph; | 4301 | Lisp_Object font_object, n, glyph; |
| 4300 | EMACS_INT i, j, from, to; | 4302 | ptrdiff_t i, j, from, to; |
| 4301 | 4303 | ||
| 4302 | if (! composition_gstring_p (gstring)) | 4304 | if (! composition_gstring_p (gstring)) |
| 4303 | signal_error ("Invalid glyph-string: ", gstring); | 4305 | signal_error ("Invalid glyph-string: ", gstring); |
| @@ -4316,8 +4318,7 @@ created glyph-string. Otherwise, the value is nil. */) | |||
| 4316 | if (INTEGERP (n)) | 4318 | if (INTEGERP (n)) |
| 4317 | break; | 4319 | break; |
| 4318 | gstring = larger_vector (gstring, | 4320 | gstring = larger_vector (gstring, |
| 4319 | ASIZE (gstring) + LGSTRING_GLYPH_LEN (gstring), | 4321 | LGSTRING_GLYPH_LEN (gstring), -1); |
| 4320 | Qnil); | ||
| 4321 | } | 4322 | } |
| 4322 | if (i == 3 || XINT (n) == 0) | 4323 | if (i == 3 || XINT (n) == 0) |
| 4323 | return Qnil; | 4324 | return Qnil; |
| @@ -4525,7 +4526,7 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |||
| 4525 | doc: /* Open FONT-ENTITY. */) | 4526 | doc: /* Open FONT-ENTITY. */) |
| 4526 | (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame) | 4527 | (Lisp_Object font_entity, Lisp_Object size, Lisp_Object frame) |
| 4527 | { | 4528 | { |
| 4528 | int isize; | 4529 | EMACS_INT isize; |
| 4529 | 4530 | ||
| 4530 | CHECK_FONT_ENTITY (font_entity); | 4531 | CHECK_FONT_ENTITY (font_entity); |
| 4531 | if (NILP (frame)) | 4532 | if (NILP (frame)) |
| @@ -4541,6 +4542,8 @@ DEFUN ("open-font", Fopen_font, Sopen_font, 1, 3, 0, | |||
| 4541 | isize = POINT_TO_PIXEL (XFLOAT_DATA (size), XFRAME (frame)->resy); | 4542 | isize = POINT_TO_PIXEL (XFLOAT_DATA (size), XFRAME (frame)->resy); |
| 4542 | else | 4543 | else |
| 4543 | isize = XINT (size); | 4544 | isize = XINT (size); |
| 4545 | if (! (INT_MIN <= isize && isize <= INT_MAX)) | ||
| 4546 | args_out_of_range (font_entity, size); | ||
| 4544 | if (isize == 0) | 4547 | if (isize == 0) |
| 4545 | isize = 120; | 4548 | isize = 120; |
| 4546 | } | 4549 | } |
| @@ -4644,14 +4647,14 @@ the corresponding element is nil. */) | |||
| 4644 | Lisp_Object object) | 4647 | Lisp_Object object) |
| 4645 | { | 4648 | { |
| 4646 | struct font *font; | 4649 | struct font *font; |
| 4647 | int i, len; | 4650 | ptrdiff_t i, len; |
| 4648 | Lisp_Object *chars, vec; | 4651 | Lisp_Object *chars, vec; |
| 4649 | USE_SAFE_ALLOCA; | 4652 | USE_SAFE_ALLOCA; |
| 4650 | 4653 | ||
| 4651 | CHECK_FONT_GET_OBJECT (font_object, font); | 4654 | CHECK_FONT_GET_OBJECT (font_object, font); |
| 4652 | if (NILP (object)) | 4655 | if (NILP (object)) |
| 4653 | { | 4656 | { |
| 4654 | EMACS_INT charpos, bytepos; | 4657 | ptrdiff_t charpos, bytepos; |
| 4655 | 4658 | ||
| 4656 | validate_region (&from, &to); | 4659 | validate_region (&from, &to); |
| 4657 | if (EQ (from, to)) | 4660 | if (EQ (from, to)) |
| @@ -4757,22 +4760,22 @@ the current buffer. It defaults to the currently selected window. */) | |||
| 4757 | (Lisp_Object position, Lisp_Object window, Lisp_Object string) | 4760 | (Lisp_Object position, Lisp_Object window, Lisp_Object string) |
| 4758 | { | 4761 | { |
| 4759 | struct window *w; | 4762 | struct window *w; |
| 4760 | EMACS_INT pos; | 4763 | ptrdiff_t pos; |
| 4761 | 4764 | ||
| 4762 | if (NILP (string)) | 4765 | if (NILP (string)) |
| 4763 | { | 4766 | { |
| 4764 | CHECK_NUMBER_COERCE_MARKER (position); | 4767 | CHECK_NUMBER_COERCE_MARKER (position); |
| 4765 | pos = XINT (position); | 4768 | if (! (BEGV <= XINT (position) && XINT (position) < ZV)) |
| 4766 | if (pos < BEGV || pos >= ZV) | ||
| 4767 | args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); | 4769 | args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); |
| 4770 | pos = XINT (position); | ||
| 4768 | } | 4771 | } |
| 4769 | else | 4772 | else |
| 4770 | { | 4773 | { |
| 4771 | CHECK_NUMBER (position); | 4774 | CHECK_NUMBER (position); |
| 4772 | CHECK_STRING (string); | 4775 | CHECK_STRING (string); |
| 4773 | pos = XINT (position); | 4776 | if (! (0 < XINT (position) && XINT (position) < SCHARS (string))) |
| 4774 | if (pos < 0 || pos >= SCHARS (string)) | ||
| 4775 | args_out_of_range (string, position); | 4777 | args_out_of_range (string, position); |
| 4778 | pos = XINT (position); | ||
| 4776 | } | 4779 | } |
| 4777 | if (NILP (window)) | 4780 | if (NILP (window)) |
| 4778 | window = selected_window; | 4781 | window = selected_window; |
diff --git a/src/font.h b/src/font.h index e50eaff9a1f..775c02b000f 100644 --- a/src/font.h +++ b/src/font.h | |||
| @@ -793,7 +793,7 @@ extern int font_unparse_fcname (Lisp_Object font, int pixel_size, | |||
| 793 | extern void register_font_driver (struct font_driver *driver, FRAME_PTR f); | 793 | extern void register_font_driver (struct font_driver *driver, FRAME_PTR f); |
| 794 | extern void free_font_driver_list (FRAME_PTR f); | 794 | extern void free_font_driver_list (FRAME_PTR f); |
| 795 | extern Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object list); | 795 | extern Lisp_Object font_update_drivers (FRAME_PTR f, Lisp_Object list); |
| 796 | extern Lisp_Object font_range (EMACS_INT, EMACS_INT *, | 796 | extern Lisp_Object font_range (ptrdiff_t, ptrdiff_t *, |
| 797 | struct window *, struct face *, | 797 | struct window *, struct face *, |
| 798 | Lisp_Object); | 798 | Lisp_Object); |
| 799 | extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object); | 799 | extern void font_fill_lglyph_metrics (Lisp_Object, Lisp_Object); |
diff --git a/src/fontset.c b/src/fontset.c index 74a25a1ca04..7730f2e4fa9 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -416,9 +416,11 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) | |||
| 416 | 416 | ||
| 417 | for (tail = Vcharset_ordered_list; | 417 | for (tail = Vcharset_ordered_list; |
| 418 | ! EQ (tail, Vcharset_non_preferred_head) && CONSP (tail); | 418 | ! EQ (tail, Vcharset_non_preferred_head) && CONSP (tail); |
| 419 | score += 0x100, tail = XCDR (tail)) | 419 | tail = XCDR (tail)) |
| 420 | if (EQ (encoding, XCAR (tail))) | 420 | if (EQ (encoding, XCAR (tail))) |
| 421 | break; | 421 | break; |
| 422 | else if (score <= MIN (INT_MAX, MOST_POSITIVE_FIXNUM) - 0x100) | ||
| 423 | score += 0x100; | ||
| 422 | } | 424 | } |
| 423 | else | 425 | else |
| 424 | { | 426 | { |
| @@ -787,7 +789,7 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base) | |||
| 787 | while (!NILP (AREF (Vfontset_table, id))) id++; | 789 | while (!NILP (AREF (Vfontset_table, id))) id++; |
| 788 | 790 | ||
| 789 | if (id + 1 == size) | 791 | if (id + 1 == size) |
| 790 | Vfontset_table = larger_vector (Vfontset_table, size + 32, Qnil); | 792 | Vfontset_table = larger_vector (Vfontset_table, 1, -1); |
| 791 | 793 | ||
| 792 | fontset = Fmake_char_table (Qfontset, Qnil); | 794 | fontset = Fmake_char_table (Qfontset, Qnil); |
| 793 | 795 | ||
| @@ -1700,7 +1702,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of | |||
| 1700 | static Lisp_Object auto_fontset_alist; | 1702 | static Lisp_Object auto_fontset_alist; |
| 1701 | 1703 | ||
| 1702 | /* Number of automatically created fontsets. */ | 1704 | /* Number of automatically created fontsets. */ |
| 1703 | static printmax_t num_auto_fontsets; | 1705 | static ptrdiff_t num_auto_fontsets; |
| 1704 | 1706 | ||
| 1705 | /* Retun a fontset synthesized from FONT-OBJECT. This is called from | 1707 | /* Retun a fontset synthesized from FONT-OBJECT. This is called from |
| 1706 | x_new_font when FONT-OBJECT is used for the default ASCII font of a | 1708 | x_new_font when FONT-OBJECT is used for the default ASCII font of a |
| @@ -1727,9 +1729,9 @@ fontset_from_font (Lisp_Object font_object) | |||
| 1727 | alias = intern ("fontset-startup"); | 1729 | alias = intern ("fontset-startup"); |
| 1728 | else | 1730 | else |
| 1729 | { | 1731 | { |
| 1730 | char temp[sizeof "fontset-auto" + INT_STRLEN_BOUND (printmax_t)]; | 1732 | char temp[sizeof "fontset-auto" + INT_STRLEN_BOUND (ptrdiff_t)]; |
| 1731 | 1733 | ||
| 1732 | sprintf (temp, "fontset-auto%"pMd, num_auto_fontsets - 1); | 1734 | sprintf (temp, "fontset-auto%"pD"d", num_auto_fontsets - 1); |
| 1733 | alias = intern (temp); | 1735 | alias = intern (temp); |
| 1734 | } | 1736 | } |
| 1735 | fontset_spec = copy_font_spec (font_spec); | 1737 | fontset_spec = copy_font_spec (font_spec); |
| @@ -1816,7 +1818,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 1816 | doc: /* For internal use only. */) | 1818 | doc: /* For internal use only. */) |
| 1817 | (Lisp_Object position, Lisp_Object ch) | 1819 | (Lisp_Object position, Lisp_Object ch) |
| 1818 | { | 1820 | { |
| 1819 | EMACS_INT pos, pos_byte, dummy; | 1821 | ptrdiff_t pos, pos_byte, dummy; |
| 1820 | int face_id; | 1822 | int face_id; |
| 1821 | int c; | 1823 | int c; |
| 1822 | struct frame *f; | 1824 | struct frame *f; |
| @@ -1836,9 +1838,9 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 1836 | struct window *w; | 1838 | struct window *w; |
| 1837 | 1839 | ||
| 1838 | CHECK_NUMBER_COERCE_MARKER (position); | 1840 | CHECK_NUMBER_COERCE_MARKER (position); |
| 1839 | pos = XINT (position); | 1841 | if (! (BEGV <= XINT (position) && XINT (position) < ZV)) |
| 1840 | if (pos < BEGV || pos >= ZV) | ||
| 1841 | args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); | 1842 | args_out_of_range_3 (position, make_number (BEGV), make_number (ZV)); |
| 1843 | pos = XINT (position); | ||
| 1842 | pos_byte = CHAR_TO_BYTE (pos); | 1844 | pos_byte = CHAR_TO_BYTE (pos); |
| 1843 | if (NILP (ch)) | 1845 | if (NILP (ch)) |
| 1844 | c = FETCH_CHAR (pos_byte); | 1846 | c = FETCH_CHAR (pos_byte); |
diff --git a/src/frame.c b/src/frame.c index 112f102a1f2..1b29bd8f085 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -1605,8 +1605,8 @@ before calling this function on it, like this. | |||
| 1605 | (Lisp_Object frame, Lisp_Object x, Lisp_Object y) | 1605 | (Lisp_Object frame, Lisp_Object x, Lisp_Object y) |
| 1606 | { | 1606 | { |
| 1607 | CHECK_LIVE_FRAME (frame); | 1607 | CHECK_LIVE_FRAME (frame); |
| 1608 | CHECK_NUMBER (x); | 1608 | CHECK_TYPE_RANGED_INTEGER (int, x); |
| 1609 | CHECK_NUMBER (y); | 1609 | CHECK_TYPE_RANGED_INTEGER (int, y); |
| 1610 | 1610 | ||
| 1611 | /* I think this should be done with a hook. */ | 1611 | /* I think this should be done with a hook. */ |
| 1612 | #ifdef HAVE_WINDOW_SYSTEM | 1612 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -1646,8 +1646,8 @@ before calling this function on it, like this. | |||
| 1646 | (Lisp_Object frame, Lisp_Object x, Lisp_Object y) | 1646 | (Lisp_Object frame, Lisp_Object x, Lisp_Object y) |
| 1647 | { | 1647 | { |
| 1648 | CHECK_LIVE_FRAME (frame); | 1648 | CHECK_LIVE_FRAME (frame); |
| 1649 | CHECK_NUMBER (x); | 1649 | CHECK_TYPE_RANGED_INTEGER (int, x); |
| 1650 | CHECK_NUMBER (y); | 1650 | CHECK_TYPE_RANGED_INTEGER (int, y); |
| 1651 | 1651 | ||
| 1652 | /* I think this should be done with a hook. */ | 1652 | /* I think this should be done with a hook. */ |
| 1653 | #ifdef HAVE_WINDOW_SYSTEM | 1653 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -2039,7 +2039,7 @@ store_in_alist (Lisp_Object *alistptr, Lisp_Object prop, Lisp_Object val) | |||
| 2039 | } | 2039 | } |
| 2040 | 2040 | ||
| 2041 | static int | 2041 | static int |
| 2042 | frame_name_fnn_p (char *str, EMACS_INT len) | 2042 | frame_name_fnn_p (char *str, ptrdiff_t len) |
| 2043 | { | 2043 | { |
| 2044 | if (len > 1 && str[0] == 'F' && '0' <= str[1] && str[1] <= '9') | 2044 | if (len > 1 && str[0] == 'F' && '0' <= str[1] && str[1] <= '9') |
| 2045 | { | 2045 | { |
| @@ -2323,7 +2323,7 @@ If FRAME is nil, describe the currently selected frame. */) | |||
| 2323 | if (STRINGP (value) && !FRAME_WINDOW_P (f)) | 2323 | if (STRINGP (value) && !FRAME_WINDOW_P (f)) |
| 2324 | { | 2324 | { |
| 2325 | const char *color_name; | 2325 | const char *color_name; |
| 2326 | EMACS_INT csz; | 2326 | ptrdiff_t csz; |
| 2327 | 2327 | ||
| 2328 | if (EQ (parameter, Qbackground_color)) | 2328 | if (EQ (parameter, Qbackground_color)) |
| 2329 | { | 2329 | { |
| @@ -2399,12 +2399,13 @@ use is not recommended. Explicitly check for a frame-parameter instead. */) | |||
| 2399 | #endif | 2399 | #endif |
| 2400 | 2400 | ||
| 2401 | { | 2401 | { |
| 2402 | int length = XINT (Flength (alist)); | 2402 | EMACS_INT length = XFASTINT (Flength (alist)); |
| 2403 | int i; | 2403 | ptrdiff_t i; |
| 2404 | Lisp_Object *parms | 2404 | Lisp_Object *parms; |
| 2405 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 2405 | Lisp_Object *values; |
| 2406 | Lisp_Object *values | 2406 | USE_SAFE_ALLOCA; |
| 2407 | = (Lisp_Object *) alloca (length * sizeof (Lisp_Object)); | 2407 | SAFE_ALLOCA_LISP (parms, 2 * length); |
| 2408 | values = parms + length; | ||
| 2408 | 2409 | ||
| 2409 | /* Extract parm names and values into those vectors. */ | 2410 | /* Extract parm names and values into those vectors. */ |
| 2410 | 2411 | ||
| @@ -2430,6 +2431,8 @@ use is not recommended. Explicitly check for a frame-parameter instead. */) | |||
| 2430 | || EQ (prop, Qbackground_color)) | 2431 | || EQ (prop, Qbackground_color)) |
| 2431 | update_face_from_frame_parameter (f, prop, val); | 2432 | update_face_from_frame_parameter (f, prop, val); |
| 2432 | } | 2433 | } |
| 2434 | |||
| 2435 | SAFE_FREE (); | ||
| 2433 | } | 2436 | } |
| 2434 | return Qnil; | 2437 | return Qnil; |
| 2435 | } | 2438 | } |
| @@ -2568,7 +2571,7 @@ but that the idea of the actual height of the frame should not be changed. */) | |||
| 2568 | { | 2571 | { |
| 2569 | register struct frame *f; | 2572 | register struct frame *f; |
| 2570 | 2573 | ||
| 2571 | CHECK_NUMBER (lines); | 2574 | CHECK_TYPE_RANGED_INTEGER (int, lines); |
| 2572 | if (NILP (frame)) | 2575 | if (NILP (frame)) |
| 2573 | frame = selected_frame; | 2576 | frame = selected_frame; |
| 2574 | CHECK_LIVE_FRAME (frame); | 2577 | CHECK_LIVE_FRAME (frame); |
| @@ -2595,7 +2598,7 @@ but that the idea of the actual width of the frame should not be changed. */) | |||
| 2595 | (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend) | 2598 | (Lisp_Object frame, Lisp_Object cols, Lisp_Object pretend) |
| 2596 | { | 2599 | { |
| 2597 | register struct frame *f; | 2600 | register struct frame *f; |
| 2598 | CHECK_NUMBER (cols); | 2601 | CHECK_TYPE_RANGED_INTEGER (int, cols); |
| 2599 | if (NILP (frame)) | 2602 | if (NILP (frame)) |
| 2600 | frame = selected_frame; | 2603 | frame = selected_frame; |
| 2601 | CHECK_LIVE_FRAME (frame); | 2604 | CHECK_LIVE_FRAME (frame); |
| @@ -2622,8 +2625,8 @@ DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 3, 0, | |||
| 2622 | register struct frame *f; | 2625 | register struct frame *f; |
| 2623 | 2626 | ||
| 2624 | CHECK_LIVE_FRAME (frame); | 2627 | CHECK_LIVE_FRAME (frame); |
| 2625 | CHECK_NUMBER (cols); | 2628 | CHECK_TYPE_RANGED_INTEGER (int, cols); |
| 2626 | CHECK_NUMBER (rows); | 2629 | CHECK_TYPE_RANGED_INTEGER (int, rows); |
| 2627 | f = XFRAME (frame); | 2630 | f = XFRAME (frame); |
| 2628 | 2631 | ||
| 2629 | /* I think this should be done with a hook. */ | 2632 | /* I think this should be done with a hook. */ |
| @@ -2654,8 +2657,8 @@ the rightmost or bottommost possible position (that stays within the screen). * | |||
| 2654 | register struct frame *f; | 2657 | register struct frame *f; |
| 2655 | 2658 | ||
| 2656 | CHECK_LIVE_FRAME (frame); | 2659 | CHECK_LIVE_FRAME (frame); |
| 2657 | CHECK_NUMBER (xoffset); | 2660 | CHECK_TYPE_RANGED_INTEGER (int, xoffset); |
| 2658 | CHECK_NUMBER (yoffset); | 2661 | CHECK_TYPE_RANGED_INTEGER (int, yoffset); |
| 2659 | f = XFRAME (frame); | 2662 | f = XFRAME (frame); |
| 2660 | 2663 | ||
| 2661 | /* I think this should be done with a hook. */ | 2664 | /* I think this should be done with a hook. */ |
| @@ -2874,12 +2877,12 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) | |||
| 2874 | prop = parms[i]; | 2877 | prop = parms[i]; |
| 2875 | val = values[i]; | 2878 | val = values[i]; |
| 2876 | 2879 | ||
| 2877 | if (EQ (prop, Qwidth) && NATNUMP (val)) | 2880 | if (EQ (prop, Qwidth) && RANGED_INTEGERP (0, val, INT_MAX)) |
| 2878 | { | 2881 | { |
| 2879 | size_changed = 1; | 2882 | size_changed = 1; |
| 2880 | width = XFASTINT (val); | 2883 | width = XFASTINT (val); |
| 2881 | } | 2884 | } |
| 2882 | else if (EQ (prop, Qheight) && NATNUMP (val)) | 2885 | else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) |
| 2883 | { | 2886 | { |
| 2884 | size_changed = 1; | 2887 | size_changed = 1; |
| 2885 | height = XFASTINT (val); | 2888 | height = XFASTINT (val); |
| @@ -2915,7 +2918,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) | |||
| 2915 | } | 2918 | } |
| 2916 | 2919 | ||
| 2917 | /* Don't die if just one of these was set. */ | 2920 | /* Don't die if just one of these was set. */ |
| 2918 | if (EQ (left, Qunbound)) | 2921 | if (! TYPE_RANGED_INTEGERP (int, left)) |
| 2919 | { | 2922 | { |
| 2920 | left_no_change = 1; | 2923 | left_no_change = 1; |
| 2921 | if (f->left_pos < 0) | 2924 | if (f->left_pos < 0) |
| @@ -2923,7 +2926,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) | |||
| 2923 | else | 2926 | else |
| 2924 | XSETINT (left, f->left_pos); | 2927 | XSETINT (left, f->left_pos); |
| 2925 | } | 2928 | } |
| 2926 | if (EQ (top, Qunbound)) | 2929 | if (! TYPE_RANGED_INTEGERP (int, top)) |
| 2927 | { | 2930 | { |
| 2928 | top_no_change = 1; | 2931 | top_no_change = 1; |
| 2929 | if (f->top_pos < 0) | 2932 | if (f->top_pos < 0) |
| @@ -2933,14 +2936,14 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) | |||
| 2933 | } | 2936 | } |
| 2934 | 2937 | ||
| 2935 | /* If one of the icon positions was not set, preserve or default it. */ | 2938 | /* If one of the icon positions was not set, preserve or default it. */ |
| 2936 | if (EQ (icon_left, Qunbound) || ! INTEGERP (icon_left)) | 2939 | if (! TYPE_RANGED_INTEGERP (int, icon_left)) |
| 2937 | { | 2940 | { |
| 2938 | icon_left_no_change = 1; | 2941 | icon_left_no_change = 1; |
| 2939 | icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); | 2942 | icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); |
| 2940 | if (NILP (icon_left)) | 2943 | if (NILP (icon_left)) |
| 2941 | XSETINT (icon_left, 0); | 2944 | XSETINT (icon_left, 0); |
| 2942 | } | 2945 | } |
| 2943 | if (EQ (icon_top, Qunbound) || ! INTEGERP (icon_top)) | 2946 | if (! TYPE_RANGED_INTEGERP (int, icon_top)) |
| 2944 | { | 2947 | { |
| 2945 | icon_top_no_change = 1; | 2948 | icon_top_no_change = 1; |
| 2946 | icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); | 2949 | icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); |
| @@ -3155,7 +3158,7 @@ x_set_line_spacing (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu | |||
| 3155 | { | 3158 | { |
| 3156 | if (NILP (new_value)) | 3159 | if (NILP (new_value)) |
| 3157 | f->extra_line_spacing = 0; | 3160 | f->extra_line_spacing = 0; |
| 3158 | else if (NATNUMP (new_value)) | 3161 | else if (RANGED_INTEGERP (0, new_value, INT_MAX)) |
| 3159 | f->extra_line_spacing = XFASTINT (new_value); | 3162 | f->extra_line_spacing = XFASTINT (new_value); |
| 3160 | else | 3163 | else |
| 3161 | signal_error ("Invalid line-spacing", new_value); | 3164 | signal_error ("Invalid line-spacing", new_value); |
| @@ -3364,7 +3367,7 @@ x_set_fringe_width (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu | |||
| 3364 | void | 3367 | void |
| 3365 | x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) | 3368 | x_set_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldval) |
| 3366 | { | 3369 | { |
| 3367 | CHECK_NUMBER (arg); | 3370 | CHECK_TYPE_RANGED_INTEGER (int, arg); |
| 3368 | 3371 | ||
| 3369 | if (XINT (arg) == f->border_width) | 3372 | if (XINT (arg) == f->border_width) |
| 3370 | return; | 3373 | return; |
| @@ -3380,7 +3383,7 @@ x_set_internal_border_width (struct frame *f, Lisp_Object arg, Lisp_Object oldva | |||
| 3380 | { | 3383 | { |
| 3381 | int old = FRAME_INTERNAL_BORDER_WIDTH (f); | 3384 | int old = FRAME_INTERNAL_BORDER_WIDTH (f); |
| 3382 | 3385 | ||
| 3383 | CHECK_NUMBER (arg); | 3386 | CHECK_TYPE_RANGED_INTEGER (int, arg); |
| 3384 | FRAME_INTERNAL_BORDER_WIDTH (f) = XINT (arg); | 3387 | FRAME_INTERNAL_BORDER_WIDTH (f) = XINT (arg); |
| 3385 | if (FRAME_INTERNAL_BORDER_WIDTH (f) < 0) | 3388 | if (FRAME_INTERNAL_BORDER_WIDTH (f) < 0) |
| 3386 | FRAME_INTERNAL_BORDER_WIDTH (f) = 0; | 3389 | FRAME_INTERNAL_BORDER_WIDTH (f) = 0; |
| @@ -4117,7 +4120,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p) | |||
| 4117 | f->top_pos = 0; | 4120 | f->top_pos = 0; |
| 4118 | else | 4121 | else |
| 4119 | { | 4122 | { |
| 4120 | CHECK_NUMBER (tem0); | 4123 | CHECK_TYPE_RANGED_INTEGER (int, tem0); |
| 4121 | f->top_pos = XINT (tem0); | 4124 | f->top_pos = XINT (tem0); |
| 4122 | if (f->top_pos < 0) | 4125 | if (f->top_pos < 0) |
| 4123 | window_prompting |= YNegative; | 4126 | window_prompting |= YNegative; |
| @@ -4145,7 +4148,7 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, int toolbar_p) | |||
| 4145 | f->left_pos = 0; | 4148 | f->left_pos = 0; |
| 4146 | else | 4149 | else |
| 4147 | { | 4150 | { |
| 4148 | CHECK_NUMBER (tem1); | 4151 | CHECK_TYPE_RANGED_INTEGER (int, tem1); |
| 4149 | f->left_pos = XINT (tem1); | 4152 | f->left_pos = XINT (tem1); |
| 4150 | if (f->left_pos < 0) | 4153 | if (f->left_pos < 0) |
| 4151 | window_prompting |= XNegative; | 4154 | window_prompting |= XNegative; |
diff --git a/src/frame.h b/src/frame.h index 3775403810f..3d2b8208ddd 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -322,7 +322,7 @@ struct frame | |||
| 322 | struct x_output *x; /* xterm.h */ | 322 | struct x_output *x; /* xterm.h */ |
| 323 | struct w32_output *w32; /* w32term.h */ | 323 | struct w32_output *w32; /* w32term.h */ |
| 324 | struct ns_output *ns; /* nsterm.h */ | 324 | struct ns_output *ns; /* nsterm.h */ |
| 325 | EMACS_INT nothing; | 325 | intptr_t nothing; |
| 326 | } | 326 | } |
| 327 | output_data; | 327 | output_data; |
| 328 | 328 | ||
diff --git a/src/fringe.c b/src/fringe.c index 25fecca2334..727547b1ab7 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -474,7 +474,7 @@ int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; | |||
| 474 | int | 474 | int |
| 475 | lookup_fringe_bitmap (Lisp_Object bitmap) | 475 | lookup_fringe_bitmap (Lisp_Object bitmap) |
| 476 | { | 476 | { |
| 477 | int bn; | 477 | EMACS_INT bn; |
| 478 | 478 | ||
| 479 | bitmap = Fget (bitmap, Qfringe); | 479 | bitmap = Fget (bitmap, Qfringe); |
| 480 | if (!INTEGERP (bitmap)) | 480 | if (!INTEGERP (bitmap)) |
| @@ -696,7 +696,7 @@ static int | |||
| 696 | get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, int partial_p) | 696 | get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, int partial_p) |
| 697 | { | 697 | { |
| 698 | Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm; | 698 | Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm; |
| 699 | int ln1 = 0, ln2 = 0; | 699 | EMACS_INT ln1 = 0, ln2 = 0; |
| 700 | int ix1 = right_p; | 700 | int ix1 = right_p; |
| 701 | int ix2 = ix1 + (partial_p ? 2 : 0); | 701 | int ix2 = ix1 + (partial_p ? 2 : 0); |
| 702 | 702 | ||
| @@ -1555,7 +1555,7 @@ If BITMAP already exists, the existing definition is replaced. */) | |||
| 1555 | else | 1555 | else |
| 1556 | { | 1556 | { |
| 1557 | CHECK_NUMBER (height); | 1557 | CHECK_NUMBER (height); |
| 1558 | fb.height = min (XINT (height), 255); | 1558 | fb.height = max (0, min (XINT (height), 255)); |
| 1559 | if (fb.height > h) | 1559 | if (fb.height > h) |
| 1560 | { | 1560 | { |
| 1561 | fill1 = (fb.height - h) / 2; | 1561 | fill1 = (fb.height - h) / 2; |
| @@ -1568,7 +1568,7 @@ If BITMAP already exists, the existing definition is replaced. */) | |||
| 1568 | else | 1568 | else |
| 1569 | { | 1569 | { |
| 1570 | CHECK_NUMBER (width); | 1570 | CHECK_NUMBER (width); |
| 1571 | fb.width = min (XINT (width), 255); | 1571 | fb.width = max (0, min (XINT (width), 255)); |
| 1572 | } | 1572 | } |
| 1573 | 1573 | ||
| 1574 | fb.period = 0; | 1574 | fb.period = 0; |
| @@ -1704,7 +1704,7 @@ Return nil if POS is not visible in WINDOW. */) | |||
| 1704 | { | 1704 | { |
| 1705 | struct window *w; | 1705 | struct window *w; |
| 1706 | struct glyph_row *row; | 1706 | struct glyph_row *row; |
| 1707 | int textpos; | 1707 | ptrdiff_t textpos; |
| 1708 | 1708 | ||
| 1709 | if (NILP (window)) | 1709 | if (NILP (window)) |
| 1710 | window = selected_window; | 1710 | window = selected_window; |
| @@ -1714,6 +1714,8 @@ Return nil if POS is not visible in WINDOW. */) | |||
| 1714 | if (!NILP (pos)) | 1714 | if (!NILP (pos)) |
| 1715 | { | 1715 | { |
| 1716 | CHECK_NUMBER_COERCE_MARKER (pos); | 1716 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 1717 | if (! (BEGV <= XINT (pos) && XINT (pos) <= ZV)) | ||
| 1718 | args_out_of_range (window, pos); | ||
| 1717 | textpos = XINT (pos); | 1719 | textpos = XINT (pos); |
| 1718 | } | 1720 | } |
| 1719 | else if (w == XWINDOW (selected_window)) | 1721 | else if (w == XWINDOW (selected_window)) |
diff --git a/src/ftfont.c b/src/ftfont.c index 7858a31be21..5f8dbb4d455 100644 --- a/src/ftfont.c +++ b/src/ftfont.c | |||
| @@ -1026,13 +1026,13 @@ ftfont_list (Lisp_Object frame, Lisp_Object spec) | |||
| 1026 | #endif /* HAVE_LIBOTF */ | 1026 | #endif /* HAVE_LIBOTF */ |
| 1027 | if (VECTORP (chars)) | 1027 | if (VECTORP (chars)) |
| 1028 | { | 1028 | { |
| 1029 | int j; | 1029 | ptrdiff_t j; |
| 1030 | 1030 | ||
| 1031 | if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset) | 1031 | if (FcPatternGetCharSet (fontset->fonts[i], FC_CHARSET, 0, &charset) |
| 1032 | != FcResultMatch) | 1032 | != FcResultMatch) |
| 1033 | continue; | 1033 | continue; |
| 1034 | for (j = 0; j < ASIZE (chars); j++) | 1034 | for (j = 0; j < ASIZE (chars); j++) |
| 1035 | if (NATNUMP (AREF (chars, j)) | 1035 | if (TYPE_RANGED_INTEGERP (FcChar32, AREF (chars, j)) |
| 1036 | && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j)))) | 1036 | && FcCharSetHasChar (charset, XFASTINT (AREF (chars, j)))) |
| 1037 | break; | 1037 | break; |
| 1038 | if (j == ASIZE (chars)) | 1038 | if (j == ASIZE (chars)) |
| @@ -2387,8 +2387,8 @@ static Lisp_Object | |||
| 2387 | ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, | 2387 | ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, |
| 2388 | FT_Face ft_face, OTF *otf, FT_Matrix *matrix) | 2388 | FT_Face ft_face, OTF *otf, FT_Matrix *matrix) |
| 2389 | { | 2389 | { |
| 2390 | EMACS_INT len = LGSTRING_GLYPH_LEN (lgstring); | 2390 | ptrdiff_t len = LGSTRING_GLYPH_LEN (lgstring); |
| 2391 | EMACS_INT i; | 2391 | ptrdiff_t i; |
| 2392 | struct MFLTFontFT flt_font_ft; | 2392 | struct MFLTFontFT flt_font_ft; |
| 2393 | MFLT *flt = NULL; | 2393 | MFLT *flt = NULL; |
| 2394 | int with_variation_selector = 0; | 2394 | int with_variation_selector = 0; |
| @@ -2416,7 +2416,6 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, | |||
| 2416 | } | 2416 | } |
| 2417 | 2417 | ||
| 2418 | len = i; | 2418 | len = i; |
| 2419 | lint_assume (len <= TYPE_MAXIMUM (EMACS_INT) - 2); | ||
| 2420 | 2419 | ||
| 2421 | if (with_variation_selector) | 2420 | if (with_variation_selector) |
| 2422 | { | 2421 | { |
diff --git a/src/gnutls.c b/src/gnutls.c index 0743ef3f4ee..f01a74dbf31 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -328,11 +328,11 @@ emacs_gnutls_transport_set_errno (gnutls_session_t state, int err) | |||
| 328 | fn_gnutls_transport_set_errno (state, err); | 328 | fn_gnutls_transport_set_errno (state, err); |
| 329 | } | 329 | } |
| 330 | 330 | ||
| 331 | EMACS_INT | 331 | ptrdiff_t |
| 332 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte) | 332 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte) |
| 333 | { | 333 | { |
| 334 | ssize_t rtnval = 0; | 334 | ssize_t rtnval = 0; |
| 335 | EMACS_INT bytes_written; | 335 | ptrdiff_t bytes_written; |
| 336 | gnutls_session_t state = proc->gnutls_state; | 336 | gnutls_session_t state = proc->gnutls_state; |
| 337 | 337 | ||
| 338 | if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { | 338 | if (proc->gnutls_initstage != GNUTLS_STAGE_READY) { |
| @@ -368,8 +368,8 @@ emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte) | |||
| 368 | return (bytes_written); | 368 | return (bytes_written); |
| 369 | } | 369 | } |
| 370 | 370 | ||
| 371 | EMACS_INT | 371 | ptrdiff_t |
| 372 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte) | 372 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte) |
| 373 | { | 373 | { |
| 374 | ssize_t rtnval; | 374 | ssize_t rtnval; |
| 375 | gnutls_session_t state = proc->gnutls_state; | 375 | gnutls_session_t state = proc->gnutls_state; |
| @@ -508,7 +508,7 @@ usage: (gnutls-error-fatalp ERROR) */) | |||
| 508 | } | 508 | } |
| 509 | } | 509 | } |
| 510 | 510 | ||
| 511 | if (!NUMBERP (err)) | 511 | if (! TYPE_RANGED_INTEGERP (int, err)) |
| 512 | error ("Not an error symbol or code"); | 512 | error ("Not an error symbol or code"); |
| 513 | 513 | ||
| 514 | if (0 == fn_gnutls_error_is_fatal (XINT (err))) | 514 | if (0 == fn_gnutls_error_is_fatal (XINT (err))) |
| @@ -540,7 +540,7 @@ usage: (gnutls-error-string ERROR) */) | |||
| 540 | } | 540 | } |
| 541 | } | 541 | } |
| 542 | 542 | ||
| 543 | if (!NUMBERP (err)) | 543 | if (! TYPE_RANGED_INTEGERP (int, err)) |
| 544 | return build_string ("Not an error symbol or code"); | 544 | return build_string ("Not an error symbol or code"); |
| 545 | 545 | ||
| 546 | return build_string (fn_gnutls_strerror (XINT (err))); | 546 | return build_string (fn_gnutls_strerror (XINT (err))); |
| @@ -736,7 +736,7 @@ one trustfile (usually a CA bundle). */) | |||
| 736 | state = XPROCESS (proc)->gnutls_state; | 736 | state = XPROCESS (proc)->gnutls_state; |
| 737 | XPROCESS (proc)->gnutls_p = 1; | 737 | XPROCESS (proc)->gnutls_p = 1; |
| 738 | 738 | ||
| 739 | if (NUMBERP (loglevel)) | 739 | if (TYPE_RANGED_INTEGERP (int, loglevel)) |
| 740 | { | 740 | { |
| 741 | fn_gnutls_global_set_log_function (gnutls_log_function); | 741 | fn_gnutls_global_set_log_function (gnutls_log_function); |
| 742 | fn_gnutls_global_set_log_level (XINT (loglevel)); | 742 | fn_gnutls_global_set_log_level (XINT (loglevel)); |
diff --git a/src/gnutls.h b/src/gnutls.h index e2a9bc9eaea..83eeb7247eb 100644 --- a/src/gnutls.h +++ b/src/gnutls.h | |||
| @@ -53,10 +53,10 @@ typedef enum | |||
| 53 | 53 | ||
| 54 | #define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } | 54 | #define GNUTLS_LOG2(level, max, string, extra) if (level <= max) { gnutls_log_function2 (level, "(Emacs) " string, extra); } |
| 55 | 55 | ||
| 56 | extern EMACS_INT | 56 | extern ptrdiff_t |
| 57 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, EMACS_INT nbyte); | 57 | emacs_gnutls_write (struct Lisp_Process *proc, const char *buf, ptrdiff_t nbyte); |
| 58 | extern EMACS_INT | 58 | extern ptrdiff_t |
| 59 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, EMACS_INT nbyte); | 59 | emacs_gnutls_read (struct Lisp_Process *proc, char *buf, ptrdiff_t nbyte); |
| 60 | 60 | ||
| 61 | extern int emacs_gnutls_record_check_pending (gnutls_session_t state); | 61 | extern int emacs_gnutls_record_check_pending (gnutls_session_t state); |
| 62 | extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); | 62 | extern void emacs_gnutls_transport_set_errno (gnutls_session_t state, int err); |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 3cac8084dea..2712297a5b2 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1620,7 +1620,7 @@ xg_maybe_add_timer (gpointer data) | |||
| 1620 | static int | 1620 | static int |
| 1621 | xg_dialog_run (FRAME_PTR f, GtkWidget *w) | 1621 | xg_dialog_run (FRAME_PTR f, GtkWidget *w) |
| 1622 | { | 1622 | { |
| 1623 | int count = SPECPDL_INDEX (); | 1623 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1624 | struct xg_dialog_data dd; | 1624 | struct xg_dialog_data dd; |
| 1625 | 1625 | ||
| 1626 | xg_set_screen (w, f); | 1626 | xg_set_screen (w, f); |
| @@ -4273,7 +4273,6 @@ xg_make_tool_item (FRAME_PTR f, | |||
| 4273 | rather than the GtkButton specific signals "enter" and | 4273 | rather than the GtkButton specific signals "enter" and |
| 4274 | "leave", so we can have only one callback. The event | 4274 | "leave", so we can have only one callback. The event |
| 4275 | will tell us what kind of event it is. */ | 4275 | will tell us what kind of event it is. */ |
| 4276 | /* The EMACS_INT cast avoids a warning. */ | ||
| 4277 | g_signal_connect (G_OBJECT (weventbox), | 4276 | g_signal_connect (G_OBJECT (weventbox), |
| 4278 | "enter-notify-event", | 4277 | "enter-notify-event", |
| 4279 | G_CALLBACK (xg_tool_bar_help_callback), | 4278 | G_CALLBACK (xg_tool_bar_help_callback), |
| @@ -4399,20 +4398,17 @@ update_frame_tool_bar (FRAME_PTR f) | |||
| 4399 | 4398 | ||
| 4400 | BLOCK_INPUT; | 4399 | BLOCK_INPUT; |
| 4401 | 4400 | ||
| 4402 | if (INTEGERP (Vtool_bar_button_margin) | 4401 | if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) |
| 4403 | && XINT (Vtool_bar_button_margin) > 0) | ||
| 4404 | { | 4402 | { |
| 4405 | hmargin = XFASTINT (Vtool_bar_button_margin); | 4403 | hmargin = XFASTINT (Vtool_bar_button_margin); |
| 4406 | vmargin = XFASTINT (Vtool_bar_button_margin); | 4404 | vmargin = XFASTINT (Vtool_bar_button_margin); |
| 4407 | } | 4405 | } |
| 4408 | else if (CONSP (Vtool_bar_button_margin)) | 4406 | else if (CONSP (Vtool_bar_button_margin)) |
| 4409 | { | 4407 | { |
| 4410 | if (INTEGERP (XCAR (Vtool_bar_button_margin)) | 4408 | if (RANGED_INTEGERP (1, XCAR (Vtool_bar_button_margin), INT_MAX)) |
| 4411 | && XINT (XCAR (Vtool_bar_button_margin)) > 0) | ||
| 4412 | hmargin = XFASTINT (XCAR (Vtool_bar_button_margin)); | 4409 | hmargin = XFASTINT (XCAR (Vtool_bar_button_margin)); |
| 4413 | 4410 | ||
| 4414 | if (INTEGERP (XCDR (Vtool_bar_button_margin)) | 4411 | if (RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), INT_MAX)) |
| 4415 | && XINT (XCDR (Vtool_bar_button_margin)) > 0) | ||
| 4416 | vmargin = XFASTINT (XCDR (Vtool_bar_button_margin)); | 4412 | vmargin = XFASTINT (XCDR (Vtool_bar_button_margin)); |
| 4417 | } | 4413 | } |
| 4418 | 4414 | ||
diff --git a/src/image.c b/src/image.c index ef72745a72f..8eb51942675 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -771,10 +771,9 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, | |||
| 771 | /* Record that we recognized the keyword. If a keywords | 771 | /* Record that we recognized the keyword. If a keywords |
| 772 | was found more than once, it's an error. */ | 772 | was found more than once, it's an error. */ |
| 773 | keywords[i].value = value; | 773 | keywords[i].value = value; |
| 774 | ++keywords[i].count; | ||
| 775 | |||
| 776 | if (keywords[i].count > 1) | 774 | if (keywords[i].count > 1) |
| 777 | return 0; | 775 | return 0; |
| 776 | ++keywords[i].count; | ||
| 778 | 777 | ||
| 779 | /* Check type of value against allowed type. */ | 778 | /* Check type of value against allowed type. */ |
| 780 | switch (keywords[i].type) | 779 | switch (keywords[i].type) |
| @@ -1754,6 +1753,7 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1754 | `:ascent ASCENT', `:margin MARGIN', `:relief RELIEF', | 1753 | `:ascent ASCENT', `:margin MARGIN', `:relief RELIEF', |
| 1755 | `:background COLOR'. */ | 1754 | `:background COLOR'. */ |
| 1756 | Lisp_Object ascent, margin, relief, bg; | 1755 | Lisp_Object ascent, margin, relief, bg; |
| 1756 | int relief_bound; | ||
| 1757 | 1757 | ||
| 1758 | ascent = image_spec_value (spec, QCascent, NULL); | 1758 | ascent = image_spec_value (spec, QCascent, NULL); |
| 1759 | if (INTEGERP (ascent)) | 1759 | if (INTEGERP (ascent)) |
| @@ -1771,7 +1771,8 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1771 | } | 1771 | } |
| 1772 | 1772 | ||
| 1773 | relief = image_spec_value (spec, QCrelief, NULL); | 1773 | relief = image_spec_value (spec, QCrelief, NULL); |
| 1774 | if (INTEGERP (relief)) | 1774 | relief_bound = INT_MAX - max (img->hmargin, img->vmargin); |
| 1775 | if (RANGED_INTEGERP (- relief_bound, relief, relief_bound)) | ||
| 1775 | { | 1776 | { |
| 1776 | img->relief = XINT (relief); | 1777 | img->relief = XINT (relief); |
| 1777 | img->hmargin += eabs (img->relief); | 1778 | img->hmargin += eabs (img->relief); |
diff --git a/src/indent.c b/src/indent.c index e00d2152577..96b6ea4fa18 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -45,23 +45,23 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | Some things in set last_known_column_point to -1 | 45 | Some things in set last_known_column_point to -1 |
| 46 | to mark the memorized value as invalid. */ | 46 | to mark the memorized value as invalid. */ |
| 47 | 47 | ||
| 48 | static EMACS_INT last_known_column; | 48 | static ptrdiff_t last_known_column; |
| 49 | 49 | ||
| 50 | /* Value of point when current_column was called. */ | 50 | /* Value of point when current_column was called. */ |
| 51 | 51 | ||
| 52 | EMACS_INT last_known_column_point; | 52 | ptrdiff_t last_known_column_point; |
| 53 | 53 | ||
| 54 | /* Value of MODIFF when current_column was called. */ | 54 | /* Value of MODIFF when current_column was called. */ |
| 55 | 55 | ||
| 56 | static int last_known_column_modified; | 56 | static EMACS_INT last_known_column_modified; |
| 57 | 57 | ||
| 58 | static EMACS_INT current_column_1 (void); | 58 | static ptrdiff_t current_column_1 (void); |
| 59 | static EMACS_INT position_indentation (ptrdiff_t); | 59 | static ptrdiff_t position_indentation (ptrdiff_t); |
| 60 | 60 | ||
| 61 | /* Cache of beginning of line found by the last call of | 61 | /* Cache of beginning of line found by the last call of |
| 62 | current_column. */ | 62 | current_column. */ |
| 63 | 63 | ||
| 64 | static EMACS_INT current_column_bol_cache; | 64 | static ptrdiff_t current_column_bol_cache; |
| 65 | 65 | ||
| 66 | /* Get the display table to use for the current buffer. */ | 66 | /* Get the display table to use for the current buffer. */ |
| 67 | 67 | ||
| @@ -204,12 +204,12 @@ width_run_cache_on_off (void) | |||
| 204 | characters immediately following, then *NEXT_BOUNDARY_P | 204 | characters immediately following, then *NEXT_BOUNDARY_P |
| 205 | will equal the return value. */ | 205 | will equal the return value. */ |
| 206 | 206 | ||
| 207 | EMACS_INT | 207 | ptrdiff_t |
| 208 | skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Object window) | 208 | skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Object window) |
| 209 | { | 209 | { |
| 210 | Lisp_Object prop, position, overlay_limit, proplimit; | 210 | Lisp_Object prop, position, overlay_limit, proplimit; |
| 211 | Lisp_Object buffer, tmp; | 211 | Lisp_Object buffer, tmp; |
| 212 | EMACS_INT end; | 212 | ptrdiff_t end; |
| 213 | int inv_p; | 213 | int inv_p; |
| 214 | 214 | ||
| 215 | XSETFASTINT (position, pos); | 215 | XSETFASTINT (position, pos); |
| @@ -318,13 +318,13 @@ invalidate_current_column (void) | |||
| 318 | last_known_column_point = 0; | 318 | last_known_column_point = 0; |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | EMACS_INT | 321 | ptrdiff_t |
| 322 | current_column (void) | 322 | current_column (void) |
| 323 | { | 323 | { |
| 324 | register EMACS_INT col; | 324 | register ptrdiff_t col; |
| 325 | register unsigned char *ptr, *stop; | 325 | register unsigned char *ptr, *stop; |
| 326 | register int tab_seen; | 326 | register int tab_seen; |
| 327 | EMACS_INT post_tab; | 327 | ptrdiff_t post_tab; |
| 328 | register int c; | 328 | register int c; |
| 329 | int tab_width = SANE_TAB_WIDTH (current_buffer); | 329 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 330 | int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); | 330 | int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); |
| @@ -360,7 +360,7 @@ current_column (void) | |||
| 360 | 360 | ||
| 361 | while (1) | 361 | while (1) |
| 362 | { | 362 | { |
| 363 | EMACS_INT i, n; | 363 | ptrdiff_t i, n; |
| 364 | Lisp_Object charvec; | 364 | Lisp_Object charvec; |
| 365 | 365 | ||
| 366 | if (ptr == stop) | 366 | if (ptr == stop) |
| @@ -400,8 +400,7 @@ current_column (void) | |||
| 400 | next_element_from_display_vector does it. */ | 400 | next_element_from_display_vector does it. */ |
| 401 | Lisp_Object entry = AREF (charvec, i); | 401 | Lisp_Object entry = AREF (charvec, i); |
| 402 | 402 | ||
| 403 | if (GLYPH_CODE_P (entry) | 403 | if (GLYPH_CODE_P (entry)) |
| 404 | && GLYPH_CODE_CHAR_VALID_P (entry)) | ||
| 405 | c = GLYPH_CODE_CHAR (entry); | 404 | c = GLYPH_CODE_CHAR (entry); |
| 406 | else | 405 | else |
| 407 | c = ' '; | 406 | c = ' '; |
| @@ -464,7 +463,7 @@ current_column (void) | |||
| 464 | in ENDPOS. | 463 | in ENDPOS. |
| 465 | Otherwise just return -1. */ | 464 | Otherwise just return -1. */ |
| 466 | static int | 465 | static int |
| 467 | check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos) | 466 | check_display_width (ptrdiff_t pos, ptrdiff_t col, ptrdiff_t *endpos) |
| 468 | { | 467 | { |
| 469 | Lisp_Object val, overlay; | 468 | Lisp_Object val, overlay; |
| 470 | 469 | ||
| @@ -474,19 +473,27 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos) | |||
| 474 | { /* FIXME: Use calc_pixel_width_or_height. */ | 473 | { /* FIXME: Use calc_pixel_width_or_height. */ |
| 475 | Lisp_Object plist = XCDR (val), prop; | 474 | Lisp_Object plist = XCDR (val), prop; |
| 476 | int width = -1; | 475 | int width = -1; |
| 476 | EMACS_INT align_to_max = | ||
| 477 | (col < MOST_POSITIVE_FIXNUM - INT_MAX | ||
| 478 | ? (EMACS_INT) INT_MAX + col | ||
| 479 | : MOST_POSITIVE_FIXNUM); | ||
| 477 | 480 | ||
| 478 | if ((prop = Fplist_get (plist, QCwidth), NATNUMP (prop))) | 481 | if ((prop = Fplist_get (plist, QCwidth), |
| 482 | RANGED_INTEGERP (0, prop, INT_MAX))) | ||
| 479 | width = XINT (prop); | 483 | width = XINT (prop); |
| 480 | else if (FLOATP (prop)) | 484 | else if (FLOATP (prop) && 0 <= XFLOAT_DATA (prop) |
| 485 | && XFLOAT_DATA (prop) <= INT_MAX) | ||
| 481 | width = (int)(XFLOAT_DATA (prop) + 0.5); | 486 | width = (int)(XFLOAT_DATA (prop) + 0.5); |
| 482 | else if ((prop = Fplist_get (plist, QCalign_to), NATNUMP (prop))) | 487 | else if ((prop = Fplist_get (plist, QCalign_to), |
| 488 | RANGED_INTEGERP (col, prop, align_to_max))) | ||
| 483 | width = XINT (prop) - col; | 489 | width = XINT (prop) - col; |
| 484 | else if (FLOATP (prop)) | 490 | else if (FLOATP (prop) && col <= XFLOAT_DATA (prop) |
| 491 | && (XFLOAT_DATA (prop) <= align_to_max)) | ||
| 485 | width = (int)(XFLOAT_DATA (prop) + 0.5) - col; | 492 | width = (int)(XFLOAT_DATA (prop) + 0.5) - col; |
| 486 | 493 | ||
| 487 | if (width >= 0) | 494 | if (width >= 0) |
| 488 | { | 495 | { |
| 489 | EMACS_INT start; | 496 | ptrdiff_t start; |
| 490 | if (OVERLAYP (overlay)) | 497 | if (OVERLAYP (overlay)) |
| 491 | *endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); | 498 | *endpos = OVERLAY_POSITION (OVERLAY_END (overlay)); |
| 492 | else | 499 | else |
| @@ -504,7 +511,7 @@ check_display_width (EMACS_INT pos, EMACS_INT col, EMACS_INT *endpos) | |||
| 504 | PREVCOL gets set to the column of the previous position (it's always | 511 | PREVCOL gets set to the column of the previous position (it's always |
| 505 | strictly smaller than the goal column). */ | 512 | strictly smaller than the goal column). */ |
| 506 | static void | 513 | static void |
| 507 | scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | 514 | scan_for_column (ptrdiff_t *endpos, EMACS_INT *goalcol, ptrdiff_t *prevcol) |
| 508 | { | 515 | { |
| 509 | int tab_width = SANE_TAB_WIDTH (current_buffer); | 516 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 510 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); | 517 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); |
| @@ -515,13 +522,13 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 515 | struct window *w; | 522 | struct window *w; |
| 516 | 523 | ||
| 517 | /* Start the scan at the beginning of this line with column number 0. */ | 524 | /* Start the scan at the beginning of this line with column number 0. */ |
| 518 | register EMACS_INT col = 0, prev_col = 0; | 525 | register ptrdiff_t col = 0, prev_col = 0; |
| 519 | EMACS_INT goal = goalcol ? *goalcol : MOST_POSITIVE_FIXNUM; | 526 | EMACS_INT goal = goalcol ? *goalcol : MOST_POSITIVE_FIXNUM; |
| 520 | EMACS_INT end = endpos ? *endpos : PT; | 527 | ptrdiff_t end = endpos ? *endpos : PT; |
| 521 | EMACS_INT scan, scan_byte; | 528 | ptrdiff_t scan, scan_byte; |
| 522 | EMACS_INT next_boundary; | 529 | ptrdiff_t next_boundary; |
| 523 | { | 530 | { |
| 524 | EMACS_INT opoint = PT, opoint_byte = PT_BYTE; | 531 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 525 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); | 532 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); |
| 526 | current_column_bol_cache = PT; | 533 | current_column_bol_cache = PT; |
| 527 | scan = PT, scan_byte = PT_BYTE; | 534 | scan = PT, scan_byte = PT_BYTE; |
| @@ -544,7 +551,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 544 | /* Occasionally we may need to skip invisible text. */ | 551 | /* Occasionally we may need to skip invisible text. */ |
| 545 | while (scan == next_boundary) | 552 | while (scan == next_boundary) |
| 546 | { | 553 | { |
| 547 | EMACS_INT old_scan = scan; | 554 | ptrdiff_t old_scan = scan; |
| 548 | /* This updates NEXT_BOUNDARY to the next place | 555 | /* This updates NEXT_BOUNDARY to the next place |
| 549 | where we might need to skip more invisible text. */ | 556 | where we might need to skip more invisible text. */ |
| 550 | scan = skip_invisible (scan, &next_boundary, end, Qnil); | 557 | scan = skip_invisible (scan, &next_boundary, end, Qnil); |
| @@ -562,7 +569,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 562 | prev_col = col; | 569 | prev_col = col; |
| 563 | 570 | ||
| 564 | { /* Check display property. */ | 571 | { /* Check display property. */ |
| 565 | EMACS_INT endp; | 572 | ptrdiff_t endp; |
| 566 | int width = check_display_width (scan, col, &endp); | 573 | int width = check_display_width (scan, col, &endp); |
| 567 | if (width >= 0) | 574 | if (width >= 0) |
| 568 | { | 575 | { |
| @@ -608,7 +615,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 608 | && VECTORP (DISP_CHAR_VECTOR (dp, c))) | 615 | && VECTORP (DISP_CHAR_VECTOR (dp, c))) |
| 609 | { | 616 | { |
| 610 | Lisp_Object charvec; | 617 | Lisp_Object charvec; |
| 611 | EMACS_INT i, n; | 618 | ptrdiff_t i, n; |
| 612 | 619 | ||
| 613 | /* This character is displayed using a vector of glyphs. | 620 | /* This character is displayed using a vector of glyphs. |
| 614 | Update the column/position based on those glyphs. */ | 621 | Update the column/position based on those glyphs. */ |
| @@ -622,8 +629,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 622 | next_element_from_display_vector does it. */ | 629 | next_element_from_display_vector does it. */ |
| 623 | Lisp_Object entry = AREF (charvec, i); | 630 | Lisp_Object entry = AREF (charvec, i); |
| 624 | 631 | ||
| 625 | if (GLYPH_CODE_P (entry) | 632 | if (GLYPH_CODE_P (entry)) |
| 626 | && GLYPH_CODE_CHAR_VALID_P (entry)) | ||
| 627 | c = GLYPH_CODE_CHAR (entry); | 633 | c = GLYPH_CODE_CHAR (entry); |
| 628 | else | 634 | else |
| 629 | c = ' '; | 635 | c = ' '; |
| @@ -698,11 +704,11 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 698 | This function handles characters that are invisible | 704 | This function handles characters that are invisible |
| 699 | due to text properties or overlays. */ | 705 | due to text properties or overlays. */ |
| 700 | 706 | ||
| 701 | static EMACS_INT | 707 | static ptrdiff_t |
| 702 | current_column_1 (void) | 708 | current_column_1 (void) |
| 703 | { | 709 | { |
| 704 | EMACS_INT col = MOST_POSITIVE_FIXNUM; | 710 | EMACS_INT col = MOST_POSITIVE_FIXNUM; |
| 705 | EMACS_INT opoint = PT; | 711 | ptrdiff_t opoint = PT; |
| 706 | 712 | ||
| 707 | scan_for_column (&opoint, &col, NULL); | 713 | scan_for_column (&opoint, &col, NULL); |
| 708 | return col; | 714 | return col; |
| @@ -798,7 +804,7 @@ The return value is COLUMN. */) | |||
| 798 | (Lisp_Object column, Lisp_Object minimum) | 804 | (Lisp_Object column, Lisp_Object minimum) |
| 799 | { | 805 | { |
| 800 | EMACS_INT mincol; | 806 | EMACS_INT mincol; |
| 801 | register EMACS_INT fromcol; | 807 | register ptrdiff_t fromcol; |
| 802 | int tab_width = SANE_TAB_WIDTH (current_buffer); | 808 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 803 | 809 | ||
| 804 | CHECK_NUMBER (column); | 810 | CHECK_NUMBER (column); |
| @@ -845,7 +851,7 @@ following any initial whitespace. */) | |||
| 845 | (void) | 851 | (void) |
| 846 | { | 852 | { |
| 847 | Lisp_Object val; | 853 | Lisp_Object val; |
| 848 | EMACS_INT opoint = PT, opoint_byte = PT_BYTE; | 854 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 849 | 855 | ||
| 850 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); | 856 | scan_newline (PT, PT_BYTE, BEGV, BEGV_BYTE, -1, 1); |
| 851 | 857 | ||
| @@ -854,16 +860,16 @@ following any initial whitespace. */) | |||
| 854 | return val; | 860 | return val; |
| 855 | } | 861 | } |
| 856 | 862 | ||
| 857 | static EMACS_INT | 863 | static ptrdiff_t |
| 858 | position_indentation (ptrdiff_t pos_byte) | 864 | position_indentation (ptrdiff_t pos_byte) |
| 859 | { | 865 | { |
| 860 | register EMACS_INT column = 0; | 866 | register ptrdiff_t column = 0; |
| 861 | int tab_width = SANE_TAB_WIDTH (current_buffer); | 867 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 862 | register unsigned char *p; | 868 | register unsigned char *p; |
| 863 | register unsigned char *stop; | 869 | register unsigned char *stop; |
| 864 | unsigned char *start; | 870 | unsigned char *start; |
| 865 | EMACS_INT next_boundary_byte = pos_byte; | 871 | ptrdiff_t next_boundary_byte = pos_byte; |
| 866 | EMACS_INT ceiling = next_boundary_byte; | 872 | ptrdiff_t ceiling = next_boundary_byte; |
| 867 | 873 | ||
| 868 | p = BYTE_POS_ADDR (pos_byte); | 874 | p = BYTE_POS_ADDR (pos_byte); |
| 869 | /* STOP records the value of P at which we will need | 875 | /* STOP records the value of P at which we will need |
| @@ -876,7 +882,7 @@ position_indentation (ptrdiff_t pos_byte) | |||
| 876 | { | 882 | { |
| 877 | while (p == stop) | 883 | while (p == stop) |
| 878 | { | 884 | { |
| 879 | EMACS_INT stop_pos_byte; | 885 | ptrdiff_t stop_pos_byte; |
| 880 | 886 | ||
| 881 | /* If we have updated P, set POS_BYTE to match. | 887 | /* If we have updated P, set POS_BYTE to match. |
| 882 | The first time we enter the loop, POS_BYTE is already right. */ | 888 | The first time we enter the loop, POS_BYTE is already right. */ |
| @@ -887,8 +893,8 @@ position_indentation (ptrdiff_t pos_byte) | |||
| 887 | return column; | 893 | return column; |
| 888 | if (pos_byte == next_boundary_byte) | 894 | if (pos_byte == next_boundary_byte) |
| 889 | { | 895 | { |
| 890 | EMACS_INT next_boundary; | 896 | ptrdiff_t next_boundary; |
| 891 | EMACS_INT pos = BYTE_TO_CHAR (pos_byte); | 897 | ptrdiff_t pos = BYTE_TO_CHAR (pos_byte); |
| 892 | pos = skip_invisible (pos, &next_boundary, ZV, Qnil); | 898 | pos = skip_invisible (pos, &next_boundary, ZV, Qnil); |
| 893 | pos_byte = CHAR_TO_BYTE (pos); | 899 | pos_byte = CHAR_TO_BYTE (pos); |
| 894 | next_boundary_byte = CHAR_TO_BYTE (next_boundary); | 900 | next_boundary_byte = CHAR_TO_BYTE (next_boundary); |
| @@ -942,10 +948,10 @@ position_indentation (ptrdiff_t pos_byte) | |||
| 942 | preceding line. */ | 948 | preceding line. */ |
| 943 | 949 | ||
| 944 | int | 950 | int |
| 945 | indented_beyond_p (EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT column) | 951 | indented_beyond_p (ptrdiff_t pos, ptrdiff_t pos_byte, EMACS_INT column) |
| 946 | { | 952 | { |
| 947 | EMACS_INT val; | 953 | ptrdiff_t val; |
| 948 | EMACS_INT opoint = PT, opoint_byte = PT_BYTE; | 954 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 949 | 955 | ||
| 950 | SET_PT_BOTH (pos, pos_byte); | 956 | SET_PT_BOTH (pos, pos_byte); |
| 951 | while (PT > BEGV && FETCH_BYTE (PT_BYTE) == '\n') | 957 | while (PT > BEGV && FETCH_BYTE (PT_BYTE) == '\n') |
| @@ -976,8 +982,8 @@ COLUMN, add spaces/tabs to get there. | |||
| 976 | The return value is the current column. */) | 982 | The return value is the current column. */) |
| 977 | (Lisp_Object column, Lisp_Object force) | 983 | (Lisp_Object column, Lisp_Object force) |
| 978 | { | 984 | { |
| 979 | EMACS_INT pos; | 985 | ptrdiff_t pos, prev_col; |
| 980 | EMACS_INT col, prev_col; | 986 | EMACS_INT col; |
| 981 | EMACS_INT goal; | 987 | EMACS_INT goal; |
| 982 | 988 | ||
| 983 | CHECK_NATNUM (column); | 989 | CHECK_NATNUM (column); |
| @@ -994,13 +1000,13 @@ The return value is the current column. */) | |||
| 994 | if (!NILP (force) && col > goal) | 1000 | if (!NILP (force) && col > goal) |
| 995 | { | 1001 | { |
| 996 | int c; | 1002 | int c; |
| 997 | EMACS_INT pos_byte = PT_BYTE; | 1003 | ptrdiff_t pos_byte = PT_BYTE; |
| 998 | 1004 | ||
| 999 | DEC_POS (pos_byte); | 1005 | DEC_POS (pos_byte); |
| 1000 | c = FETCH_CHAR (pos_byte); | 1006 | c = FETCH_CHAR (pos_byte); |
| 1001 | if (c == '\t' && prev_col < goal) | 1007 | if (c == '\t' && prev_col < goal) |
| 1002 | { | 1008 | { |
| 1003 | EMACS_INT goal_pt, goal_pt_byte; | 1009 | ptrdiff_t goal_pt, goal_pt_byte; |
| 1004 | 1010 | ||
| 1005 | /* Insert spaces in front of the tab to reach GOAL. Do this | 1011 | /* Insert spaces in front of the tab to reach GOAL. Do this |
| 1006 | first so that a marker at the end of the tab gets | 1012 | first so that a marker at the end of the tab gets |
| @@ -1099,13 +1105,13 @@ static struct position val_compute_motion; | |||
| 1099 | the scroll bars if they are turned on. */ | 1105 | the scroll bars if they are turned on. */ |
| 1100 | 1106 | ||
| 1101 | struct position * | 1107 | struct position * |
| 1102 | compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, EMACS_INT to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, EMACS_INT hscroll, EMACS_INT tab_offset, struct window *win) | 1108 | compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_motion, ptrdiff_t to, EMACS_INT tovpos, EMACS_INT tohpos, EMACS_INT width, ptrdiff_t hscroll, int tab_offset, struct window *win) |
| 1103 | { | 1109 | { |
| 1104 | register EMACS_INT hpos = fromhpos; | 1110 | register EMACS_INT hpos = fromhpos; |
| 1105 | register EMACS_INT vpos = fromvpos; | 1111 | register EMACS_INT vpos = fromvpos; |
| 1106 | 1112 | ||
| 1107 | register EMACS_INT pos; | 1113 | register ptrdiff_t pos; |
| 1108 | EMACS_INT pos_byte; | 1114 | ptrdiff_t pos_byte; |
| 1109 | register int c = 0; | 1115 | register int c = 0; |
| 1110 | int tab_width = SANE_TAB_WIDTH (current_buffer); | 1116 | int tab_width = SANE_TAB_WIDTH (current_buffer); |
| 1111 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); | 1117 | register int ctl_arrow = !NILP (BVAR (current_buffer, ctl_arrow)); |
| @@ -1114,38 +1120,38 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1114 | = (INTEGERP (BVAR (current_buffer, selective_display)) | 1120 | = (INTEGERP (BVAR (current_buffer, selective_display)) |
| 1115 | ? XINT (BVAR (current_buffer, selective_display)) | 1121 | ? XINT (BVAR (current_buffer, selective_display)) |
| 1116 | : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); | 1122 | : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); |
| 1117 | int selective_rlen | 1123 | ptrdiff_t selective_rlen |
| 1118 | = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) | 1124 | = (selective && dp && VECTORP (DISP_INVIS_VECTOR (dp)) |
| 1119 | ? ASIZE (DISP_INVIS_VECTOR (dp)) : 0); | 1125 | ? ASIZE (DISP_INVIS_VECTOR (dp)) : 0); |
| 1120 | /* The next location where the `invisible' property changes, or an | 1126 | /* The next location where the `invisible' property changes, or an |
| 1121 | overlay starts or ends. */ | 1127 | overlay starts or ends. */ |
| 1122 | EMACS_INT next_boundary = from; | 1128 | ptrdiff_t next_boundary = from; |
| 1123 | 1129 | ||
| 1124 | /* For computing runs of characters with similar widths. | 1130 | /* For computing runs of characters with similar widths. |
| 1125 | Invariant: width_run_width is zero, or all the characters | 1131 | Invariant: width_run_width is zero, or all the characters |
| 1126 | from width_run_start to width_run_end have a fixed width of | 1132 | from width_run_start to width_run_end have a fixed width of |
| 1127 | width_run_width. */ | 1133 | width_run_width. */ |
| 1128 | EMACS_INT width_run_start = from; | 1134 | ptrdiff_t width_run_start = from; |
| 1129 | EMACS_INT width_run_end = from; | 1135 | ptrdiff_t width_run_end = from; |
| 1130 | EMACS_INT width_run_width = 0; | 1136 | ptrdiff_t width_run_width = 0; |
| 1131 | Lisp_Object *width_table; | 1137 | Lisp_Object *width_table; |
| 1132 | Lisp_Object buffer; | 1138 | Lisp_Object buffer; |
| 1133 | 1139 | ||
| 1134 | /* The next buffer pos where we should consult the width run cache. */ | 1140 | /* The next buffer pos where we should consult the width run cache. */ |
| 1135 | EMACS_INT next_width_run = from; | 1141 | ptrdiff_t next_width_run = from; |
| 1136 | Lisp_Object window; | 1142 | Lisp_Object window; |
| 1137 | 1143 | ||
| 1138 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 1144 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 1139 | /* If previous char scanned was a wide character, | 1145 | /* If previous char scanned was a wide character, |
| 1140 | this is the column where it ended. Otherwise, this is 0. */ | 1146 | this is the column where it ended. Otherwise, this is 0. */ |
| 1141 | EMACS_INT wide_column_end_hpos = 0; | 1147 | EMACS_INT wide_column_end_hpos = 0; |
| 1142 | EMACS_INT prev_pos; /* Previous buffer position. */ | 1148 | ptrdiff_t prev_pos; /* Previous buffer position. */ |
| 1143 | EMACS_INT prev_pos_byte; /* Previous buffer position. */ | 1149 | ptrdiff_t prev_pos_byte; /* Previous buffer position. */ |
| 1144 | EMACS_INT prev_hpos = 0; | 1150 | EMACS_INT prev_hpos = 0; |
| 1145 | EMACS_INT prev_vpos = 0; | 1151 | EMACS_INT prev_vpos = 0; |
| 1146 | EMACS_INT contin_hpos; /* HPOS of last column of continued line. */ | 1152 | EMACS_INT contin_hpos; /* HPOS of last column of continued line. */ |
| 1147 | EMACS_INT prev_tab_offset; /* Previous tab offset. */ | 1153 | int prev_tab_offset; /* Previous tab offset. */ |
| 1148 | EMACS_INT continuation_glyph_width; | 1154 | int continuation_glyph_width; |
| 1149 | 1155 | ||
| 1150 | struct composition_it cmp_it; | 1156 | struct composition_it cmp_it; |
| 1151 | 1157 | ||
| @@ -1194,8 +1200,8 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1194 | { | 1200 | { |
| 1195 | while (pos == next_boundary) | 1201 | while (pos == next_boundary) |
| 1196 | { | 1202 | { |
| 1197 | EMACS_INT pos_here = pos; | 1203 | ptrdiff_t pos_here = pos; |
| 1198 | EMACS_INT newpos; | 1204 | ptrdiff_t newpos; |
| 1199 | 1205 | ||
| 1200 | /* Don't skip invisible if we are already at the margin. */ | 1206 | /* Don't skip invisible if we are already at the margin. */ |
| 1201 | if (vpos > tovpos || (vpos == tovpos && hpos >= tohpos)) | 1207 | if (vpos > tovpos || (vpos == tovpos && hpos >= tohpos)) |
| @@ -1229,7 +1235,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1229 | to be changed here. */ | 1235 | to be changed here. */ |
| 1230 | { | 1236 | { |
| 1231 | unsigned char *ovstr; | 1237 | unsigned char *ovstr; |
| 1232 | EMACS_INT ovlen = overlay_strings (pos, win, &ovstr); | 1238 | ptrdiff_t ovlen = overlay_strings (pos, win, &ovstr); |
| 1233 | hpos += ((multibyte && ovlen > 0) | 1239 | hpos += ((multibyte && ovlen > 0) |
| 1234 | ? strwidth ((char *) ovstr, ovlen) : ovlen); | 1240 | ? strwidth ((char *) ovstr, ovlen) : ovlen); |
| 1235 | } | 1241 | } |
| @@ -1304,7 +1310,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1304 | 1310 | ||
| 1305 | if (hpos > width) | 1311 | if (hpos > width) |
| 1306 | { | 1312 | { |
| 1307 | int total_width = width + continuation_glyph_width; | 1313 | EMACS_INT total_width = width + continuation_glyph_width; |
| 1308 | int truncate = 0; | 1314 | int truncate = 0; |
| 1309 | 1315 | ||
| 1310 | if (!NILP (Vtruncate_partial_width_windows) | 1316 | if (!NILP (Vtruncate_partial_width_windows) |
| @@ -1434,7 +1440,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1434 | want to skip over it for some other reason. */ | 1440 | want to skip over it for some other reason. */ |
| 1435 | if (common_width != 0) | 1441 | if (common_width != 0) |
| 1436 | { | 1442 | { |
| 1437 | EMACS_INT run_end_hpos; | 1443 | ptrdiff_t run_end_hpos; |
| 1438 | 1444 | ||
| 1439 | /* Don't go past the final buffer posn the user | 1445 | /* Don't go past the final buffer posn the user |
| 1440 | requested. */ | 1446 | requested. */ |
| @@ -1474,7 +1480,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1474 | /* We have to scan the text character-by-character. */ | 1480 | /* We have to scan the text character-by-character. */ |
| 1475 | else | 1481 | else |
| 1476 | { | 1482 | { |
| 1477 | EMACS_INT i, n; | 1483 | ptrdiff_t i, n; |
| 1478 | Lisp_Object charvec; | 1484 | Lisp_Object charvec; |
| 1479 | 1485 | ||
| 1480 | /* Check composition sequence. */ | 1486 | /* Check composition sequence. */ |
| @@ -1551,8 +1557,7 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1551 | next_element_from_display_vector does it. */ | 1557 | next_element_from_display_vector does it. */ |
| 1552 | Lisp_Object entry = AREF (charvec, i); | 1558 | Lisp_Object entry = AREF (charvec, i); |
| 1553 | 1559 | ||
| 1554 | if (GLYPH_CODE_P (entry) | 1560 | if (GLYPH_CODE_P (entry)) |
| 1555 | && GLYPH_CODE_CHAR_VALID_P (entry)) | ||
| 1556 | c = GLYPH_CODE_CHAR (entry); | 1561 | c = GLYPH_CODE_CHAR (entry); |
| 1557 | else | 1562 | else |
| 1558 | c = ' '; | 1563 | c = ' '; |
| @@ -1675,8 +1680,6 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1675 | val_compute_motion.prevhpos = contin_hpos; | 1680 | val_compute_motion.prevhpos = contin_hpos; |
| 1676 | else | 1681 | else |
| 1677 | val_compute_motion.prevhpos = prev_hpos; | 1682 | val_compute_motion.prevhpos = prev_hpos; |
| 1678 | /* We alalways handle all of them here; none of them remain to do. */ | ||
| 1679 | val_compute_motion.ovstring_chars_done = 0; | ||
| 1680 | 1683 | ||
| 1681 | /* Nonzero if have just continued a line */ | 1684 | /* Nonzero if have just continued a line */ |
| 1682 | val_compute_motion.contin = (contin_hpos && prev_hpos == 0); | 1685 | val_compute_motion.contin = (contin_hpos && prev_hpos == 0); |
| @@ -1733,7 +1736,8 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) | |||
| 1733 | struct window *w; | 1736 | struct window *w; |
| 1734 | Lisp_Object bufpos, hpos, vpos, prevhpos; | 1737 | Lisp_Object bufpos, hpos, vpos, prevhpos; |
| 1735 | struct position *pos; | 1738 | struct position *pos; |
| 1736 | EMACS_INT hscroll, tab_offset; | 1739 | ptrdiff_t hscroll; |
| 1740 | int tab_offset; | ||
| 1737 | 1741 | ||
| 1738 | CHECK_NUMBER_COERCE_MARKER (from); | 1742 | CHECK_NUMBER_COERCE_MARKER (from); |
| 1739 | CHECK_CONS (frompos); | 1743 | CHECK_CONS (frompos); |
| @@ -1754,6 +1758,9 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) | |||
| 1754 | CHECK_CONS (offsets); | 1758 | CHECK_CONS (offsets); |
| 1755 | CHECK_NUMBER_CAR (offsets); | 1759 | CHECK_NUMBER_CAR (offsets); |
| 1756 | CHECK_NUMBER_CDR (offsets); | 1760 | CHECK_NUMBER_CDR (offsets); |
| 1761 | if (! (0 <= XINT (XCAR (offsets)) && XINT (XCAR (offsets)) <= PTRDIFF_MAX | ||
| 1762 | && 0 <= XINT (XCDR (offsets)) && XINT (XCDR (offsets)) <= INT_MAX)) | ||
| 1763 | args_out_of_range (XCAR (offsets), XCDR (offsets)); | ||
| 1757 | hscroll = XINT (XCAR (offsets)); | 1764 | hscroll = XINT (XCAR (offsets)); |
| 1758 | tab_offset = XINT (XCDR (offsets)); | 1765 | tab_offset = XINT (XCDR (offsets)); |
| 1759 | } | 1766 | } |
| @@ -1807,22 +1814,22 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) | |||
| 1807 | static struct position val_vmotion; | 1814 | static struct position val_vmotion; |
| 1808 | 1815 | ||
| 1809 | struct position * | 1816 | struct position * |
| 1810 | vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) | 1817 | vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) |
| 1811 | { | 1818 | { |
| 1812 | EMACS_INT hscroll = XINT (w->hscroll); | 1819 | ptrdiff_t hscroll = XINT (w->hscroll); |
| 1813 | struct position pos; | 1820 | struct position pos; |
| 1814 | /* vpos is cumulative vertical position, changed as from is changed */ | 1821 | /* vpos is cumulative vertical position, changed as from is changed */ |
| 1815 | register int vpos = 0; | 1822 | register EMACS_INT vpos = 0; |
| 1816 | EMACS_INT prevline; | 1823 | ptrdiff_t prevline; |
| 1817 | register EMACS_INT first; | 1824 | register ptrdiff_t first; |
| 1818 | EMACS_INT from_byte; | 1825 | ptrdiff_t from_byte; |
| 1819 | EMACS_INT lmargin = hscroll > 0 ? 1 - hscroll : 0; | 1826 | ptrdiff_t lmargin = hscroll > 0 ? 1 - hscroll : 0; |
| 1820 | EMACS_INT selective | 1827 | ptrdiff_t selective |
| 1821 | = (INTEGERP (BVAR (current_buffer, selective_display)) | 1828 | = (INTEGERP (BVAR (current_buffer, selective_display)) |
| 1822 | ? XINT (BVAR (current_buffer, selective_display)) | 1829 | ? clip_to_bounds (-1, XINT (BVAR (current_buffer, selective_display)), |
| 1830 | PTRDIFF_MAX) | ||
| 1823 | : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); | 1831 | : !NILP (BVAR (current_buffer, selective_display)) ? -1 : 0); |
| 1824 | Lisp_Object window; | 1832 | Lisp_Object window; |
| 1825 | EMACS_INT start_hpos = 0; | ||
| 1826 | int did_motion; | 1833 | int did_motion; |
| 1827 | /* This is the object we use for fetching character properties. */ | 1834 | /* This is the object we use for fetching character properties. */ |
| 1828 | Lisp_Object text_prop_object; | 1835 | Lisp_Object text_prop_object; |
| @@ -1861,7 +1868,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) | |||
| 1861 | TEXT_PROP_MEANS_INVISIBLE (propval)))) | 1868 | TEXT_PROP_MEANS_INVISIBLE (propval)))) |
| 1862 | prevline = find_next_newline_no_quit (prevline - 1, -1); | 1869 | prevline = find_next_newline_no_quit (prevline - 1, -1); |
| 1863 | pos = *compute_motion (prevline, 0, | 1870 | pos = *compute_motion (prevline, 0, |
| 1864 | lmargin + (prevline == BEG ? start_hpos : 0), | 1871 | lmargin, |
| 1865 | 0, | 1872 | 0, |
| 1866 | from, | 1873 | from, |
| 1867 | /* Don't care for VPOS... */ | 1874 | /* Don't care for VPOS... */ |
| @@ -1869,10 +1876,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) | |||
| 1869 | /* ... nor HPOS. */ | 1876 | /* ... nor HPOS. */ |
| 1870 | 1 << (BITS_PER_SHORT - 1), | 1877 | 1 << (BITS_PER_SHORT - 1), |
| 1871 | -1, hscroll, | 1878 | -1, hscroll, |
| 1872 | /* This compensates for start_hpos | 1879 | 0, |
| 1873 | so that a tab as first character | ||
| 1874 | still occupies 8 columns. */ | ||
| 1875 | (prevline == BEG ? -start_hpos : 0), | ||
| 1876 | w); | 1880 | w); |
| 1877 | vpos -= pos.vpos; | 1881 | vpos -= pos.vpos; |
| 1878 | first = 0; | 1882 | first = 0; |
| @@ -1890,8 +1894,6 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) | |||
| 1890 | val_vmotion.hpos = lmargin; | 1894 | val_vmotion.hpos = lmargin; |
| 1891 | val_vmotion.contin = 0; | 1895 | val_vmotion.contin = 0; |
| 1892 | val_vmotion.prevhpos = 0; | 1896 | val_vmotion.prevhpos = 0; |
| 1893 | val_vmotion.ovstring_chars_done = 0; | ||
| 1894 | val_vmotion.tab_offset = 0; /* For accumulating tab offset. */ | ||
| 1895 | return &val_vmotion; | 1897 | return &val_vmotion; |
| 1896 | } | 1898 | } |
| 1897 | 1899 | ||
| @@ -1918,8 +1920,7 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) | |||
| 1918 | TEXT_PROP_MEANS_INVISIBLE (propval)))) | 1920 | TEXT_PROP_MEANS_INVISIBLE (propval)))) |
| 1919 | prevline = find_next_newline_no_quit (prevline - 1, -1); | 1921 | prevline = find_next_newline_no_quit (prevline - 1, -1); |
| 1920 | pos = *compute_motion (prevline, 0, | 1922 | pos = *compute_motion (prevline, 0, |
| 1921 | lmargin + (prevline == BEG | 1923 | lmargin, |
| 1922 | ? start_hpos : 0), | ||
| 1923 | 0, | 1924 | 0, |
| 1924 | from, | 1925 | from, |
| 1925 | /* Don't care for VPOS... */ | 1926 | /* Don't care for VPOS... */ |
| @@ -1927,21 +1928,20 @@ vmotion (register EMACS_INT from, register EMACS_INT vtarget, struct window *w) | |||
| 1927 | /* ... nor HPOS. */ | 1928 | /* ... nor HPOS. */ |
| 1928 | 1 << (BITS_PER_SHORT - 1), | 1929 | 1 << (BITS_PER_SHORT - 1), |
| 1929 | -1, hscroll, | 1930 | -1, hscroll, |
| 1930 | (prevline == BEG ? -start_hpos : 0), | 1931 | 0, |
| 1931 | w); | 1932 | w); |
| 1932 | did_motion = 1; | 1933 | did_motion = 1; |
| 1933 | } | 1934 | } |
| 1934 | else | 1935 | else |
| 1935 | { | 1936 | { |
| 1936 | pos.hpos = lmargin + (from == BEG ? start_hpos : 0); | 1937 | pos.hpos = lmargin; |
| 1937 | pos.vpos = 0; | 1938 | pos.vpos = 0; |
| 1938 | pos.tab_offset = 0; | ||
| 1939 | did_motion = 0; | 1939 | did_motion = 0; |
| 1940 | } | 1940 | } |
| 1941 | return compute_motion (from, vpos, pos.hpos, did_motion, | 1941 | return compute_motion (from, vpos, pos.hpos, did_motion, |
| 1942 | ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), | 1942 | ZV, vtarget, - (1 << (BITS_PER_SHORT - 1)), |
| 1943 | -1, hscroll, | 1943 | -1, hscroll, |
| 1944 | pos.tab_offset - (from == BEG ? start_hpos : 0), | 1944 | 0, |
| 1945 | w); | 1945 | w); |
| 1946 | } | 1946 | } |
| 1947 | 1947 | ||
| @@ -2018,7 +2018,7 @@ whether or not it is currently displayed in some window. */) | |||
| 2018 | } | 2018 | } |
| 2019 | else | 2019 | else |
| 2020 | { | 2020 | { |
| 2021 | EMACS_INT it_start; | 2021 | ptrdiff_t it_start; |
| 2022 | int first_x, it_overshoot_expected IF_LINT (= 0); | 2022 | int first_x, it_overshoot_expected IF_LINT (= 0); |
| 2023 | 2023 | ||
| 2024 | itdata = bidi_shelve_cache (); | 2024 | itdata = bidi_shelve_cache (); |
diff --git a/src/indent.h b/src/indent.h index 07ca4dd87a5..4731bf0994b 100644 --- a/src/indent.h +++ b/src/indent.h | |||
| @@ -16,51 +16,29 @@ GNU General Public License for more details. | |||
| 16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 17 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 18 | 18 | ||
| 19 | /* We introduce new member `tab_offset'. We need it because of the | ||
| 20 | existence of wide-column characters. There is a case that the | ||
| 21 | line-break occurs at a wide-column character and the number of | ||
| 22 | colums of the line gets less than width. | ||
| 23 | |||
| 24 | Example (where W_ stands for a wide-column character): | ||
| 25 | ---------- | ||
| 26 | abcdefgh\\ | ||
| 27 | W_ | ||
| 28 | ---------- | ||
| 29 | |||
| 30 | To handle this case, we should not calculate the tab offset by | ||
| 31 | tab_offset += width; | ||
| 32 | |||
| 33 | Instead, we must remember tab_offset of the line. | ||
| 34 | |||
| 35 | */ | ||
| 36 | |||
| 37 | struct position | 19 | struct position |
| 38 | { | 20 | { |
| 39 | EMACS_INT bufpos; | 21 | ptrdiff_t bufpos; |
| 40 | EMACS_INT bytepos; | 22 | ptrdiff_t bytepos; |
| 41 | EMACS_INT hpos; | 23 | EMACS_INT hpos; |
| 42 | EMACS_INT vpos; | 24 | EMACS_INT vpos; |
| 43 | EMACS_INT prevhpos; | 25 | EMACS_INT prevhpos; |
| 44 | EMACS_INT contin; | 26 | int contin; |
| 45 | /* Number of characters we have already handled | ||
| 46 | from the before and after strings at this position. */ | ||
| 47 | EMACS_INT ovstring_chars_done; | ||
| 48 | EMACS_INT tab_offset; | ||
| 49 | }; | 27 | }; |
| 50 | 28 | ||
| 51 | struct position *compute_motion (EMACS_INT from, EMACS_INT fromvpos, | 29 | struct position *compute_motion (ptrdiff_t from, ptrdiff_t fromvpos, |
| 52 | EMACS_INT fromhpos, int did_motion, | 30 | ptrdiff_t fromhpos, int did_motion, |
| 53 | EMACS_INT to, EMACS_INT tovpos, | 31 | ptrdiff_t to, ptrdiff_t tovpos, |
| 54 | EMACS_INT tohpos, | 32 | ptrdiff_t tohpos, |
| 55 | EMACS_INT width, EMACS_INT hscroll, | 33 | ptrdiff_t width, ptrdiff_t hscroll, |
| 56 | EMACS_INT tab_offset, struct window *); | 34 | int tab_offset, struct window *); |
| 57 | struct position *vmotion (EMACS_INT from, EMACS_INT vtarget, | 35 | struct position *vmotion (ptrdiff_t from, ptrdiff_t vtarget, |
| 58 | struct window *); | 36 | struct window *); |
| 59 | EMACS_INT skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, | 37 | ptrdiff_t skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, |
| 60 | EMACS_INT to, Lisp_Object window); | 38 | ptrdiff_t to, Lisp_Object window); |
| 61 | 39 | ||
| 62 | /* Value of point when current_column was called */ | 40 | /* Value of point when current_column was called */ |
| 63 | extern EMACS_INT last_known_column_point; | 41 | extern ptrdiff_t last_known_column_point; |
| 64 | 42 | ||
| 65 | /* Functions for dealing with the column cache. */ | 43 | /* Functions for dealing with the column cache. */ |
| 66 | 44 | ||
| @@ -73,5 +51,3 @@ int disptab_matches_widthtab (struct Lisp_Char_Table *disptab, | |||
| 73 | /* Recompute BUF's width table, using the display table DISPTAB. */ | 51 | /* Recompute BUF's width table, using the display table DISPTAB. */ |
| 74 | void recompute_width_table (struct buffer *buf, | 52 | void recompute_width_table (struct buffer *buf, |
| 75 | struct Lisp_Char_Table *disptab); | 53 | struct Lisp_Char_Table *disptab); |
| 76 | |||
| 77 | |||
diff --git a/src/insdel.c b/src/insdel.c index 01e5c57b2b0..0a9777ad95e 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -36,14 +36,14 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 36 | #endif | 36 | #endif |
| 37 | 37 | ||
| 38 | static void insert_from_string_1 (Lisp_Object string, | 38 | static void insert_from_string_1 (Lisp_Object string, |
| 39 | EMACS_INT pos, EMACS_INT pos_byte, | 39 | ptrdiff_t pos, ptrdiff_t pos_byte, |
| 40 | EMACS_INT nchars, EMACS_INT nbytes, | 40 | ptrdiff_t nchars, ptrdiff_t nbytes, |
| 41 | int inherit, int before_markers); | 41 | int inherit, int before_markers); |
| 42 | static void insert_from_buffer_1 (struct buffer *buf, | 42 | static void insert_from_buffer_1 (struct buffer *buf, |
| 43 | EMACS_INT from, EMACS_INT nchars, | 43 | ptrdiff_t from, ptrdiff_t nchars, |
| 44 | int inherit); | 44 | int inherit); |
| 45 | static void gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap); | 45 | static void gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap); |
| 46 | static void gap_right (EMACS_INT charpos, EMACS_INT bytepos); | 46 | static void gap_right (ptrdiff_t charpos, ptrdiff_t bytepos); |
| 47 | 47 | ||
| 48 | static Lisp_Object Fcombine_after_change_execute (void); | 48 | static Lisp_Object Fcombine_after_change_execute (void); |
| 49 | 49 | ||
| @@ -64,7 +64,7 @@ static Lisp_Object combine_after_change_buffer; | |||
| 64 | 64 | ||
| 65 | Lisp_Object Qinhibit_modification_hooks; | 65 | Lisp_Object Qinhibit_modification_hooks; |
| 66 | 66 | ||
| 67 | static void signal_before_change (EMACS_INT, EMACS_INT, EMACS_INT *); | 67 | static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *); |
| 68 | 68 | ||
| 69 | #define CHECK_MARKERS() \ | 69 | #define CHECK_MARKERS() \ |
| 70 | do \ | 70 | do \ |
| @@ -97,7 +97,7 @@ check_markers (void) | |||
| 97 | Note that this can quit! */ | 97 | Note that this can quit! */ |
| 98 | 98 | ||
| 99 | void | 99 | void |
| 100 | move_gap (EMACS_INT charpos) | 100 | move_gap (ptrdiff_t charpos) |
| 101 | { | 101 | { |
| 102 | move_gap_both (charpos, charpos_to_bytepos (charpos)); | 102 | move_gap_both (charpos, charpos_to_bytepos (charpos)); |
| 103 | } | 103 | } |
| @@ -106,7 +106,7 @@ move_gap (EMACS_INT charpos) | |||
| 106 | Note that this can quit! */ | 106 | Note that this can quit! */ |
| 107 | 107 | ||
| 108 | void | 108 | void |
| 109 | move_gap_both (EMACS_INT charpos, EMACS_INT bytepos) | 109 | move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 110 | { | 110 | { |
| 111 | if (bytepos < GPT_BYTE) | 111 | if (bytepos < GPT_BYTE) |
| 112 | gap_left (charpos, bytepos, 0); | 112 | gap_left (charpos, bytepos, 0); |
| @@ -120,11 +120,11 @@ move_gap_both (EMACS_INT charpos, EMACS_INT bytepos) | |||
| 120 | If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */ | 120 | If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */ |
| 121 | 121 | ||
| 122 | static void | 122 | static void |
| 123 | gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap) | 123 | gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap) |
| 124 | { | 124 | { |
| 125 | register unsigned char *to, *from; | 125 | register unsigned char *to, *from; |
| 126 | register EMACS_INT i; | 126 | register ptrdiff_t i; |
| 127 | EMACS_INT new_s1; | 127 | ptrdiff_t new_s1; |
| 128 | 128 | ||
| 129 | if (!newgap) | 129 | if (!newgap) |
| 130 | BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); | 130 | BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); |
| @@ -175,11 +175,11 @@ gap_left (EMACS_INT charpos, EMACS_INT bytepos, int newgap) | |||
| 175 | and CHARPOS is the corresponding char position. */ | 175 | and CHARPOS is the corresponding char position. */ |
| 176 | 176 | ||
| 177 | static void | 177 | static void |
| 178 | gap_right (EMACS_INT charpos, EMACS_INT bytepos) | 178 | gap_right (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 179 | { | 179 | { |
| 180 | register unsigned char *to, *from; | 180 | register unsigned char *to, *from; |
| 181 | register EMACS_INT i; | 181 | register ptrdiff_t i; |
| 182 | EMACS_INT new_s1; | 182 | ptrdiff_t new_s1; |
| 183 | 183 | ||
| 184 | BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); | 184 | BUF_COMPUTE_UNCHANGED (current_buffer, charpos, GPT); |
| 185 | 185 | ||
| @@ -229,12 +229,12 @@ gap_right (EMACS_INT charpos, EMACS_INT bytepos) | |||
| 229 | or inside of the range being deleted. */ | 229 | or inside of the range being deleted. */ |
| 230 | 230 | ||
| 231 | void | 231 | void |
| 232 | adjust_markers_for_delete (EMACS_INT from, EMACS_INT from_byte, | 232 | adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte, |
| 233 | EMACS_INT to, EMACS_INT to_byte) | 233 | ptrdiff_t to, ptrdiff_t to_byte) |
| 234 | { | 234 | { |
| 235 | Lisp_Object marker; | 235 | Lisp_Object marker; |
| 236 | register struct Lisp_Marker *m; | 236 | register struct Lisp_Marker *m; |
| 237 | register EMACS_INT charpos; | 237 | register ptrdiff_t charpos; |
| 238 | 238 | ||
| 239 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) | 239 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) |
| 240 | { | 240 | { |
| @@ -294,13 +294,13 @@ adjust_markers_for_delete (EMACS_INT from, EMACS_INT from_byte, | |||
| 294 | or BEFORE_MARKERS is true. */ | 294 | or BEFORE_MARKERS is true. */ |
| 295 | 295 | ||
| 296 | static void | 296 | static void |
| 297 | adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, | 297 | adjust_markers_for_insert (ptrdiff_t from, ptrdiff_t from_byte, |
| 298 | EMACS_INT to, EMACS_INT to_byte, int before_markers) | 298 | ptrdiff_t to, ptrdiff_t to_byte, int before_markers) |
| 299 | { | 299 | { |
| 300 | struct Lisp_Marker *m; | 300 | struct Lisp_Marker *m; |
| 301 | int adjusted = 0; | 301 | int adjusted = 0; |
| 302 | EMACS_INT nchars = to - from; | 302 | ptrdiff_t nchars = to - from; |
| 303 | EMACS_INT nbytes = to_byte - from_byte; | 303 | ptrdiff_t nbytes = to_byte - from_byte; |
| 304 | 304 | ||
| 305 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) | 305 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) |
| 306 | { | 306 | { |
| @@ -345,7 +345,7 @@ adjust_markers_for_insert (EMACS_INT from, EMACS_INT from_byte, | |||
| 345 | intervals. */ | 345 | intervals. */ |
| 346 | 346 | ||
| 347 | static void | 347 | static void |
| 348 | adjust_point (EMACS_INT nchars, EMACS_INT nbytes) | 348 | adjust_point (ptrdiff_t nchars, ptrdiff_t nbytes) |
| 349 | { | 349 | { |
| 350 | SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes); | 350 | SET_BUF_PT_BOTH (current_buffer, PT + nchars, PT_BYTE + nbytes); |
| 351 | /* In a single-byte buffer, the two positions must be equal. */ | 351 | /* In a single-byte buffer, the two positions must be equal. */ |
| @@ -358,14 +358,14 @@ adjust_point (EMACS_INT nchars, EMACS_INT nbytes) | |||
| 358 | an insertion. */ | 358 | an insertion. */ |
| 359 | 359 | ||
| 360 | static void | 360 | static void |
| 361 | adjust_markers_for_replace (EMACS_INT from, EMACS_INT from_byte, | 361 | adjust_markers_for_replace (ptrdiff_t from, ptrdiff_t from_byte, |
| 362 | EMACS_INT old_chars, EMACS_INT old_bytes, | 362 | ptrdiff_t old_chars, ptrdiff_t old_bytes, |
| 363 | EMACS_INT new_chars, EMACS_INT new_bytes) | 363 | ptrdiff_t new_chars, ptrdiff_t new_bytes) |
| 364 | { | 364 | { |
| 365 | register struct Lisp_Marker *m; | 365 | register struct Lisp_Marker *m; |
| 366 | EMACS_INT prev_to_byte = from_byte + old_bytes; | 366 | ptrdiff_t prev_to_byte = from_byte + old_bytes; |
| 367 | EMACS_INT diff_chars = new_chars - old_chars; | 367 | ptrdiff_t diff_chars = new_chars - old_chars; |
| 368 | EMACS_INT diff_bytes = new_bytes - old_bytes; | 368 | ptrdiff_t diff_bytes = new_bytes - old_bytes; |
| 369 | 369 | ||
| 370 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) | 370 | for (m = BUF_MARKERS (current_buffer); m; m = m->next) |
| 371 | { | 371 | { |
| @@ -394,13 +394,13 @@ buffer_overflow (void) | |||
| 394 | /* Make the gap NBYTES_ADDED bytes longer. */ | 394 | /* Make the gap NBYTES_ADDED bytes longer. */ |
| 395 | 395 | ||
| 396 | static void | 396 | static void |
| 397 | make_gap_larger (EMACS_INT nbytes_added) | 397 | make_gap_larger (ptrdiff_t nbytes_added) |
| 398 | { | 398 | { |
| 399 | Lisp_Object tem; | 399 | Lisp_Object tem; |
| 400 | EMACS_INT real_gap_loc; | 400 | ptrdiff_t real_gap_loc; |
| 401 | EMACS_INT real_gap_loc_byte; | 401 | ptrdiff_t real_gap_loc_byte; |
| 402 | EMACS_INT old_gap_size; | 402 | ptrdiff_t old_gap_size; |
| 403 | EMACS_INT current_size = Z_BYTE - BEG_BYTE + GAP_SIZE; | 403 | ptrdiff_t current_size = Z_BYTE - BEG_BYTE + GAP_SIZE; |
| 404 | enum { enough_for_a_while = 2000 }; | 404 | enum { enough_for_a_while = 2000 }; |
| 405 | 405 | ||
| 406 | if (BUF_BYTES_MAX - current_size < nbytes_added) | 406 | if (BUF_BYTES_MAX - current_size < nbytes_added) |
| @@ -446,15 +446,15 @@ make_gap_larger (EMACS_INT nbytes_added) | |||
| 446 | /* Make the gap NBYTES_REMOVED bytes shorter. */ | 446 | /* Make the gap NBYTES_REMOVED bytes shorter. */ |
| 447 | 447 | ||
| 448 | static void | 448 | static void |
| 449 | make_gap_smaller (EMACS_INT nbytes_removed) | 449 | make_gap_smaller (ptrdiff_t nbytes_removed) |
| 450 | { | 450 | { |
| 451 | Lisp_Object tem; | 451 | Lisp_Object tem; |
| 452 | EMACS_INT real_gap_loc; | 452 | ptrdiff_t real_gap_loc; |
| 453 | EMACS_INT real_gap_loc_byte; | 453 | ptrdiff_t real_gap_loc_byte; |
| 454 | EMACS_INT real_Z; | 454 | ptrdiff_t real_Z; |
| 455 | EMACS_INT real_Z_byte; | 455 | ptrdiff_t real_Z_byte; |
| 456 | EMACS_INT real_beg_unchanged; | 456 | ptrdiff_t real_beg_unchanged; |
| 457 | EMACS_INT new_gap_size; | 457 | ptrdiff_t new_gap_size; |
| 458 | 458 | ||
| 459 | /* Make sure the gap is at least 20 bytes. */ | 459 | /* Make sure the gap is at least 20 bytes. */ |
| 460 | if (GAP_SIZE - nbytes_removed < 20) | 460 | if (GAP_SIZE - nbytes_removed < 20) |
| @@ -504,7 +504,7 @@ make_gap_smaller (EMACS_INT nbytes_removed) | |||
| 504 | #endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */ | 504 | #endif /* USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC */ |
| 505 | 505 | ||
| 506 | void | 506 | void |
| 507 | make_gap (EMACS_INT nbytes_added) | 507 | make_gap (ptrdiff_t nbytes_added) |
| 508 | { | 508 | { |
| 509 | if (nbytes_added >= 0) | 509 | if (nbytes_added >= 0) |
| 510 | make_gap_larger (nbytes_added); | 510 | make_gap_larger (nbytes_added); |
| @@ -521,9 +521,9 @@ make_gap (EMACS_INT nbytes_added) | |||
| 521 | 521 | ||
| 522 | Return the number of bytes stored at TO_ADDR. */ | 522 | Return the number of bytes stored at TO_ADDR. */ |
| 523 | 523 | ||
| 524 | EMACS_INT | 524 | ptrdiff_t |
| 525 | copy_text (const unsigned char *from_addr, unsigned char *to_addr, | 525 | copy_text (const unsigned char *from_addr, unsigned char *to_addr, |
| 526 | EMACS_INT nbytes, int from_multibyte, int to_multibyte) | 526 | ptrdiff_t nbytes, int from_multibyte, int to_multibyte) |
| 527 | { | 527 | { |
| 528 | if (from_multibyte == to_multibyte) | 528 | if (from_multibyte == to_multibyte) |
| 529 | { | 529 | { |
| @@ -532,8 +532,8 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr, | |||
| 532 | } | 532 | } |
| 533 | else if (from_multibyte) | 533 | else if (from_multibyte) |
| 534 | { | 534 | { |
| 535 | EMACS_INT nchars = 0; | 535 | ptrdiff_t nchars = 0; |
| 536 | EMACS_INT bytes_left = nbytes; | 536 | ptrdiff_t bytes_left = nbytes; |
| 537 | 537 | ||
| 538 | while (bytes_left > 0) | 538 | while (bytes_left > 0) |
| 539 | { | 539 | { |
| @@ -580,11 +580,11 @@ copy_text (const unsigned char *from_addr, unsigned char *to_addr, | |||
| 580 | prepare_to_modify_buffer could relocate the text. */ | 580 | prepare_to_modify_buffer could relocate the text. */ |
| 581 | 581 | ||
| 582 | void | 582 | void |
| 583 | insert (const char *string, EMACS_INT nbytes) | 583 | insert (const char *string, ptrdiff_t nbytes) |
| 584 | { | 584 | { |
| 585 | if (nbytes > 0) | 585 | if (nbytes > 0) |
| 586 | { | 586 | { |
| 587 | EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint; | 587 | ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint; |
| 588 | insert_1_both (string, len, nbytes, 0, 1, 0); | 588 | insert_1_both (string, len, nbytes, 0, 1, 0); |
| 589 | opoint = PT - len; | 589 | opoint = PT - len; |
| 590 | signal_after_change (opoint, 0, len); | 590 | signal_after_change (opoint, 0, len); |
| @@ -595,11 +595,11 @@ insert (const char *string, EMACS_INT nbytes) | |||
| 595 | /* Likewise, but inherit text properties from neighboring characters. */ | 595 | /* Likewise, but inherit text properties from neighboring characters. */ |
| 596 | 596 | ||
| 597 | void | 597 | void |
| 598 | insert_and_inherit (const char *string, EMACS_INT nbytes) | 598 | insert_and_inherit (const char *string, ptrdiff_t nbytes) |
| 599 | { | 599 | { |
| 600 | if (nbytes > 0) | 600 | if (nbytes > 0) |
| 601 | { | 601 | { |
| 602 | EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint; | 602 | ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint; |
| 603 | insert_1_both (string, len, nbytes, 1, 1, 0); | 603 | insert_1_both (string, len, nbytes, 1, 1, 0); |
| 604 | opoint = PT - len; | 604 | opoint = PT - len; |
| 605 | signal_after_change (opoint, 0, len); | 605 | signal_after_change (opoint, 0, len); |
| @@ -640,11 +640,11 @@ insert_string (const char *s) | |||
| 640 | since gc could happen and relocate it. */ | 640 | since gc could happen and relocate it. */ |
| 641 | 641 | ||
| 642 | void | 642 | void |
| 643 | insert_before_markers (const char *string, EMACS_INT nbytes) | 643 | insert_before_markers (const char *string, ptrdiff_t nbytes) |
| 644 | { | 644 | { |
| 645 | if (nbytes > 0) | 645 | if (nbytes > 0) |
| 646 | { | 646 | { |
| 647 | EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint; | 647 | ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint; |
| 648 | insert_1_both (string, len, nbytes, 0, 1, 1); | 648 | insert_1_both (string, len, nbytes, 0, 1, 1); |
| 649 | opoint = PT - len; | 649 | opoint = PT - len; |
| 650 | signal_after_change (opoint, 0, len); | 650 | signal_after_change (opoint, 0, len); |
| @@ -656,11 +656,11 @@ insert_before_markers (const char *string, EMACS_INT nbytes) | |||
| 656 | 656 | ||
| 657 | void | 657 | void |
| 658 | insert_before_markers_and_inherit (const char *string, | 658 | insert_before_markers_and_inherit (const char *string, |
| 659 | EMACS_INT nbytes) | 659 | ptrdiff_t nbytes) |
| 660 | { | 660 | { |
| 661 | if (nbytes > 0) | 661 | if (nbytes > 0) |
| 662 | { | 662 | { |
| 663 | EMACS_INT len = chars_in_text ((unsigned char *) string, nbytes), opoint; | 663 | ptrdiff_t len = chars_in_text ((unsigned char *) string, nbytes), opoint; |
| 664 | insert_1_both (string, len, nbytes, 1, 1, 1); | 664 | insert_1_both (string, len, nbytes, 1, 1, 1); |
| 665 | opoint = PT - len; | 665 | opoint = PT - len; |
| 666 | signal_after_change (opoint, 0, len); | 666 | signal_after_change (opoint, 0, len); |
| @@ -671,7 +671,7 @@ insert_before_markers_and_inherit (const char *string, | |||
| 671 | /* Subroutine used by the insert functions above. */ | 671 | /* Subroutine used by the insert functions above. */ |
| 672 | 672 | ||
| 673 | void | 673 | void |
| 674 | insert_1 (const char *string, EMACS_INT nbytes, | 674 | insert_1 (const char *string, ptrdiff_t nbytes, |
| 675 | int inherit, int prepare, int before_markers) | 675 | int inherit, int prepare, int before_markers) |
| 676 | { | 676 | { |
| 677 | insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes), | 677 | insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes), |
| @@ -687,8 +687,8 @@ insert_1 (const char *string, EMACS_INT nbytes, | |||
| 687 | which combine in this way. Otherwise, return 0. */ | 687 | which combine in this way. Otherwise, return 0. */ |
| 688 | 688 | ||
| 689 | int | 689 | int |
| 690 | count_combining_before (const unsigned char *string, EMACS_INT length, | 690 | count_combining_before (const unsigned char *string, ptrdiff_t length, |
| 691 | EMACS_INT pos, EMACS_INT pos_byte) | 691 | ptrdiff_t pos, ptrdiff_t pos_byte) |
| 692 | { | 692 | { |
| 693 | int len, combining_bytes; | 693 | int len, combining_bytes; |
| 694 | const unsigned char *p; | 694 | const unsigned char *p; |
| @@ -733,11 +733,11 @@ count_combining_before (const unsigned char *string, EMACS_INT length, | |||
| 733 | 733 | ||
| 734 | int | 734 | int |
| 735 | count_combining_after (const unsigned char *string, | 735 | count_combining_after (const unsigned char *string, |
| 736 | EMACS_INT length, EMACS_INT pos, EMACS_INT pos_byte) | 736 | ptrdiff_t length, ptrdiff_t pos, ptrdiff_t pos_byte) |
| 737 | { | 737 | { |
| 738 | EMACS_INT opos_byte = pos_byte; | 738 | ptrdiff_t opos_byte = pos_byte; |
| 739 | EMACS_INT i; | 739 | ptrdiff_t i; |
| 740 | EMACS_INT bytes; | 740 | ptrdiff_t bytes; |
| 741 | unsigned char *bufp; | 741 | unsigned char *bufp; |
| 742 | 742 | ||
| 743 | if (NILP (current_buffer->enable_multibyte_characters)) | 743 | if (NILP (current_buffer->enable_multibyte_characters)) |
| @@ -797,7 +797,7 @@ count_combining_after (const unsigned char *string, | |||
| 797 | 797 | ||
| 798 | void | 798 | void |
| 799 | insert_1_both (const char *string, | 799 | insert_1_both (const char *string, |
| 800 | EMACS_INT nchars, EMACS_INT nbytes, | 800 | ptrdiff_t nchars, ptrdiff_t nbytes, |
| 801 | int inherit, int prepare, int before_markers) | 801 | int inherit, int prepare, int before_markers) |
| 802 | { | 802 | { |
| 803 | if (nchars == 0) | 803 | if (nchars == 0) |
| @@ -875,10 +875,10 @@ insert_1_both (const char *string, | |||
| 875 | without insert noticing. */ | 875 | without insert noticing. */ |
| 876 | 876 | ||
| 877 | void | 877 | void |
| 878 | insert_from_string (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | 878 | insert_from_string (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, |
| 879 | EMACS_INT length, EMACS_INT length_byte, int inherit) | 879 | ptrdiff_t length, ptrdiff_t length_byte, int inherit) |
| 880 | { | 880 | { |
| 881 | EMACS_INT opoint = PT; | 881 | ptrdiff_t opoint = PT; |
| 882 | 882 | ||
| 883 | if (SCHARS (string) == 0) | 883 | if (SCHARS (string) == 0) |
| 884 | return; | 884 | return; |
| @@ -894,11 +894,11 @@ insert_from_string (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 894 | 894 | ||
| 895 | void | 895 | void |
| 896 | insert_from_string_before_markers (Lisp_Object string, | 896 | insert_from_string_before_markers (Lisp_Object string, |
| 897 | EMACS_INT pos, EMACS_INT pos_byte, | 897 | ptrdiff_t pos, ptrdiff_t pos_byte, |
| 898 | EMACS_INT length, EMACS_INT length_byte, | 898 | ptrdiff_t length, ptrdiff_t length_byte, |
| 899 | int inherit) | 899 | int inherit) |
| 900 | { | 900 | { |
| 901 | EMACS_INT opoint = PT; | 901 | ptrdiff_t opoint = PT; |
| 902 | 902 | ||
| 903 | if (SCHARS (string) == 0) | 903 | if (SCHARS (string) == 0) |
| 904 | return; | 904 | return; |
| @@ -912,12 +912,12 @@ insert_from_string_before_markers (Lisp_Object string, | |||
| 912 | /* Subroutine of the insertion functions above. */ | 912 | /* Subroutine of the insertion functions above. */ |
| 913 | 913 | ||
| 914 | static void | 914 | static void |
| 915 | insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | 915 | insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, |
| 916 | EMACS_INT nchars, EMACS_INT nbytes, | 916 | ptrdiff_t nchars, ptrdiff_t nbytes, |
| 917 | int inherit, int before_markers) | 917 | int inherit, int before_markers) |
| 918 | { | 918 | { |
| 919 | struct gcpro gcpro1; | 919 | struct gcpro gcpro1; |
| 920 | EMACS_INT outgoing_nbytes = nbytes; | 920 | ptrdiff_t outgoing_nbytes = nbytes; |
| 921 | INTERVAL intervals; | 921 | INTERVAL intervals; |
| 922 | 922 | ||
| 923 | /* Make OUTGOING_NBYTES describe the text | 923 | /* Make OUTGOING_NBYTES describe the text |
| @@ -1004,7 +1004,7 @@ insert_from_string_1 (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 1004 | starting at GPT_ADDR. */ | 1004 | starting at GPT_ADDR. */ |
| 1005 | 1005 | ||
| 1006 | void | 1006 | void |
| 1007 | insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) | 1007 | insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes) |
| 1008 | { | 1008 | { |
| 1009 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | 1009 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 1010 | nchars = nbytes; | 1010 | nchars = nbytes; |
| @@ -1050,9 +1050,9 @@ insert_from_gap (EMACS_INT nchars, EMACS_INT nbytes) | |||
| 1050 | 1050 | ||
| 1051 | void | 1051 | void |
| 1052 | insert_from_buffer (struct buffer *buf, | 1052 | insert_from_buffer (struct buffer *buf, |
| 1053 | EMACS_INT charpos, EMACS_INT nchars, int inherit) | 1053 | ptrdiff_t charpos, ptrdiff_t nchars, int inherit) |
| 1054 | { | 1054 | { |
| 1055 | EMACS_INT opoint = PT; | 1055 | ptrdiff_t opoint = PT; |
| 1056 | 1056 | ||
| 1057 | insert_from_buffer_1 (buf, charpos, nchars, inherit); | 1057 | insert_from_buffer_1 (buf, charpos, nchars, inherit); |
| 1058 | signal_after_change (opoint, 0, PT - opoint); | 1058 | signal_after_change (opoint, 0, PT - opoint); |
| @@ -1061,13 +1061,13 @@ insert_from_buffer (struct buffer *buf, | |||
| 1061 | 1061 | ||
| 1062 | static void | 1062 | static void |
| 1063 | insert_from_buffer_1 (struct buffer *buf, | 1063 | insert_from_buffer_1 (struct buffer *buf, |
| 1064 | EMACS_INT from, EMACS_INT nchars, int inherit) | 1064 | ptrdiff_t from, ptrdiff_t nchars, int inherit) |
| 1065 | { | 1065 | { |
| 1066 | EMACS_INT chunk, chunk_expanded; | 1066 | ptrdiff_t chunk, chunk_expanded; |
| 1067 | EMACS_INT from_byte = buf_charpos_to_bytepos (buf, from); | 1067 | ptrdiff_t from_byte = buf_charpos_to_bytepos (buf, from); |
| 1068 | EMACS_INT to_byte = buf_charpos_to_bytepos (buf, from + nchars); | 1068 | ptrdiff_t to_byte = buf_charpos_to_bytepos (buf, from + nchars); |
| 1069 | EMACS_INT incoming_nbytes = to_byte - from_byte; | 1069 | ptrdiff_t incoming_nbytes = to_byte - from_byte; |
| 1070 | EMACS_INT outgoing_nbytes = incoming_nbytes; | 1070 | ptrdiff_t outgoing_nbytes = incoming_nbytes; |
| 1071 | INTERVAL intervals; | 1071 | INTERVAL intervals; |
| 1072 | 1072 | ||
| 1073 | /* Make OUTGOING_NBYTES describe the text | 1073 | /* Make OUTGOING_NBYTES describe the text |
| @@ -1077,8 +1077,8 @@ insert_from_buffer_1 (struct buffer *buf, | |||
| 1077 | outgoing_nbytes = nchars; | 1077 | outgoing_nbytes = nchars; |
| 1078 | else if (NILP (BVAR (buf, enable_multibyte_characters))) | 1078 | else if (NILP (BVAR (buf, enable_multibyte_characters))) |
| 1079 | { | 1079 | { |
| 1080 | EMACS_INT outgoing_before_gap = 0; | 1080 | ptrdiff_t outgoing_before_gap = 0; |
| 1081 | EMACS_INT outgoing_after_gap = 0; | 1081 | ptrdiff_t outgoing_after_gap = 0; |
| 1082 | 1082 | ||
| 1083 | if (from < BUF_GPT (buf)) | 1083 | if (from < BUF_GPT (buf)) |
| 1084 | { | 1084 | { |
| @@ -1195,10 +1195,10 @@ insert_from_buffer_1 (struct buffer *buf, | |||
| 1195 | PREV_TEXT nil means the new text was just inserted. */ | 1195 | PREV_TEXT nil means the new text was just inserted. */ |
| 1196 | 1196 | ||
| 1197 | static void | 1197 | static void |
| 1198 | adjust_after_replace (EMACS_INT from, EMACS_INT from_byte, | 1198 | adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, |
| 1199 | Lisp_Object prev_text, EMACS_INT len, EMACS_INT len_byte) | 1199 | Lisp_Object prev_text, ptrdiff_t len, ptrdiff_t len_byte) |
| 1200 | { | 1200 | { |
| 1201 | EMACS_INT nchars_del = 0, nbytes_del = 0; | 1201 | ptrdiff_t nchars_del = 0, nbytes_del = 0; |
| 1202 | 1202 | ||
| 1203 | #ifdef BYTE_COMBINING_DEBUG | 1203 | #ifdef BYTE_COMBINING_DEBUG |
| 1204 | if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) | 1204 | if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) |
| @@ -1263,10 +1263,10 @@ adjust_after_replace (EMACS_INT from, EMACS_INT from_byte, | |||
| 1263 | - FROM) may be incorrect, the correct length is NEWLEN. */ | 1263 | - FROM) may be incorrect, the correct length is NEWLEN. */ |
| 1264 | 1264 | ||
| 1265 | void | 1265 | void |
| 1266 | adjust_after_insert (EMACS_INT from, EMACS_INT from_byte, | 1266 | adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte, |
| 1267 | EMACS_INT to, EMACS_INT to_byte, EMACS_INT newlen) | 1267 | ptrdiff_t to, ptrdiff_t to_byte, ptrdiff_t newlen) |
| 1268 | { | 1268 | { |
| 1269 | EMACS_INT len = to - from, len_byte = to_byte - from_byte; | 1269 | ptrdiff_t len = to - from, len_byte = to_byte - from_byte; |
| 1270 | 1270 | ||
| 1271 | if (GPT != to) | 1271 | if (GPT != to) |
| 1272 | move_gap_both (to, to_byte); | 1272 | move_gap_both (to, to_byte); |
| @@ -1290,16 +1290,16 @@ adjust_after_insert (EMACS_INT from, EMACS_INT from_byte, | |||
| 1290 | But if MARKERS is 0, don't relocate markers. */ | 1290 | But if MARKERS is 0, don't relocate markers. */ |
| 1291 | 1291 | ||
| 1292 | void | 1292 | void |
| 1293 | replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, | 1293 | replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, |
| 1294 | int prepare, int inherit, int markers) | 1294 | int prepare, int inherit, int markers) |
| 1295 | { | 1295 | { |
| 1296 | EMACS_INT inschars = SCHARS (new); | 1296 | ptrdiff_t inschars = SCHARS (new); |
| 1297 | EMACS_INT insbytes = SBYTES (new); | 1297 | ptrdiff_t insbytes = SBYTES (new); |
| 1298 | EMACS_INT from_byte, to_byte; | 1298 | ptrdiff_t from_byte, to_byte; |
| 1299 | EMACS_INT nbytes_del, nchars_del; | 1299 | ptrdiff_t nbytes_del, nchars_del; |
| 1300 | struct gcpro gcpro1; | 1300 | struct gcpro gcpro1; |
| 1301 | INTERVAL intervals; | 1301 | INTERVAL intervals; |
| 1302 | EMACS_INT outgoing_insbytes = insbytes; | 1302 | ptrdiff_t outgoing_insbytes = insbytes; |
| 1303 | Lisp_Object deletion; | 1303 | Lisp_Object deletion; |
| 1304 | 1304 | ||
| 1305 | CHECK_MARKERS (); | 1305 | CHECK_MARKERS (); |
| @@ -1309,7 +1309,7 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, | |||
| 1309 | 1309 | ||
| 1310 | if (prepare) | 1310 | if (prepare) |
| 1311 | { | 1311 | { |
| 1312 | EMACS_INT range_length = to - from; | 1312 | ptrdiff_t range_length = to - from; |
| 1313 | prepare_to_modify_buffer (from, to, &from); | 1313 | prepare_to_modify_buffer (from, to, &from); |
| 1314 | to = from + range_length; | 1314 | to = from + range_length; |
| 1315 | } | 1315 | } |
| @@ -1464,12 +1464,12 @@ replace_range (EMACS_INT from, EMACS_INT to, Lisp_Object new, | |||
| 1464 | prepare_to_modify_buffer and never call signal_after_change. */ | 1464 | prepare_to_modify_buffer and never call signal_after_change. */ |
| 1465 | 1465 | ||
| 1466 | void | 1466 | void |
| 1467 | replace_range_2 (EMACS_INT from, EMACS_INT from_byte, | 1467 | replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, |
| 1468 | EMACS_INT to, EMACS_INT to_byte, | 1468 | ptrdiff_t to, ptrdiff_t to_byte, |
| 1469 | const char *ins, EMACS_INT inschars, EMACS_INT insbytes, | 1469 | const char *ins, ptrdiff_t inschars, ptrdiff_t insbytes, |
| 1470 | int markers) | 1470 | int markers) |
| 1471 | { | 1471 | { |
| 1472 | EMACS_INT nbytes_del, nchars_del; | 1472 | ptrdiff_t nbytes_del, nchars_del; |
| 1473 | 1473 | ||
| 1474 | CHECK_MARKERS (); | 1474 | CHECK_MARKERS (); |
| 1475 | 1475 | ||
| @@ -1571,7 +1571,7 @@ replace_range_2 (EMACS_INT from, EMACS_INT from_byte, | |||
| 1571 | If TO comes before FROM, we delete nothing. */ | 1571 | If TO comes before FROM, we delete nothing. */ |
| 1572 | 1572 | ||
| 1573 | void | 1573 | void |
| 1574 | del_range (EMACS_INT from, EMACS_INT to) | 1574 | del_range (ptrdiff_t from, ptrdiff_t to) |
| 1575 | { | 1575 | { |
| 1576 | del_range_1 (from, to, 1, 0); | 1576 | del_range_1 (from, to, 1, 0); |
| 1577 | } | 1577 | } |
| @@ -1580,9 +1580,9 @@ del_range (EMACS_INT from, EMACS_INT to) | |||
| 1580 | RET_STRING says to return the deleted text. */ | 1580 | RET_STRING says to return the deleted text. */ |
| 1581 | 1581 | ||
| 1582 | Lisp_Object | 1582 | Lisp_Object |
| 1583 | del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string) | 1583 | del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string) |
| 1584 | { | 1584 | { |
| 1585 | EMACS_INT from_byte, to_byte; | 1585 | ptrdiff_t from_byte, to_byte; |
| 1586 | Lisp_Object deletion; | 1586 | Lisp_Object deletion; |
| 1587 | struct gcpro gcpro1; | 1587 | struct gcpro gcpro1; |
| 1588 | 1588 | ||
| @@ -1597,7 +1597,7 @@ del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string) | |||
| 1597 | 1597 | ||
| 1598 | if (prepare) | 1598 | if (prepare) |
| 1599 | { | 1599 | { |
| 1600 | EMACS_INT range_length = to - from; | 1600 | ptrdiff_t range_length = to - from; |
| 1601 | prepare_to_modify_buffer (from, to, &from); | 1601 | prepare_to_modify_buffer (from, to, &from); |
| 1602 | to = min (ZV, from + range_length); | 1602 | to = min (ZV, from + range_length); |
| 1603 | } | 1603 | } |
| @@ -1616,9 +1616,9 @@ del_range_1 (EMACS_INT from, EMACS_INT to, int prepare, int ret_string) | |||
| 1616 | /* Like del_range_1 but args are byte positions, not char positions. */ | 1616 | /* Like del_range_1 but args are byte positions, not char positions. */ |
| 1617 | 1617 | ||
| 1618 | void | 1618 | void |
| 1619 | del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare) | 1619 | del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare) |
| 1620 | { | 1620 | { |
| 1621 | EMACS_INT from, to; | 1621 | ptrdiff_t from, to; |
| 1622 | 1622 | ||
| 1623 | /* Make args be valid */ | 1623 | /* Make args be valid */ |
| 1624 | if (from_byte < BEGV_BYTE) | 1624 | if (from_byte < BEGV_BYTE) |
| @@ -1634,8 +1634,8 @@ del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare) | |||
| 1634 | 1634 | ||
| 1635 | if (prepare) | 1635 | if (prepare) |
| 1636 | { | 1636 | { |
| 1637 | EMACS_INT old_from = from, old_to = Z - to; | 1637 | ptrdiff_t old_from = from, old_to = Z - to; |
| 1638 | EMACS_INT range_length = to - from; | 1638 | ptrdiff_t range_length = to - from; |
| 1639 | prepare_to_modify_buffer (from, to, &from); | 1639 | prepare_to_modify_buffer (from, to, &from); |
| 1640 | to = from + range_length; | 1640 | to = from + range_length; |
| 1641 | 1641 | ||
| @@ -1659,8 +1659,8 @@ del_range_byte (EMACS_INT from_byte, EMACS_INT to_byte, int prepare) | |||
| 1659 | and bytepos. */ | 1659 | and bytepos. */ |
| 1660 | 1660 | ||
| 1661 | void | 1661 | void |
| 1662 | del_range_both (EMACS_INT from, EMACS_INT from_byte, | 1662 | del_range_both (ptrdiff_t from, ptrdiff_t from_byte, |
| 1663 | EMACS_INT to, EMACS_INT to_byte, int prepare) | 1663 | ptrdiff_t to, ptrdiff_t to_byte, int prepare) |
| 1664 | { | 1664 | { |
| 1665 | /* Make args be valid */ | 1665 | /* Make args be valid */ |
| 1666 | if (from_byte < BEGV_BYTE) | 1666 | if (from_byte < BEGV_BYTE) |
| @@ -1678,8 +1678,8 @@ del_range_both (EMACS_INT from, EMACS_INT from_byte, | |||
| 1678 | 1678 | ||
| 1679 | if (prepare) | 1679 | if (prepare) |
| 1680 | { | 1680 | { |
| 1681 | EMACS_INT old_from = from, old_to = Z - to; | 1681 | ptrdiff_t old_from = from, old_to = Z - to; |
| 1682 | EMACS_INT range_length = to - from; | 1682 | ptrdiff_t range_length = to - from; |
| 1683 | prepare_to_modify_buffer (from, to, &from); | 1683 | prepare_to_modify_buffer (from, to, &from); |
| 1684 | to = from + range_length; | 1684 | to = from + range_length; |
| 1685 | 1685 | ||
| @@ -1705,10 +1705,10 @@ del_range_both (EMACS_INT from, EMACS_INT from_byte, | |||
| 1705 | If RET_STRING is true, the deleted area is returned as a string. */ | 1705 | If RET_STRING is true, the deleted area is returned as a string. */ |
| 1706 | 1706 | ||
| 1707 | Lisp_Object | 1707 | Lisp_Object |
| 1708 | del_range_2 (EMACS_INT from, EMACS_INT from_byte, | 1708 | del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, |
| 1709 | EMACS_INT to, EMACS_INT to_byte, int ret_string) | 1709 | ptrdiff_t to, ptrdiff_t to_byte, int ret_string) |
| 1710 | { | 1710 | { |
| 1711 | register EMACS_INT nbytes_del, nchars_del; | 1711 | register ptrdiff_t nbytes_del, nchars_del; |
| 1712 | Lisp_Object deletion; | 1712 | Lisp_Object deletion; |
| 1713 | 1713 | ||
| 1714 | CHECK_MARKERS (); | 1714 | CHECK_MARKERS (); |
| @@ -1792,7 +1792,7 @@ del_range_2 (EMACS_INT from, EMACS_INT from_byte, | |||
| 1792 | Otherwise set CHARS_MODIFF to the new value of MODIFF. */ | 1792 | Otherwise set CHARS_MODIFF to the new value of MODIFF. */ |
| 1793 | 1793 | ||
| 1794 | void | 1794 | void |
| 1795 | modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end, | 1795 | modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end, |
| 1796 | int preserve_chars_modiff) | 1796 | int preserve_chars_modiff) |
| 1797 | { | 1797 | { |
| 1798 | struct buffer *old_buffer = current_buffer; | 1798 | struct buffer *old_buffer = current_buffer; |
| @@ -1827,8 +1827,8 @@ modify_region (struct buffer *buffer, EMACS_INT start, EMACS_INT end, | |||
| 1827 | by holding its value temporarily in a marker. */ | 1827 | by holding its value temporarily in a marker. */ |
| 1828 | 1828 | ||
| 1829 | void | 1829 | void |
| 1830 | prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, | 1830 | prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, |
| 1831 | EMACS_INT *preserve_ptr) | 1831 | ptrdiff_t *preserve_ptr) |
| 1832 | { | 1832 | { |
| 1833 | struct buffer *base_buffer; | 1833 | struct buffer *base_buffer; |
| 1834 | 1834 | ||
| @@ -1889,8 +1889,8 @@ prepare_to_modify_buffer (EMACS_INT start, EMACS_INT end, | |||
| 1889 | : (!NILP (Vselect_active_regions) | 1889 | : (!NILP (Vselect_active_regions) |
| 1890 | && !NILP (Vtransient_mark_mode)))) | 1890 | && !NILP (Vtransient_mark_mode)))) |
| 1891 | { | 1891 | { |
| 1892 | EMACS_INT b = XMARKER (BVAR (current_buffer, mark))->charpos; | 1892 | ptrdiff_t b = XMARKER (BVAR (current_buffer, mark))->charpos; |
| 1893 | EMACS_INT e = PT; | 1893 | ptrdiff_t e = PT; |
| 1894 | if (b < e) | 1894 | if (b < e) |
| 1895 | Vsaved_region_selection = make_buffer_string (b, e, 0); | 1895 | Vsaved_region_selection = make_buffer_string (b, e, 0); |
| 1896 | else if (b > e) | 1896 | else if (b > e) |
| @@ -1958,14 +1958,14 @@ reset_var_on_error (Lisp_Object val) | |||
| 1958 | by holding its value temporarily in a marker. */ | 1958 | by holding its value temporarily in a marker. */ |
| 1959 | 1959 | ||
| 1960 | static void | 1960 | static void |
| 1961 | signal_before_change (EMACS_INT start_int, EMACS_INT end_int, | 1961 | signal_before_change (ptrdiff_t start_int, ptrdiff_t end_int, |
| 1962 | EMACS_INT *preserve_ptr) | 1962 | ptrdiff_t *preserve_ptr) |
| 1963 | { | 1963 | { |
| 1964 | Lisp_Object start, end; | 1964 | Lisp_Object start, end; |
| 1965 | Lisp_Object start_marker, end_marker; | 1965 | Lisp_Object start_marker, end_marker; |
| 1966 | Lisp_Object preserve_marker; | 1966 | Lisp_Object preserve_marker; |
| 1967 | struct gcpro gcpro1, gcpro2, gcpro3; | 1967 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 1968 | int count = SPECPDL_INDEX (); | 1968 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1969 | 1969 | ||
| 1970 | if (inhibit_modification_hooks) | 1970 | if (inhibit_modification_hooks) |
| 1971 | return; | 1971 | return; |
| @@ -2036,9 +2036,9 @@ signal_before_change (EMACS_INT start_int, EMACS_INT end_int, | |||
| 2036 | after the change. */ | 2036 | after the change. */ |
| 2037 | 2037 | ||
| 2038 | void | 2038 | void |
| 2039 | signal_after_change (EMACS_INT charpos, EMACS_INT lendel, EMACS_INT lenins) | 2039 | signal_after_change (ptrdiff_t charpos, ptrdiff_t lendel, ptrdiff_t lenins) |
| 2040 | { | 2040 | { |
| 2041 | int count = SPECPDL_INDEX (); | 2041 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2042 | if (inhibit_modification_hooks) | 2042 | if (inhibit_modification_hooks) |
| 2043 | return; | 2043 | return; |
| 2044 | 2044 | ||
| @@ -2119,9 +2119,9 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, | |||
| 2119 | doc: /* This function is for use internally in `combine-after-change-calls'. */) | 2119 | doc: /* This function is for use internally in `combine-after-change-calls'. */) |
| 2120 | (void) | 2120 | (void) |
| 2121 | { | 2121 | { |
| 2122 | int count = SPECPDL_INDEX (); | 2122 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2123 | EMACS_INT beg, end, change; | 2123 | ptrdiff_t beg, end, change; |
| 2124 | EMACS_INT begpos, endpos; | 2124 | ptrdiff_t begpos, endpos; |
| 2125 | Lisp_Object tail; | 2125 | Lisp_Object tail; |
| 2126 | 2126 | ||
| 2127 | if (NILP (combine_after_change_list)) | 2127 | if (NILP (combine_after_change_list)) |
| @@ -2155,7 +2155,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute, | |||
| 2155 | tail = XCDR (tail)) | 2155 | tail = XCDR (tail)) |
| 2156 | { | 2156 | { |
| 2157 | Lisp_Object elt; | 2157 | Lisp_Object elt; |
| 2158 | EMACS_INT thisbeg, thisend, thischange; | 2158 | ptrdiff_t thisbeg, thisend, thischange; |
| 2159 | 2159 | ||
| 2160 | /* Extract the info from the next element. */ | 2160 | /* Extract the info from the next element. */ |
| 2161 | elt = XCAR (tail); | 2161 | elt = XCAR (tail); |
diff --git a/src/intervals.c b/src/intervals.c index 2063655cdb9..54b98804d3c 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -223,7 +223,7 @@ traverse_intervals_noorder (INTERVAL tree, void (*function) (INTERVAL, Lisp_Obje | |||
| 223 | Pass FUNCTION two args: an interval, and ARG. */ | 223 | Pass FUNCTION two args: an interval, and ARG. */ |
| 224 | 224 | ||
| 225 | void | 225 | void |
| 226 | traverse_intervals (INTERVAL tree, EMACS_INT position, | 226 | traverse_intervals (INTERVAL tree, ptrdiff_t position, |
| 227 | void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) | 227 | void (*function) (INTERVAL, Lisp_Object), Lisp_Object arg) |
| 228 | { | 228 | { |
| 229 | while (!NULL_INTERVAL_P (tree)) | 229 | while (!NULL_INTERVAL_P (tree)) |
| @@ -313,7 +313,7 @@ rotate_right (INTERVAL interval) | |||
| 313 | { | 313 | { |
| 314 | INTERVAL i; | 314 | INTERVAL i; |
| 315 | INTERVAL B = interval->left; | 315 | INTERVAL B = interval->left; |
| 316 | EMACS_INT old_total = interval->total_length; | 316 | ptrdiff_t old_total = interval->total_length; |
| 317 | 317 | ||
| 318 | /* Deal with any Parent of A; make it point to B. */ | 318 | /* Deal with any Parent of A; make it point to B. */ |
| 319 | if (! ROOT_INTERVAL_P (interval)) | 319 | if (! ROOT_INTERVAL_P (interval)) |
| @@ -360,7 +360,7 @@ rotate_left (INTERVAL interval) | |||
| 360 | { | 360 | { |
| 361 | INTERVAL i; | 361 | INTERVAL i; |
| 362 | INTERVAL B = interval->right; | 362 | INTERVAL B = interval->right; |
| 363 | EMACS_INT old_total = interval->total_length; | 363 | ptrdiff_t old_total = interval->total_length; |
| 364 | 364 | ||
| 365 | /* Deal with any parent of A; make it point to B. */ | 365 | /* Deal with any parent of A; make it point to B. */ |
| 366 | if (! ROOT_INTERVAL_P (interval)) | 366 | if (! ROOT_INTERVAL_P (interval)) |
| @@ -399,7 +399,7 @@ rotate_left (INTERVAL interval) | |||
| 399 | static INTERVAL | 399 | static INTERVAL |
| 400 | balance_an_interval (INTERVAL i) | 400 | balance_an_interval (INTERVAL i) |
| 401 | { | 401 | { |
| 402 | register EMACS_INT old_diff, new_diff; | 402 | register ptrdiff_t old_diff, new_diff; |
| 403 | 403 | ||
| 404 | while (1) | 404 | while (1) |
| 405 | { | 405 | { |
| @@ -499,11 +499,11 @@ balance_intervals (INTERVAL tree) | |||
| 499 | it is still a root after this operation. */ | 499 | it is still a root after this operation. */ |
| 500 | 500 | ||
| 501 | INTERVAL | 501 | INTERVAL |
| 502 | split_interval_right (INTERVAL interval, EMACS_INT offset) | 502 | split_interval_right (INTERVAL interval, ptrdiff_t offset) |
| 503 | { | 503 | { |
| 504 | INTERVAL new = make_interval (); | 504 | INTERVAL new = make_interval (); |
| 505 | EMACS_INT position = interval->position; | 505 | ptrdiff_t position = interval->position; |
| 506 | EMACS_INT new_length = LENGTH (interval) - offset; | 506 | ptrdiff_t new_length = LENGTH (interval) - offset; |
| 507 | 507 | ||
| 508 | new->position = position + offset; | 508 | new->position = position + offset; |
| 509 | SET_INTERVAL_PARENT (new, interval); | 509 | SET_INTERVAL_PARENT (new, interval); |
| @@ -544,10 +544,10 @@ split_interval_right (INTERVAL interval, EMACS_INT offset) | |||
| 544 | it is still a root after this operation. */ | 544 | it is still a root after this operation. */ |
| 545 | 545 | ||
| 546 | INTERVAL | 546 | INTERVAL |
| 547 | split_interval_left (INTERVAL interval, EMACS_INT offset) | 547 | split_interval_left (INTERVAL interval, ptrdiff_t offset) |
| 548 | { | 548 | { |
| 549 | INTERVAL new = make_interval (); | 549 | INTERVAL new = make_interval (); |
| 550 | EMACS_INT new_length = offset; | 550 | ptrdiff_t new_length = offset; |
| 551 | 551 | ||
| 552 | new->position = interval->position; | 552 | new->position = interval->position; |
| 553 | interval->position = interval->position + offset; | 553 | interval->position = interval->position + offset; |
| @@ -610,11 +610,11 @@ interval_start_pos (INTERVAL source) | |||
| 610 | will update this cache based on the result of find_interval. */ | 610 | will update this cache based on the result of find_interval. */ |
| 611 | 611 | ||
| 612 | INTERVAL | 612 | INTERVAL |
| 613 | find_interval (register INTERVAL tree, register EMACS_INT position) | 613 | find_interval (register INTERVAL tree, register ptrdiff_t position) |
| 614 | { | 614 | { |
| 615 | /* The distance from the left edge of the subtree at TREE | 615 | /* The distance from the left edge of the subtree at TREE |
| 616 | to POSITION. */ | 616 | to POSITION. */ |
| 617 | register EMACS_INT relative_position; | 617 | register ptrdiff_t relative_position; |
| 618 | 618 | ||
| 619 | if (NULL_INTERVAL_P (tree)) | 619 | if (NULL_INTERVAL_P (tree)) |
| 620 | return NULL_INTERVAL; | 620 | return NULL_INTERVAL; |
| @@ -667,7 +667,7 @@ INTERVAL | |||
| 667 | next_interval (register INTERVAL interval) | 667 | next_interval (register INTERVAL interval) |
| 668 | { | 668 | { |
| 669 | register INTERVAL i = interval; | 669 | register INTERVAL i = interval; |
| 670 | register EMACS_INT next_position; | 670 | register ptrdiff_t next_position; |
| 671 | 671 | ||
| 672 | if (NULL_INTERVAL_P (i)) | 672 | if (NULL_INTERVAL_P (i)) |
| 673 | return NULL_INTERVAL; | 673 | return NULL_INTERVAL; |
| @@ -742,7 +742,7 @@ previous_interval (register INTERVAL interval) | |||
| 742 | To speed up the process, we assume that the ->position of | 742 | To speed up the process, we assume that the ->position of |
| 743 | I and all its parents is already uptodate. */ | 743 | I and all its parents is already uptodate. */ |
| 744 | INTERVAL | 744 | INTERVAL |
| 745 | update_interval (register INTERVAL i, EMACS_INT pos) | 745 | update_interval (register INTERVAL i, ptrdiff_t pos) |
| 746 | { | 746 | { |
| 747 | if (NULL_INTERVAL_P (i)) | 747 | if (NULL_INTERVAL_P (i)) |
| 748 | return NULL_INTERVAL; | 748 | return NULL_INTERVAL; |
| @@ -799,10 +799,10 @@ update_interval (register INTERVAL i, EMACS_INT pos) | |||
| 799 | to the root. */ | 799 | to the root. */ |
| 800 | 800 | ||
| 801 | static INTERVAL | 801 | static INTERVAL |
| 802 | adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position, | 802 | adjust_intervals_for_insertion (INTERVAL tree, ptrdiff_t position, |
| 803 | EMACS_INT length) | 803 | ptrdiff_t length) |
| 804 | { | 804 | { |
| 805 | register EMACS_INT relative_position; | 805 | register ptrdiff_t relative_position; |
| 806 | register INTERVAL this; | 806 | register INTERVAL this; |
| 807 | 807 | ||
| 808 | if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ | 808 | if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ |
| @@ -861,13 +861,13 @@ adjust_intervals_for_insertion (INTERVAL tree, EMACS_INT position, | |||
| 861 | 861 | ||
| 862 | static INTERVAL | 862 | static INTERVAL |
| 863 | adjust_intervals_for_insertion (INTERVAL tree, | 863 | adjust_intervals_for_insertion (INTERVAL tree, |
| 864 | EMACS_INT position, EMACS_INT length) | 864 | ptrdiff_t position, ptrdiff_t length) |
| 865 | { | 865 | { |
| 866 | register INTERVAL i; | 866 | register INTERVAL i; |
| 867 | register INTERVAL temp; | 867 | register INTERVAL temp; |
| 868 | int eobp = 0; | 868 | int eobp = 0; |
| 869 | Lisp_Object parent; | 869 | Lisp_Object parent; |
| 870 | EMACS_INT offset; | 870 | ptrdiff_t offset; |
| 871 | 871 | ||
| 872 | if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ | 872 | if (TOTAL_LENGTH (tree) == 0) /* Paranoia */ |
| 873 | abort (); | 873 | abort (); |
| @@ -1225,7 +1225,7 @@ static INTERVAL | |||
| 1225 | delete_node (register INTERVAL i) | 1225 | delete_node (register INTERVAL i) |
| 1226 | { | 1226 | { |
| 1227 | register INTERVAL migrate, this; | 1227 | register INTERVAL migrate, this; |
| 1228 | register EMACS_INT migrate_amt; | 1228 | register ptrdiff_t migrate_amt; |
| 1229 | 1229 | ||
| 1230 | if (NULL_INTERVAL_P (i->left)) | 1230 | if (NULL_INTERVAL_P (i->left)) |
| 1231 | return i->right; | 1231 | return i->right; |
| @@ -1258,7 +1258,7 @@ static void | |||
| 1258 | delete_interval (register INTERVAL i) | 1258 | delete_interval (register INTERVAL i) |
| 1259 | { | 1259 | { |
| 1260 | register INTERVAL parent; | 1260 | register INTERVAL parent; |
| 1261 | EMACS_INT amt = LENGTH (i); | 1261 | ptrdiff_t amt = LENGTH (i); |
| 1262 | 1262 | ||
| 1263 | if (amt > 0) /* Only used on zero-length intervals now. */ | 1263 | if (amt > 0) /* Only used on zero-length intervals now. */ |
| 1264 | abort (); | 1264 | abort (); |
| @@ -1308,11 +1308,11 @@ delete_interval (register INTERVAL i) | |||
| 1308 | Do this by recursing down TREE to the interval in question, and | 1308 | Do this by recursing down TREE to the interval in question, and |
| 1309 | deleting the appropriate amount of text. */ | 1309 | deleting the appropriate amount of text. */ |
| 1310 | 1310 | ||
| 1311 | static EMACS_INT | 1311 | static ptrdiff_t |
| 1312 | interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | 1312 | interval_deletion_adjustment (register INTERVAL tree, register ptrdiff_t from, |
| 1313 | register EMACS_INT amount) | 1313 | register ptrdiff_t amount) |
| 1314 | { | 1314 | { |
| 1315 | register EMACS_INT relative_position = from; | 1315 | register ptrdiff_t relative_position = from; |
| 1316 | 1316 | ||
| 1317 | if (NULL_INTERVAL_P (tree)) | 1317 | if (NULL_INTERVAL_P (tree)) |
| 1318 | return 0; | 1318 | return 0; |
| @@ -1320,7 +1320,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1320 | /* Left branch */ | 1320 | /* Left branch */ |
| 1321 | if (relative_position < LEFT_TOTAL_LENGTH (tree)) | 1321 | if (relative_position < LEFT_TOTAL_LENGTH (tree)) |
| 1322 | { | 1322 | { |
| 1323 | EMACS_INT subtract = interval_deletion_adjustment (tree->left, | 1323 | ptrdiff_t subtract = interval_deletion_adjustment (tree->left, |
| 1324 | relative_position, | 1324 | relative_position, |
| 1325 | amount); | 1325 | amount); |
| 1326 | tree->total_length -= subtract; | 1326 | tree->total_length -= subtract; |
| @@ -1331,7 +1331,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1331 | else if (relative_position >= (TOTAL_LENGTH (tree) | 1331 | else if (relative_position >= (TOTAL_LENGTH (tree) |
| 1332 | - RIGHT_TOTAL_LENGTH (tree))) | 1332 | - RIGHT_TOTAL_LENGTH (tree))) |
| 1333 | { | 1333 | { |
| 1334 | EMACS_INT subtract; | 1334 | ptrdiff_t subtract; |
| 1335 | 1335 | ||
| 1336 | relative_position -= (tree->total_length | 1336 | relative_position -= (tree->total_length |
| 1337 | - RIGHT_TOTAL_LENGTH (tree)); | 1337 | - RIGHT_TOTAL_LENGTH (tree)); |
| @@ -1346,7 +1346,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1346 | else | 1346 | else |
| 1347 | { | 1347 | { |
| 1348 | /* How much can we delete from this interval? */ | 1348 | /* How much can we delete from this interval? */ |
| 1349 | EMACS_INT my_amount = ((tree->total_length | 1349 | ptrdiff_t my_amount = ((tree->total_length |
| 1350 | - RIGHT_TOTAL_LENGTH (tree)) | 1350 | - RIGHT_TOTAL_LENGTH (tree)) |
| 1351 | - relative_position); | 1351 | - relative_position); |
| 1352 | 1352 | ||
| @@ -1371,12 +1371,12 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1371 | 1371 | ||
| 1372 | static void | 1372 | static void |
| 1373 | adjust_intervals_for_deletion (struct buffer *buffer, | 1373 | adjust_intervals_for_deletion (struct buffer *buffer, |
| 1374 | EMACS_INT start, EMACS_INT length) | 1374 | ptrdiff_t start, ptrdiff_t length) |
| 1375 | { | 1375 | { |
| 1376 | register EMACS_INT left_to_delete = length; | 1376 | register ptrdiff_t left_to_delete = length; |
| 1377 | register INTERVAL tree = BUF_INTERVALS (buffer); | 1377 | register INTERVAL tree = BUF_INTERVALS (buffer); |
| 1378 | Lisp_Object parent; | 1378 | Lisp_Object parent; |
| 1379 | EMACS_INT offset; | 1379 | ptrdiff_t offset; |
| 1380 | 1380 | ||
| 1381 | GET_INTERVAL_OBJECT (parent, tree); | 1381 | GET_INTERVAL_OBJECT (parent, tree); |
| 1382 | offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0); | 1382 | offset = (BUFFERP (parent) ? BUF_BEG (XBUFFER (parent)) : 0); |
| @@ -1426,8 +1426,8 @@ adjust_intervals_for_deletion (struct buffer *buffer, | |||
| 1426 | adjust_intervals_for_deletion) from a non-static inline function. */ | 1426 | adjust_intervals_for_deletion) from a non-static inline function. */ |
| 1427 | 1427 | ||
| 1428 | static inline void | 1428 | static inline void |
| 1429 | static_offset_intervals (struct buffer *buffer, EMACS_INT start, | 1429 | static_offset_intervals (struct buffer *buffer, ptrdiff_t start, |
| 1430 | EMACS_INT length) | 1430 | ptrdiff_t length) |
| 1431 | { | 1431 | { |
| 1432 | if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) | 1432 | if (NULL_INTERVAL_P (BUF_INTERVALS (buffer)) || length == 0) |
| 1433 | return; | 1433 | return; |
| @@ -1436,13 +1436,13 @@ static_offset_intervals (struct buffer *buffer, EMACS_INT start, | |||
| 1436 | adjust_intervals_for_insertion (BUF_INTERVALS (buffer), start, length); | 1436 | adjust_intervals_for_insertion (BUF_INTERVALS (buffer), start, length); |
| 1437 | else | 1437 | else |
| 1438 | { | 1438 | { |
| 1439 | IF_LINT (if (length < - TYPE_MAXIMUM (EMACS_INT)) abort ();) | 1439 | IF_LINT (if (length < - TYPE_MAXIMUM (ptrdiff_t)) abort ();) |
| 1440 | adjust_intervals_for_deletion (buffer, start, -length); | 1440 | adjust_intervals_for_deletion (buffer, start, -length); |
| 1441 | } | 1441 | } |
| 1442 | } | 1442 | } |
| 1443 | 1443 | ||
| 1444 | inline void | 1444 | inline void |
| 1445 | offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length) | 1445 | offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) |
| 1446 | { | 1446 | { |
| 1447 | static_offset_intervals (buffer, start, length); | 1447 | static_offset_intervals (buffer, start, length); |
| 1448 | } | 1448 | } |
| @@ -1459,7 +1459,7 @@ offset_intervals (struct buffer *buffer, EMACS_INT start, EMACS_INT length) | |||
| 1459 | static INTERVAL | 1459 | static INTERVAL |
| 1460 | merge_interval_right (register INTERVAL i) | 1460 | merge_interval_right (register INTERVAL i) |
| 1461 | { | 1461 | { |
| 1462 | register EMACS_INT absorb = LENGTH (i); | 1462 | register ptrdiff_t absorb = LENGTH (i); |
| 1463 | register INTERVAL successor; | 1463 | register INTERVAL successor; |
| 1464 | 1464 | ||
| 1465 | /* Zero out this interval. */ | 1465 | /* Zero out this interval. */ |
| @@ -1515,7 +1515,7 @@ merge_interval_right (register INTERVAL i) | |||
| 1515 | INTERVAL | 1515 | INTERVAL |
| 1516 | merge_interval_left (register INTERVAL i) | 1516 | merge_interval_left (register INTERVAL i) |
| 1517 | { | 1517 | { |
| 1518 | register EMACS_INT absorb = LENGTH (i); | 1518 | register ptrdiff_t absorb = LENGTH (i); |
| 1519 | register INTERVAL predecessor; | 1519 | register INTERVAL predecessor; |
| 1520 | 1520 | ||
| 1521 | /* Zero out this interval. */ | 1521 | /* Zero out this interval. */ |
| @@ -1609,7 +1609,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent) | |||
| 1609 | interval. */ | 1609 | interval. */ |
| 1610 | 1610 | ||
| 1611 | static INTERVAL | 1611 | static INTERVAL |
| 1612 | make_new_interval (INTERVAL intervals, EMACS_INT start, EMACS_INT length) | 1612 | make_new_interval (INTERVAL intervals, ptrdiff_t start, ptrdiff_t length) |
| 1613 | { | 1613 | { |
| 1614 | INTERVAL slot; | 1614 | INTERVAL slot; |
| 1615 | 1615 | ||
| @@ -1681,13 +1681,13 @@ make_new_interval (INTERVAL intervals, EMACS_INT start, EMACS_INT length) | |||
| 1681 | text... */ | 1681 | text... */ |
| 1682 | 1682 | ||
| 1683 | void | 1683 | void |
| 1684 | graft_intervals_into_buffer (INTERVAL source, EMACS_INT position, | 1684 | graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, |
| 1685 | EMACS_INT length, struct buffer *buffer, | 1685 | ptrdiff_t length, struct buffer *buffer, |
| 1686 | int inherit) | 1686 | int inherit) |
| 1687 | { | 1687 | { |
| 1688 | register INTERVAL under, over, this; | 1688 | register INTERVAL under, over, this; |
| 1689 | register INTERVAL tree; | 1689 | register INTERVAL tree; |
| 1690 | EMACS_INT over_used; | 1690 | ptrdiff_t over_used; |
| 1691 | 1691 | ||
| 1692 | tree = BUF_INTERVALS (buffer); | 1692 | tree = BUF_INTERVALS (buffer); |
| 1693 | 1693 | ||
| @@ -1888,7 +1888,7 @@ lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop | |||
| 1888 | 1888 | ||
| 1889 | inline void | 1889 | inline void |
| 1890 | temp_set_point_both (struct buffer *buffer, | 1890 | temp_set_point_both (struct buffer *buffer, |
| 1891 | EMACS_INT charpos, EMACS_INT bytepos) | 1891 | ptrdiff_t charpos, ptrdiff_t bytepos) |
| 1892 | { | 1892 | { |
| 1893 | /* In a single-byte buffer, the two positions must be equal. */ | 1893 | /* In a single-byte buffer, the two positions must be equal. */ |
| 1894 | if (BUF_ZV (buffer) == BUF_ZV_BYTE (buffer) | 1894 | if (BUF_ZV (buffer) == BUF_ZV_BYTE (buffer) |
| @@ -1907,7 +1907,7 @@ temp_set_point_both (struct buffer *buffer, | |||
| 1907 | /* Set point "temporarily", without checking any text properties. */ | 1907 | /* Set point "temporarily", without checking any text properties. */ |
| 1908 | 1908 | ||
| 1909 | inline void | 1909 | inline void |
| 1910 | temp_set_point (struct buffer *buffer, EMACS_INT charpos) | 1910 | temp_set_point (struct buffer *buffer, ptrdiff_t charpos) |
| 1911 | { | 1911 | { |
| 1912 | temp_set_point_both (buffer, charpos, | 1912 | temp_set_point_both (buffer, charpos, |
| 1913 | buf_charpos_to_bytepos (buffer, charpos)); | 1913 | buf_charpos_to_bytepos (buffer, charpos)); |
| @@ -1917,7 +1917,7 @@ temp_set_point (struct buffer *buffer, EMACS_INT charpos) | |||
| 1917 | before an intangible character, move to an ok place. */ | 1917 | before an intangible character, move to an ok place. */ |
| 1918 | 1918 | ||
| 1919 | void | 1919 | void |
| 1920 | set_point (EMACS_INT charpos) | 1920 | set_point (ptrdiff_t charpos) |
| 1921 | { | 1921 | { |
| 1922 | set_point_both (charpos, buf_charpos_to_bytepos (current_buffer, charpos)); | 1922 | set_point_both (charpos, buf_charpos_to_bytepos (current_buffer, charpos)); |
| 1923 | } | 1923 | } |
| @@ -1933,8 +1933,8 @@ set_point (EMACS_INT charpos) | |||
| 1933 | Note that `stickiness' is determined by overlay marker insertion types, | 1933 | Note that `stickiness' is determined by overlay marker insertion types, |
| 1934 | if the invisible property comes from an overlay. */ | 1934 | if the invisible property comes from an overlay. */ |
| 1935 | 1935 | ||
| 1936 | static EMACS_INT | 1936 | static ptrdiff_t |
| 1937 | adjust_for_invis_intang (EMACS_INT pos, EMACS_INT test_offs, EMACS_INT adj, | 1937 | adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj, |
| 1938 | int test_intang) | 1938 | int test_intang) |
| 1939 | { | 1939 | { |
| 1940 | Lisp_Object invis_propval, invis_overlay; | 1940 | Lisp_Object invis_propval, invis_overlay; |
| @@ -1973,18 +1973,18 @@ adjust_for_invis_intang (EMACS_INT pos, EMACS_INT test_offs, EMACS_INT adj, | |||
| 1973 | before an intangible character, move to an ok place. */ | 1973 | before an intangible character, move to an ok place. */ |
| 1974 | 1974 | ||
| 1975 | void | 1975 | void |
| 1976 | set_point_both (EMACS_INT charpos, EMACS_INT bytepos) | 1976 | set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 1977 | { | 1977 | { |
| 1978 | register INTERVAL to, from, toprev, fromprev; | 1978 | register INTERVAL to, from, toprev, fromprev; |
| 1979 | EMACS_INT buffer_point; | 1979 | ptrdiff_t buffer_point; |
| 1980 | EMACS_INT old_position = PT; | 1980 | ptrdiff_t old_position = PT; |
| 1981 | /* This ensures that we move forward past intangible text when the | 1981 | /* This ensures that we move forward past intangible text when the |
| 1982 | initial position is the same as the destination, in the rare | 1982 | initial position is the same as the destination, in the rare |
| 1983 | instances where this is important, e.g. in line-move-finish | 1983 | instances where this is important, e.g. in line-move-finish |
| 1984 | (simple.el). */ | 1984 | (simple.el). */ |
| 1985 | int backwards = (charpos < old_position ? 1 : 0); | 1985 | int backwards = (charpos < old_position ? 1 : 0); |
| 1986 | int have_overlays; | 1986 | int have_overlays; |
| 1987 | EMACS_INT original_position; | 1987 | ptrdiff_t original_position; |
| 1988 | 1988 | ||
| 1989 | BVAR (current_buffer, point_before_scroll) = Qnil; | 1989 | BVAR (current_buffer, point_before_scroll) = Qnil; |
| 1990 | 1990 | ||
| @@ -2197,7 +2197,7 @@ set_point_both (EMACS_INT charpos, EMACS_INT bytepos) | |||
| 2197 | segment that reaches all the way to point. */ | 2197 | segment that reaches all the way to point. */ |
| 2198 | 2198 | ||
| 2199 | void | 2199 | void |
| 2200 | move_if_not_intangible (EMACS_INT position) | 2200 | move_if_not_intangible (ptrdiff_t position) |
| 2201 | { | 2201 | { |
| 2202 | Lisp_Object pos; | 2202 | Lisp_Object pos; |
| 2203 | Lisp_Object intangible_propval; | 2203 | Lisp_Object intangible_propval; |
| @@ -2260,8 +2260,8 @@ move_if_not_intangible (EMACS_INT position) | |||
| 2260 | nil means the current buffer. */ | 2260 | nil means the current buffer. */ |
| 2261 | 2261 | ||
| 2262 | int | 2262 | int |
| 2263 | get_property_and_range (EMACS_INT pos, Lisp_Object prop, Lisp_Object *val, | 2263 | get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, |
| 2264 | EMACS_INT *start, EMACS_INT *end, Lisp_Object object) | 2264 | ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object) |
| 2265 | { | 2265 | { |
| 2266 | INTERVAL i, prev, next; | 2266 | INTERVAL i, prev, next; |
| 2267 | 2267 | ||
| @@ -2304,11 +2304,11 @@ get_property_and_range (EMACS_INT pos, Lisp_Object prop, Lisp_Object *val, | |||
| 2304 | POSITION must be in the accessible part of BUFFER. */ | 2304 | POSITION must be in the accessible part of BUFFER. */ |
| 2305 | 2305 | ||
| 2306 | Lisp_Object | 2306 | Lisp_Object |
| 2307 | get_local_map (register EMACS_INT position, register struct buffer *buffer, | 2307 | get_local_map (register ptrdiff_t position, register struct buffer *buffer, |
| 2308 | Lisp_Object type) | 2308 | Lisp_Object type) |
| 2309 | { | 2309 | { |
| 2310 | Lisp_Object prop, lispy_position, lispy_buffer; | 2310 | Lisp_Object prop, lispy_position, lispy_buffer; |
| 2311 | EMACS_INT old_begv, old_zv, old_begv_byte, old_zv_byte; | 2311 | ptrdiff_t old_begv, old_zv, old_begv_byte, old_zv_byte; |
| 2312 | 2312 | ||
| 2313 | /* Perhaps we should just change `position' to the limit. */ | 2313 | /* Perhaps we should just change `position' to the limit. */ |
| 2314 | if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer)) | 2314 | if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer)) |
| @@ -2355,10 +2355,10 @@ get_local_map (register EMACS_INT position, register struct buffer *buffer, | |||
| 2355 | The new interval tree has no parent and has a starting-position of 0. */ | 2355 | The new interval tree has no parent and has a starting-position of 0. */ |
| 2356 | 2356 | ||
| 2357 | INTERVAL | 2357 | INTERVAL |
| 2358 | copy_intervals (INTERVAL tree, EMACS_INT start, EMACS_INT length) | 2358 | copy_intervals (INTERVAL tree, ptrdiff_t start, ptrdiff_t length) |
| 2359 | { | 2359 | { |
| 2360 | register INTERVAL i, new, t; | 2360 | register INTERVAL i, new, t; |
| 2361 | register EMACS_INT got, prevlen; | 2361 | register ptrdiff_t got, prevlen; |
| 2362 | 2362 | ||
| 2363 | if (NULL_INTERVAL_P (tree) || length <= 0) | 2363 | if (NULL_INTERVAL_P (tree) || length <= 0) |
| 2364 | return NULL_INTERVAL; | 2364 | return NULL_INTERVAL; |
| @@ -2397,7 +2397,7 @@ copy_intervals (INTERVAL tree, EMACS_INT start, EMACS_INT length) | |||
| 2397 | 2397 | ||
| 2398 | inline void | 2398 | inline void |
| 2399 | copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, | 2399 | copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, |
| 2400 | EMACS_INT position, EMACS_INT length) | 2400 | ptrdiff_t position, ptrdiff_t length) |
| 2401 | { | 2401 | { |
| 2402 | INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), | 2402 | INTERVAL interval_copy = copy_intervals (BUF_INTERVALS (buffer), |
| 2403 | position, length); | 2403 | position, length); |
| @@ -2415,8 +2415,8 @@ int | |||
| 2415 | compare_string_intervals (Lisp_Object s1, Lisp_Object s2) | 2415 | compare_string_intervals (Lisp_Object s1, Lisp_Object s2) |
| 2416 | { | 2416 | { |
| 2417 | INTERVAL i1, i2; | 2417 | INTERVAL i1, i2; |
| 2418 | EMACS_INT pos = 0; | 2418 | ptrdiff_t pos = 0; |
| 2419 | EMACS_INT end = SCHARS (s1); | 2419 | ptrdiff_t end = SCHARS (s1); |
| 2420 | 2420 | ||
| 2421 | i1 = find_interval (STRING_INTERVALS (s1), 0); | 2421 | i1 = find_interval (STRING_INTERVALS (s1), 0); |
| 2422 | i2 = find_interval (STRING_INTERVALS (s2), 0); | 2422 | i2 = find_interval (STRING_INTERVALS (s2), 0); |
| @@ -2424,9 +2424,9 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2) | |||
| 2424 | while (pos < end) | 2424 | while (pos < end) |
| 2425 | { | 2425 | { |
| 2426 | /* Determine how far we can go before we reach the end of I1 or I2. */ | 2426 | /* Determine how far we can go before we reach the end of I1 or I2. */ |
| 2427 | EMACS_INT len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos; | 2427 | ptrdiff_t len1 = (i1 != 0 ? INTERVAL_LAST_POS (i1) : end) - pos; |
| 2428 | EMACS_INT len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos; | 2428 | ptrdiff_t len2 = (i2 != 0 ? INTERVAL_LAST_POS (i2) : end) - pos; |
| 2429 | EMACS_INT distance = min (len1, len2); | 2429 | ptrdiff_t distance = min (len1, len2); |
| 2430 | 2430 | ||
| 2431 | /* If we ever find a mismatch between the strings, | 2431 | /* If we ever find a mismatch between the strings, |
| 2432 | they differ. */ | 2432 | they differ. */ |
| @@ -2451,8 +2451,8 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2) | |||
| 2451 | 2451 | ||
| 2452 | static void | 2452 | static void |
| 2453 | set_intervals_multibyte_1 (INTERVAL i, int multi_flag, | 2453 | set_intervals_multibyte_1 (INTERVAL i, int multi_flag, |
| 2454 | EMACS_INT start, EMACS_INT start_byte, | 2454 | ptrdiff_t start, ptrdiff_t start_byte, |
| 2455 | EMACS_INT end, EMACS_INT end_byte) | 2455 | ptrdiff_t end, ptrdiff_t end_byte) |
| 2456 | { | 2456 | { |
| 2457 | /* Fix the length of this interval. */ | 2457 | /* Fix the length of this interval. */ |
| 2458 | if (multi_flag) | 2458 | if (multi_flag) |
| @@ -2470,11 +2470,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag, | |||
| 2470 | /* Recursively fix the length of the subintervals. */ | 2470 | /* Recursively fix the length of the subintervals. */ |
| 2471 | if (i->left) | 2471 | if (i->left) |
| 2472 | { | 2472 | { |
| 2473 | EMACS_INT left_end, left_end_byte; | 2473 | ptrdiff_t left_end, left_end_byte; |
| 2474 | 2474 | ||
| 2475 | if (multi_flag) | 2475 | if (multi_flag) |
| 2476 | { | 2476 | { |
| 2477 | EMACS_INT temp; | 2477 | ptrdiff_t temp; |
| 2478 | left_end_byte = start_byte + LEFT_TOTAL_LENGTH (i); | 2478 | left_end_byte = start_byte + LEFT_TOTAL_LENGTH (i); |
| 2479 | left_end = BYTE_TO_CHAR (left_end_byte); | 2479 | left_end = BYTE_TO_CHAR (left_end_byte); |
| 2480 | 2480 | ||
| @@ -2503,11 +2503,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag, | |||
| 2503 | } | 2503 | } |
| 2504 | if (i->right) | 2504 | if (i->right) |
| 2505 | { | 2505 | { |
| 2506 | EMACS_INT right_start_byte, right_start; | 2506 | ptrdiff_t right_start_byte, right_start; |
| 2507 | 2507 | ||
| 2508 | if (multi_flag) | 2508 | if (multi_flag) |
| 2509 | { | 2509 | { |
| 2510 | EMACS_INT temp; | 2510 | ptrdiff_t temp; |
| 2511 | 2511 | ||
| 2512 | right_start_byte = end_byte - RIGHT_TOTAL_LENGTH (i); | 2512 | right_start_byte = end_byte - RIGHT_TOTAL_LENGTH (i); |
| 2513 | right_start = BYTE_TO_CHAR (right_start_byte); | 2513 | right_start = BYTE_TO_CHAR (right_start_byte); |
diff --git a/src/intervals.h b/src/intervals.h index 720598fe7a6..d7d156b42db 100644 --- a/src/intervals.h +++ b/src/intervals.h | |||
| @@ -27,8 +27,8 @@ struct interval | |||
| 27 | { | 27 | { |
| 28 | /* The first group of entries deal with the tree structure. */ | 28 | /* The first group of entries deal with the tree structure. */ |
| 29 | 29 | ||
| 30 | EMACS_INT total_length; /* Length of myself and both children. */ | 30 | ptrdiff_t total_length; /* Length of myself and both children. */ |
| 31 | EMACS_INT position; /* Cache of interval's character position. */ | 31 | ptrdiff_t position; /* Cache of interval's character position. */ |
| 32 | /* This field is usually updated | 32 | /* This field is usually updated |
| 33 | simultaneously with an interval | 33 | simultaneously with an interval |
| 34 | traversal, there is no guarantee | 34 | traversal, there is no guarantee |
| @@ -254,39 +254,39 @@ extern INTERVAL make_interval (void); | |||
| 254 | extern INTERVAL create_root_interval (Lisp_Object); | 254 | extern INTERVAL create_root_interval (Lisp_Object); |
| 255 | extern void copy_properties (INTERVAL, INTERVAL); | 255 | extern void copy_properties (INTERVAL, INTERVAL); |
| 256 | extern int intervals_equal (INTERVAL, INTERVAL); | 256 | extern int intervals_equal (INTERVAL, INTERVAL); |
| 257 | extern void traverse_intervals (INTERVAL, EMACS_INT, | 257 | extern void traverse_intervals (INTERVAL, ptrdiff_t, |
| 258 | void (*) (INTERVAL, Lisp_Object), | 258 | void (*) (INTERVAL, Lisp_Object), |
| 259 | Lisp_Object); | 259 | Lisp_Object); |
| 260 | extern void traverse_intervals_noorder (INTERVAL, | 260 | extern void traverse_intervals_noorder (INTERVAL, |
| 261 | void (*) (INTERVAL, Lisp_Object), | 261 | void (*) (INTERVAL, Lisp_Object), |
| 262 | Lisp_Object); | 262 | Lisp_Object); |
| 263 | extern INTERVAL split_interval_right (INTERVAL, EMACS_INT); | 263 | extern INTERVAL split_interval_right (INTERVAL, ptrdiff_t); |
| 264 | extern INTERVAL split_interval_left (INTERVAL, EMACS_INT); | 264 | extern INTERVAL split_interval_left (INTERVAL, ptrdiff_t); |
| 265 | extern INTERVAL find_interval (INTERVAL, EMACS_INT); | 265 | extern INTERVAL find_interval (INTERVAL, ptrdiff_t); |
| 266 | extern INTERVAL next_interval (INTERVAL); | 266 | extern INTERVAL next_interval (INTERVAL); |
| 267 | extern INTERVAL previous_interval (INTERVAL); | 267 | extern INTERVAL previous_interval (INTERVAL); |
| 268 | extern INTERVAL merge_interval_left (INTERVAL); | 268 | extern INTERVAL merge_interval_left (INTERVAL); |
| 269 | extern void offset_intervals (struct buffer *, EMACS_INT, EMACS_INT); | 269 | extern void offset_intervals (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 270 | extern void graft_intervals_into_buffer (INTERVAL, EMACS_INT, EMACS_INT, | 270 | extern void graft_intervals_into_buffer (INTERVAL, ptrdiff_t, ptrdiff_t, |
| 271 | struct buffer *, int); | 271 | struct buffer *, int); |
| 272 | extern void verify_interval_modification (struct buffer *, | 272 | extern void verify_interval_modification (struct buffer *, |
| 273 | EMACS_INT, EMACS_INT); | 273 | ptrdiff_t, ptrdiff_t); |
| 274 | extern INTERVAL balance_intervals (INTERVAL); | 274 | extern INTERVAL balance_intervals (INTERVAL); |
| 275 | extern void copy_intervals_to_string (Lisp_Object, struct buffer *, | 275 | extern void copy_intervals_to_string (Lisp_Object, struct buffer *, |
| 276 | EMACS_INT, EMACS_INT); | 276 | ptrdiff_t, ptrdiff_t); |
| 277 | extern INTERVAL copy_intervals (INTERVAL, EMACS_INT, EMACS_INT); | 277 | extern INTERVAL copy_intervals (INTERVAL, ptrdiff_t, ptrdiff_t); |
| 278 | extern int compare_string_intervals (Lisp_Object, Lisp_Object); | 278 | extern int compare_string_intervals (Lisp_Object, Lisp_Object); |
| 279 | extern Lisp_Object textget (Lisp_Object, Lisp_Object); | 279 | extern Lisp_Object textget (Lisp_Object, Lisp_Object); |
| 280 | extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int); | 280 | extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int); |
| 281 | extern void move_if_not_intangible (EMACS_INT); | 281 | extern void move_if_not_intangible (ptrdiff_t); |
| 282 | extern int get_property_and_range (EMACS_INT, Lisp_Object, Lisp_Object *, | 282 | extern int get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *, |
| 283 | EMACS_INT *, EMACS_INT *, Lisp_Object); | 283 | ptrdiff_t *, ptrdiff_t *, Lisp_Object); |
| 284 | extern Lisp_Object get_local_map (EMACS_INT, struct buffer *, Lisp_Object); | 284 | extern Lisp_Object get_local_map (ptrdiff_t, struct buffer *, Lisp_Object); |
| 285 | extern INTERVAL update_interval (INTERVAL, EMACS_INT); | 285 | extern INTERVAL update_interval (INTERVAL, ptrdiff_t); |
| 286 | extern void set_intervals_multibyte (int); | 286 | extern void set_intervals_multibyte (int); |
| 287 | extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, | 287 | extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, |
| 288 | Lisp_Object *, int); | 288 | Lisp_Object *, int); |
| 289 | extern INTERVAL interval_of (EMACS_INT, Lisp_Object); | 289 | extern INTERVAL interval_of (ptrdiff_t, Lisp_Object); |
| 290 | 290 | ||
| 291 | /* Defined in xdisp.c */ | 291 | /* Defined in xdisp.c */ |
| 292 | extern int invisible_p (Lisp_Object, Lisp_Object); | 292 | extern int invisible_p (Lisp_Object, Lisp_Object); |
diff --git a/src/keyboard.c b/src/keyboard.c index 26407785c86..318ada35eb3 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -122,7 +122,7 @@ static Lisp_Object recent_keys; | |||
| 122 | actually mean something. | 122 | actually mean something. |
| 123 | It's easier to staticpro a single Lisp_Object than an array. */ | 123 | It's easier to staticpro a single Lisp_Object than an array. */ |
| 124 | Lisp_Object this_command_keys; | 124 | Lisp_Object this_command_keys; |
| 125 | int this_command_key_count; | 125 | ptrdiff_t this_command_key_count; |
| 126 | 126 | ||
| 127 | /* 1 after calling Freset_this_command_lengths. | 127 | /* 1 after calling Freset_this_command_lengths. |
| 128 | Usually it is 0. */ | 128 | Usually it is 0. */ |
| @@ -135,16 +135,16 @@ static int raw_keybuf_count; | |||
| 135 | 135 | ||
| 136 | #define GROW_RAW_KEYBUF \ | 136 | #define GROW_RAW_KEYBUF \ |
| 137 | if (raw_keybuf_count == ASIZE (raw_keybuf)) \ | 137 | if (raw_keybuf_count == ASIZE (raw_keybuf)) \ |
| 138 | raw_keybuf = larger_vector (raw_keybuf, raw_keybuf_count * 2, Qnil) \ | 138 | raw_keybuf = larger_vector (raw_keybuf, 1, -1) |
| 139 | 139 | ||
| 140 | /* Number of elements of this_command_keys | 140 | /* Number of elements of this_command_keys |
| 141 | that precede this key sequence. */ | 141 | that precede this key sequence. */ |
| 142 | static int this_single_command_key_start; | 142 | static ptrdiff_t this_single_command_key_start; |
| 143 | 143 | ||
| 144 | /* Record values of this_command_key_count and echo_length () | 144 | /* Record values of this_command_key_count and echo_length () |
| 145 | before this command was read. */ | 145 | before this command was read. */ |
| 146 | static int before_command_key_count; | 146 | static ptrdiff_t before_command_key_count; |
| 147 | static int before_command_echo_length; | 147 | static ptrdiff_t before_command_echo_length; |
| 148 | 148 | ||
| 149 | /* For longjmp to where kbd input is being done. */ | 149 | /* For longjmp to where kbd input is being done. */ |
| 150 | 150 | ||
| @@ -208,20 +208,20 @@ EMACS_INT command_loop_level; | |||
| 208 | Lisp_Object unread_switch_frame; | 208 | Lisp_Object unread_switch_frame; |
| 209 | 209 | ||
| 210 | /* Last size recorded for a current buffer which is not a minibuffer. */ | 210 | /* Last size recorded for a current buffer which is not a minibuffer. */ |
| 211 | static EMACS_INT last_non_minibuf_size; | 211 | static ptrdiff_t last_non_minibuf_size; |
| 212 | 212 | ||
| 213 | /* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */ | 213 | /* Total number of times read_char has returned, modulo UINTMAX_MAX + 1. */ |
| 214 | uintmax_t num_input_events; | 214 | uintmax_t num_input_events; |
| 215 | 215 | ||
| 216 | /* Value of num_nonmacro_input_events as of last auto save. */ | 216 | /* Value of num_nonmacro_input_events as of last auto save. */ |
| 217 | 217 | ||
| 218 | static int last_auto_save; | 218 | static EMACS_INT last_auto_save; |
| 219 | 219 | ||
| 220 | /* This is like Vthis_command, except that commands never set it. */ | 220 | /* This is like Vthis_command, except that commands never set it. */ |
| 221 | Lisp_Object real_this_command; | 221 | Lisp_Object real_this_command; |
| 222 | 222 | ||
| 223 | /* The value of point when the last command was started. */ | 223 | /* The value of point when the last command was started. */ |
| 224 | static EMACS_INT last_point_position; | 224 | static ptrdiff_t last_point_position; |
| 225 | 225 | ||
| 226 | /* The buffer that was current when the last command was started. */ | 226 | /* The buffer that was current when the last command was started. */ |
| 227 | static Lisp_Object last_point_position_buffer; | 227 | static Lisp_Object last_point_position_buffer; |
| @@ -375,7 +375,7 @@ EMACS_TIME timer_check (void); | |||
| 375 | 375 | ||
| 376 | static void record_menu_key (Lisp_Object c); | 376 | static void record_menu_key (Lisp_Object c); |
| 377 | static void echo_now (void); | 377 | static void echo_now (void); |
| 378 | static int echo_length (void); | 378 | static ptrdiff_t echo_length (void); |
| 379 | 379 | ||
| 380 | static Lisp_Object Qpolling_period; | 380 | static Lisp_Object Qpolling_period; |
| 381 | 381 | ||
| @@ -446,9 +446,9 @@ static Lisp_Object make_lispy_movement (struct frame *, Lisp_Object, | |||
| 446 | Lisp_Object, Lisp_Object, | 446 | Lisp_Object, Lisp_Object, |
| 447 | Time); | 447 | Time); |
| 448 | #endif | 448 | #endif |
| 449 | static Lisp_Object modify_event_symbol (EMACS_INT, unsigned, Lisp_Object, | 449 | static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object, |
| 450 | Lisp_Object, const char *const *, | 450 | Lisp_Object, const char *const *, |
| 451 | Lisp_Object *, EMACS_INT); | 451 | Lisp_Object *, ptrdiff_t); |
| 452 | static Lisp_Object make_lispy_switch_frame (Lisp_Object); | 452 | static Lisp_Object make_lispy_switch_frame (Lisp_Object); |
| 453 | static int help_char_p (Lisp_Object); | 453 | static int help_char_p (Lisp_Object); |
| 454 | static void save_getcjmp (jmp_buf); | 454 | static void save_getcjmp (jmp_buf); |
| @@ -612,7 +612,7 @@ echo_now (void) | |||
| 612 | { | 612 | { |
| 613 | if (!current_kboard->immediate_echo) | 613 | if (!current_kboard->immediate_echo) |
| 614 | { | 614 | { |
| 615 | int i; | 615 | ptrdiff_t i; |
| 616 | current_kboard->immediate_echo = 1; | 616 | current_kboard->immediate_echo = 1; |
| 617 | 617 | ||
| 618 | for (i = 0; i < this_command_key_count; i++) | 618 | for (i = 0; i < this_command_key_count; i++) |
| @@ -670,7 +670,7 @@ cancel_echoing (void) | |||
| 670 | 670 | ||
| 671 | /* Return the length of the current echo string. */ | 671 | /* Return the length of the current echo string. */ |
| 672 | 672 | ||
| 673 | static int | 673 | static ptrdiff_t |
| 674 | echo_length (void) | 674 | echo_length (void) |
| 675 | { | 675 | { |
| 676 | return (STRINGP (KVAR (current_kboard, echo_string)) | 676 | return (STRINGP (KVAR (current_kboard, echo_string)) |
| @@ -683,7 +683,7 @@ echo_length (void) | |||
| 683 | switches frames while entering a key sequence. */ | 683 | switches frames while entering a key sequence. */ |
| 684 | 684 | ||
| 685 | static void | 685 | static void |
| 686 | echo_truncate (EMACS_INT nchars) | 686 | echo_truncate (ptrdiff_t nchars) |
| 687 | { | 687 | { |
| 688 | if (STRINGP (KVAR (current_kboard, echo_string))) | 688 | if (STRINGP (KVAR (current_kboard, echo_string))) |
| 689 | KVAR (current_kboard, echo_string) | 689 | KVAR (current_kboard, echo_string) |
| @@ -712,9 +712,7 @@ add_command_key (Lisp_Object key) | |||
| 712 | #endif | 712 | #endif |
| 713 | 713 | ||
| 714 | if (this_command_key_count >= ASIZE (this_command_keys)) | 714 | if (this_command_key_count >= ASIZE (this_command_keys)) |
| 715 | this_command_keys = larger_vector (this_command_keys, | 715 | this_command_keys = larger_vector (this_command_keys, 1, -1); |
| 716 | 2 * ASIZE (this_command_keys), | ||
| 717 | Qnil); | ||
| 718 | 716 | ||
| 719 | ASET (this_command_keys, this_command_key_count, key); | 717 | ASET (this_command_keys, this_command_key_count, key); |
| 720 | ++this_command_key_count; | 718 | ++this_command_key_count; |
| @@ -724,7 +722,7 @@ add_command_key (Lisp_Object key) | |||
| 724 | Lisp_Object | 722 | Lisp_Object |
| 725 | recursive_edit_1 (void) | 723 | recursive_edit_1 (void) |
| 726 | { | 724 | { |
| 727 | int count = SPECPDL_INDEX (); | 725 | ptrdiff_t count = SPECPDL_INDEX (); |
| 728 | Lisp_Object val; | 726 | Lisp_Object val; |
| 729 | 727 | ||
| 730 | if (command_loop_level > 0) | 728 | if (command_loop_level > 0) |
| @@ -792,7 +790,7 @@ Alternatively, `(throw 'exit t)' makes this function signal an error. | |||
| 792 | This function is called by the editor initialization to begin editing. */) | 790 | This function is called by the editor initialization to begin editing. */) |
| 793 | (void) | 791 | (void) |
| 794 | { | 792 | { |
| 795 | int count = SPECPDL_INDEX (); | 793 | ptrdiff_t count = SPECPDL_INDEX (); |
| 796 | Lisp_Object buffer; | 794 | Lisp_Object buffer; |
| 797 | 795 | ||
| 798 | /* If we enter while input is blocked, don't lock up here. | 796 | /* If we enter while input is blocked, don't lock up here. |
| @@ -1253,7 +1251,7 @@ Normally, mouse motion is ignored. | |||
| 1253 | usage: (track-mouse BODY...) */) | 1251 | usage: (track-mouse BODY...) */) |
| 1254 | (Lisp_Object args) | 1252 | (Lisp_Object args) |
| 1255 | { | 1253 | { |
| 1256 | int count = SPECPDL_INDEX (); | 1254 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1257 | Lisp_Object val; | 1255 | Lisp_Object val; |
| 1258 | 1256 | ||
| 1259 | record_unwind_protect (tracking_off, do_mouse_tracking); | 1257 | record_unwind_protect (tracking_off, do_mouse_tracking); |
| @@ -1304,7 +1302,7 @@ some_mouse_moved (void) | |||
| 1304 | static int read_key_sequence (Lisp_Object *, int, Lisp_Object, | 1302 | static int read_key_sequence (Lisp_Object *, int, Lisp_Object, |
| 1305 | int, int, int); | 1303 | int, int, int); |
| 1306 | void safe_run_hooks (Lisp_Object); | 1304 | void safe_run_hooks (Lisp_Object); |
| 1307 | static void adjust_point_for_property (EMACS_INT, int); | 1305 | static void adjust_point_for_property (ptrdiff_t, int); |
| 1308 | 1306 | ||
| 1309 | /* Cancel hourglass from protect_unwind. | 1307 | /* Cancel hourglass from protect_unwind. |
| 1310 | ARG is not used. */ | 1308 | ARG is not used. */ |
| @@ -1328,7 +1326,7 @@ command_loop_1 (void) | |||
| 1328 | Lisp_Object cmd; | 1326 | Lisp_Object cmd; |
| 1329 | Lisp_Object keybuf[30]; | 1327 | Lisp_Object keybuf[30]; |
| 1330 | int i; | 1328 | int i; |
| 1331 | int prev_modiff = 0; | 1329 | EMACS_INT prev_modiff = 0; |
| 1332 | struct buffer *prev_buffer = NULL; | 1330 | struct buffer *prev_buffer = NULL; |
| 1333 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | 1331 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ |
| 1334 | int was_locked = single_kboard; | 1332 | int was_locked = single_kboard; |
| @@ -1400,7 +1398,7 @@ command_loop_1 (void) | |||
| 1400 | { | 1398 | { |
| 1401 | /* Bind inhibit-quit to t so that C-g gets read in | 1399 | /* Bind inhibit-quit to t so that C-g gets read in |
| 1402 | rather than quitting back to the minibuffer. */ | 1400 | rather than quitting back to the minibuffer. */ |
| 1403 | int count = SPECPDL_INDEX (); | 1401 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1404 | specbind (Qinhibit_quit, Qt); | 1402 | specbind (Qinhibit_quit, Qt); |
| 1405 | 1403 | ||
| 1406 | sit_for (Vminibuffer_message_timeout, 0, 2); | 1404 | sit_for (Vminibuffer_message_timeout, 0, 2); |
| @@ -1558,7 +1556,7 @@ command_loop_1 (void) | |||
| 1558 | /* Here for a command that isn't executed directly */ | 1556 | /* Here for a command that isn't executed directly */ |
| 1559 | 1557 | ||
| 1560 | #ifdef HAVE_WINDOW_SYSTEM | 1558 | #ifdef HAVE_WINDOW_SYSTEM |
| 1561 | int scount = SPECPDL_INDEX (); | 1559 | ptrdiff_t scount = SPECPDL_INDEX (); |
| 1562 | 1560 | ||
| 1563 | if (display_hourglass_p | 1561 | if (display_hourglass_p |
| 1564 | && NILP (Vexecuting_kbd_macro)) | 1562 | && NILP (Vexecuting_kbd_macro)) |
| @@ -1651,9 +1649,9 @@ command_loop_1 (void) | |||
| 1651 | && !NILP (Vtransient_mark_mode))) | 1649 | && !NILP (Vtransient_mark_mode))) |
| 1652 | && !EQ (Vthis_command, Qhandle_switch_frame)) | 1650 | && !EQ (Vthis_command, Qhandle_switch_frame)) |
| 1653 | { | 1651 | { |
| 1654 | EMACS_INT beg = | 1652 | ptrdiff_t beg = |
| 1655 | XINT (Fmarker_position (BVAR (current_buffer, mark))); | 1653 | XINT (Fmarker_position (BVAR (current_buffer, mark))); |
| 1656 | EMACS_INT end = PT; | 1654 | ptrdiff_t end = PT; |
| 1657 | if (beg < end) | 1655 | if (beg < end) |
| 1658 | call2 (Qx_set_selection, QPRIMARY, | 1656 | call2 (Qx_set_selection, QPRIMARY, |
| 1659 | make_buffer_string (beg, end, 0)); | 1657 | make_buffer_string (beg, end, 0)); |
| @@ -1713,16 +1711,16 @@ command_loop_1 (void) | |||
| 1713 | LAST_PT is the last position of point. */ | 1711 | LAST_PT is the last position of point. */ |
| 1714 | 1712 | ||
| 1715 | static void | 1713 | static void |
| 1716 | adjust_point_for_property (EMACS_INT last_pt, int modified) | 1714 | adjust_point_for_property (ptrdiff_t last_pt, int modified) |
| 1717 | { | 1715 | { |
| 1718 | EMACS_INT beg, end; | 1716 | ptrdiff_t beg, end; |
| 1719 | Lisp_Object val, overlay, tmp; | 1717 | Lisp_Object val, overlay, tmp; |
| 1720 | /* When called after buffer modification, we should temporarily | 1718 | /* When called after buffer modification, we should temporarily |
| 1721 | suppress the point adjustment for automatic composition so that a | 1719 | suppress the point adjustment for automatic composition so that a |
| 1722 | user can keep inserting another character at point or keep | 1720 | user can keep inserting another character at point or keep |
| 1723 | deleting characters around point. */ | 1721 | deleting characters around point. */ |
| 1724 | int check_composition = ! modified, check_display = 1, check_invisible = 1; | 1722 | int check_composition = ! modified, check_display = 1, check_invisible = 1; |
| 1725 | EMACS_INT orig_pt = PT; | 1723 | ptrdiff_t orig_pt = PT; |
| 1726 | 1724 | ||
| 1727 | /* FIXME: cycling is probably not necessary because these properties | 1725 | /* FIXME: cycling is probably not necessary because these properties |
| 1728 | can't be usefully combined anyway. */ | 1726 | can't be usefully combined anyway. */ |
| @@ -1935,7 +1933,7 @@ safe_run_hooks (Lisp_Object hook) | |||
| 1935 | /* FIXME: our `internal_condition_case' does not provide any way to pass data | 1933 | /* FIXME: our `internal_condition_case' does not provide any way to pass data |
| 1936 | to its body or to its handlers other than via globals such as | 1934 | to its body or to its handlers other than via globals such as |
| 1937 | dynamically-bound variables ;-) */ | 1935 | dynamically-bound variables ;-) */ |
| 1938 | int count = SPECPDL_INDEX (); | 1936 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1939 | specbind (Qinhibit_quit, hook); | 1937 | specbind (Qinhibit_quit, hook); |
| 1940 | 1938 | ||
| 1941 | run_hook_with_args (1, &hook, safe_run_hook_funcall); | 1939 | run_hook_with_args (1, &hook, safe_run_hook_funcall); |
| @@ -2273,7 +2271,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 2273 | int *used_mouse_menu, struct timeval *end_time) | 2271 | int *used_mouse_menu, struct timeval *end_time) |
| 2274 | { | 2272 | { |
| 2275 | volatile Lisp_Object c; | 2273 | volatile Lisp_Object c; |
| 2276 | int jmpcount; | 2274 | ptrdiff_t jmpcount; |
| 2277 | jmp_buf local_getcjmp; | 2275 | jmp_buf local_getcjmp; |
| 2278 | jmp_buf save_jump; | 2276 | jmp_buf save_jump; |
| 2279 | volatile int key_already_recorded = 0; | 2277 | volatile int key_already_recorded = 0; |
| @@ -2662,7 +2660,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 2662 | if (INTERACTIVE && NILP (c)) | 2660 | if (INTERACTIVE && NILP (c)) |
| 2663 | { | 2661 | { |
| 2664 | int delay_level; | 2662 | int delay_level; |
| 2665 | EMACS_INT buffer_size; | 2663 | ptrdiff_t buffer_size; |
| 2666 | 2664 | ||
| 2667 | /* Slow down auto saves logarithmically in size of current buffer, | 2665 | /* Slow down auto saves logarithmically in size of current buffer, |
| 2668 | and garbage collect while we're at it. */ | 2666 | and garbage collect while we're at it. */ |
| @@ -2683,8 +2681,9 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 2683 | && XINT (Vauto_save_timeout) > 0) | 2681 | && XINT (Vauto_save_timeout) > 0) |
| 2684 | { | 2682 | { |
| 2685 | Lisp_Object tem0; | 2683 | Lisp_Object tem0; |
| 2686 | int timeout = delay_level * XFASTINT (Vauto_save_timeout) / 4; | 2684 | EMACS_INT timeout = (delay_level |
| 2687 | 2685 | * min (XFASTINT (Vauto_save_timeout) / 4, | |
| 2686 | MOST_POSITIVE_FIXNUM / delay_level)); | ||
| 2688 | save_getcjmp (save_jump); | 2687 | save_getcjmp (save_jump); |
| 2689 | restore_getcjmp (local_getcjmp); | 2688 | restore_getcjmp (local_getcjmp); |
| 2690 | tem0 = sit_for (make_number (timeout), 1, 1); | 2689 | tem0 = sit_for (make_number (timeout), 1, 1); |
| @@ -2878,7 +2877,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 2878 | struct buffer *prev_buffer = current_buffer; | 2877 | struct buffer *prev_buffer = current_buffer; |
| 2879 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ | 2878 | #if 0 /* This shouldn't be necessary anymore. --lorentey */ |
| 2880 | int was_locked = single_kboard; | 2879 | int was_locked = single_kboard; |
| 2881 | int count = SPECPDL_INDEX (); | 2880 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2882 | record_single_kboard_state (); | 2881 | record_single_kboard_state (); |
| 2883 | #endif | 2882 | #endif |
| 2884 | 2883 | ||
| @@ -3000,9 +2999,10 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 3000 | && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127) | 2999 | && ' ' <= XINT (c) && XINT (c) < 256 && XINT (c) != 127) |
| 3001 | { | 3000 | { |
| 3002 | Lisp_Object keys; | 3001 | Lisp_Object keys; |
| 3003 | int key_count, key_count_reset; | 3002 | ptrdiff_t key_count; |
| 3003 | int key_count_reset; | ||
| 3004 | struct gcpro inner_gcpro1; | 3004 | struct gcpro inner_gcpro1; |
| 3005 | int count = SPECPDL_INDEX (); | 3005 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3006 | 3006 | ||
| 3007 | /* Save the echo status. */ | 3007 | /* Save the echo status. */ |
| 3008 | int saved_immediate_echo = current_kboard->immediate_echo; | 3008 | int saved_immediate_echo = current_kboard->immediate_echo; |
| @@ -3139,7 +3139,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, | |||
| 3139 | /* Process the help character specially if enabled */ | 3139 | /* Process the help character specially if enabled */ |
| 3140 | if (!NILP (Vhelp_form) && help_char_p (c)) | 3140 | if (!NILP (Vhelp_form) && help_char_p (c)) |
| 3141 | { | 3141 | { |
| 3142 | int count = SPECPDL_INDEX (); | 3142 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3143 | 3143 | ||
| 3144 | help_form_saved_window_configs | 3144 | help_form_saved_window_configs |
| 3145 | = Fcons (Fcurrent_window_configuration (Qnil), | 3145 | = Fcons (Fcurrent_window_configuration (Qnil), |
| @@ -3299,7 +3299,7 @@ record_char (Lisp_Object c) | |||
| 3299 | 3299 | ||
| 3300 | if (!recorded) | 3300 | if (!recorded) |
| 3301 | { | 3301 | { |
| 3302 | total_keys++; | 3302 | total_keys += total_keys < NUM_RECENT_KEYS; |
| 3303 | ASET (recent_keys, recent_keys_index, c); | 3303 | ASET (recent_keys, recent_keys_index, c); |
| 3304 | if (++recent_keys_index >= NUM_RECENT_KEYS) | 3304 | if (++recent_keys_index >= NUM_RECENT_KEYS) |
| 3305 | recent_keys_index = 0; | 3305 | recent_keys_index = 0; |
| @@ -3668,7 +3668,7 @@ kbd_buffer_unget_event (register struct input_event *event) | |||
| 3668 | 3668 | ||
| 3669 | void | 3669 | void |
| 3670 | gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window, | 3670 | gen_help_event (Lisp_Object help, Lisp_Object frame, Lisp_Object window, |
| 3671 | Lisp_Object object, EMACS_INT pos) | 3671 | Lisp_Object object, ptrdiff_t pos) |
| 3672 | { | 3672 | { |
| 3673 | struct input_event event; | 3673 | struct input_event event; |
| 3674 | 3674 | ||
| @@ -4418,7 +4418,7 @@ timer_check_2 (void) | |||
| 4418 | { | 4418 | { |
| 4419 | if (NILP (vector[0])) | 4419 | if (NILP (vector[0])) |
| 4420 | { | 4420 | { |
| 4421 | int count = SPECPDL_INDEX (); | 4421 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4422 | Lisp_Object old_deactivate_mark = Vdeactivate_mark; | 4422 | Lisp_Object old_deactivate_mark = Vdeactivate_mark; |
| 4423 | 4423 | ||
| 4424 | /* Mark the timer as triggered to prevent problems if the lisp | 4424 | /* Mark the timer as triggered to prevent problems if the lisp |
| @@ -5129,7 +5129,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, | |||
| 5129 | /* It's a click in window window at frame coordinates (x,y) */ | 5129 | /* It's a click in window window at frame coordinates (x,y) */ |
| 5130 | struct window *w = XWINDOW (window); | 5130 | struct window *w = XWINDOW (window); |
| 5131 | Lisp_Object string_info = Qnil; | 5131 | Lisp_Object string_info = Qnil; |
| 5132 | EMACS_INT textpos = -1; | 5132 | ptrdiff_t textpos = -1; |
| 5133 | int col = -1, row = -1; | 5133 | int col = -1, row = -1; |
| 5134 | int dx = -1, dy = -1; | 5134 | int dx = -1, dy = -1; |
| 5135 | int width = -1, height = -1; | 5135 | int width = -1, height = -1; |
| @@ -5153,7 +5153,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, | |||
| 5153 | else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) | 5153 | else if (part == ON_MODE_LINE || part == ON_HEADER_LINE) |
| 5154 | { | 5154 | { |
| 5155 | Lisp_Object string; | 5155 | Lisp_Object string; |
| 5156 | EMACS_INT charpos; | 5156 | ptrdiff_t charpos; |
| 5157 | 5157 | ||
| 5158 | posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line; | 5158 | posn = (part == ON_MODE_LINE) ? Qmode_line : Qheader_line; |
| 5159 | /* Note that mode_line_string takes COL, ROW as pixels and | 5159 | /* Note that mode_line_string takes COL, ROW as pixels and |
| @@ -5176,7 +5176,7 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, | |||
| 5176 | else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) | 5176 | else if (part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) |
| 5177 | { | 5177 | { |
| 5178 | Lisp_Object string; | 5178 | Lisp_Object string; |
| 5179 | EMACS_INT charpos; | 5179 | ptrdiff_t charpos; |
| 5180 | 5180 | ||
| 5181 | posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; | 5181 | posn = (part == ON_LEFT_MARGIN) ? Qleft_margin : Qright_margin; |
| 5182 | col = wx; | 5182 | col = wx; |
| @@ -5404,7 +5404,7 @@ make_lispy_event (struct input_event *event) | |||
| 5404 | Qfunction_key, | 5404 | Qfunction_key, |
| 5405 | KVAR (current_kboard, Vsystem_key_alist), | 5405 | KVAR (current_kboard, Vsystem_key_alist), |
| 5406 | 0, &KVAR (current_kboard, system_key_syms), | 5406 | 0, &KVAR (current_kboard, system_key_syms), |
| 5407 | TYPE_MAXIMUM (EMACS_INT)); | 5407 | PTRDIFF_MAX); |
| 5408 | } | 5408 | } |
| 5409 | 5409 | ||
| 5410 | return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET, | 5410 | return modify_event_symbol (event->code - FUNCTION_KEY_OFFSET, |
| @@ -5536,9 +5536,10 @@ make_lispy_event (struct input_event *event) | |||
| 5536 | 5536 | ||
| 5537 | if (button >= ASIZE (button_down_location)) | 5537 | if (button >= ASIZE (button_down_location)) |
| 5538 | { | 5538 | { |
| 5539 | ptrdiff_t incr = button - ASIZE (button_down_location) + 1; | ||
| 5539 | button_down_location = larger_vector (button_down_location, | 5540 | button_down_location = larger_vector (button_down_location, |
| 5540 | button + 1, Qnil); | 5541 | incr, -1); |
| 5541 | mouse_syms = larger_vector (mouse_syms, button + 1, Qnil); | 5542 | mouse_syms = larger_vector (mouse_syms, incr, -1); |
| 5542 | } | 5543 | } |
| 5543 | 5544 | ||
| 5544 | start_pos_ptr = &AREF (button_down_location, button); | 5545 | start_pos_ptr = &AREF (button_down_location, button); |
| @@ -5838,7 +5839,9 @@ make_lispy_event (struct input_event *event) | |||
| 5838 | event->modifiers &= ~up_modifier; | 5839 | event->modifiers &= ~up_modifier; |
| 5839 | 5840 | ||
| 5840 | if (event->code >= ASIZE (mouse_syms)) | 5841 | if (event->code >= ASIZE (mouse_syms)) |
| 5841 | mouse_syms = larger_vector (mouse_syms, event->code + 1, Qnil); | 5842 | mouse_syms = larger_vector (mouse_syms, |
| 5843 | event->code - ASIZE (mouse_syms) + 1, | ||
| 5844 | -1); | ||
| 5842 | 5845 | ||
| 5843 | /* Get the symbol we should use for the mouse click. */ | 5846 | /* Get the symbol we should use for the mouse click. */ |
| 5844 | head = modify_event_symbol (event->code, | 5847 | head = modify_event_symbol (event->code, |
| @@ -5941,9 +5944,10 @@ make_lispy_event (struct input_event *event) | |||
| 5941 | 5944 | ||
| 5942 | if (button >= ASIZE (button_down_location)) | 5945 | if (button >= ASIZE (button_down_location)) |
| 5943 | { | 5946 | { |
| 5947 | ptrdiff_t incr = button - ASIZE (button_down_location) + 1; | ||
| 5944 | button_down_location = larger_vector (button_down_location, | 5948 | button_down_location = larger_vector (button_down_location, |
| 5945 | button + 1, Qnil); | 5949 | incr, -1); |
| 5946 | mouse_syms = larger_vector (mouse_syms, button + 1, Qnil); | 5950 | mouse_syms = larger_vector (mouse_syms, incr, -1); |
| 5947 | } | 5951 | } |
| 5948 | 5952 | ||
| 5949 | start_pos_ptr = &AREF (button_down_location, button); | 5953 | start_pos_ptr = &AREF (button_down_location, button); |
| @@ -6045,10 +6049,10 @@ make_lispy_switch_frame (Lisp_Object frame) | |||
| 6045 | This doesn't use any caches. */ | 6049 | This doesn't use any caches. */ |
| 6046 | 6050 | ||
| 6047 | static int | 6051 | static int |
| 6048 | parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end) | 6052 | parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t *modifier_end) |
| 6049 | { | 6053 | { |
| 6050 | Lisp_Object name; | 6054 | Lisp_Object name; |
| 6051 | EMACS_INT i; | 6055 | ptrdiff_t i; |
| 6052 | int modifiers; | 6056 | int modifiers; |
| 6053 | 6057 | ||
| 6054 | CHECK_SYMBOL (symbol); | 6058 | CHECK_SYMBOL (symbol); |
| @@ -6056,9 +6060,9 @@ parse_modifiers_uncached (Lisp_Object symbol, EMACS_INT *modifier_end) | |||
| 6056 | modifiers = 0; | 6060 | modifiers = 0; |
| 6057 | name = SYMBOL_NAME (symbol); | 6061 | name = SYMBOL_NAME (symbol); |
| 6058 | 6062 | ||
| 6059 | for (i = 0; i+2 <= SBYTES (name); ) | 6063 | for (i = 0; 2 <= SBYTES (name) - i; ) |
| 6060 | { | 6064 | { |
| 6061 | EMACS_INT this_mod_end = 0; | 6065 | ptrdiff_t this_mod_end = 0; |
| 6062 | int this_mod = 0; | 6066 | int this_mod = 0; |
| 6063 | 6067 | ||
| 6064 | /* See if the name continues with a modifier word. | 6068 | /* See if the name continues with a modifier word. |
| @@ -6255,7 +6259,7 @@ parse_modifiers (Lisp_Object symbol) | |||
| 6255 | return elements; | 6259 | return elements; |
| 6256 | else | 6260 | else |
| 6257 | { | 6261 | { |
| 6258 | EMACS_INT end; | 6262 | ptrdiff_t end; |
| 6259 | int modifiers = parse_modifiers_uncached (symbol, &end); | 6263 | int modifiers = parse_modifiers_uncached (symbol, &end); |
| 6260 | Lisp_Object unmodified; | 6264 | Lisp_Object unmodified; |
| 6261 | Lisp_Object mask; | 6265 | Lisp_Object mask; |
| @@ -6421,9 +6425,9 @@ reorder_modifiers (Lisp_Object symbol) | |||
| 6421 | in the symbol's name. */ | 6425 | in the symbol's name. */ |
| 6422 | 6426 | ||
| 6423 | static Lisp_Object | 6427 | static Lisp_Object |
| 6424 | modify_event_symbol (EMACS_INT symbol_num, unsigned int modifiers, Lisp_Object symbol_kind, | 6428 | modify_event_symbol (ptrdiff_t symbol_num, int modifiers, Lisp_Object symbol_kind, |
| 6425 | Lisp_Object name_alist_or_stem, const char *const *name_table, | 6429 | Lisp_Object name_alist_or_stem, const char *const *name_table, |
| 6426 | Lisp_Object *symbol_table, EMACS_INT table_size) | 6430 | Lisp_Object *symbol_table, ptrdiff_t table_size) |
| 6427 | { | 6431 | { |
| 6428 | Lisp_Object value; | 6432 | Lisp_Object value; |
| 6429 | Lisp_Object symbol_int; | 6433 | Lisp_Object symbol_int; |
| @@ -7525,7 +7529,7 @@ menu_bar_items (Lisp_Object old) | |||
| 7525 | int i = menu_bar_items_index; | 7529 | int i = menu_bar_items_index; |
| 7526 | if (i + 4 > ASIZE (menu_bar_items_vector)) | 7530 | if (i + 4 > ASIZE (menu_bar_items_vector)) |
| 7527 | menu_bar_items_vector = | 7531 | menu_bar_items_vector = |
| 7528 | larger_vector (menu_bar_items_vector, 2 * i, Qnil); | 7532 | larger_vector (menu_bar_items_vector, 4, -1); |
| 7529 | /* Add this item. */ | 7533 | /* Add this item. */ |
| 7530 | XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; | 7534 | XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; |
| 7531 | XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; | 7535 | XVECTOR (menu_bar_items_vector)->contents[i++] = Qnil; |
| @@ -7596,7 +7600,7 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm | |||
| 7596 | { | 7600 | { |
| 7597 | /* If vector is too small, get a bigger one. */ | 7601 | /* If vector is too small, get a bigger one. */ |
| 7598 | if (i + 4 > ASIZE (menu_bar_items_vector)) | 7602 | if (i + 4 > ASIZE (menu_bar_items_vector)) |
| 7599 | menu_bar_items_vector = larger_vector (menu_bar_items_vector, 2 * i, Qnil); | 7603 | menu_bar_items_vector = larger_vector (menu_bar_items_vector, 4, -1); |
| 7600 | /* Add this item. */ | 7604 | /* Add this item. */ |
| 7601 | XVECTOR (menu_bar_items_vector)->contents[i++] = key; | 7605 | XVECTOR (menu_bar_items_vector)->contents[i++] = key; |
| 7602 | XVECTOR (menu_bar_items_vector)->contents[i++] | 7606 | XVECTOR (menu_bar_items_vector)->contents[i++] |
| @@ -7640,7 +7644,7 @@ eval_dyn (Lisp_Object form) | |||
| 7640 | Lisp_Object | 7644 | Lisp_Object |
| 7641 | menu_item_eval_property (Lisp_Object sexpr) | 7645 | menu_item_eval_property (Lisp_Object sexpr) |
| 7642 | { | 7646 | { |
| 7643 | int count = SPECPDL_INDEX (); | 7647 | ptrdiff_t count = SPECPDL_INDEX (); |
| 7644 | Lisp_Object val; | 7648 | Lisp_Object val; |
| 7645 | specbind (Qinhibit_redisplay, Qt); | 7649 | specbind (Qinhibit_redisplay, Qt); |
| 7646 | val = internal_condition_case_1 (eval_dyn, sexpr, Qerror, | 7650 | val = internal_condition_case_1 (eval_dyn, sexpr, Qerror, |
| @@ -8365,13 +8369,14 @@ static void | |||
| 8365 | append_tool_bar_item (void) | 8369 | append_tool_bar_item (void) |
| 8366 | { | 8370 | { |
| 8367 | Lisp_Object *to, *from; | 8371 | Lisp_Object *to, *from; |
| 8372 | ptrdiff_t incr = | ||
| 8373 | (ntool_bar_items | ||
| 8374 | - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); | ||
| 8368 | 8375 | ||
| 8369 | /* Enlarge tool_bar_items_vector if necessary. */ | 8376 | /* Enlarge tool_bar_items_vector if necessary. */ |
| 8370 | if (ntool_bar_items + TOOL_BAR_ITEM_NSLOTS | 8377 | if (0 < incr) |
| 8371 | >= ASIZE (tool_bar_items_vector)) | ||
| 8372 | tool_bar_items_vector | 8378 | tool_bar_items_vector |
| 8373 | = larger_vector (tool_bar_items_vector, | 8379 | = larger_vector (tool_bar_items_vector, incr, -1); |
| 8374 | 2 * ASIZE (tool_bar_items_vector), Qnil); | ||
| 8375 | 8380 | ||
| 8376 | /* Append entries from tool_bar_item_properties to the end of | 8381 | /* Append entries from tool_bar_item_properties to the end of |
| 8377 | tool_bar_items_vector. */ | 8382 | tool_bar_items_vector. */ |
| @@ -8948,15 +8953,15 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 8948 | int fix_current_buffer) | 8953 | int fix_current_buffer) |
| 8949 | { | 8954 | { |
| 8950 | Lisp_Object from_string; | 8955 | Lisp_Object from_string; |
| 8951 | int count = SPECPDL_INDEX (); | 8956 | ptrdiff_t count = SPECPDL_INDEX (); |
| 8952 | 8957 | ||
| 8953 | /* How many keys there are in the current key sequence. */ | 8958 | /* How many keys there are in the current key sequence. */ |
| 8954 | int t; | 8959 | int t; |
| 8955 | 8960 | ||
| 8956 | /* The length of the echo buffer when we started reading, and | 8961 | /* The length of the echo buffer when we started reading, and |
| 8957 | the length of this_command_keys when we started reading. */ | 8962 | the length of this_command_keys when we started reading. */ |
| 8958 | int echo_start IF_LINT (= 0); | 8963 | ptrdiff_t echo_start IF_LINT (= 0); |
| 8959 | int keys_start; | 8964 | ptrdiff_t keys_start; |
| 8960 | 8965 | ||
| 8961 | /* The number of keymaps we're scanning right now, and the number of | 8966 | /* The number of keymaps we're scanning right now, and the number of |
| 8962 | keymaps we have allocated space for. */ | 8967 | keymaps we have allocated space for. */ |
| @@ -9212,7 +9217,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, | |||
| 9212 | while those allow us to restart the entire key sequence, | 9217 | while those allow us to restart the entire key sequence, |
| 9213 | echo_local_start and keys_local_start allow us to throw away | 9218 | echo_local_start and keys_local_start allow us to throw away |
| 9214 | just one key. */ | 9219 | just one key. */ |
| 9215 | int echo_local_start IF_LINT (= 0); | 9220 | ptrdiff_t echo_local_start IF_LINT (= 0); |
| 9216 | int keys_local_start; | 9221 | int keys_local_start; |
| 9217 | ptrdiff_t local_first_binding; | 9222 | ptrdiff_t local_first_binding; |
| 9218 | 9223 | ||
| @@ -10089,7 +10094,7 @@ will read just one key sequence. */) | |||
| 10089 | Lisp_Object keybuf[30]; | 10094 | Lisp_Object keybuf[30]; |
| 10090 | register int i; | 10095 | register int i; |
| 10091 | struct gcpro gcpro1; | 10096 | struct gcpro gcpro1; |
| 10092 | int count = SPECPDL_INDEX (); | 10097 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10093 | 10098 | ||
| 10094 | if (!NILP (prompt)) | 10099 | if (!NILP (prompt)) |
| 10095 | CHECK_STRING (prompt); | 10100 | CHECK_STRING (prompt); |
| @@ -10146,7 +10151,7 @@ DEFUN ("read-key-sequence-vector", Fread_key_sequence_vector, | |||
| 10146 | Lisp_Object keybuf[30]; | 10151 | Lisp_Object keybuf[30]; |
| 10147 | register int i; | 10152 | register int i; |
| 10148 | struct gcpro gcpro1; | 10153 | struct gcpro gcpro1; |
| 10149 | int count = SPECPDL_INDEX (); | 10154 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10150 | 10155 | ||
| 10151 | if (!NILP (prompt)) | 10156 | if (!NILP (prompt)) |
| 10152 | CHECK_STRING (prompt); | 10157 | CHECK_STRING (prompt); |
| @@ -10292,7 +10297,7 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 10292 | (Lisp_Object prefixarg) | 10297 | (Lisp_Object prefixarg) |
| 10293 | { | 10298 | { |
| 10294 | Lisp_Object function; | 10299 | Lisp_Object function; |
| 10295 | EMACS_INT saved_last_point_position; | 10300 | ptrdiff_t saved_last_point_position; |
| 10296 | Lisp_Object saved_keys, saved_last_point_position_buffer; | 10301 | Lisp_Object saved_keys, saved_last_point_position_buffer; |
| 10297 | Lisp_Object bindings, value; | 10302 | Lisp_Object bindings, value; |
| 10298 | struct gcpro gcpro1, gcpro2, gcpro3; | 10303 | struct gcpro gcpro1, gcpro2, gcpro3; |
| @@ -10386,7 +10391,7 @@ give to the command you invoke, if it asks for an argument. */) | |||
| 10386 | Lisp_Object binding; | 10391 | Lisp_Object binding; |
| 10387 | char *newmessage; | 10392 | char *newmessage; |
| 10388 | int message_p = push_message (); | 10393 | int message_p = push_message (); |
| 10389 | int count = SPECPDL_INDEX (); | 10394 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10390 | ptrdiff_t newmessage_len, newmessage_alloc; | 10395 | ptrdiff_t newmessage_len, newmessage_alloc; |
| 10391 | USE_SAFE_ALLOCA; | 10396 | USE_SAFE_ALLOCA; |
| 10392 | 10397 | ||
| @@ -10711,7 +10716,7 @@ Some operating systems cannot stop the Emacs process and resume it later. | |||
| 10711 | On such systems, Emacs starts a subshell instead of suspending. */) | 10716 | On such systems, Emacs starts a subshell instead of suspending. */) |
| 10712 | (Lisp_Object stuffstring) | 10717 | (Lisp_Object stuffstring) |
| 10713 | { | 10718 | { |
| 10714 | int count = SPECPDL_INDEX (); | 10719 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10715 | int old_height, old_width; | 10720 | int old_height, old_width; |
| 10716 | int width, height; | 10721 | int width, height; |
| 10717 | struct gcpro gcpro1; | 10722 | struct gcpro gcpro1; |
| @@ -10767,7 +10772,7 @@ stuff_buffered_input (Lisp_Object stuffstring) | |||
| 10767 | 10772 | ||
| 10768 | if (STRINGP (stuffstring)) | 10773 | if (STRINGP (stuffstring)) |
| 10769 | { | 10774 | { |
| 10770 | register EMACS_INT count; | 10775 | register ptrdiff_t count; |
| 10771 | 10776 | ||
| 10772 | p = SDATA (stuffstring); | 10777 | p = SDATA (stuffstring); |
| 10773 | count = SBYTES (stuffstring); | 10778 | count = SBYTES (stuffstring); |
diff --git a/src/keyboard.h b/src/keyboard.h index d4339d0529b..9f2be5b531b 100644 --- a/src/keyboard.h +++ b/src/keyboard.h | |||
| @@ -202,7 +202,7 @@ extern int poll_suppress_count; | |||
| 202 | sequence; this_command_key_count indicates how many elements | 202 | sequence; this_command_key_count indicates how many elements |
| 203 | actually mean something. */ | 203 | actually mean something. */ |
| 204 | extern Lisp_Object this_command_keys; | 204 | extern Lisp_Object this_command_keys; |
| 205 | extern int this_command_key_count; | 205 | extern ptrdiff_t this_command_key_count; |
| 206 | 206 | ||
| 207 | /* The frame in which the last input event occurred, or Qmacro if the | 207 | /* The frame in which the last input event occurred, or Qmacro if the |
| 208 | last event came from a macro. We use this to determine when to | 208 | last event came from a macro. We use this to determine when to |
| @@ -500,7 +500,7 @@ extern void poll_for_input_1 (void); | |||
| 500 | extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object, | 500 | extern void show_help_echo (Lisp_Object, Lisp_Object, Lisp_Object, |
| 501 | Lisp_Object); | 501 | Lisp_Object); |
| 502 | extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object, | 502 | extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object, |
| 503 | Lisp_Object, EMACS_INT); | 503 | Lisp_Object, ptrdiff_t); |
| 504 | extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); | 504 | extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); |
| 505 | extern Lisp_Object menu_item_eval_property (Lisp_Object); | 505 | extern Lisp_Object menu_item_eval_property (Lisp_Object); |
| 506 | extern int kbd_buffer_events_waiting (int); | 506 | extern int kbd_buffer_events_waiting (int); |
diff --git a/src/keymap.c b/src/keymap.c index 4485080db21..2d2f36d91c3 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -1117,12 +1117,12 @@ binding is altered. If there is no binding for KEY, the new pair | |||
| 1117 | binding KEY to DEF is added at the front of KEYMAP. */) | 1117 | binding KEY to DEF is added at the front of KEYMAP. */) |
| 1118 | (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) | 1118 | (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) |
| 1119 | { | 1119 | { |
| 1120 | register int idx; | 1120 | register ptrdiff_t idx; |
| 1121 | register Lisp_Object c; | 1121 | register Lisp_Object c; |
| 1122 | register Lisp_Object cmd; | 1122 | register Lisp_Object cmd; |
| 1123 | int metized = 0; | 1123 | int metized = 0; |
| 1124 | int meta_bit; | 1124 | int meta_bit; |
| 1125 | int length; | 1125 | ptrdiff_t length; |
| 1126 | struct gcpro gcpro1, gcpro2, gcpro3; | 1126 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 1127 | 1127 | ||
| 1128 | GCPRO3 (keymap, key, def); | 1128 | GCPRO3 (keymap, key, def); |
| @@ -1274,10 +1274,10 @@ third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will | |||
| 1274 | recognize the default bindings, just as `read-key-sequence' does. */) | 1274 | recognize the default bindings, just as `read-key-sequence' does. */) |
| 1275 | (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) | 1275 | (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) |
| 1276 | { | 1276 | { |
| 1277 | register int idx; | 1277 | register ptrdiff_t idx; |
| 1278 | register Lisp_Object cmd; | 1278 | register Lisp_Object cmd; |
| 1279 | register Lisp_Object c; | 1279 | register Lisp_Object c; |
| 1280 | int length; | 1280 | ptrdiff_t length; |
| 1281 | int t_ok = !NILP (accept_default); | 1281 | int t_ok = !NILP (accept_default); |
| 1282 | struct gcpro gcpro1, gcpro2; | 1282 | struct gcpro gcpro1, gcpro2; |
| 1283 | 1283 | ||
| @@ -1527,6 +1527,19 @@ current_minor_maps (Lisp_Object **modeptr, Lisp_Object **mapptr) | |||
| 1527 | return i; | 1527 | return i; |
| 1528 | } | 1528 | } |
| 1529 | 1529 | ||
| 1530 | /* Return the offset of POSITION, a click position, in the style of | ||
| 1531 | the respective argument of Fkey_binding. */ | ||
| 1532 | static ptrdiff_t | ||
| 1533 | click_position (Lisp_Object position) | ||
| 1534 | { | ||
| 1535 | EMACS_INT pos = (INTEGERP (position) ? XINT (position) | ||
| 1536 | : MARKERP (position) ? marker_position (position) | ||
| 1537 | : PT); | ||
| 1538 | if (! (BEGV <= pos && pos <= ZV)) | ||
| 1539 | args_out_of_range (Fcurrent_buffer (), position); | ||
| 1540 | return pos; | ||
| 1541 | } | ||
| 1542 | |||
| 1530 | DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps, | 1543 | DEFUN ("current-active-maps", Fcurrent_active_maps, Scurrent_active_maps, |
| 1531 | 0, 2, 0, | 1544 | 0, 2, 0, |
| 1532 | doc: /* Return a list of the currently active keymaps. | 1545 | doc: /* Return a list of the currently active keymaps. |
| @@ -1535,7 +1548,7 @@ OLP if non-nil indicates that we should obey `overriding-local-map' and | |||
| 1535 | like in the respective argument of `key-binding'. */) | 1548 | like in the respective argument of `key-binding'. */) |
| 1536 | (Lisp_Object olp, Lisp_Object position) | 1549 | (Lisp_Object olp, Lisp_Object position) |
| 1537 | { | 1550 | { |
| 1538 | int count = SPECPDL_INDEX (); | 1551 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1539 | 1552 | ||
| 1540 | Lisp_Object keymaps = Fcons (current_global_map, Qnil); | 1553 | Lisp_Object keymaps = Fcons (current_global_map, Qnil); |
| 1541 | 1554 | ||
| @@ -1582,10 +1595,7 @@ like in the respective argument of `key-binding'. */) | |||
| 1582 | { | 1595 | { |
| 1583 | Lisp_Object *maps; | 1596 | Lisp_Object *maps; |
| 1584 | int nmaps, i; | 1597 | int nmaps, i; |
| 1585 | EMACS_INT pt | 1598 | ptrdiff_t pt = click_position (position); |
| 1586 | = INTEGERP (position) ? XINT (position) | ||
| 1587 | : MARKERP (position) ? marker_position (position) | ||
| 1588 | : PT; | ||
| 1589 | /* This usually returns the buffer's local map, | 1599 | /* This usually returns the buffer's local map, |
| 1590 | but that can be overridden by a `local-map' property. */ | 1600 | but that can be overridden by a `local-map' property. */ |
| 1591 | Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); | 1601 | Lisp_Object local_map = get_local_map (pt, current_buffer, Qlocal_map); |
| @@ -1904,10 +1914,10 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void * | |||
| 1904 | while (!NILP (tem = Frassq (cmd, maps))) | 1914 | while (!NILP (tem = Frassq (cmd, maps))) |
| 1905 | { | 1915 | { |
| 1906 | Lisp_Object prefix = XCAR (tem); | 1916 | Lisp_Object prefix = XCAR (tem); |
| 1907 | int lim = XINT (Flength (XCAR (tem))); | 1917 | ptrdiff_t lim = XINT (Flength (XCAR (tem))); |
| 1908 | if (lim <= XINT (Flength (thisseq))) | 1918 | if (lim <= XINT (Flength (thisseq))) |
| 1909 | { /* This keymap was already seen with a smaller prefix. */ | 1919 | { /* This keymap was already seen with a smaller prefix. */ |
| 1910 | int i = 0; | 1920 | ptrdiff_t i = 0; |
| 1911 | while (i < lim && EQ (Faref (prefix, make_number (i)), | 1921 | while (i < lim && EQ (Faref (prefix, make_number (i)), |
| 1912 | Faref (thisseq, make_number (i)))) | 1922 | Faref (thisseq, make_number (i)))) |
| 1913 | i++; | 1923 | i++; |
| @@ -1960,7 +1970,7 @@ then the value includes only maps for prefixes that start with PREFIX. */) | |||
| 1960 | (Lisp_Object keymap, Lisp_Object prefix) | 1970 | (Lisp_Object keymap, Lisp_Object prefix) |
| 1961 | { | 1971 | { |
| 1962 | Lisp_Object maps, tail; | 1972 | Lisp_Object maps, tail; |
| 1963 | int prefixlen = XINT (Flength (prefix)); | 1973 | EMACS_INT prefixlen = XFASTINT (Flength (prefix)); |
| 1964 | 1974 | ||
| 1965 | /* no need for gcpro because we don't autoload any keymaps. */ | 1975 | /* no need for gcpro because we don't autoload any keymaps. */ |
| 1966 | 1976 | ||
| @@ -2047,20 +2057,25 @@ Control characters turn into "C-foo" sequences, meta into "M-foo", | |||
| 2047 | spaces are put between sequence elements, etc. */) | 2057 | spaces are put between sequence elements, etc. */) |
| 2048 | (Lisp_Object keys, Lisp_Object prefix) | 2058 | (Lisp_Object keys, Lisp_Object prefix) |
| 2049 | { | 2059 | { |
| 2050 | int len = 0; | 2060 | ptrdiff_t len = 0; |
| 2051 | int i, i_byte; | 2061 | EMACS_INT i; |
| 2062 | ptrdiff_t i_byte; | ||
| 2052 | Lisp_Object *args; | 2063 | Lisp_Object *args; |
| 2053 | int size = XINT (Flength (keys)); | 2064 | EMACS_INT size = XINT (Flength (keys)); |
| 2054 | Lisp_Object list; | 2065 | Lisp_Object list; |
| 2055 | Lisp_Object sep = build_string (" "); | 2066 | Lisp_Object sep = build_string (" "); |
| 2056 | Lisp_Object key; | 2067 | Lisp_Object key; |
| 2068 | Lisp_Object result; | ||
| 2057 | int add_meta = 0; | 2069 | int add_meta = 0; |
| 2070 | USE_SAFE_ALLOCA; | ||
| 2058 | 2071 | ||
| 2059 | if (!NILP (prefix)) | 2072 | if (!NILP (prefix)) |
| 2060 | size += XINT (Flength (prefix)); | 2073 | size += XINT (Flength (prefix)); |
| 2061 | 2074 | ||
| 2062 | /* This has one extra element at the end that we don't pass to Fconcat. */ | 2075 | /* This has one extra element at the end that we don't pass to Fconcat. */ |
| 2063 | args = (Lisp_Object *) alloca (size * 4 * sizeof (Lisp_Object)); | 2076 | if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) / 4 < size) |
| 2077 | memory_full (SIZE_MAX); | ||
| 2078 | SAFE_ALLOCA_LISP (args, size * 4); | ||
| 2064 | 2079 | ||
| 2065 | /* In effect, this computes | 2080 | /* In effect, this computes |
| 2066 | (mapconcat 'single-key-description keys " ") | 2081 | (mapconcat 'single-key-description keys " ") |
| @@ -2078,9 +2093,9 @@ spaces are put between sequence elements, etc. */) | |||
| 2078 | args[len] = Fsingle_key_description (meta_prefix_char, Qnil); | 2093 | args[len] = Fsingle_key_description (meta_prefix_char, Qnil); |
| 2079 | len += 2; | 2094 | len += 2; |
| 2080 | } | 2095 | } |
| 2081 | else if (len == 0) | 2096 | result = len == 0 ? empty_unibyte_string : Fconcat (len - 1, args); |
| 2082 | return empty_unibyte_string; | 2097 | SAFE_FREE (); |
| 2083 | return Fconcat (len - 1, args); | 2098 | return result; |
| 2084 | } | 2099 | } |
| 2085 | 2100 | ||
| 2086 | if (STRINGP (list)) | 2101 | if (STRINGP (list)) |
| @@ -2342,7 +2357,7 @@ See Info node `(elisp)Describing Characters' for examples. */) | |||
| 2342 | char str[6]; | 2357 | char str[6]; |
| 2343 | int c; | 2358 | int c; |
| 2344 | 2359 | ||
| 2345 | CHECK_NUMBER (character); | 2360 | CHECK_CHARACTER (character); |
| 2346 | 2361 | ||
| 2347 | c = XINT (character); | 2362 | c = XINT (character); |
| 2348 | if (!ASCII_CHAR_P (c)) | 2363 | if (!ASCII_CHAR_P (c)) |
| @@ -2365,8 +2380,8 @@ static int where_is_preferred_modifier; | |||
| 2365 | static int | 2380 | static int |
| 2366 | preferred_sequence_p (Lisp_Object seq) | 2381 | preferred_sequence_p (Lisp_Object seq) |
| 2367 | { | 2382 | { |
| 2368 | int i; | 2383 | EMACS_INT i; |
| 2369 | int len = XINT (Flength (seq)); | 2384 | EMACS_INT len = XFASTINT (Flength (seq)); |
| 2370 | int result = 1; | 2385 | int result = 1; |
| 2371 | 2386 | ||
| 2372 | for (i = 0; i < len; i++) | 2387 | for (i = 0; i < len; i++) |
| @@ -3083,7 +3098,7 @@ static void | |||
| 3083 | describe_command (Lisp_Object definition, Lisp_Object args) | 3098 | describe_command (Lisp_Object definition, Lisp_Object args) |
| 3084 | { | 3099 | { |
| 3085 | register Lisp_Object tem1; | 3100 | register Lisp_Object tem1; |
| 3086 | EMACS_INT column = current_column (); | 3101 | ptrdiff_t column = current_column (); |
| 3087 | int description_column; | 3102 | int description_column; |
| 3088 | 3103 | ||
| 3089 | /* If column 16 is no good, go to col 32; | 3104 | /* If column 16 is no good, go to col 32; |
| @@ -3366,7 +3381,7 @@ This is text showing the elements of vector matched against indices. | |||
| 3366 | DESCRIBER is the output function used; nil means use `princ'. */) | 3381 | DESCRIBER is the output function used; nil means use `princ'. */) |
| 3367 | (Lisp_Object vector, Lisp_Object describer) | 3382 | (Lisp_Object vector, Lisp_Object describer) |
| 3368 | { | 3383 | { |
| 3369 | int count = SPECPDL_INDEX (); | 3384 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3370 | if (NILP (describer)) | 3385 | if (NILP (describer)) |
| 3371 | describer = intern ("princ"); | 3386 | describer = intern ("princ"); |
| 3372 | specbind (Qstandard_output, Fcurrent_buffer ()); | 3387 | specbind (Qstandard_output, Fcurrent_buffer ()); |
diff --git a/src/lisp.h b/src/lisp.h index e9a525a32b5..ed8eb2720b5 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -372,14 +372,13 @@ typedef EMACS_INT Lisp_Object; | |||
| 372 | #define LISP_MAKE_RVALUE(o) (0+(o)) | 372 | #define LISP_MAKE_RVALUE(o) (0+(o)) |
| 373 | #endif /* USE_LISP_UNION_TYPE */ | 373 | #endif /* USE_LISP_UNION_TYPE */ |
| 374 | 374 | ||
| 375 | /* In the size word of a vector, this bit means the vector has been marked. | 375 | /* In the size word of a vector, this bit means the vector has been marked. */ |
| 376 | (Shift -1 left, not 1, to avoid provoking overflow diagnostics.) */ | ||
| 377 | 376 | ||
| 378 | #define ARRAY_MARK_FLAG ((EMACS_INT) -1 << (BITS_PER_EMACS_INT - 1)) | 377 | #define ARRAY_MARK_FLAG PTRDIFF_MIN |
| 379 | 378 | ||
| 380 | /* In the size word of a struct Lisp_Vector, this bit means it's really | 379 | /* In the size word of a struct Lisp_Vector, this bit means it's really |
| 381 | some other vector-like object. */ | 380 | some other vector-like object. */ |
| 382 | #define PSEUDOVECTOR_FLAG ((EMACS_INT) 1 << (BITS_PER_EMACS_INT - 2)) | 381 | #define PSEUDOVECTOR_FLAG (PTRDIFF_MAX - PTRDIFF_MAX / 2) |
| 383 | 382 | ||
| 384 | /* In a pseudovector, the size field actually contains a word with one | 383 | /* In a pseudovector, the size field actually contains a word with one |
| 385 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to | 384 | PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to |
| @@ -582,6 +581,12 @@ extern Lisp_Object make_number (EMACS_INT); | |||
| 582 | #define FIXNUM_OVERFLOW_P(i) \ | 581 | #define FIXNUM_OVERFLOW_P(i) \ |
| 583 | (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) | 582 | (! ((0 <= (i) || MOST_NEGATIVE_FIXNUM <= (i)) && (i) <= MOST_POSITIVE_FIXNUM)) |
| 584 | 583 | ||
| 584 | static inline ptrdiff_t | ||
| 585 | clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) | ||
| 586 | { | ||
| 587 | return num < lower ? lower : num <= upper ? num : upper; | ||
| 588 | } | ||
| 589 | |||
| 585 | /* Extract a value or address from a Lisp_Object. */ | 590 | /* Extract a value or address from a Lisp_Object. */ |
| 586 | 591 | ||
| 587 | #define XCONS(a) (eassert (CONSP (a)), (struct Lisp_Cons *) XPNTR (a)) | 592 | #define XCONS(a) (eassert (CONSP (a)), (struct Lisp_Cons *) XPNTR (a)) |
| @@ -659,8 +664,7 @@ extern Lisp_Object make_number (EMACS_INT); | |||
| 659 | #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) | 664 | #define XSETWINDOW(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_WINDOW)) |
| 660 | #define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) | 665 | #define XSETTERMINAL(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_TERMINAL)) |
| 661 | /* XSETSUBR is special since Lisp_Subr lacks struct vectorlike_header. */ | 666 | /* XSETSUBR is special since Lisp_Subr lacks struct vectorlike_header. */ |
| 662 | #define XSETSUBR(a, b) \ | 667 | #define XSETSUBR(a, b) XSETTYPED_PSEUDOVECTOR (a, b, 0, PVEC_SUBR) |
| 663 | XSETTYPED_PSEUDOVECTOR (a, b, XSUBR (a)->size, PVEC_SUBR) | ||
| 664 | #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) | 668 | #define XSETCOMPILED(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_COMPILED)) |
| 665 | #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) | 669 | #define XSETBUFFER(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_BUFFER)) |
| 666 | #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) | 670 | #define XSETCHAR_TABLE(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_CHAR_TABLE)) |
| @@ -788,7 +792,7 @@ struct Lisp_Cons | |||
| 788 | #ifdef GC_CHECK_STRING_BYTES | 792 | #ifdef GC_CHECK_STRING_BYTES |
| 789 | 793 | ||
| 790 | struct Lisp_String; | 794 | struct Lisp_String; |
| 791 | extern EMACS_INT string_bytes (struct Lisp_String *); | 795 | extern ptrdiff_t string_bytes (struct Lisp_String *); |
| 792 | #define STRING_BYTES(S) string_bytes ((S)) | 796 | #define STRING_BYTES(S) string_bytes ((S)) |
| 793 | 797 | ||
| 794 | #else /* not GC_CHECK_STRING_BYTES */ | 798 | #else /* not GC_CHECK_STRING_BYTES */ |
| @@ -835,8 +839,8 @@ extern EMACS_INT string_bytes (struct Lisp_String *); | |||
| 835 | 839 | ||
| 836 | struct Lisp_String | 840 | struct Lisp_String |
| 837 | { | 841 | { |
| 838 | EMACS_INT size; | 842 | ptrdiff_t size; |
| 839 | EMACS_INT size_byte; | 843 | ptrdiff_t size_byte; |
| 840 | INTERVAL intervals; /* text properties in this string */ | 844 | INTERVAL intervals; /* text properties in this string */ |
| 841 | unsigned char *data; | 845 | unsigned char *data; |
| 842 | }; | 846 | }; |
| @@ -850,7 +854,7 @@ struct Lisp_String | |||
| 850 | <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8546>. */ | 854 | <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8546>. */ |
| 851 | struct vectorlike_header | 855 | struct vectorlike_header |
| 852 | { | 856 | { |
| 853 | EMACS_INT size; | 857 | ptrdiff_t size; |
| 854 | 858 | ||
| 855 | /* Pointer to the next vector-like object. It is generally a buffer or a | 859 | /* Pointer to the next vector-like object. It is generally a buffer or a |
| 856 | Lisp_Vector alias, so for convenience it is a union instead of a | 860 | Lisp_Vector alias, so for convenience it is a union instead of a |
| @@ -1045,7 +1049,7 @@ struct Lisp_Bool_Vector | |||
| 1045 | 1049 | ||
| 1046 | struct Lisp_Subr | 1050 | struct Lisp_Subr |
| 1047 | { | 1051 | { |
| 1048 | EMACS_INT size; | 1052 | ptrdiff_t size; |
| 1049 | union { | 1053 | union { |
| 1050 | Lisp_Object (*a0) (void); | 1054 | Lisp_Object (*a0) (void); |
| 1051 | Lisp_Object (*a1) (Lisp_Object); | 1055 | Lisp_Object (*a1) (Lisp_Object); |
| @@ -1238,7 +1242,7 @@ struct Lisp_Hash_Table | |||
| 1238 | a special way (e.g. because of weakness). */ | 1242 | a special way (e.g. because of weakness). */ |
| 1239 | 1243 | ||
| 1240 | /* Number of key/value entries in the table. */ | 1244 | /* Number of key/value entries in the table. */ |
| 1241 | EMACS_INT count; | 1245 | ptrdiff_t count; |
| 1242 | 1246 | ||
| 1243 | /* Vector of keys and values. The key of item I is found at index | 1247 | /* Vector of keys and values. The key of item I is found at index |
| 1244 | 2 * I, the value is found at index 2 * I + 1. | 1248 | 2 * I, the value is found at index 2 * I + 1. |
| @@ -1355,12 +1359,12 @@ struct Lisp_Marker | |||
| 1355 | That would also allow to preserve it ordered. */ | 1359 | That would also allow to preserve it ordered. */ |
| 1356 | struct Lisp_Marker *next; | 1360 | struct Lisp_Marker *next; |
| 1357 | /* This is the char position where the marker points. */ | 1361 | /* This is the char position where the marker points. */ |
| 1358 | EMACS_INT charpos; | 1362 | ptrdiff_t charpos; |
| 1359 | /* This is the byte position. | 1363 | /* This is the byte position. |
| 1360 | It's mostly used as a charpos<->bytepos cache (i.e. it's not directly | 1364 | It's mostly used as a charpos<->bytepos cache (i.e. it's not directly |
| 1361 | used to implement the functionality of markers, but rather to (ab)use | 1365 | used to implement the functionality of markers, but rather to (ab)use |
| 1362 | markers as a cache for char<->byte mappings). */ | 1366 | markers as a cache for char<->byte mappings). */ |
| 1363 | EMACS_INT bytepos; | 1367 | ptrdiff_t bytepos; |
| 1364 | }; | 1368 | }; |
| 1365 | 1369 | ||
| 1366 | /* Forwarding pointer to an int variable. | 1370 | /* Forwarding pointer to an int variable. |
| @@ -1626,18 +1630,24 @@ typedef struct { | |||
| 1626 | encodes a char code in the lower CHARACTERBITS bits and a (very small) | 1630 | encodes a char code in the lower CHARACTERBITS bits and a (very small) |
| 1627 | face-id in the upper bits, or it may be a cons (CHAR . FACE-ID). */ | 1631 | face-id in the upper bits, or it may be a cons (CHAR . FACE-ID). */ |
| 1628 | 1632 | ||
| 1629 | #define GLYPH_CODE_CHAR(gc) \ | 1633 | #define GLYPH_CODE_P(gc) \ |
| 1630 | (CONSP (gc) ? XINT (XCAR (gc)) : INTEGERP (gc) ? (XINT (gc) & ((1 << CHARACTERBITS)-1)) : 0) | 1634 | (CONSP (gc) \ |
| 1635 | ? (CHARACTERP (XCAR (gc)) \ | ||
| 1636 | && RANGED_INTEGERP (0, XCDR (gc), MAX_FACE_ID)) \ | ||
| 1637 | : (RANGED_INTEGERP \ | ||
| 1638 | (0, gc, \ | ||
| 1639 | (MAX_FACE_ID < TYPE_MAXIMUM (EMACS_INT) >> CHARACTERBITS \ | ||
| 1640 | ? ((EMACS_INT) MAX_FACE_ID << CHARACTERBITS) | MAX_CHAR \ | ||
| 1641 | : TYPE_MAXIMUM (EMACS_INT))))) | ||
| 1631 | 1642 | ||
| 1632 | #define GLYPH_CODE_FACE(gc) \ | 1643 | /* The following are valid only if GLYPH_CODE_P (gc). */ |
| 1633 | (CONSP (gc) ? XINT (XCDR (gc)) : INTEGERP (gc) ? (XINT (gc) >> CHARACTERBITS) : DEFAULT_FACE_ID) | ||
| 1634 | 1644 | ||
| 1635 | /* Return 1 if glyph code from display vector contains valid character code. */ | 1645 | #define GLYPH_CODE_CHAR(gc) \ |
| 1636 | #define GLYPH_CODE_CHAR_VALID_P(gc) CHAR_VALID_P (GLYPH_CODE_CHAR (gc)) | 1646 | (CONSP (gc) ? XINT (XCAR (gc)) : XINT (gc) & ((1 << CHARACTERBITS) - 1)) |
| 1637 | 1647 | ||
| 1638 | #define GLYPH_CODE_P(gc) ((CONSP (gc) && INTEGERP (XCAR (gc)) && INTEGERP (XCDR (gc))) || INTEGERP (gc)) | 1648 | #define GLYPH_CODE_FACE(gc) \ |
| 1649 | (CONSP (gc) ? XINT (XCDR (gc)) : XINT (gc) >> CHARACTERBITS) | ||
| 1639 | 1650 | ||
| 1640 | /* Only called when GLYPH_CODE_P (gc) is true. */ | ||
| 1641 | #define SET_GLYPH_FROM_GLYPH_CODE(glyph, gc) \ | 1651 | #define SET_GLYPH_FROM_GLYPH_CODE(glyph, gc) \ |
| 1642 | do \ | 1652 | do \ |
| 1643 | { \ | 1653 | { \ |
| @@ -1697,7 +1707,9 @@ typedef struct { | |||
| 1697 | #define RANGED_INTEGERP(lo, x, hi) \ | 1707 | #define RANGED_INTEGERP(lo, x, hi) \ |
| 1698 | (INTEGERP (x) && (lo) <= XINT (x) && XINT (x) <= (hi)) | 1708 | (INTEGERP (x) && (lo) <= XINT (x) && XINT (x) <= (hi)) |
| 1699 | #define TYPE_RANGED_INTEGERP(type, x) \ | 1709 | #define TYPE_RANGED_INTEGERP(type, x) \ |
| 1700 | RANGED_INTEGERP (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type)) | 1710 | (TYPE_SIGNED (type) \ |
| 1711 | ? RANGED_INTEGERP (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type)) \ | ||
| 1712 | : RANGED_INTEGERP (0, x, TYPE_MAXIMUM (type))) | ||
| 1701 | 1713 | ||
| 1702 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) | 1714 | #define INTEGERP(x) (LISP_INT_TAG_P (XTYPE ((x)))) |
| 1703 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) | 1715 | #define SYMBOLP(x) (XTYPE ((x)) == Lisp_Symbol) |
| @@ -1820,6 +1832,25 @@ typedef struct { | |||
| 1820 | #define CHECK_NATNUM(x) \ | 1832 | #define CHECK_NATNUM(x) \ |
| 1821 | CHECK_TYPE (NATNUMP (x), Qwholenump, x) | 1833 | CHECK_TYPE (NATNUMP (x), Qwholenump, x) |
| 1822 | 1834 | ||
| 1835 | #define CHECK_RANGED_INTEGER(lo, x, hi) \ | ||
| 1836 | do { \ | ||
| 1837 | CHECK_NUMBER (x); \ | ||
| 1838 | if (! ((lo) <= XINT (x) && XINT (x) <= (hi))) \ | ||
| 1839 | args_out_of_range_3 \ | ||
| 1840 | (x, \ | ||
| 1841 | make_number ((lo) < 0 && (lo) < MOST_NEGATIVE_FIXNUM \ | ||
| 1842 | ? MOST_NEGATIVE_FIXNUM \ | ||
| 1843 | : (lo)), \ | ||
| 1844 | make_number (min (hi, MOST_POSITIVE_FIXNUM))); \ | ||
| 1845 | } while (0) | ||
| 1846 | #define CHECK_TYPE_RANGED_INTEGER(type, x) \ | ||
| 1847 | do { \ | ||
| 1848 | if (TYPE_SIGNED (type)) \ | ||
| 1849 | CHECK_RANGED_INTEGER (TYPE_MINIMUM (type), x, TYPE_MAXIMUM (type)); \ | ||
| 1850 | else \ | ||
| 1851 | CHECK_RANGED_INTEGER (0, x, TYPE_MAXIMUM (type)); \ | ||
| 1852 | } while (0) | ||
| 1853 | |||
| 1823 | #define CHECK_MARKER(x) \ | 1854 | #define CHECK_MARKER(x) \ |
| 1824 | CHECK_TYPE (MARKERP (x), Qmarkerp, x) | 1855 | CHECK_TYPE (MARKERP (x), Qmarkerp, x) |
| 1825 | 1856 | ||
| @@ -2031,9 +2062,9 @@ struct specbinding | |||
| 2031 | 2062 | ||
| 2032 | extern struct specbinding *specpdl; | 2063 | extern struct specbinding *specpdl; |
| 2033 | extern struct specbinding *specpdl_ptr; | 2064 | extern struct specbinding *specpdl_ptr; |
| 2034 | extern EMACS_INT specpdl_size; | 2065 | extern ptrdiff_t specpdl_size; |
| 2035 | 2066 | ||
| 2036 | #define SPECPDL_INDEX() ((int) (specpdl_ptr - specpdl)) | 2067 | #define SPECPDL_INDEX() (specpdl_ptr - specpdl) |
| 2037 | 2068 | ||
| 2038 | /* Everything needed to describe an active condition case. */ | 2069 | /* Everything needed to describe an active condition case. */ |
| 2039 | struct handler | 2070 | struct handler |
| @@ -2086,8 +2117,8 @@ struct catchtag | |||
| 2086 | jmp_buf jmp; | 2117 | jmp_buf jmp; |
| 2087 | struct backtrace *backlist; | 2118 | struct backtrace *backlist; |
| 2088 | struct handler *handlerlist; | 2119 | struct handler *handlerlist; |
| 2089 | int lisp_eval_depth; | 2120 | EMACS_INT lisp_eval_depth; |
| 2090 | int pdlcount; | 2121 | ptrdiff_t pdlcount; |
| 2091 | int poll_suppress_count; | 2122 | int poll_suppress_count; |
| 2092 | int interrupt_input_blocked; | 2123 | int interrupt_input_blocked; |
| 2093 | struct byte_stack *byte_stack; | 2124 | struct byte_stack *byte_stack; |
| @@ -2511,8 +2542,8 @@ EXFUN (Fread_coding_system, 2); | |||
| 2511 | EXFUN (Fread_non_nil_coding_system, 1); | 2542 | EXFUN (Fread_non_nil_coding_system, 1); |
| 2512 | EXFUN (Ffind_operation_coding_system, MANY); | 2543 | EXFUN (Ffind_operation_coding_system, MANY); |
| 2513 | EXFUN (Fdecode_coding_string, 4); | 2544 | EXFUN (Fdecode_coding_string, 4); |
| 2514 | extern Lisp_Object detect_coding_system (const unsigned char *, EMACS_INT, | 2545 | extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t, |
| 2515 | EMACS_INT, int, int, Lisp_Object); | 2546 | ptrdiff_t, int, int, Lisp_Object); |
| 2516 | extern void init_coding (void); | 2547 | extern void init_coding (void); |
| 2517 | extern void init_coding_once (void); | 2548 | extern void init_coding_once (void); |
| 2518 | extern void syms_of_coding (void); | 2549 | extern void syms_of_coding (void); |
| @@ -2520,8 +2551,8 @@ extern void syms_of_coding (void); | |||
| 2520 | /* Defined in character.c */ | 2551 | /* Defined in character.c */ |
| 2521 | EXFUN (Fchar_width, 1); | 2552 | EXFUN (Fchar_width, 1); |
| 2522 | EXFUN (Fstring, MANY); | 2553 | EXFUN (Fstring, MANY); |
| 2523 | extern EMACS_INT chars_in_text (const unsigned char *, EMACS_INT); | 2554 | extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t); |
| 2524 | extern EMACS_INT multibyte_chars_in_text (const unsigned char *, EMACS_INT); | 2555 | extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); |
| 2525 | extern int multibyte_char_to_unibyte (int); | 2556 | extern int multibyte_char_to_unibyte (int); |
| 2526 | extern int multibyte_char_to_unibyte_safe (int); | 2557 | extern int multibyte_char_to_unibyte_safe (int); |
| 2527 | extern void init_character_once (void); | 2558 | extern void init_character_once (void); |
| @@ -2548,7 +2579,7 @@ extern void syms_of_syntax (void); | |||
| 2548 | extern Lisp_Object QCrehash_size, QCrehash_threshold; | 2579 | extern Lisp_Object QCrehash_size, QCrehash_threshold; |
| 2549 | enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; | 2580 | enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; |
| 2550 | extern EMACS_INT next_almost_prime (EMACS_INT); | 2581 | extern EMACS_INT next_almost_prime (EMACS_INT); |
| 2551 | extern Lisp_Object larger_vector (Lisp_Object, EMACS_INT, Lisp_Object); | 2582 | extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 2552 | extern void sweep_weak_hash_tables (void); | 2583 | extern void sweep_weak_hash_tables (void); |
| 2553 | extern Lisp_Object Qcursor_in_echo_area; | 2584 | extern Lisp_Object Qcursor_in_echo_area; |
| 2554 | extern Lisp_Object Qstring_lessp; | 2585 | extern Lisp_Object Qstring_lessp; |
| @@ -2580,8 +2611,8 @@ EXFUN (Fstring_as_multibyte, 1); | |||
| 2580 | EXFUN (Fstring_as_unibyte, 1); | 2611 | EXFUN (Fstring_as_unibyte, 1); |
| 2581 | EXFUN (Fstring_to_multibyte, 1); | 2612 | EXFUN (Fstring_to_multibyte, 1); |
| 2582 | EXFUN (Fsubstring, 3); | 2613 | EXFUN (Fsubstring, 3); |
| 2583 | extern Lisp_Object substring_both (Lisp_Object, EMACS_INT, EMACS_INT, | 2614 | extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 2584 | EMACS_INT, EMACS_INT); | 2615 | ptrdiff_t, ptrdiff_t); |
| 2585 | EXFUN (Fnth, 2); | 2616 | EXFUN (Fnth, 2); |
| 2586 | EXFUN (Fnthcdr, 2); | 2617 | EXFUN (Fnthcdr, 2); |
| 2587 | EXFUN (Fmemq, 2); | 2618 | EXFUN (Fmemq, 2); |
| @@ -2609,8 +2640,8 @@ extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object); | |||
| 2609 | extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); | 2640 | extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object); |
| 2610 | extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); | 2641 | extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object); |
| 2611 | extern void clear_string_char_byte_cache (void); | 2642 | extern void clear_string_char_byte_cache (void); |
| 2612 | extern EMACS_INT string_char_to_byte (Lisp_Object, EMACS_INT); | 2643 | extern ptrdiff_t string_char_to_byte (Lisp_Object, ptrdiff_t); |
| 2613 | extern EMACS_INT string_byte_to_char (Lisp_Object, EMACS_INT); | 2644 | extern ptrdiff_t string_byte_to_char (Lisp_Object, ptrdiff_t); |
| 2614 | extern Lisp_Object string_to_multibyte (Lisp_Object); | 2645 | extern Lisp_Object string_to_multibyte (Lisp_Object); |
| 2615 | extern Lisp_Object string_make_unibyte (Lisp_Object); | 2646 | extern Lisp_Object string_make_unibyte (Lisp_Object); |
| 2616 | EXFUN (Fcopy_alist, 1); | 2647 | EXFUN (Fcopy_alist, 1); |
| @@ -2648,48 +2679,48 @@ extern void init_image (void); | |||
| 2648 | 2679 | ||
| 2649 | /* Defined in insdel.c */ | 2680 | /* Defined in insdel.c */ |
| 2650 | extern Lisp_Object Qinhibit_modification_hooks; | 2681 | extern Lisp_Object Qinhibit_modification_hooks; |
| 2651 | extern void move_gap (EMACS_INT); | 2682 | extern void move_gap (ptrdiff_t); |
| 2652 | extern void move_gap_both (EMACS_INT, EMACS_INT); | 2683 | extern void move_gap_both (ptrdiff_t, ptrdiff_t); |
| 2653 | extern void buffer_overflow (void) NO_RETURN; | 2684 | extern void buffer_overflow (void) NO_RETURN; |
| 2654 | extern void make_gap (EMACS_INT); | 2685 | extern void make_gap (ptrdiff_t); |
| 2655 | extern EMACS_INT copy_text (const unsigned char *, unsigned char *, | 2686 | extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, |
| 2656 | EMACS_INT, int, int); | 2687 | ptrdiff_t, int, int); |
| 2657 | extern int count_combining_before (const unsigned char *, | 2688 | extern int count_combining_before (const unsigned char *, |
| 2658 | EMACS_INT, EMACS_INT, EMACS_INT); | 2689 | ptrdiff_t, ptrdiff_t, ptrdiff_t); |
| 2659 | extern int count_combining_after (const unsigned char *, | 2690 | extern int count_combining_after (const unsigned char *, |
| 2660 | EMACS_INT, EMACS_INT, EMACS_INT); | 2691 | ptrdiff_t, ptrdiff_t, ptrdiff_t); |
| 2661 | extern void insert (const char *, EMACS_INT); | 2692 | extern void insert (const char *, ptrdiff_t); |
| 2662 | extern void insert_and_inherit (const char *, EMACS_INT); | 2693 | extern void insert_and_inherit (const char *, ptrdiff_t); |
| 2663 | extern void insert_1 (const char *, EMACS_INT, int, int, int); | 2694 | extern void insert_1 (const char *, ptrdiff_t, int, int, int); |
| 2664 | extern void insert_1_both (const char *, EMACS_INT, EMACS_INT, | 2695 | extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t, |
| 2665 | int, int, int); | 2696 | int, int, int); |
| 2666 | extern void insert_from_gap (EMACS_INT, EMACS_INT); | 2697 | extern void insert_from_gap (ptrdiff_t, ptrdiff_t); |
| 2667 | extern void insert_from_string (Lisp_Object, EMACS_INT, EMACS_INT, | 2698 | extern void insert_from_string (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 2668 | EMACS_INT, EMACS_INT, int); | 2699 | ptrdiff_t, ptrdiff_t, int); |
| 2669 | extern void insert_from_buffer (struct buffer *, EMACS_INT, EMACS_INT, int); | 2700 | extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, int); |
| 2670 | extern void insert_char (int); | 2701 | extern void insert_char (int); |
| 2671 | extern void insert_string (const char *); | 2702 | extern void insert_string (const char *); |
| 2672 | extern void insert_before_markers (const char *, EMACS_INT); | 2703 | extern void insert_before_markers (const char *, ptrdiff_t); |
| 2673 | extern void insert_before_markers_and_inherit (const char *, EMACS_INT); | 2704 | extern void insert_before_markers_and_inherit (const char *, ptrdiff_t); |
| 2674 | extern void insert_from_string_before_markers (Lisp_Object, EMACS_INT, | 2705 | extern void insert_from_string_before_markers (Lisp_Object, ptrdiff_t, |
| 2675 | EMACS_INT, EMACS_INT, | 2706 | ptrdiff_t, ptrdiff_t, |
| 2676 | EMACS_INT, int); | 2707 | ptrdiff_t, int); |
| 2677 | extern void del_range (EMACS_INT, EMACS_INT); | 2708 | extern void del_range (ptrdiff_t, ptrdiff_t); |
| 2678 | extern Lisp_Object del_range_1 (EMACS_INT, EMACS_INT, int, int); | 2709 | extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, int, int); |
| 2679 | extern void del_range_byte (EMACS_INT, EMACS_INT, int); | 2710 | extern void del_range_byte (ptrdiff_t, ptrdiff_t, int); |
| 2680 | extern void del_range_both (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, int); | 2711 | extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, int); |
| 2681 | extern Lisp_Object del_range_2 (EMACS_INT, EMACS_INT, | 2712 | extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t, |
| 2682 | EMACS_INT, EMACS_INT, int); | 2713 | ptrdiff_t, ptrdiff_t, int); |
| 2683 | extern void modify_region (struct buffer *, EMACS_INT, EMACS_INT, int); | 2714 | extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, int); |
| 2684 | extern void prepare_to_modify_buffer (EMACS_INT, EMACS_INT, EMACS_INT *); | 2715 | extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); |
| 2685 | extern void signal_after_change (EMACS_INT, EMACS_INT, EMACS_INT); | 2716 | extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); |
| 2686 | extern void adjust_after_insert (EMACS_INT, EMACS_INT, EMACS_INT, | 2717 | extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 2687 | EMACS_INT, EMACS_INT); | 2718 | ptrdiff_t, ptrdiff_t); |
| 2688 | extern void adjust_markers_for_delete (EMACS_INT, EMACS_INT, | 2719 | extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t, |
| 2689 | EMACS_INT, EMACS_INT); | 2720 | ptrdiff_t, ptrdiff_t); |
| 2690 | extern void replace_range (EMACS_INT, EMACS_INT, Lisp_Object, int, int, int); | 2721 | extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, int, int, int); |
| 2691 | extern void replace_range_2 (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, | 2722 | extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 2692 | const char *, EMACS_INT, EMACS_INT, int); | 2723 | const char *, ptrdiff_t, ptrdiff_t, int); |
| 2693 | extern void syms_of_insdel (void); | 2724 | extern void syms_of_insdel (void); |
| 2694 | 2725 | ||
| 2695 | /* Defined in dispnew.c */ | 2726 | /* Defined in dispnew.c */ |
| @@ -2697,6 +2728,7 @@ extern Lisp_Object selected_frame; | |||
| 2697 | extern Lisp_Object Vwindow_system; | 2728 | extern Lisp_Object Vwindow_system; |
| 2698 | EXFUN (Fding, 1); | 2729 | EXFUN (Fding, 1); |
| 2699 | EXFUN (Fredraw_frame, 1); | 2730 | EXFUN (Fredraw_frame, 1); |
| 2731 | void duration_to_sec_usec (double, int *, int *); | ||
| 2700 | EXFUN (Fsleep_for, 2); | 2732 | EXFUN (Fsleep_for, 2); |
| 2701 | EXFUN (Fredisplay, 1); | 2733 | EXFUN (Fredisplay, 1); |
| 2702 | extern Lisp_Object sit_for (Lisp_Object, int, int); | 2734 | extern Lisp_Object sit_for (Lisp_Object, int, int); |
| @@ -2718,7 +2750,7 @@ extern Lisp_Object QCdata, QCfile; | |||
| 2718 | extern Lisp_Object QCmap; | 2750 | extern Lisp_Object QCmap; |
| 2719 | extern Lisp_Object Qrisky_local_variable; | 2751 | extern Lisp_Object Qrisky_local_variable; |
| 2720 | extern struct frame *last_glyphless_glyph_frame; | 2752 | extern struct frame *last_glyphless_glyph_frame; |
| 2721 | extern unsigned last_glyphless_glyph_face_id; | 2753 | extern int last_glyphless_glyph_face_id; |
| 2722 | extern int last_glyphless_glyph_merged_face_id; | 2754 | extern int last_glyphless_glyph_merged_face_id; |
| 2723 | extern int noninteractive_need_newline; | 2755 | extern int noninteractive_need_newline; |
| 2724 | extern Lisp_Object echo_area_buffer[2]; | 2756 | extern Lisp_Object echo_area_buffer[2]; |
| @@ -2734,15 +2766,15 @@ extern void clear_message (int, int); | |||
| 2734 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); | 2766 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2735 | extern void message1 (const char *); | 2767 | extern void message1 (const char *); |
| 2736 | extern void message1_nolog (const char *); | 2768 | extern void message1_nolog (const char *); |
| 2737 | extern void message2 (const char *, EMACS_INT, int); | 2769 | extern void message2 (const char *, ptrdiff_t, int); |
| 2738 | extern void message2_nolog (const char *, EMACS_INT, int); | 2770 | extern void message2_nolog (const char *, ptrdiff_t, int); |
| 2739 | extern void message3 (Lisp_Object, EMACS_INT, int); | 2771 | extern void message3 (Lisp_Object, ptrdiff_t, int); |
| 2740 | extern void message3_nolog (Lisp_Object, EMACS_INT, int); | 2772 | extern void message3_nolog (Lisp_Object, ptrdiff_t, int); |
| 2741 | extern void message_dolog (const char *, EMACS_INT, int, int); | 2773 | extern void message_dolog (const char *, ptrdiff_t, int, int); |
| 2742 | extern void message_with_string (const char *, Lisp_Object, int); | 2774 | extern void message_with_string (const char *, Lisp_Object, int); |
| 2743 | extern void message_log_maybe_newline (void); | 2775 | extern void message_log_maybe_newline (void); |
| 2744 | extern void update_echo_area (void); | 2776 | extern void update_echo_area (void); |
| 2745 | extern void truncate_echo_area (EMACS_INT); | 2777 | extern void truncate_echo_area (ptrdiff_t); |
| 2746 | extern void redisplay (void); | 2778 | extern void redisplay (void); |
| 2747 | extern void redisplay_preserve_echo_area (int); | 2779 | extern void redisplay_preserve_echo_area (int); |
| 2748 | extern void prepare_menu_bars (void); | 2780 | extern void prepare_menu_bars (void); |
| @@ -2751,7 +2783,7 @@ void set_frame_cursor_types (struct frame *, Lisp_Object); | |||
| 2751 | extern void syms_of_xdisp (void); | 2783 | extern void syms_of_xdisp (void); |
| 2752 | extern void init_xdisp (void); | 2784 | extern void init_xdisp (void); |
| 2753 | extern Lisp_Object safe_eval (Lisp_Object); | 2785 | extern Lisp_Object safe_eval (Lisp_Object); |
| 2754 | extern int pos_visible_p (struct window *, EMACS_INT, int *, | 2786 | extern int pos_visible_p (struct window *, ptrdiff_t, int *, |
| 2755 | int *, int *, int *, int *, int *); | 2787 | int *, int *, int *, int *, int *); |
| 2756 | 2788 | ||
| 2757 | /* Defined in xsettings.c */ | 2789 | /* Defined in xsettings.c */ |
| @@ -2767,7 +2799,7 @@ extern void reset_malloc_hooks (void); | |||
| 2767 | extern void uninterrupt_malloc (void); | 2799 | extern void uninterrupt_malloc (void); |
| 2768 | extern void malloc_warning (const char *); | 2800 | extern void malloc_warning (const char *); |
| 2769 | extern void memory_full (size_t) NO_RETURN; | 2801 | extern void memory_full (size_t) NO_RETURN; |
| 2770 | extern void buffer_memory_full (EMACS_INT) NO_RETURN; | 2802 | extern void buffer_memory_full (ptrdiff_t) NO_RETURN; |
| 2771 | extern int survives_gc_p (Lisp_Object); | 2803 | extern int survives_gc_p (Lisp_Object); |
| 2772 | extern void mark_object (Lisp_Object); | 2804 | extern void mark_object (Lisp_Object); |
| 2773 | #if defined REL_ALLOC && !defined SYSTEM_MALLOC | 2805 | #if defined REL_ALLOC && !defined SYSTEM_MALLOC |
| @@ -2792,26 +2824,26 @@ EXFUN (Fmake_marker, 0); | |||
| 2792 | extern void string_overflow (void) NO_RETURN; | 2824 | extern void string_overflow (void) NO_RETURN; |
| 2793 | EXFUN (Fmake_string, 2); | 2825 | EXFUN (Fmake_string, 2); |
| 2794 | extern Lisp_Object build_string (const char *); | 2826 | extern Lisp_Object build_string (const char *); |
| 2795 | extern Lisp_Object make_string (const char *, EMACS_INT); | 2827 | extern Lisp_Object make_string (const char *, ptrdiff_t); |
| 2796 | extern Lisp_Object make_unibyte_string (const char *, EMACS_INT); | 2828 | extern Lisp_Object make_unibyte_string (const char *, ptrdiff_t); |
| 2797 | extern Lisp_Object make_multibyte_string (const char *, EMACS_INT, EMACS_INT); | 2829 | extern Lisp_Object make_multibyte_string (const char *, ptrdiff_t, ptrdiff_t); |
| 2798 | extern Lisp_Object make_event_array (int, Lisp_Object *); | 2830 | extern Lisp_Object make_event_array (int, Lisp_Object *); |
| 2799 | extern Lisp_Object make_uninit_string (EMACS_INT); | 2831 | extern Lisp_Object make_uninit_string (EMACS_INT); |
| 2800 | extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); | 2832 | extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); |
| 2801 | extern Lisp_Object make_string_from_bytes (const char *, EMACS_INT, EMACS_INT); | 2833 | extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); |
| 2802 | extern Lisp_Object make_specified_string (const char *, | 2834 | extern Lisp_Object make_specified_string (const char *, |
| 2803 | EMACS_INT, EMACS_INT, int); | 2835 | ptrdiff_t, ptrdiff_t, int); |
| 2804 | EXFUN (Fpurecopy, 1); | 2836 | EXFUN (Fpurecopy, 1); |
| 2805 | extern Lisp_Object make_pure_string (const char *, EMACS_INT, EMACS_INT, int); | 2837 | extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); |
| 2806 | extern Lisp_Object make_pure_c_string (const char *data); | 2838 | extern Lisp_Object make_pure_c_string (const char *data); |
| 2807 | extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); | 2839 | extern Lisp_Object pure_cons (Lisp_Object, Lisp_Object); |
| 2808 | extern Lisp_Object make_pure_vector (EMACS_INT); | 2840 | extern Lisp_Object make_pure_vector (ptrdiff_t); |
| 2809 | EXFUN (Fgarbage_collect, 0); | 2841 | EXFUN (Fgarbage_collect, 0); |
| 2810 | EXFUN (Fmake_byte_code, MANY); | 2842 | EXFUN (Fmake_byte_code, MANY); |
| 2811 | EXFUN (Fmake_bool_vector, 2); | 2843 | EXFUN (Fmake_bool_vector, 2); |
| 2812 | extern Lisp_Object Qchar_table_extra_slots; | 2844 | extern Lisp_Object Qchar_table_extra_slots; |
| 2813 | extern struct Lisp_Vector *allocate_vector (EMACS_INT); | 2845 | extern struct Lisp_Vector *allocate_vector (EMACS_INT); |
| 2814 | extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, EMACS_INT tag); | 2846 | extern struct Lisp_Vector *allocate_pseudovector (int memlen, int lisplen, int tag); |
| 2815 | #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ | 2847 | #define ALLOCATE_PSEUDOVECTOR(typ,field,tag) \ |
| 2816 | ((typ*) \ | 2848 | ((typ*) \ |
| 2817 | allocate_pseudovector \ | 2849 | allocate_pseudovector \ |
| @@ -2825,7 +2857,7 @@ extern int gc_in_progress; | |||
| 2825 | extern int abort_on_gc; | 2857 | extern int abort_on_gc; |
| 2826 | extern Lisp_Object make_float (double); | 2858 | extern Lisp_Object make_float (double); |
| 2827 | extern void display_malloc_warning (void); | 2859 | extern void display_malloc_warning (void); |
| 2828 | extern int inhibit_garbage_collection (void); | 2860 | extern ptrdiff_t inhibit_garbage_collection (void); |
| 2829 | extern Lisp_Object make_save_value (void *, ptrdiff_t); | 2861 | extern Lisp_Object make_save_value (void *, ptrdiff_t); |
| 2830 | extern void free_marker (Lisp_Object); | 2862 | extern void free_marker (Lisp_Object); |
| 2831 | extern void free_cons (struct Lisp_Cons *); | 2863 | extern void free_cons (struct Lisp_Cons *); |
| @@ -2909,7 +2941,7 @@ EXFUN (Fread_event, 3); | |||
| 2909 | extern Lisp_Object check_obarray (Lisp_Object); | 2941 | extern Lisp_Object check_obarray (Lisp_Object); |
| 2910 | extern Lisp_Object intern (const char *); | 2942 | extern Lisp_Object intern (const char *); |
| 2911 | extern Lisp_Object intern_c_string (const char *); | 2943 | extern Lisp_Object intern_c_string (const char *); |
| 2912 | extern Lisp_Object oblookup (Lisp_Object, const char *, EMACS_INT, EMACS_INT); | 2944 | extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t); |
| 2913 | #define LOADHIST_ATTACH(x) \ | 2945 | #define LOADHIST_ATTACH(x) \ |
| 2914 | do { \ | 2946 | do { \ |
| 2915 | if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \ | 2947 | if (initialized) Vcurrent_load_list = Fcons (x, Vcurrent_load_list); \ |
| @@ -2985,7 +3017,7 @@ extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp | |||
| 2985 | extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (ptrdiff_t, Lisp_Object *), ptrdiff_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)); | 3017 | extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (ptrdiff_t, Lisp_Object *), ptrdiff_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object)); |
| 2986 | extern void specbind (Lisp_Object, Lisp_Object); | 3018 | extern void specbind (Lisp_Object, Lisp_Object); |
| 2987 | extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); | 3019 | extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object); |
| 2988 | extern Lisp_Object unbind_to (int, Lisp_Object); | 3020 | extern Lisp_Object unbind_to (ptrdiff_t, Lisp_Object); |
| 2989 | extern void error (const char *, ...) NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2); | 3021 | extern void error (const char *, ...) NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2990 | extern void verror (const char *, va_list) | 3022 | extern void verror (const char *, va_list) |
| 2991 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); | 3023 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); |
| @@ -3037,10 +3069,9 @@ EXFUN (Fuser_login_name, 1); | |||
| 3037 | EXFUN (Fsystem_name, 0); | 3069 | EXFUN (Fsystem_name, 0); |
| 3038 | EXFUN (Fcurrent_time, 0); | 3070 | EXFUN (Fcurrent_time, 0); |
| 3039 | EXFUN (Fget_internal_run_time, 0); | 3071 | EXFUN (Fget_internal_run_time, 0); |
| 3040 | extern EMACS_INT clip_to_bounds (EMACS_INT, EMACS_INT, EMACS_INT); | 3072 | extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, int); |
| 3041 | extern Lisp_Object make_buffer_string (EMACS_INT, EMACS_INT, int); | 3073 | extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 3042 | extern Lisp_Object make_buffer_string_both (EMACS_INT, EMACS_INT, EMACS_INT, | 3074 | ptrdiff_t, int); |
| 3043 | EMACS_INT, int); | ||
| 3044 | extern void init_editfns (void); | 3075 | extern void init_editfns (void); |
| 3045 | const char *get_system_name (void); | 3076 | const char *get_system_name (void); |
| 3046 | extern void syms_of_editfns (void); | 3077 | extern void syms_of_editfns (void); |
| @@ -3054,12 +3085,12 @@ extern void nsberror (Lisp_Object) NO_RETURN; | |||
| 3054 | EXFUN (Fset_buffer_multibyte, 1); | 3085 | EXFUN (Fset_buffer_multibyte, 1); |
| 3055 | EXFUN (Foverlay_start, 1); | 3086 | EXFUN (Foverlay_start, 1); |
| 3056 | EXFUN (Foverlay_end, 1); | 3087 | EXFUN (Foverlay_end, 1); |
| 3057 | extern void adjust_overlays_for_insert (EMACS_INT, EMACS_INT); | 3088 | extern void adjust_overlays_for_insert (ptrdiff_t, ptrdiff_t); |
| 3058 | extern void adjust_overlays_for_delete (EMACS_INT, EMACS_INT); | 3089 | extern void adjust_overlays_for_delete (ptrdiff_t, ptrdiff_t); |
| 3059 | extern void fix_start_end_in_overlays (EMACS_INT, EMACS_INT); | 3090 | extern void fix_start_end_in_overlays (ptrdiff_t, ptrdiff_t); |
| 3060 | extern void report_overlay_modification (Lisp_Object, Lisp_Object, int, | 3091 | extern void report_overlay_modification (Lisp_Object, Lisp_Object, int, |
| 3061 | Lisp_Object, Lisp_Object, Lisp_Object); | 3092 | Lisp_Object, Lisp_Object, Lisp_Object); |
| 3062 | extern int overlay_touches_p (EMACS_INT); | 3093 | extern int overlay_touches_p (ptrdiff_t); |
| 3063 | extern Lisp_Object Vbuffer_alist; | 3094 | extern Lisp_Object Vbuffer_alist; |
| 3064 | EXFUN (Fget_buffer, 1); | 3095 | EXFUN (Fget_buffer, 1); |
| 3065 | EXFUN (Fget_buffer_create, 1); | 3096 | EXFUN (Fget_buffer_create, 1); |
| @@ -3093,17 +3124,17 @@ EXFUN (Fmarker_position, 1); | |||
| 3093 | EXFUN (Fmarker_buffer, 1); | 3124 | EXFUN (Fmarker_buffer, 1); |
| 3094 | EXFUN (Fcopy_marker, 2); | 3125 | EXFUN (Fcopy_marker, 2); |
| 3095 | EXFUN (Fset_marker, 3); | 3126 | EXFUN (Fset_marker, 3); |
| 3096 | extern EMACS_INT marker_position (Lisp_Object); | 3127 | extern ptrdiff_t marker_position (Lisp_Object); |
| 3097 | extern EMACS_INT marker_byte_position (Lisp_Object); | 3128 | extern ptrdiff_t marker_byte_position (Lisp_Object); |
| 3098 | extern void clear_charpos_cache (struct buffer *); | 3129 | extern void clear_charpos_cache (struct buffer *); |
| 3099 | extern EMACS_INT charpos_to_bytepos (EMACS_INT); | 3130 | extern ptrdiff_t charpos_to_bytepos (ptrdiff_t); |
| 3100 | extern EMACS_INT buf_charpos_to_bytepos (struct buffer *, EMACS_INT); | 3131 | extern ptrdiff_t buf_charpos_to_bytepos (struct buffer *, ptrdiff_t); |
| 3101 | extern EMACS_INT buf_bytepos_to_charpos (struct buffer *, EMACS_INT); | 3132 | extern ptrdiff_t buf_bytepos_to_charpos (struct buffer *, ptrdiff_t); |
| 3102 | extern void unchain_marker (struct Lisp_Marker *marker); | 3133 | extern void unchain_marker (struct Lisp_Marker *marker); |
| 3103 | extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); | 3134 | extern Lisp_Object set_marker_restricted (Lisp_Object, Lisp_Object, Lisp_Object); |
| 3104 | extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, EMACS_INT, EMACS_INT); | 3135 | extern Lisp_Object set_marker_both (Lisp_Object, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 3105 | extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, | 3136 | extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, |
| 3106 | EMACS_INT, EMACS_INT); | 3137 | ptrdiff_t, ptrdiff_t); |
| 3107 | extern void syms_of_marker (void); | 3138 | extern void syms_of_marker (void); |
| 3108 | 3139 | ||
| 3109 | /* Defined in fileio.c */ | 3140 | /* Defined in fileio.c */ |
| @@ -3156,18 +3187,18 @@ struct re_registers; | |||
| 3156 | extern struct re_pattern_buffer *compile_pattern (Lisp_Object, | 3187 | extern struct re_pattern_buffer *compile_pattern (Lisp_Object, |
| 3157 | struct re_registers *, | 3188 | struct re_registers *, |
| 3158 | Lisp_Object, int, int); | 3189 | Lisp_Object, int, int); |
| 3159 | extern EMACS_INT fast_string_match (Lisp_Object, Lisp_Object); | 3190 | extern ptrdiff_t fast_string_match (Lisp_Object, Lisp_Object); |
| 3160 | extern EMACS_INT fast_c_string_match_ignore_case (Lisp_Object, const char *); | 3191 | extern ptrdiff_t fast_c_string_match_ignore_case (Lisp_Object, const char *); |
| 3161 | extern EMACS_INT fast_string_match_ignore_case (Lisp_Object, Lisp_Object); | 3192 | extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object); |
| 3162 | extern EMACS_INT fast_looking_at (Lisp_Object, EMACS_INT, EMACS_INT, | 3193 | extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 3163 | EMACS_INT, EMACS_INT, Lisp_Object); | 3194 | ptrdiff_t, ptrdiff_t, Lisp_Object); |
| 3164 | extern EMACS_INT scan_buffer (int, EMACS_INT, EMACS_INT, EMACS_INT, | 3195 | extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 3165 | EMACS_INT *, int); | 3196 | ptrdiff_t *, int); |
| 3166 | extern EMACS_INT scan_newline (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT, | 3197 | extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 3167 | EMACS_INT, int); | 3198 | EMACS_INT, int); |
| 3168 | extern EMACS_INT find_next_newline (EMACS_INT, int); | 3199 | extern ptrdiff_t find_next_newline (ptrdiff_t, int); |
| 3169 | extern EMACS_INT find_next_newline_no_quit (EMACS_INT, EMACS_INT); | 3200 | extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t); |
| 3170 | extern EMACS_INT find_before_next_newline (EMACS_INT, EMACS_INT, EMACS_INT); | 3201 | extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t); |
| 3171 | extern void syms_of_search (void); | 3202 | extern void syms_of_search (void); |
| 3172 | extern void clear_regexp_cache (void); | 3203 | extern void clear_regexp_cache (void); |
| 3173 | 3204 | ||
| @@ -3253,9 +3284,9 @@ extern void keys_of_keyboard (void); | |||
| 3253 | EXFUN (Fvertical_motion, 2); | 3284 | EXFUN (Fvertical_motion, 2); |
| 3254 | EXFUN (Findent_to, 2); | 3285 | EXFUN (Findent_to, 2); |
| 3255 | EXFUN (Fmove_to_column, 2); | 3286 | EXFUN (Fmove_to_column, 2); |
| 3256 | extern EMACS_INT current_column (void); | 3287 | extern ptrdiff_t current_column (void); |
| 3257 | extern void invalidate_current_column (void); | 3288 | extern void invalidate_current_column (void); |
| 3258 | extern int indented_beyond_p (EMACS_INT, EMACS_INT, EMACS_INT); | 3289 | extern int indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT); |
| 3259 | extern void syms_of_indent (void); | 3290 | extern void syms_of_indent (void); |
| 3260 | 3291 | ||
| 3261 | /* Defined in frame.c */ | 3292 | /* Defined in frame.c */ |
| @@ -3386,12 +3417,12 @@ extern Lisp_Object Qapply; | |||
| 3386 | extern Lisp_Object Qinhibit_read_only; | 3417 | extern Lisp_Object Qinhibit_read_only; |
| 3387 | EXFUN (Fundo_boundary, 0); | 3418 | EXFUN (Fundo_boundary, 0); |
| 3388 | extern void truncate_undo_list (struct buffer *); | 3419 | extern void truncate_undo_list (struct buffer *); |
| 3389 | extern void record_marker_adjustment (Lisp_Object, EMACS_INT); | 3420 | extern void record_marker_adjustment (Lisp_Object, ptrdiff_t); |
| 3390 | extern void record_insert (EMACS_INT, EMACS_INT); | 3421 | extern void record_insert (ptrdiff_t, ptrdiff_t); |
| 3391 | extern void record_delete (EMACS_INT, Lisp_Object); | 3422 | extern void record_delete (ptrdiff_t, Lisp_Object); |
| 3392 | extern void record_first_change (void); | 3423 | extern void record_first_change (void); |
| 3393 | extern void record_change (EMACS_INT, EMACS_INT); | 3424 | extern void record_change (ptrdiff_t, ptrdiff_t); |
| 3394 | extern void record_property_change (EMACS_INT, EMACS_INT, | 3425 | extern void record_property_change (ptrdiff_t, ptrdiff_t, |
| 3395 | Lisp_Object, Lisp_Object, | 3426 | Lisp_Object, Lisp_Object, |
| 3396 | Lisp_Object); | 3427 | Lisp_Object); |
| 3397 | extern void syms_of_undo (void); | 3428 | extern void syms_of_undo (void); |
| @@ -3437,8 +3468,8 @@ extern void init_sys_modes (struct tty_display_info *); | |||
| 3437 | extern void reset_sys_modes (struct tty_display_info *); | 3468 | extern void reset_sys_modes (struct tty_display_info *); |
| 3438 | extern void init_all_sys_modes (void); | 3469 | extern void init_all_sys_modes (void); |
| 3439 | extern void reset_all_sys_modes (void); | 3470 | extern void reset_all_sys_modes (void); |
| 3440 | extern void wait_for_termination (int); | 3471 | extern void wait_for_termination (pid_t); |
| 3441 | extern void interruptible_wait_for_termination (int); | 3472 | extern void interruptible_wait_for_termination (pid_t); |
| 3442 | extern void flush_pending_output (int); | 3473 | extern void flush_pending_output (int); |
| 3443 | extern void child_setup_tty (int); | 3474 | extern void child_setup_tty (int); |
| 3444 | extern void setup_pty (int); | 3475 | extern void setup_pty (int); |
| @@ -3447,8 +3478,8 @@ extern EMACS_INT get_random (void); | |||
| 3447 | extern void seed_random (long); | 3478 | extern void seed_random (long); |
| 3448 | extern int emacs_open (const char *, int, int); | 3479 | extern int emacs_open (const char *, int, int); |
| 3449 | extern int emacs_close (int); | 3480 | extern int emacs_close (int); |
| 3450 | extern EMACS_INT emacs_read (int, char *, EMACS_INT); | 3481 | extern ptrdiff_t emacs_read (int, char *, ptrdiff_t); |
| 3451 | extern EMACS_INT emacs_write (int, const char *, EMACS_INT); | 3482 | extern ptrdiff_t emacs_write (int, const char *, ptrdiff_t); |
| 3452 | enum { READLINK_BUFSIZE = 1024 }; | 3483 | enum { READLINK_BUFSIZE = 1024 }; |
| 3453 | extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]); | 3484 | extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]); |
| 3454 | 3485 | ||
| @@ -3674,7 +3705,7 @@ extern void init_system_name (void); | |||
| 3674 | extern Lisp_Object safe_alloca_unwind (Lisp_Object); | 3705 | extern Lisp_Object safe_alloca_unwind (Lisp_Object); |
| 3675 | 3706 | ||
| 3676 | #define USE_SAFE_ALLOCA \ | 3707 | #define USE_SAFE_ALLOCA \ |
| 3677 | int sa_count = (int) SPECPDL_INDEX (), sa_must_free = 0 | 3708 | ptrdiff_t sa_count = SPECPDL_INDEX (); int sa_must_free = 0 |
| 3678 | 3709 | ||
| 3679 | /* SAFE_ALLOCA allocates a simple buffer. */ | 3710 | /* SAFE_ALLOCA allocates a simple buffer. */ |
| 3680 | 3711 | ||
diff --git a/src/lread.c b/src/lread.c index 11c4cf8c8f4..3a1b3f0c9c5 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -109,9 +109,9 @@ static FILE *instream; | |||
| 109 | static int read_pure; | 109 | static int read_pure; |
| 110 | 110 | ||
| 111 | /* For use within read-from-string (this reader is non-reentrant!!) */ | 111 | /* For use within read-from-string (this reader is non-reentrant!!) */ |
| 112 | static EMACS_INT read_from_string_index; | 112 | static ptrdiff_t read_from_string_index; |
| 113 | static EMACS_INT read_from_string_index_byte; | 113 | static ptrdiff_t read_from_string_index_byte; |
| 114 | static EMACS_INT read_from_string_limit; | 114 | static ptrdiff_t read_from_string_limit; |
| 115 | 115 | ||
| 116 | /* Number of characters read in the current call to Fread or | 116 | /* Number of characters read in the current call to Fread or |
| 117 | Fread_from_string. */ | 117 | Fread_from_string. */ |
| @@ -209,7 +209,7 @@ readchar (Lisp_Object readcharfun, int *multibyte) | |||
| 209 | { | 209 | { |
| 210 | register struct buffer *inbuffer = XBUFFER (readcharfun); | 210 | register struct buffer *inbuffer = XBUFFER (readcharfun); |
| 211 | 211 | ||
| 212 | EMACS_INT pt_byte = BUF_PT_BYTE (inbuffer); | 212 | ptrdiff_t pt_byte = BUF_PT_BYTE (inbuffer); |
| 213 | 213 | ||
| 214 | if (pt_byte >= BUF_ZV_BYTE (inbuffer)) | 214 | if (pt_byte >= BUF_ZV_BYTE (inbuffer)) |
| 215 | return -1; | 215 | return -1; |
| @@ -238,7 +238,7 @@ readchar (Lisp_Object readcharfun, int *multibyte) | |||
| 238 | { | 238 | { |
| 239 | register struct buffer *inbuffer = XMARKER (readcharfun)->buffer; | 239 | register struct buffer *inbuffer = XMARKER (readcharfun)->buffer; |
| 240 | 240 | ||
| 241 | EMACS_INT bytepos = marker_byte_position (readcharfun); | 241 | ptrdiff_t bytepos = marker_byte_position (readcharfun); |
| 242 | 242 | ||
| 243 | if (bytepos >= BUF_ZV_BYTE (inbuffer)) | 243 | if (bytepos >= BUF_ZV_BYTE (inbuffer)) |
| 244 | return -1; | 244 | return -1; |
| @@ -372,8 +372,8 @@ unreadchar (Lisp_Object readcharfun, int c) | |||
| 372 | else if (BUFFERP (readcharfun)) | 372 | else if (BUFFERP (readcharfun)) |
| 373 | { | 373 | { |
| 374 | struct buffer *b = XBUFFER (readcharfun); | 374 | struct buffer *b = XBUFFER (readcharfun); |
| 375 | EMACS_INT charpos = BUF_PT (b); | 375 | ptrdiff_t charpos = BUF_PT (b); |
| 376 | EMACS_INT bytepos = BUF_PT_BYTE (b); | 376 | ptrdiff_t bytepos = BUF_PT_BYTE (b); |
| 377 | 377 | ||
| 378 | if (! NILP (BVAR (b, enable_multibyte_characters))) | 378 | if (! NILP (BVAR (b, enable_multibyte_characters))) |
| 379 | BUF_DEC_POS (b, bytepos); | 379 | BUF_DEC_POS (b, bytepos); |
| @@ -385,7 +385,7 @@ unreadchar (Lisp_Object readcharfun, int c) | |||
| 385 | else if (MARKERP (readcharfun)) | 385 | else if (MARKERP (readcharfun)) |
| 386 | { | 386 | { |
| 387 | struct buffer *b = XMARKER (readcharfun)->buffer; | 387 | struct buffer *b = XMARKER (readcharfun)->buffer; |
| 388 | EMACS_INT bytepos = XMARKER (readcharfun)->bytepos; | 388 | ptrdiff_t bytepos = XMARKER (readcharfun)->bytepos; |
| 389 | 389 | ||
| 390 | XMARKER (readcharfun)->charpos--; | 390 | XMARKER (readcharfun)->charpos--; |
| 391 | if (! NILP (BVAR (b, enable_multibyte_characters))) | 391 | if (! NILP (BVAR (b, enable_multibyte_characters))) |
| @@ -1023,7 +1023,7 @@ Return t if the file exists and loads successfully. */) | |||
| 1023 | { | 1023 | { |
| 1024 | register FILE *stream; | 1024 | register FILE *stream; |
| 1025 | register int fd = -1; | 1025 | register int fd = -1; |
| 1026 | int count = SPECPDL_INDEX (); | 1026 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1027 | struct gcpro gcpro1, gcpro2, gcpro3; | 1027 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 1028 | Lisp_Object found, efound, hist_file_name; | 1028 | Lisp_Object found, efound, hist_file_name; |
| 1029 | /* 1 means we printed the ".el is newer" message. */ | 1029 | /* 1 means we printed the ".el is newer" message. */ |
| @@ -1443,16 +1443,16 @@ int | |||
| 1443 | openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate) | 1443 | openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate) |
| 1444 | { | 1444 | { |
| 1445 | register int fd; | 1445 | register int fd; |
| 1446 | EMACS_INT fn_size = 100; | 1446 | ptrdiff_t fn_size = 100; |
| 1447 | char buf[100]; | 1447 | char buf[100]; |
| 1448 | register char *fn = buf; | 1448 | register char *fn = buf; |
| 1449 | int absolute = 0; | 1449 | int absolute = 0; |
| 1450 | EMACS_INT want_length; | 1450 | ptrdiff_t want_length; |
| 1451 | Lisp_Object filename; | 1451 | Lisp_Object filename; |
| 1452 | struct stat st; | 1452 | struct stat st; |
| 1453 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 1453 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 1454 | Lisp_Object string, tail, encoded_fn; | 1454 | Lisp_Object string, tail, encoded_fn; |
| 1455 | EMACS_INT max_suffix_len = 0; | 1455 | ptrdiff_t max_suffix_len = 0; |
| 1456 | 1456 | ||
| 1457 | CHECK_STRING (str); | 1457 | CHECK_STRING (str); |
| 1458 | 1458 | ||
| @@ -1562,7 +1562,9 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto | |||
| 1562 | { | 1562 | { |
| 1563 | /* Check that we can access or open it. */ | 1563 | /* Check that we can access or open it. */ |
| 1564 | if (NATNUMP (predicate)) | 1564 | if (NATNUMP (predicate)) |
| 1565 | fd = (access (pfn, XFASTINT (predicate)) == 0) ? 1 : -1; | 1565 | fd = (((XFASTINT (predicate) & ~INT_MAX) == 0 |
| 1566 | && access (pfn, XFASTINT (predicate)) == 0) | ||
| 1567 | ? 1 : -1); | ||
| 1566 | else | 1568 | else |
| 1567 | fd = emacs_open (pfn, O_RDONLY, 0); | 1569 | fd = emacs_open (pfn, O_RDONLY, 0); |
| 1568 | 1570 | ||
| @@ -1696,7 +1698,7 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1696 | { | 1698 | { |
| 1697 | register int c; | 1699 | register int c; |
| 1698 | register Lisp_Object val; | 1700 | register Lisp_Object val; |
| 1699 | int count = SPECPDL_INDEX (); | 1701 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1700 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1702 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 1701 | struct buffer *b = 0; | 1703 | struct buffer *b = 0; |
| 1702 | int continue_reading_p; | 1704 | int continue_reading_p; |
| @@ -1747,7 +1749,7 @@ readevalloop (Lisp_Object readcharfun, | |||
| 1747 | continue_reading_p = 1; | 1749 | continue_reading_p = 1; |
| 1748 | while (continue_reading_p) | 1750 | while (continue_reading_p) |
| 1749 | { | 1751 | { |
| 1750 | int count1 = SPECPDL_INDEX (); | 1752 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 1751 | 1753 | ||
| 1752 | if (b != 0 && NILP (BVAR (b, name))) | 1754 | if (b != 0 && NILP (BVAR (b, name))) |
| 1753 | error ("Reading from killed buffer"); | 1755 | error ("Reading from killed buffer"); |
| @@ -1873,7 +1875,7 @@ DO-ALLOW-PRINT, if non-nil, specifies that `print' and related | |||
| 1873 | This function preserves the position of point. */) | 1875 | This function preserves the position of point. */) |
| 1874 | (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, Lisp_Object unibyte, Lisp_Object do_allow_print) | 1876 | (Lisp_Object buffer, Lisp_Object printflag, Lisp_Object filename, Lisp_Object unibyte, Lisp_Object do_allow_print) |
| 1875 | { | 1877 | { |
| 1876 | int count = SPECPDL_INDEX (); | 1878 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1877 | Lisp_Object tem, buf; | 1879 | Lisp_Object tem, buf; |
| 1878 | 1880 | ||
| 1879 | if (NILP (buffer)) | 1881 | if (NILP (buffer)) |
| @@ -1918,7 +1920,7 @@ This function does not move point. */) | |||
| 1918 | (Lisp_Object start, Lisp_Object end, Lisp_Object printflag, Lisp_Object read_function) | 1920 | (Lisp_Object start, Lisp_Object end, Lisp_Object printflag, Lisp_Object read_function) |
| 1919 | { | 1921 | { |
| 1920 | /* FIXME: Do the eval-sexp-add-defvars danse! */ | 1922 | /* FIXME: Do the eval-sexp-add-defvars danse! */ |
| 1921 | int count = SPECPDL_INDEX (); | 1923 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1922 | Lisp_Object tem, cbuf; | 1924 | Lisp_Object tem, cbuf; |
| 1923 | 1925 | ||
| 1924 | cbuf = Fcurrent_buffer (); | 1926 | cbuf = Fcurrent_buffer (); |
| @@ -1994,7 +1996,7 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 1994 | if (STRINGP (stream) | 1996 | if (STRINGP (stream) |
| 1995 | || ((CONSP (stream) && STRINGP (XCAR (stream))))) | 1997 | || ((CONSP (stream) && STRINGP (XCAR (stream))))) |
| 1996 | { | 1998 | { |
| 1997 | EMACS_INT startval, endval; | 1999 | ptrdiff_t startval, endval; |
| 1998 | Lisp_Object string; | 2000 | Lisp_Object string; |
| 1999 | 2001 | ||
| 2000 | if (STRINGP (stream)) | 2002 | if (STRINGP (stream)) |
| @@ -2007,9 +2009,9 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 2007 | else | 2009 | else |
| 2008 | { | 2010 | { |
| 2009 | CHECK_NUMBER (end); | 2011 | CHECK_NUMBER (end); |
| 2010 | endval = XINT (end); | 2012 | if (! (0 <= XINT (end) && XINT (end) <= SCHARS (string))) |
| 2011 | if (endval < 0 || endval > SCHARS (string)) | ||
| 2012 | args_out_of_range (string, end); | 2013 | args_out_of_range (string, end); |
| 2014 | endval = XINT (end); | ||
| 2013 | } | 2015 | } |
| 2014 | 2016 | ||
| 2015 | if (NILP (start)) | 2017 | if (NILP (start)) |
| @@ -2017,9 +2019,9 @@ read_internal_start (Lisp_Object stream, Lisp_Object start, Lisp_Object end) | |||
| 2017 | else | 2019 | else |
| 2018 | { | 2020 | { |
| 2019 | CHECK_NUMBER (start); | 2021 | CHECK_NUMBER (start); |
| 2020 | startval = XINT (start); | 2022 | if (! (0 <= XINT (start) && XINT (start) <= endval)) |
| 2021 | if (startval < 0 || startval > endval) | ||
| 2022 | args_out_of_range (string, start); | 2023 | args_out_of_range (string, start); |
| 2024 | startval = XINT (start); | ||
| 2023 | } | 2025 | } |
| 2024 | read_from_string_index = startval; | 2026 | read_from_string_index = startval; |
| 2025 | read_from_string_index_byte = string_char_to_byte (string, startval); | 2027 | read_from_string_index_byte = string_char_to_byte (string, startval); |
| @@ -2495,14 +2497,13 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 2495 | if (c == '[') | 2497 | if (c == '[') |
| 2496 | { | 2498 | { |
| 2497 | Lisp_Object tmp; | 2499 | Lisp_Object tmp; |
| 2498 | EMACS_INT depth, size; | 2500 | int depth; |
| 2501 | ptrdiff_t size; | ||
| 2499 | 2502 | ||
| 2500 | tmp = read_vector (readcharfun, 0); | 2503 | tmp = read_vector (readcharfun, 0); |
| 2501 | if (!INTEGERP (AREF (tmp, 0))) | 2504 | if (! RANGED_INTEGERP (1, AREF (tmp, 0), 3)) |
| 2502 | error ("Invalid depth in char-table"); | 2505 | error ("Invalid depth in char-table"); |
| 2503 | depth = XINT (AREF (tmp, 0)); | 2506 | depth = XINT (AREF (tmp, 0)); |
| 2504 | if (depth < 1 || depth > 3) | ||
| 2505 | error ("Invalid depth in char-table"); | ||
| 2506 | size = ASIZE (tmp) - 2; | 2507 | size = ASIZE (tmp) - 2; |
| 2507 | if (chartab_size [depth] != size) | 2508 | if (chartab_size [depth] != size) |
| 2508 | error ("Invalid size char-table"); | 2509 | error ("Invalid size char-table"); |
| @@ -3099,8 +3100,8 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | |||
| 3099 | } | 3100 | } |
| 3100 | { | 3101 | { |
| 3101 | Lisp_Object name, result; | 3102 | Lisp_Object name, result; |
| 3102 | EMACS_INT nbytes = p - read_buffer; | 3103 | ptrdiff_t nbytes = p - read_buffer; |
| 3103 | EMACS_INT nchars | 3104 | ptrdiff_t nchars |
| 3104 | = (multibyte | 3105 | = (multibyte |
| 3105 | ? multibyte_chars_in_text ((unsigned char *) read_buffer, | 3106 | ? multibyte_chars_in_text ((unsigned char *) read_buffer, |
| 3106 | nbytes) | 3107 | nbytes) |
| @@ -3885,7 +3886,7 @@ OBARRAY defaults to the value of the variable `obarray'. */) | |||
| 3885 | Also store the bucket number in oblookup_last_bucket_number. */ | 3886 | Also store the bucket number in oblookup_last_bucket_number. */ |
| 3886 | 3887 | ||
| 3887 | Lisp_Object | 3888 | Lisp_Object |
| 3888 | oblookup (Lisp_Object obarray, register const char *ptr, EMACS_INT size, EMACS_INT size_byte) | 3889 | oblookup (Lisp_Object obarray, register const char *ptr, ptrdiff_t size, ptrdiff_t size_byte) |
| 3889 | { | 3890 | { |
| 3890 | size_t hash; | 3891 | size_t hash; |
| 3891 | size_t obsize; | 3892 | size_t obsize; |
diff --git a/src/macros.c b/src/macros.c index 4ecf49834a1..4860308367d 100644 --- a/src/macros.c +++ b/src/macros.c | |||
| @@ -95,13 +95,14 @@ macro before appending to it. */) | |||
| 95 | has put another macro there. */ | 95 | has put another macro there. */ |
| 96 | if (current_kboard->kbd_macro_bufsize < len + 30) | 96 | if (current_kboard->kbd_macro_bufsize < len + 30) |
| 97 | { | 97 | { |
| 98 | if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) - 30 | 98 | if (PTRDIFF_MAX < MOST_POSITIVE_FIXNUM + 30 |
| 99 | < current_kboard->kbd_macro_bufsize) | 99 | && PTRDIFF_MAX < len + 30) |
| 100 | memory_full (SIZE_MAX); | 100 | memory_full (SIZE_MAX); |
| 101 | current_kboard->kbd_macro_buffer | 101 | current_kboard->kbd_macro_buffer = |
| 102 | = (Lisp_Object *)xrealloc (current_kboard->kbd_macro_buffer, | 102 | xpalloc (current_kboard->kbd_macro_buffer, |
| 103 | (len + 30) * sizeof (Lisp_Object)); | 103 | ¤t_kboard->kbd_macro_bufsize, |
| 104 | current_kboard->kbd_macro_bufsize = len + 30; | 104 | len + 30 - current_kboard->kbd_macro_bufsize, -1, |
| 105 | sizeof *current_kboard->kbd_macro_buffer); | ||
| 105 | } | 106 | } |
| 106 | 107 | ||
| 107 | /* Must convert meta modifier when copying string to vector. */ | 108 | /* Must convert meta modifier when copying string to vector. */ |
| @@ -301,7 +302,7 @@ each iteration of the macro. Iteration stops if LOOPFUNC returns nil. */) | |||
| 301 | { | 302 | { |
| 302 | Lisp_Object final; | 303 | Lisp_Object final; |
| 303 | Lisp_Object tem; | 304 | Lisp_Object tem; |
| 304 | int pdlcount = SPECPDL_INDEX (); | 305 | ptrdiff_t pdlcount = SPECPDL_INDEX (); |
| 305 | EMACS_INT repeat = 1; | 306 | EMACS_INT repeat = 1; |
| 306 | struct gcpro gcpro1, gcpro2; | 307 | struct gcpro gcpro1, gcpro2; |
| 307 | EMACS_INT success_count = 0; | 308 | EMACS_INT success_count = 0; |
diff --git a/src/marker.c b/src/marker.c index 675bbc5ad73..2b78282e693 100644 --- a/src/marker.c +++ b/src/marker.c | |||
| @@ -26,12 +26,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 26 | /* Record one cached position found recently by | 26 | /* Record one cached position found recently by |
| 27 | buf_charpos_to_bytepos or buf_bytepos_to_charpos. */ | 27 | buf_charpos_to_bytepos or buf_bytepos_to_charpos. */ |
| 28 | 28 | ||
| 29 | static EMACS_INT cached_charpos; | 29 | static ptrdiff_t cached_charpos; |
| 30 | static EMACS_INT cached_bytepos; | 30 | static ptrdiff_t cached_bytepos; |
| 31 | static struct buffer *cached_buffer; | 31 | static struct buffer *cached_buffer; |
| 32 | static int cached_modiff; | 32 | static int cached_modiff; |
| 33 | 33 | ||
| 34 | static void byte_char_debug_check (struct buffer *, EMACS_INT, EMACS_INT); | 34 | static void byte_char_debug_check (struct buffer *, ptrdiff_t, ptrdiff_t); |
| 35 | 35 | ||
| 36 | void | 36 | void |
| 37 | clear_charpos_cache (struct buffer *b) | 37 | clear_charpos_cache (struct buffer *b) |
| @@ -55,12 +55,12 @@ clear_charpos_cache (struct buffer *b) | |||
| 55 | 55 | ||
| 56 | #define CONSIDER(CHARPOS, BYTEPOS) \ | 56 | #define CONSIDER(CHARPOS, BYTEPOS) \ |
| 57 | { \ | 57 | { \ |
| 58 | EMACS_INT this_charpos = (CHARPOS); \ | 58 | ptrdiff_t this_charpos = (CHARPOS); \ |
| 59 | int changed = 0; \ | 59 | int changed = 0; \ |
| 60 | \ | 60 | \ |
| 61 | if (this_charpos == charpos) \ | 61 | if (this_charpos == charpos) \ |
| 62 | { \ | 62 | { \ |
| 63 | EMACS_INT value = (BYTEPOS); \ | 63 | ptrdiff_t value = (BYTEPOS); \ |
| 64 | if (byte_debug_flag) \ | 64 | if (byte_debug_flag) \ |
| 65 | byte_char_debug_check (b, charpos, value); \ | 65 | byte_char_debug_check (b, charpos, value); \ |
| 66 | return value; \ | 66 | return value; \ |
| @@ -85,7 +85,7 @@ clear_charpos_cache (struct buffer *b) | |||
| 85 | { \ | 85 | { \ |
| 86 | if (best_above - best_below == best_above_byte - best_below_byte) \ | 86 | if (best_above - best_below == best_above_byte - best_below_byte) \ |
| 87 | { \ | 87 | { \ |
| 88 | EMACS_INT value = best_below_byte + (charpos - best_below); \ | 88 | ptrdiff_t value = best_below_byte + (charpos - best_below); \ |
| 89 | if (byte_debug_flag) \ | 89 | if (byte_debug_flag) \ |
| 90 | byte_char_debug_check (b, charpos, value); \ | 90 | byte_char_debug_check (b, charpos, value); \ |
| 91 | return value; \ | 91 | return value; \ |
| @@ -94,9 +94,9 @@ clear_charpos_cache (struct buffer *b) | |||
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | static void | 96 | static void |
| 97 | byte_char_debug_check (struct buffer *b, EMACS_INT charpos, EMACS_INT bytepos) | 97 | byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) |
| 98 | { | 98 | { |
| 99 | EMACS_INT nchars = 0; | 99 | ptrdiff_t nchars = 0; |
| 100 | 100 | ||
| 101 | if (bytepos > BUF_GPT_BYTE (b)) | 101 | if (bytepos > BUF_GPT_BYTE (b)) |
| 102 | { | 102 | { |
| @@ -113,18 +113,18 @@ byte_char_debug_check (struct buffer *b, EMACS_INT charpos, EMACS_INT bytepos) | |||
| 113 | abort (); | 113 | abort (); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | EMACS_INT | 116 | ptrdiff_t |
| 117 | charpos_to_bytepos (EMACS_INT charpos) | 117 | charpos_to_bytepos (ptrdiff_t charpos) |
| 118 | { | 118 | { |
| 119 | return buf_charpos_to_bytepos (current_buffer, charpos); | 119 | return buf_charpos_to_bytepos (current_buffer, charpos); |
| 120 | } | 120 | } |
| 121 | 121 | ||
| 122 | EMACS_INT | 122 | ptrdiff_t |
| 123 | buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos) | 123 | buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos) |
| 124 | { | 124 | { |
| 125 | struct Lisp_Marker *tail; | 125 | struct Lisp_Marker *tail; |
| 126 | EMACS_INT best_above, best_above_byte; | 126 | ptrdiff_t best_above, best_above_byte; |
| 127 | EMACS_INT best_below, best_below_byte; | 127 | ptrdiff_t best_below, best_below_byte; |
| 128 | 128 | ||
| 129 | if (charpos < BUF_BEG (b) || charpos > BUF_Z (b)) | 129 | if (charpos < BUF_BEG (b) || charpos > BUF_Z (b)) |
| 130 | abort (); | 130 | abort (); |
| @@ -242,12 +242,12 @@ buf_charpos_to_bytepos (struct buffer *b, EMACS_INT charpos) | |||
| 242 | /* Used for debugging: recompute the bytepos corresponding to CHARPOS | 242 | /* Used for debugging: recompute the bytepos corresponding to CHARPOS |
| 243 | in the simplest, most reliable way. */ | 243 | in the simplest, most reliable way. */ |
| 244 | 244 | ||
| 245 | extern EMACS_INT verify_bytepos (EMACS_INT charpos) EXTERNALLY_VISIBLE; | 245 | extern ptrdiff_t verify_bytepos (ptrdiff_t charpos) EXTERNALLY_VISIBLE; |
| 246 | EMACS_INT | 246 | ptrdiff_t |
| 247 | verify_bytepos (EMACS_INT charpos) | 247 | verify_bytepos (ptrdiff_t charpos) |
| 248 | { | 248 | { |
| 249 | EMACS_INT below = 1; | 249 | ptrdiff_t below = 1; |
| 250 | EMACS_INT below_byte = 1; | 250 | ptrdiff_t below_byte = 1; |
| 251 | 251 | ||
| 252 | while (below != charpos) | 252 | while (below != charpos) |
| 253 | { | 253 | { |
| @@ -266,12 +266,12 @@ verify_bytepos (EMACS_INT charpos) | |||
| 266 | 266 | ||
| 267 | #define CONSIDER(BYTEPOS, CHARPOS) \ | 267 | #define CONSIDER(BYTEPOS, CHARPOS) \ |
| 268 | { \ | 268 | { \ |
| 269 | EMACS_INT this_bytepos = (BYTEPOS); \ | 269 | ptrdiff_t this_bytepos = (BYTEPOS); \ |
| 270 | int changed = 0; \ | 270 | int changed = 0; \ |
| 271 | \ | 271 | \ |
| 272 | if (this_bytepos == bytepos) \ | 272 | if (this_bytepos == bytepos) \ |
| 273 | { \ | 273 | { \ |
| 274 | EMACS_INT value = (CHARPOS); \ | 274 | ptrdiff_t value = (CHARPOS); \ |
| 275 | if (byte_debug_flag) \ | 275 | if (byte_debug_flag) \ |
| 276 | byte_char_debug_check (b, value, bytepos); \ | 276 | byte_char_debug_check (b, value, bytepos); \ |
| 277 | return value; \ | 277 | return value; \ |
| @@ -296,7 +296,7 @@ verify_bytepos (EMACS_INT charpos) | |||
| 296 | { \ | 296 | { \ |
| 297 | if (best_above - best_below == best_above_byte - best_below_byte) \ | 297 | if (best_above - best_below == best_above_byte - best_below_byte) \ |
| 298 | { \ | 298 | { \ |
| 299 | EMACS_INT value = best_below + (bytepos - best_below_byte); \ | 299 | ptrdiff_t value = best_below + (bytepos - best_below_byte); \ |
| 300 | if (byte_debug_flag) \ | 300 | if (byte_debug_flag) \ |
| 301 | byte_char_debug_check (b, value, bytepos); \ | 301 | byte_char_debug_check (b, value, bytepos); \ |
| 302 | return value; \ | 302 | return value; \ |
| @@ -304,12 +304,12 @@ verify_bytepos (EMACS_INT charpos) | |||
| 304 | } \ | 304 | } \ |
| 305 | } | 305 | } |
| 306 | 306 | ||
| 307 | EMACS_INT | 307 | ptrdiff_t |
| 308 | buf_bytepos_to_charpos (struct buffer *b, EMACS_INT bytepos) | 308 | buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos) |
| 309 | { | 309 | { |
| 310 | struct Lisp_Marker *tail; | 310 | struct Lisp_Marker *tail; |
| 311 | EMACS_INT best_above, best_above_byte; | 311 | ptrdiff_t best_above, best_above_byte; |
| 312 | EMACS_INT best_below, best_below_byte; | 312 | ptrdiff_t best_below, best_below_byte; |
| 313 | 313 | ||
| 314 | if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b)) | 314 | if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b)) |
| 315 | abort (); | 315 | abort (); |
| @@ -461,7 +461,8 @@ Then it no longer slows down editing in any buffer. | |||
| 461 | Returns MARKER. */) | 461 | Returns MARKER. */) |
| 462 | (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) | 462 | (Lisp_Object marker, Lisp_Object position, Lisp_Object buffer) |
| 463 | { | 463 | { |
| 464 | register EMACS_INT charno, bytepos; | 464 | register ptrdiff_t charno; |
| 465 | register ptrdiff_t bytepos; | ||
| 465 | register struct buffer *b; | 466 | register struct buffer *b; |
| 466 | register struct Lisp_Marker *m; | 467 | register struct Lisp_Marker *m; |
| 467 | 468 | ||
| @@ -502,14 +503,7 @@ Returns MARKER. */) | |||
| 502 | } | 503 | } |
| 503 | 504 | ||
| 504 | CHECK_NUMBER_COERCE_MARKER (position); | 505 | CHECK_NUMBER_COERCE_MARKER (position); |
| 505 | 506 | charno = clip_to_bounds (BUF_BEG (b), XINT (position), BUF_Z (b)); | |
| 506 | charno = XINT (position); | ||
| 507 | |||
| 508 | if (charno < BUF_BEG (b)) | ||
| 509 | charno = BUF_BEG (b); | ||
| 510 | if (charno > BUF_Z (b)) | ||
| 511 | charno = BUF_Z (b); | ||
| 512 | |||
| 513 | bytepos = buf_charpos_to_bytepos (b, charno); | 507 | bytepos = buf_charpos_to_bytepos (b, charno); |
| 514 | 508 | ||
| 515 | /* Every character is at least one byte. */ | 509 | /* Every character is at least one byte. */ |
| @@ -536,7 +530,8 @@ Returns MARKER. */) | |||
| 536 | Lisp_Object | 530 | Lisp_Object |
| 537 | set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) | 531 | set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) |
| 538 | { | 532 | { |
| 539 | register EMACS_INT charno, bytepos; | 533 | register ptrdiff_t charno; |
| 534 | register ptrdiff_t bytepos; | ||
| 540 | register struct buffer *b; | 535 | register struct buffer *b; |
| 541 | register struct Lisp_Marker *m; | 536 | register struct Lisp_Marker *m; |
| 542 | 537 | ||
| @@ -577,14 +572,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) | |||
| 577 | } | 572 | } |
| 578 | 573 | ||
| 579 | CHECK_NUMBER_COERCE_MARKER (pos); | 574 | CHECK_NUMBER_COERCE_MARKER (pos); |
| 580 | 575 | charno = clip_to_bounds (BUF_BEGV (b), XINT (pos), BUF_ZV (b)); | |
| 581 | charno = XINT (pos); | ||
| 582 | |||
| 583 | if (charno < BUF_BEGV (b)) | ||
| 584 | charno = BUF_BEGV (b); | ||
| 585 | if (charno > BUF_ZV (b)) | ||
| 586 | charno = BUF_ZV (b); | ||
| 587 | |||
| 588 | bytepos = buf_charpos_to_bytepos (b, charno); | 576 | bytepos = buf_charpos_to_bytepos (b, charno); |
| 589 | 577 | ||
| 590 | /* Every character is at least one byte. */ | 578 | /* Every character is at least one byte. */ |
| @@ -609,7 +597,7 @@ set_marker_restricted (Lisp_Object marker, Lisp_Object pos, Lisp_Object buffer) | |||
| 609 | character position and the corresponding byte position. */ | 597 | character position and the corresponding byte position. */ |
| 610 | 598 | ||
| 611 | Lisp_Object | 599 | Lisp_Object |
| 612 | set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMACS_INT bytepos) | 600 | set_marker_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t charpos, ptrdiff_t bytepos) |
| 613 | { | 601 | { |
| 614 | register struct buffer *b; | 602 | register struct buffer *b; |
| 615 | register struct Lisp_Marker *m; | 603 | register struct Lisp_Marker *m; |
| @@ -657,7 +645,7 @@ set_marker_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMAC | |||
| 657 | be outside the visible part. */ | 645 | be outside the visible part. */ |
| 658 | 646 | ||
| 659 | Lisp_Object | 647 | Lisp_Object |
| 660 | set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, EMACS_INT charpos, EMACS_INT bytepos) | 648 | set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, ptrdiff_t charpos, ptrdiff_t bytepos) |
| 661 | { | 649 | { |
| 662 | register struct buffer *b; | 650 | register struct buffer *b; |
| 663 | register struct Lisp_Marker *m; | 651 | register struct Lisp_Marker *m; |
| @@ -767,7 +755,7 @@ unchain_marker (register struct Lisp_Marker *marker) | |||
| 767 | 755 | ||
| 768 | /* Return the char position of marker MARKER, as a C integer. */ | 756 | /* Return the char position of marker MARKER, as a C integer. */ |
| 769 | 757 | ||
| 770 | EMACS_INT | 758 | ptrdiff_t |
| 771 | marker_position (Lisp_Object marker) | 759 | marker_position (Lisp_Object marker) |
| 772 | { | 760 | { |
| 773 | register struct Lisp_Marker *m = XMARKER (marker); | 761 | register struct Lisp_Marker *m = XMARKER (marker); |
| @@ -781,12 +769,12 @@ marker_position (Lisp_Object marker) | |||
| 781 | 769 | ||
| 782 | /* Return the byte position of marker MARKER, as a C integer. */ | 770 | /* Return the byte position of marker MARKER, as a C integer. */ |
| 783 | 771 | ||
| 784 | EMACS_INT | 772 | ptrdiff_t |
| 785 | marker_byte_position (Lisp_Object marker) | 773 | marker_byte_position (Lisp_Object marker) |
| 786 | { | 774 | { |
| 787 | register struct Lisp_Marker *m = XMARKER (marker); | 775 | register struct Lisp_Marker *m = XMARKER (marker); |
| 788 | register struct buffer *buf = m->buffer; | 776 | register struct buffer *buf = m->buffer; |
| 789 | register EMACS_INT i = m->bytepos; | 777 | register ptrdiff_t i = m->bytepos; |
| 790 | 778 | ||
| 791 | if (!buf) | 779 | if (!buf) |
| 792 | error ("Marker does not point anywhere"); | 780 | error ("Marker does not point anywhere"); |
| @@ -847,14 +835,9 @@ DEFUN ("buffer-has-markers-at", Fbuffer_has_markers_at, Sbuffer_has_markers_at, | |||
| 847 | (Lisp_Object position) | 835 | (Lisp_Object position) |
| 848 | { | 836 | { |
| 849 | register struct Lisp_Marker *tail; | 837 | register struct Lisp_Marker *tail; |
| 850 | register EMACS_INT charno; | 838 | register ptrdiff_t charno; |
| 851 | |||
| 852 | charno = XINT (position); | ||
| 853 | 839 | ||
| 854 | if (charno < BEG) | 840 | charno = clip_to_bounds (BEG, XINT (position), Z); |
| 855 | charno = BEG; | ||
| 856 | if (charno > Z) | ||
| 857 | charno = Z; | ||
| 858 | 841 | ||
| 859 | for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) | 842 | for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) |
| 860 | if (tail->charpos == charno) | 843 | if (tail->charpos == charno) |
diff --git a/src/menu.c b/src/menu.c index 587f55e14db..90423be5973 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -175,15 +175,17 @@ save_menu_items (void) | |||
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | 177 | ||
| 178 | /* Make the menu_items vector twice as large. */ | 178 | /* Ensure that there is room for ITEMS items in the menu_items vector. */ |
| 179 | 179 | ||
| 180 | static void | 180 | static void |
| 181 | grow_menu_items (void) | 181 | ensure_menu_items (int items) |
| 182 | { | 182 | { |
| 183 | if ((INT_MAX - MENU_ITEMS_PANE_LENGTH) / 2 < menu_items_allocated) | 183 | int incr = items - (menu_items_allocated - menu_items_used); |
| 184 | memory_full (SIZE_MAX); | 184 | if (0 < incr) |
| 185 | menu_items_allocated *= 2; | 185 | { |
| 186 | menu_items = larger_vector (menu_items, menu_items_allocated, Qnil); | 186 | menu_items = larger_vector (menu_items, incr, INT_MAX); |
| 187 | menu_items_allocated = ASIZE (menu_items); | ||
| 188 | } | ||
| 187 | } | 189 | } |
| 188 | 190 | ||
| 189 | #if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \ | 191 | #if (defined USE_X_TOOLKIT || defined USE_GTK || defined HAVE_NS \ |
| @@ -194,9 +196,7 @@ grow_menu_items (void) | |||
| 194 | static void | 196 | static void |
| 195 | push_submenu_start (void) | 197 | push_submenu_start (void) |
| 196 | { | 198 | { |
| 197 | if (menu_items_used + 1 > menu_items_allocated) | 199 | ensure_menu_items (1); |
| 198 | grow_menu_items (); | ||
| 199 | |||
| 200 | XVECTOR (menu_items)->contents[menu_items_used++] = Qnil; | 200 | XVECTOR (menu_items)->contents[menu_items_used++] = Qnil; |
| 201 | menu_items_submenu_depth++; | 201 | menu_items_submenu_depth++; |
| 202 | } | 202 | } |
| @@ -206,9 +206,7 @@ push_submenu_start (void) | |||
| 206 | static void | 206 | static void |
| 207 | push_submenu_end (void) | 207 | push_submenu_end (void) |
| 208 | { | 208 | { |
| 209 | if (menu_items_used + 1 > menu_items_allocated) | 209 | ensure_menu_items (1); |
| 210 | grow_menu_items (); | ||
| 211 | |||
| 212 | XVECTOR (menu_items)->contents[menu_items_used++] = Qlambda; | 210 | XVECTOR (menu_items)->contents[menu_items_used++] = Qlambda; |
| 213 | menu_items_submenu_depth--; | 211 | menu_items_submenu_depth--; |
| 214 | } | 212 | } |
| @@ -220,9 +218,7 @@ push_submenu_end (void) | |||
| 220 | static void | 218 | static void |
| 221 | push_left_right_boundary (void) | 219 | push_left_right_boundary (void) |
| 222 | { | 220 | { |
| 223 | if (menu_items_used + 1 > menu_items_allocated) | 221 | ensure_menu_items (1); |
| 224 | grow_menu_items (); | ||
| 225 | |||
| 226 | XVECTOR (menu_items)->contents[menu_items_used++] = Qquote; | 222 | XVECTOR (menu_items)->contents[menu_items_used++] = Qquote; |
| 227 | } | 223 | } |
| 228 | 224 | ||
| @@ -232,9 +228,7 @@ push_left_right_boundary (void) | |||
| 232 | static void | 228 | static void |
| 233 | push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec) | 229 | push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec) |
| 234 | { | 230 | { |
| 235 | if (menu_items_used + MENU_ITEMS_PANE_LENGTH > menu_items_allocated) | 231 | ensure_menu_items (MENU_ITEMS_PANE_LENGTH); |
| 236 | grow_menu_items (); | ||
| 237 | |||
| 238 | if (menu_items_submenu_depth == 0) | 232 | if (menu_items_submenu_depth == 0) |
| 239 | menu_items_n_panes++; | 233 | menu_items_n_panes++; |
| 240 | XVECTOR (menu_items)->contents[menu_items_used++] = Qt; | 234 | XVECTOR (menu_items)->contents[menu_items_used++] = Qt; |
| @@ -253,8 +247,7 @@ push_menu_pane (Lisp_Object name, Lisp_Object prefix_vec) | |||
| 253 | static void | 247 | static void |
| 254 | push_menu_item (Lisp_Object name, Lisp_Object enable, Lisp_Object key, Lisp_Object def, Lisp_Object equiv, Lisp_Object type, Lisp_Object selected, Lisp_Object help) | 248 | push_menu_item (Lisp_Object name, Lisp_Object enable, Lisp_Object key, Lisp_Object def, Lisp_Object equiv, Lisp_Object type, Lisp_Object selected, Lisp_Object help) |
| 255 | { | 249 | { |
| 256 | if (menu_items_used + MENU_ITEMS_ITEM_LENGTH > menu_items_allocated) | 250 | ensure_menu_items (MENU_ITEMS_ITEM_LENGTH); |
| 257 | grow_menu_items (); | ||
| 258 | 251 | ||
| 259 | ASET (menu_items, menu_items_used + MENU_ITEMS_ITEM_NAME, name); | 252 | ASET (menu_items, menu_items_used + MENU_ITEMS_ITEM_NAME, name); |
| 260 | ASET (menu_items, menu_items_used + MENU_ITEMS_ITEM_ENABLE, enable); | 253 | ASET (menu_items, menu_items_used + MENU_ITEMS_ITEM_ENABLE, enable); |
| @@ -458,9 +451,9 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk | |||
| 458 | and generate menu panes for them in menu_items. */ | 451 | and generate menu panes for them in menu_items. */ |
| 459 | 452 | ||
| 460 | static void | 453 | static void |
| 461 | keymap_panes (Lisp_Object *keymaps, int nmaps) | 454 | keymap_panes (Lisp_Object *keymaps, ptrdiff_t nmaps) |
| 462 | { | 455 | { |
| 463 | int mapno; | 456 | ptrdiff_t mapno; |
| 464 | 457 | ||
| 465 | init_menu_items (); | 458 | init_menu_items (); |
| 466 | 459 | ||
| @@ -532,16 +525,17 @@ int | |||
| 532 | parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) | 525 | parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) |
| 533 | { | 526 | { |
| 534 | Lisp_Object length; | 527 | Lisp_Object length; |
| 535 | int len; | 528 | EMACS_INT len; |
| 536 | Lisp_Object *mapvec; | 529 | Lisp_Object *mapvec; |
| 537 | int i; | 530 | ptrdiff_t i; |
| 538 | int top_level_items = 0; | 531 | int top_level_items = 0; |
| 532 | USE_SAFE_ALLOCA; | ||
| 539 | 533 | ||
| 540 | length = Flength (maps); | 534 | length = Flength (maps); |
| 541 | len = XINT (length); | 535 | len = XINT (length); |
| 542 | 536 | ||
| 543 | /* Convert the list MAPS into a vector MAPVEC. */ | 537 | /* Convert the list MAPS into a vector MAPVEC. */ |
| 544 | mapvec = (Lisp_Object *) alloca (len * sizeof (Lisp_Object)); | 538 | SAFE_ALLOCA_LISP (mapvec, len); |
| 545 | for (i = 0; i < len; i++) | 539 | for (i = 0; i < len; i++) |
| 546 | { | 540 | { |
| 547 | mapvec[i] = Fcar (maps); | 541 | mapvec[i] = Fcar (maps); |
| @@ -571,6 +565,7 @@ parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object m | |||
| 571 | } | 565 | } |
| 572 | } | 566 | } |
| 573 | 567 | ||
| 568 | SAFE_FREE (); | ||
| 574 | return top_level_items; | 569 | return top_level_items; |
| 575 | } | 570 | } |
| 576 | 571 | ||
| @@ -1006,7 +1001,7 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data) | |||
| 1006 | { | 1001 | { |
| 1007 | entry | 1002 | entry |
| 1008 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; | 1003 | = XVECTOR (menu_items)->contents[i + MENU_ITEMS_ITEM_VALUE]; |
| 1009 | if ((EMACS_INT)client_data == (EMACS_INT)(&XVECTOR (menu_items)->contents[i])) | 1004 | if (&XVECTOR (menu_items)->contents[i] == client_data) |
| 1010 | { | 1005 | { |
| 1011 | if (keymaps != 0) | 1006 | if (keymaps != 0) |
| 1012 | { | 1007 | { |
| @@ -1082,7 +1077,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1082 | Lisp_Object x, y, window; | 1077 | Lisp_Object x, y, window; |
| 1083 | int keymaps = 0; | 1078 | int keymaps = 0; |
| 1084 | int for_click = 0; | 1079 | int for_click = 0; |
| 1085 | int specpdl_count = SPECPDL_INDEX (); | 1080 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 1086 | struct gcpro gcpro1; | 1081 | struct gcpro gcpro1; |
| 1087 | 1082 | ||
| 1088 | if (NILP (position)) | 1083 | if (NILP (position)) |
| @@ -1175,9 +1170,6 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1175 | } | 1170 | } |
| 1176 | } | 1171 | } |
| 1177 | 1172 | ||
| 1178 | CHECK_NUMBER (x); | ||
| 1179 | CHECK_NUMBER (y); | ||
| 1180 | |||
| 1181 | /* Decode where to put the menu. */ | 1173 | /* Decode where to put the menu. */ |
| 1182 | 1174 | ||
| 1183 | if (FRAMEP (window)) | 1175 | if (FRAMEP (window)) |
| @@ -1200,6 +1192,14 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1200 | but I don't want to make one now. */ | 1192 | but I don't want to make one now. */ |
| 1201 | CHECK_WINDOW (window); | 1193 | CHECK_WINDOW (window); |
| 1202 | 1194 | ||
| 1195 | CHECK_RANGED_INTEGER ((xpos < INT_MIN - MOST_NEGATIVE_FIXNUM | ||
| 1196 | ? (EMACS_INT) INT_MIN - xpos | ||
| 1197 | : MOST_NEGATIVE_FIXNUM), | ||
| 1198 | x, INT_MAX - xpos); | ||
| 1199 | CHECK_RANGED_INTEGER ((ypos < INT_MIN - MOST_NEGATIVE_FIXNUM | ||
| 1200 | ? (EMACS_INT) INT_MIN - ypos | ||
| 1201 | : MOST_NEGATIVE_FIXNUM), | ||
| 1202 | y, INT_MAX - ypos); | ||
| 1203 | xpos += XINT (x); | 1203 | xpos += XINT (x); |
| 1204 | ypos += XINT (y); | 1204 | ypos += XINT (y); |
| 1205 | 1205 | ||
| @@ -1248,11 +1248,12 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1248 | else if (CONSP (menu) && KEYMAPP (XCAR (menu))) | 1248 | else if (CONSP (menu) && KEYMAPP (XCAR (menu))) |
| 1249 | { | 1249 | { |
| 1250 | /* We were given a list of keymaps. */ | 1250 | /* We were given a list of keymaps. */ |
| 1251 | int nmaps = XFASTINT (Flength (menu)); | 1251 | EMACS_INT nmaps = XFASTINT (Flength (menu)); |
| 1252 | Lisp_Object *maps | 1252 | Lisp_Object *maps; |
| 1253 | = (Lisp_Object *) alloca (nmaps * sizeof (Lisp_Object)); | 1253 | ptrdiff_t i; |
| 1254 | int i; | 1254 | USE_SAFE_ALLOCA; |
| 1255 | 1255 | ||
| 1256 | SAFE_ALLOCA_LISP (maps, nmaps); | ||
| 1256 | title = Qnil; | 1257 | title = Qnil; |
| 1257 | 1258 | ||
| 1258 | /* The first keymap that has a prompt string | 1259 | /* The first keymap that has a prompt string |
| @@ -1276,6 +1277,8 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1276 | ASET (menu_items, MENU_ITEMS_PANE_NAME, title); | 1277 | ASET (menu_items, MENU_ITEMS_PANE_NAME, title); |
| 1277 | 1278 | ||
| 1278 | keymaps = 1; | 1279 | keymaps = 1; |
| 1280 | |||
| 1281 | SAFE_FREE (); | ||
| 1279 | } | 1282 | } |
| 1280 | else | 1283 | else |
| 1281 | { | 1284 | { |
diff --git a/src/minibuf.c b/src/minibuf.c index d3f43b06254..66b9a8a1e49 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -89,7 +89,7 @@ static Lisp_Object minibuf_prompt; | |||
| 89 | /* Width of current mini-buffer prompt. Only set after display_line | 89 | /* Width of current mini-buffer prompt. Only set after display_line |
| 90 | of the line that contains the prompt. */ | 90 | of the line that contains the prompt. */ |
| 91 | 91 | ||
| 92 | static EMACS_INT minibuf_prompt_width; | 92 | static ptrdiff_t minibuf_prompt_width; |
| 93 | 93 | ||
| 94 | 94 | ||
| 95 | /* Put minibuf on currently selected frame's minibuffer. | 95 | /* Put minibuf on currently selected frame's minibuffer. |
| @@ -172,7 +172,7 @@ without invoking the usual minibuffer commands. */) | |||
| 172 | static Lisp_Object read_minibuf_unwind (Lisp_Object); | 172 | static Lisp_Object read_minibuf_unwind (Lisp_Object); |
| 173 | static Lisp_Object run_exit_minibuf_hook (Lisp_Object); | 173 | static Lisp_Object run_exit_minibuf_hook (Lisp_Object); |
| 174 | static Lisp_Object read_minibuf (Lisp_Object, Lisp_Object, | 174 | static Lisp_Object read_minibuf (Lisp_Object, Lisp_Object, |
| 175 | Lisp_Object, Lisp_Object, | 175 | Lisp_Object, |
| 176 | int, Lisp_Object, | 176 | int, Lisp_Object, |
| 177 | Lisp_Object, Lisp_Object, | 177 | Lisp_Object, Lisp_Object, |
| 178 | int, int); | 178 | int, int); |
| @@ -192,7 +192,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt) | |||
| 192 | { | 192 | { |
| 193 | struct gcpro gcpro1, gcpro2; | 193 | struct gcpro gcpro1, gcpro2; |
| 194 | Lisp_Object expr_and_pos; | 194 | Lisp_Object expr_and_pos; |
| 195 | EMACS_INT pos; | 195 | ptrdiff_t pos; |
| 196 | 196 | ||
| 197 | GCPRO2 (val, defalt); | 197 | GCPRO2 (val, defalt); |
| 198 | 198 | ||
| @@ -210,7 +210,7 @@ string_to_object (Lisp_Object val, Lisp_Object defalt) | |||
| 210 | { | 210 | { |
| 211 | /* Ignore trailing whitespace; any other trailing junk | 211 | /* Ignore trailing whitespace; any other trailing junk |
| 212 | is an error. */ | 212 | is an error. */ |
| 213 | EMACS_INT i; | 213 | ptrdiff_t i; |
| 214 | pos = string_char_to_byte (val, pos); | 214 | pos = string_char_to_byte (val, pos); |
| 215 | for (i = pos; i < SBYTES (val); i++) | 215 | for (i = pos; i < SBYTES (val); i++) |
| 216 | { | 216 | { |
| @@ -335,7 +335,7 @@ DEFUN ("minibuffer-contents", Fminibuffer_contents, | |||
| 335 | If the current buffer is not a minibuffer, return its entire contents. */) | 335 | If the current buffer is not a minibuffer, return its entire contents. */) |
| 336 | (void) | 336 | (void) |
| 337 | { | 337 | { |
| 338 | EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ()); | 338 | ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ()); |
| 339 | return make_buffer_string (prompt_end, ZV, 1); | 339 | return make_buffer_string (prompt_end, ZV, 1); |
| 340 | } | 340 | } |
| 341 | 341 | ||
| @@ -345,7 +345,7 @@ DEFUN ("minibuffer-contents-no-properties", Fminibuffer_contents_no_properties, | |||
| 345 | If the current buffer is not a minibuffer, return its entire contents. */) | 345 | If the current buffer is not a minibuffer, return its entire contents. */) |
| 346 | (void) | 346 | (void) |
| 347 | { | 347 | { |
| 348 | EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ()); | 348 | ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ()); |
| 349 | return make_buffer_string (prompt_end, ZV, 0); | 349 | return make_buffer_string (prompt_end, ZV, 0); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| @@ -356,7 +356,7 @@ That is what completion commands operate on. | |||
| 356 | If the current buffer is not a minibuffer, return its entire contents. */) | 356 | If the current buffer is not a minibuffer, return its entire contents. */) |
| 357 | (void) | 357 | (void) |
| 358 | { | 358 | { |
| 359 | EMACS_INT prompt_end = XINT (Fminibuffer_prompt_end ()); | 359 | ptrdiff_t prompt_end = XINT (Fminibuffer_prompt_end ()); |
| 360 | if (PT < prompt_end) | 360 | if (PT < prompt_end) |
| 361 | error ("Cannot do completion in the prompt"); | 361 | error ("Cannot do completion in the prompt"); |
| 362 | return make_buffer_string (prompt_end, PT, 1); | 362 | return make_buffer_string (prompt_end, PT, 1); |
| @@ -388,16 +388,16 @@ If the current buffer is not a minibuffer, return its entire contents. */) | |||
| 388 | 388 | ||
| 389 | static Lisp_Object | 389 | static Lisp_Object |
| 390 | read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | 390 | read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, |
| 391 | Lisp_Object backup_n, int expflag, | 391 | int expflag, |
| 392 | Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt, | 392 | Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt, |
| 393 | int allow_props, int inherit_input_method) | 393 | int allow_props, int inherit_input_method) |
| 394 | { | 394 | { |
| 395 | Lisp_Object val; | 395 | Lisp_Object val; |
| 396 | int count = SPECPDL_INDEX (); | 396 | ptrdiff_t count = SPECPDL_INDEX (); |
| 397 | Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; | 397 | Lisp_Object mini_frame, ambient_dir, minibuffer, input_method; |
| 398 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | 398 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 399 | Lisp_Object enable_multibyte; | 399 | Lisp_Object enable_multibyte; |
| 400 | int pos = INTEGERP (backup_n) ? XINT (backup_n) : 0; | 400 | EMACS_INT pos = 0; |
| 401 | /* String to add to the history. */ | 401 | /* String to add to the history. */ |
| 402 | Lisp_Object histstring; | 402 | Lisp_Object histstring; |
| 403 | 403 | ||
| @@ -423,7 +423,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 423 | { | 423 | { |
| 424 | if (CONSP (initial)) | 424 | if (CONSP (initial)) |
| 425 | { | 425 | { |
| 426 | backup_n = Fcdr (initial); | 426 | Lisp_Object backup_n = Fcdr (initial); |
| 427 | initial = Fcar (initial); | 427 | initial = Fcar (initial); |
| 428 | CHECK_STRING (initial); | 428 | CHECK_STRING (initial); |
| 429 | if (!NILP (backup_n)) | 429 | if (!NILP (backup_n)) |
| @@ -624,7 +624,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, | |||
| 624 | 624 | ||
| 625 | /* Erase the buffer. */ | 625 | /* Erase the buffer. */ |
| 626 | { | 626 | { |
| 627 | int count1 = SPECPDL_INDEX (); | 627 | ptrdiff_t count1 = SPECPDL_INDEX (); |
| 628 | specbind (Qinhibit_read_only, Qt); | 628 | specbind (Qinhibit_read_only, Qt); |
| 629 | specbind (Qinhibit_modification_hooks, Qt); | 629 | specbind (Qinhibit_modification_hooks, Qt); |
| 630 | Ferase_buffer (); | 630 | Ferase_buffer (); |
| @@ -798,7 +798,7 @@ get_minibuffer (EMACS_INT depth) | |||
| 798 | } | 798 | } |
| 799 | else | 799 | else |
| 800 | { | 800 | { |
| 801 | int count = SPECPDL_INDEX (); | 801 | ptrdiff_t count = SPECPDL_INDEX (); |
| 802 | /* `reset_buffer' blindly sets the list of overlays to NULL, so we | 802 | /* `reset_buffer' blindly sets the list of overlays to NULL, so we |
| 803 | have to empty the list, otherwise we end up with overlays that | 803 | have to empty the list, otherwise we end up with overlays that |
| 804 | think they belong to this buffer while the buffer doesn't know about | 804 | think they belong to this buffer while the buffer doesn't know about |
| @@ -866,7 +866,7 @@ read_minibuf_unwind (Lisp_Object data) | |||
| 866 | 866 | ||
| 867 | /* Erase the minibuffer we were using at this level. */ | 867 | /* Erase the minibuffer we were using at this level. */ |
| 868 | { | 868 | { |
| 869 | int count = SPECPDL_INDEX (); | 869 | ptrdiff_t count = SPECPDL_INDEX (); |
| 870 | /* Prevent error in erase-buffer. */ | 870 | /* Prevent error in erase-buffer. */ |
| 871 | specbind (Qinhibit_read_only, Qt); | 871 | specbind (Qinhibit_read_only, Qt); |
| 872 | specbind (Qinhibit_modification_hooks, Qt); | 872 | specbind (Qinhibit_modification_hooks, Qt); |
| @@ -964,7 +964,7 @@ and some related functions, which use zero-indexing for POSITION. */) | |||
| 964 | 964 | ||
| 965 | GCPRO1 (default_value); | 965 | GCPRO1 (default_value); |
| 966 | val = read_minibuf (keymap, initial_contents, prompt, | 966 | val = read_minibuf (keymap, initial_contents, prompt, |
| 967 | Qnil, !NILP (read), | 967 | !NILP (read), |
| 968 | histvar, histpos, default_value, | 968 | histvar, histpos, default_value, |
| 969 | minibuffer_allow_text_properties, | 969 | minibuffer_allow_text_properties, |
| 970 | !NILP (inherit_input_method)); | 970 | !NILP (inherit_input_method)); |
| @@ -982,7 +982,7 @@ Such arguments are used as in `read-from-minibuffer'.) */) | |||
| 982 | { | 982 | { |
| 983 | CHECK_STRING (prompt); | 983 | CHECK_STRING (prompt); |
| 984 | return read_minibuf (Vminibuffer_local_map, initial_contents, | 984 | return read_minibuf (Vminibuffer_local_map, initial_contents, |
| 985 | prompt, Qnil, 1, Qminibuffer_history, | 985 | prompt, 1, Qminibuffer_history, |
| 986 | make_number (0), Qnil, 0, 0); | 986 | make_number (0), Qnil, 0, 0); |
| 987 | } | 987 | } |
| 988 | 988 | ||
| @@ -995,7 +995,7 @@ Such arguments are used as in `read-from-minibuffer'.) */) | |||
| 995 | (Lisp_Object prompt, Lisp_Object initial_contents) | 995 | (Lisp_Object prompt, Lisp_Object initial_contents) |
| 996 | { | 996 | { |
| 997 | return Feval (read_minibuf (Vread_expression_map, initial_contents, | 997 | return Feval (read_minibuf (Vread_expression_map, initial_contents, |
| 998 | prompt, Qnil, 1, Qread_expression_history, | 998 | prompt, 1, Qread_expression_history, |
| 999 | make_number (0), Qnil, 0, 0), | 999 | make_number (0), Qnil, 0, 0), |
| 1000 | Qnil); | 1000 | Qnil); |
| 1001 | } | 1001 | } |
| @@ -1041,7 +1041,7 @@ the current input method and the setting of`enable-multibyte-characters'. */) | |||
| 1041 | (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method) | 1041 | (Lisp_Object prompt, Lisp_Object initial, Lisp_Object inherit_input_method) |
| 1042 | { | 1042 | { |
| 1043 | CHECK_STRING (prompt); | 1043 | CHECK_STRING (prompt); |
| 1044 | return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, Qnil, | 1044 | return read_minibuf (Vminibuffer_local_ns_map, initial, prompt, |
| 1045 | 0, Qminibuffer_history, make_number (0), Qnil, 0, | 1045 | 0, Qminibuffer_history, make_number (0), Qnil, 0, |
| 1046 | !NILP (inherit_input_method)); | 1046 | !NILP (inherit_input_method)); |
| 1047 | } | 1047 | } |
| @@ -1121,7 +1121,7 @@ function, instead of the usual behavior. */) | |||
| 1121 | Lisp_Object args[4], result; | 1121 | Lisp_Object args[4], result; |
| 1122 | char *s; | 1122 | char *s; |
| 1123 | ptrdiff_t len; | 1123 | ptrdiff_t len; |
| 1124 | int count = SPECPDL_INDEX (); | 1124 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1125 | 1125 | ||
| 1126 | if (BUFFERP (def)) | 1126 | if (BUFFERP (def)) |
| 1127 | def = BVAR (XBUFFER (def), name); | 1127 | def = BVAR (XBUFFER (def), name); |
| @@ -1220,9 +1220,9 @@ is used to further constrain the set of candidates. */) | |||
| 1220 | { | 1220 | { |
| 1221 | Lisp_Object bestmatch, tail, elt, eltstring; | 1221 | Lisp_Object bestmatch, tail, elt, eltstring; |
| 1222 | /* Size in bytes of BESTMATCH. */ | 1222 | /* Size in bytes of BESTMATCH. */ |
| 1223 | int bestmatchsize = 0; | 1223 | ptrdiff_t bestmatchsize = 0; |
| 1224 | /* These are in bytes, too. */ | 1224 | /* These are in bytes, too. */ |
| 1225 | int compare, matchsize; | 1225 | ptrdiff_t compare, matchsize; |
| 1226 | enum { function_table, list_table, obarray_table, hash_table} | 1226 | enum { function_table, list_table, obarray_table, hash_table} |
| 1227 | type = (HASH_TABLE_P (collection) ? hash_table | 1227 | type = (HASH_TABLE_P (collection) ? hash_table |
| 1228 | : VECTORP (collection) ? obarray_table | 1228 | : VECTORP (collection) ? obarray_table |
| @@ -1231,9 +1231,9 @@ is used to further constrain the set of candidates. */) | |||
| 1231 | && (!SYMBOLP (XCAR (collection)) | 1231 | && (!SYMBOLP (XCAR (collection)) |
| 1232 | || NILP (XCAR (collection))))) | 1232 | || NILP (XCAR (collection))))) |
| 1233 | ? list_table : function_table)); | 1233 | ? list_table : function_table)); |
| 1234 | EMACS_INT idx = 0, obsize = 0; | 1234 | ptrdiff_t idx = 0, obsize = 0; |
| 1235 | int matchcount = 0; | 1235 | int matchcount = 0; |
| 1236 | int bindcount = -1; | 1236 | ptrdiff_t bindcount = -1; |
| 1237 | Lisp_Object bucket, zero, end, tem; | 1237 | Lisp_Object bucket, zero, end, tem; |
| 1238 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1238 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 1239 | 1239 | ||
| @@ -1496,8 +1496,8 @@ with a space are ignored unless STRING itself starts with a space. */) | |||
| 1496 | : NILP (collection) || (CONSP (collection) | 1496 | : NILP (collection) || (CONSP (collection) |
| 1497 | && (!SYMBOLP (XCAR (collection)) | 1497 | && (!SYMBOLP (XCAR (collection)) |
| 1498 | || NILP (XCAR (collection)))); | 1498 | || NILP (XCAR (collection)))); |
| 1499 | EMACS_INT idx = 0, obsize = 0; | 1499 | ptrdiff_t idx = 0, obsize = 0; |
| 1500 | int bindcount = -1; | 1500 | ptrdiff_t bindcount = -1; |
| 1501 | Lisp_Object bucket, tem, zero; | 1501 | Lisp_Object bucket, tem, zero; |
| 1502 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 1502 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 1503 | 1503 | ||
| @@ -1806,7 +1806,7 @@ the values STRING, PREDICATE and `lambda'. */) | |||
| 1806 | /* Reject this element if it fails to match all the regexps. */ | 1806 | /* Reject this element if it fails to match all the regexps. */ |
| 1807 | if (CONSP (Vcompletion_regexp_list)) | 1807 | if (CONSP (Vcompletion_regexp_list)) |
| 1808 | { | 1808 | { |
| 1809 | int count = SPECPDL_INDEX (); | 1809 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1810 | specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); | 1810 | specbind (Qcase_fold_search, completion_ignore_case ? Qt : Qnil); |
| 1811 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); | 1811 | for (regexps = Vcompletion_regexp_list; CONSP (regexps); |
| 1812 | regexps = XCDR (regexps)) | 1812 | regexps = XCDR (regexps)) |
diff --git a/src/nsfns.m b/src/nsfns.m index a09011d8461..80da9d7a9ac 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -165,7 +165,7 @@ check_ns_display_info (Lisp_Object frame) | |||
| 165 | struct terminal *t = get_terminal (frame, 1); | 165 | struct terminal *t = get_terminal (frame, 1); |
| 166 | 166 | ||
| 167 | if (t->type != output_ns) | 167 | if (t->type != output_ns) |
| 168 | error ("Terminal %ld is not a Nextstep display", (long) XINT (frame)); | 168 | error ("Terminal %"pI"d is not a Nextstep display", XINT (frame)); |
| 169 | 169 | ||
| 170 | return t->display_info.ns; | 170 | return t->display_info.ns; |
| 171 | } | 171 | } |
| @@ -706,7 +706,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 706 | if (FRAME_MINIBUF_ONLY_P (f)) | 706 | if (FRAME_MINIBUF_ONLY_P (f)) |
| 707 | return; | 707 | return; |
| 708 | 708 | ||
| 709 | if (INTEGERP (value)) | 709 | if (TYPE_RANGED_INTEGERP (int, value)) |
| 710 | nlines = XINT (value); | 710 | nlines = XINT (value); |
| 711 | else | 711 | else |
| 712 | nlines = 0; | 712 | nlines = 0; |
| @@ -738,7 +738,7 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 738 | if (FRAME_MINIBUF_ONLY_P (f)) | 738 | if (FRAME_MINIBUF_ONLY_P (f)) |
| 739 | return; | 739 | return; |
| 740 | 740 | ||
| 741 | if (INTEGERP (value) && XINT (value) >= 0) | 741 | if (RANGED_INTEGERP (0, value, INT_MAX)) |
| 742 | nlines = XFASTINT (value); | 742 | nlines = XFASTINT (value); |
| 743 | else | 743 | else |
| 744 | nlines = 0; | 744 | nlines = 0; |
| @@ -1062,7 +1062,7 @@ be shared by the new frame. */) | |||
| 1062 | Lisp_Object frame, tem; | 1062 | Lisp_Object frame, tem; |
| 1063 | Lisp_Object name; | 1063 | Lisp_Object name; |
| 1064 | int minibuffer_only = 0; | 1064 | int minibuffer_only = 0; |
| 1065 | int count = specpdl_ptr - specpdl; | 1065 | ptrdiff_t count = specpdl_ptr - specpdl; |
| 1066 | Lisp_Object display; | 1066 | Lisp_Object display; |
| 1067 | struct ns_display_info *dpyinfo = NULL; | 1067 | struct ns_display_info *dpyinfo = NULL; |
| 1068 | Lisp_Object parent; | 1068 | Lisp_Object parent; |
| @@ -1163,9 +1163,9 @@ be shared by the new frame. */) | |||
| 1163 | FRAME_NS_DISPLAY_INFO (f) = dpyinfo; | 1163 | FRAME_NS_DISPLAY_INFO (f) = dpyinfo; |
| 1164 | 1164 | ||
| 1165 | f->output_data.ns->window_desc = desc_ctr++; | 1165 | f->output_data.ns->window_desc = desc_ctr++; |
| 1166 | if (!NILP (parent)) | 1166 | if (TYPE_RANGED_INTEGERP (Window, parent)) |
| 1167 | { | 1167 | { |
| 1168 | f->output_data.ns->parent_desc = (Window) XFASTINT (parent); | 1168 | f->output_data.ns->parent_desc = XFASTINT (parent); |
| 1169 | f->output_data.ns->explicit_parent = 1; | 1169 | f->output_data.ns->explicit_parent = 1; |
| 1170 | } | 1170 | } |
| 1171 | else | 1171 | else |
| @@ -2486,7 +2486,7 @@ Text larger than the specified size is clipped. */) | |||
| 2486 | { | 2486 | { |
| 2487 | int root_x, root_y; | 2487 | int root_x, root_y; |
| 2488 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 2488 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 2489 | int count = SPECPDL_INDEX (); | 2489 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2490 | struct frame *f; | 2490 | struct frame *f; |
| 2491 | char *str; | 2491 | char *str; |
| 2492 | NSSize size; | 2492 | NSSize size; |
diff --git a/src/nsfont.m b/src/nsfont.m index c4d9123faef..ca94b07a6bd 100644 --- a/src/nsfont.m +++ b/src/nsfont.m | |||
| @@ -549,8 +549,8 @@ ns_findfonts (Lisp_Object font_spec, BOOL isMatch) | |||
| 549 | return ns_fallback_entity (); | 549 | return ns_fallback_entity (); |
| 550 | 550 | ||
| 551 | if (NSFONT_TRACE) | 551 | if (NSFONT_TRACE) |
| 552 | fprintf (stderr, " Returning %ld entities.\n", | 552 | fprintf (stderr, " Returning %"pI"d entities.\n", |
| 553 | (long) XINT (Flength (list))); | 553 | XINT (Flength (list))); |
| 554 | 554 | ||
| 555 | return list; | 555 | return list; |
| 556 | } | 556 | } |
| @@ -656,8 +656,8 @@ nsfont_list_family (Lisp_Object frame) | |||
| 656 | /* FIXME: escape the name? */ | 656 | /* FIXME: escape the name? */ |
| 657 | 657 | ||
| 658 | if (NSFONT_TRACE) | 658 | if (NSFONT_TRACE) |
| 659 | fprintf (stderr, "nsfont: list families returning %ld entries\n", | 659 | fprintf (stderr, "nsfont: list families returning %"pI"d entries\n", |
| 660 | (long) XINT (Flength (list))); | 660 | XINT (Flength (list))); |
| 661 | 661 | ||
| 662 | return list; | 662 | return list; |
| 663 | } | 663 | } |
diff --git a/src/nsmenu.m b/src/nsmenu.m index 951282910ac..644576ae559 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m | |||
| @@ -182,7 +182,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 182 | int *submenu_top_level_items, *submenu_n_panes; | 182 | int *submenu_top_level_items, *submenu_n_panes; |
| 183 | struct buffer *prev = current_buffer; | 183 | struct buffer *prev = current_buffer; |
| 184 | Lisp_Object buffer; | 184 | Lisp_Object buffer; |
| 185 | int specpdl_count = SPECPDL_INDEX (); | 185 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 186 | int previous_menu_items_used = f->menu_bar_items_used; | 186 | int previous_menu_items_used = f->menu_bar_items_used; |
| 187 | Lisp_Object *previous_items | 187 | Lisp_Object *previous_items |
| 188 | = (Lisp_Object *) alloca (previous_menu_items_used | 188 | = (Lisp_Object *) alloca (previous_menu_items_used |
| @@ -449,7 +449,7 @@ ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) | |||
| 449 | wv->enabled = 1; | 449 | wv->enabled = 1; |
| 450 | wv->button_type = BUTTON_TYPE_NONE; | 450 | wv->button_type = BUTTON_TYPE_NONE; |
| 451 | wv->help = Qnil; | 451 | wv->help = Qnil; |
| 452 | wv->call_data = (void *) (EMACS_INT) (-1); | 452 | wv->call_data = (void *) (intptr_t) (-1); |
| 453 | 453 | ||
| 454 | #ifdef NS_IMPL_COCOA | 454 | #ifdef NS_IMPL_COCOA |
| 455 | /* we'll update the real copy under app menu when time comes */ | 455 | /* we'll update the real copy under app menu when time comes */ |
| @@ -763,7 +763,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 763 | EmacsMenu *pmenu; | 763 | EmacsMenu *pmenu; |
| 764 | NSPoint p; | 764 | NSPoint p; |
| 765 | Lisp_Object window, tem, keymap; | 765 | Lisp_Object window, tem, keymap; |
| 766 | int specpdl_count = SPECPDL_INDEX (); | 766 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 767 | widget_value *wv, *first_wv = 0; | 767 | widget_value *wv, *first_wv = 0; |
| 768 | 768 | ||
| 769 | p.x = x; p.y = y; | 769 | p.x = x; p.y = y; |
| @@ -1400,7 +1400,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) | |||
| 1400 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents | 1400 | dialog = [[EmacsDialogPanel alloc] initFromContents: contents |
| 1401 | isQuestion: isQ]; | 1401 | isQuestion: isQ]; |
| 1402 | { | 1402 | { |
| 1403 | int specpdl_count = SPECPDL_INDEX (); | 1403 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 1404 | record_unwind_protect (pop_down_menu, make_save_value (dialog, 0)); | 1404 | record_unwind_protect (pop_down_menu, make_save_value (dialog, 0)); |
| 1405 | popup_activated_flag = 1; | 1405 | popup_activated_flag = 1; |
| 1406 | tem = [dialog runDialogAt: p]; | 1406 | tem = [dialog runDialogAt: p]; |
diff --git a/src/nsselect.m b/src/nsselect.m index 867cf3252e5..655fedc640c 100644 --- a/src/nsselect.m +++ b/src/nsselect.m | |||
| @@ -181,7 +181,7 @@ ns_get_local_selection (Lisp_Object selection_name, | |||
| 181 | { | 181 | { |
| 182 | Lisp_Object local_value; | 182 | Lisp_Object local_value; |
| 183 | Lisp_Object handler_fn, value, type, check; | 183 | Lisp_Object handler_fn, value, type, check; |
| 184 | int count; | 184 | ptrdiff_t count; |
| 185 | 185 | ||
| 186 | local_value = assq_no_quit (selection_name, Vselection_alist); | 186 | local_value = assq_no_quit (selection_name, Vselection_alist); |
| 187 | 187 | ||
diff --git a/src/print.c b/src/print.c index 62bd048cf97..28b3dd7cba5 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -69,11 +69,11 @@ static Lisp_Object being_printed[PRINT_CIRCLE]; | |||
| 69 | static char *print_buffer; | 69 | static char *print_buffer; |
| 70 | 70 | ||
| 71 | /* Size allocated in print_buffer. */ | 71 | /* Size allocated in print_buffer. */ |
| 72 | static EMACS_INT print_buffer_size; | 72 | static ptrdiff_t print_buffer_size; |
| 73 | /* Chars stored in print_buffer. */ | 73 | /* Chars stored in print_buffer. */ |
| 74 | static EMACS_INT print_buffer_pos; | 74 | static ptrdiff_t print_buffer_pos; |
| 75 | /* Bytes stored in print_buffer. */ | 75 | /* Bytes stored in print_buffer. */ |
| 76 | static EMACS_INT print_buffer_pos_byte; | 76 | static ptrdiff_t print_buffer_pos_byte; |
| 77 | 77 | ||
| 78 | Lisp_Object Qprint_escape_newlines; | 78 | Lisp_Object Qprint_escape_newlines; |
| 79 | static Lisp_Object Qprint_escape_multibyte, Qprint_escape_nonascii; | 79 | static Lisp_Object Qprint_escape_multibyte, Qprint_escape_nonascii; |
| @@ -104,9 +104,9 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; | |||
| 104 | 104 | ||
| 105 | #define PRINTDECLARE \ | 105 | #define PRINTDECLARE \ |
| 106 | struct buffer *old = current_buffer; \ | 106 | struct buffer *old = current_buffer; \ |
| 107 | EMACS_INT old_point = -1, start_point = -1; \ | 107 | ptrdiff_t old_point = -1, start_point = -1; \ |
| 108 | EMACS_INT old_point_byte = -1, start_point_byte = -1; \ | 108 | ptrdiff_t old_point_byte = -1, start_point_byte = -1; \ |
| 109 | int specpdl_count = SPECPDL_INDEX (); \ | 109 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); \ |
| 110 | int free_print_buffer = 0; \ | 110 | int free_print_buffer = 0; \ |
| 111 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \ | 111 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); \ |
| 112 | Lisp_Object original | 112 | Lisp_Object original |
| @@ -122,7 +122,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; | |||
| 122 | } \ | 122 | } \ |
| 123 | if (MARKERP (printcharfun)) \ | 123 | if (MARKERP (printcharfun)) \ |
| 124 | { \ | 124 | { \ |
| 125 | EMACS_INT marker_pos; \ | 125 | ptrdiff_t marker_pos; \ |
| 126 | if (! XMARKER (printcharfun)->buffer) \ | 126 | if (! XMARKER (printcharfun)->buffer) \ |
| 127 | error ("Marker does not point anywhere"); \ | 127 | error ("Marker does not point anywhere"); \ |
| 128 | if (XMARKER (printcharfun)->buffer != current_buffer) \ | 128 | if (XMARKER (printcharfun)->buffer != current_buffer) \ |
| @@ -156,7 +156,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; | |||
| 156 | } \ | 156 | } \ |
| 157 | else \ | 157 | else \ |
| 158 | { \ | 158 | { \ |
| 159 | ptrdiff_t new_size = 1000; \ | 159 | int new_size = 1000; \ |
| 160 | print_buffer = (char *) xmalloc (new_size); \ | 160 | print_buffer = (char *) xmalloc (new_size); \ |
| 161 | print_buffer_size = new_size; \ | 161 | print_buffer_size = new_size; \ |
| 162 | free_print_buffer = 1; \ | 162 | free_print_buffer = 1; \ |
| @@ -173,12 +173,14 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1; | |||
| 173 | if (print_buffer_pos != print_buffer_pos_byte \ | 173 | if (print_buffer_pos != print_buffer_pos_byte \ |
| 174 | && NILP (BVAR (current_buffer, enable_multibyte_characters))) \ | 174 | && NILP (BVAR (current_buffer, enable_multibyte_characters))) \ |
| 175 | { \ | 175 | { \ |
| 176 | unsigned char *temp \ | 176 | USE_SAFE_ALLOCA; \ |
| 177 | = (unsigned char *) alloca (print_buffer_pos + 1); \ | 177 | unsigned char *temp; \ |
| 178 | SAFE_ALLOCA (temp, unsigned char *, print_buffer_pos + 1); \ | ||
| 178 | copy_text ((unsigned char *) print_buffer, temp, \ | 179 | copy_text ((unsigned char *) print_buffer, temp, \ |
| 179 | print_buffer_pos_byte, 1, 0); \ | 180 | print_buffer_pos_byte, 1, 0); \ |
| 180 | insert_1_both ((char *) temp, print_buffer_pos, \ | 181 | insert_1_both ((char *) temp, print_buffer_pos, \ |
| 181 | print_buffer_pos, 0, 1, 0); \ | 182 | print_buffer_pos, 0, 1, 0); \ |
| 183 | SAFE_FREE (); \ | ||
| 182 | } \ | 184 | } \ |
| 183 | else \ | 185 | else \ |
| 184 | insert_1_both (print_buffer, print_buffer_pos, \ | 186 | insert_1_both (print_buffer, print_buffer_pos, \ |
| @@ -233,15 +235,10 @@ printchar (unsigned int ch, Lisp_Object fun) | |||
| 233 | 235 | ||
| 234 | if (NILP (fun)) | 236 | if (NILP (fun)) |
| 235 | { | 237 | { |
| 236 | if (print_buffer_size - len <= print_buffer_pos_byte) | 238 | ptrdiff_t incr = len - (print_buffer_size - print_buffer_pos_byte); |
| 237 | { | 239 | if (0 < incr) |
| 238 | ptrdiff_t new_size; | 240 | print_buffer = |
| 239 | if (STRING_BYTES_BOUND / 2 < print_buffer_size) | 241 | xpalloc (print_buffer, &print_buffer_size, incr, -1, 1); |
| 240 | string_overflow (); | ||
| 241 | new_size = print_buffer_size * 2; | ||
| 242 | print_buffer = (char *) xrealloc (print_buffer, new_size); | ||
| 243 | print_buffer_size = new_size; | ||
| 244 | } | ||
| 245 | memcpy (print_buffer + print_buffer_pos_byte, str, len); | 242 | memcpy (print_buffer + print_buffer_pos_byte, str, len); |
| 246 | print_buffer_pos += 1; | 243 | print_buffer_pos += 1; |
| 247 | print_buffer_pos_byte += len; | 244 | print_buffer_pos_byte += len; |
| @@ -276,7 +273,7 @@ printchar (unsigned int ch, Lisp_Object fun) | |||
| 276 | to data in a Lisp string. Otherwise that is not safe. */ | 273 | to data in a Lisp string. Otherwise that is not safe. */ |
| 277 | 274 | ||
| 278 | static void | 275 | static void |
| 279 | strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, | 276 | strout (const char *ptr, ptrdiff_t size, ptrdiff_t size_byte, |
| 280 | Lisp_Object printcharfun) | 277 | Lisp_Object printcharfun) |
| 281 | { | 278 | { |
| 282 | if (size < 0) | 279 | if (size < 0) |
| @@ -284,15 +281,9 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, | |||
| 284 | 281 | ||
| 285 | if (NILP (printcharfun)) | 282 | if (NILP (printcharfun)) |
| 286 | { | 283 | { |
| 287 | if (print_buffer_size - size_byte < print_buffer_pos_byte) | 284 | ptrdiff_t incr = size_byte - (print_buffer_size - print_buffer_pos_byte); |
| 288 | { | 285 | if (0 < incr) |
| 289 | ptrdiff_t new_size; | 286 | print_buffer = xpalloc (print_buffer, &print_buffer_size, incr, -1, 1); |
| 290 | if (STRING_BYTES_BOUND / 2 - size_byte < print_buffer_size) | ||
| 291 | string_overflow (); | ||
| 292 | new_size = print_buffer_size * 2 + size_byte; | ||
| 293 | print_buffer = (char *) xrealloc (print_buffer, new_size); | ||
| 294 | print_buffer_size = new_size; | ||
| 295 | } | ||
| 296 | memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte); | 287 | memcpy (print_buffer + print_buffer_pos_byte, ptr, size_byte); |
| 297 | print_buffer_pos += size; | 288 | print_buffer_pos += size; |
| 298 | print_buffer_pos_byte += size_byte; | 289 | print_buffer_pos_byte += size_byte; |
| @@ -333,7 +324,7 @@ strout (const char *ptr, EMACS_INT size, EMACS_INT size_byte, | |||
| 333 | else | 324 | else |
| 334 | { | 325 | { |
| 335 | /* PRINTCHARFUN is a Lisp function. */ | 326 | /* PRINTCHARFUN is a Lisp function. */ |
| 336 | EMACS_INT i = 0; | 327 | ptrdiff_t i = 0; |
| 337 | 328 | ||
| 338 | if (size == size_byte) | 329 | if (size == size_byte) |
| 339 | { | 330 | { |
| @@ -369,7 +360,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) | |||
| 369 | { | 360 | { |
| 370 | if (EQ (printcharfun, Qt) || NILP (printcharfun)) | 361 | if (EQ (printcharfun, Qt) || NILP (printcharfun)) |
| 371 | { | 362 | { |
| 372 | EMACS_INT chars; | 363 | ptrdiff_t chars; |
| 373 | 364 | ||
| 374 | if (print_escape_nonascii) | 365 | if (print_escape_nonascii) |
| 375 | string = string_escape_byte8 (string); | 366 | string = string_escape_byte8 (string); |
| @@ -385,7 +376,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) | |||
| 385 | convert STRING to a multibyte string containing the same | 376 | convert STRING to a multibyte string containing the same |
| 386 | character codes. */ | 377 | character codes. */ |
| 387 | Lisp_Object newstr; | 378 | Lisp_Object newstr; |
| 388 | EMACS_INT bytes; | 379 | ptrdiff_t bytes; |
| 389 | 380 | ||
| 390 | chars = SBYTES (string); | 381 | chars = SBYTES (string); |
| 391 | bytes = count_size_as_multibyte (SDATA (string), chars); | 382 | bytes = count_size_as_multibyte (SDATA (string), chars); |
| @@ -403,7 +394,7 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) | |||
| 403 | if (EQ (printcharfun, Qt)) | 394 | if (EQ (printcharfun, Qt)) |
| 404 | { | 395 | { |
| 405 | /* Output to echo area. */ | 396 | /* Output to echo area. */ |
| 406 | EMACS_INT nbytes = SBYTES (string); | 397 | ptrdiff_t nbytes = SBYTES (string); |
| 407 | char *buffer; | 398 | char *buffer; |
| 408 | 399 | ||
| 409 | /* Copy the string contents so that relocation of STRING by | 400 | /* Copy the string contents so that relocation of STRING by |
| @@ -425,9 +416,9 @@ print_string (Lisp_Object string, Lisp_Object printcharfun) | |||
| 425 | { | 416 | { |
| 426 | /* Otherwise, string may be relocated by printing one char. | 417 | /* Otherwise, string may be relocated by printing one char. |
| 427 | So re-fetch the string address for each character. */ | 418 | So re-fetch the string address for each character. */ |
| 428 | EMACS_INT i; | 419 | ptrdiff_t i; |
| 429 | EMACS_INT size = SCHARS (string); | 420 | ptrdiff_t size = SCHARS (string); |
| 430 | EMACS_INT size_byte = SBYTES (string); | 421 | ptrdiff_t size_byte = SBYTES (string); |
| 431 | struct gcpro gcpro1; | 422 | struct gcpro gcpro1; |
| 432 | GCPRO1 (string); | 423 | GCPRO1 (string); |
| 433 | if (size == size_byte) | 424 | if (size == size_byte) |
| @@ -498,7 +489,7 @@ write_string_1 (const char *data, int size, Lisp_Object printcharfun) | |||
| 498 | void | 489 | void |
| 499 | temp_output_buffer_setup (const char *bufname) | 490 | temp_output_buffer_setup (const char *bufname) |
| 500 | { | 491 | { |
| 501 | int count = SPECPDL_INDEX (); | 492 | ptrdiff_t count = SPECPDL_INDEX (); |
| 502 | register struct buffer *old = current_buffer; | 493 | register struct buffer *old = current_buffer; |
| 503 | register Lisp_Object buf; | 494 | register Lisp_Object buf; |
| 504 | 495 | ||
| @@ -602,7 +593,7 @@ A printed representation of an object is text which describes that object. */) | |||
| 602 | Lisp_Object printcharfun; | 593 | Lisp_Object printcharfun; |
| 603 | /* struct gcpro gcpro1, gcpro2; */ | 594 | /* struct gcpro gcpro1, gcpro2; */ |
| 604 | Lisp_Object save_deactivate_mark; | 595 | Lisp_Object save_deactivate_mark; |
| 605 | int count = SPECPDL_INDEX (); | 596 | ptrdiff_t count = SPECPDL_INDEX (); |
| 606 | struct buffer *previous; | 597 | struct buffer *previous; |
| 607 | 598 | ||
| 608 | specbind (Qinhibit_modification_hooks, Qt); | 599 | specbind (Qinhibit_modification_hooks, Qt); |
| @@ -727,7 +718,7 @@ You can call print while debugging emacs, and pass it this function | |||
| 727 | to make it write to the debugging output. */) | 718 | to make it write to the debugging output. */) |
| 728 | (Lisp_Object character) | 719 | (Lisp_Object character) |
| 729 | { | 720 | { |
| 730 | CHECK_NUMBER (character); | 721 | CHECK_CHARACTER (character); |
| 731 | putc ((int) XINT (character), stderr); | 722 | putc ((int) XINT (character), stderr); |
| 732 | 723 | ||
| 733 | #ifdef WINDOWSNT | 724 | #ifdef WINDOWSNT |
| @@ -875,10 +866,13 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, | |||
| 875 | if (!NILP (caller) && SYMBOLP (caller)) | 866 | if (!NILP (caller) && SYMBOLP (caller)) |
| 876 | { | 867 | { |
| 877 | Lisp_Object cname = SYMBOL_NAME (caller); | 868 | Lisp_Object cname = SYMBOL_NAME (caller); |
| 878 | char *name = alloca (SBYTES (cname)); | 869 | char *name; |
| 870 | USE_SAFE_ALLOCA; | ||
| 871 | SAFE_ALLOCA (name, char *, SBYTES (cname)); | ||
| 879 | memcpy (name, SDATA (cname), SBYTES (cname)); | 872 | memcpy (name, SDATA (cname), SBYTES (cname)); |
| 880 | message_dolog (name, SBYTES (cname), 0, 0); | 873 | message_dolog (name, SBYTES (cname), 0, 0); |
| 881 | message_dolog (": ", 2, 0, 0); | 874 | message_dolog (": ", 2, 0, 0); |
| 875 | SAFE_FREE (); | ||
| 882 | } | 876 | } |
| 883 | 877 | ||
| 884 | errname = Fcar (data); | 878 | errname = Fcar (data); |
| @@ -1092,7 +1086,7 @@ print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag) | |||
| 1092 | Maybe a better way to do that is to copy elements to | 1086 | Maybe a better way to do that is to copy elements to |
| 1093 | a new hash table. */ | 1087 | a new hash table. */ |
| 1094 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vprint_number_table); | 1088 | struct Lisp_Hash_Table *h = XHASH_TABLE (Vprint_number_table); |
| 1095 | EMACS_INT i; | 1089 | ptrdiff_t i; |
| 1096 | 1090 | ||
| 1097 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) | 1091 | for (i = 0; i < HASH_TABLE_SIZE (h); ++i) |
| 1098 | if (!NILP (HASH_HASH (h, i)) | 1092 | if (!NILP (HASH_HASH (h, i)) |
| @@ -1126,7 +1120,7 @@ static void | |||
| 1126 | print_preprocess (Lisp_Object obj) | 1120 | print_preprocess (Lisp_Object obj) |
| 1127 | { | 1121 | { |
| 1128 | int i; | 1122 | int i; |
| 1129 | EMACS_INT size; | 1123 | ptrdiff_t size; |
| 1130 | int loop_count = 0; | 1124 | int loop_count = 0; |
| 1131 | Lisp_Object halftail; | 1125 | Lisp_Object halftail; |
| 1132 | 1126 | ||
| @@ -1269,8 +1263,8 @@ print_check_string_charset_prop (INTERVAL interval, Lisp_Object string) | |||
| 1269 | || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) | 1263 | || ! (print_check_string_result & PRINT_STRING_UNSAFE_CHARSET_FOUND)) |
| 1270 | { | 1264 | { |
| 1271 | int i, c; | 1265 | int i, c; |
| 1272 | EMACS_INT charpos = interval->position; | 1266 | ptrdiff_t charpos = interval->position; |
| 1273 | EMACS_INT bytepos = string_char_to_byte (string, charpos); | 1267 | ptrdiff_t bytepos = string_char_to_byte (string, charpos); |
| 1274 | Lisp_Object charset; | 1268 | Lisp_Object charset; |
| 1275 | 1269 | ||
| 1276 | charset = XCAR (XCDR (val)); | 1270 | charset = XCAR (XCDR (val)); |
| @@ -1392,10 +1386,10 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1392 | print_string (obj, printcharfun); | 1386 | print_string (obj, printcharfun); |
| 1393 | else | 1387 | else |
| 1394 | { | 1388 | { |
| 1395 | register EMACS_INT i_byte; | 1389 | register ptrdiff_t i_byte; |
| 1396 | struct gcpro gcpro1; | 1390 | struct gcpro gcpro1; |
| 1397 | unsigned char *str; | 1391 | unsigned char *str; |
| 1398 | EMACS_INT size_byte; | 1392 | ptrdiff_t size_byte; |
| 1399 | /* 1 means we must ensure that the next character we output | 1393 | /* 1 means we must ensure that the next character we output |
| 1400 | cannot be taken as part of a hex character escape. */ | 1394 | cannot be taken as part of a hex character escape. */ |
| 1401 | int need_nonhex = 0; | 1395 | int need_nonhex = 0; |
| @@ -1513,8 +1507,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1513 | register unsigned char *p = SDATA (SYMBOL_NAME (obj)); | 1507 | register unsigned char *p = SDATA (SYMBOL_NAME (obj)); |
| 1514 | register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj)); | 1508 | register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj)); |
| 1515 | register int c; | 1509 | register int c; |
| 1516 | int i, i_byte; | 1510 | ptrdiff_t i, i_byte; |
| 1517 | EMACS_INT size_byte; | 1511 | ptrdiff_t size_byte; |
| 1518 | Lisp_Object name; | 1512 | Lisp_Object name; |
| 1519 | 1513 | ||
| 1520 | name = SYMBOL_NAME (obj); | 1514 | name = SYMBOL_NAME (obj); |
| @@ -1705,7 +1699,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1705 | ptrdiff_t i; | 1699 | ptrdiff_t i; |
| 1706 | register unsigned char c; | 1700 | register unsigned char c; |
| 1707 | struct gcpro gcpro1; | 1701 | struct gcpro gcpro1; |
| 1708 | EMACS_INT size_in_chars | 1702 | ptrdiff_t size_in_chars |
| 1709 | = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1) | 1703 | = ((XBOOL_VECTOR (obj)->size + BOOL_VECTOR_BITS_PER_CHAR - 1) |
| 1710 | / BOOL_VECTOR_BITS_PER_CHAR); | 1704 | / BOOL_VECTOR_BITS_PER_CHAR); |
| 1711 | 1705 | ||
| @@ -1791,8 +1785,8 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1791 | else if (HASH_TABLE_P (obj)) | 1785 | else if (HASH_TABLE_P (obj)) |
| 1792 | { | 1786 | { |
| 1793 | struct Lisp_Hash_Table *h = XHASH_TABLE (obj); | 1787 | struct Lisp_Hash_Table *h = XHASH_TABLE (obj); |
| 1794 | int i; | 1788 | ptrdiff_t i; |
| 1795 | EMACS_INT real_size, size; | 1789 | ptrdiff_t real_size, size; |
| 1796 | #if 0 | 1790 | #if 0 |
| 1797 | strout ("#<hash-table", -1, -1, printcharfun); | 1791 | strout ("#<hash-table", -1, -1, printcharfun); |
| 1798 | if (SYMBOLP (h->test)) | 1792 | if (SYMBOLP (h->test)) |
| @@ -1897,7 +1891,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1897 | } | 1891 | } |
| 1898 | else if (FONTP (obj)) | 1892 | else if (FONTP (obj)) |
| 1899 | { | 1893 | { |
| 1900 | EMACS_INT i; | 1894 | int i; |
| 1901 | 1895 | ||
| 1902 | if (! FONT_OBJECT_P (obj)) | 1896 | if (! FONT_OBJECT_P (obj)) |
| 1903 | { | 1897 | { |
| @@ -1925,7 +1919,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1925 | } | 1919 | } |
| 1926 | else | 1920 | else |
| 1927 | { | 1921 | { |
| 1928 | EMACS_INT size = ASIZE (obj); | 1922 | ptrdiff_t size = ASIZE (obj); |
| 1929 | if (COMPILEDP (obj)) | 1923 | if (COMPILEDP (obj)) |
| 1930 | { | 1924 | { |
| 1931 | PRINTCHAR ('#'); | 1925 | PRINTCHAR ('#'); |
| @@ -1956,7 +1950,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1956 | { | 1950 | { |
| 1957 | register int i; | 1951 | register int i; |
| 1958 | register Lisp_Object tem; | 1952 | register Lisp_Object tem; |
| 1959 | EMACS_INT real_size = size; | 1953 | ptrdiff_t real_size = size; |
| 1960 | 1954 | ||
| 1961 | /* Don't print more elements than the specified maximum. */ | 1955 | /* Don't print more elements than the specified maximum. */ |
| 1962 | if (NATNUMP (Vprint_length) | 1956 | if (NATNUMP (Vprint_length) |
diff --git a/src/process.c b/src/process.c index 90ad9c21681..d604415bdd0 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -761,9 +761,7 @@ nil, indicating the current buffer's process. */) | |||
| 761 | { | 761 | { |
| 762 | #ifdef SIGCHLD | 762 | #ifdef SIGCHLD |
| 763 | Lisp_Object symbol; | 763 | Lisp_Object symbol; |
| 764 | /* Assignment to EMACS_INT stops GCC whining about limited range | 764 | pid_t pid = p->pid; |
| 765 | of data type. */ | ||
| 766 | EMACS_INT pid = p->pid; | ||
| 767 | 765 | ||
| 768 | /* No problem storing the pid here, as it is still in Vprocess_alist. */ | 766 | /* No problem storing the pid here, as it is still in Vprocess_alist. */ |
| 769 | deleted_pid_list = Fcons (make_fixnum_or_float (pid), | 767 | deleted_pid_list = Fcons (make_fixnum_or_float (pid), |
| @@ -860,9 +858,7 @@ This is the pid of the external process which PROCESS uses or talks to. | |||
| 860 | For a network connection, this value is nil. */) | 858 | For a network connection, this value is nil. */) |
| 861 | (register Lisp_Object process) | 859 | (register Lisp_Object process) |
| 862 | { | 860 | { |
| 863 | /* Assignment to EMACS_INT stops GCC whining about limited range of | 861 | pid_t pid; |
| 864 | data type. */ | ||
| 865 | EMACS_INT pid; | ||
| 866 | 862 | ||
| 867 | CHECK_PROCESS (process); | 863 | CHECK_PROCESS (process); |
| 868 | pid = XPROCESS (process)->pid; | 864 | pid = XPROCESS (process)->pid; |
| @@ -1037,8 +1033,8 @@ DEFUN ("set-process-window-size", Fset_process_window_size, | |||
| 1037 | (register Lisp_Object process, Lisp_Object height, Lisp_Object width) | 1033 | (register Lisp_Object process, Lisp_Object height, Lisp_Object width) |
| 1038 | { | 1034 | { |
| 1039 | CHECK_PROCESS (process); | 1035 | CHECK_PROCESS (process); |
| 1040 | CHECK_NATNUM (height); | 1036 | CHECK_RANGED_INTEGER (0, height, INT_MAX); |
| 1041 | CHECK_NATNUM (width); | 1037 | CHECK_RANGED_INTEGER (0, width, INT_MAX); |
| 1042 | 1038 | ||
| 1043 | if (XPROCESS (process)->infd < 0 | 1039 | if (XPROCESS (process)->infd < 0 |
| 1044 | || set_window_size (XPROCESS (process)->infd, | 1040 | || set_window_size (XPROCESS (process)->infd, |
| @@ -1198,7 +1194,7 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1198 | if (VECTORP (address)) /* AF_INET or AF_INET6 */ | 1194 | if (VECTORP (address)) /* AF_INET or AF_INET6 */ |
| 1199 | { | 1195 | { |
| 1200 | register struct Lisp_Vector *p = XVECTOR (address); | 1196 | register struct Lisp_Vector *p = XVECTOR (address); |
| 1201 | EMACS_INT size = p->header.size; | 1197 | ptrdiff_t size = p->header.size; |
| 1202 | Lisp_Object args[10]; | 1198 | Lisp_Object args[10]; |
| 1203 | int nargs, i; | 1199 | int nargs, i; |
| 1204 | 1200 | ||
| @@ -1227,14 +1223,12 @@ Returns nil if format of ADDRESS is invalid. */) | |||
| 1227 | 1223 | ||
| 1228 | for (i = 0; i < nargs; i++) | 1224 | for (i = 0; i < nargs; i++) |
| 1229 | { | 1225 | { |
| 1230 | EMACS_INT element = XINT (p->contents[i]); | 1226 | if (! RANGED_INTEGERP (0, p->contents[i], 65535)) |
| 1231 | |||
| 1232 | if (element < 0 || element > 65535) | ||
| 1233 | return Qnil; | 1227 | return Qnil; |
| 1234 | 1228 | ||
| 1235 | if (nargs <= 5 /* IPv4 */ | 1229 | if (nargs <= 5 /* IPv4 */ |
| 1236 | && i < 4 /* host, not port */ | 1230 | && i < 4 /* host, not port */ |
| 1237 | && element > 255) | 1231 | && XINT (p->contents[i]) > 255) |
| 1238 | return Qnil; | 1232 | return Qnil; |
| 1239 | 1233 | ||
| 1240 | args[i+1] = p->contents[i]; | 1234 | args[i+1] = p->contents[i]; |
| @@ -1289,7 +1283,7 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | |||
| 1289 | Lisp_Object buffer, name, program, proc, current_dir, tem; | 1283 | Lisp_Object buffer, name, program, proc, current_dir, tem; |
| 1290 | register unsigned char **new_argv; | 1284 | register unsigned char **new_argv; |
| 1291 | ptrdiff_t i; | 1285 | ptrdiff_t i; |
| 1292 | int count = SPECPDL_INDEX (); | 1286 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1293 | 1287 | ||
| 1294 | buffer = args[1]; | 1288 | buffer = args[1]; |
| 1295 | if (!NILP (buffer)) | 1289 | if (!NILP (buffer)) |
| @@ -2098,7 +2092,8 @@ get_lisp_to_sockaddr_size (Lisp_Object address, int *familyp) | |||
| 2098 | return sizeof (struct sockaddr_un); | 2092 | return sizeof (struct sockaddr_un); |
| 2099 | } | 2093 | } |
| 2100 | #endif | 2094 | #endif |
| 2101 | else if (CONSP (address) && INTEGERP (XCAR (address)) && VECTORP (XCDR (address))) | 2095 | else if (CONSP (address) && TYPE_RANGED_INTEGERP (int, XCAR (address)) |
| 2096 | && VECTORP (XCDR (address))) | ||
| 2102 | { | 2097 | { |
| 2103 | struct sockaddr *sa; | 2098 | struct sockaddr *sa; |
| 2104 | *familyp = XINT (XCAR (address)); | 2099 | *familyp = XINT (XCAR (address)); |
| @@ -2121,6 +2116,7 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int | |||
| 2121 | register struct Lisp_Vector *p; | 2116 | register struct Lisp_Vector *p; |
| 2122 | register unsigned char *cp = NULL; | 2117 | register unsigned char *cp = NULL; |
| 2123 | register int i; | 2118 | register int i; |
| 2119 | EMACS_INT hostport; | ||
| 2124 | 2120 | ||
| 2125 | memset (sa, 0, len); | 2121 | memset (sa, 0, len); |
| 2126 | 2122 | ||
| @@ -2131,8 +2127,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int | |||
| 2131 | { | 2127 | { |
| 2132 | struct sockaddr_in *sin = (struct sockaddr_in *) sa; | 2128 | struct sockaddr_in *sin = (struct sockaddr_in *) sa; |
| 2133 | len = sizeof (sin->sin_addr) + 1; | 2129 | len = sizeof (sin->sin_addr) + 1; |
| 2134 | i = XINT (p->contents[--len]); | 2130 | hostport = XINT (p->contents[--len]); |
| 2135 | sin->sin_port = htons (i); | 2131 | sin->sin_port = htons (hostport); |
| 2136 | cp = (unsigned char *)&sin->sin_addr; | 2132 | cp = (unsigned char *)&sin->sin_addr; |
| 2137 | sa->sa_family = family; | 2133 | sa->sa_family = family; |
| 2138 | } | 2134 | } |
| @@ -2142,8 +2138,8 @@ conv_lisp_to_sockaddr (int family, Lisp_Object address, struct sockaddr *sa, int | |||
| 2142 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; | 2138 | struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) sa; |
| 2143 | uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr; | 2139 | uint16_t *ip6 = (uint16_t *)&sin6->sin6_addr; |
| 2144 | len = sizeof (sin6->sin6_addr) + 1; | 2140 | len = sizeof (sin6->sin6_addr) + 1; |
| 2145 | i = XINT (p->contents[--len]); | 2141 | hostport = XINT (p->contents[--len]); |
| 2146 | sin6->sin6_port = htons (i); | 2142 | sin6->sin6_port = htons (hostport); |
| 2147 | for (i = 0; i < len; i++) | 2143 | for (i = 0; i < len; i++) |
| 2148 | if (INTEGERP (p->contents[i])) | 2144 | if (INTEGERP (p->contents[i])) |
| 2149 | { | 2145 | { |
| @@ -2298,7 +2294,7 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val) | |||
| 2298 | case SOPT_INT: | 2294 | case SOPT_INT: |
| 2299 | { | 2295 | { |
| 2300 | int optval; | 2296 | int optval; |
| 2301 | if (INTEGERP (val)) | 2297 | if (TYPE_RANGED_INTEGERP (int, val)) |
| 2302 | optval = XINT (val); | 2298 | optval = XINT (val); |
| 2303 | else | 2299 | else |
| 2304 | error ("Bad option value for %s", name); | 2300 | error ("Bad option value for %s", name); |
| @@ -2337,7 +2333,7 @@ set_socket_option (int s, Lisp_Object opt, Lisp_Object val) | |||
| 2337 | 2333 | ||
| 2338 | linger.l_onoff = 1; | 2334 | linger.l_onoff = 1; |
| 2339 | linger.l_linger = 0; | 2335 | linger.l_linger = 0; |
| 2340 | if (INTEGERP (val)) | 2336 | if (TYPE_RANGED_INTEGERP (int, val)) |
| 2341 | linger.l_linger = XINT (val); | 2337 | linger.l_linger = XINT (val); |
| 2342 | else | 2338 | else |
| 2343 | linger.l_onoff = NILP (val) ? 0 : 1; | 2339 | linger.l_onoff = NILP (val) ? 0 : 1; |
| @@ -2577,7 +2573,7 @@ usage: (make-serial-process &rest ARGS) */) | |||
| 2577 | struct gcpro gcpro1; | 2573 | struct gcpro gcpro1; |
| 2578 | Lisp_Object name, buffer; | 2574 | Lisp_Object name, buffer; |
| 2579 | Lisp_Object tem, val; | 2575 | Lisp_Object tem, val; |
| 2580 | int specpdl_count = -1; | 2576 | ptrdiff_t specpdl_count = -1; |
| 2581 | 2577 | ||
| 2582 | if (nargs == 0) | 2578 | if (nargs == 0) |
| 2583 | return Qnil; | 2579 | return Qnil; |
| @@ -2877,8 +2873,8 @@ usage: (make-network-process &rest ARGS) */) | |||
| 2877 | int xerrno = 0; | 2873 | int xerrno = 0; |
| 2878 | int s = -1, outch, inch; | 2874 | int s = -1, outch, inch; |
| 2879 | struct gcpro gcpro1; | 2875 | struct gcpro gcpro1; |
| 2880 | int count = SPECPDL_INDEX (); | 2876 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2881 | int count1; | 2877 | ptrdiff_t count1; |
| 2882 | Lisp_Object QCaddress; /* one of QClocal or QCremote */ | 2878 | Lisp_Object QCaddress; /* one of QClocal or QCremote */ |
| 2883 | Lisp_Object tem; | 2879 | Lisp_Object tem; |
| 2884 | Lisp_Object name, buffer, host, service, address; | 2880 | Lisp_Object name, buffer, host, service, address; |
| @@ -2925,7 +2921,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 2925 | error ("Network servers not supported"); | 2921 | error ("Network servers not supported"); |
| 2926 | #else | 2922 | #else |
| 2927 | is_server = 1; | 2923 | is_server = 1; |
| 2928 | if (INTEGERP (tem)) | 2924 | if (TYPE_RANGED_INTEGERP (int, tem)) |
| 2929 | backlog = XINT (tem); | 2925 | backlog = XINT (tem); |
| 2930 | #endif | 2926 | #endif |
| 2931 | } | 2927 | } |
| @@ -2991,7 +2987,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 2991 | #endif | 2987 | #endif |
| 2992 | else if (EQ (tem, Qipv4)) | 2988 | else if (EQ (tem, Qipv4)) |
| 2993 | family = AF_INET; | 2989 | family = AF_INET; |
| 2994 | else if (INTEGERP (tem)) | 2990 | else if (TYPE_RANGED_INTEGERP (int, tem)) |
| 2995 | family = XINT (tem); | 2991 | family = XINT (tem); |
| 2996 | else | 2992 | else |
| 2997 | error ("Unknown address family"); | 2993 | error ("Unknown address family"); |
| @@ -3943,7 +3939,7 @@ If JUST-THIS-ONE is an integer, don't run any timers either. | |||
| 3943 | Return non-nil if we received any output before the timeout expired. */) | 3939 | Return non-nil if we received any output before the timeout expired. */) |
| 3944 | (register Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one) | 3940 | (register Lisp_Object process, Lisp_Object seconds, Lisp_Object millisec, Lisp_Object just_this_one) |
| 3945 | { | 3941 | { |
| 3946 | int secs, usecs = 0; | 3942 | int secs = -1, usecs = 0; |
| 3947 | 3943 | ||
| 3948 | if (! NILP (process)) | 3944 | if (! NILP (process)) |
| 3949 | CHECK_PROCESS (process); | 3945 | CHECK_PROCESS (process); |
| @@ -3964,22 +3960,12 @@ Return non-nil if we received any output before the timeout expired. */) | |||
| 3964 | 3960 | ||
| 3965 | if (!NILP (seconds)) | 3961 | if (!NILP (seconds)) |
| 3966 | { | 3962 | { |
| 3967 | if (INTEGERP (seconds)) | 3963 | double duration = extract_float (duration); |
| 3968 | secs = XINT (seconds); | 3964 | if (0 < duration) |
| 3969 | else if (FLOATP (seconds)) | 3965 | duration_to_sec_usec (duration, &secs, &usecs); |
| 3970 | { | ||
| 3971 | double timeout = XFLOAT_DATA (seconds); | ||
| 3972 | secs = (int) timeout; | ||
| 3973 | usecs = (int) ((timeout - (double) secs) * 1000000); | ||
| 3974 | } | ||
| 3975 | else | ||
| 3976 | wrong_type_argument (Qnumberp, seconds); | ||
| 3977 | |||
| 3978 | if (secs < 0 || (secs == 0 && usecs == 0)) | ||
| 3979 | secs = -1, usecs = 0; | ||
| 3980 | } | 3966 | } |
| 3981 | else | 3967 | else if (!NILP (process)) |
| 3982 | secs = NILP (process) ? -1 : 0; | 3968 | secs = 0; |
| 3983 | 3969 | ||
| 3984 | return | 3970 | return |
| 3985 | (wait_reading_process_output (secs, usecs, 0, 0, | 3971 | (wait_reading_process_output (secs, usecs, 0, 0, |
| @@ -4292,7 +4278,7 @@ wait_reading_process_output (int time_limit, int microsecs, int read_kbd, | |||
| 4292 | EMACS_TIME timeout, end_time; | 4278 | EMACS_TIME timeout, end_time; |
| 4293 | int wait_channel = -1; | 4279 | int wait_channel = -1; |
| 4294 | int got_some_input = 0; | 4280 | int got_some_input = 0; |
| 4295 | int count = SPECPDL_INDEX (); | 4281 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4296 | 4282 | ||
| 4297 | FD_ZERO (&Available); | 4283 | FD_ZERO (&Available); |
| 4298 | FD_ZERO (&Writeok); | 4284 | FD_ZERO (&Writeok); |
| @@ -4995,11 +4981,11 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 4995 | char *chars; | 4981 | char *chars; |
| 4996 | register Lisp_Object outstream; | 4982 | register Lisp_Object outstream; |
| 4997 | register struct Lisp_Process *p = XPROCESS (proc); | 4983 | register struct Lisp_Process *p = XPROCESS (proc); |
| 4998 | register EMACS_INT opoint; | 4984 | register ptrdiff_t opoint; |
| 4999 | struct coding_system *coding = proc_decode_coding_system[channel]; | 4985 | struct coding_system *coding = proc_decode_coding_system[channel]; |
| 5000 | int carryover = p->decoding_carryover; | 4986 | int carryover = p->decoding_carryover; |
| 5001 | int readmax = 4096; | 4987 | int readmax = 4096; |
| 5002 | int count = SPECPDL_INDEX (); | 4988 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5003 | Lisp_Object odeactivate; | 4989 | Lisp_Object odeactivate; |
| 5004 | 4990 | ||
| 5005 | chars = (char *) alloca (carryover + readmax); | 4991 | chars = (char *) alloca (carryover + readmax); |
| @@ -5195,10 +5181,10 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5195 | else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name))) | 5181 | else if (!NILP (p->buffer) && !NILP (BVAR (XBUFFER (p->buffer), name))) |
| 5196 | { | 5182 | { |
| 5197 | Lisp_Object old_read_only; | 5183 | Lisp_Object old_read_only; |
| 5198 | EMACS_INT old_begv, old_zv; | 5184 | ptrdiff_t old_begv, old_zv; |
| 5199 | EMACS_INT old_begv_byte, old_zv_byte; | 5185 | ptrdiff_t old_begv_byte, old_zv_byte; |
| 5200 | EMACS_INT before, before_byte; | 5186 | ptrdiff_t before, before_byte; |
| 5201 | EMACS_INT opoint_byte; | 5187 | ptrdiff_t opoint_byte; |
| 5202 | Lisp_Object text; | 5188 | Lisp_Object text; |
| 5203 | struct buffer *b; | 5189 | struct buffer *b; |
| 5204 | 5190 | ||
| @@ -5339,7 +5325,7 @@ send_process_trap (int ignore) | |||
| 5339 | 5325 | ||
| 5340 | static void | 5326 | static void |
| 5341 | send_process (volatile Lisp_Object proc, const char *volatile buf, | 5327 | send_process (volatile Lisp_Object proc, const char *volatile buf, |
| 5342 | volatile EMACS_INT len, volatile Lisp_Object object) | 5328 | volatile ptrdiff_t len, volatile Lisp_Object object) |
| 5343 | { | 5329 | { |
| 5344 | /* Use volatile to protect variables from being clobbered by longjmp. */ | 5330 | /* Use volatile to protect variables from being clobbered by longjmp. */ |
| 5345 | struct Lisp_Process *p = XPROCESS (proc); | 5331 | struct Lisp_Process *p = XPROCESS (proc); |
| @@ -5409,8 +5395,8 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, | |||
| 5409 | coding->dst_object = Qt; | 5395 | coding->dst_object = Qt; |
| 5410 | if (BUFFERP (object)) | 5396 | if (BUFFERP (object)) |
| 5411 | { | 5397 | { |
| 5412 | EMACS_INT from_byte, from, to; | 5398 | ptrdiff_t from_byte, from, to; |
| 5413 | EMACS_INT save_pt, save_pt_byte; | 5399 | ptrdiff_t save_pt, save_pt_byte; |
| 5414 | struct buffer *cur = current_buffer; | 5400 | struct buffer *cur = current_buffer; |
| 5415 | 5401 | ||
| 5416 | set_buffer_internal (XBUFFER (object)); | 5402 | set_buffer_internal (XBUFFER (object)); |
| @@ -5464,12 +5450,12 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, | |||
| 5464 | process_sent_to = proc; | 5450 | process_sent_to = proc; |
| 5465 | while (len > 0) | 5451 | while (len > 0) |
| 5466 | { | 5452 | { |
| 5467 | EMACS_INT this = len; | 5453 | ptrdiff_t this = len; |
| 5468 | 5454 | ||
| 5469 | /* Send this batch, using one or more write calls. */ | 5455 | /* Send this batch, using one or more write calls. */ |
| 5470 | while (this > 0) | 5456 | while (this > 0) |
| 5471 | { | 5457 | { |
| 5472 | EMACS_INT written = 0; | 5458 | ptrdiff_t written = 0; |
| 5473 | int outfd = p->outfd; | 5459 | int outfd = p->outfd; |
| 5474 | old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap); | 5460 | old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap); |
| 5475 | #ifdef DATAGRAM_SOCKETS | 5461 | #ifdef DATAGRAM_SOCKETS |
| @@ -5524,7 +5510,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, | |||
| 5524 | that may allow the program | 5510 | that may allow the program |
| 5525 | to finish doing output and read more. */ | 5511 | to finish doing output and read more. */ |
| 5526 | { | 5512 | { |
| 5527 | EMACS_INT offset = 0; | 5513 | ptrdiff_t offset = 0; |
| 5528 | 5514 | ||
| 5529 | #ifdef BROKEN_PTY_READ_AFTER_EAGAIN | 5515 | #ifdef BROKEN_PTY_READ_AFTER_EAGAIN |
| 5530 | /* A gross hack to work around a bug in FreeBSD. | 5516 | /* A gross hack to work around a bug in FreeBSD. |
| @@ -5608,7 +5594,7 @@ Output from processes can arrive in between bunches. */) | |||
| 5608 | (Lisp_Object process, Lisp_Object start, Lisp_Object end) | 5594 | (Lisp_Object process, Lisp_Object start, Lisp_Object end) |
| 5609 | { | 5595 | { |
| 5610 | Lisp_Object proc; | 5596 | Lisp_Object proc; |
| 5611 | EMACS_INT start1, end1; | 5597 | ptrdiff_t start1, end1; |
| 5612 | 5598 | ||
| 5613 | proc = get_process (process); | 5599 | proc = get_process (process); |
| 5614 | validate_region (&start, &end); | 5600 | validate_region (&start, &end); |
| @@ -5974,24 +5960,33 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) | |||
| 5974 | 5960 | ||
| 5975 | if (INTEGERP (process)) | 5961 | if (INTEGERP (process)) |
| 5976 | { | 5962 | { |
| 5963 | CHECK_TYPE_RANGED_INTEGER (pid_t, process); | ||
| 5977 | pid = XINT (process); | 5964 | pid = XINT (process); |
| 5978 | goto got_it; | 5965 | goto got_it; |
| 5979 | } | 5966 | } |
| 5980 | 5967 | ||
| 5981 | if (FLOATP (process)) | 5968 | if (FLOATP (process)) |
| 5982 | { | 5969 | { |
| 5983 | pid = (pid_t) XFLOAT_DATA (process); | 5970 | double v = XFLOAT_DATA (process); |
| 5971 | if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0)) | ||
| 5972 | args_out_of_range_3 (process, | ||
| 5973 | make_fixnum_or_float (TYPE_MINIMUM (pid_t)), | ||
| 5974 | make_fixnum_or_float (TYPE_MAXIMUM (pid_t))); | ||
| 5975 | pid = v; | ||
| 5984 | goto got_it; | 5976 | goto got_it; |
| 5985 | } | 5977 | } |
| 5986 | 5978 | ||
| 5987 | if (STRINGP (process)) | 5979 | if (STRINGP (process)) |
| 5988 | { | 5980 | { |
| 5989 | Lisp_Object tem; | 5981 | Lisp_Object tem = Fget_process (process); |
| 5990 | if (tem = Fget_process (process), NILP (tem)) | 5982 | if (NILP (tem)) |
| 5991 | { | 5983 | { |
| 5992 | pid = XINT (Fstring_to_number (process, make_number (10))); | 5984 | EMACS_INT v = XINT (Fstring_to_number (process, make_number (10))); |
| 5993 | if (pid > 0) | 5985 | if (0 < v && v <= TYPE_MAXIMUM (pid_t)) |
| 5994 | goto got_it; | 5986 | { |
| 5987 | pid = v; | ||
| 5988 | goto got_it; | ||
| 5989 | } | ||
| 5995 | } | 5990 | } |
| 5996 | process = tem; | 5991 | process = tem; |
| 5997 | } | 5992 | } |
| @@ -6013,7 +6008,7 @@ SIGCODE may be an integer, or a symbol whose name is a signal name. */) | |||
| 6013 | XSETINT (sigcode, VALUE) | 6008 | XSETINT (sigcode, VALUE) |
| 6014 | 6009 | ||
| 6015 | if (INTEGERP (sigcode)) | 6010 | if (INTEGERP (sigcode)) |
| 6016 | ; | 6011 | CHECK_TYPE_RANGED_INTEGER (int, sigcode); |
| 6017 | else | 6012 | else |
| 6018 | { | 6013 | { |
| 6019 | char *name; | 6014 | char *name; |
| @@ -6276,8 +6271,8 @@ sigchld_handler (int signo) | |||
| 6276 | for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail)) | 6271 | for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail)) |
| 6277 | { | 6272 | { |
| 6278 | Lisp_Object xpid = XCAR (tail); | 6273 | Lisp_Object xpid = XCAR (tail); |
| 6279 | if ((INTEGERP (xpid) && pid == (pid_t) XINT (xpid)) | 6274 | if ((INTEGERP (xpid) && pid == XINT (xpid)) |
| 6280 | || (FLOATP (xpid) && pid == (pid_t) XFLOAT_DATA (xpid))) | 6275 | || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) |
| 6281 | { | 6276 | { |
| 6282 | XSETCAR (tail, Qnil); | 6277 | XSETCAR (tail, Qnil); |
| 6283 | goto sigchld_end_of_loop; | 6278 | goto sigchld_end_of_loop; |
| @@ -6393,7 +6388,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason) | |||
| 6393 | { | 6388 | { |
| 6394 | Lisp_Object sentinel, odeactivate; | 6389 | Lisp_Object sentinel, odeactivate; |
| 6395 | register struct Lisp_Process *p = XPROCESS (proc); | 6390 | register struct Lisp_Process *p = XPROCESS (proc); |
| 6396 | int count = SPECPDL_INDEX (); | 6391 | ptrdiff_t count = SPECPDL_INDEX (); |
| 6397 | int outer_running_asynch_code = running_asynch_code; | 6392 | int outer_running_asynch_code = running_asynch_code; |
| 6398 | int waiting = waiting_for_user_input_p; | 6393 | int waiting = waiting_for_user_input_p; |
| 6399 | 6394 | ||
| @@ -6552,8 +6547,8 @@ status_notify (struct Lisp_Process *deleting_process) | |||
| 6552 | { | 6547 | { |
| 6553 | Lisp_Object tem; | 6548 | Lisp_Object tem; |
| 6554 | struct buffer *old = current_buffer; | 6549 | struct buffer *old = current_buffer; |
| 6555 | EMACS_INT opoint, opoint_byte; | 6550 | ptrdiff_t opoint, opoint_byte; |
| 6556 | EMACS_INT before, before_byte; | 6551 | ptrdiff_t before, before_byte; |
| 6557 | 6552 | ||
| 6558 | /* Avoid error if buffer is deleted | 6553 | /* Avoid error if buffer is deleted |
| 6559 | (probably that's why the process is dead, too) */ | 6554 | (probably that's why the process is dead, too) */ |
diff --git a/src/scroll.c b/src/scroll.c index 05f6fdf85f0..4e0801f092f 100644 --- a/src/scroll.c +++ b/src/scroll.c | |||
| @@ -94,7 +94,7 @@ calculate_scrolling (FRAME_PTR frame, | |||
| 94 | int free_at_end) | 94 | int free_at_end) |
| 95 | { | 95 | { |
| 96 | register int i, j; | 96 | register int i, j; |
| 97 | EMACS_INT frame_lines = FRAME_LINES (frame); | 97 | int frame_lines = FRAME_LINES (frame); |
| 98 | register struct matrix_elt *p, *p1; | 98 | register struct matrix_elt *p, *p1; |
| 99 | register int cost, cost1; | 99 | register int cost, cost1; |
| 100 | 100 | ||
| @@ -432,7 +432,7 @@ calculate_direct_scrolling (FRAME_PTR frame, | |||
| 432 | int free_at_end) | 432 | int free_at_end) |
| 433 | { | 433 | { |
| 434 | register int i, j; | 434 | register int i, j; |
| 435 | EMACS_INT frame_lines = FRAME_LINES (frame); | 435 | int frame_lines = FRAME_LINES (frame); |
| 436 | register struct matrix_elt *p, *p1; | 436 | register struct matrix_elt *p, *p1; |
| 437 | register int cost, cost1, delta; | 437 | register int cost, cost1, delta; |
| 438 | 438 | ||
| @@ -889,8 +889,8 @@ static void | |||
| 889 | line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, | 889 | line_ins_del (FRAME_PTR frame, int ov1, int pf1, int ovn, int pfn, |
| 890 | register int *ov, register int *mf) | 890 | register int *ov, register int *mf) |
| 891 | { | 891 | { |
| 892 | register EMACS_INT i; | 892 | register int i; |
| 893 | register EMACS_INT frame_lines = FRAME_LINES (frame); | 893 | register int frame_lines = FRAME_LINES (frame); |
| 894 | register int insert_overhead = ov1 * 10; | 894 | register int insert_overhead = ov1 * 10; |
| 895 | register int next_insert_cost = ovn * 10; | 895 | register int next_insert_cost = ovn * 10; |
| 896 | 896 | ||
diff --git a/src/search.c b/src/search.c index b3d67e6c431..7dc88268c76 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -90,16 +90,16 @@ static Lisp_Object Qinvalid_regexp; | |||
| 90 | /* Error condition used for failing searches */ | 90 | /* Error condition used for failing searches */ |
| 91 | static Lisp_Object Qsearch_failed; | 91 | static Lisp_Object Qsearch_failed; |
| 92 | 92 | ||
| 93 | static void set_search_regs (EMACS_INT, EMACS_INT); | 93 | static void set_search_regs (ptrdiff_t, ptrdiff_t); |
| 94 | static void save_search_regs (void); | 94 | static void save_search_regs (void); |
| 95 | static EMACS_INT simple_search (EMACS_INT, unsigned char *, EMACS_INT, | 95 | static EMACS_INT simple_search (EMACS_INT, unsigned char *, ptrdiff_t, |
| 96 | EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT, | 96 | ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 97 | EMACS_INT, EMACS_INT); | 97 | ptrdiff_t, ptrdiff_t); |
| 98 | static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, EMACS_INT, | 98 | static EMACS_INT boyer_moore (EMACS_INT, unsigned char *, ptrdiff_t, |
| 99 | Lisp_Object, Lisp_Object, EMACS_INT, | 99 | Lisp_Object, Lisp_Object, ptrdiff_t, |
| 100 | EMACS_INT, int); | 100 | ptrdiff_t, int); |
| 101 | static EMACS_INT search_buffer (Lisp_Object, EMACS_INT, EMACS_INT, | 101 | static EMACS_INT search_buffer (Lisp_Object, ptrdiff_t, ptrdiff_t, |
| 102 | EMACS_INT, EMACS_INT, EMACS_INT, int, | 102 | ptrdiff_t, ptrdiff_t, EMACS_INT, int, |
| 103 | Lisp_Object, Lisp_Object, int); | 103 | Lisp_Object, Lisp_Object, int); |
| 104 | static void matcher_overflow (void) NO_RETURN; | 104 | static void matcher_overflow (void) NO_RETURN; |
| 105 | 105 | ||
| @@ -272,8 +272,8 @@ looking_at_1 (Lisp_Object string, int posix) | |||
| 272 | { | 272 | { |
| 273 | Lisp_Object val; | 273 | Lisp_Object val; |
| 274 | unsigned char *p1, *p2; | 274 | unsigned char *p1, *p2; |
| 275 | EMACS_INT s1, s2; | 275 | ptrdiff_t s1, s2; |
| 276 | register EMACS_INT i; | 276 | register ptrdiff_t i; |
| 277 | struct re_pattern_buffer *bufp; | 277 | struct re_pattern_buffer *bufp; |
| 278 | 278 | ||
| 279 | if (running_asynch_code) | 279 | if (running_asynch_code) |
| @@ -368,10 +368,10 @@ data if you want to preserve them. */) | |||
| 368 | static Lisp_Object | 368 | static Lisp_Object |
| 369 | string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix) | 369 | string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int posix) |
| 370 | { | 370 | { |
| 371 | EMACS_INT val; | 371 | ptrdiff_t val; |
| 372 | struct re_pattern_buffer *bufp; | 372 | struct re_pattern_buffer *bufp; |
| 373 | EMACS_INT pos, pos_byte; | 373 | EMACS_INT pos; |
| 374 | int i; | 374 | ptrdiff_t pos_byte, i; |
| 375 | 375 | ||
| 376 | if (running_asynch_code) | 376 | if (running_asynch_code) |
| 377 | save_search_regs (); | 377 | save_search_regs (); |
| @@ -383,7 +383,7 @@ string_match_1 (Lisp_Object regexp, Lisp_Object string, Lisp_Object start, int p | |||
| 383 | pos = 0, pos_byte = 0; | 383 | pos = 0, pos_byte = 0; |
| 384 | else | 384 | else |
| 385 | { | 385 | { |
| 386 | EMACS_INT len = SCHARS (string); | 386 | ptrdiff_t len = SCHARS (string); |
| 387 | 387 | ||
| 388 | CHECK_NUMBER (start); | 388 | CHECK_NUMBER (start); |
| 389 | pos = XINT (start); | 389 | pos = XINT (start); |
| @@ -468,10 +468,10 @@ matched by parenthesis constructs in the pattern. */) | |||
| 468 | and return the index of the match, or negative on failure. | 468 | and return the index of the match, or negative on failure. |
| 469 | This does not clobber the match data. */ | 469 | This does not clobber the match data. */ |
| 470 | 470 | ||
| 471 | EMACS_INT | 471 | ptrdiff_t |
| 472 | fast_string_match (Lisp_Object regexp, Lisp_Object string) | 472 | fast_string_match (Lisp_Object regexp, Lisp_Object string) |
| 473 | { | 473 | { |
| 474 | EMACS_INT val; | 474 | ptrdiff_t val; |
| 475 | struct re_pattern_buffer *bufp; | 475 | struct re_pattern_buffer *bufp; |
| 476 | 476 | ||
| 477 | bufp = compile_pattern (regexp, 0, Qnil, | 477 | bufp = compile_pattern (regexp, 0, Qnil, |
| @@ -491,10 +491,10 @@ fast_string_match (Lisp_Object regexp, Lisp_Object string) | |||
| 491 | This does not clobber the match data. | 491 | This does not clobber the match data. |
| 492 | We assume that STRING contains single-byte characters. */ | 492 | We assume that STRING contains single-byte characters. */ |
| 493 | 493 | ||
| 494 | EMACS_INT | 494 | ptrdiff_t |
| 495 | fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string) | 495 | fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string) |
| 496 | { | 496 | { |
| 497 | EMACS_INT val; | 497 | ptrdiff_t val; |
| 498 | struct re_pattern_buffer *bufp; | 498 | struct re_pattern_buffer *bufp; |
| 499 | size_t len = strlen (string); | 499 | size_t len = strlen (string); |
| 500 | 500 | ||
| @@ -511,10 +511,10 @@ fast_c_string_match_ignore_case (Lisp_Object regexp, const char *string) | |||
| 511 | 511 | ||
| 512 | /* Like fast_string_match but ignore case. */ | 512 | /* Like fast_string_match but ignore case. */ |
| 513 | 513 | ||
| 514 | EMACS_INT | 514 | ptrdiff_t |
| 515 | fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string) | 515 | fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string) |
| 516 | { | 516 | { |
| 517 | EMACS_INT val; | 517 | ptrdiff_t val; |
| 518 | struct re_pattern_buffer *bufp; | 518 | struct re_pattern_buffer *bufp; |
| 519 | 519 | ||
| 520 | bufp = compile_pattern (regexp, 0, Vascii_canon_table, | 520 | bufp = compile_pattern (regexp, 0, Vascii_canon_table, |
| @@ -535,14 +535,14 @@ fast_string_match_ignore_case (Lisp_Object regexp, Lisp_Object string) | |||
| 535 | indices into the string. This function doesn't modify the match | 535 | indices into the string. This function doesn't modify the match |
| 536 | data. */ | 536 | data. */ |
| 537 | 537 | ||
| 538 | EMACS_INT | 538 | ptrdiff_t |
| 539 | fast_looking_at (Lisp_Object regexp, EMACS_INT pos, EMACS_INT pos_byte, EMACS_INT limit, EMACS_INT limit_byte, Lisp_Object string) | 539 | fast_looking_at (Lisp_Object regexp, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t limit, ptrdiff_t limit_byte, Lisp_Object string) |
| 540 | { | 540 | { |
| 541 | int multibyte; | 541 | int multibyte; |
| 542 | struct re_pattern_buffer *buf; | 542 | struct re_pattern_buffer *buf; |
| 543 | unsigned char *p1, *p2; | 543 | unsigned char *p1, *p2; |
| 544 | EMACS_INT s1, s2; | 544 | ptrdiff_t s1, s2; |
| 545 | EMACS_INT len; | 545 | ptrdiff_t len; |
| 546 | 546 | ||
| 547 | if (STRINGP (string)) | 547 | if (STRINGP (string)) |
| 548 | { | 548 | { |
| @@ -641,9 +641,9 @@ newline_cache_on_off (struct buffer *buf) | |||
| 641 | If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do | 641 | If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do |
| 642 | except when inside redisplay. */ | 642 | except when inside redisplay. */ |
| 643 | 643 | ||
| 644 | EMACS_INT | 644 | ptrdiff_t |
| 645 | scan_buffer (register int target, EMACS_INT start, EMACS_INT end, | 645 | scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end, |
| 646 | EMACS_INT count, EMACS_INT *shortage, int allow_quit) | 646 | ptrdiff_t count, ptrdiff_t *shortage, int allow_quit) |
| 647 | { | 647 | { |
| 648 | struct region_cache *newline_cache; | 648 | struct region_cache *newline_cache; |
| 649 | int direction; | 649 | int direction; |
| @@ -675,9 +675,9 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end, | |||
| 675 | the position of the last character before the next such | 675 | the position of the last character before the next such |
| 676 | obstacle --- the last character the dumb search loop should | 676 | obstacle --- the last character the dumb search loop should |
| 677 | examine. */ | 677 | examine. */ |
| 678 | EMACS_INT ceiling_byte = CHAR_TO_BYTE (end) - 1; | 678 | ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end) - 1; |
| 679 | EMACS_INT start_byte = CHAR_TO_BYTE (start); | 679 | ptrdiff_t start_byte = CHAR_TO_BYTE (start); |
| 680 | EMACS_INT tem; | 680 | ptrdiff_t tem; |
| 681 | 681 | ||
| 682 | /* If we're looking for a newline, consult the newline cache | 682 | /* If we're looking for a newline, consult the newline cache |
| 683 | to see where we can avoid some scanning. */ | 683 | to see where we can avoid some scanning. */ |
| @@ -748,9 +748,9 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end, | |||
| 748 | while (start > end) | 748 | while (start > end) |
| 749 | { | 749 | { |
| 750 | /* The last character to check before the next obstacle. */ | 750 | /* The last character to check before the next obstacle. */ |
| 751 | EMACS_INT ceiling_byte = CHAR_TO_BYTE (end); | 751 | ptrdiff_t ceiling_byte = CHAR_TO_BYTE (end); |
| 752 | EMACS_INT start_byte = CHAR_TO_BYTE (start); | 752 | ptrdiff_t start_byte = CHAR_TO_BYTE (start); |
| 753 | EMACS_INT tem; | 753 | ptrdiff_t tem; |
| 754 | 754 | ||
| 755 | /* Consult the newline cache, if appropriate. */ | 755 | /* Consult the newline cache, if appropriate. */ |
| 756 | if (target == '\n' && newline_cache) | 756 | if (target == '\n' && newline_cache) |
| @@ -835,8 +835,8 @@ scan_buffer (register int target, EMACS_INT start, EMACS_INT end, | |||
| 835 | except in special cases. */ | 835 | except in special cases. */ |
| 836 | 836 | ||
| 837 | EMACS_INT | 837 | EMACS_INT |
| 838 | scan_newline (EMACS_INT start, EMACS_INT start_byte, | 838 | scan_newline (ptrdiff_t start, ptrdiff_t start_byte, |
| 839 | EMACS_INT limit, EMACS_INT limit_byte, | 839 | ptrdiff_t limit, ptrdiff_t limit_byte, |
| 840 | register EMACS_INT count, int allow_quit) | 840 | register EMACS_INT count, int allow_quit) |
| 841 | { | 841 | { |
| 842 | int direction = ((count > 0) ? 1 : -1); | 842 | int direction = ((count > 0) ? 1 : -1); |
| @@ -844,7 +844,7 @@ scan_newline (EMACS_INT start, EMACS_INT start_byte, | |||
| 844 | register unsigned char *cursor; | 844 | register unsigned char *cursor; |
| 845 | unsigned char *base; | 845 | unsigned char *base; |
| 846 | 846 | ||
| 847 | EMACS_INT ceiling; | 847 | ptrdiff_t ceiling; |
| 848 | register unsigned char *ceiling_addr; | 848 | register unsigned char *ceiling_addr; |
| 849 | 849 | ||
| 850 | int old_immediate_quit = immediate_quit; | 850 | int old_immediate_quit = immediate_quit; |
| @@ -930,21 +930,21 @@ scan_newline (EMACS_INT start, EMACS_INT start_byte, | |||
| 930 | return count * direction; | 930 | return count * direction; |
| 931 | } | 931 | } |
| 932 | 932 | ||
| 933 | EMACS_INT | 933 | ptrdiff_t |
| 934 | find_next_newline_no_quit (EMACS_INT from, EMACS_INT cnt) | 934 | find_next_newline_no_quit (ptrdiff_t from, ptrdiff_t cnt) |
| 935 | { | 935 | { |
| 936 | return scan_buffer ('\n', from, 0, cnt, (EMACS_INT *) 0, 0); | 936 | return scan_buffer ('\n', from, 0, cnt, (ptrdiff_t *) 0, 0); |
| 937 | } | 937 | } |
| 938 | 938 | ||
| 939 | /* Like find_next_newline, but returns position before the newline, | 939 | /* Like find_next_newline, but returns position before the newline, |
| 940 | not after, and only search up to TO. This isn't just | 940 | not after, and only search up to TO. This isn't just |
| 941 | find_next_newline (...)-1, because you might hit TO. */ | 941 | find_next_newline (...)-1, because you might hit TO. */ |
| 942 | 942 | ||
| 943 | EMACS_INT | 943 | ptrdiff_t |
| 944 | find_before_next_newline (EMACS_INT from, EMACS_INT to, EMACS_INT cnt) | 944 | find_before_next_newline (ptrdiff_t from, ptrdiff_t to, ptrdiff_t cnt) |
| 945 | { | 945 | { |
| 946 | EMACS_INT shortage; | 946 | ptrdiff_t shortage; |
| 947 | EMACS_INT pos = scan_buffer ('\n', from, to, cnt, &shortage, 1); | 947 | ptrdiff_t pos = scan_buffer ('\n', from, to, cnt, &shortage, 1); |
| 948 | 948 | ||
| 949 | if (shortage == 0) | 949 | if (shortage == 0) |
| 950 | pos--; | 950 | pos--; |
| @@ -959,7 +959,8 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, | |||
| 959 | Lisp_Object count, int direction, int RE, int posix) | 959 | Lisp_Object count, int direction, int RE, int posix) |
| 960 | { | 960 | { |
| 961 | register EMACS_INT np; | 961 | register EMACS_INT np; |
| 962 | EMACS_INT lim, lim_byte; | 962 | EMACS_INT lim; |
| 963 | ptrdiff_t lim_byte; | ||
| 963 | EMACS_INT n = direction; | 964 | EMACS_INT n = direction; |
| 964 | 965 | ||
| 965 | if (!NILP (count)) | 966 | if (!NILP (count)) |
| @@ -1035,7 +1036,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, | |||
| 1035 | static int | 1036 | static int |
| 1036 | trivial_regexp_p (Lisp_Object regexp) | 1037 | trivial_regexp_p (Lisp_Object regexp) |
| 1037 | { | 1038 | { |
| 1038 | EMACS_INT len = SBYTES (regexp); | 1039 | ptrdiff_t len = SBYTES (regexp); |
| 1039 | unsigned char *s = SDATA (regexp); | 1040 | unsigned char *s = SDATA (regexp); |
| 1040 | while (--len >= 0) | 1041 | while (--len >= 0) |
| 1041 | { | 1042 | { |
| @@ -1099,13 +1100,13 @@ while (0) | |||
| 1099 | static struct re_registers search_regs_1; | 1100 | static struct re_registers search_regs_1; |
| 1100 | 1101 | ||
| 1101 | static EMACS_INT | 1102 | static EMACS_INT |
| 1102 | search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | 1103 | search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, |
| 1103 | EMACS_INT lim, EMACS_INT lim_byte, EMACS_INT n, | 1104 | ptrdiff_t lim, ptrdiff_t lim_byte, EMACS_INT n, |
| 1104 | int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix) | 1105 | int RE, Lisp_Object trt, Lisp_Object inverse_trt, int posix) |
| 1105 | { | 1106 | { |
| 1106 | EMACS_INT len = SCHARS (string); | 1107 | ptrdiff_t len = SCHARS (string); |
| 1107 | EMACS_INT len_byte = SBYTES (string); | 1108 | ptrdiff_t len_byte = SBYTES (string); |
| 1108 | register int i; | 1109 | register ptrdiff_t i; |
| 1109 | 1110 | ||
| 1110 | if (running_asynch_code) | 1111 | if (running_asynch_code) |
| 1111 | save_search_regs (); | 1112 | save_search_regs (); |
| @@ -1121,7 +1122,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 1121 | if (RE && !(trivial_regexp_p (string) && NILP (Vsearch_spaces_regexp))) | 1122 | if (RE && !(trivial_regexp_p (string) && NILP (Vsearch_spaces_regexp))) |
| 1122 | { | 1123 | { |
| 1123 | unsigned char *p1, *p2; | 1124 | unsigned char *p1, *p2; |
| 1124 | EMACS_INT s1, s2; | 1125 | ptrdiff_t s1, s2; |
| 1125 | struct re_pattern_buffer *bufp; | 1126 | struct re_pattern_buffer *bufp; |
| 1126 | 1127 | ||
| 1127 | bufp = compile_pattern (string, | 1128 | bufp = compile_pattern (string, |
| @@ -1157,7 +1158,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 1157 | 1158 | ||
| 1158 | while (n < 0) | 1159 | while (n < 0) |
| 1159 | { | 1160 | { |
| 1160 | EMACS_INT val; | 1161 | ptrdiff_t val; |
| 1161 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, | 1162 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
| 1162 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, | 1163 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, |
| 1163 | (NILP (Vinhibit_changing_match_data) | 1164 | (NILP (Vinhibit_changing_match_data) |
| @@ -1201,7 +1202,7 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 1201 | } | 1202 | } |
| 1202 | while (n > 0) | 1203 | while (n > 0) |
| 1203 | { | 1204 | { |
| 1204 | EMACS_INT val; | 1205 | ptrdiff_t val; |
| 1205 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, | 1206 | val = re_search_2 (bufp, (char *) p1, s1, (char *) p2, s2, |
| 1206 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, | 1207 | pos_byte - BEGV_BYTE, lim_byte - pos_byte, |
| 1207 | (NILP (Vinhibit_changing_match_data) | 1208 | (NILP (Vinhibit_changing_match_data) |
| @@ -1246,8 +1247,8 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 1246 | else /* non-RE case */ | 1247 | else /* non-RE case */ |
| 1247 | { | 1248 | { |
| 1248 | unsigned char *raw_pattern, *pat; | 1249 | unsigned char *raw_pattern, *pat; |
| 1249 | EMACS_INT raw_pattern_size; | 1250 | ptrdiff_t raw_pattern_size; |
| 1250 | EMACS_INT raw_pattern_size_byte; | 1251 | ptrdiff_t raw_pattern_size_byte; |
| 1251 | unsigned char *patbuf; | 1252 | unsigned char *patbuf; |
| 1252 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 1253 | int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 1253 | unsigned char *base_pat; | 1254 | unsigned char *base_pat; |
| @@ -1441,15 +1442,15 @@ search_buffer (Lisp_Object string, EMACS_INT pos, EMACS_INT pos_byte, | |||
| 1441 | 1442 | ||
| 1442 | static EMACS_INT | 1443 | static EMACS_INT |
| 1443 | simple_search (EMACS_INT n, unsigned char *pat, | 1444 | simple_search (EMACS_INT n, unsigned char *pat, |
| 1444 | EMACS_INT len, EMACS_INT len_byte, Lisp_Object trt, | 1445 | ptrdiff_t len, ptrdiff_t len_byte, Lisp_Object trt, |
| 1445 | EMACS_INT pos, EMACS_INT pos_byte, | 1446 | ptrdiff_t pos, ptrdiff_t pos_byte, |
| 1446 | EMACS_INT lim, EMACS_INT lim_byte) | 1447 | ptrdiff_t lim, ptrdiff_t lim_byte) |
| 1447 | { | 1448 | { |
| 1448 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 1449 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 1449 | int forward = n > 0; | 1450 | int forward = n > 0; |
| 1450 | /* Number of buffer bytes matched. Note that this may be different | 1451 | /* Number of buffer bytes matched. Note that this may be different |
| 1451 | from len_byte in a multibyte buffer. */ | 1452 | from len_byte in a multibyte buffer. */ |
| 1452 | EMACS_INT match_byte; | 1453 | ptrdiff_t match_byte; |
| 1453 | 1454 | ||
| 1454 | if (lim > pos && multibyte) | 1455 | if (lim > pos && multibyte) |
| 1455 | while (n > 0) | 1456 | while (n > 0) |
| @@ -1457,9 +1458,9 @@ simple_search (EMACS_INT n, unsigned char *pat, | |||
| 1457 | while (1) | 1458 | while (1) |
| 1458 | { | 1459 | { |
| 1459 | /* Try matching at position POS. */ | 1460 | /* Try matching at position POS. */ |
| 1460 | EMACS_INT this_pos = pos; | 1461 | ptrdiff_t this_pos = pos; |
| 1461 | EMACS_INT this_pos_byte = pos_byte; | 1462 | ptrdiff_t this_pos_byte = pos_byte; |
| 1462 | EMACS_INT this_len = len; | 1463 | ptrdiff_t this_len = len; |
| 1463 | unsigned char *p = pat; | 1464 | unsigned char *p = pat; |
| 1464 | if (pos + len > lim || pos_byte + len_byte > lim_byte) | 1465 | if (pos + len > lim || pos_byte + len_byte > lim_byte) |
| 1465 | goto stop; | 1466 | goto stop; |
| @@ -1503,8 +1504,8 @@ simple_search (EMACS_INT n, unsigned char *pat, | |||
| 1503 | while (1) | 1504 | while (1) |
| 1504 | { | 1505 | { |
| 1505 | /* Try matching at position POS. */ | 1506 | /* Try matching at position POS. */ |
| 1506 | EMACS_INT this_pos = pos; | 1507 | ptrdiff_t this_pos = pos; |
| 1507 | EMACS_INT this_len = len; | 1508 | ptrdiff_t this_len = len; |
| 1508 | unsigned char *p = pat; | 1509 | unsigned char *p = pat; |
| 1509 | 1510 | ||
| 1510 | if (pos + len > lim) | 1511 | if (pos + len > lim) |
| @@ -1542,9 +1543,9 @@ simple_search (EMACS_INT n, unsigned char *pat, | |||
| 1542 | while (1) | 1543 | while (1) |
| 1543 | { | 1544 | { |
| 1544 | /* Try matching at position POS. */ | 1545 | /* Try matching at position POS. */ |
| 1545 | EMACS_INT this_pos = pos; | 1546 | ptrdiff_t this_pos = pos; |
| 1546 | EMACS_INT this_pos_byte = pos_byte; | 1547 | ptrdiff_t this_pos_byte = pos_byte; |
| 1547 | EMACS_INT this_len = len; | 1548 | ptrdiff_t this_len = len; |
| 1548 | const unsigned char *p = pat + len_byte; | 1549 | const unsigned char *p = pat + len_byte; |
| 1549 | 1550 | ||
| 1550 | if (this_pos - len < lim || (pos_byte - len_byte) < lim_byte) | 1551 | if (this_pos - len < lim || (pos_byte - len_byte) < lim_byte) |
| @@ -1585,8 +1586,8 @@ simple_search (EMACS_INT n, unsigned char *pat, | |||
| 1585 | while (1) | 1586 | while (1) |
| 1586 | { | 1587 | { |
| 1587 | /* Try matching at position POS. */ | 1588 | /* Try matching at position POS. */ |
| 1588 | EMACS_INT this_pos = pos - len; | 1589 | ptrdiff_t this_pos = pos - len; |
| 1589 | EMACS_INT this_len = len; | 1590 | ptrdiff_t this_len = len; |
| 1590 | unsigned char *p = pat; | 1591 | unsigned char *p = pat; |
| 1591 | 1592 | ||
| 1592 | if (this_pos < lim) | 1593 | if (this_pos < lim) |
| @@ -1650,18 +1651,18 @@ simple_search (EMACS_INT n, unsigned char *pat, | |||
| 1650 | 1651 | ||
| 1651 | static EMACS_INT | 1652 | static EMACS_INT |
| 1652 | boyer_moore (EMACS_INT n, unsigned char *base_pat, | 1653 | boyer_moore (EMACS_INT n, unsigned char *base_pat, |
| 1653 | EMACS_INT len_byte, | 1654 | ptrdiff_t len_byte, |
| 1654 | Lisp_Object trt, Lisp_Object inverse_trt, | 1655 | Lisp_Object trt, Lisp_Object inverse_trt, |
| 1655 | EMACS_INT pos_byte, EMACS_INT lim_byte, | 1656 | ptrdiff_t pos_byte, ptrdiff_t lim_byte, |
| 1656 | int char_base) | 1657 | int char_base) |
| 1657 | { | 1658 | { |
| 1658 | int direction = ((n > 0) ? 1 : -1); | 1659 | int direction = ((n > 0) ? 1 : -1); |
| 1659 | register EMACS_INT dirlen; | 1660 | register ptrdiff_t dirlen; |
| 1660 | EMACS_INT limit; | 1661 | ptrdiff_t limit; |
| 1661 | int stride_for_teases = 0; | 1662 | int stride_for_teases = 0; |
| 1662 | int BM_tab[0400]; | 1663 | int BM_tab[0400]; |
| 1663 | register unsigned char *cursor, *p_limit; | 1664 | register unsigned char *cursor, *p_limit; |
| 1664 | register EMACS_INT i; | 1665 | register ptrdiff_t i; |
| 1665 | register int j; | 1666 | register int j; |
| 1666 | unsigned char *pat, *pat_end; | 1667 | unsigned char *pat, *pat_end; |
| 1667 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 1668 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| @@ -1813,7 +1814,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 1813 | char if reverse) of pattern would align in a possible match. */ | 1814 | char if reverse) of pattern would align in a possible match. */ |
| 1814 | while (n != 0) | 1815 | while (n != 0) |
| 1815 | { | 1816 | { |
| 1816 | EMACS_INT tail_end; | 1817 | ptrdiff_t tail_end; |
| 1817 | unsigned char *tail_end_ptr; | 1818 | unsigned char *tail_end_ptr; |
| 1818 | 1819 | ||
| 1819 | /* It's been reported that some (broken) compiler thinks that | 1820 | /* It's been reported that some (broken) compiler thinks that |
| @@ -1917,7 +1918,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 1917 | cursor += dirlen - i - direction; /* fix cursor */ | 1918 | cursor += dirlen - i - direction; /* fix cursor */ |
| 1918 | if (i + direction == 0) | 1919 | if (i + direction == 0) |
| 1919 | { | 1920 | { |
| 1920 | EMACS_INT position, start, end; | 1921 | ptrdiff_t position, start, end; |
| 1921 | 1922 | ||
| 1922 | cursor -= direction; | 1923 | cursor -= direction; |
| 1923 | 1924 | ||
| @@ -2009,7 +2010,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 2009 | pos_byte += dirlen - i - direction; | 2010 | pos_byte += dirlen - i - direction; |
| 2010 | if (i + direction == 0) | 2011 | if (i + direction == 0) |
| 2011 | { | 2012 | { |
| 2012 | EMACS_INT position, start, end; | 2013 | ptrdiff_t position, start, end; |
| 2013 | pos_byte -= direction; | 2014 | pos_byte -= direction; |
| 2014 | 2015 | ||
| 2015 | position = pos_byte + ((direction > 0) ? 1 - len_byte : 0); | 2016 | position = pos_byte + ((direction > 0) ? 1 - len_byte : 0); |
| @@ -2050,9 +2051,9 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 2050 | Also clear out the match data for registers 1 and up. */ | 2051 | Also clear out the match data for registers 1 and up. */ |
| 2051 | 2052 | ||
| 2052 | static void | 2053 | static void |
| 2053 | set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes) | 2054 | set_search_regs (ptrdiff_t beg_byte, ptrdiff_t nbytes) |
| 2054 | { | 2055 | { |
| 2055 | int i; | 2056 | ptrdiff_t i; |
| 2056 | 2057 | ||
| 2057 | if (!NILP (Vinhibit_changing_match_data)) | 2058 | if (!NILP (Vinhibit_changing_match_data)) |
| 2058 | return; | 2059 | return; |
| @@ -2087,7 +2088,7 @@ static Lisp_Object | |||
| 2087 | wordify (Lisp_Object string, int lax) | 2088 | wordify (Lisp_Object string, int lax) |
| 2088 | { | 2089 | { |
| 2089 | register unsigned char *o; | 2090 | register unsigned char *o; |
| 2090 | register EMACS_INT i, i_byte, len, punct_count = 0, word_count = 0; | 2091 | register ptrdiff_t i, i_byte, len, punct_count = 0, word_count = 0; |
| 2091 | Lisp_Object val; | 2092 | Lisp_Object val; |
| 2092 | int prev_c = 0; | 2093 | int prev_c = 0; |
| 2093 | EMACS_INT adjust; | 2094 | EMACS_INT adjust; |
| @@ -2124,14 +2125,24 @@ wordify (Lisp_Object string, int lax) | |||
| 2124 | return empty_unibyte_string; | 2125 | return empty_unibyte_string; |
| 2125 | } | 2126 | } |
| 2126 | 2127 | ||
| 2127 | adjust = - punct_count + 5 * (word_count - 1) | 2128 | adjust = word_count - 1; |
| 2129 | if (INT_MULTIPLY_OVERFLOW (5, adjust)) | ||
| 2130 | memory_full (SIZE_MAX); | ||
| 2131 | adjust = - punct_count + 5 * adjust | ||
| 2128 | + ((lax && !whitespace_at_end) ? 2 : 4); | 2132 | + ((lax && !whitespace_at_end) ? 2 : 4); |
| 2129 | if (STRING_MULTIBYTE (string)) | 2133 | if (STRING_MULTIBYTE (string)) |
| 2130 | val = make_uninit_multibyte_string (len + adjust, | 2134 | { |
| 2131 | SBYTES (string) | 2135 | if (INT_ADD_OVERFLOW (SBYTES (string), adjust)) |
| 2132 | + adjust); | 2136 | memory_full (SIZE_MAX); |
| 2137 | val = make_uninit_multibyte_string (len + adjust, | ||
| 2138 | SBYTES (string) + adjust); | ||
| 2139 | } | ||
| 2133 | else | 2140 | else |
| 2134 | val = make_uninit_string (len + adjust); | 2141 | { |
| 2142 | if (INT_ADD_OVERFLOW (len, adjust)) | ||
| 2143 | memory_full (SIZE_MAX); | ||
| 2144 | val = make_uninit_string (len + adjust); | ||
| 2145 | } | ||
| 2135 | 2146 | ||
| 2136 | o = SDATA (val); | 2147 | o = SDATA (val); |
| 2137 | *o++ = '\\'; | 2148 | *o++ = '\\'; |
| @@ -2141,7 +2152,7 @@ wordify (Lisp_Object string, int lax) | |||
| 2141 | for (i = 0, i_byte = 0; i < len; ) | 2152 | for (i = 0, i_byte = 0; i < len; ) |
| 2142 | { | 2153 | { |
| 2143 | int c; | 2154 | int c; |
| 2144 | EMACS_INT i_byte_orig = i_byte; | 2155 | ptrdiff_t i_byte_orig = i_byte; |
| 2145 | 2156 | ||
| 2146 | FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, i, i_byte); | 2157 | FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c, string, i, i_byte); |
| 2147 | 2158 | ||
| @@ -2398,14 +2409,14 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2398 | (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp) | 2409 | (Lisp_Object newtext, Lisp_Object fixedcase, Lisp_Object literal, Lisp_Object string, Lisp_Object subexp) |
| 2399 | { | 2410 | { |
| 2400 | enum { nochange, all_caps, cap_initial } case_action; | 2411 | enum { nochange, all_caps, cap_initial } case_action; |
| 2401 | register EMACS_INT pos, pos_byte; | 2412 | register ptrdiff_t pos, pos_byte; |
| 2402 | int some_multiletter_word; | 2413 | int some_multiletter_word; |
| 2403 | int some_lowercase; | 2414 | int some_lowercase; |
| 2404 | int some_uppercase; | 2415 | int some_uppercase; |
| 2405 | int some_nonuppercase_initial; | 2416 | int some_nonuppercase_initial; |
| 2406 | register int c, prevc; | 2417 | register int c, prevc; |
| 2407 | ptrdiff_t sub; | 2418 | ptrdiff_t sub; |
| 2408 | EMACS_INT opoint, newpoint; | 2419 | ptrdiff_t opoint, newpoint; |
| 2409 | 2420 | ||
| 2410 | CHECK_STRING (newtext); | 2421 | CHECK_STRING (newtext); |
| 2411 | 2422 | ||
| @@ -2448,7 +2459,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2448 | if (NILP (fixedcase)) | 2459 | if (NILP (fixedcase)) |
| 2449 | { | 2460 | { |
| 2450 | /* Decide how to casify by examining the matched text. */ | 2461 | /* Decide how to casify by examining the matched text. */ |
| 2451 | EMACS_INT last; | 2462 | ptrdiff_t last; |
| 2452 | 2463 | ||
| 2453 | pos = search_regs.start[sub]; | 2464 | pos = search_regs.start[sub]; |
| 2454 | last = search_regs.end[sub]; | 2465 | last = search_regs.end[sub]; |
| @@ -2535,19 +2546,19 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2535 | if desired. */ | 2546 | if desired. */ |
| 2536 | if (NILP (literal)) | 2547 | if (NILP (literal)) |
| 2537 | { | 2548 | { |
| 2538 | EMACS_INT lastpos = 0; | 2549 | ptrdiff_t lastpos = 0; |
| 2539 | EMACS_INT lastpos_byte = 0; | 2550 | ptrdiff_t lastpos_byte = 0; |
| 2540 | /* We build up the substituted string in ACCUM. */ | 2551 | /* We build up the substituted string in ACCUM. */ |
| 2541 | Lisp_Object accum; | 2552 | Lisp_Object accum; |
| 2542 | Lisp_Object middle; | 2553 | Lisp_Object middle; |
| 2543 | EMACS_INT length = SBYTES (newtext); | 2554 | ptrdiff_t length = SBYTES (newtext); |
| 2544 | 2555 | ||
| 2545 | accum = Qnil; | 2556 | accum = Qnil; |
| 2546 | 2557 | ||
| 2547 | for (pos_byte = 0, pos = 0; pos_byte < length;) | 2558 | for (pos_byte = 0, pos = 0; pos_byte < length;) |
| 2548 | { | 2559 | { |
| 2549 | EMACS_INT substart = -1; | 2560 | ptrdiff_t substart = -1; |
| 2550 | EMACS_INT subend = 0; | 2561 | ptrdiff_t subend = 0; |
| 2551 | int delbackslash = 0; | 2562 | int delbackslash = 0; |
| 2552 | 2563 | ||
| 2553 | FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); | 2564 | FETCH_STRING_CHAR_ADVANCE (c, newtext, pos, pos_byte); |
| @@ -2563,8 +2574,8 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2563 | } | 2574 | } |
| 2564 | else if (c >= '1' && c <= '9') | 2575 | else if (c >= '1' && c <= '9') |
| 2565 | { | 2576 | { |
| 2566 | if (search_regs.start[c - '0'] >= 0 | 2577 | if (c - '0' < search_regs.num_regs |
| 2567 | && c <= search_regs.num_regs + '0') | 2578 | && 0 <= search_regs.start[c - '0']) |
| 2568 | { | 2579 | { |
| 2569 | substart = search_regs.start[c - '0']; | 2580 | substart = search_regs.start[c - '0']; |
| 2570 | subend = search_regs.end[c - '0']; | 2581 | subend = search_regs.end[c - '0']; |
| @@ -2702,7 +2713,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2702 | 2713 | ||
| 2703 | if (c == '&') | 2714 | if (c == '&') |
| 2704 | idx = sub; | 2715 | idx = sub; |
| 2705 | else if (c >= '1' && c <= '9' && c <= search_regs.num_regs + '0') | 2716 | else if (c >= '1' && c <= '9' && c - '0' < search_regs.num_regs) |
| 2706 | { | 2717 | { |
| 2707 | if (search_regs.start[c - '0'] >= 1) | 2718 | if (search_regs.start[c - '0'] >= 1) |
| 2708 | idx = c - '0'; | 2719 | idx = c - '0'; |
| @@ -2754,7 +2765,7 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2754 | { | 2765 | { |
| 2755 | if (buf_multibyte) | 2766 | if (buf_multibyte) |
| 2756 | { | 2767 | { |
| 2757 | EMACS_INT nchars = | 2768 | ptrdiff_t nchars = |
| 2758 | multibyte_chars_in_text (substed, substed_len); | 2769 | multibyte_chars_in_text (substed, substed_len); |
| 2759 | 2770 | ||
| 2760 | newtext = make_multibyte_string ((char *) substed, nchars, | 2771 | newtext = make_multibyte_string ((char *) substed, nchars, |
| @@ -2780,10 +2791,10 @@ since only regular expressions have distinguished subexpressions. */) | |||
| 2780 | 2791 | ||
| 2781 | /* Adjust search data for this change. */ | 2792 | /* Adjust search data for this change. */ |
| 2782 | { | 2793 | { |
| 2783 | EMACS_INT oldend = search_regs.end[sub]; | 2794 | ptrdiff_t oldend = search_regs.end[sub]; |
| 2784 | EMACS_INT oldstart = search_regs.start[sub]; | 2795 | ptrdiff_t oldstart = search_regs.start[sub]; |
| 2785 | EMACS_INT change = newpoint - search_regs.end[sub]; | 2796 | ptrdiff_t change = newpoint - search_regs.end[sub]; |
| 2786 | int i; | 2797 | ptrdiff_t i; |
| 2787 | 2798 | ||
| 2788 | for (i = 0; i < search_regs.num_regs; i++) | 2799 | for (i = 0; i < search_regs.num_regs; i++) |
| 2789 | { | 2800 | { |
| @@ -2876,7 +2887,7 @@ Return value is undefined if the last search failed. */) | |||
| 2876 | { | 2887 | { |
| 2877 | Lisp_Object tail, prev; | 2888 | Lisp_Object tail, prev; |
| 2878 | Lisp_Object *data; | 2889 | Lisp_Object *data; |
| 2879 | int i, len; | 2890 | ptrdiff_t i, len; |
| 2880 | 2891 | ||
| 2881 | if (!NILP (reseat)) | 2892 | if (!NILP (reseat)) |
| 2882 | for (tail = reuse; CONSP (tail); tail = XCDR (tail)) | 2893 | for (tail = reuse; CONSP (tail); tail = XCDR (tail)) |
| @@ -2897,7 +2908,7 @@ Return value is undefined if the last search failed. */) | |||
| 2897 | len = 0; | 2908 | len = 0; |
| 2898 | for (i = 0; i < search_regs.num_regs; i++) | 2909 | for (i = 0; i < search_regs.num_regs; i++) |
| 2899 | { | 2910 | { |
| 2900 | EMACS_INT start = search_regs.start[i]; | 2911 | ptrdiff_t start = search_regs.start[i]; |
| 2901 | if (start >= 0) | 2912 | if (start >= 0) |
| 2902 | { | 2913 | { |
| 2903 | if (EQ (last_thing_searched, Qt) | 2914 | if (EQ (last_thing_searched, Qt) |
| @@ -2988,11 +2999,13 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) | |||
| 2988 | 2999 | ||
| 2989 | /* Allocate registers if they don't already exist. */ | 3000 | /* Allocate registers if they don't already exist. */ |
| 2990 | { | 3001 | { |
| 2991 | ptrdiff_t length = XFASTINT (Flength (list)) / 2; | 3002 | EMACS_INT length = XFASTINT (Flength (list)) / 2; |
| 2992 | 3003 | ||
| 2993 | if (length > search_regs.num_regs) | 3004 | if (length > search_regs.num_regs) |
| 2994 | { | 3005 | { |
| 2995 | ptrdiff_t num_regs = search_regs.num_regs; | 3006 | ptrdiff_t num_regs = search_regs.num_regs; |
| 3007 | if (PTRDIFF_MAX < length) | ||
| 3008 | memory_full (SIZE_MAX); | ||
| 2996 | search_regs.start = | 3009 | search_regs.start = |
| 2997 | xpalloc (search_regs.start, &num_regs, length - num_regs, | 3010 | xpalloc (search_regs.start, &num_regs, length - num_regs, |
| 2998 | min (PTRDIFF_MAX, UINT_MAX), sizeof (regoff_t)); | 3011 | min (PTRDIFF_MAX, UINT_MAX), sizeof (regoff_t)); |
| @@ -3022,7 +3035,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) | |||
| 3022 | } | 3035 | } |
| 3023 | else | 3036 | else |
| 3024 | { | 3037 | { |
| 3025 | EMACS_INT from; | 3038 | Lisp_Object from; |
| 3026 | Lisp_Object m; | 3039 | Lisp_Object m; |
| 3027 | 3040 | ||
| 3028 | m = marker; | 3041 | m = marker; |
| @@ -3035,7 +3048,7 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) | |||
| 3035 | } | 3048 | } |
| 3036 | 3049 | ||
| 3037 | CHECK_NUMBER_COERCE_MARKER (marker); | 3050 | CHECK_NUMBER_COERCE_MARKER (marker); |
| 3038 | from = XINT (marker); | 3051 | from = marker; |
| 3039 | 3052 | ||
| 3040 | if (!NILP (reseat) && MARKERP (m)) | 3053 | if (!NILP (reseat) && MARKERP (m)) |
| 3041 | { | 3054 | { |
| @@ -3052,8 +3065,18 @@ If optional arg RESEAT is non-nil, make markers on LIST point nowhere. */) | |||
| 3052 | XSETFASTINT (marker, 0); | 3065 | XSETFASTINT (marker, 0); |
| 3053 | 3066 | ||
| 3054 | CHECK_NUMBER_COERCE_MARKER (marker); | 3067 | CHECK_NUMBER_COERCE_MARKER (marker); |
| 3055 | search_regs.start[i] = from; | 3068 | if (TYPE_MINIMUM (regoff_t) <= XINT (from) |
| 3056 | search_regs.end[i] = XINT (marker); | 3069 | && XINT (from) <= TYPE_MAXIMUM (regoff_t) |
| 3070 | && TYPE_MINIMUM (regoff_t) <= XINT (marker) | ||
| 3071 | && XINT (marker) <= TYPE_MAXIMUM (regoff_t)) | ||
| 3072 | { | ||
| 3073 | search_regs.start[i] = XINT (from); | ||
| 3074 | search_regs.end[i] = XINT (marker); | ||
| 3075 | } | ||
| 3076 | else | ||
| 3077 | { | ||
| 3078 | search_regs.start[i] = -1; | ||
| 3079 | } | ||
| 3057 | 3080 | ||
| 3058 | if (!NILP (reseat) && MARKERP (m)) | 3081 | if (!NILP (reseat) && MARKERP (m)) |
| 3059 | { | 3082 | { |
diff --git a/src/sound.c b/src/sound.c index 362c04b7d40..b95fa82202f 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -235,11 +235,11 @@ struct sound_device | |||
| 235 | 235 | ||
| 236 | /* Return a preferred data size in bytes to be sent to write (below) | 236 | /* Return a preferred data size in bytes to be sent to write (below) |
| 237 | each time. 2048 is used if this is NULL. */ | 237 | each time. 2048 is used if this is NULL. */ |
| 238 | EMACS_INT (* period_size) (struct sound_device *sd); | 238 | ptrdiff_t (* period_size) (struct sound_device *sd); |
| 239 | 239 | ||
| 240 | /* Write NYBTES bytes from BUFFER to device SD. */ | 240 | /* Write NYBTES bytes from BUFFER to device SD. */ |
| 241 | void (* write) (struct sound_device *sd, const char *buffer, | 241 | void (* write) (struct sound_device *sd, const char *buffer, |
| 242 | EMACS_INT nbytes); | 242 | ptrdiff_t nbytes); |
| 243 | 243 | ||
| 244 | /* A place for devices to store additional data. */ | 244 | /* A place for devices to store additional data. */ |
| 245 | void *data; | 245 | void *data; |
| @@ -291,7 +291,7 @@ static void vox_configure (struct sound_device *); | |||
| 291 | static void vox_close (struct sound_device *sd); | 291 | static void vox_close (struct sound_device *sd); |
| 292 | static void vox_choose_format (struct sound_device *, struct sound *); | 292 | static void vox_choose_format (struct sound_device *, struct sound *); |
| 293 | static int vox_init (struct sound_device *); | 293 | static int vox_init (struct sound_device *); |
| 294 | static void vox_write (struct sound_device *, const char *, EMACS_INT); | 294 | static void vox_write (struct sound_device *, const char *, ptrdiff_t); |
| 295 | static void find_sound_type (struct sound *); | 295 | static void find_sound_type (struct sound *); |
| 296 | static u_int32_t le2hl (u_int32_t); | 296 | static u_int32_t le2hl (u_int32_t); |
| 297 | static u_int16_t le2hs (u_int16_t); | 297 | static u_int16_t le2hs (u_int16_t); |
| @@ -600,9 +600,9 @@ wav_play (struct sound *s, struct sound_device *sd) | |||
| 600 | else | 600 | else |
| 601 | { | 601 | { |
| 602 | char *buffer; | 602 | char *buffer; |
| 603 | EMACS_INT nbytes = 0; | 603 | ptrdiff_t nbytes = 0; |
| 604 | EMACS_INT blksize = sd->period_size ? sd->period_size (sd) : 2048; | 604 | ptrdiff_t blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 605 | EMACS_INT data_left = header->data_length; | 605 | ptrdiff_t data_left = header->data_length; |
| 606 | 606 | ||
| 607 | buffer = (char *) alloca (blksize); | 607 | buffer = (char *) alloca (blksize); |
| 608 | lseek (s->fd, sizeof *header, SEEK_SET); | 608 | lseek (s->fd, sizeof *header, SEEK_SET); |
| @@ -690,9 +690,9 @@ au_play (struct sound *s, struct sound_device *sd) | |||
| 690 | SBYTES (s->data) - header->data_offset); | 690 | SBYTES (s->data) - header->data_offset); |
| 691 | else | 691 | else |
| 692 | { | 692 | { |
| 693 | EMACS_INT blksize = sd->period_size ? sd->period_size (sd) : 2048; | 693 | ptrdiff_t blksize = sd->period_size ? sd->period_size (sd) : 2048; |
| 694 | char *buffer; | 694 | char *buffer; |
| 695 | EMACS_INT nbytes; | 695 | ptrdiff_t nbytes; |
| 696 | 696 | ||
| 697 | /* Seek */ | 697 | /* Seek */ |
| 698 | lseek (s->fd, header->data_offset, SEEK_SET); | 698 | lseek (s->fd, header->data_offset, SEEK_SET); |
| @@ -895,7 +895,7 @@ vox_init (struct sound_device *sd) | |||
| 895 | /* Write NBYTES bytes from BUFFER to device SD. */ | 895 | /* Write NBYTES bytes from BUFFER to device SD. */ |
| 896 | 896 | ||
| 897 | static void | 897 | static void |
| 898 | vox_write (struct sound_device *sd, const char *buffer, EMACS_INT nbytes) | 898 | vox_write (struct sound_device *sd, const char *buffer, ptrdiff_t nbytes) |
| 899 | { | 899 | { |
| 900 | if (emacs_write (sd->fd, buffer, nbytes) != nbytes) | 900 | if (emacs_write (sd->fd, buffer, nbytes) != nbytes) |
| 901 | sound_perror ("Error writing to sound device"); | 901 | sound_perror ("Error writing to sound device"); |
| @@ -952,7 +952,7 @@ alsa_open (struct sound_device *sd) | |||
| 952 | alsa_sound_perror (file, err); | 952 | alsa_sound_perror (file, err); |
| 953 | } | 953 | } |
| 954 | 954 | ||
| 955 | static EMACS_INT | 955 | static ptrdiff_t |
| 956 | alsa_period_size (struct sound_device *sd) | 956 | alsa_period_size (struct sound_device *sd) |
| 957 | { | 957 | { |
| 958 | struct alsa_params *p = (struct alsa_params *) sd->data; | 958 | struct alsa_params *p = (struct alsa_params *) sd->data; |
| @@ -1155,13 +1155,13 @@ alsa_choose_format (struct sound_device *sd, struct sound *s) | |||
| 1155 | /* Write NBYTES bytes from BUFFER to device SD. */ | 1155 | /* Write NBYTES bytes from BUFFER to device SD. */ |
| 1156 | 1156 | ||
| 1157 | static void | 1157 | static void |
| 1158 | alsa_write (struct sound_device *sd, const char *buffer, EMACS_INT nbytes) | 1158 | alsa_write (struct sound_device *sd, const char *buffer, ptrdiff_t nbytes) |
| 1159 | { | 1159 | { |
| 1160 | struct alsa_params *p = (struct alsa_params *) sd->data; | 1160 | struct alsa_params *p = (struct alsa_params *) sd->data; |
| 1161 | 1161 | ||
| 1162 | /* The the third parameter to snd_pcm_writei is frames, not bytes. */ | 1162 | /* The the third parameter to snd_pcm_writei is frames, not bytes. */ |
| 1163 | int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; | 1163 | int fact = snd_pcm_format_size (sd->format, 1) * sd->channels; |
| 1164 | EMACS_INT nwritten = 0; | 1164 | ptrdiff_t nwritten = 0; |
| 1165 | int err; | 1165 | int err; |
| 1166 | 1166 | ||
| 1167 | while (nwritten < nbytes) | 1167 | while (nwritten < nbytes) |
| @@ -1348,7 +1348,7 @@ Internal use only, use `play-sound' instead. */) | |||
| 1348 | (Lisp_Object sound) | 1348 | (Lisp_Object sound) |
| 1349 | { | 1349 | { |
| 1350 | Lisp_Object attrs[SOUND_ATTR_SENTINEL]; | 1350 | Lisp_Object attrs[SOUND_ATTR_SENTINEL]; |
| 1351 | int count = SPECPDL_INDEX (); | 1351 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1352 | 1352 | ||
| 1353 | #ifndef WINDOWSNT | 1353 | #ifndef WINDOWSNT |
| 1354 | Lisp_Object file; | 1354 | Lisp_Object file; |
diff --git a/src/syntax.c b/src/syntax.c index 3e51099794b..2960a9c96a0 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -94,8 +94,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 94 | string-ender-char to distinguish comments/strings started by | 94 | string-ender-char to distinguish comments/strings started by |
| 95 | comment_fence and string_fence codes. */ | 95 | comment_fence and string_fence codes. */ |
| 96 | 96 | ||
| 97 | #define ST_COMMENT_STYLE (256 + 1) | 97 | #define ST_COMMENT_STYLE (SYNTAX_FLAGS_COMMENT_STYLE (~0, ~0) + 1) |
| 98 | #define ST_STRING_STYLE (256 + 2) | 98 | #define ST_STRING_STYLE (MAX_CHAR + 1) |
| 99 | 99 | ||
| 100 | static Lisp_Object Qsyntax_table_p; | 100 | static Lisp_Object Qsyntax_table_p; |
| 101 | static Lisp_Object Qsyntax_table, Qscan_error; | 101 | static Lisp_Object Qsyntax_table, Qscan_error; |
| @@ -111,18 +111,18 @@ Lisp_Object syntax_temp; | |||
| 111 | 111 | ||
| 112 | struct lisp_parse_state | 112 | struct lisp_parse_state |
| 113 | { | 113 | { |
| 114 | int depth; /* Depth at end of parsing. */ | 114 | EMACS_INT depth; /* Depth at end of parsing. */ |
| 115 | int instring; /* -1 if not within string, else desired terminator. */ | 115 | int instring; /* -1 if not within string, else desired terminator. */ |
| 116 | int incomment; /* -1 if in unnestable comment else comment nesting */ | 116 | EMACS_INT incomment; /* -1 if in unnestable comment else comment nesting */ |
| 117 | int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ | 117 | int comstyle; /* comment style a=0, or b=1, or ST_COMMENT_STYLE. */ |
| 118 | int quoted; /* Nonzero if just after an escape char at end of parsing */ | 118 | int quoted; /* Nonzero if just after an escape char at end of parsing */ |
| 119 | int mindepth; /* Minimum depth seen while scanning. */ | 119 | EMACS_INT mindepth; /* Minimum depth seen while scanning. */ |
| 120 | /* Char number of most recent start-of-expression at current level */ | 120 | /* Char number of most recent start-of-expression at current level */ |
| 121 | EMACS_INT thislevelstart; | 121 | ptrdiff_t thislevelstart; |
| 122 | /* Char number of start of containing expression */ | 122 | /* Char number of start of containing expression */ |
| 123 | EMACS_INT prevlevelstart; | 123 | ptrdiff_t prevlevelstart; |
| 124 | EMACS_INT location; /* Char number at which parsing stopped. */ | 124 | ptrdiff_t location; /* Char number at which parsing stopped. */ |
| 125 | EMACS_INT comstr_start; /* Position of last comment/string starter. */ | 125 | ptrdiff_t comstr_start; /* Position of last comment/string starter. */ |
| 126 | Lisp_Object levelstarts; /* Char numbers of starts-of-expression | 126 | Lisp_Object levelstarts; /* Char numbers of starts-of-expression |
| 127 | of levels (starting from outermost). */ | 127 | of levels (starting from outermost). */ |
| 128 | }; | 128 | }; |
| @@ -135,12 +135,12 @@ struct lisp_parse_state | |||
| 135 | find_start_begv is the BEGV value when it was found. | 135 | find_start_begv is the BEGV value when it was found. |
| 136 | find_start_modiff is the value of MODIFF when it was found. */ | 136 | find_start_modiff is the value of MODIFF when it was found. */ |
| 137 | 137 | ||
| 138 | static EMACS_INT find_start_pos; | 138 | static ptrdiff_t find_start_pos; |
| 139 | static EMACS_INT find_start_value; | 139 | static ptrdiff_t find_start_value; |
| 140 | static EMACS_INT find_start_value_byte; | 140 | static ptrdiff_t find_start_value_byte; |
| 141 | static struct buffer *find_start_buffer; | 141 | static struct buffer *find_start_buffer; |
| 142 | static EMACS_INT find_start_begv; | 142 | static ptrdiff_t find_start_begv; |
| 143 | static int find_start_modiff; | 143 | static EMACS_INT find_start_modiff; |
| 144 | 144 | ||
| 145 | 145 | ||
| 146 | static Lisp_Object Fsyntax_table_p (Lisp_Object); | 146 | static Lisp_Object Fsyntax_table_p (Lisp_Object); |
| @@ -148,7 +148,7 @@ static Lisp_Object skip_chars (int, Lisp_Object, Lisp_Object, int); | |||
| 148 | static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); | 148 | static Lisp_Object skip_syntaxes (int, Lisp_Object, Lisp_Object); |
| 149 | static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); | 149 | static Lisp_Object scan_lists (EMACS_INT, EMACS_INT, EMACS_INT, int); |
| 150 | static void scan_sexps_forward (struct lisp_parse_state *, | 150 | static void scan_sexps_forward (struct lisp_parse_state *, |
| 151 | EMACS_INT, EMACS_INT, EMACS_INT, int, | 151 | ptrdiff_t, ptrdiff_t, ptrdiff_t, EMACS_INT, |
| 152 | int, Lisp_Object, int); | 152 | int, Lisp_Object, int); |
| 153 | static int in_classes (int, Lisp_Object); | 153 | static int in_classes (int, Lisp_Object); |
| 154 | 154 | ||
| @@ -177,7 +177,7 @@ struct gl_state_s gl_state; /* Global state of syntax parser. */ | |||
| 177 | start/end of OBJECT. */ | 177 | start/end of OBJECT. */ |
| 178 | 178 | ||
| 179 | void | 179 | void |
| 180 | update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init, | 180 | update_syntax_table (ptrdiff_t charpos, EMACS_INT count, int init, |
| 181 | Lisp_Object object) | 181 | Lisp_Object object) |
| 182 | { | 182 | { |
| 183 | Lisp_Object tmp_table; | 183 | Lisp_Object tmp_table; |
| @@ -339,12 +339,12 @@ update_syntax_table (EMACS_INT charpos, EMACS_INT count, int init, | |||
| 339 | or after. On return global syntax data is good for lookup at CHARPOS. */ | 339 | or after. On return global syntax data is good for lookup at CHARPOS. */ |
| 340 | 340 | ||
| 341 | static int | 341 | static int |
| 342 | char_quoted (EMACS_INT charpos, EMACS_INT bytepos) | 342 | char_quoted (ptrdiff_t charpos, ptrdiff_t bytepos) |
| 343 | { | 343 | { |
| 344 | register enum syntaxcode code; | 344 | register enum syntaxcode code; |
| 345 | register EMACS_INT beg = BEGV; | 345 | register ptrdiff_t beg = BEGV; |
| 346 | register int quoted = 0; | 346 | register int quoted = 0; |
| 347 | EMACS_INT orig = charpos; | 347 | ptrdiff_t orig = charpos; |
| 348 | 348 | ||
| 349 | while (charpos > beg) | 349 | while (charpos > beg) |
| 350 | { | 350 | { |
| @@ -367,8 +367,8 @@ char_quoted (EMACS_INT charpos, EMACS_INT bytepos) | |||
| 367 | /* Return the bytepos one character before BYTEPOS. | 367 | /* Return the bytepos one character before BYTEPOS. |
| 368 | We assume that BYTEPOS is not at the start of the buffer. */ | 368 | We assume that BYTEPOS is not at the start of the buffer. */ |
| 369 | 369 | ||
| 370 | static inline EMACS_INT | 370 | static inline ptrdiff_t |
| 371 | dec_bytepos (EMACS_INT bytepos) | 371 | dec_bytepos (ptrdiff_t bytepos) |
| 372 | { | 372 | { |
| 373 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) | 373 | if (NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 374 | return bytepos - 1; | 374 | return bytepos - 1; |
| @@ -391,10 +391,10 @@ dec_bytepos (EMACS_INT bytepos) | |||
| 391 | valid on return from the subroutine, so the caller should explicitly | 391 | valid on return from the subroutine, so the caller should explicitly |
| 392 | update the global data. */ | 392 | update the global data. */ |
| 393 | 393 | ||
| 394 | static EMACS_INT | 394 | static ptrdiff_t |
| 395 | find_defun_start (EMACS_INT pos, EMACS_INT pos_byte) | 395 | find_defun_start (ptrdiff_t pos, ptrdiff_t pos_byte) |
| 396 | { | 396 | { |
| 397 | EMACS_INT opoint = PT, opoint_byte = PT_BYTE; | 397 | ptrdiff_t opoint = PT, opoint_byte = PT_BYTE; |
| 398 | 398 | ||
| 399 | if (!open_paren_in_column_0_is_defun_start) | 399 | if (!open_paren_in_column_0_is_defun_start) |
| 400 | { | 400 | { |
| @@ -461,7 +461,7 @@ find_defun_start (EMACS_INT pos, EMACS_INT pos_byte) | |||
| 461 | /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ | 461 | /* Return the SYNTAX_COMEND_FIRST of the character before POS, POS_BYTE. */ |
| 462 | 462 | ||
| 463 | static int | 463 | static int |
| 464 | prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte) | 464 | prev_char_comend_first (ptrdiff_t pos, ptrdiff_t pos_byte) |
| 465 | { | 465 | { |
| 466 | int c, val; | 466 | int c, val; |
| 467 | 467 | ||
| @@ -503,7 +503,7 @@ prev_char_comend_first (EMACS_INT pos, EMACS_INT pos_byte) | |||
| 503 | the returned value (or at FROM, if the search was not successful). */ | 503 | the returned value (or at FROM, if the search was not successful). */ |
| 504 | 504 | ||
| 505 | static int | 505 | static int |
| 506 | back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested, int comstyle, EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr) | 506 | back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, int comnested, int comstyle, ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr) |
| 507 | { | 507 | { |
| 508 | /* Look back, counting the parity of string-quotes, | 508 | /* Look back, counting the parity of string-quotes, |
| 509 | and recording the comment-starters seen. | 509 | and recording the comment-starters seen. |
| @@ -522,14 +522,14 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 522 | inside another comment). | 522 | inside another comment). |
| 523 | Test case: { a (* b } c (* d *) */ | 523 | Test case: { a (* b } c (* d *) */ |
| 524 | int comment_lossage = 0; | 524 | int comment_lossage = 0; |
| 525 | EMACS_INT comment_end = from; | 525 | ptrdiff_t comment_end = from; |
| 526 | EMACS_INT comment_end_byte = from_byte; | 526 | ptrdiff_t comment_end_byte = from_byte; |
| 527 | EMACS_INT comstart_pos = 0; | 527 | ptrdiff_t comstart_pos = 0; |
| 528 | EMACS_INT comstart_byte IF_LINT (= 0); | 528 | ptrdiff_t comstart_byte IF_LINT (= 0); |
| 529 | /* Place where the containing defun starts, | 529 | /* Place where the containing defun starts, |
| 530 | or 0 if we didn't come across it yet. */ | 530 | or 0 if we didn't come across it yet. */ |
| 531 | EMACS_INT defun_start = 0; | 531 | ptrdiff_t defun_start = 0; |
| 532 | EMACS_INT defun_start_byte = 0; | 532 | ptrdiff_t defun_start_byte = 0; |
| 533 | register enum syntaxcode code; | 533 | register enum syntaxcode code; |
| 534 | int nesting = 1; /* current comment nesting */ | 534 | int nesting = 1; /* current comment nesting */ |
| 535 | int c; | 535 | int c; |
| @@ -543,7 +543,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 543 | that determines quote parity to the comment-end. */ | 543 | that determines quote parity to the comment-end. */ |
| 544 | while (from != stop) | 544 | while (from != stop) |
| 545 | { | 545 | { |
| 546 | EMACS_INT temp_byte; | 546 | ptrdiff_t temp_byte; |
| 547 | int prev_syntax, com2start, com2end; | 547 | int prev_syntax, com2start, com2end; |
| 548 | int comstart; | 548 | int comstart; |
| 549 | 549 | ||
| @@ -581,7 +581,7 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 581 | have %..\n and %{..}%. */ | 581 | have %..\n and %{..}%. */ |
| 582 | if (from > stop && (com2end || comstart)) | 582 | if (from > stop && (com2end || comstart)) |
| 583 | { | 583 | { |
| 584 | EMACS_INT next = from, next_byte = from_byte; | 584 | ptrdiff_t next = from, next_byte = from_byte; |
| 585 | int next_c, next_syntax; | 585 | int next_c, next_syntax; |
| 586 | DEC_BOTH (next, next_byte); | 586 | DEC_BOTH (next, next_byte); |
| 587 | UPDATE_SYNTAX_TABLE_BACKWARD (next); | 587 | UPDATE_SYNTAX_TABLE_BACKWARD (next); |
| @@ -737,7 +737,8 @@ back_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, int comnested | |||
| 737 | { | 737 | { |
| 738 | scan_sexps_forward (&state, | 738 | scan_sexps_forward (&state, |
| 739 | defun_start, defun_start_byte, | 739 | defun_start, defun_start_byte, |
| 740 | comment_end, -10000, 0, Qnil, 0); | 740 | comment_end, TYPE_MINIMUM (EMACS_INT), |
| 741 | 0, Qnil, 0); | ||
| 741 | defun_start = comment_end; | 742 | defun_start = comment_end; |
| 742 | if (state.incomment == (comnested ? 1 : -1) | 743 | if (state.incomment == (comnested ? 1 : -1) |
| 743 | && state.comstyle == comstyle) | 744 | && state.comstyle == comstyle) |
| @@ -1099,13 +1100,13 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1099 | first = XCAR (value); | 1100 | first = XCAR (value); |
| 1100 | match_lisp = XCDR (value); | 1101 | match_lisp = XCDR (value); |
| 1101 | 1102 | ||
| 1102 | if (!INTEGERP (first) || !(NILP (match_lisp) || INTEGERP (match_lisp))) | 1103 | if (!INTEGERP (first) || !(NILP (match_lisp) || CHARACTERP (match_lisp))) |
| 1103 | { | 1104 | { |
| 1104 | insert_string ("invalid"); | 1105 | insert_string ("invalid"); |
| 1105 | return syntax; | 1106 | return syntax; |
| 1106 | } | 1107 | } |
| 1107 | 1108 | ||
| 1108 | syntax_code = XINT (first); | 1109 | syntax_code = XINT (first) & INT_MAX; |
| 1109 | code = (enum syntaxcode) (syntax_code & 0377); | 1110 | code = (enum syntaxcode) (syntax_code & 0377); |
| 1110 | start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); | 1111 | start1 = SYNTAX_FLAGS_COMSTART_FIRST (syntax_code); |
| 1111 | start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; | 1112 | start2 = SYNTAX_FLAGS_COMSTART_SECOND (syntax_code);; |
| @@ -1223,12 +1224,12 @@ DEFUN ("internal-describe-syntax-value", Finternal_describe_syntax_value, | |||
| 1223 | If that many words cannot be found before the end of the buffer, return 0. | 1224 | If that many words cannot be found before the end of the buffer, return 0. |
| 1224 | COUNT negative means scan backward and stop at word beginning. */ | 1225 | COUNT negative means scan backward and stop at word beginning. */ |
| 1225 | 1226 | ||
| 1226 | EMACS_INT | 1227 | ptrdiff_t |
| 1227 | scan_words (register EMACS_INT from, register EMACS_INT count) | 1228 | scan_words (register ptrdiff_t from, register EMACS_INT count) |
| 1228 | { | 1229 | { |
| 1229 | register EMACS_INT beg = BEGV; | 1230 | register ptrdiff_t beg = BEGV; |
| 1230 | register EMACS_INT end = ZV; | 1231 | register ptrdiff_t end = ZV; |
| 1231 | register EMACS_INT from_byte = CHAR_TO_BYTE (from); | 1232 | register ptrdiff_t from_byte = CHAR_TO_BYTE (from); |
| 1232 | register enum syntaxcode code; | 1233 | register enum syntaxcode code; |
| 1233 | int ch0, ch1; | 1234 | int ch0, ch1; |
| 1234 | Lisp_Object func, pos; | 1235 | Lisp_Object func, pos; |
| @@ -1263,7 +1264,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count) | |||
| 1263 | if (! NILP (Ffboundp (func))) | 1264 | if (! NILP (Ffboundp (func))) |
| 1264 | { | 1265 | { |
| 1265 | pos = call2 (func, make_number (from - 1), make_number (end)); | 1266 | pos = call2 (func, make_number (from - 1), make_number (end)); |
| 1266 | if (INTEGERP (pos) && XINT (pos) > from) | 1267 | if (RANGED_INTEGERP (from + 1, pos, ZV)) |
| 1267 | { | 1268 | { |
| 1268 | from = XINT (pos); | 1269 | from = XINT (pos); |
| 1269 | from_byte = CHAR_TO_BYTE (from); | 1270 | from_byte = CHAR_TO_BYTE (from); |
| @@ -1313,7 +1314,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count) | |||
| 1313 | if (! NILP (Ffboundp (func))) | 1314 | if (! NILP (Ffboundp (func))) |
| 1314 | { | 1315 | { |
| 1315 | pos = call2 (func, make_number (from), make_number (beg)); | 1316 | pos = call2 (func, make_number (from), make_number (beg)); |
| 1316 | if (INTEGERP (pos) && XINT (pos) < from) | 1317 | if (RANGED_INTEGERP (BEGV, pos, from - 1)) |
| 1317 | { | 1318 | { |
| 1318 | from = XINT (pos); | 1319 | from = XINT (pos); |
| 1319 | from_byte = CHAR_TO_BYTE (from); | 1320 | from_byte = CHAR_TO_BYTE (from); |
| @@ -1357,7 +1358,7 @@ and the function returns nil. Field boundaries are not noticed if | |||
| 1357 | (Lisp_Object arg) | 1358 | (Lisp_Object arg) |
| 1358 | { | 1359 | { |
| 1359 | Lisp_Object tmp; | 1360 | Lisp_Object tmp; |
| 1360 | int orig_val, val; | 1361 | ptrdiff_t orig_val, val; |
| 1361 | 1362 | ||
| 1362 | if (NILP (arg)) | 1363 | if (NILP (arg)) |
| 1363 | XSETFASTINT (arg, 1); | 1364 | XSETFASTINT (arg, 1); |
| @@ -1432,14 +1433,14 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1432 | int *char_ranges IF_LINT (= NULL); | 1433 | int *char_ranges IF_LINT (= NULL); |
| 1433 | int n_char_ranges = 0; | 1434 | int n_char_ranges = 0; |
| 1434 | int negate = 0; | 1435 | int negate = 0; |
| 1435 | register EMACS_INT i, i_byte; | 1436 | register ptrdiff_t i, i_byte; |
| 1436 | /* Set to 1 if the current buffer is multibyte and the region | 1437 | /* Set to 1 if the current buffer is multibyte and the region |
| 1437 | contains non-ASCII chars. */ | 1438 | contains non-ASCII chars. */ |
| 1438 | int multibyte; | 1439 | int multibyte; |
| 1439 | /* Set to 1 if STRING is multibyte and it contains non-ASCII | 1440 | /* Set to 1 if STRING is multibyte and it contains non-ASCII |
| 1440 | chars. */ | 1441 | chars. */ |
| 1441 | int string_multibyte; | 1442 | int string_multibyte; |
| 1442 | EMACS_INT size_byte; | 1443 | ptrdiff_t size_byte; |
| 1443 | const unsigned char *str; | 1444 | const unsigned char *str; |
| 1444 | int len; | 1445 | int len; |
| 1445 | Lisp_Object iso_classes; | 1446 | Lisp_Object iso_classes; |
| @@ -1753,9 +1754,9 @@ skip_chars (int forwardp, Lisp_Object string, Lisp_Object lim, int handle_iso_cl | |||
| 1753 | } | 1754 | } |
| 1754 | 1755 | ||
| 1755 | { | 1756 | { |
| 1756 | EMACS_INT start_point = PT; | 1757 | ptrdiff_t start_point = PT; |
| 1757 | EMACS_INT pos = PT; | 1758 | ptrdiff_t pos = PT; |
| 1758 | EMACS_INT pos_byte = PT_BYTE; | 1759 | ptrdiff_t pos_byte = PT_BYTE; |
| 1759 | unsigned char *p = PT_ADDR, *endp, *stop; | 1760 | unsigned char *p = PT_ADDR, *endp, *stop; |
| 1760 | 1761 | ||
| 1761 | if (forwardp) | 1762 | if (forwardp) |
| @@ -1925,9 +1926,9 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 1925 | register unsigned int c; | 1926 | register unsigned int c; |
| 1926 | unsigned char fastmap[0400]; | 1927 | unsigned char fastmap[0400]; |
| 1927 | int negate = 0; | 1928 | int negate = 0; |
| 1928 | register EMACS_INT i, i_byte; | 1929 | register ptrdiff_t i, i_byte; |
| 1929 | int multibyte; | 1930 | int multibyte; |
| 1930 | EMACS_INT size_byte; | 1931 | ptrdiff_t size_byte; |
| 1931 | unsigned char *str; | 1932 | unsigned char *str; |
| 1932 | 1933 | ||
| 1933 | CHECK_STRING (string); | 1934 | CHECK_STRING (string); |
| @@ -1980,9 +1981,9 @@ skip_syntaxes (int forwardp, Lisp_Object string, Lisp_Object lim) | |||
| 1980 | fastmap[i] ^= 1; | 1981 | fastmap[i] ^= 1; |
| 1981 | 1982 | ||
| 1982 | { | 1983 | { |
| 1983 | EMACS_INT start_point = PT; | 1984 | ptrdiff_t start_point = PT; |
| 1984 | EMACS_INT pos = PT; | 1985 | ptrdiff_t pos = PT; |
| 1985 | EMACS_INT pos_byte = PT_BYTE; | 1986 | ptrdiff_t pos_byte = PT_BYTE; |
| 1986 | unsigned char *p = PT_ADDR, *endp, *stop; | 1987 | unsigned char *p = PT_ADDR, *endp, *stop; |
| 1987 | 1988 | ||
| 1988 | if (forwardp) | 1989 | if (forwardp) |
| @@ -2135,10 +2136,10 @@ in_classes (int c, Lisp_Object iso_classes) | |||
| 2135 | remains valid for forward search starting at the returned position. */ | 2136 | remains valid for forward search starting at the returned position. */ |
| 2136 | 2137 | ||
| 2137 | static int | 2138 | static int |
| 2138 | forw_comment (EMACS_INT from, EMACS_INT from_byte, EMACS_INT stop, | 2139 | forw_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop, |
| 2139 | int nesting, int style, int prev_syntax, | 2140 | EMACS_INT nesting, int style, int prev_syntax, |
| 2140 | EMACS_INT *charpos_ptr, EMACS_INT *bytepos_ptr, | 2141 | ptrdiff_t *charpos_ptr, ptrdiff_t *bytepos_ptr, |
| 2141 | int *incomment_ptr) | 2142 | EMACS_INT *incomment_ptr) |
| 2142 | { | 2143 | { |
| 2143 | register int c, c1; | 2144 | register int c, c1; |
| 2144 | register enum syntaxcode code; | 2145 | register enum syntaxcode code; |
| @@ -2240,17 +2241,17 @@ If COUNT comments are found as expected, with nothing except whitespace | |||
| 2240 | between them, return t; otherwise return nil. */) | 2241 | between them, return t; otherwise return nil. */) |
| 2241 | (Lisp_Object count) | 2242 | (Lisp_Object count) |
| 2242 | { | 2243 | { |
| 2243 | register EMACS_INT from; | 2244 | register ptrdiff_t from; |
| 2244 | EMACS_INT from_byte; | 2245 | ptrdiff_t from_byte; |
| 2245 | register EMACS_INT stop; | 2246 | register ptrdiff_t stop; |
| 2246 | register int c, c1; | 2247 | register int c, c1; |
| 2247 | register enum syntaxcode code; | 2248 | register enum syntaxcode code; |
| 2248 | int comstyle = 0; /* style of comment encountered */ | 2249 | int comstyle = 0; /* style of comment encountered */ |
| 2249 | int comnested = 0; /* whether the comment is nestable or not */ | 2250 | int comnested = 0; /* whether the comment is nestable or not */ |
| 2250 | int found; | 2251 | int found; |
| 2251 | EMACS_INT count1; | 2252 | EMACS_INT count1; |
| 2252 | EMACS_INT out_charpos, out_bytepos; | 2253 | ptrdiff_t out_charpos, out_bytepos; |
| 2253 | int dummy; | 2254 | ptrdiff_t dummy; |
| 2254 | 2255 | ||
| 2255 | CHECK_NUMBER (count); | 2256 | CHECK_NUMBER (count); |
| 2256 | count1 = XINT (count); | 2257 | count1 = XINT (count); |
| @@ -2374,7 +2375,7 @@ between them, return t; otherwise return nil. */) | |||
| 2374 | { | 2375 | { |
| 2375 | /* Skip until first preceding unquoted comment_fence. */ | 2376 | /* Skip until first preceding unquoted comment_fence. */ |
| 2376 | int fence_found = 0; | 2377 | int fence_found = 0; |
| 2377 | EMACS_INT ini = from, ini_byte = from_byte; | 2378 | ptrdiff_t ini = from, ini_byte = from_byte; |
| 2378 | 2379 | ||
| 2379 | while (1) | 2380 | while (1) |
| 2380 | { | 2381 | { |
| @@ -2457,21 +2458,22 @@ static Lisp_Object | |||
| 2457 | scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) | 2458 | scan_lists (register EMACS_INT from, EMACS_INT count, EMACS_INT depth, int sexpflag) |
| 2458 | { | 2459 | { |
| 2459 | Lisp_Object val; | 2460 | Lisp_Object val; |
| 2460 | register EMACS_INT stop = count > 0 ? ZV : BEGV; | 2461 | register ptrdiff_t stop = count > 0 ? ZV : BEGV; |
| 2461 | register int c, c1; | 2462 | register int c, c1; |
| 2462 | int stringterm; | 2463 | int stringterm; |
| 2463 | int quoted; | 2464 | int quoted; |
| 2464 | int mathexit = 0; | 2465 | int mathexit = 0; |
| 2465 | register enum syntaxcode code, temp_code; | 2466 | register enum syntaxcode code, temp_code; |
| 2466 | int min_depth = depth; /* Err out if depth gets less than this. */ | 2467 | EMACS_INT min_depth = depth; /* Err out if depth gets less than this. */ |
| 2467 | int comstyle = 0; /* style of comment encountered */ | 2468 | int comstyle = 0; /* style of comment encountered */ |
| 2468 | int comnested = 0; /* whether the comment is nestable or not */ | 2469 | int comnested = 0; /* whether the comment is nestable or not */ |
| 2469 | EMACS_INT temp_pos; | 2470 | ptrdiff_t temp_pos; |
| 2470 | EMACS_INT last_good = from; | 2471 | EMACS_INT last_good = from; |
| 2471 | int found; | 2472 | int found; |
| 2472 | EMACS_INT from_byte; | 2473 | ptrdiff_t from_byte; |
| 2473 | EMACS_INT out_bytepos, out_charpos; | 2474 | ptrdiff_t out_bytepos, out_charpos; |
| 2474 | int temp, dummy; | 2475 | int temp; |
| 2476 | ptrdiff_t dummy; | ||
| 2475 | int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; | 2477 | int multibyte_symbol_p = sexpflag && multibyte_syntax_as_symbol; |
| 2476 | 2478 | ||
| 2477 | if (depth > 0) min_depth = 0; | 2479 | if (depth > 0) min_depth = 0; |
| @@ -2890,11 +2892,11 @@ DEFUN ("backward-prefix-chars", Fbackward_prefix_chars, Sbackward_prefix_chars, | |||
| 2890 | This includes chars with "quote" or "prefix" syntax (' or p). */) | 2892 | This includes chars with "quote" or "prefix" syntax (' or p). */) |
| 2891 | (void) | 2893 | (void) |
| 2892 | { | 2894 | { |
| 2893 | EMACS_INT beg = BEGV; | 2895 | ptrdiff_t beg = BEGV; |
| 2894 | EMACS_INT opoint = PT; | 2896 | ptrdiff_t opoint = PT; |
| 2895 | EMACS_INT opoint_byte = PT_BYTE; | 2897 | ptrdiff_t opoint_byte = PT_BYTE; |
| 2896 | EMACS_INT pos = PT; | 2898 | ptrdiff_t pos = PT; |
| 2897 | EMACS_INT pos_byte = PT_BYTE; | 2899 | ptrdiff_t pos_byte = PT_BYTE; |
| 2898 | int c; | 2900 | int c; |
| 2899 | 2901 | ||
| 2900 | if (pos <= beg) | 2902 | if (pos <= beg) |
| @@ -2935,8 +2937,8 @@ This includes chars with "quote" or "prefix" syntax (' or p). */) | |||
| 2935 | 2937 | ||
| 2936 | static void | 2938 | static void |
| 2937 | scan_sexps_forward (struct lisp_parse_state *stateptr, | 2939 | scan_sexps_forward (struct lisp_parse_state *stateptr, |
| 2938 | EMACS_INT from, EMACS_INT from_byte, EMACS_INT end, | 2940 | ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t end, |
| 2939 | int targetdepth, int stopbefore, | 2941 | EMACS_INT targetdepth, int stopbefore, |
| 2940 | Lisp_Object oldstate, int commentstop) | 2942 | Lisp_Object oldstate, int commentstop) |
| 2941 | { | 2943 | { |
| 2942 | struct lisp_parse_state state; | 2944 | struct lisp_parse_state state; |
| @@ -2944,23 +2946,23 @@ scan_sexps_forward (struct lisp_parse_state *stateptr, | |||
| 2944 | register enum syntaxcode code; | 2946 | register enum syntaxcode code; |
| 2945 | int c1; | 2947 | int c1; |
| 2946 | int comnested; | 2948 | int comnested; |
| 2947 | struct level { int last, prev; }; | 2949 | struct level { ptrdiff_t last, prev; }; |
| 2948 | struct level levelstart[100]; | 2950 | struct level levelstart[100]; |
| 2949 | register struct level *curlevel = levelstart; | 2951 | register struct level *curlevel = levelstart; |
| 2950 | struct level *endlevel = levelstart + 100; | 2952 | struct level *endlevel = levelstart + 100; |
| 2951 | register int depth; /* Paren depth of current scanning location. | 2953 | register EMACS_INT depth; /* Paren depth of current scanning location. |
| 2952 | level - levelstart equals this except | 2954 | level - levelstart equals this except |
| 2953 | when the depth becomes negative. */ | 2955 | when the depth becomes negative. */ |
| 2954 | int mindepth; /* Lowest DEPTH value seen. */ | 2956 | EMACS_INT mindepth; /* Lowest DEPTH value seen. */ |
| 2955 | int start_quoted = 0; /* Nonzero means starting after a char quote */ | 2957 | int start_quoted = 0; /* Nonzero means starting after a char quote */ |
| 2956 | Lisp_Object tem; | 2958 | Lisp_Object tem; |
| 2957 | EMACS_INT prev_from; /* Keep one character before FROM. */ | 2959 | ptrdiff_t prev_from; /* Keep one character before FROM. */ |
| 2958 | EMACS_INT prev_from_byte; | 2960 | ptrdiff_t prev_from_byte; |
| 2959 | int prev_from_syntax; | 2961 | int prev_from_syntax; |
| 2960 | int boundary_stop = commentstop == -1; | 2962 | int boundary_stop = commentstop == -1; |
| 2961 | int nofence; | 2963 | int nofence; |
| 2962 | int found; | 2964 | int found; |
| 2963 | EMACS_INT out_bytepos, out_charpos; | 2965 | ptrdiff_t out_bytepos, out_charpos; |
| 2964 | int temp; | 2966 | int temp; |
| 2965 | 2967 | ||
| 2966 | prev_from = from; | 2968 | prev_from = from; |
| @@ -3004,7 +3006,7 @@ do { prev_from = from; \ | |||
| 3004 | tem = Fcar (oldstate); | 3006 | tem = Fcar (oldstate); |
| 3005 | /* Check whether we are inside string_fence-style string: */ | 3007 | /* Check whether we are inside string_fence-style string: */ |
| 3006 | state.instring = (!NILP (tem) | 3008 | state.instring = (!NILP (tem) |
| 3007 | ? (INTEGERP (tem) ? XINT (tem) : ST_STRING_STYLE) | 3009 | ? (CHARACTERP (tem) ? XFASTINT (tem) : ST_STRING_STYLE) |
| 3008 | : -1); | 3010 | : -1); |
| 3009 | 3011 | ||
| 3010 | oldstate = Fcdr (oldstate); | 3012 | oldstate = Fcdr (oldstate); |
| @@ -3024,19 +3026,21 @@ do { prev_from = from; \ | |||
| 3024 | tem = Fcar (oldstate); | 3026 | tem = Fcar (oldstate); |
| 3025 | state.comstyle = (NILP (tem) | 3027 | state.comstyle = (NILP (tem) |
| 3026 | ? 0 | 3028 | ? 0 |
| 3027 | : (EQ (tem, Qsyntax_table) | 3029 | : (RANGED_INTEGERP (0, tem, ST_COMMENT_STYLE) |
| 3028 | ? ST_COMMENT_STYLE | 3030 | ? XINT (tem) |
| 3029 | : INTEGERP (tem) ? XINT (tem) : 1)); | 3031 | : ST_COMMENT_STYLE)); |
| 3030 | 3032 | ||
| 3031 | oldstate = Fcdr (oldstate); | 3033 | oldstate = Fcdr (oldstate); |
| 3032 | tem = Fcar (oldstate); | 3034 | tem = Fcar (oldstate); |
| 3033 | state.comstr_start = NILP (tem) ? -1 : XINT (tem) ; | 3035 | state.comstr_start = |
| 3036 | RANGED_INTEGERP (PTRDIFF_MIN, tem, PTRDIFF_MAX) ? XINT (tem) : -1; | ||
| 3034 | oldstate = Fcdr (oldstate); | 3037 | oldstate = Fcdr (oldstate); |
| 3035 | tem = Fcar (oldstate); | 3038 | tem = Fcar (oldstate); |
| 3036 | while (!NILP (tem)) /* >= second enclosing sexps. */ | 3039 | while (!NILP (tem)) /* >= second enclosing sexps. */ |
| 3037 | { | 3040 | { |
| 3038 | /* curlevel++->last ran into compiler bug on Apollo */ | 3041 | Lisp_Object temhd = Fcar (tem); |
| 3039 | curlevel->last = XINT (Fcar (tem)); | 3042 | if (RANGED_INTEGERP (PTRDIFF_MIN, temhd, PTRDIFF_MAX)) |
| 3043 | curlevel->last = XINT (temhd); | ||
| 3040 | if (++curlevel == endlevel) | 3044 | if (++curlevel == endlevel) |
| 3041 | curlevel--; /* error ("Nesting too deep for parser"); */ | 3045 | curlevel--; /* error ("Nesting too deep for parser"); */ |
| 3042 | curlevel->prev = -1; | 3046 | curlevel->prev = -1; |
| @@ -3309,14 +3313,14 @@ Fourth arg STOPBEFORE non-nil means stop when come to | |||
| 3309 | any character that starts a sexp. | 3313 | any character that starts a sexp. |
| 3310 | Fifth arg OLDSTATE is a list like what this function returns. | 3314 | Fifth arg OLDSTATE is a list like what this function returns. |
| 3311 | It is used to initialize the state of the parse. Elements number 1, 2, 6 | 3315 | It is used to initialize the state of the parse. Elements number 1, 2, 6 |
| 3312 | and 8 are ignored. | 3316 | are ignored. |
| 3313 | Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. | 3317 | Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. |
| 3314 | If it is symbol `syntax-table', stop after the start of a comment or a | 3318 | If it is symbol `syntax-table', stop after the start of a comment or a |
| 3315 | string, or after end of a comment or a string. */) | 3319 | string, or after end of a comment or a string. */) |
| 3316 | (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) | 3320 | (Lisp_Object from, Lisp_Object to, Lisp_Object targetdepth, Lisp_Object stopbefore, Lisp_Object oldstate, Lisp_Object commentstop) |
| 3317 | { | 3321 | { |
| 3318 | struct lisp_parse_state state; | 3322 | struct lisp_parse_state state; |
| 3319 | int target; | 3323 | EMACS_INT target; |
| 3320 | 3324 | ||
| 3321 | if (!NILP (targetdepth)) | 3325 | if (!NILP (targetdepth)) |
| 3322 | { | 3326 | { |
| @@ -3324,7 +3328,7 @@ Sixth arg COMMENTSTOP non-nil means stop at the start of a comment. | |||
| 3324 | target = XINT (targetdepth); | 3328 | target = XINT (targetdepth); |
| 3325 | } | 3329 | } |
| 3326 | else | 3330 | else |
| 3327 | target = -100000; /* We won't reach this depth */ | 3331 | target = TYPE_MINIMUM (EMACS_INT); /* We won't reach this depth */ |
| 3328 | 3332 | ||
| 3329 | validate_region (&from, &to); | 3333 | validate_region (&from, &to); |
| 3330 | scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)), | 3334 | scan_sexps_forward (&state, XINT (from), CHAR_TO_BYTE (XINT (from)), |
diff --git a/src/syntax.h b/src/syntax.h index 42d689cb96c..1ea37ac5d5f 100644 --- a/src/syntax.h +++ b/src/syntax.h | |||
| @@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License | |||
| 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | 19 | along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
| 20 | 20 | ||
| 21 | 21 | ||
| 22 | extern void update_syntax_table (EMACS_INT, EMACS_INT, int, Lisp_Object); | 22 | extern void update_syntax_table (ptrdiff_t, EMACS_INT, int, Lisp_Object); |
| 23 | 23 | ||
| 24 | /* The standard syntax table is stored where it will automatically | 24 | /* The standard syntax table is stored where it will automatically |
| 25 | be used in all new buffers. */ | 25 | be used in all new buffers. */ |
| @@ -277,15 +277,15 @@ while (0) | |||
| 277 | struct gl_state_s | 277 | struct gl_state_s |
| 278 | { | 278 | { |
| 279 | Lisp_Object object; /* The object we are scanning. */ | 279 | Lisp_Object object; /* The object we are scanning. */ |
| 280 | EMACS_INT start; /* Where to stop. */ | 280 | ptrdiff_t start; /* Where to stop. */ |
| 281 | EMACS_INT stop; /* Where to stop. */ | 281 | ptrdiff_t stop; /* Where to stop. */ |
| 282 | int use_global; /* Whether to use global_code | 282 | int use_global; /* Whether to use global_code |
| 283 | or c_s_t. */ | 283 | or c_s_t. */ |
| 284 | Lisp_Object global_code; /* Syntax code of current char. */ | 284 | Lisp_Object global_code; /* Syntax code of current char. */ |
| 285 | Lisp_Object current_syntax_table; /* Syntax table for current pos. */ | 285 | Lisp_Object current_syntax_table; /* Syntax table for current pos. */ |
| 286 | Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ | 286 | Lisp_Object old_prop; /* Syntax-table prop at prev pos. */ |
| 287 | EMACS_INT b_property; /* First index where c_s_t is valid. */ | 287 | ptrdiff_t b_property; /* First index where c_s_t is valid. */ |
| 288 | EMACS_INT e_property; /* First index where c_s_t is | 288 | ptrdiff_t e_property; /* First index where c_s_t is |
| 289 | not valid. */ | 289 | not valid. */ |
| 290 | INTERVAL forward_i; /* Where to start lookup on forward */ | 290 | INTERVAL forward_i; /* Where to start lookup on forward */ |
| 291 | INTERVAL backward_i; /* or backward movement. The | 291 | INTERVAL backward_i; /* or backward movement. The |
| @@ -295,8 +295,8 @@ struct gl_state_s | |||
| 295 | intervals too, depending | 295 | intervals too, depending |
| 296 | on: */ | 296 | on: */ |
| 297 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ | 297 | /* Offset for positions specified to UPDATE_SYNTAX_TABLE. */ |
| 298 | EMACS_INT offset; | 298 | ptrdiff_t offset; |
| 299 | }; | 299 | }; |
| 300 | 300 | ||
| 301 | extern struct gl_state_s gl_state; | 301 | extern struct gl_state_s gl_state; |
| 302 | extern EMACS_INT scan_words (EMACS_INT, EMACS_INT); | 302 | extern ptrdiff_t scan_words (ptrdiff_t, EMACS_INT); |
diff --git a/src/sysdep.c b/src/sysdep.c index f97a8585253..ba296a2d094 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -296,7 +296,7 @@ int wait_debugging EXTERNALLY_VISIBLE; | |||
| 296 | #ifndef MSDOS | 296 | #ifndef MSDOS |
| 297 | 297 | ||
| 298 | static void | 298 | static void |
| 299 | wait_for_termination_1 (int pid, int interruptible) | 299 | wait_for_termination_1 (pid_t pid, int interruptible) |
| 300 | { | 300 | { |
| 301 | while (1) | 301 | while (1) |
| 302 | { | 302 | { |
| @@ -344,14 +344,14 @@ wait_for_termination_1 (int pid, int interruptible) | |||
| 344 | make sure it will get eliminated (not remain forever as a zombie) */ | 344 | make sure it will get eliminated (not remain forever as a zombie) */ |
| 345 | 345 | ||
| 346 | void | 346 | void |
| 347 | wait_for_termination (int pid) | 347 | wait_for_termination (pid_t pid) |
| 348 | { | 348 | { |
| 349 | wait_for_termination_1 (pid, 0); | 349 | wait_for_termination_1 (pid, 0); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | /* Like the above, but allow keyboard interruption. */ | 352 | /* Like the above, but allow keyboard interruption. */ |
| 353 | void | 353 | void |
| 354 | interruptible_wait_for_termination (int pid) | 354 | interruptible_wait_for_termination (pid_t pid) |
| 355 | { | 355 | { |
| 356 | wait_for_termination_1 (pid, 1); | 356 | wait_for_termination_1 (pid, 1); |
| 357 | } | 357 | } |
| @@ -1895,8 +1895,8 @@ emacs_close (int fd) | |||
| 1895 | /* Read from FILEDESC to a buffer BUF with size NBYTE, retrying if interrupted. | 1895 | /* Read from FILEDESC to a buffer BUF with size NBYTE, retrying if interrupted. |
| 1896 | Return the number of bytes read, which might be less than NBYTE. | 1896 | Return the number of bytes read, which might be less than NBYTE. |
| 1897 | On error, set errno and return -1. */ | 1897 | On error, set errno and return -1. */ |
| 1898 | EMACS_INT | 1898 | ptrdiff_t |
| 1899 | emacs_read (int fildes, char *buf, EMACS_INT nbyte) | 1899 | emacs_read (int fildes, char *buf, ptrdiff_t nbyte) |
| 1900 | { | 1900 | { |
| 1901 | register ssize_t rtnval; | 1901 | register ssize_t rtnval; |
| 1902 | 1902 | ||
| @@ -1912,11 +1912,11 @@ emacs_read (int fildes, char *buf, EMACS_INT nbyte) | |||
| 1912 | /* Write to FILEDES from a buffer BUF with size NBYTE, retrying if interrupted | 1912 | /* Write to FILEDES from a buffer BUF with size NBYTE, retrying if interrupted |
| 1913 | or if a partial write occurs. Return the number of bytes written, setting | 1913 | or if a partial write occurs. Return the number of bytes written, setting |
| 1914 | errno if this is less than NBYTE. */ | 1914 | errno if this is less than NBYTE. */ |
| 1915 | EMACS_INT | 1915 | ptrdiff_t |
| 1916 | emacs_write (int fildes, const char *buf, EMACS_INT nbyte) | 1916 | emacs_write (int fildes, const char *buf, ptrdiff_t nbyte) |
| 1917 | { | 1917 | { |
| 1918 | ssize_t rtnval; | 1918 | ssize_t rtnval; |
| 1919 | EMACS_INT bytes_written; | 1919 | ptrdiff_t bytes_written; |
| 1920 | 1920 | ||
| 1921 | bytes_written = 0; | 1921 | bytes_written = 0; |
| 1922 | 1922 | ||
| @@ -2151,7 +2151,8 @@ set_file_times (const char *filename, EMACS_TIME atime, EMACS_TIME mtime) | |||
| 2151 | int | 2151 | int |
| 2152 | mkdir (char *dpath, int dmode) | 2152 | mkdir (char *dpath, int dmode) |
| 2153 | { | 2153 | { |
| 2154 | int cpid, status, fd; | 2154 | pid_t cpid; |
| 2155 | int status, fd; | ||
| 2155 | struct stat statbuf; | 2156 | struct stat statbuf; |
| 2156 | 2157 | ||
| 2157 | if (stat (dpath, &statbuf) == 0) | 2158 | if (stat (dpath, &statbuf) == 0) |
| @@ -2681,7 +2682,10 @@ system_process_attributes (Lisp_Object pid) | |||
| 2681 | char *cmdline = NULL; | 2682 | char *cmdline = NULL; |
| 2682 | ptrdiff_t cmdsize = 0, cmdline_size; | 2683 | ptrdiff_t cmdsize = 0, cmdline_size; |
| 2683 | unsigned char c; | 2684 | unsigned char c; |
| 2684 | int proc_id, ppid, uid, gid, pgrp, sess, tty, tpgid, thcount; | 2685 | printmax_t proc_id; |
| 2686 | int ppid, pgrp, sess, tty, tpgid, thcount; | ||
| 2687 | uid_t uid; | ||
| 2688 | gid_t gid; | ||
| 2685 | unsigned long long u_time, s_time, cutime, cstime, start; | 2689 | unsigned long long u_time, s_time, cutime, cstime, start; |
| 2686 | long priority, niceness, rss; | 2690 | long priority, niceness, rss; |
| 2687 | unsigned long minflt, majflt, cminflt, cmajflt, vsize; | 2691 | unsigned long minflt, majflt, cminflt, cmajflt, vsize; |
| @@ -2692,11 +2696,18 @@ system_process_attributes (Lisp_Object pid) | |||
| 2692 | Lisp_Object attrs = Qnil; | 2696 | Lisp_Object attrs = Qnil; |
| 2693 | Lisp_Object cmd_str, decoded_cmd, tem; | 2697 | Lisp_Object cmd_str, decoded_cmd, tem; |
| 2694 | struct gcpro gcpro1, gcpro2; | 2698 | struct gcpro gcpro1, gcpro2; |
| 2695 | EMACS_INT uid_eint, gid_eint; | ||
| 2696 | 2699 | ||
| 2697 | CHECK_NUMBER_OR_FLOAT (pid); | 2700 | CHECK_NUMBER_OR_FLOAT (pid); |
| 2698 | proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid); | 2701 | if (FLOATP (pid)) |
| 2699 | sprintf (procfn, "/proc/%u", proc_id); | 2702 | { |
| 2703 | double v = XFLOAT_DATA (pid); | ||
| 2704 | if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0)) | ||
| 2705 | return attrs; | ||
| 2706 | proc_id = v; | ||
| 2707 | } | ||
| 2708 | else | ||
| 2709 | proc_id = XINT (pid); | ||
| 2710 | sprintf (procfn, "/proc/%"pMd, proc_id); | ||
| 2700 | if (stat (procfn, &st) < 0) | 2711 | if (stat (procfn, &st) < 0) |
| 2701 | return attrs; | 2712 | return attrs; |
| 2702 | 2713 | ||
| @@ -2704,9 +2715,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 2704 | 2715 | ||
| 2705 | /* euid egid */ | 2716 | /* euid egid */ |
| 2706 | uid = st.st_uid; | 2717 | uid = st.st_uid; |
| 2707 | /* Use of EMACS_INT stops GCC whining about limited range of data type. */ | 2718 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); |
| 2708 | uid_eint = uid; | ||
| 2709 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid_eint)), attrs); | ||
| 2710 | BLOCK_INPUT; | 2719 | BLOCK_INPUT; |
| 2711 | pw = getpwuid (uid); | 2720 | pw = getpwuid (uid); |
| 2712 | UNBLOCK_INPUT; | 2721 | UNBLOCK_INPUT; |
| @@ -2714,8 +2723,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 2714 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 2723 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 2715 | 2724 | ||
| 2716 | gid = st.st_gid; | 2725 | gid = st.st_gid; |
| 2717 | gid_eint = gid; | 2726 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); |
| 2718 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid_eint)), attrs); | ||
| 2719 | BLOCK_INPUT; | 2727 | BLOCK_INPUT; |
| 2720 | gr = getgrgid (gid); | 2728 | gr = getgrgid (gid); |
| 2721 | UNBLOCK_INPUT; | 2729 | UNBLOCK_INPUT; |
| @@ -2955,15 +2963,24 @@ system_process_attributes (Lisp_Object pid) | |||
| 2955 | struct psinfo pinfo; | 2963 | struct psinfo pinfo; |
| 2956 | int fd; | 2964 | int fd; |
| 2957 | ssize_t nread; | 2965 | ssize_t nread; |
| 2958 | int proc_id, uid, gid; | 2966 | printmax_t proc_id; |
| 2967 | uid_t uid; | ||
| 2968 | gid_t gid; | ||
| 2959 | Lisp_Object attrs = Qnil; | 2969 | Lisp_Object attrs = Qnil; |
| 2960 | Lisp_Object decoded_cmd, tem; | 2970 | Lisp_Object decoded_cmd, tem; |
| 2961 | struct gcpro gcpro1, gcpro2; | 2971 | struct gcpro gcpro1, gcpro2; |
| 2962 | EMACS_INT uid_eint, gid_eint; | ||
| 2963 | 2972 | ||
| 2964 | CHECK_NUMBER_OR_FLOAT (pid); | 2973 | CHECK_NUMBER_OR_FLOAT (pid); |
| 2965 | proc_id = FLOATP (pid) ? XFLOAT_DATA (pid) : XINT (pid); | 2974 | if (FLOATP (pid)) |
| 2966 | sprintf (procfn, "/proc/%u", proc_id); | 2975 | { |
| 2976 | double v = XFLOAT_DATA (pid); | ||
| 2977 | if (! (TYPE_MINIMUM (pid_t) <= v && v < TYPE_MAXIMUM (pid_t) + 1.0)) | ||
| 2978 | return attrs; | ||
| 2979 | proc_id = v; | ||
| 2980 | } | ||
| 2981 | else | ||
| 2982 | proc_id = XINT (v); | ||
| 2983 | sprintf (procfn, "/proc/%"pMd, proc_id); | ||
| 2967 | if (stat (procfn, &st) < 0) | 2984 | if (stat (procfn, &st) < 0) |
| 2968 | return attrs; | 2985 | return attrs; |
| 2969 | 2986 | ||
| @@ -2971,9 +2988,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 2971 | 2988 | ||
| 2972 | /* euid egid */ | 2989 | /* euid egid */ |
| 2973 | uid = st.st_uid; | 2990 | uid = st.st_uid; |
| 2974 | /* Use of EMACS_INT stops GCC whining about limited range of data type. */ | 2991 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); |
| 2975 | uid_eint = uid; | ||
| 2976 | attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid_eint)), attrs); | ||
| 2977 | BLOCK_INPUT; | 2992 | BLOCK_INPUT; |
| 2978 | pw = getpwuid (uid); | 2993 | pw = getpwuid (uid); |
| 2979 | UNBLOCK_INPUT; | 2994 | UNBLOCK_INPUT; |
| @@ -2981,8 +2996,7 @@ system_process_attributes (Lisp_Object pid) | |||
| 2981 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); | 2996 | attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); |
| 2982 | 2997 | ||
| 2983 | gid = st.st_gid; | 2998 | gid = st.st_gid; |
| 2984 | gid_eint = gid; | 2999 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); |
| 2985 | attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid_eint)), attrs); | ||
| 2986 | BLOCK_INPUT; | 3000 | BLOCK_INPUT; |
| 2987 | gr = getgrgid (gid); | 3001 | gr = getgrgid (gid); |
| 2988 | UNBLOCK_INPUT; | 3002 | UNBLOCK_INPUT; |
diff --git a/src/term.c b/src/term.c index 4a671d048c4..fb3166a6e50 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -1915,8 +1915,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 1915 | else | 1915 | else |
| 1916 | SET_GLYPH_FROM_CHAR (glyph, '\\'); | 1916 | SET_GLYPH_FROM_CHAR (glyph, '\\'); |
| 1917 | if (it->dp | 1917 | if (it->dp |
| 1918 | && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc)) | 1918 | && (gc = DISP_CONTINUE_GLYPH (it->dp), GLYPH_CODE_P (gc))) |
| 1919 | && GLYPH_CODE_CHAR_VALID_P (gc)) | ||
| 1920 | { | 1919 | { |
| 1921 | /* FIXME: Should we mirror GC for R2L lines? */ | 1920 | /* FIXME: Should we mirror GC for R2L lines? */ |
| 1922 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); | 1921 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); |
| @@ -1928,8 +1927,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what) | |||
| 1928 | /* Truncation glyph. */ | 1927 | /* Truncation glyph. */ |
| 1929 | SET_GLYPH_FROM_CHAR (glyph, '$'); | 1928 | SET_GLYPH_FROM_CHAR (glyph, '$'); |
| 1930 | if (it->dp | 1929 | if (it->dp |
| 1931 | && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc)) | 1930 | && (gc = DISP_TRUNC_GLYPH (it->dp), GLYPH_CODE_P (gc))) |
| 1932 | && GLYPH_CODE_CHAR_VALID_P (gc)) | ||
| 1933 | { | 1931 | { |
| 1934 | /* FIXME: Should we mirror GC for R2L lines? */ | 1932 | /* FIXME: Should we mirror GC for R2L lines? */ |
| 1935 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); | 1933 | SET_GLYPH_FROM_GLYPH_CODE (glyph, gc); |
| @@ -2279,7 +2277,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) | |||
| 2279 | else | 2277 | else |
| 2280 | color_mode = Qnil; | 2278 | color_mode = Qnil; |
| 2281 | 2279 | ||
| 2282 | mode = INTEGERP (color_mode) ? XINT (color_mode) : 0; | 2280 | mode = TYPE_RANGED_INTEGERP (int, color_mode) ? XINT (color_mode) : 0; |
| 2283 | 2281 | ||
| 2284 | if (mode != tty->previous_color_mode) | 2282 | if (mode != tty->previous_color_mode) |
| 2285 | { | 2283 | { |
diff --git a/src/termhooks.h b/src/termhooks.h index 63d166b6418..ddcbf53eb6f 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -229,7 +229,7 @@ struct input_event | |||
| 229 | For a HELP_EVENT, this is the position within the object | 229 | For a HELP_EVENT, this is the position within the object |
| 230 | (stored in ARG below) where the help was found. */ | 230 | (stored in ARG below) where the help was found. */ |
| 231 | /* In WindowsNT, for a mouse wheel event, this is the delta. */ | 231 | /* In WindowsNT, for a mouse wheel event, this is the delta. */ |
| 232 | EMACS_INT code; | 232 | ptrdiff_t code; |
| 233 | enum scroll_bar_part part; | 233 | enum scroll_bar_part part; |
| 234 | 234 | ||
| 235 | int modifiers; /* See enum below for interpretation. */ | 235 | int modifiers; /* See enum below for interpretation. */ |
diff --git a/src/textprop.c b/src/textprop.c index 29425f7a550..a877e2a67ae 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -124,7 +124,7 @@ INTERVAL | |||
| 124 | validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force) | 124 | validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *end, int force) |
| 125 | { | 125 | { |
| 126 | register INTERVAL i; | 126 | register INTERVAL i; |
| 127 | EMACS_INT searchpos; | 127 | ptrdiff_t searchpos; |
| 128 | 128 | ||
| 129 | CHECK_STRING_OR_BUFFER (object); | 129 | CHECK_STRING_OR_BUFFER (object); |
| 130 | CHECK_NUMBER_COERCE_MARKER (*begin); | 130 | CHECK_NUMBER_COERCE_MARKER (*begin); |
| @@ -160,7 +160,7 @@ validate_interval_range (Lisp_Object object, Lisp_Object *begin, Lisp_Object *en | |||
| 160 | } | 160 | } |
| 161 | else | 161 | else |
| 162 | { | 162 | { |
| 163 | EMACS_INT len = SCHARS (object); | 163 | ptrdiff_t len = SCHARS (object); |
| 164 | 164 | ||
| 165 | if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end) | 165 | if (! (0 <= XINT (*begin) && XINT (*begin) <= XINT (*end) |
| 166 | && XINT (*end) <= len)) | 166 | && XINT (*end) <= len)) |
| @@ -514,10 +514,10 @@ erase_properties (INTERVAL i) | |||
| 514 | POSITION is BEG-based. */ | 514 | POSITION is BEG-based. */ |
| 515 | 515 | ||
| 516 | INTERVAL | 516 | INTERVAL |
| 517 | interval_of (EMACS_INT position, Lisp_Object object) | 517 | interval_of (ptrdiff_t position, Lisp_Object object) |
| 518 | { | 518 | { |
| 519 | register INTERVAL i; | 519 | register INTERVAL i; |
| 520 | EMACS_INT beg, end; | 520 | ptrdiff_t beg, end; |
| 521 | 521 | ||
| 522 | if (NILP (object)) | 522 | if (NILP (object)) |
| 523 | XSETBUFFER (object, current_buffer); | 523 | XSETBUFFER (object, current_buffer); |
| @@ -775,7 +775,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) | |||
| 775 | else | 775 | else |
| 776 | { | 776 | { |
| 777 | Lisp_Object initial_value, value; | 777 | Lisp_Object initial_value, value; |
| 778 | int count = SPECPDL_INDEX (); | 778 | ptrdiff_t count = SPECPDL_INDEX (); |
| 779 | 779 | ||
| 780 | if (! NILP (object)) | 780 | if (! NILP (object)) |
| 781 | CHECK_BUFFER (object); | 781 | CHECK_BUFFER (object); |
| @@ -858,7 +858,7 @@ position LIMIT; return LIMIT if nothing is found before reaching LIMIT. */) | |||
| 858 | } | 858 | } |
| 859 | else | 859 | else |
| 860 | { | 860 | { |
| 861 | int count = SPECPDL_INDEX (); | 861 | ptrdiff_t count = SPECPDL_INDEX (); |
| 862 | 862 | ||
| 863 | if (! NILP (object)) | 863 | if (! NILP (object)) |
| 864 | CHECK_BUFFER (object); | 864 | CHECK_BUFFER (object); |
| @@ -1140,7 +1140,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1140 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) | 1140 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1141 | { | 1141 | { |
| 1142 | register INTERVAL i, unchanged; | 1142 | register INTERVAL i, unchanged; |
| 1143 | register EMACS_INT s, len; | 1143 | register ptrdiff_t s, len; |
| 1144 | register int modified = 0; | 1144 | register int modified = 0; |
| 1145 | struct gcpro gcpro1; | 1145 | struct gcpro gcpro1; |
| 1146 | 1146 | ||
| @@ -1170,7 +1170,7 @@ Return t if any property value actually changed, nil otherwise. */) | |||
| 1170 | skip it. */ | 1170 | skip it. */ |
| 1171 | if (interval_has_all_properties (properties, i)) | 1171 | if (interval_has_all_properties (properties, i)) |
| 1172 | { | 1172 | { |
| 1173 | EMACS_INT got = (LENGTH (i) - (s - i->position)); | 1173 | ptrdiff_t got = (LENGTH (i) - (s - i->position)); |
| 1174 | if (got >= len) | 1174 | if (got >= len) |
| 1175 | RETURN_UNGCPRO (Qnil); | 1175 | RETURN_UNGCPRO (Qnil); |
| 1176 | len -= got; | 1176 | len -= got; |
| @@ -1345,7 +1345,7 @@ void | |||
| 1345 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) | 1345 | set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object buffer, INTERVAL i) |
| 1346 | { | 1346 | { |
| 1347 | register INTERVAL prev_changed = NULL_INTERVAL; | 1347 | register INTERVAL prev_changed = NULL_INTERVAL; |
| 1348 | register EMACS_INT s, len; | 1348 | register ptrdiff_t s, len; |
| 1349 | INTERVAL unchanged; | 1349 | INTERVAL unchanged; |
| 1350 | 1350 | ||
| 1351 | if (XINT (start) < XINT (end)) | 1351 | if (XINT (start) < XINT (end)) |
| @@ -1438,7 +1438,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1438 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) | 1438 | (Lisp_Object start, Lisp_Object end, Lisp_Object properties, Lisp_Object object) |
| 1439 | { | 1439 | { |
| 1440 | register INTERVAL i, unchanged; | 1440 | register INTERVAL i, unchanged; |
| 1441 | register EMACS_INT s, len; | 1441 | register ptrdiff_t s, len; |
| 1442 | register int modified = 0; | 1442 | register int modified = 0; |
| 1443 | 1443 | ||
| 1444 | if (NILP (object)) | 1444 | if (NILP (object)) |
| @@ -1457,7 +1457,7 @@ Use `set-text-properties' if you want to remove all text properties. */) | |||
| 1457 | it covers the entire region. */ | 1457 | it covers the entire region. */ |
| 1458 | if (! interval_has_some_properties (properties, i)) | 1458 | if (! interval_has_some_properties (properties, i)) |
| 1459 | { | 1459 | { |
| 1460 | EMACS_INT got = (LENGTH (i) - (s - i->position)); | 1460 | ptrdiff_t got = (LENGTH (i) - (s - i->position)); |
| 1461 | if (got >= len) | 1461 | if (got >= len) |
| 1462 | return Qnil; | 1462 | return Qnil; |
| 1463 | len -= got; | 1463 | len -= got; |
| @@ -1524,7 +1524,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1524 | (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) | 1524 | (Lisp_Object start, Lisp_Object end, Lisp_Object list_of_properties, Lisp_Object object) |
| 1525 | { | 1525 | { |
| 1526 | register INTERVAL i, unchanged; | 1526 | register INTERVAL i, unchanged; |
| 1527 | register EMACS_INT s, len; | 1527 | register ptrdiff_t s, len; |
| 1528 | register int modified = 0; | 1528 | register int modified = 0; |
| 1529 | Lisp_Object properties; | 1529 | Lisp_Object properties; |
| 1530 | properties = list_of_properties; | 1530 | properties = list_of_properties; |
| @@ -1545,7 +1545,7 @@ Return t if any property was actually removed, nil otherwise. */) | |||
| 1545 | it covers the entire region. */ | 1545 | it covers the entire region. */ |
| 1546 | if (! interval_has_some_properties_list (properties, i)) | 1546 | if (! interval_has_some_properties_list (properties, i)) |
| 1547 | { | 1547 | { |
| 1548 | EMACS_INT got = (LENGTH (i) - (s - i->position)); | 1548 | ptrdiff_t got = (LENGTH (i) - (s - i->position)); |
| 1549 | if (got >= len) | 1549 | if (got >= len) |
| 1550 | return Qnil; | 1550 | return Qnil; |
| 1551 | len -= got; | 1551 | len -= got; |
| @@ -1634,7 +1634,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1634 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) | 1634 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1635 | { | 1635 | { |
| 1636 | register INTERVAL i; | 1636 | register INTERVAL i; |
| 1637 | register EMACS_INT e, pos; | 1637 | register ptrdiff_t e, pos; |
| 1638 | 1638 | ||
| 1639 | if (NILP (object)) | 1639 | if (NILP (object)) |
| 1640 | XSETBUFFER (object, current_buffer); | 1640 | XSETBUFFER (object, current_buffer); |
| @@ -1670,7 +1670,7 @@ markers). If OBJECT is a string, START and END are 0-based indices into it. */ | |||
| 1670 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) | 1670 | (Lisp_Object start, Lisp_Object end, Lisp_Object property, Lisp_Object value, Lisp_Object object) |
| 1671 | { | 1671 | { |
| 1672 | register INTERVAL i; | 1672 | register INTERVAL i; |
| 1673 | register EMACS_INT s, e; | 1673 | register ptrdiff_t s, e; |
| 1674 | 1674 | ||
| 1675 | if (NILP (object)) | 1675 | if (NILP (object)) |
| 1676 | XSETBUFFER (object, current_buffer); | 1676 | XSETBUFFER (object, current_buffer); |
| @@ -1780,7 +1780,7 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1780 | Lisp_Object res; | 1780 | Lisp_Object res; |
| 1781 | Lisp_Object stuff; | 1781 | Lisp_Object stuff; |
| 1782 | Lisp_Object plist; | 1782 | Lisp_Object plist; |
| 1783 | EMACS_INT s, e, e2, p, len; | 1783 | ptrdiff_t s, e, e2, p, len; |
| 1784 | int modified = 0; | 1784 | int modified = 0; |
| 1785 | struct gcpro gcpro1, gcpro2; | 1785 | struct gcpro gcpro1, gcpro2; |
| 1786 | 1786 | ||
| @@ -1792,8 +1792,11 @@ copy_text_properties (Lisp_Object start, Lisp_Object end, Lisp_Object src, Lisp_ | |||
| 1792 | { | 1792 | { |
| 1793 | Lisp_Object dest_start, dest_end; | 1793 | Lisp_Object dest_start, dest_end; |
| 1794 | 1794 | ||
| 1795 | e = XINT (pos) + (XINT (end) - XINT (start)); | ||
| 1796 | if (MOST_POSITIVE_FIXNUM < e) | ||
| 1797 | args_out_of_range (pos, end); | ||
| 1795 | dest_start = pos; | 1798 | dest_start = pos; |
| 1796 | XSETFASTINT (dest_end, XINT (dest_start) + (XINT (end) - XINT (start))); | 1799 | XSETFASTINT (dest_end, e); |
| 1797 | /* Apply this to a copy of pos; it will try to increment its arguments, | 1800 | /* Apply this to a copy of pos; it will try to increment its arguments, |
| 1798 | which we don't want. */ | 1801 | which we don't want. */ |
| 1799 | validate_interval_range (dest, &dest_start, &dest_end, soft); | 1802 | validate_interval_range (dest, &dest_start, &dest_end, soft); |
| @@ -1877,12 +1880,12 @@ text_property_list (Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp | |||
| 1877 | i = validate_interval_range (object, &start, &end, soft); | 1880 | i = validate_interval_range (object, &start, &end, soft); |
| 1878 | if (!NULL_INTERVAL_P (i)) | 1881 | if (!NULL_INTERVAL_P (i)) |
| 1879 | { | 1882 | { |
| 1880 | EMACS_INT s = XINT (start); | 1883 | ptrdiff_t s = XINT (start); |
| 1881 | EMACS_INT e = XINT (end); | 1884 | ptrdiff_t e = XINT (end); |
| 1882 | 1885 | ||
| 1883 | while (s < e) | 1886 | while (s < e) |
| 1884 | { | 1887 | { |
| 1885 | EMACS_INT interval_end, len; | 1888 | ptrdiff_t interval_end, len; |
| 1886 | Lisp_Object plist; | 1889 | Lisp_Object plist; |
| 1887 | 1890 | ||
| 1888 | interval_end = i->position + LENGTH (i); | 1891 | interval_end = i->position + LENGTH (i); |
| @@ -1960,7 +1963,7 @@ Lisp_Object | |||
| 1960 | extend_property_ranges (Lisp_Object list, Lisp_Object new_end) | 1963 | extend_property_ranges (Lisp_Object list, Lisp_Object new_end) |
| 1961 | { | 1964 | { |
| 1962 | Lisp_Object prev = Qnil, head = list; | 1965 | Lisp_Object prev = Qnil, head = list; |
| 1963 | EMACS_INT max = XINT (new_end); | 1966 | ptrdiff_t max = XINT (new_end); |
| 1964 | 1967 | ||
| 1965 | for (; CONSP (list); prev = list, list = XCDR (list)) | 1968 | for (; CONSP (list); prev = list, list = XCDR (list)) |
| 1966 | { | 1969 | { |
| @@ -2014,7 +2017,7 @@ call_mod_hooks (Lisp_Object list, Lisp_Object start, Lisp_Object end) | |||
| 2014 | 2017 | ||
| 2015 | void | 2018 | void |
| 2016 | verify_interval_modification (struct buffer *buf, | 2019 | verify_interval_modification (struct buffer *buf, |
| 2017 | EMACS_INT start, EMACS_INT end) | 2020 | ptrdiff_t start, ptrdiff_t end) |
| 2018 | { | 2021 | { |
| 2019 | register INTERVAL intervals = BUF_INTERVALS (buf); | 2022 | register INTERVAL intervals = BUF_INTERVALS (buf); |
| 2020 | register INTERVAL i; | 2023 | register INTERVAL i; |
| @@ -2035,7 +2038,7 @@ verify_interval_modification (struct buffer *buf, | |||
| 2035 | 2038 | ||
| 2036 | if (start > end) | 2039 | if (start > end) |
| 2037 | { | 2040 | { |
| 2038 | EMACS_INT temp = start; | 2041 | ptrdiff_t temp = start; |
| 2039 | start = end; | 2042 | start = end; |
| 2040 | end = temp; | 2043 | end = temp; |
| 2041 | } | 2044 | } |
diff --git a/src/undo.c b/src/undo.c index 7e121e8b27d..7e999fe5120 100644 --- a/src/undo.c +++ b/src/undo.c | |||
| @@ -30,7 +30,7 @@ static struct buffer *last_undo_buffer; | |||
| 30 | 30 | ||
| 31 | /* Position of point last time we inserted a boundary. */ | 31 | /* Position of point last time we inserted a boundary. */ |
| 32 | static struct buffer *last_boundary_buffer; | 32 | static struct buffer *last_boundary_buffer; |
| 33 | static EMACS_INT last_boundary_position; | 33 | static ptrdiff_t last_boundary_position; |
| 34 | 34 | ||
| 35 | Lisp_Object Qinhibit_read_only; | 35 | Lisp_Object Qinhibit_read_only; |
| 36 | 36 | ||
| @@ -51,7 +51,7 @@ static Lisp_Object pending_boundary; | |||
| 51 | undo record that will be added just after this command terminates. */ | 51 | undo record that will be added just after this command terminates. */ |
| 52 | 52 | ||
| 53 | static void | 53 | static void |
| 54 | record_point (EMACS_INT pt) | 54 | record_point (ptrdiff_t pt) |
| 55 | { | 55 | { |
| 56 | int at_boundary; | 56 | int at_boundary; |
| 57 | 57 | ||
| @@ -113,7 +113,7 @@ record_point (EMACS_INT pt) | |||
| 113 | because we don't need to record the contents.) */ | 113 | because we don't need to record the contents.) */ |
| 114 | 114 | ||
| 115 | void | 115 | void |
| 116 | record_insert (EMACS_INT beg, EMACS_INT length) | 116 | record_insert (ptrdiff_t beg, ptrdiff_t length) |
| 117 | { | 117 | { |
| 118 | Lisp_Object lbeg, lend; | 118 | Lisp_Object lbeg, lend; |
| 119 | 119 | ||
| @@ -148,7 +148,7 @@ record_insert (EMACS_INT beg, EMACS_INT length) | |||
| 148 | of the characters in STRING, at location BEG. */ | 148 | of the characters in STRING, at location BEG. */ |
| 149 | 149 | ||
| 150 | void | 150 | void |
| 151 | record_delete (EMACS_INT beg, Lisp_Object string) | 151 | record_delete (ptrdiff_t beg, Lisp_Object string) |
| 152 | { | 152 | { |
| 153 | Lisp_Object sbeg; | 153 | Lisp_Object sbeg; |
| 154 | 154 | ||
| @@ -176,7 +176,7 @@ record_delete (EMACS_INT beg, Lisp_Object string) | |||
| 176 | won't be inverted automatically by undoing the buffer modification. */ | 176 | won't be inverted automatically by undoing the buffer modification. */ |
| 177 | 177 | ||
| 178 | void | 178 | void |
| 179 | record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) | 179 | record_marker_adjustment (Lisp_Object marker, ptrdiff_t adjustment) |
| 180 | { | 180 | { |
| 181 | if (EQ (BVAR (current_buffer, undo_list), Qt)) | 181 | if (EQ (BVAR (current_buffer, undo_list), Qt)) |
| 182 | return; | 182 | return; |
| @@ -199,7 +199,7 @@ record_marker_adjustment (Lisp_Object marker, EMACS_INT adjustment) | |||
| 199 | The replacement must not change the number of characters. */ | 199 | The replacement must not change the number of characters. */ |
| 200 | 200 | ||
| 201 | void | 201 | void |
| 202 | record_change (EMACS_INT beg, EMACS_INT length) | 202 | record_change (ptrdiff_t beg, ptrdiff_t length) |
| 203 | { | 203 | { |
| 204 | record_delete (beg, make_buffer_string (beg, beg + length, 1)); | 204 | record_delete (beg, make_buffer_string (beg, beg + length, 1)); |
| 205 | record_insert (beg, length); | 205 | record_insert (beg, length); |
| @@ -233,7 +233,7 @@ record_first_change (void) | |||
| 233 | for LENGTH characters starting at position BEG in BUFFER. */ | 233 | for LENGTH characters starting at position BEG in BUFFER. */ |
| 234 | 234 | ||
| 235 | void | 235 | void |
| 236 | record_property_change (EMACS_INT beg, EMACS_INT length, | 236 | record_property_change (ptrdiff_t beg, ptrdiff_t length, |
| 237 | Lisp_Object prop, Lisp_Object value, | 237 | Lisp_Object prop, Lisp_Object value, |
| 238 | Lisp_Object buffer) | 238 | Lisp_Object buffer) |
| 239 | { | 239 | { |
| @@ -308,11 +308,11 @@ truncate_undo_list (struct buffer *b) | |||
| 308 | { | 308 | { |
| 309 | Lisp_Object list; | 309 | Lisp_Object list; |
| 310 | Lisp_Object prev, next, last_boundary; | 310 | Lisp_Object prev, next, last_boundary; |
| 311 | int size_so_far = 0; | 311 | EMACS_INT size_so_far = 0; |
| 312 | 312 | ||
| 313 | /* Make sure that calling undo-outer-limit-function | 313 | /* Make sure that calling undo-outer-limit-function |
| 314 | won't cause another GC. */ | 314 | won't cause another GC. */ |
| 315 | int count = inhibit_garbage_collection (); | 315 | ptrdiff_t count = inhibit_garbage_collection (); |
| 316 | 316 | ||
| 317 | /* Make the buffer current to get its local values of variables such | 317 | /* Make the buffer current to get its local values of variables such |
| 318 | as undo_limit. Also so that Vundo_outer_limit_function can | 318 | as undo_limit. Also so that Vundo_outer_limit_function can |
| @@ -444,8 +444,8 @@ Return what remains of the list. */) | |||
| 444 | { | 444 | { |
| 445 | struct gcpro gcpro1, gcpro2; | 445 | struct gcpro gcpro1, gcpro2; |
| 446 | Lisp_Object next; | 446 | Lisp_Object next; |
| 447 | int count = SPECPDL_INDEX (); | 447 | ptrdiff_t count = SPECPDL_INDEX (); |
| 448 | register int arg; | 448 | register EMACS_INT arg; |
| 449 | Lisp_Object oldlist; | 449 | Lisp_Object oldlist; |
| 450 | int did_apply = 0; | 450 | int did_apply = 0; |
| 451 | 451 | ||
diff --git a/src/w32fns.c b/src/w32fns.c index f48e5764b4c..5c135b2e46d 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -4059,7 +4059,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4059 | int minibuffer_only = 0; | 4059 | int minibuffer_only = 0; |
| 4060 | long window_prompting = 0; | 4060 | long window_prompting = 0; |
| 4061 | int width, height; | 4061 | int width, height; |
| 4062 | int count = SPECPDL_INDEX (); | 4062 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4063 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 4063 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 4064 | Lisp_Object display; | 4064 | Lisp_Object display; |
| 4065 | struct w32_display_info *dpyinfo = NULL; | 4065 | struct w32_display_info *dpyinfo = NULL; |
| @@ -5170,7 +5170,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, | |||
| 5170 | Lisp_Object name; | 5170 | Lisp_Object name; |
| 5171 | long window_prompting = 0; | 5171 | long window_prompting = 0; |
| 5172 | int width, height; | 5172 | int width, height; |
| 5173 | int count = SPECPDL_INDEX (); | 5173 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5174 | struct gcpro gcpro1, gcpro2, gcpro3; | 5174 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 5175 | struct kboard *kb; | 5175 | struct kboard *kb; |
| 5176 | int face_change_count_before = face_change_count; | 5176 | int face_change_count_before = face_change_count; |
| @@ -5518,7 +5518,7 @@ Text larger than the specified size is clipped. */) | |||
| 5518 | int i, width, height, seen_reversed_p; | 5518 | int i, width, height, seen_reversed_p; |
| 5519 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 5519 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 5520 | int old_windows_or_buffers_changed = windows_or_buffers_changed; | 5520 | int old_windows_or_buffers_changed = windows_or_buffers_changed; |
| 5521 | int count = SPECPDL_INDEX (); | 5521 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5522 | 5522 | ||
| 5523 | specbind (Qinhibit_redisplay, Qt); | 5523 | specbind (Qinhibit_redisplay, Qt); |
| 5524 | 5524 | ||
| @@ -5797,7 +5797,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, | |||
| 5797 | Value is t if tooltip was open, nil otherwise. */) | 5797 | Value is t if tooltip was open, nil otherwise. */) |
| 5798 | (void) | 5798 | (void) |
| 5799 | { | 5799 | { |
| 5800 | int count; | 5800 | ptrdiff_t count; |
| 5801 | Lisp_Object deleted, frame, timer; | 5801 | Lisp_Object deleted, frame, timer; |
| 5802 | struct gcpro gcpro1, gcpro2; | 5802 | struct gcpro gcpro1, gcpro2; |
| 5803 | 5803 | ||
| @@ -5919,7 +5919,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5919 | { | 5919 | { |
| 5920 | struct frame *f = SELECTED_FRAME (); | 5920 | struct frame *f = SELECTED_FRAME (); |
| 5921 | Lisp_Object file = Qnil; | 5921 | Lisp_Object file = Qnil; |
| 5922 | int count = SPECPDL_INDEX (); | 5922 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5923 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 5923 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 5924 | char filename[MAX_PATH + 1]; | 5924 | char filename[MAX_PATH + 1]; |
| 5925 | char init_dir[MAX_PATH + 1]; | 5925 | char init_dir[MAX_PATH + 1]; |
diff --git a/src/w32menu.c b/src/w32menu.c index c31a8c1fd96..98b053a9e23 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -381,7 +381,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 381 | 381 | ||
| 382 | struct buffer *prev = current_buffer; | 382 | struct buffer *prev = current_buffer; |
| 383 | Lisp_Object buffer; | 383 | Lisp_Object buffer; |
| 384 | int specpdl_count = SPECPDL_INDEX (); | 384 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 385 | int previous_menu_items_used = f->menu_bar_items_used; | 385 | int previous_menu_items_used = f->menu_bar_items_used; |
| 386 | Lisp_Object *previous_items | 386 | Lisp_Object *previous_items |
| 387 | = (Lisp_Object *) alloca (previous_menu_items_used | 387 | = (Lisp_Object *) alloca (previous_menu_items_used |
diff --git a/src/window.c b/src/window.c index 39210b91616..3014d90ff79 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -63,7 +63,7 @@ static int displayed_window_lines (struct window *); | |||
| 63 | static struct window *decode_window (Lisp_Object); | 63 | static struct window *decode_window (Lisp_Object); |
| 64 | static int count_windows (struct window *); | 64 | static int count_windows (struct window *); |
| 65 | static int get_leaf_windows (struct window *, struct window **, int); | 65 | static int get_leaf_windows (struct window *, struct window **, int); |
| 66 | static void window_scroll (Lisp_Object, int, int, int); | 66 | static void window_scroll (Lisp_Object, EMACS_INT, int, int); |
| 67 | static void window_scroll_pixel_based (Lisp_Object, int, int, int); | 67 | static void window_scroll_pixel_based (Lisp_Object, int, int, int); |
| 68 | static void window_scroll_line_based (Lisp_Object, int, int, int); | 68 | static void window_scroll_line_based (Lisp_Object, int, int, int); |
| 69 | static int freeze_window_start (struct window *, void *); | 69 | static int freeze_window_start (struct window *, void *); |
| @@ -127,8 +127,8 @@ static int window_scroll_pixel_based_preserve_x; | |||
| 127 | static int window_scroll_pixel_based_preserve_y; | 127 | static int window_scroll_pixel_based_preserve_y; |
| 128 | 128 | ||
| 129 | /* Same for window_scroll_line_based. */ | 129 | /* Same for window_scroll_line_based. */ |
| 130 | static int window_scroll_preserve_hpos; | 130 | static EMACS_INT window_scroll_preserve_hpos; |
| 131 | static int window_scroll_preserve_vpos; | 131 | static EMACS_INT window_scroll_preserve_vpos; |
| 132 | 132 | ||
| 133 | static struct window * | 133 | static struct window * |
| 134 | decode_window (register Lisp_Object window) | 134 | decode_window (register Lisp_Object window) |
| @@ -379,7 +379,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 379 | redisplay_window has altered point after scrolling, | 379 | redisplay_window has altered point after scrolling, |
| 380 | because it makes the change only in the window. */ | 380 | because it makes the change only in the window. */ |
| 381 | { | 381 | { |
| 382 | register EMACS_INT new_point = marker_position (w->pointm); | 382 | register ptrdiff_t new_point = marker_position (w->pointm); |
| 383 | if (new_point < BEGV) | 383 | if (new_point < BEGV) |
| 384 | SET_PT (BEGV); | 384 | SET_PT (BEGV); |
| 385 | else if (new_point > ZV) | 385 | else if (new_point > ZV) |
| @@ -691,10 +691,10 @@ window so that the location of point moves off-window. */) | |||
| 691 | (Lisp_Object window, Lisp_Object ncol) | 691 | (Lisp_Object window, Lisp_Object ncol) |
| 692 | { | 692 | { |
| 693 | struct window *w = decode_window (window); | 693 | struct window *w = decode_window (window); |
| 694 | int hscroll; | 694 | ptrdiff_t hscroll; |
| 695 | 695 | ||
| 696 | CHECK_NUMBER (ncol); | 696 | CHECK_NUMBER (ncol); |
| 697 | hscroll = max (0, XINT (ncol)); | 697 | hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); |
| 698 | 698 | ||
| 699 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 699 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 700 | if (XINT (w->hscroll) != hscroll) | 700 | if (XINT (w->hscroll) != hscroll) |
| @@ -1526,7 +1526,8 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1526 | register struct window *w; | 1526 | register struct window *w; |
| 1527 | register struct buffer *b; | 1527 | register struct buffer *b; |
| 1528 | struct glyph_row *row, *end_row; | 1528 | struct glyph_row *row, *end_row; |
| 1529 | int max_y, crop, i, n; | 1529 | int max_y, crop, i; |
| 1530 | EMACS_INT n; | ||
| 1530 | 1531 | ||
| 1531 | w = decode_window (window); | 1532 | w = decode_window (window); |
| 1532 | 1533 | ||
| @@ -2596,7 +2597,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2596 | struct window *w, *r, *s; | 2597 | struct window *w, *r, *s; |
| 2597 | struct frame *f; | 2598 | struct frame *f; |
| 2598 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; | 2599 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; |
| 2599 | EMACS_INT startpos IF_LINT (= 0); | 2600 | ptrdiff_t startpos IF_LINT (= 0); |
| 2600 | int top IF_LINT (= 0), new_top, resize_failed; | 2601 | int top IF_LINT (= 0), new_top, resize_failed; |
| 2601 | 2602 | ||
| 2602 | w = decode_any_window (window); | 2603 | w = decode_any_window (window); |
| @@ -2925,7 +2926,7 @@ select_frame_norecord (Lisp_Object frame) | |||
| 2925 | void | 2926 | void |
| 2926 | run_window_configuration_change_hook (struct frame *f) | 2927 | run_window_configuration_change_hook (struct frame *f) |
| 2927 | { | 2928 | { |
| 2928 | int count = SPECPDL_INDEX (); | 2929 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2929 | Lisp_Object frame, global_wcch | 2930 | Lisp_Object frame, global_wcch |
| 2930 | = Fdefault_value (Qwindow_configuration_change_hook); | 2931 | = Fdefault_value (Qwindow_configuration_change_hook); |
| 2931 | XSETFRAME (frame, f); | 2932 | XSETFRAME (frame, f); |
| @@ -2956,7 +2957,7 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 2956 | if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, | 2957 | if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, |
| 2957 | buffer))) | 2958 | buffer))) |
| 2958 | { | 2959 | { |
| 2959 | int inner_count = SPECPDL_INDEX (); | 2960 | ptrdiff_t inner_count = SPECPDL_INDEX (); |
| 2960 | record_unwind_protect (select_window_norecord, Fselected_window ()); | 2961 | record_unwind_protect (select_window_norecord, Fselected_window ()); |
| 2961 | select_window_norecord (window); | 2962 | select_window_norecord (window); |
| 2962 | run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, | 2963 | run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, |
| @@ -2991,7 +2992,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 2991 | { | 2992 | { |
| 2992 | struct window *w = XWINDOW (window); | 2993 | struct window *w = XWINDOW (window); |
| 2993 | struct buffer *b = XBUFFER (buffer); | 2994 | struct buffer *b = XBUFFER (buffer); |
| 2994 | int count = SPECPDL_INDEX (); | 2995 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2995 | int samebuf = EQ (buffer, w->buffer); | 2996 | int samebuf = EQ (buffer, w->buffer); |
| 2996 | 2997 | ||
| 2997 | w->buffer = buffer; | 2998 | w->buffer = buffer; |
| @@ -3225,7 +3226,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3225 | /* Run temp-buffer-show-hook, with the chosen window selected | 3226 | /* Run temp-buffer-show-hook, with the chosen window selected |
| 3226 | and its buffer current. */ | 3227 | and its buffer current. */ |
| 3227 | { | 3228 | { |
| 3228 | int count = SPECPDL_INDEX (); | 3229 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3229 | Lisp_Object prev_window, prev_buffer; | 3230 | Lisp_Object prev_window, prev_buffer; |
| 3230 | prev_window = selected_window; | 3231 | prev_window = selected_window; |
| 3231 | XSETBUFFER (prev_buffer, old); | 3232 | XSETBUFFER (prev_buffer, old); |
| @@ -4212,9 +4213,10 @@ window_internal_height (struct window *w) | |||
| 4212 | respectively. */ | 4213 | respectively. */ |
| 4213 | 4214 | ||
| 4214 | static void | 4215 | static void |
| 4215 | window_scroll (Lisp_Object window, int n, int whole, int noerror) | 4216 | window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror) |
| 4216 | { | 4217 | { |
| 4217 | immediate_quit = 1; | 4218 | immediate_quit = 1; |
| 4219 | n = clip_to_bounds (INT_MIN, n, INT_MAX); | ||
| 4218 | 4220 | ||
| 4219 | /* If we must, use the pixel-based version which is much slower than | 4221 | /* If we must, use the pixel-based version which is much slower than |
| 4220 | the line-based one but can handle varying line heights. */ | 4222 | the line-based one but can handle varying line heights. */ |
| @@ -4310,7 +4312,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4310 | /* Maybe modify window start instead of scrolling. */ | 4312 | /* Maybe modify window start instead of scrolling. */ |
| 4311 | if (rbot > 0 || w->vscroll < 0) | 4313 | if (rbot > 0 || w->vscroll < 0) |
| 4312 | { | 4314 | { |
| 4313 | EMACS_INT spos; | 4315 | ptrdiff_t spos; |
| 4314 | 4316 | ||
| 4315 | Fset_window_vscroll (window, make_number (0), Qt); | 4317 | Fset_window_vscroll (window, make_number (0), Qt); |
| 4316 | /* If there are other text lines above the current row, | 4318 | /* If there are other text lines above the current row, |
| @@ -4365,7 +4367,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4365 | start_display (&it, w, start); | 4367 | start_display (&it, w, start); |
| 4366 | if (whole) | 4368 | if (whole) |
| 4367 | { | 4369 | { |
| 4368 | EMACS_INT start_pos = IT_CHARPOS (it); | 4370 | ptrdiff_t start_pos = IT_CHARPOS (it); |
| 4369 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); | 4371 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4370 | dy = max ((window_box_height (w) | 4372 | dy = max ((window_box_height (w) |
| 4371 | - next_screen_context_lines * dy), | 4373 | - next_screen_context_lines * dy), |
| @@ -4452,8 +4454,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4452 | 4454 | ||
| 4453 | if (! vscrolled) | 4455 | if (! vscrolled) |
| 4454 | { | 4456 | { |
| 4455 | EMACS_INT pos = IT_CHARPOS (it); | 4457 | ptrdiff_t pos = IT_CHARPOS (it); |
| 4456 | EMACS_INT bytepos; | 4458 | ptrdiff_t bytepos; |
| 4457 | 4459 | ||
| 4458 | /* If in the middle of a multi-glyph character move forward to | 4460 | /* If in the middle of a multi-glyph character move forward to |
| 4459 | the next character. */ | 4461 | the next character. */ |
| @@ -4523,7 +4525,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4523 | } | 4525 | } |
| 4524 | else if (n < 0) | 4526 | else if (n < 0) |
| 4525 | { | 4527 | { |
| 4526 | EMACS_INT charpos, bytepos; | 4528 | ptrdiff_t charpos, bytepos; |
| 4527 | int partial_p; | 4529 | int partial_p; |
| 4528 | 4530 | ||
| 4529 | /* Save our position, for the | 4531 | /* Save our position, for the |
| @@ -4600,12 +4602,12 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4600 | in `grep-mode-font-lock-keywords'). So we use a marker to record | 4602 | in `grep-mode-font-lock-keywords'). So we use a marker to record |
| 4601 | the old point position, to prevent crashes in SET_PT_BOTH. */ | 4603 | the old point position, to prevent crashes in SET_PT_BOTH. */ |
| 4602 | Lisp_Object opoint_marker = Fpoint_marker (); | 4604 | Lisp_Object opoint_marker = Fpoint_marker (); |
| 4603 | register EMACS_INT pos, pos_byte; | 4605 | register ptrdiff_t pos, pos_byte; |
| 4604 | register int ht = window_internal_height (w); | 4606 | register int ht = window_internal_height (w); |
| 4605 | register Lisp_Object tem; | 4607 | register Lisp_Object tem; |
| 4606 | int lose; | 4608 | int lose; |
| 4607 | Lisp_Object bolp; | 4609 | Lisp_Object bolp; |
| 4608 | EMACS_INT startpos; | 4610 | ptrdiff_t startpos; |
| 4609 | Lisp_Object original_pos = Qnil; | 4611 | Lisp_Object original_pos = Qnil; |
| 4610 | 4612 | ||
| 4611 | /* If scrolling screen-fulls, compute the number of lines to | 4613 | /* If scrolling screen-fulls, compute the number of lines to |
| @@ -4754,7 +4756,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4754 | static void | 4756 | static void |
| 4755 | scroll_command (Lisp_Object n, int direction) | 4757 | scroll_command (Lisp_Object n, int direction) |
| 4756 | { | 4758 | { |
| 4757 | int count = SPECPDL_INDEX (); | 4759 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4758 | 4760 | ||
| 4759 | xassert (eabs (direction) == 1); | 4761 | xassert (eabs (direction) == 1); |
| 4760 | 4762 | ||
| @@ -4869,7 +4871,7 @@ specifies the window to scroll. This takes precedence over | |||
| 4869 | { | 4871 | { |
| 4870 | Lisp_Object window; | 4872 | Lisp_Object window; |
| 4871 | struct window *w; | 4873 | struct window *w; |
| 4872 | int count = SPECPDL_INDEX (); | 4874 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4873 | 4875 | ||
| 4874 | window = Fother_window_for_scrolling (); | 4876 | window = Fother_window_for_scrolling (); |
| 4875 | w = XWINDOW (window); | 4877 | w = XWINDOW (window); |
| @@ -4911,7 +4913,7 @@ by this function. This happens in an interactive call. */) | |||
| 4911 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4913 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4912 | { | 4914 | { |
| 4913 | Lisp_Object result; | 4915 | Lisp_Object result; |
| 4914 | int hscroll; | 4916 | EMACS_INT hscroll; |
| 4915 | struct window *w = XWINDOW (selected_window); | 4917 | struct window *w = XWINDOW (selected_window); |
| 4916 | 4918 | ||
| 4917 | if (NILP (arg)) | 4919 | if (NILP (arg)) |
| @@ -4940,7 +4942,7 @@ by this function. This happens in an interactive call. */) | |||
| 4940 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4942 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4941 | { | 4943 | { |
| 4942 | Lisp_Object result; | 4944 | Lisp_Object result; |
| 4943 | int hscroll; | 4945 | EMACS_INT hscroll; |
| 4944 | struct window *w = XWINDOW (selected_window); | 4946 | struct window *w = XWINDOW (selected_window); |
| 4945 | 4947 | ||
| 4946 | if (NILP (arg)) | 4948 | if (NILP (arg)) |
| @@ -5051,7 +5053,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5051 | struct buffer *buf = XBUFFER (w->buffer); | 5053 | struct buffer *buf = XBUFFER (w->buffer); |
| 5052 | struct buffer *obuf = current_buffer; | 5054 | struct buffer *obuf = current_buffer; |
| 5053 | int center_p = 0; | 5055 | int center_p = 0; |
| 5054 | EMACS_INT charpos, bytepos; | 5056 | ptrdiff_t charpos, bytepos; |
| 5055 | EMACS_INT iarg IF_LINT (= 0); | 5057 | EMACS_INT iarg IF_LINT (= 0); |
| 5056 | int this_scroll_margin; | 5058 | int this_scroll_margin; |
| 5057 | 5059 | ||
| @@ -5400,7 +5402,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5400 | Lisp_Object frame; | 5402 | Lisp_Object frame; |
| 5401 | Lisp_Object auto_buffer_name; | 5403 | Lisp_Object auto_buffer_name; |
| 5402 | FRAME_PTR f; | 5404 | FRAME_PTR f; |
| 5403 | EMACS_INT old_point = -1; | 5405 | ptrdiff_t old_point = -1; |
| 5404 | 5406 | ||
| 5405 | CHECK_WINDOW_CONFIGURATION (configuration); | 5407 | CHECK_WINDOW_CONFIGURATION (configuration); |
| 5406 | 5408 | ||
| @@ -6117,7 +6119,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) | |||
| 6117 | 6119 | ||
| 6118 | if (!NILP (width)) | 6120 | if (!NILP (width)) |
| 6119 | { | 6121 | { |
| 6120 | CHECK_NATNUM (width); | 6122 | CHECK_RANGED_INTEGER (0, width, INT_MAX); |
| 6121 | 6123 | ||
| 6122 | if (XINT (width) == 0) | 6124 | if (XINT (width) == 0) |
| 6123 | vertical_type = Qnil; | 6125 | vertical_type = Qnil; |
diff --git a/src/xdisp.c b/src/xdisp.c index 6ba92f3ed79..763862cd0e3 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -748,7 +748,7 @@ static Lisp_Object Qinhibit_free_realized_faces; | |||
| 748 | Lisp_Object help_echo_string; | 748 | Lisp_Object help_echo_string; |
| 749 | Lisp_Object help_echo_window; | 749 | Lisp_Object help_echo_window; |
| 750 | Lisp_Object help_echo_object; | 750 | Lisp_Object help_echo_object; |
| 751 | EMACS_INT help_echo_pos; | 751 | ptrdiff_t help_echo_pos; |
| 752 | 752 | ||
| 753 | /* Temporary variable for XTread_socket. */ | 753 | /* Temporary variable for XTread_socket. */ |
| 754 | 754 | ||
| @@ -795,33 +795,33 @@ static Lisp_Object get_it_property (struct it *it, Lisp_Object prop); | |||
| 795 | 795 | ||
| 796 | static void handle_line_prefix (struct it *); | 796 | static void handle_line_prefix (struct it *); |
| 797 | 797 | ||
| 798 | static void pint2str (char *, int, EMACS_INT); | 798 | static void pint2str (char *, int, ptrdiff_t); |
| 799 | static void pint2hrstr (char *, int, EMACS_INT); | 799 | static void pint2hrstr (char *, int, ptrdiff_t); |
| 800 | static struct text_pos run_window_scroll_functions (Lisp_Object, | 800 | static struct text_pos run_window_scroll_functions (Lisp_Object, |
| 801 | struct text_pos); | 801 | struct text_pos); |
| 802 | static void reconsider_clip_changes (struct window *, struct buffer *); | 802 | static void reconsider_clip_changes (struct window *, struct buffer *); |
| 803 | static int text_outside_line_unchanged_p (struct window *, | 803 | static int text_outside_line_unchanged_p (struct window *, |
| 804 | EMACS_INT, EMACS_INT); | 804 | ptrdiff_t, ptrdiff_t); |
| 805 | static void store_mode_line_noprop_char (char); | 805 | static void store_mode_line_noprop_char (char); |
| 806 | static int store_mode_line_noprop (const char *, int, int); | 806 | static int store_mode_line_noprop (const char *, int, int); |
| 807 | static void handle_stop (struct it *); | 807 | static void handle_stop (struct it *); |
| 808 | static void handle_stop_backwards (struct it *, EMACS_INT); | 808 | static void handle_stop_backwards (struct it *, ptrdiff_t); |
| 809 | static void vmessage (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); | 809 | static void vmessage (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); |
| 810 | static void ensure_echo_area_buffers (void); | 810 | static void ensure_echo_area_buffers (void); |
| 811 | static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); | 811 | static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); |
| 812 | static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); | 812 | static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); |
| 813 | static int with_echo_area_buffer (struct window *, int, | 813 | static int with_echo_area_buffer (struct window *, int, |
| 814 | int (*) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT), | 814 | int (*) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t), |
| 815 | EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); | 815 | ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 816 | static void clear_garbaged_frames (void); | 816 | static void clear_garbaged_frames (void); |
| 817 | static int current_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); | 817 | static int current_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 818 | static void pop_message (void); | 818 | static void pop_message (void); |
| 819 | static int truncate_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); | 819 | static int truncate_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 820 | static void set_message (const char *, Lisp_Object, EMACS_INT, int); | 820 | static void set_message (const char *, Lisp_Object, ptrdiff_t, int); |
| 821 | static int set_message_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); | 821 | static int set_message_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 822 | static int display_echo_area (struct window *); | 822 | static int display_echo_area (struct window *); |
| 823 | static int display_echo_area_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); | 823 | static int display_echo_area_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 824 | static int resize_mini_window_1 (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT); | 824 | static int resize_mini_window_1 (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t); |
| 825 | static Lisp_Object unwind_redisplay (Lisp_Object); | 825 | static Lisp_Object unwind_redisplay (Lisp_Object); |
| 826 | static int string_char_and_length (const unsigned char *, int *); | 826 | static int string_char_and_length (const unsigned char *, int *); |
| 827 | static struct text_pos display_prop_end (struct it *, Lisp_Object, | 827 | static struct text_pos display_prop_end (struct it *, Lisp_Object, |
| @@ -834,10 +834,10 @@ static struct glyph_row *get_overlay_arrow_glyph_row (struct window *, | |||
| 834 | static void extend_face_to_end_of_line (struct it *); | 834 | static void extend_face_to_end_of_line (struct it *); |
| 835 | static int append_space_for_newline (struct it *, int); | 835 | static int append_space_for_newline (struct it *, int); |
| 836 | static int cursor_row_fully_visible_p (struct window *, int, int); | 836 | static int cursor_row_fully_visible_p (struct window *, int, int); |
| 837 | static int try_scrolling (Lisp_Object, int, EMACS_INT, EMACS_INT, int, int); | 837 | static int try_scrolling (Lisp_Object, int, ptrdiff_t, ptrdiff_t, int, int); |
| 838 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); | 838 | static int try_cursor_movement (Lisp_Object, struct text_pos, int *); |
| 839 | static int trailing_whitespace_p (EMACS_INT); | 839 | static int trailing_whitespace_p (ptrdiff_t); |
| 840 | static intmax_t message_log_check_duplicate (EMACS_INT, EMACS_INT); | 840 | static intmax_t message_log_check_duplicate (ptrdiff_t, ptrdiff_t); |
| 841 | static void push_it (struct it *, struct text_pos *); | 841 | static void push_it (struct it *, struct text_pos *); |
| 842 | static void pop_it (struct it *); | 842 | static void pop_it (struct it *); |
| 843 | static void sync_frame_with_window_matrix_rows (struct window *); | 843 | static void sync_frame_with_window_matrix_rows (struct window *); |
| @@ -850,7 +850,7 @@ static Lisp_Object redisplay_window_error (Lisp_Object); | |||
| 850 | static Lisp_Object redisplay_window_0 (Lisp_Object); | 850 | static Lisp_Object redisplay_window_0 (Lisp_Object); |
| 851 | static Lisp_Object redisplay_window_1 (Lisp_Object); | 851 | static Lisp_Object redisplay_window_1 (Lisp_Object); |
| 852 | static int set_cursor_from_row (struct window *, struct glyph_row *, | 852 | static int set_cursor_from_row (struct window *, struct glyph_row *, |
| 853 | struct glyph_matrix *, EMACS_INT, EMACS_INT, | 853 | struct glyph_matrix *, ptrdiff_t, ptrdiff_t, |
| 854 | int, int); | 854 | int, int); |
| 855 | static int update_menu_bar (struct frame *, int, int); | 855 | static int update_menu_bar (struct frame *, int, int); |
| 856 | static int try_window_reusing_current_matrix (struct window *); | 856 | static int try_window_reusing_current_matrix (struct window *); |
| @@ -862,14 +862,14 @@ static int display_mode_element (struct it *, int, int, int, Lisp_Object, Lisp_O | |||
| 862 | static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object); | 862 | static int store_mode_line_string (const char *, Lisp_Object, int, int, int, Lisp_Object); |
| 863 | static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *); | 863 | static const char *decode_mode_spec (struct window *, int, int, Lisp_Object *); |
| 864 | static void display_menu_bar (struct window *); | 864 | static void display_menu_bar (struct window *); |
| 865 | static EMACS_INT display_count_lines (EMACS_INT, EMACS_INT, EMACS_INT, | 865 | static ptrdiff_t display_count_lines (ptrdiff_t, ptrdiff_t, ptrdiff_t, |
| 866 | EMACS_INT *); | 866 | ptrdiff_t *); |
| 867 | static int display_string (const char *, Lisp_Object, Lisp_Object, | 867 | static int display_string (const char *, Lisp_Object, Lisp_Object, |
| 868 | EMACS_INT, EMACS_INT, struct it *, int, int, int, int); | 868 | ptrdiff_t, ptrdiff_t, struct it *, int, int, int, int); |
| 869 | static void compute_line_metrics (struct it *); | 869 | static void compute_line_metrics (struct it *); |
| 870 | static void run_redisplay_end_trigger_hook (struct it *); | 870 | static void run_redisplay_end_trigger_hook (struct it *); |
| 871 | static int get_overlay_strings (struct it *, EMACS_INT); | 871 | static int get_overlay_strings (struct it *, ptrdiff_t); |
| 872 | static int get_overlay_strings_1 (struct it *, EMACS_INT, int); | 872 | static int get_overlay_strings_1 (struct it *, ptrdiff_t, int); |
| 873 | static void next_overlay_string (struct it *); | 873 | static void next_overlay_string (struct it *); |
| 874 | static void reseat (struct it *, struct text_pos, int); | 874 | static void reseat (struct it *, struct text_pos, int); |
| 875 | static void reseat_1 (struct it *, struct text_pos, int); | 875 | static void reseat_1 (struct it *, struct text_pos, int); |
| @@ -884,14 +884,14 @@ static int next_element_from_buffer (struct it *); | |||
| 884 | static int next_element_from_composition (struct it *); | 884 | static int next_element_from_composition (struct it *); |
| 885 | static int next_element_from_image (struct it *); | 885 | static int next_element_from_image (struct it *); |
| 886 | static int next_element_from_stretch (struct it *); | 886 | static int next_element_from_stretch (struct it *); |
| 887 | static void load_overlay_strings (struct it *, EMACS_INT); | 887 | static void load_overlay_strings (struct it *, ptrdiff_t); |
| 888 | static int init_from_display_pos (struct it *, struct window *, | 888 | static int init_from_display_pos (struct it *, struct window *, |
| 889 | struct display_pos *); | 889 | struct display_pos *); |
| 890 | static void reseat_to_string (struct it *, const char *, | 890 | static void reseat_to_string (struct it *, const char *, |
| 891 | Lisp_Object, EMACS_INT, EMACS_INT, int, int); | 891 | Lisp_Object, ptrdiff_t, ptrdiff_t, int, int); |
| 892 | static int get_next_display_element (struct it *); | 892 | static int get_next_display_element (struct it *); |
| 893 | static enum move_it_result | 893 | static enum move_it_result |
| 894 | move_it_in_display_line_to (struct it *, EMACS_INT, int, | 894 | move_it_in_display_line_to (struct it *, ptrdiff_t, int, |
| 895 | enum move_operation_enum); | 895 | enum move_operation_enum); |
| 896 | void move_it_vertically_backward (struct it *, int); | 896 | void move_it_vertically_backward (struct it *, int); |
| 897 | static void init_to_row_start (struct it *, struct window *, | 897 | static void init_to_row_start (struct it *, struct window *, |
| @@ -901,20 +901,20 @@ static int init_to_row_end (struct it *, struct window *, | |||
| 901 | static void back_to_previous_line_start (struct it *); | 901 | static void back_to_previous_line_start (struct it *); |
| 902 | static int forward_to_next_line_start (struct it *, int *, struct bidi_it *); | 902 | static int forward_to_next_line_start (struct it *, int *, struct bidi_it *); |
| 903 | static struct text_pos string_pos_nchars_ahead (struct text_pos, | 903 | static struct text_pos string_pos_nchars_ahead (struct text_pos, |
| 904 | Lisp_Object, EMACS_INT); | 904 | Lisp_Object, ptrdiff_t); |
| 905 | static struct text_pos string_pos (EMACS_INT, Lisp_Object); | 905 | static struct text_pos string_pos (ptrdiff_t, Lisp_Object); |
| 906 | static struct text_pos c_string_pos (EMACS_INT, const char *, int); | 906 | static struct text_pos c_string_pos (ptrdiff_t, const char *, int); |
| 907 | static EMACS_INT number_of_chars (const char *, int); | 907 | static ptrdiff_t number_of_chars (const char *, int); |
| 908 | static void compute_stop_pos (struct it *); | 908 | static void compute_stop_pos (struct it *); |
| 909 | static void compute_string_pos (struct text_pos *, struct text_pos, | 909 | static void compute_string_pos (struct text_pos *, struct text_pos, |
| 910 | Lisp_Object); | 910 | Lisp_Object); |
| 911 | static int face_before_or_after_it_pos (struct it *, int); | 911 | static int face_before_or_after_it_pos (struct it *, int); |
| 912 | static EMACS_INT next_overlay_change (EMACS_INT); | 912 | static ptrdiff_t next_overlay_change (ptrdiff_t); |
| 913 | static int handle_display_spec (struct it *, Lisp_Object, Lisp_Object, | 913 | static int handle_display_spec (struct it *, Lisp_Object, Lisp_Object, |
| 914 | Lisp_Object, struct text_pos *, EMACS_INT, int); | 914 | Lisp_Object, struct text_pos *, ptrdiff_t, int); |
| 915 | static int handle_single_display_spec (struct it *, Lisp_Object, | 915 | static int handle_single_display_spec (struct it *, Lisp_Object, |
| 916 | Lisp_Object, Lisp_Object, | 916 | Lisp_Object, Lisp_Object, |
| 917 | struct text_pos *, EMACS_INT, int, int); | 917 | struct text_pos *, ptrdiff_t, int, int); |
| 918 | static int underlying_face_id (struct it *); | 918 | static int underlying_face_id (struct it *); |
| 919 | static int in_ellipses_for_invisible_text_p (struct display_pos *, | 919 | static int in_ellipses_for_invisible_text_p (struct display_pos *, |
| 920 | struct window *); | 920 | struct window *); |
| @@ -1218,7 +1218,7 @@ line_bottom_y (struct it *it) | |||
| 1218 | Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ | 1218 | Set *ROWH and *VPOS to row's visible height and VPOS (row number). */ |
| 1219 | 1219 | ||
| 1220 | int | 1220 | int |
| 1221 | pos_visible_p (struct window *w, EMACS_INT charpos, int *x, int *y, | 1221 | pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, |
| 1222 | int *rtop, int *rbot, int *rowh, int *vpos) | 1222 | int *rtop, int *rbot, int *rowh, int *vpos) |
| 1223 | { | 1223 | { |
| 1224 | struct it it; | 1224 | struct it it; |
| @@ -1392,7 +1392,7 @@ string_char_and_length (const unsigned char *str, int *len) | |||
| 1392 | in STRING, return the position NCHARS ahead (NCHARS >= 0). */ | 1392 | in STRING, return the position NCHARS ahead (NCHARS >= 0). */ |
| 1393 | 1393 | ||
| 1394 | static struct text_pos | 1394 | static struct text_pos |
| 1395 | string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, EMACS_INT nchars) | 1395 | string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, ptrdiff_t nchars) |
| 1396 | { | 1396 | { |
| 1397 | xassert (STRINGP (string) && nchars >= 0); | 1397 | xassert (STRINGP (string) && nchars >= 0); |
| 1398 | 1398 | ||
| @@ -1420,7 +1420,7 @@ string_pos_nchars_ahead (struct text_pos pos, Lisp_Object string, EMACS_INT ncha | |||
| 1420 | for character position CHARPOS in STRING. */ | 1420 | for character position CHARPOS in STRING. */ |
| 1421 | 1421 | ||
| 1422 | static inline struct text_pos | 1422 | static inline struct text_pos |
| 1423 | string_pos (EMACS_INT charpos, Lisp_Object string) | 1423 | string_pos (ptrdiff_t charpos, Lisp_Object string) |
| 1424 | { | 1424 | { |
| 1425 | struct text_pos pos; | 1425 | struct text_pos pos; |
| 1426 | xassert (STRINGP (string)); | 1426 | xassert (STRINGP (string)); |
| @@ -1435,7 +1435,7 @@ string_pos (EMACS_INT charpos, Lisp_Object string) | |||
| 1435 | means recognize multibyte characters. */ | 1435 | means recognize multibyte characters. */ |
| 1436 | 1436 | ||
| 1437 | static struct text_pos | 1437 | static struct text_pos |
| 1438 | c_string_pos (EMACS_INT charpos, const char *s, int multibyte_p) | 1438 | c_string_pos (ptrdiff_t charpos, const char *s, int multibyte_p) |
| 1439 | { | 1439 | { |
| 1440 | struct text_pos pos; | 1440 | struct text_pos pos; |
| 1441 | 1441 | ||
| @@ -1465,14 +1465,14 @@ c_string_pos (EMACS_INT charpos, const char *s, int multibyte_p) | |||
| 1465 | /* Value is the number of characters in C string S. MULTIBYTE_P | 1465 | /* Value is the number of characters in C string S. MULTIBYTE_P |
| 1466 | non-zero means recognize multibyte characters. */ | 1466 | non-zero means recognize multibyte characters. */ |
| 1467 | 1467 | ||
| 1468 | static EMACS_INT | 1468 | static ptrdiff_t |
| 1469 | number_of_chars (const char *s, int multibyte_p) | 1469 | number_of_chars (const char *s, int multibyte_p) |
| 1470 | { | 1470 | { |
| 1471 | EMACS_INT nchars; | 1471 | ptrdiff_t nchars; |
| 1472 | 1472 | ||
| 1473 | if (multibyte_p) | 1473 | if (multibyte_p) |
| 1474 | { | 1474 | { |
| 1475 | EMACS_INT rest = strlen (s); | 1475 | ptrdiff_t rest = strlen (s); |
| 1476 | int len; | 1476 | int len; |
| 1477 | const unsigned char *p = (const unsigned char *) s; | 1477 | const unsigned char *p = (const unsigned char *) s; |
| 1478 | 1478 | ||
| @@ -2188,7 +2188,7 @@ safe_call (ptrdiff_t nargs, Lisp_Object *args) | |||
| 2188 | val = Qnil; | 2188 | val = Qnil; |
| 2189 | else | 2189 | else |
| 2190 | { | 2190 | { |
| 2191 | int count = SPECPDL_INDEX (); | 2191 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2192 | struct gcpro gcpro1; | 2192 | struct gcpro gcpro1; |
| 2193 | 2193 | ||
| 2194 | GCPRO1 (args[0]); | 2194 | GCPRO1 (args[0]); |
| @@ -2338,7 +2338,7 @@ check_window_end (struct window *w) | |||
| 2338 | 2338 | ||
| 2339 | void | 2339 | void |
| 2340 | init_iterator (struct it *it, struct window *w, | 2340 | init_iterator (struct it *it, struct window *w, |
| 2341 | EMACS_INT charpos, EMACS_INT bytepos, | 2341 | ptrdiff_t charpos, ptrdiff_t bytepos, |
| 2342 | struct glyph_row *row, enum face_id base_face_id) | 2342 | struct glyph_row *row, enum face_id base_face_id) |
| 2343 | { | 2343 | { |
| 2344 | int highlight_region_p; | 2344 | int highlight_region_p; |
| @@ -2429,7 +2429,9 @@ init_iterator (struct it *it, struct window *w, | |||
| 2429 | is invisible. >0 means lines indented more than this value are | 2429 | is invisible. >0 means lines indented more than this value are |
| 2430 | invisible. */ | 2430 | invisible. */ |
| 2431 | it->selective = (INTEGERP (BVAR (current_buffer, selective_display)) | 2431 | it->selective = (INTEGERP (BVAR (current_buffer, selective_display)) |
| 2432 | ? XINT (BVAR (current_buffer, selective_display)) | 2432 | ? clip_to_bounds (-1, XINT (BVAR (current_buffer, |
| 2433 | selective_display)), | ||
| 2434 | PTRDIFF_MAX) | ||
| 2433 | : (!NILP (BVAR (current_buffer, selective_display)) | 2435 | : (!NILP (BVAR (current_buffer, selective_display)) |
| 2434 | ? -1 : 0)); | 2436 | ? -1 : 0)); |
| 2435 | it->selective_display_ellipsis_p | 2437 | it->selective_display_ellipsis_p |
| @@ -2462,7 +2464,7 @@ init_iterator (struct it *it, struct window *w, | |||
| 2462 | && WINDOWP (minibuf_selected_window) | 2464 | && WINDOWP (minibuf_selected_window) |
| 2463 | && w == XWINDOW (minibuf_selected_window)))) | 2465 | && w == XWINDOW (minibuf_selected_window)))) |
| 2464 | { | 2466 | { |
| 2465 | EMACS_INT markpos = marker_position (BVAR (current_buffer, mark)); | 2467 | ptrdiff_t markpos = marker_position (BVAR (current_buffer, mark)); |
| 2466 | it->region_beg_charpos = min (PT, markpos); | 2468 | it->region_beg_charpos = min (PT, markpos); |
| 2467 | it->region_end_charpos = max (PT, markpos); | 2469 | it->region_end_charpos = max (PT, markpos); |
| 2468 | } | 2470 | } |
| @@ -2476,7 +2478,8 @@ init_iterator (struct it *it, struct window *w, | |||
| 2476 | it->redisplay_end_trigger_charpos | 2478 | it->redisplay_end_trigger_charpos |
| 2477 | = marker_position (w->redisplay_end_trigger); | 2479 | = marker_position (w->redisplay_end_trigger); |
| 2478 | else if (INTEGERP (w->redisplay_end_trigger)) | 2480 | else if (INTEGERP (w->redisplay_end_trigger)) |
| 2479 | it->redisplay_end_trigger_charpos = XINT (w->redisplay_end_trigger); | 2481 | it->redisplay_end_trigger_charpos = |
| 2482 | clip_to_bounds (PTRDIFF_MIN, XINT (w->redisplay_end_trigger), PTRDIFF_MAX); | ||
| 2480 | 2483 | ||
| 2481 | it->tab_width = SANE_TAB_WIDTH (current_buffer); | 2484 | it->tab_width = SANE_TAB_WIDTH (current_buffer); |
| 2482 | 2485 | ||
| @@ -2716,7 +2719,7 @@ in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w) | |||
| 2716 | { | 2719 | { |
| 2717 | Lisp_Object prop, window; | 2720 | Lisp_Object prop, window; |
| 2718 | int ellipses_p = 0; | 2721 | int ellipses_p = 0; |
| 2719 | EMACS_INT charpos = CHARPOS (pos->pos); | 2722 | ptrdiff_t charpos = CHARPOS (pos->pos); |
| 2720 | 2723 | ||
| 2721 | /* If POS specifies a position in a display vector, this might | 2724 | /* If POS specifies a position in a display vector, this might |
| 2722 | be for an ellipsis displayed for invisible text. We won't | 2725 | be for an ellipsis displayed for invisible text. We won't |
| @@ -2748,7 +2751,7 @@ in_ellipses_for_invisible_text_p (struct display_pos *pos, struct window *w) | |||
| 2748 | static int | 2751 | static int |
| 2749 | init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) | 2752 | init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) |
| 2750 | { | 2753 | { |
| 2751 | EMACS_INT charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos); | 2754 | ptrdiff_t charpos = CHARPOS (pos->pos), bytepos = BYTEPOS (pos->pos); |
| 2752 | int i, overlay_strings_with_newlines = 0; | 2755 | int i, overlay_strings_with_newlines = 0; |
| 2753 | 2756 | ||
| 2754 | /* If POS specifies a position in a display vector, this might | 2757 | /* If POS specifies a position in a display vector, this might |
| @@ -2808,7 +2811,7 @@ init_from_display_pos (struct it *it, struct window *w, struct display_pos *pos) | |||
| 2808 | pos->overlay_string_index is in IT->overlay_strings. */ | 2811 | pos->overlay_string_index is in IT->overlay_strings. */ |
| 2809 | if (pos->overlay_string_index >= OVERLAY_STRING_CHUNK_SIZE) | 2812 | if (pos->overlay_string_index >= OVERLAY_STRING_CHUNK_SIZE) |
| 2810 | { | 2813 | { |
| 2811 | int n = pos->overlay_string_index / OVERLAY_STRING_CHUNK_SIZE; | 2814 | ptrdiff_t n = pos->overlay_string_index / OVERLAY_STRING_CHUNK_SIZE; |
| 2812 | it->current.overlay_string_index = 0; | 2815 | it->current.overlay_string_index = 0; |
| 2813 | while (n--) | 2816 | while (n--) |
| 2814 | { | 2817 | { |
| @@ -2995,7 +2998,7 @@ compute_stop_pos (struct it *it) | |||
| 2995 | { | 2998 | { |
| 2996 | register INTERVAL iv, next_iv; | 2999 | register INTERVAL iv, next_iv; |
| 2997 | Lisp_Object object, limit, position; | 3000 | Lisp_Object object, limit, position; |
| 2998 | EMACS_INT charpos, bytepos; | 3001 | ptrdiff_t charpos, bytepos; |
| 2999 | 3002 | ||
| 3000 | /* If nowhere else, stop at the end. */ | 3003 | /* If nowhere else, stop at the end. */ |
| 3001 | it->stop_charpos = it->end_charpos; | 3004 | it->stop_charpos = it->end_charpos; |
| @@ -3011,7 +3014,7 @@ compute_stop_pos (struct it *it) | |||
| 3011 | } | 3014 | } |
| 3012 | else | 3015 | else |
| 3013 | { | 3016 | { |
| 3014 | EMACS_INT pos; | 3017 | ptrdiff_t pos; |
| 3015 | 3018 | ||
| 3016 | /* If next overlay change is in front of the current stop pos | 3019 | /* If next overlay change is in front of the current stop pos |
| 3017 | (which is IT->end_charpos), stop there. Note: value of | 3020 | (which is IT->end_charpos), stop there. Note: value of |
| @@ -3087,7 +3090,7 @@ compute_stop_pos (struct it *it) | |||
| 3087 | 3090 | ||
| 3088 | if (it->cmp_it.id < 0) | 3091 | if (it->cmp_it.id < 0) |
| 3089 | { | 3092 | { |
| 3090 | EMACS_INT stoppos = it->end_charpos; | 3093 | ptrdiff_t stoppos = it->end_charpos; |
| 3091 | 3094 | ||
| 3092 | if (it->bidi_p && it->bidi_it.scan_dir < 0) | 3095 | if (it->bidi_p && it->bidi_it.scan_dir < 0) |
| 3093 | stoppos = -1; | 3096 | stoppos = -1; |
| @@ -3106,11 +3109,11 @@ compute_stop_pos (struct it *it) | |||
| 3106 | follows. This is like `next-overlay-change' but doesn't use | 3109 | follows. This is like `next-overlay-change' but doesn't use |
| 3107 | xmalloc. */ | 3110 | xmalloc. */ |
| 3108 | 3111 | ||
| 3109 | static EMACS_INT | 3112 | static ptrdiff_t |
| 3110 | next_overlay_change (EMACS_INT pos) | 3113 | next_overlay_change (ptrdiff_t pos) |
| 3111 | { | 3114 | { |
| 3112 | ptrdiff_t i, noverlays; | 3115 | ptrdiff_t i, noverlays; |
| 3113 | EMACS_INT endpos; | 3116 | ptrdiff_t endpos; |
| 3114 | Lisp_Object *overlays; | 3117 | Lisp_Object *overlays; |
| 3115 | 3118 | ||
| 3116 | /* Get all overlays at the given position. */ | 3119 | /* Get all overlays at the given position. */ |
| @@ -3121,7 +3124,7 @@ next_overlay_change (EMACS_INT pos) | |||
| 3121 | for (i = 0; i < noverlays; ++i) | 3124 | for (i = 0; i < noverlays; ++i) |
| 3122 | { | 3125 | { |
| 3123 | Lisp_Object oend; | 3126 | Lisp_Object oend; |
| 3124 | EMACS_INT oendpos; | 3127 | ptrdiff_t oendpos; |
| 3125 | 3128 | ||
| 3126 | oend = OVERLAY_END (overlays[i]); | 3129 | oend = OVERLAY_END (overlays[i]); |
| 3127 | oendpos = OVERLAY_POSITION (oend); | 3130 | oendpos = OVERLAY_POSITION (oend); |
| @@ -3148,7 +3151,7 @@ next_overlay_change (EMACS_INT pos) | |||
| 3148 | strings, non-zero otherwise. It is set to 2 if the display string | 3151 | strings, non-zero otherwise. It is set to 2 if the display string |
| 3149 | uses any kind of `(space ...)' spec that will produce a stretch of | 3152 | uses any kind of `(space ...)' spec that will produce a stretch of |
| 3150 | white space in the text area. */ | 3153 | white space in the text area. */ |
| 3151 | EMACS_INT | 3154 | ptrdiff_t |
| 3152 | compute_display_string_pos (struct text_pos *position, | 3155 | compute_display_string_pos (struct text_pos *position, |
| 3153 | struct bidi_string_data *string, | 3156 | struct bidi_string_data *string, |
| 3154 | int frame_window_p, int *disp_prop) | 3157 | int frame_window_p, int *disp_prop) |
| @@ -3158,10 +3161,10 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3158 | (string && STRINGP (string->lstring)) ? string->lstring : Qnil; | 3161 | (string && STRINGP (string->lstring)) ? string->lstring : Qnil; |
| 3159 | Lisp_Object pos, spec, limpos; | 3162 | Lisp_Object pos, spec, limpos; |
| 3160 | int string_p = (string && (STRINGP (string->lstring) || string->s)); | 3163 | int string_p = (string && (STRINGP (string->lstring) || string->s)); |
| 3161 | EMACS_INT eob = string_p ? string->schars : ZV; | 3164 | ptrdiff_t eob = string_p ? string->schars : ZV; |
| 3162 | EMACS_INT begb = string_p ? 0 : BEGV; | 3165 | ptrdiff_t begb = string_p ? 0 : BEGV; |
| 3163 | EMACS_INT bufpos, charpos = CHARPOS (*position); | 3166 | ptrdiff_t bufpos, charpos = CHARPOS (*position); |
| 3164 | EMACS_INT lim = | 3167 | ptrdiff_t lim = |
| 3165 | (charpos < eob - MAX_DISP_SCAN) ? charpos + MAX_DISP_SCAN : eob; | 3168 | (charpos < eob - MAX_DISP_SCAN) ? charpos + MAX_DISP_SCAN : eob; |
| 3166 | struct text_pos tpos; | 3169 | struct text_pos tpos; |
| 3167 | int rv = 0; | 3170 | int rv = 0; |
| @@ -3231,14 +3234,14 @@ compute_display_string_pos (struct text_pos *position, | |||
| 3231 | started at CHARPOS. A display string is either an overlay with | 3234 | started at CHARPOS. A display string is either an overlay with |
| 3232 | `display' property whose value is a string or a `display' text | 3235 | `display' property whose value is a string or a `display' text |
| 3233 | property whose value is a string. */ | 3236 | property whose value is a string. */ |
| 3234 | EMACS_INT | 3237 | ptrdiff_t |
| 3235 | compute_display_string_end (EMACS_INT charpos, struct bidi_string_data *string) | 3238 | compute_display_string_end (ptrdiff_t charpos, struct bidi_string_data *string) |
| 3236 | { | 3239 | { |
| 3237 | /* OBJECT = nil means current buffer. */ | 3240 | /* OBJECT = nil means current buffer. */ |
| 3238 | Lisp_Object object = | 3241 | Lisp_Object object = |
| 3239 | (string && STRINGP (string->lstring)) ? string->lstring : Qnil; | 3242 | (string && STRINGP (string->lstring)) ? string->lstring : Qnil; |
| 3240 | Lisp_Object pos = make_number (charpos); | 3243 | Lisp_Object pos = make_number (charpos); |
| 3241 | EMACS_INT eob = | 3244 | ptrdiff_t eob = |
| 3242 | (STRINGP (object) || (string && string->s)) ? string->schars : ZV; | 3245 | (STRINGP (object) || (string && string->s)) ? string->schars : ZV; |
| 3243 | 3246 | ||
| 3244 | if (charpos >= eob || (string->s && !STRINGP (object))) | 3247 | if (charpos >= eob || (string->s && !STRINGP (object))) |
| @@ -3287,7 +3290,7 @@ handle_fontified_prop (struct it *it) | |||
| 3287 | no amount of fontifying will be able to change it. */ | 3290 | no amount of fontifying will be able to change it. */ |
| 3288 | NILP (prop) && IT_CHARPOS (*it) < Z)) | 3291 | NILP (prop) && IT_CHARPOS (*it) < Z)) |
| 3289 | { | 3292 | { |
| 3290 | int count = SPECPDL_INDEX (); | 3293 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3291 | Lisp_Object val; | 3294 | Lisp_Object val; |
| 3292 | struct buffer *obuf = current_buffer; | 3295 | struct buffer *obuf = current_buffer; |
| 3293 | int begv = BEGV, zv = ZV; | 3296 | int begv = BEGV, zv = ZV; |
| @@ -3384,7 +3387,7 @@ static enum prop_handled | |||
| 3384 | handle_face_prop (struct it *it) | 3387 | handle_face_prop (struct it *it) |
| 3385 | { | 3388 | { |
| 3386 | int new_face_id; | 3389 | int new_face_id; |
| 3387 | EMACS_INT next_stop; | 3390 | ptrdiff_t next_stop; |
| 3388 | 3391 | ||
| 3389 | if (!STRINGP (it->string)) | 3392 | if (!STRINGP (it->string)) |
| 3390 | { | 3393 | { |
| @@ -3425,7 +3428,7 @@ handle_face_prop (struct it *it) | |||
| 3425 | else | 3428 | else |
| 3426 | { | 3429 | { |
| 3427 | int base_face_id; | 3430 | int base_face_id; |
| 3428 | EMACS_INT bufpos; | 3431 | ptrdiff_t bufpos; |
| 3429 | int i; | 3432 | int i; |
| 3430 | Lisp_Object from_overlay | 3433 | Lisp_Object from_overlay |
| 3431 | = (it->current.overlay_string_index >= 0 | 3434 | = (it->current.overlay_string_index >= 0 |
| @@ -3543,7 +3546,7 @@ static int | |||
| 3543 | face_before_or_after_it_pos (struct it *it, int before_p) | 3546 | face_before_or_after_it_pos (struct it *it, int before_p) |
| 3544 | { | 3547 | { |
| 3545 | int face_id, limit; | 3548 | int face_id, limit; |
| 3546 | EMACS_INT next_check_charpos; | 3549 | ptrdiff_t next_check_charpos; |
| 3547 | struct it it_copy; | 3550 | struct it it_copy; |
| 3548 | void *it_copy_data = NULL; | 3551 | void *it_copy_data = NULL; |
| 3549 | 3552 | ||
| @@ -3551,7 +3554,7 @@ face_before_or_after_it_pos (struct it *it, int before_p) | |||
| 3551 | 3554 | ||
| 3552 | if (STRINGP (it->string)) | 3555 | if (STRINGP (it->string)) |
| 3553 | { | 3556 | { |
| 3554 | EMACS_INT bufpos, charpos; | 3557 | ptrdiff_t bufpos, charpos; |
| 3555 | int base_face_id; | 3558 | int base_face_id; |
| 3556 | 3559 | ||
| 3557 | /* No face change past the end of the string (for the case | 3560 | /* No face change past the end of the string (for the case |
| @@ -3764,7 +3767,7 @@ handle_invisible_prop (struct it *it) | |||
| 3764 | if (!NILP (prop) | 3767 | if (!NILP (prop) |
| 3765 | && IT_STRING_CHARPOS (*it) < it->end_charpos) | 3768 | && IT_STRING_CHARPOS (*it) < it->end_charpos) |
| 3766 | { | 3769 | { |
| 3767 | EMACS_INT endpos; | 3770 | ptrdiff_t endpos; |
| 3768 | 3771 | ||
| 3769 | handled = HANDLED_RECOMPUTE_PROPS; | 3772 | handled = HANDLED_RECOMPUTE_PROPS; |
| 3770 | 3773 | ||
| @@ -3783,7 +3786,7 @@ handle_invisible_prop (struct it *it) | |||
| 3783 | && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) | 3786 | && (endpos = XFASTINT (end_charpos)) < XFASTINT (limit)) |
| 3784 | { | 3787 | { |
| 3785 | struct text_pos old; | 3788 | struct text_pos old; |
| 3786 | EMACS_INT oldpos; | 3789 | ptrdiff_t oldpos; |
| 3787 | 3790 | ||
| 3788 | old = it->current.string_pos; | 3791 | old = it->current.string_pos; |
| 3789 | oldpos = CHARPOS (old); | 3792 | oldpos = CHARPOS (old); |
| @@ -3835,7 +3838,7 @@ handle_invisible_prop (struct it *it) | |||
| 3835 | else | 3838 | else |
| 3836 | { | 3839 | { |
| 3837 | int invis_p; | 3840 | int invis_p; |
| 3838 | EMACS_INT newpos, next_stop, start_charpos, tem; | 3841 | ptrdiff_t newpos, next_stop, start_charpos, tem; |
| 3839 | Lisp_Object pos, prop, overlay; | 3842 | Lisp_Object pos, prop, overlay; |
| 3840 | 3843 | ||
| 3841 | /* First of all, is there invisible text at this position? */ | 3844 | /* First of all, is there invisible text at this position? */ |
| @@ -4035,7 +4038,7 @@ handle_display_prop (struct it *it) | |||
| 4035 | { | 4038 | { |
| 4036 | Lisp_Object propval, object, overlay; | 4039 | Lisp_Object propval, object, overlay; |
| 4037 | struct text_pos *position; | 4040 | struct text_pos *position; |
| 4038 | EMACS_INT bufpos; | 4041 | ptrdiff_t bufpos; |
| 4039 | /* Nonzero if some property replaces the display of the text itself. */ | 4042 | /* Nonzero if some property replaces the display of the text itself. */ |
| 4040 | int display_replaced_p = 0; | 4043 | int display_replaced_p = 0; |
| 4041 | 4044 | ||
| @@ -4100,7 +4103,7 @@ handle_display_prop (struct it *it) | |||
| 4100 | static int | 4103 | static int |
| 4101 | handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | 4104 | handle_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, |
| 4102 | Lisp_Object overlay, struct text_pos *position, | 4105 | Lisp_Object overlay, struct text_pos *position, |
| 4103 | EMACS_INT bufpos, int frame_window_p) | 4106 | ptrdiff_t bufpos, int frame_window_p) |
| 4104 | { | 4107 | { |
| 4105 | int replacing_p = 0; | 4108 | int replacing_p = 0; |
| 4106 | int rv; | 4109 | int rv; |
| @@ -4207,7 +4210,7 @@ display_prop_end (struct it *it, Lisp_Object object, struct text_pos start_pos) | |||
| 4207 | static int | 4210 | static int |
| 4208 | handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | 4211 | handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, |
| 4209 | Lisp_Object overlay, struct text_pos *position, | 4212 | Lisp_Object overlay, struct text_pos *position, |
| 4210 | EMACS_INT bufpos, int display_replaced_p, | 4213 | ptrdiff_t bufpos, int display_replaced_p, |
| 4211 | int frame_window_p) | 4214 | int frame_window_p) |
| 4212 | { | 4215 | { |
| 4213 | Lisp_Object form; | 4216 | Lisp_Object form; |
| @@ -4229,7 +4232,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4229 | 4232 | ||
| 4230 | if (!NILP (form) && !EQ (form, Qt)) | 4233 | if (!NILP (form) && !EQ (form, Qt)) |
| 4231 | { | 4234 | { |
| 4232 | int count = SPECPDL_INDEX (); | 4235 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4233 | struct gcpro gcpro1; | 4236 | struct gcpro gcpro1; |
| 4234 | 4237 | ||
| 4235 | /* Bind `object' to the object having the `display' property, a | 4238 | /* Bind `object' to the object having the `display' property, a |
| @@ -4271,7 +4274,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4271 | && (EQ (XCAR (it->font_height), Qplus) | 4274 | && (EQ (XCAR (it->font_height), Qplus) |
| 4272 | || EQ (XCAR (it->font_height), Qminus)) | 4275 | || EQ (XCAR (it->font_height), Qminus)) |
| 4273 | && CONSP (XCDR (it->font_height)) | 4276 | && CONSP (XCDR (it->font_height)) |
| 4274 | && INTEGERP (XCAR (XCDR (it->font_height)))) | 4277 | && RANGED_INTEGERP (0, XCAR (XCDR (it->font_height)), INT_MAX)) |
| 4275 | { | 4278 | { |
| 4276 | /* `(+ N)' or `(- N)' where N is an integer. */ | 4279 | /* `(+ N)' or `(- N)' where N is an integer. */ |
| 4277 | int steps = XINT (XCAR (XCDR (it->font_height))); | 4280 | int steps = XINT (XCAR (XCDR (it->font_height))); |
| @@ -4303,7 +4306,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4303 | { | 4306 | { |
| 4304 | /* Evaluate IT->font_height with `height' bound to the | 4307 | /* Evaluate IT->font_height with `height' bound to the |
| 4305 | current specified height to get the new height. */ | 4308 | current specified height to get the new height. */ |
| 4306 | int count = SPECPDL_INDEX (); | 4309 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4307 | 4310 | ||
| 4308 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); | 4311 | specbind (Qheight, face->lface[LFACE_HEIGHT_INDEX]); |
| 4309 | value = safe_eval (it->font_height); | 4312 | value = safe_eval (it->font_height); |
| @@ -4632,7 +4635,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, | |||
| 4632 | 4635 | ||
| 4633 | int | 4636 | int |
| 4634 | display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay, | 4637 | display_prop_intangible_p (Lisp_Object prop, Lisp_Object overlay, |
| 4635 | EMACS_INT charpos, EMACS_INT bytepos) | 4638 | ptrdiff_t charpos, ptrdiff_t bytepos) |
| 4636 | { | 4639 | { |
| 4637 | int frame_window_p = FRAME_WINDOW_P (XFRAME (selected_frame)); | 4640 | int frame_window_p = FRAME_WINDOW_P (XFRAME (selected_frame)); |
| 4638 | struct text_pos position; | 4641 | struct text_pos position; |
| @@ -4734,9 +4737,9 @@ display_prop_string_p (Lisp_Object prop, Lisp_Object string) | |||
| 4734 | This function may only use code that doesn't eval because it is | 4737 | This function may only use code that doesn't eval because it is |
| 4735 | called asynchronously from note_mouse_highlight. */ | 4738 | called asynchronously from note_mouse_highlight. */ |
| 4736 | 4739 | ||
| 4737 | static EMACS_INT | 4740 | static ptrdiff_t |
| 4738 | string_buffer_position_lim (Lisp_Object string, | 4741 | string_buffer_position_lim (Lisp_Object string, |
| 4739 | EMACS_INT from, EMACS_INT to, int back_p) | 4742 | ptrdiff_t from, ptrdiff_t to, int back_p) |
| 4740 | { | 4743 | { |
| 4741 | Lisp_Object limit, prop, pos; | 4744 | Lisp_Object limit, prop, pos; |
| 4742 | int found = 0; | 4745 | int found = 0; |
| @@ -4782,11 +4785,11 @@ string_buffer_position_lim (Lisp_Object string, | |||
| 4782 | This function may only use code that doesn't eval because it is | 4785 | This function may only use code that doesn't eval because it is |
| 4783 | called asynchronously from note_mouse_highlight. */ | 4786 | called asynchronously from note_mouse_highlight. */ |
| 4784 | 4787 | ||
| 4785 | static EMACS_INT | 4788 | static ptrdiff_t |
| 4786 | string_buffer_position (Lisp_Object string, EMACS_INT around_charpos) | 4789 | string_buffer_position (Lisp_Object string, ptrdiff_t around_charpos) |
| 4787 | { | 4790 | { |
| 4788 | const int MAX_DISTANCE = 1000; | 4791 | const int MAX_DISTANCE = 1000; |
| 4789 | EMACS_INT found = string_buffer_position_lim (string, around_charpos, | 4792 | ptrdiff_t found = string_buffer_position_lim (string, around_charpos, |
| 4790 | around_charpos + MAX_DISTANCE, | 4793 | around_charpos + MAX_DISTANCE, |
| 4791 | 0); | 4794 | 0); |
| 4792 | 4795 | ||
| @@ -4809,7 +4812,7 @@ static enum prop_handled | |||
| 4809 | handle_composition_prop (struct it *it) | 4812 | handle_composition_prop (struct it *it) |
| 4810 | { | 4813 | { |
| 4811 | Lisp_Object prop, string; | 4814 | Lisp_Object prop, string; |
| 4812 | EMACS_INT pos, pos_byte, start, end; | 4815 | ptrdiff_t pos, pos_byte, start, end; |
| 4813 | 4816 | ||
| 4814 | if (STRINGP (it->string)) | 4817 | if (STRINGP (it->string)) |
| 4815 | { | 4818 | { |
| @@ -4875,7 +4878,7 @@ struct overlay_entry | |||
| 4875 | { | 4878 | { |
| 4876 | Lisp_Object overlay; | 4879 | Lisp_Object overlay; |
| 4877 | Lisp_Object string; | 4880 | Lisp_Object string; |
| 4878 | int priority; | 4881 | EMACS_INT priority; |
| 4879 | int after_string_p; | 4882 | int after_string_p; |
| 4880 | }; | 4883 | }; |
| 4881 | 4884 | ||
| @@ -5001,12 +5004,17 @@ compare_overlay_entries (const void *e1, const void *e2) | |||
| 5001 | else | 5004 | else |
| 5002 | result = entry1->after_string_p ? -1 : 1; | 5005 | result = entry1->after_string_p ? -1 : 1; |
| 5003 | } | 5006 | } |
| 5004 | else if (entry1->after_string_p) | 5007 | else if (entry1->priority != entry2->priority) |
| 5005 | /* After-strings sorted in order of decreasing priority. */ | 5008 | { |
| 5006 | result = entry2->priority - entry1->priority; | 5009 | if (entry1->after_string_p) |
| 5010 | /* After-strings sorted in order of decreasing priority. */ | ||
| 5011 | result = entry2->priority < entry1->priority ? -1 : 1; | ||
| 5012 | else | ||
| 5013 | /* Before-strings sorted in order of increasing priority. */ | ||
| 5014 | result = entry1->priority < entry2->priority ? -1 : 1; | ||
| 5015 | } | ||
| 5007 | else | 5016 | else |
| 5008 | /* Before-strings sorted in order of increasing priority. */ | 5017 | result = 0; |
| 5009 | result = entry1->priority - entry2->priority; | ||
| 5010 | 5018 | ||
| 5011 | return result; | 5019 | return result; |
| 5012 | } | 5020 | } |
| @@ -5037,15 +5045,17 @@ compare_overlay_entries (const void *e1, const void *e2) | |||
| 5037 | compare_overlay_entries. */ | 5045 | compare_overlay_entries. */ |
| 5038 | 5046 | ||
| 5039 | static void | 5047 | static void |
| 5040 | load_overlay_strings (struct it *it, EMACS_INT charpos) | 5048 | load_overlay_strings (struct it *it, ptrdiff_t charpos) |
| 5041 | { | 5049 | { |
| 5042 | Lisp_Object overlay, window, str, invisible; | 5050 | Lisp_Object overlay, window, str, invisible; |
| 5043 | struct Lisp_Overlay *ov; | 5051 | struct Lisp_Overlay *ov; |
| 5044 | EMACS_INT start, end; | 5052 | ptrdiff_t start, end; |
| 5045 | int size = 20; | 5053 | ptrdiff_t size = 20; |
| 5046 | int n = 0, i, j, invis_p; | 5054 | ptrdiff_t n = 0, i, j; |
| 5055 | int invis_p; | ||
| 5047 | struct overlay_entry *entries | 5056 | struct overlay_entry *entries |
| 5048 | = (struct overlay_entry *) alloca (size * sizeof *entries); | 5057 | = (struct overlay_entry *) alloca (size * sizeof *entries); |
| 5058 | USE_SAFE_ALLOCA; | ||
| 5049 | 5059 | ||
| 5050 | if (charpos <= 0) | 5060 | if (charpos <= 0) |
| 5051 | charpos = IT_CHARPOS (*it); | 5061 | charpos = IT_CHARPOS (*it); |
| @@ -5061,13 +5071,10 @@ load_overlay_strings (struct it *it, EMACS_INT charpos) | |||
| 5061 | \ | 5071 | \ |
| 5062 | if (n == size) \ | 5072 | if (n == size) \ |
| 5063 | { \ | 5073 | { \ |
| 5064 | int new_size = 2 * size; \ | ||
| 5065 | struct overlay_entry *old = entries; \ | 5074 | struct overlay_entry *old = entries; \ |
| 5066 | entries = \ | 5075 | SAFE_NALLOCA (entries, 2, size); \ |
| 5067 | (struct overlay_entry *) alloca (new_size \ | ||
| 5068 | * sizeof *entries); \ | ||
| 5069 | memcpy (entries, old, size * sizeof *entries); \ | 5076 | memcpy (entries, old, size * sizeof *entries); \ |
| 5070 | size = new_size; \ | 5077 | size *= 2; \ |
| 5071 | } \ | 5078 | } \ |
| 5072 | \ | 5079 | \ |
| 5073 | entries[n].string = (STRING); \ | 5080 | entries[n].string = (STRING); \ |
| @@ -5180,6 +5187,7 @@ load_overlay_strings (struct it *it, EMACS_INT charpos) | |||
| 5180 | } | 5187 | } |
| 5181 | 5188 | ||
| 5182 | CHECK_IT (it); | 5189 | CHECK_IT (it); |
| 5190 | SAFE_FREE (); | ||
| 5183 | } | 5191 | } |
| 5184 | 5192 | ||
| 5185 | 5193 | ||
| @@ -5188,7 +5196,7 @@ load_overlay_strings (struct it *it, EMACS_INT charpos) | |||
| 5188 | least one overlay string was found. */ | 5196 | least one overlay string was found. */ |
| 5189 | 5197 | ||
| 5190 | static int | 5198 | static int |
| 5191 | get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p) | 5199 | get_overlay_strings_1 (struct it *it, ptrdiff_t charpos, int compute_stop_p) |
| 5192 | { | 5200 | { |
| 5193 | /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to | 5201 | /* Get the first OVERLAY_STRING_CHUNK_SIZE overlay strings to |
| 5194 | process. This fills IT->overlay_strings with strings, and sets | 5202 | process. This fills IT->overlay_strings with strings, and sets |
| @@ -5245,7 +5253,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p) | |||
| 5245 | /* Set up the bidi iterator for this overlay string. */ | 5253 | /* Set up the bidi iterator for this overlay string. */ |
| 5246 | if (it->bidi_p) | 5254 | if (it->bidi_p) |
| 5247 | { | 5255 | { |
| 5248 | EMACS_INT pos = (charpos > 0 ? charpos : IT_CHARPOS (*it)); | 5256 | ptrdiff_t pos = (charpos > 0 ? charpos : IT_CHARPOS (*it)); |
| 5249 | 5257 | ||
| 5250 | it->bidi_it.string.lstring = it->string; | 5258 | it->bidi_it.string.lstring = it->string; |
| 5251 | it->bidi_it.string.s = NULL; | 5259 | it->bidi_it.string.s = NULL; |
| @@ -5263,7 +5271,7 @@ get_overlay_strings_1 (struct it *it, EMACS_INT charpos, int compute_stop_p) | |||
| 5263 | } | 5271 | } |
| 5264 | 5272 | ||
| 5265 | static int | 5273 | static int |
| 5266 | get_overlay_strings (struct it *it, EMACS_INT charpos) | 5274 | get_overlay_strings (struct it *it, ptrdiff_t charpos) |
| 5267 | { | 5275 | { |
| 5268 | it->string = Qnil; | 5276 | it->string = Qnil; |
| 5269 | it->method = GET_FROM_BUFFER; | 5277 | it->method = GET_FROM_BUFFER; |
| @@ -5343,8 +5351,8 @@ static void | |||
| 5343 | iterate_out_of_display_property (struct it *it) | 5351 | iterate_out_of_display_property (struct it *it) |
| 5344 | { | 5352 | { |
| 5345 | int buffer_p = BUFFERP (it->object); | 5353 | int buffer_p = BUFFERP (it->object); |
| 5346 | EMACS_INT eob = (buffer_p ? ZV : it->end_charpos); | 5354 | ptrdiff_t eob = (buffer_p ? ZV : it->end_charpos); |
| 5347 | EMACS_INT bob = (buffer_p ? BEGV : 0); | 5355 | ptrdiff_t bob = (buffer_p ? BEGV : 0); |
| 5348 | 5356 | ||
| 5349 | xassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob); | 5357 | xassert (eob >= CHARPOS (it->position) && CHARPOS (it->position) >= bob); |
| 5350 | 5358 | ||
| @@ -5504,7 +5512,7 @@ static int | |||
| 5504 | forward_to_next_line_start (struct it *it, int *skipped_p, | 5512 | forward_to_next_line_start (struct it *it, int *skipped_p, |
| 5505 | struct bidi_it *bidi_it_prev) | 5513 | struct bidi_it *bidi_it_prev) |
| 5506 | { | 5514 | { |
| 5507 | EMACS_INT old_selective; | 5515 | ptrdiff_t old_selective; |
| 5508 | int newline_found_p, n; | 5516 | int newline_found_p, n; |
| 5509 | const int MAX_NEWLINE_DISTANCE = 500; | 5517 | const int MAX_NEWLINE_DISTANCE = 500; |
| 5510 | 5518 | ||
| @@ -5546,8 +5554,8 @@ forward_to_next_line_start (struct it *it, int *skipped_p, | |||
| 5546 | short-cut. */ | 5554 | short-cut. */ |
| 5547 | if (!newline_found_p) | 5555 | if (!newline_found_p) |
| 5548 | { | 5556 | { |
| 5549 | EMACS_INT start = IT_CHARPOS (*it); | 5557 | ptrdiff_t start = IT_CHARPOS (*it); |
| 5550 | EMACS_INT limit = find_next_newline_no_quit (start, 1); | 5558 | ptrdiff_t limit = find_next_newline_no_quit (start, 1); |
| 5551 | Lisp_Object pos; | 5559 | Lisp_Object pos; |
| 5552 | 5560 | ||
| 5553 | xassert (!STRINGP (it->string)); | 5561 | xassert (!STRINGP (it->string)); |
| @@ -5645,8 +5653,8 @@ back_to_previous_visible_line_start (struct it *it) | |||
| 5645 | { | 5653 | { |
| 5646 | struct it it2; | 5654 | struct it it2; |
| 5647 | void *it2data = NULL; | 5655 | void *it2data = NULL; |
| 5648 | EMACS_INT pos; | 5656 | ptrdiff_t pos; |
| 5649 | EMACS_INT beg, end; | 5657 | ptrdiff_t beg, end; |
| 5650 | Lisp_Object val, overlay; | 5658 | Lisp_Object val, overlay; |
| 5651 | 5659 | ||
| 5652 | SAVE_IT (it2, *it, it2data); | 5660 | SAVE_IT (it2, *it, it2data); |
| @@ -5799,7 +5807,7 @@ reseat_at_next_visible_line_start (struct it *it, int on_newline_p) | |||
| 5799 | static void | 5807 | static void |
| 5800 | reseat (struct it *it, struct text_pos pos, int force_p) | 5808 | reseat (struct it *it, struct text_pos pos, int force_p) |
| 5801 | { | 5809 | { |
| 5802 | EMACS_INT original_pos = IT_CHARPOS (*it); | 5810 | ptrdiff_t original_pos = IT_CHARPOS (*it); |
| 5803 | 5811 | ||
| 5804 | reseat_1 (it, pos, 0); | 5812 | reseat_1 (it, pos, 0); |
| 5805 | 5813 | ||
| @@ -5907,7 +5915,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) | |||
| 5907 | 5915 | ||
| 5908 | static void | 5916 | static void |
| 5909 | reseat_to_string (struct it *it, const char *s, Lisp_Object string, | 5917 | reseat_to_string (struct it *it, const char *s, Lisp_Object string, |
| 5910 | EMACS_INT charpos, EMACS_INT precision, int field_width, | 5918 | ptrdiff_t charpos, ptrdiff_t precision, int field_width, |
| 5911 | int multibyte) | 5919 | int multibyte) |
| 5912 | { | 5920 | { |
| 5913 | /* No region in strings. */ | 5921 | /* No region in strings. */ |
| @@ -6021,7 +6029,7 @@ reseat_to_string (struct it *it, const char *s, Lisp_Object string, | |||
| 6021 | } | 6029 | } |
| 6022 | if (s == NULL && it->multibyte_p) | 6030 | if (s == NULL && it->multibyte_p) |
| 6023 | { | 6031 | { |
| 6024 | EMACS_INT endpos = SCHARS (it->string); | 6032 | ptrdiff_t endpos = SCHARS (it->string); |
| 6025 | if (endpos > it->end_charpos) | 6033 | if (endpos > it->end_charpos) |
| 6026 | endpos = it->end_charpos; | 6034 | endpos = it->end_charpos; |
| 6027 | composition_compute_stop_pos (&it->cmp_it, charpos, -1, endpos, | 6035 | composition_compute_stop_pos (&it->cmp_it, charpos, -1, endpos, |
| @@ -6129,11 +6137,11 @@ lookup_glyphless_char_display (int c, struct it *it) | |||
| 6129 | end of buffer (or C string) is reached. */ | 6137 | end of buffer (or C string) is reached. */ |
| 6130 | 6138 | ||
| 6131 | static struct frame *last_escape_glyph_frame = NULL; | 6139 | static struct frame *last_escape_glyph_frame = NULL; |
| 6132 | static unsigned last_escape_glyph_face_id = (1 << FACE_ID_BITS); | 6140 | static int last_escape_glyph_face_id = (1 << FACE_ID_BITS); |
| 6133 | static int last_escape_glyph_merged_face_id = 0; | 6141 | static int last_escape_glyph_merged_face_id = 0; |
| 6134 | 6142 | ||
| 6135 | struct frame *last_glyphless_glyph_frame = NULL; | 6143 | struct frame *last_glyphless_glyph_frame = NULL; |
| 6136 | unsigned last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); | 6144 | int last_glyphless_glyph_face_id = (1 << FACE_ID_BITS); |
| 6137 | int last_glyphless_glyph_merged_face_id = 0; | 6145 | int last_glyphless_glyph_merged_face_id = 0; |
| 6138 | 6146 | ||
| 6139 | static int | 6147 | static int |
| @@ -6258,7 +6266,7 @@ get_next_display_element (struct it *it) | |||
| 6258 | Lisp_Object gc; | 6266 | Lisp_Object gc; |
| 6259 | int ctl_len; | 6267 | int ctl_len; |
| 6260 | int face_id; | 6268 | int face_id; |
| 6261 | EMACS_INT lface_id = 0; | 6269 | int lface_id = 0; |
| 6262 | int escape_glyph; | 6270 | int escape_glyph; |
| 6263 | 6271 | ||
| 6264 | /* Handle control characters with ^. */ | 6272 | /* Handle control characters with ^. */ |
| @@ -6270,8 +6278,7 @@ get_next_display_element (struct it *it) | |||
| 6270 | g = '^'; /* default glyph for Control */ | 6278 | g = '^'; /* default glyph for Control */ |
| 6271 | /* Set IT->ctl_chars[0] to the glyph for `^'. */ | 6279 | /* Set IT->ctl_chars[0] to the glyph for `^'. */ |
| 6272 | if (it->dp | 6280 | if (it->dp |
| 6273 | && (gc = DISP_CTRL_GLYPH (it->dp), GLYPH_CODE_P (gc)) | 6281 | && (gc = DISP_CTRL_GLYPH (it->dp), GLYPH_CODE_P (gc))) |
| 6274 | && GLYPH_CODE_CHAR_VALID_P (gc)) | ||
| 6275 | { | 6282 | { |
| 6276 | g = GLYPH_CODE_CHAR (gc); | 6283 | g = GLYPH_CODE_CHAR (gc); |
| 6277 | lface_id = GLYPH_CODE_FACE (gc); | 6284 | lface_id = GLYPH_CODE_FACE (gc); |
| @@ -6323,8 +6330,7 @@ get_next_display_element (struct it *it) | |||
| 6323 | escape_glyph = '\\'; | 6330 | escape_glyph = '\\'; |
| 6324 | 6331 | ||
| 6325 | if (it->dp | 6332 | if (it->dp |
| 6326 | && (gc = DISP_ESCAPE_GLYPH (it->dp), GLYPH_CODE_P (gc)) | 6333 | && (gc = DISP_ESCAPE_GLYPH (it->dp), GLYPH_CODE_P (gc))) |
| 6327 | && GLYPH_CODE_CHAR_VALID_P (gc)) | ||
| 6328 | { | 6334 | { |
| 6329 | escape_glyph = GLYPH_CODE_CHAR (gc); | 6335 | escape_glyph = GLYPH_CODE_CHAR (gc); |
| 6330 | lface_id = GLYPH_CODE_FACE (gc); | 6336 | lface_id = GLYPH_CODE_FACE (gc); |
| @@ -6427,7 +6433,7 @@ get_next_display_element (struct it *it) | |||
| 6427 | } | 6433 | } |
| 6428 | else | 6434 | else |
| 6429 | { | 6435 | { |
| 6430 | EMACS_INT pos = (it->s ? -1 | 6436 | ptrdiff_t pos = (it->s ? -1 |
| 6431 | : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) | 6437 | : STRINGP (it->string) ? IT_STRING_CHARPOS (*it) |
| 6432 | : IT_CHARPOS (*it)); | 6438 | : IT_CHARPOS (*it)); |
| 6433 | int c; | 6439 | int c; |
| @@ -6479,7 +6485,7 @@ get_next_display_element (struct it *it) | |||
| 6479 | && (it->current.overlay_string_index | 6485 | && (it->current.overlay_string_index |
| 6480 | == it->n_overlay_strings - 1)) | 6486 | == it->n_overlay_strings - 1)) |
| 6481 | { | 6487 | { |
| 6482 | EMACS_INT ignore; | 6488 | ptrdiff_t ignore; |
| 6483 | int next_face_id; | 6489 | int next_face_id; |
| 6484 | struct text_pos pos = it->current.pos; | 6490 | struct text_pos pos = it->current.pos; |
| 6485 | INC_TEXT_POS (pos, it->multibyte_p); | 6491 | INC_TEXT_POS (pos, it->multibyte_p); |
| @@ -6581,7 +6587,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6581 | { | 6587 | { |
| 6582 | /* No more grapheme clusters in this composition. | 6588 | /* No more grapheme clusters in this composition. |
| 6583 | Find the next stop position. */ | 6589 | Find the next stop position. */ |
| 6584 | EMACS_INT stop = it->end_charpos; | 6590 | ptrdiff_t stop = it->end_charpos; |
| 6585 | if (it->bidi_it.scan_dir < 0) | 6591 | if (it->bidi_it.scan_dir < 0) |
| 6586 | /* Now we are scanning backward and don't know | 6592 | /* Now we are scanning backward and don't know |
| 6587 | where to stop. */ | 6593 | where to stop. */ |
| @@ -6609,7 +6615,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6609 | { | 6615 | { |
| 6610 | /* No more grapheme clusters in this composition. | 6616 | /* No more grapheme clusters in this composition. |
| 6611 | Find the next stop position. */ | 6617 | Find the next stop position. */ |
| 6612 | EMACS_INT stop = it->end_charpos; | 6618 | ptrdiff_t stop = it->end_charpos; |
| 6613 | if (it->bidi_it.scan_dir < 0) | 6619 | if (it->bidi_it.scan_dir < 0) |
| 6614 | /* Now we are scanning backward and don't know | 6620 | /* Now we are scanning backward and don't know |
| 6615 | where to stop. */ | 6621 | where to stop. */ |
| @@ -6642,7 +6648,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6642 | { | 6648 | { |
| 6643 | /* As the scan direction was changed, we must | 6649 | /* As the scan direction was changed, we must |
| 6644 | re-compute the stop position for composition. */ | 6650 | re-compute the stop position for composition. */ |
| 6645 | EMACS_INT stop = it->end_charpos; | 6651 | ptrdiff_t stop = it->end_charpos; |
| 6646 | if (it->bidi_it.scan_dir < 0) | 6652 | if (it->bidi_it.scan_dir < 0) |
| 6647 | stop = -1; | 6653 | stop = -1; |
| 6648 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), | 6654 | composition_compute_stop_pos (&it->cmp_it, IT_CHARPOS (*it), |
| @@ -6752,7 +6758,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6752 | it->cmp_it.from = it->cmp_it.to; | 6758 | it->cmp_it.from = it->cmp_it.to; |
| 6753 | else | 6759 | else |
| 6754 | { | 6760 | { |
| 6755 | EMACS_INT stop = it->end_charpos; | 6761 | ptrdiff_t stop = it->end_charpos; |
| 6756 | if (it->bidi_it.scan_dir < 0) | 6762 | if (it->bidi_it.scan_dir < 0) |
| 6757 | stop = -1; | 6763 | stop = -1; |
| 6758 | composition_compute_stop_pos (&it->cmp_it, | 6764 | composition_compute_stop_pos (&it->cmp_it, |
| @@ -6771,7 +6777,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6771 | it->cmp_it.to = it->cmp_it.from; | 6777 | it->cmp_it.to = it->cmp_it.from; |
| 6772 | else | 6778 | else |
| 6773 | { | 6779 | { |
| 6774 | EMACS_INT stop = it->end_charpos; | 6780 | ptrdiff_t stop = it->end_charpos; |
| 6775 | if (it->bidi_it.scan_dir < 0) | 6781 | if (it->bidi_it.scan_dir < 0) |
| 6776 | stop = -1; | 6782 | stop = -1; |
| 6777 | composition_compute_stop_pos (&it->cmp_it, | 6783 | composition_compute_stop_pos (&it->cmp_it, |
| @@ -6803,7 +6809,7 @@ set_iterator_to_next (struct it *it, int reseat_p) | |||
| 6803 | IT_STRING_CHARPOS (*it) = it->bidi_it.charpos; | 6809 | IT_STRING_CHARPOS (*it) = it->bidi_it.charpos; |
| 6804 | if (prev_scan_dir != it->bidi_it.scan_dir) | 6810 | if (prev_scan_dir != it->bidi_it.scan_dir) |
| 6805 | { | 6811 | { |
| 6806 | EMACS_INT stop = it->end_charpos; | 6812 | ptrdiff_t stop = it->end_charpos; |
| 6807 | 6813 | ||
| 6808 | if (it->bidi_it.scan_dir < 0) | 6814 | if (it->bidi_it.scan_dir < 0) |
| 6809 | stop = -1; | 6815 | stop = -1; |
| @@ -6889,7 +6895,7 @@ next_element_from_display_vector (struct it *it) | |||
| 6889 | That seemed totally bogus - so I changed it... */ | 6895 | That seemed totally bogus - so I changed it... */ |
| 6890 | gc = it->dpvec[it->current.dpvec_index]; | 6896 | gc = it->dpvec[it->current.dpvec_index]; |
| 6891 | 6897 | ||
| 6892 | if (GLYPH_CODE_P (gc) && GLYPH_CODE_CHAR_VALID_P (gc)) | 6898 | if (GLYPH_CODE_P (gc)) |
| 6893 | { | 6899 | { |
| 6894 | it->c = GLYPH_CODE_CHAR (gc); | 6900 | it->c = GLYPH_CODE_CHAR (gc); |
| 6895 | it->len = CHAR_BYTES (it->c); | 6901 | it->len = CHAR_BYTES (it->c); |
| @@ -6901,7 +6907,7 @@ next_element_from_display_vector (struct it *it) | |||
| 6901 | it->face_id = it->dpvec_face_id; | 6907 | it->face_id = it->dpvec_face_id; |
| 6902 | else | 6908 | else |
| 6903 | { | 6909 | { |
| 6904 | EMACS_INT lface_id = GLYPH_CODE_FACE (gc); | 6910 | int lface_id = GLYPH_CODE_FACE (gc); |
| 6905 | if (lface_id > 0) | 6911 | if (lface_id > 0) |
| 6906 | it->face_id = merge_faces (it->f, Qt, lface_id, | 6912 | it->face_id = merge_faces (it->f, Qt, lface_id, |
| 6907 | it->saved_face_id); | 6913 | it->saved_face_id); |
| @@ -6924,8 +6930,8 @@ static void | |||
| 6924 | get_visually_first_element (struct it *it) | 6930 | get_visually_first_element (struct it *it) |
| 6925 | { | 6931 | { |
| 6926 | int string_p = STRINGP (it->string) || it->s; | 6932 | int string_p = STRINGP (it->string) || it->s; |
| 6927 | EMACS_INT eob = (string_p ? it->bidi_it.string.schars : ZV); | 6933 | ptrdiff_t eob = (string_p ? it->bidi_it.string.schars : ZV); |
| 6928 | EMACS_INT bob = (string_p ? 0 : BEGV); | 6934 | ptrdiff_t bob = (string_p ? 0 : BEGV); |
| 6929 | 6935 | ||
| 6930 | if (STRINGP (it->string)) | 6936 | if (STRINGP (it->string)) |
| 6931 | { | 6937 | { |
| @@ -6958,7 +6964,7 @@ get_visually_first_element (struct it *it) | |||
| 6958 | } | 6964 | } |
| 6959 | else | 6965 | else |
| 6960 | { | 6966 | { |
| 6961 | EMACS_INT orig_bytepos = it->bidi_it.bytepos; | 6967 | ptrdiff_t orig_bytepos = it->bidi_it.bytepos; |
| 6962 | 6968 | ||
| 6963 | /* We need to prime the bidi iterator starting at the line's or | 6969 | /* We need to prime the bidi iterator starting at the line's or |
| 6964 | string's beginning, before we will be able to produce the | 6970 | string's beginning, before we will be able to produce the |
| @@ -6996,7 +7002,7 @@ get_visually_first_element (struct it *it) | |||
| 6996 | 7002 | ||
| 6997 | if (STRINGP (it->string) || !it->s) | 7003 | if (STRINGP (it->string) || !it->s) |
| 6998 | { | 7004 | { |
| 6999 | EMACS_INT stop, charpos, bytepos; | 7005 | ptrdiff_t stop, charpos, bytepos; |
| 7000 | 7006 | ||
| 7001 | if (STRINGP (it->string)) | 7007 | if (STRINGP (it->string)) |
| 7002 | { | 7008 | { |
| @@ -7297,10 +7303,10 @@ compute_stop_pos_backwards (struct it *it) | |||
| 7297 | struct text_pos pos; | 7303 | struct text_pos pos; |
| 7298 | struct display_pos save_current = it->current; | 7304 | struct display_pos save_current = it->current; |
| 7299 | struct text_pos save_position = it->position; | 7305 | struct text_pos save_position = it->position; |
| 7300 | EMACS_INT charpos = IT_CHARPOS (*it); | 7306 | ptrdiff_t charpos = IT_CHARPOS (*it); |
| 7301 | EMACS_INT where_we_are = charpos; | 7307 | ptrdiff_t where_we_are = charpos; |
| 7302 | EMACS_INT save_stop_pos = it->stop_charpos; | 7308 | ptrdiff_t save_stop_pos = it->stop_charpos; |
| 7303 | EMACS_INT save_end_pos = it->end_charpos; | 7309 | ptrdiff_t save_end_pos = it->end_charpos; |
| 7304 | 7310 | ||
| 7305 | xassert (NILP (it->string) && !it->s); | 7311 | xassert (NILP (it->string) && !it->s); |
| 7306 | xassert (it->bidi_p); | 7312 | xassert (it->bidi_p); |
| @@ -7338,14 +7344,14 @@ compute_stop_pos_backwards (struct it *it) | |||
| 7338 | position. */ | 7344 | position. */ |
| 7339 | 7345 | ||
| 7340 | static void | 7346 | static void |
| 7341 | handle_stop_backwards (struct it *it, EMACS_INT charpos) | 7347 | handle_stop_backwards (struct it *it, ptrdiff_t charpos) |
| 7342 | { | 7348 | { |
| 7343 | int bufp = !STRINGP (it->string); | 7349 | int bufp = !STRINGP (it->string); |
| 7344 | EMACS_INT where_we_are = (bufp ? IT_CHARPOS (*it) : IT_STRING_CHARPOS (*it)); | 7350 | ptrdiff_t where_we_are = (bufp ? IT_CHARPOS (*it) : IT_STRING_CHARPOS (*it)); |
| 7345 | struct display_pos save_current = it->current; | 7351 | struct display_pos save_current = it->current; |
| 7346 | struct text_pos save_position = it->position; | 7352 | struct text_pos save_position = it->position; |
| 7347 | struct text_pos pos1; | 7353 | struct text_pos pos1; |
| 7348 | EMACS_INT next_stop; | 7354 | ptrdiff_t next_stop; |
| 7349 | 7355 | ||
| 7350 | /* Scan in strict logical order. */ | 7356 | /* Scan in strict logical order. */ |
| 7351 | xassert (it->bidi_p); | 7357 | xassert (it->bidi_p); |
| @@ -7489,7 +7495,7 @@ next_element_from_buffer (struct it *it) | |||
| 7489 | /* No face changes, overlays etc. in sight, so just return a | 7495 | /* No face changes, overlays etc. in sight, so just return a |
| 7490 | character from current_buffer. */ | 7496 | character from current_buffer. */ |
| 7491 | unsigned char *p; | 7497 | unsigned char *p; |
| 7492 | EMACS_INT stop; | 7498 | ptrdiff_t stop; |
| 7493 | 7499 | ||
| 7494 | /* Maybe run the redisplay end trigger hook. Performance note: | 7500 | /* Maybe run the redisplay end trigger hook. Performance note: |
| 7495 | This doesn't seem to cost measurable time. */ | 7501 | This doesn't seem to cost measurable time. */ |
| @@ -7678,7 +7684,7 @@ next_element_from_composition (struct it *it) | |||
| 7678 | 7684 | ||
| 7679 | static enum move_it_result | 7685 | static enum move_it_result |
| 7680 | move_it_in_display_line_to (struct it *it, | 7686 | move_it_in_display_line_to (struct it *it, |
| 7681 | EMACS_INT to_charpos, int to_x, | 7687 | ptrdiff_t to_charpos, int to_x, |
| 7682 | enum move_operation_enum op) | 7688 | enum move_operation_enum op) |
| 7683 | { | 7689 | { |
| 7684 | enum move_it_result result = MOVE_UNDEFINED; | 7690 | enum move_it_result result = MOVE_UNDEFINED; |
| @@ -7688,7 +7694,7 @@ move_it_in_display_line_to (struct it *it, | |||
| 7688 | void *ppos_data = NULL; | 7694 | void *ppos_data = NULL; |
| 7689 | int may_wrap = 0; | 7695 | int may_wrap = 0; |
| 7690 | enum it_method prev_method = it->method; | 7696 | enum it_method prev_method = it->method; |
| 7691 | EMACS_INT prev_pos = IT_CHARPOS (*it); | 7697 | ptrdiff_t prev_pos = IT_CHARPOS (*it); |
| 7692 | int saw_smaller_pos = prev_pos < to_charpos; | 7698 | int saw_smaller_pos = prev_pos < to_charpos; |
| 7693 | 7699 | ||
| 7694 | /* Don't produce glyphs in produce_glyphs. */ | 7700 | /* Don't produce glyphs in produce_glyphs. */ |
| @@ -8174,7 +8180,7 @@ move_it_in_display_line_to (struct it *it, | |||
| 8174 | /* For external use. */ | 8180 | /* For external use. */ |
| 8175 | void | 8181 | void |
| 8176 | move_it_in_display_line (struct it *it, | 8182 | move_it_in_display_line (struct it *it, |
| 8177 | EMACS_INT to_charpos, int to_x, | 8183 | ptrdiff_t to_charpos, int to_x, |
| 8178 | enum move_operation_enum op) | 8184 | enum move_operation_enum op) |
| 8179 | { | 8185 | { |
| 8180 | if (it->line_wrap == WORD_WRAP | 8186 | if (it->line_wrap == WORD_WRAP |
| @@ -8217,7 +8223,7 @@ move_it_in_display_line (struct it *it, | |||
| 8217 | displayed to the right of TO_CHARPOS on the screen. */ | 8223 | displayed to the right of TO_CHARPOS on the screen. */ |
| 8218 | 8224 | ||
| 8219 | void | 8225 | void |
| 8220 | move_it_to (struct it *it, EMACS_INT to_charpos, int to_x, int to_y, int to_vpos, int op) | 8226 | move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos, int op) |
| 8221 | { | 8227 | { |
| 8222 | enum move_it_result skip, skip2 = MOVE_X_REACHED; | 8228 | enum move_it_result skip, skip2 = MOVE_X_REACHED; |
| 8223 | int line_height, line_start_x = 0, reached = 0; | 8229 | int line_height, line_start_x = 0, reached = 0; |
| @@ -8484,7 +8490,7 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8484 | int nlines, h; | 8490 | int nlines, h; |
| 8485 | struct it it2, it3; | 8491 | struct it it2, it3; |
| 8486 | void *it2data = NULL, *it3data = NULL; | 8492 | void *it2data = NULL, *it3data = NULL; |
| 8487 | EMACS_INT start_pos; | 8493 | ptrdiff_t start_pos; |
| 8488 | 8494 | ||
| 8489 | move_further_back: | 8495 | move_further_back: |
| 8490 | xassert (dy >= 0); | 8496 | xassert (dy >= 0); |
| @@ -8554,7 +8560,7 @@ move_it_vertically_backward (struct it *it, int dy) | |||
| 8554 | if (it->bidi_p && IT_CHARPOS (*it) > BEGV | 8560 | if (it->bidi_p && IT_CHARPOS (*it) > BEGV |
| 8555 | && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') | 8561 | && FETCH_BYTE (IT_BYTEPOS (*it) - 1) != '\n') |
| 8556 | { | 8562 | { |
| 8557 | EMACS_INT nl_pos = | 8563 | ptrdiff_t nl_pos = |
| 8558 | find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1); | 8564 | find_next_newline_no_quit (IT_CHARPOS (*it) - 1, -1); |
| 8559 | 8565 | ||
| 8560 | move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS); | 8566 | move_it_to (it, nl_pos, -1, -1, -1, MOVE_TO_POS); |
| @@ -8664,7 +8670,7 @@ move_it_past_eol (struct it *it) | |||
| 8664 | truncate-lines nil. */ | 8670 | truncate-lines nil. */ |
| 8665 | 8671 | ||
| 8666 | void | 8672 | void |
| 8667 | move_it_by_lines (struct it *it, int dvpos) | 8673 | move_it_by_lines (struct it *it, ptrdiff_t dvpos) |
| 8668 | { | 8674 | { |
| 8669 | 8675 | ||
| 8670 | /* The commented-out optimization uses vmotion on terminals. This | 8676 | /* The commented-out optimization uses vmotion on terminals. This |
| @@ -8701,7 +8707,7 @@ move_it_by_lines (struct it *it, int dvpos) | |||
| 8701 | { | 8707 | { |
| 8702 | struct it it2; | 8708 | struct it it2; |
| 8703 | void *it2data = NULL; | 8709 | void *it2data = NULL; |
| 8704 | EMACS_INT start_charpos, i; | 8710 | ptrdiff_t start_charpos, i; |
| 8705 | 8711 | ||
| 8706 | /* Start at the beginning of the screen line containing IT's | 8712 | /* Start at the beginning of the screen line containing IT's |
| 8707 | position. This may actually move vertically backwards, | 8713 | position. This may actually move vertically backwards, |
| @@ -8787,7 +8793,7 @@ add_to_log (const char *format, Lisp_Object arg1, Lisp_Object arg2) | |||
| 8787 | Lisp_Object args[3]; | 8793 | Lisp_Object args[3]; |
| 8788 | Lisp_Object msg, fmt; | 8794 | Lisp_Object msg, fmt; |
| 8789 | char *buffer; | 8795 | char *buffer; |
| 8790 | EMACS_INT len; | 8796 | ptrdiff_t len; |
| 8791 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 8797 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 8792 | USE_SAFE_ALLOCA; | 8798 | USE_SAFE_ALLOCA; |
| 8793 | 8799 | ||
| @@ -8836,7 +8842,7 @@ message_log_maybe_newline (void) | |||
| 8836 | so the buffer M must NOT point to a Lisp string. */ | 8842 | so the buffer M must NOT point to a Lisp string. */ |
| 8837 | 8843 | ||
| 8838 | void | 8844 | void |
| 8839 | message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | 8845 | message_dolog (const char *m, ptrdiff_t nbytes, int nlflag, int multibyte) |
| 8840 | { | 8846 | { |
| 8841 | const unsigned char *msg = (const unsigned char *) m; | 8847 | const unsigned char *msg = (const unsigned char *) m; |
| 8842 | 8848 | ||
| @@ -8848,8 +8854,8 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8848 | struct buffer *oldbuf; | 8854 | struct buffer *oldbuf; |
| 8849 | Lisp_Object oldpoint, oldbegv, oldzv; | 8855 | Lisp_Object oldpoint, oldbegv, oldzv; |
| 8850 | int old_windows_or_buffers_changed = windows_or_buffers_changed; | 8856 | int old_windows_or_buffers_changed = windows_or_buffers_changed; |
| 8851 | EMACS_INT point_at_end = 0; | 8857 | ptrdiff_t point_at_end = 0; |
| 8852 | EMACS_INT zv_at_end = 0; | 8858 | ptrdiff_t zv_at_end = 0; |
| 8853 | Lisp_Object old_deactivate_mark, tem; | 8859 | Lisp_Object old_deactivate_mark, tem; |
| 8854 | struct gcpro gcpro1; | 8860 | struct gcpro gcpro1; |
| 8855 | 8861 | ||
| @@ -8882,7 +8888,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8882 | if (multibyte | 8888 | if (multibyte |
| 8883 | && NILP (BVAR (current_buffer, enable_multibyte_characters))) | 8889 | && NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 8884 | { | 8890 | { |
| 8885 | EMACS_INT i; | 8891 | ptrdiff_t i; |
| 8886 | int c, char_bytes; | 8892 | int c, char_bytes; |
| 8887 | char work[1]; | 8893 | char work[1]; |
| 8888 | 8894 | ||
| @@ -8900,7 +8906,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8900 | else if (! multibyte | 8906 | else if (! multibyte |
| 8901 | && ! NILP (BVAR (current_buffer, enable_multibyte_characters))) | 8907 | && ! NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 8902 | { | 8908 | { |
| 8903 | EMACS_INT i; | 8909 | ptrdiff_t i; |
| 8904 | int c, char_bytes; | 8910 | int c, char_bytes; |
| 8905 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | 8911 | unsigned char str[MAX_MULTIBYTE_LENGTH]; |
| 8906 | /* Convert a single-byte string to multibyte | 8912 | /* Convert a single-byte string to multibyte |
| @@ -8918,7 +8924,7 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 8918 | 8924 | ||
| 8919 | if (nlflag) | 8925 | if (nlflag) |
| 8920 | { | 8926 | { |
| 8921 | EMACS_INT this_bol, this_bol_byte, prev_bol, prev_bol_byte; | 8927 | ptrdiff_t this_bol, this_bol_byte, prev_bol, prev_bol_byte; |
| 8922 | printmax_t dups; | 8928 | printmax_t dups; |
| 8923 | insert_1 ("\n", 1, 1, 0, 0); | 8929 | insert_1 ("\n", 1, 1, 0, 0); |
| 8924 | 8930 | ||
| @@ -9011,10 +9017,10 @@ message_dolog (const char *m, EMACS_INT nbytes, int nlflag, int multibyte) | |||
| 9011 | value N > 1 if we should also append " [N times]". */ | 9017 | value N > 1 if we should also append " [N times]". */ |
| 9012 | 9018 | ||
| 9013 | static intmax_t | 9019 | static intmax_t |
| 9014 | message_log_check_duplicate (EMACS_INT prev_bol_byte, EMACS_INT this_bol_byte) | 9020 | message_log_check_duplicate (ptrdiff_t prev_bol_byte, ptrdiff_t this_bol_byte) |
| 9015 | { | 9021 | { |
| 9016 | EMACS_INT i; | 9022 | ptrdiff_t i; |
| 9017 | EMACS_INT len = Z_BYTE - 1 - this_bol_byte; | 9023 | ptrdiff_t len = Z_BYTE - 1 - this_bol_byte; |
| 9018 | int seen_dots = 0; | 9024 | int seen_dots = 0; |
| 9019 | unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte); | 9025 | unsigned char *p1 = BUF_BYTE_ADDRESS (current_buffer, prev_bol_byte); |
| 9020 | unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte); | 9026 | unsigned char *p2 = BUF_BYTE_ADDRESS (current_buffer, this_bol_byte); |
| @@ -9048,7 +9054,7 @@ message_log_check_duplicate (EMACS_INT prev_bol_byte, EMACS_INT this_bol_byte) | |||
| 9048 | This may GC, so the buffer M must NOT point to a Lisp string. */ | 9054 | This may GC, so the buffer M must NOT point to a Lisp string. */ |
| 9049 | 9055 | ||
| 9050 | void | 9056 | void |
| 9051 | message2 (const char *m, EMACS_INT nbytes, int multibyte) | 9057 | message2 (const char *m, ptrdiff_t nbytes, int multibyte) |
| 9052 | { | 9058 | { |
| 9053 | /* First flush out any partial line written with print. */ | 9059 | /* First flush out any partial line written with print. */ |
| 9054 | message_log_maybe_newline (); | 9060 | message_log_maybe_newline (); |
| @@ -9061,7 +9067,7 @@ message2 (const char *m, EMACS_INT nbytes, int multibyte) | |||
| 9061 | /* The non-logging counterpart of message2. */ | 9067 | /* The non-logging counterpart of message2. */ |
| 9062 | 9068 | ||
| 9063 | void | 9069 | void |
| 9064 | message2_nolog (const char *m, EMACS_INT nbytes, int multibyte) | 9070 | message2_nolog (const char *m, ptrdiff_t nbytes, int multibyte) |
| 9065 | { | 9071 | { |
| 9066 | struct frame *sf = SELECTED_FRAME (); | 9072 | struct frame *sf = SELECTED_FRAME (); |
| 9067 | message_enable_multibyte = multibyte; | 9073 | message_enable_multibyte = multibyte; |
| @@ -9123,7 +9129,7 @@ message2_nolog (const char *m, EMACS_INT nbytes, int multibyte) | |||
| 9123 | This function cancels echoing. */ | 9129 | This function cancels echoing. */ |
| 9124 | 9130 | ||
| 9125 | void | 9131 | void |
| 9126 | message3 (Lisp_Object m, EMACS_INT nbytes, int multibyte) | 9132 | message3 (Lisp_Object m, ptrdiff_t nbytes, int multibyte) |
| 9127 | { | 9133 | { |
| 9128 | struct gcpro gcpro1; | 9134 | struct gcpro gcpro1; |
| 9129 | 9135 | ||
| @@ -9155,7 +9161,7 @@ message3 (Lisp_Object m, EMACS_INT nbytes, int multibyte) | |||
| 9155 | and make this cancel echoing. */ | 9161 | and make this cancel echoing. */ |
| 9156 | 9162 | ||
| 9157 | void | 9163 | void |
| 9158 | message3_nolog (Lisp_Object m, EMACS_INT nbytes, int multibyte) | 9164 | message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) |
| 9159 | { | 9165 | { |
| 9160 | struct frame *sf = SELECTED_FRAME (); | 9166 | struct frame *sf = SELECTED_FRAME (); |
| 9161 | message_enable_multibyte = multibyte; | 9167 | message_enable_multibyte = multibyte; |
| @@ -9452,12 +9458,12 @@ ensure_echo_area_buffers (void) | |||
| 9452 | 9458 | ||
| 9453 | static int | 9459 | static int |
| 9454 | with_echo_area_buffer (struct window *w, int which, | 9460 | with_echo_area_buffer (struct window *w, int which, |
| 9455 | int (*fn) (EMACS_INT, Lisp_Object, EMACS_INT, EMACS_INT), | 9461 | int (*fn) (ptrdiff_t, Lisp_Object, ptrdiff_t, ptrdiff_t), |
| 9456 | EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) | 9462 | ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) |
| 9457 | { | 9463 | { |
| 9458 | Lisp_Object buffer; | 9464 | Lisp_Object buffer; |
| 9459 | int this_one, the_other, clear_buffer_p, rc; | 9465 | int this_one, the_other, clear_buffer_p, rc; |
| 9460 | int count = SPECPDL_INDEX (); | 9466 | ptrdiff_t count = SPECPDL_INDEX (); |
| 9461 | 9467 | ||
| 9462 | /* If buffers aren't live, make new ones. */ | 9468 | /* If buffers aren't live, make new ones. */ |
| 9463 | ensure_echo_area_buffers (); | 9469 | ensure_echo_area_buffers (); |
| @@ -9633,7 +9639,7 @@ setup_echo_area_for_printing (int multibyte_p) | |||
| 9633 | 9639 | ||
| 9634 | if (Z > BEG) | 9640 | if (Z > BEG) |
| 9635 | { | 9641 | { |
| 9636 | int count = SPECPDL_INDEX (); | 9642 | ptrdiff_t count = SPECPDL_INDEX (); |
| 9637 | specbind (Qinhibit_read_only, Qt); | 9643 | specbind (Qinhibit_read_only, Qt); |
| 9638 | /* Note that undo recording is always disabled. */ | 9644 | /* Note that undo recording is always disabled. */ |
| 9639 | del_range (BEG, Z); | 9645 | del_range (BEG, Z); |
| @@ -9686,14 +9692,14 @@ setup_echo_area_for_printing (int multibyte_p) | |||
| 9686 | static int | 9692 | static int |
| 9687 | display_echo_area (struct window *w) | 9693 | display_echo_area (struct window *w) |
| 9688 | { | 9694 | { |
| 9689 | int i, no_message_p, window_height_changed_p, count; | 9695 | int i, no_message_p, window_height_changed_p; |
| 9690 | 9696 | ||
| 9691 | /* Temporarily disable garbage collections while displaying the echo | 9697 | /* Temporarily disable garbage collections while displaying the echo |
| 9692 | area. This is done because a GC can print a message itself. | 9698 | area. This is done because a GC can print a message itself. |
| 9693 | That message would modify the echo area buffer's contents while a | 9699 | That message would modify the echo area buffer's contents while a |
| 9694 | redisplay of the buffer is going on, and seriously confuse | 9700 | redisplay of the buffer is going on, and seriously confuse |
| 9695 | redisplay. */ | 9701 | redisplay. */ |
| 9696 | count = inhibit_garbage_collection (); | 9702 | ptrdiff_t count = inhibit_garbage_collection (); |
| 9697 | 9703 | ||
| 9698 | /* If there is no message, we must call display_echo_area_1 | 9704 | /* If there is no message, we must call display_echo_area_1 |
| 9699 | nevertheless because it resizes the window. But we will have to | 9705 | nevertheless because it resizes the window. But we will have to |
| @@ -9722,7 +9728,7 @@ display_echo_area (struct window *w) | |||
| 9722 | Value is non-zero if height of W was changed. */ | 9728 | Value is non-zero if height of W was changed. */ |
| 9723 | 9729 | ||
| 9724 | static int | 9730 | static int |
| 9725 | display_echo_area_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) | 9731 | display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) |
| 9726 | { | 9732 | { |
| 9727 | intptr_t i1 = a1; | 9733 | intptr_t i1 = a1; |
| 9728 | struct window *w = (struct window *) i1; | 9734 | struct window *w = (struct window *) i1; |
| @@ -9786,7 +9792,7 @@ resize_echo_area_exactly (void) | |||
| 9786 | resize_mini_window returns. */ | 9792 | resize_mini_window returns. */ |
| 9787 | 9793 | ||
| 9788 | static int | 9794 | static int |
| 9789 | resize_mini_window_1 (EMACS_INT a1, Lisp_Object exactly, EMACS_INT a3, EMACS_INT a4) | 9795 | resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t a4) |
| 9790 | { | 9796 | { |
| 9791 | intptr_t i1 = a1; | 9797 | intptr_t i1 = a1; |
| 9792 | return resize_mini_window ((struct window *) i1, !NILP (exactly)); | 9798 | return resize_mini_window ((struct window *) i1, !NILP (exactly)); |
| @@ -9836,7 +9842,8 @@ resize_mini_window (struct window *w, int exact_p) | |||
| 9836 | struct it it; | 9842 | struct it it; |
| 9837 | struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); | 9843 | struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 9838 | int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w); | 9844 | int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w); |
| 9839 | int height, max_height; | 9845 | int height; |
| 9846 | EMACS_INT max_height; | ||
| 9840 | int unit = FRAME_LINE_HEIGHT (f); | 9847 | int unit = FRAME_LINE_HEIGHT (f); |
| 9841 | struct text_pos start; | 9848 | struct text_pos start; |
| 9842 | struct buffer *old_current_buffer = NULL; | 9849 | struct buffer *old_current_buffer = NULL; |
| @@ -9965,7 +9972,7 @@ current_message (void) | |||
| 9965 | 9972 | ||
| 9966 | 9973 | ||
| 9967 | static int | 9974 | static int |
| 9968 | current_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) | 9975 | current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) |
| 9969 | { | 9976 | { |
| 9970 | intptr_t i1 = a1; | 9977 | intptr_t i1 = a1; |
| 9971 | Lisp_Object *msg = (Lisp_Object *) i1; | 9978 | Lisp_Object *msg = (Lisp_Object *) i1; |
| @@ -10044,7 +10051,7 @@ check_message_stack (void) | |||
| 10044 | time we display it---but don't redisplay it now. */ | 10051 | time we display it---but don't redisplay it now. */ |
| 10045 | 10052 | ||
| 10046 | void | 10053 | void |
| 10047 | truncate_echo_area (EMACS_INT nchars) | 10054 | truncate_echo_area (ptrdiff_t nchars) |
| 10048 | { | 10055 | { |
| 10049 | if (nchars == 0) | 10056 | if (nchars == 0) |
| 10050 | echo_area_buffer[0] = Qnil; | 10057 | echo_area_buffer[0] = Qnil; |
| @@ -10066,7 +10073,7 @@ truncate_echo_area (EMACS_INT nchars) | |||
| 10066 | message to at most NCHARS characters. */ | 10073 | message to at most NCHARS characters. */ |
| 10067 | 10074 | ||
| 10068 | static int | 10075 | static int |
| 10069 | truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4) | 10076 | truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) |
| 10070 | { | 10077 | { |
| 10071 | if (BEG + nchars < Z) | 10078 | if (BEG + nchars < Z) |
| 10072 | del_range (BEG + nchars, Z); | 10079 | del_range (BEG + nchars, Z); |
| @@ -10092,7 +10099,7 @@ truncate_message_1 (EMACS_INT nchars, Lisp_Object a2, EMACS_INT a3, EMACS_INT a4 | |||
| 10092 | 10099 | ||
| 10093 | static void | 10100 | static void |
| 10094 | set_message (const char *s, Lisp_Object string, | 10101 | set_message (const char *s, Lisp_Object string, |
| 10095 | EMACS_INT nbytes, int multibyte_p) | 10102 | ptrdiff_t nbytes, int multibyte_p) |
| 10096 | { | 10103 | { |
| 10097 | message_enable_multibyte | 10104 | message_enable_multibyte |
| 10098 | = ((s && multibyte_p) | 10105 | = ((s && multibyte_p) |
| @@ -10111,7 +10118,7 @@ set_message (const char *s, Lisp_Object string, | |||
| 10111 | current. */ | 10118 | current. */ |
| 10112 | 10119 | ||
| 10113 | static int | 10120 | static int |
| 10114 | set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multibyte_p) | 10121 | set_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t nbytes, ptrdiff_t multibyte_p) |
| 10115 | { | 10122 | { |
| 10116 | intptr_t i1 = a1; | 10123 | intptr_t i1 = a1; |
| 10117 | const char *s = (const char *) i1; | 10124 | const char *s = (const char *) i1; |
| @@ -10132,7 +10139,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby | |||
| 10132 | 10139 | ||
| 10133 | if (STRINGP (string)) | 10140 | if (STRINGP (string)) |
| 10134 | { | 10141 | { |
| 10135 | EMACS_INT nchars; | 10142 | ptrdiff_t nchars; |
| 10136 | 10143 | ||
| 10137 | if (nbytes == 0) | 10144 | if (nbytes == 0) |
| 10138 | nbytes = SBYTES (string); | 10145 | nbytes = SBYTES (string); |
| @@ -10151,7 +10158,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby | |||
| 10151 | if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters))) | 10158 | if (multibyte_p && NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 10152 | { | 10159 | { |
| 10153 | /* Convert from multi-byte to single-byte. */ | 10160 | /* Convert from multi-byte to single-byte. */ |
| 10154 | EMACS_INT i; | 10161 | ptrdiff_t i; |
| 10155 | int c, n; | 10162 | int c, n; |
| 10156 | char work[1]; | 10163 | char work[1]; |
| 10157 | 10164 | ||
| @@ -10169,7 +10176,7 @@ set_message_1 (EMACS_INT a1, Lisp_Object a2, EMACS_INT nbytes, EMACS_INT multiby | |||
| 10169 | && !NILP (BVAR (current_buffer, enable_multibyte_characters))) | 10176 | && !NILP (BVAR (current_buffer, enable_multibyte_characters))) |
| 10170 | { | 10177 | { |
| 10171 | /* Convert from single-byte to multi-byte. */ | 10178 | /* Convert from single-byte to multi-byte. */ |
| 10172 | EMACS_INT i; | 10179 | ptrdiff_t i; |
| 10173 | int c, n; | 10180 | int c, n; |
| 10174 | unsigned char str[MAX_MULTIBYTE_LENGTH]; | 10181 | unsigned char str[MAX_MULTIBYTE_LENGTH]; |
| 10175 | 10182 | ||
| @@ -10314,7 +10321,7 @@ echo_area_display (int update_frame_p) | |||
| 10314 | /* Must update other windows. Likewise as in other | 10321 | /* Must update other windows. Likewise as in other |
| 10315 | cases, don't let this update be interrupted by | 10322 | cases, don't let this update be interrupted by |
| 10316 | pending input. */ | 10323 | pending input. */ |
| 10317 | int count = SPECPDL_INDEX (); | 10324 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10318 | specbind (Qredisplay_dont_pause, Qt); | 10325 | specbind (Qredisplay_dont_pause, Qt); |
| 10319 | windows_or_buffers_changed = 1; | 10326 | windows_or_buffers_changed = 1; |
| 10320 | redisplay_internal (); | 10327 | redisplay_internal (); |
| @@ -10491,7 +10498,7 @@ store_mode_line_noprop (const char *string, int field_width, int precision) | |||
| 10491 | { | 10498 | { |
| 10492 | const unsigned char *str = (const unsigned char *) string; | 10499 | const unsigned char *str = (const unsigned char *) string; |
| 10493 | int n = 0; | 10500 | int n = 0; |
| 10494 | EMACS_INT dummy, nbytes; | 10501 | ptrdiff_t dummy, nbytes; |
| 10495 | 10502 | ||
| 10496 | /* Copy at most PRECISION chars from STR. */ | 10503 | /* Copy at most PRECISION chars from STR. */ |
| 10497 | nbytes = strlen (string); | 10504 | nbytes = strlen (string); |
| @@ -10536,7 +10543,7 @@ x_consider_frame_title (Lisp_Object frame) | |||
| 10536 | char *title; | 10543 | char *title; |
| 10537 | ptrdiff_t len; | 10544 | ptrdiff_t len; |
| 10538 | struct it it; | 10545 | struct it it; |
| 10539 | int count = SPECPDL_INDEX (); | 10546 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10540 | 10547 | ||
| 10541 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) | 10548 | for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) |
| 10542 | { | 10549 | { |
| @@ -10639,7 +10646,7 @@ prepare_menu_bars (void) | |||
| 10639 | if (all_windows) | 10646 | if (all_windows) |
| 10640 | { | 10647 | { |
| 10641 | Lisp_Object tail, frame; | 10648 | Lisp_Object tail, frame; |
| 10642 | int count = SPECPDL_INDEX (); | 10649 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10643 | /* 1 means that update_menu_bar has run its hooks | 10650 | /* 1 means that update_menu_bar has run its hooks |
| 10644 | so any further calls to update_menu_bar shouldn't do so again. */ | 10651 | so any further calls to update_menu_bar shouldn't do so again. */ |
| 10645 | int menu_bar_hooks_run = 0; | 10652 | int menu_bar_hooks_run = 0; |
| @@ -10756,7 +10763,7 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) | |||
| 10756 | != !NILP (w->region_showing))) | 10763 | != !NILP (w->region_showing))) |
| 10757 | { | 10764 | { |
| 10758 | struct buffer *prev = current_buffer; | 10765 | struct buffer *prev = current_buffer; |
| 10759 | int count = SPECPDL_INDEX (); | 10766 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10760 | 10767 | ||
| 10761 | specbind (Qinhibit_menubar_update, Qt); | 10768 | specbind (Qinhibit_menubar_update, Qt); |
| 10762 | 10769 | ||
| @@ -10954,7 +10961,7 @@ update_tool_bar (struct frame *f, int save_match_data) | |||
| 10954 | != !NILP (w->region_showing))) | 10961 | != !NILP (w->region_showing))) |
| 10955 | { | 10962 | { |
| 10956 | struct buffer *prev = current_buffer; | 10963 | struct buffer *prev = current_buffer; |
| 10957 | int count = SPECPDL_INDEX (); | 10964 | ptrdiff_t count = SPECPDL_INDEX (); |
| 10958 | Lisp_Object frame, new_tool_bar; | 10965 | Lisp_Object frame, new_tool_bar; |
| 10959 | int new_n_tool_bar; | 10966 | int new_n_tool_bar; |
| 10960 | struct gcpro gcpro1; | 10967 | struct gcpro gcpro1; |
| @@ -11092,20 +11099,20 @@ build_desired_tool_bar_string (struct frame *f) | |||
| 11092 | : DEFAULT_TOOL_BAR_BUTTON_RELIEF); | 11099 | : DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
| 11093 | hmargin = vmargin = relief; | 11100 | hmargin = vmargin = relief; |
| 11094 | 11101 | ||
| 11095 | if (INTEGERP (Vtool_bar_button_margin) | 11102 | if (RANGED_INTEGERP (1, Vtool_bar_button_margin, |
| 11096 | && XINT (Vtool_bar_button_margin) > 0) | 11103 | INT_MAX - max (hmargin, vmargin))) |
| 11097 | { | 11104 | { |
| 11098 | hmargin += XFASTINT (Vtool_bar_button_margin); | 11105 | hmargin += XFASTINT (Vtool_bar_button_margin); |
| 11099 | vmargin += XFASTINT (Vtool_bar_button_margin); | 11106 | vmargin += XFASTINT (Vtool_bar_button_margin); |
| 11100 | } | 11107 | } |
| 11101 | else if (CONSP (Vtool_bar_button_margin)) | 11108 | else if (CONSP (Vtool_bar_button_margin)) |
| 11102 | { | 11109 | { |
| 11103 | if (INTEGERP (XCAR (Vtool_bar_button_margin)) | 11110 | if (RANGED_INTEGERP (1, XCAR (Vtool_bar_button_margin), |
| 11104 | && XINT (XCAR (Vtool_bar_button_margin)) > 0) | 11111 | INT_MAX - hmargin)) |
| 11105 | hmargin += XFASTINT (XCAR (Vtool_bar_button_margin)); | 11112 | hmargin += XFASTINT (XCAR (Vtool_bar_button_margin)); |
| 11106 | 11113 | ||
| 11107 | if (INTEGERP (XCDR (Vtool_bar_button_margin)) | 11114 | if (RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), |
| 11108 | && XINT (XCDR (Vtool_bar_button_margin)) > 0) | 11115 | INT_MAX - vmargin)) |
| 11109 | vmargin += XFASTINT (XCDR (Vtool_bar_button_margin)); | 11116 | vmargin += XFASTINT (XCDR (Vtool_bar_button_margin)); |
| 11110 | } | 11117 | } |
| 11111 | 11118 | ||
| @@ -11451,7 +11458,7 @@ redisplay_tool_bar (struct frame *f) | |||
| 11451 | { | 11458 | { |
| 11452 | int border, rows, height, extra; | 11459 | int border, rows, height, extra; |
| 11453 | 11460 | ||
| 11454 | if (INTEGERP (Vtool_bar_border)) | 11461 | if (TYPE_RANGED_INTEGERP (int, Vtool_bar_border)) |
| 11455 | border = XINT (Vtool_bar_border); | 11462 | border = XINT (Vtool_bar_border); |
| 11456 | else if (EQ (Vtool_bar_border, Qinternal_border_width)) | 11463 | else if (EQ (Vtool_bar_border, Qinternal_border_width)) |
| 11457 | border = FRAME_INTERNAL_BORDER_WIDTH (f); | 11464 | border = FRAME_INTERNAL_BORDER_WIDTH (f); |
| @@ -11639,7 +11646,7 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, | |||
| 11639 | 11646 | ||
| 11640 | void | 11647 | void |
| 11641 | handle_tool_bar_click (struct frame *f, int x, int y, int down_p, | 11648 | handle_tool_bar_click (struct frame *f, int x, int y, int down_p, |
| 11642 | unsigned int modifiers) | 11649 | int modifiers) |
| 11643 | { | 11650 | { |
| 11644 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 11651 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 11645 | struct window *w = XWINDOW (f->tool_bar_window); | 11652 | struct window *w = XWINDOW (f->tool_bar_window); |
| @@ -11818,7 +11825,7 @@ hscroll_window_tree (Lisp_Object window) | |||
| 11818 | hscroll_step_abs = 0; | 11825 | hscroll_step_abs = 0; |
| 11819 | } | 11826 | } |
| 11820 | } | 11827 | } |
| 11821 | else if (INTEGERP (Vhscroll_step)) | 11828 | else if (TYPE_RANGED_INTEGERP (int, Vhscroll_step)) |
| 11822 | { | 11829 | { |
| 11823 | hscroll_step_abs = XINT (Vhscroll_step); | 11830 | hscroll_step_abs = XINT (Vhscroll_step); |
| 11824 | if (hscroll_step_abs < 0) | 11831 | if (hscroll_step_abs < 0) |
| @@ -11861,9 +11868,9 @@ hscroll_window_tree (Lisp_Object window) | |||
| 11861 | && (w->cursor.x >= text_area_width - h_margin)))) | 11868 | && (w->cursor.x >= text_area_width - h_margin)))) |
| 11862 | { | 11869 | { |
| 11863 | struct it it; | 11870 | struct it it; |
| 11864 | int hscroll; | 11871 | ptrdiff_t hscroll; |
| 11865 | struct buffer *saved_current_buffer; | 11872 | struct buffer *saved_current_buffer; |
| 11866 | EMACS_INT pt; | 11873 | ptrdiff_t pt; |
| 11867 | int wanted_x; | 11874 | int wanted_x; |
| 11868 | 11875 | ||
| 11869 | /* Find point in a display of infinite width. */ | 11876 | /* Find point in a display of infinite width. */ |
| @@ -11976,12 +11983,12 @@ static int debug_dvpos, debug_dy; | |||
| 11976 | 11983 | ||
| 11977 | /* Delta in characters and bytes for try_window_id. */ | 11984 | /* Delta in characters and bytes for try_window_id. */ |
| 11978 | 11985 | ||
| 11979 | static EMACS_INT debug_delta, debug_delta_bytes; | 11986 | static ptrdiff_t debug_delta, debug_delta_bytes; |
| 11980 | 11987 | ||
| 11981 | /* Values of window_end_pos and window_end_vpos at the end of | 11988 | /* Values of window_end_pos and window_end_vpos at the end of |
| 11982 | try_window_id. */ | 11989 | try_window_id. */ |
| 11983 | 11990 | ||
| 11984 | static EMACS_INT debug_end_vpos; | 11991 | static ptrdiff_t debug_end_vpos; |
| 11985 | 11992 | ||
| 11986 | /* Append a string to W->desired_matrix->method. FMT is a printf | 11993 | /* Append a string to W->desired_matrix->method. FMT is a printf |
| 11987 | format string. If trace_redisplay_p is non-zero also printf the | 11994 | format string. If trace_redisplay_p is non-zero also printf the |
| @@ -12031,7 +12038,7 @@ debug_method_add (struct window *w, char const *fmt, ...) | |||
| 12031 | 12038 | ||
| 12032 | static inline int | 12039 | static inline int |
| 12033 | text_outside_line_unchanged_p (struct window *w, | 12040 | text_outside_line_unchanged_p (struct window *w, |
| 12034 | EMACS_INT start, EMACS_INT end) | 12041 | ptrdiff_t start, ptrdiff_t end) |
| 12035 | { | 12042 | { |
| 12036 | int unchanged_p = 1; | 12043 | int unchanged_p = 1; |
| 12037 | 12044 | ||
| @@ -12254,10 +12261,10 @@ overlay_arrow_at_row (struct it *it, struct glyph_row *row) | |||
| 12254 | position. BUF and PT are the current point buffer and position. */ | 12261 | position. BUF and PT are the current point buffer and position. */ |
| 12255 | 12262 | ||
| 12256 | static int | 12263 | static int |
| 12257 | check_point_in_composition (struct buffer *prev_buf, EMACS_INT prev_pt, | 12264 | check_point_in_composition (struct buffer *prev_buf, ptrdiff_t prev_pt, |
| 12258 | struct buffer *buf, EMACS_INT pt) | 12265 | struct buffer *buf, ptrdiff_t pt) |
| 12259 | { | 12266 | { |
| 12260 | EMACS_INT start, end; | 12267 | ptrdiff_t start, end; |
| 12261 | Lisp_Object prop; | 12268 | Lisp_Object prop; |
| 12262 | Lisp_Object buffer; | 12269 | Lisp_Object buffer; |
| 12263 | 12270 | ||
| @@ -12308,7 +12315,7 @@ reconsider_clip_changes (struct window *w, struct buffer *b) | |||
| 12308 | if (!b->clip_changed | 12315 | if (!b->clip_changed |
| 12309 | && BUFFERP (w->buffer) && !NILP (w->window_end_valid)) | 12316 | && BUFFERP (w->buffer) && !NILP (w->window_end_valid)) |
| 12310 | { | 12317 | { |
| 12311 | EMACS_INT pt; | 12318 | ptrdiff_t pt; |
| 12312 | 12319 | ||
| 12313 | if (w == XWINDOW (selected_window)) | 12320 | if (w == XWINDOW (selected_window)) |
| 12314 | pt = PT; | 12321 | pt = PT; |
| @@ -12377,7 +12384,7 @@ redisplay_internal (void) | |||
| 12377 | int must_finish = 0; | 12384 | int must_finish = 0; |
| 12378 | struct text_pos tlbufpos, tlendpos; | 12385 | struct text_pos tlbufpos, tlendpos; |
| 12379 | int number_of_visible_frames; | 12386 | int number_of_visible_frames; |
| 12380 | int count, count1; | 12387 | ptrdiff_t count, count1; |
| 12381 | struct frame *sf; | 12388 | struct frame *sf; |
| 12382 | int polling_stopped_here = 0; | 12389 | int polling_stopped_here = 0; |
| 12383 | Lisp_Object old_frame = selected_frame; | 12390 | Lisp_Object old_frame = selected_frame; |
| @@ -12720,7 +12727,7 @@ redisplay_internal (void) | |||
| 12720 | { | 12727 | { |
| 12721 | struct glyph_row *row | 12728 | struct glyph_row *row |
| 12722 | = MATRIX_ROW (w->current_matrix, this_line_vpos + 1); | 12729 | = MATRIX_ROW (w->current_matrix, this_line_vpos + 1); |
| 12723 | EMACS_INT delta, delta_bytes; | 12730 | ptrdiff_t delta, delta_bytes; |
| 12724 | 12731 | ||
| 12725 | /* We used to distinguish between two cases here, | 12732 | /* We used to distinguish between two cases here, |
| 12726 | conditioned by Z - CHARPOS (tlendpos) == ZV, for | 12733 | conditioned by Z - CHARPOS (tlendpos) == ZV, for |
| @@ -13343,18 +13350,18 @@ redisplay_window_1 (Lisp_Object window) | |||
| 13343 | static int | 13350 | static int |
| 13344 | set_cursor_from_row (struct window *w, struct glyph_row *row, | 13351 | set_cursor_from_row (struct window *w, struct glyph_row *row, |
| 13345 | struct glyph_matrix *matrix, | 13352 | struct glyph_matrix *matrix, |
| 13346 | EMACS_INT delta, EMACS_INT delta_bytes, | 13353 | ptrdiff_t delta, ptrdiff_t delta_bytes, |
| 13347 | int dy, int dvpos) | 13354 | int dy, int dvpos) |
| 13348 | { | 13355 | { |
| 13349 | struct glyph *glyph = row->glyphs[TEXT_AREA]; | 13356 | struct glyph *glyph = row->glyphs[TEXT_AREA]; |
| 13350 | struct glyph *end = glyph + row->used[TEXT_AREA]; | 13357 | struct glyph *end = glyph + row->used[TEXT_AREA]; |
| 13351 | struct glyph *cursor = NULL; | 13358 | struct glyph *cursor = NULL; |
| 13352 | /* The last known character position in row. */ | 13359 | /* The last known character position in row. */ |
| 13353 | EMACS_INT last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; | 13360 | ptrdiff_t last_pos = MATRIX_ROW_START_CHARPOS (row) + delta; |
| 13354 | int x = row->x; | 13361 | int x = row->x; |
| 13355 | EMACS_INT pt_old = PT - delta; | 13362 | ptrdiff_t pt_old = PT - delta; |
| 13356 | EMACS_INT pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; | 13363 | ptrdiff_t pos_before = MATRIX_ROW_START_CHARPOS (row) + delta; |
| 13357 | EMACS_INT pos_after = MATRIX_ROW_END_CHARPOS (row) + delta; | 13364 | ptrdiff_t pos_after = MATRIX_ROW_END_CHARPOS (row) + delta; |
| 13358 | struct glyph *glyph_before = glyph - 1, *glyph_after = end; | 13365 | struct glyph *glyph_before = glyph - 1, *glyph_after = end; |
| 13359 | /* A glyph beyond the edge of TEXT_AREA which we should never | 13366 | /* A glyph beyond the edge of TEXT_AREA which we should never |
| 13360 | touch. */ | 13367 | touch. */ |
| @@ -13367,11 +13374,11 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13367 | int string_seen = 0; | 13374 | int string_seen = 0; |
| 13368 | /* Largest and smalles buffer positions seen so far during scan of | 13375 | /* Largest and smalles buffer positions seen so far during scan of |
| 13369 | glyph row. */ | 13376 | glyph row. */ |
| 13370 | EMACS_INT bpos_max = pos_before; | 13377 | ptrdiff_t bpos_max = pos_before; |
| 13371 | EMACS_INT bpos_min = pos_after; | 13378 | ptrdiff_t bpos_min = pos_after; |
| 13372 | /* Last buffer position covered by an overlay string with an integer | 13379 | /* Last buffer position covered by an overlay string with an integer |
| 13373 | `cursor' property. */ | 13380 | `cursor' property. */ |
| 13374 | EMACS_INT bpos_covered = 0; | 13381 | ptrdiff_t bpos_covered = 0; |
| 13375 | /* Non-zero means the display string on which to display the cursor | 13382 | /* Non-zero means the display string on which to display the cursor |
| 13376 | comes from a text property, not from an overlay. */ | 13383 | comes from a text property, not from an overlay. */ |
| 13377 | int string_from_text_prop = 0; | 13384 | int string_from_text_prop = 0; |
| @@ -13457,7 +13464,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13457 | { | 13464 | { |
| 13458 | if (BUFFERP (glyph->object)) | 13465 | if (BUFFERP (glyph->object)) |
| 13459 | { | 13466 | { |
| 13460 | EMACS_INT dpos = glyph->charpos - pt_old; | 13467 | ptrdiff_t dpos = glyph->charpos - pt_old; |
| 13461 | 13468 | ||
| 13462 | if (glyph->charpos > bpos_max) | 13469 | if (glyph->charpos > bpos_max) |
| 13463 | bpos_max = glyph->charpos; | 13470 | bpos_max = glyph->charpos; |
| @@ -13494,7 +13501,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13494 | else if (STRINGP (glyph->object)) | 13501 | else if (STRINGP (glyph->object)) |
| 13495 | { | 13502 | { |
| 13496 | Lisp_Object chprop; | 13503 | Lisp_Object chprop; |
| 13497 | EMACS_INT glyph_pos = glyph->charpos; | 13504 | ptrdiff_t glyph_pos = glyph->charpos; |
| 13498 | 13505 | ||
| 13499 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, | 13506 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, |
| 13500 | glyph->object); | 13507 | glyph->object); |
| @@ -13533,7 +13540,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13533 | { | 13540 | { |
| 13534 | if (BUFFERP (glyph->object)) | 13541 | if (BUFFERP (glyph->object)) |
| 13535 | { | 13542 | { |
| 13536 | EMACS_INT dpos = glyph->charpos - pt_old; | 13543 | ptrdiff_t dpos = glyph->charpos - pt_old; |
| 13537 | 13544 | ||
| 13538 | if (glyph->charpos > bpos_max) | 13545 | if (glyph->charpos > bpos_max) |
| 13539 | bpos_max = glyph->charpos; | 13546 | bpos_max = glyph->charpos; |
| @@ -13563,7 +13570,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13563 | else if (STRINGP (glyph->object)) | 13570 | else if (STRINGP (glyph->object)) |
| 13564 | { | 13571 | { |
| 13565 | Lisp_Object chprop; | 13572 | Lisp_Object chprop; |
| 13566 | EMACS_INT glyph_pos = glyph->charpos; | 13573 | ptrdiff_t glyph_pos = glyph->charpos; |
| 13567 | 13574 | ||
| 13568 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, | 13575 | chprop = Fget_char_property (make_number (glyph_pos), Qcursor, |
| 13569 | glyph->object); | 13576 | glyph->object); |
| @@ -13608,7 +13615,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13608 | 13615 | ||
| 13609 | if (row->ends_in_ellipsis_p && pos_after == last_pos) | 13616 | if (row->ends_in_ellipsis_p && pos_after == last_pos) |
| 13610 | { | 13617 | { |
| 13611 | EMACS_INT ellipsis_pos; | 13618 | ptrdiff_t ellipsis_pos; |
| 13612 | 13619 | ||
| 13613 | /* Scan back over the ellipsis glyphs. */ | 13620 | /* Scan back over the ellipsis glyphs. */ |
| 13614 | if (!row->reversed_p) | 13621 | if (!row->reversed_p) |
| @@ -13660,7 +13667,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13660 | positioned between POS_BEFORE and POS_AFTER in the | 13667 | positioned between POS_BEFORE and POS_AFTER in the |
| 13661 | buffer. */ | 13668 | buffer. */ |
| 13662 | struct glyph *start, *stop; | 13669 | struct glyph *start, *stop; |
| 13663 | EMACS_INT pos = pos_before; | 13670 | ptrdiff_t pos = pos_before; |
| 13664 | 13671 | ||
| 13665 | x = -1; | 13672 | x = -1; |
| 13666 | 13673 | ||
| @@ -13692,10 +13699,10 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13692 | if (STRINGP (glyph->object)) | 13699 | if (STRINGP (glyph->object)) |
| 13693 | { | 13700 | { |
| 13694 | Lisp_Object str; | 13701 | Lisp_Object str; |
| 13695 | EMACS_INT tem; | 13702 | ptrdiff_t tem; |
| 13696 | /* If the display property covers the newline, we | 13703 | /* If the display property covers the newline, we |
| 13697 | need to search for it one position farther. */ | 13704 | need to search for it one position farther. */ |
| 13698 | EMACS_INT lim = pos_after | 13705 | ptrdiff_t lim = pos_after |
| 13699 | + (pos_after == MATRIX_ROW_END_CHARPOS (row) + delta); | 13706 | + (pos_after == MATRIX_ROW_END_CHARPOS (row) + delta); |
| 13700 | 13707 | ||
| 13701 | string_from_text_prop = 0; | 13708 | string_from_text_prop = 0; |
| @@ -13721,7 +13728,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13721 | be a character in the string with the | 13728 | be a character in the string with the |
| 13722 | `cursor' property, which means display | 13729 | `cursor' property, which means display |
| 13723 | cursor on that character's glyph. */ | 13730 | cursor on that character's glyph. */ |
| 13724 | EMACS_INT strpos = glyph->charpos; | 13731 | ptrdiff_t strpos = glyph->charpos; |
| 13725 | 13732 | ||
| 13726 | if (tem) | 13733 | if (tem) |
| 13727 | { | 13734 | { |
| @@ -13734,7 +13741,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, | |||
| 13734 | glyph += incr) | 13741 | glyph += incr) |
| 13735 | { | 13742 | { |
| 13736 | Lisp_Object cprop; | 13743 | Lisp_Object cprop; |
| 13737 | EMACS_INT gpos = glyph->charpos; | 13744 | ptrdiff_t gpos = glyph->charpos; |
| 13738 | 13745 | ||
| 13739 | cprop = Fget_char_property (make_number (gpos), | 13746 | cprop = Fget_char_property (make_number (gpos), |
| 13740 | Qcursor, | 13747 | Qcursor, |
| @@ -14004,7 +14011,7 @@ enum | |||
| 14004 | 14011 | ||
| 14005 | static int | 14012 | static int |
| 14006 | try_scrolling (Lisp_Object window, int just_this_one_p, | 14013 | try_scrolling (Lisp_Object window, int just_this_one_p, |
| 14007 | EMACS_INT arg_scroll_conservatively, EMACS_INT scroll_step, | 14014 | ptrdiff_t arg_scroll_conservatively, ptrdiff_t scroll_step, |
| 14008 | int temp_scroll_step, int last_line_misfit) | 14015 | int temp_scroll_step, int last_line_misfit) |
| 14009 | { | 14016 | { |
| 14010 | struct window *w = XWINDOW (window); | 14017 | struct window *w = XWINDOW (window); |
| @@ -14638,7 +14645,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste | |||
| 14638 | MATRIX_ROW (w->current_matrix, w->cursor.vpos); | 14645 | MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
| 14639 | struct glyph *g = | 14646 | struct glyph *g = |
| 14640 | candidate->glyphs[TEXT_AREA] + w->cursor.hpos; | 14647 | candidate->glyphs[TEXT_AREA] + w->cursor.hpos; |
| 14641 | EMACS_INT endpos = MATRIX_ROW_END_CHARPOS (candidate); | 14648 | ptrdiff_t endpos = MATRIX_ROW_END_CHARPOS (candidate); |
| 14642 | 14649 | ||
| 14643 | exact_match_p = | 14650 | exact_match_p = |
| 14644 | (BUFFERP (g->object) && g->charpos == PT) | 14651 | (BUFFERP (g->object) && g->charpos == PT) |
| @@ -14698,7 +14705,7 @@ static | |||
| 14698 | void | 14705 | void |
| 14699 | set_vertical_scroll_bar (struct window *w) | 14706 | set_vertical_scroll_bar (struct window *w) |
| 14700 | { | 14707 | { |
| 14701 | EMACS_INT start, end, whole; | 14708 | ptrdiff_t start, end, whole; |
| 14702 | 14709 | ||
| 14703 | /* Calculate the start and end positions for the current window. | 14710 | /* Calculate the start and end positions for the current window. |
| 14704 | At some point, it would be nice to choose between scrollbars | 14711 | At some point, it would be nice to choose between scrollbars |
| @@ -14758,11 +14765,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 14758 | It indictes that the buffer contents and narrowing are unchanged. */ | 14765 | It indictes that the buffer contents and narrowing are unchanged. */ |
| 14759 | int buffer_unchanged_p = 0; | 14766 | int buffer_unchanged_p = 0; |
| 14760 | int temp_scroll_step = 0; | 14767 | int temp_scroll_step = 0; |
| 14761 | int count = SPECPDL_INDEX (); | 14768 | ptrdiff_t count = SPECPDL_INDEX (); |
| 14762 | int rc; | 14769 | int rc; |
| 14763 | int centering_position = -1; | 14770 | int centering_position = -1; |
| 14764 | int last_line_misfit = 0; | 14771 | int last_line_misfit = 0; |
| 14765 | EMACS_INT beg_unchanged, end_unchanged; | 14772 | ptrdiff_t beg_unchanged, end_unchanged; |
| 14766 | 14773 | ||
| 14767 | SET_TEXT_POS (lpoint, PT, PT_BYTE); | 14774 | SET_TEXT_POS (lpoint, PT, PT_BYTE); |
| 14768 | opoint = lpoint; | 14775 | opoint = lpoint; |
| @@ -14903,8 +14910,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 14903 | window, set up appropriate value. */ | 14910 | window, set up appropriate value. */ |
| 14904 | if (!EQ (window, selected_window)) | 14911 | if (!EQ (window, selected_window)) |
| 14905 | { | 14912 | { |
| 14906 | EMACS_INT new_pt = XMARKER (w->pointm)->charpos; | 14913 | ptrdiff_t new_pt = XMARKER (w->pointm)->charpos; |
| 14907 | EMACS_INT new_pt_byte = marker_byte_position (w->pointm); | 14914 | ptrdiff_t new_pt_byte = marker_byte_position (w->pointm); |
| 14908 | if (new_pt < BEGV) | 14915 | if (new_pt < BEGV) |
| 14909 | { | 14916 | { |
| 14910 | new_pt = BEGV; | 14917 | new_pt = BEGV; |
| @@ -15276,7 +15283,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) | |||
| 15276 | scroll_margin > 0 | 15283 | scroll_margin > 0 |
| 15277 | ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4) | 15284 | ? min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4) |
| 15278 | : 0; | 15285 | : 0; |
| 15279 | EMACS_INT margin_pos = CHARPOS (startp); | 15286 | ptrdiff_t margin_pos = CHARPOS (startp); |
| 15280 | int scrolling_up; | 15287 | int scrolling_up; |
| 15281 | Lisp_Object aggressive; | 15288 | Lisp_Object aggressive; |
| 15282 | 15289 | ||
| @@ -16144,7 +16151,7 @@ try_window_reusing_current_matrix (struct window *w) | |||
| 16144 | 16151 | ||
| 16145 | static struct glyph_row *find_last_unchanged_at_beg_row (struct window *); | 16152 | static struct glyph_row *find_last_unchanged_at_beg_row (struct window *); |
| 16146 | static struct glyph_row *find_first_unchanged_at_end_row (struct window *, | 16153 | static struct glyph_row *find_first_unchanged_at_end_row (struct window *, |
| 16147 | EMACS_INT *, EMACS_INT *); | 16154 | ptrdiff_t *, ptrdiff_t *); |
| 16148 | static struct glyph_row * | 16155 | static struct glyph_row * |
| 16149 | find_last_row_displaying_text (struct glyph_matrix *, struct it *, | 16156 | find_last_row_displaying_text (struct glyph_matrix *, struct it *, |
| 16150 | struct glyph_row *); | 16157 | struct glyph_row *); |
| @@ -16192,7 +16199,7 @@ find_last_row_displaying_text (struct glyph_matrix *matrix, struct it *it, | |||
| 16192 | static struct glyph_row * | 16199 | static struct glyph_row * |
| 16193 | find_last_unchanged_at_beg_row (struct window *w) | 16200 | find_last_unchanged_at_beg_row (struct window *w) |
| 16194 | { | 16201 | { |
| 16195 | EMACS_INT first_changed_pos = BEG + BEG_UNCHANGED; | 16202 | ptrdiff_t first_changed_pos = BEG + BEG_UNCHANGED; |
| 16196 | struct glyph_row *row; | 16203 | struct glyph_row *row; |
| 16197 | struct glyph_row *row_found = NULL; | 16204 | struct glyph_row *row_found = NULL; |
| 16198 | int yb = window_text_bottom_y (w); | 16205 | int yb = window_text_bottom_y (w); |
| @@ -16240,7 +16247,7 @@ find_last_unchanged_at_beg_row (struct window *w) | |||
| 16240 | 16247 | ||
| 16241 | static struct glyph_row * | 16248 | static struct glyph_row * |
| 16242 | find_first_unchanged_at_end_row (struct window *w, | 16249 | find_first_unchanged_at_end_row (struct window *w, |
| 16243 | EMACS_INT *delta, EMACS_INT *delta_bytes) | 16250 | ptrdiff_t *delta, ptrdiff_t *delta_bytes) |
| 16244 | { | 16251 | { |
| 16245 | struct glyph_row *row; | 16252 | struct glyph_row *row; |
| 16246 | struct glyph_row *row_found = NULL; | 16253 | struct glyph_row *row_found = NULL; |
| @@ -16268,11 +16275,11 @@ find_first_unchanged_at_end_row (struct window *w, | |||
| 16268 | corresponds to window_end_pos. This allows us to translate | 16275 | corresponds to window_end_pos. This allows us to translate |
| 16269 | buffer positions in the current matrix to current buffer | 16276 | buffer positions in the current matrix to current buffer |
| 16270 | positions for characters not in changed text. */ | 16277 | positions for characters not in changed text. */ |
| 16271 | EMACS_INT Z_old = | 16278 | ptrdiff_t Z_old = |
| 16272 | MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); | 16279 | MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); |
| 16273 | EMACS_INT Z_BYTE_old = | 16280 | ptrdiff_t Z_BYTE_old = |
| 16274 | MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; | 16281 | MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; |
| 16275 | EMACS_INT last_unchanged_pos, last_unchanged_pos_old; | 16282 | ptrdiff_t last_unchanged_pos, last_unchanged_pos_old; |
| 16276 | struct glyph_row *first_text_row | 16283 | struct glyph_row *first_text_row |
| 16277 | = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 16284 | = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 16278 | 16285 | ||
| @@ -16359,12 +16366,12 @@ sync_frame_with_window_matrix_rows (struct window *w) | |||
| 16359 | containing CHARPOS or null. */ | 16366 | containing CHARPOS or null. */ |
| 16360 | 16367 | ||
| 16361 | struct glyph_row * | 16368 | struct glyph_row * |
| 16362 | row_containing_pos (struct window *w, EMACS_INT charpos, | 16369 | row_containing_pos (struct window *w, ptrdiff_t charpos, |
| 16363 | struct glyph_row *start, struct glyph_row *end, int dy) | 16370 | struct glyph_row *start, struct glyph_row *end, int dy) |
| 16364 | { | 16371 | { |
| 16365 | struct glyph_row *row = start; | 16372 | struct glyph_row *row = start; |
| 16366 | struct glyph_row *best_row = NULL; | 16373 | struct glyph_row *best_row = NULL; |
| 16367 | EMACS_INT mindif = BUF_ZV (XBUFFER (w->buffer)) + 1; | 16374 | ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1; |
| 16368 | int last_y; | 16375 | int last_y; |
| 16369 | 16376 | ||
| 16370 | /* If we happen to start on a header-line, skip that. */ | 16377 | /* If we happen to start on a header-line, skip that. */ |
| @@ -16478,14 +16485,14 @@ try_window_id (struct window *w) | |||
| 16478 | struct glyph_row *bottom_row; | 16485 | struct glyph_row *bottom_row; |
| 16479 | int bottom_vpos; | 16486 | int bottom_vpos; |
| 16480 | struct it it; | 16487 | struct it it; |
| 16481 | EMACS_INT delta = 0, delta_bytes = 0, stop_pos; | 16488 | ptrdiff_t delta = 0, delta_bytes = 0, stop_pos; |
| 16482 | int dvpos, dy; | 16489 | int dvpos, dy; |
| 16483 | struct text_pos start_pos; | 16490 | struct text_pos start_pos; |
| 16484 | struct run run; | 16491 | struct run run; |
| 16485 | int first_unchanged_at_end_vpos = 0; | 16492 | int first_unchanged_at_end_vpos = 0; |
| 16486 | struct glyph_row *last_text_row, *last_text_row_at_end; | 16493 | struct glyph_row *last_text_row, *last_text_row_at_end; |
| 16487 | struct text_pos start; | 16494 | struct text_pos start; |
| 16488 | EMACS_INT first_changed_charpos, last_changed_charpos; | 16495 | ptrdiff_t first_changed_charpos, last_changed_charpos; |
| 16489 | 16496 | ||
| 16490 | #if GLYPH_DEBUG | 16497 | #if GLYPH_DEBUG |
| 16491 | if (inhibit_try_window_id) | 16498 | if (inhibit_try_window_id) |
| @@ -16612,7 +16619,7 @@ try_window_id (struct window *w) | |||
| 16612 | || (last_changed_charpos < CHARPOS (start) - 1 | 16619 | || (last_changed_charpos < CHARPOS (start) - 1 |
| 16613 | && FETCH_BYTE (BYTEPOS (start) - 1) == '\n'))) | 16620 | && FETCH_BYTE (BYTEPOS (start) - 1) == '\n'))) |
| 16614 | { | 16621 | { |
| 16615 | EMACS_INT Z_old, Z_delta, Z_BYTE_old, Z_delta_bytes; | 16622 | ptrdiff_t Z_old, Z_delta, Z_BYTE_old, Z_delta_bytes; |
| 16616 | struct glyph_row *r0; | 16623 | struct glyph_row *r0; |
| 16617 | 16624 | ||
| 16618 | /* Compute how many chars/bytes have been added to or removed | 16625 | /* Compute how many chars/bytes have been added to or removed |
| @@ -17356,7 +17363,7 @@ dump_glyph_row (struct glyph_row *row, int vpos, int glyphs) | |||
| 17356 | row->visible_height, | 17363 | row->visible_height, |
| 17357 | row->ascent, | 17364 | row->ascent, |
| 17358 | row->phys_ascent); | 17365 | row->phys_ascent); |
| 17359 | fprintf (stderr, "%9d %5d\t%5d\n", row->start.overlay_string_index, | 17366 | fprintf (stderr, "%9"pD"d %5"pD"d\t%5d\n", row->start.overlay_string_index, |
| 17360 | row->end.overlay_string_index, | 17367 | row->end.overlay_string_index, |
| 17361 | row->continuation_lines_width); | 17368 | row->continuation_lines_width); |
| 17362 | fprintf (stderr, "%9"pI"d %5"pI"d\n", | 17369 | fprintf (stderr, "%9"pI"d %5"pI"d\n", |
| @@ -17430,7 +17437,7 @@ glyphs in short form, otherwise show glyphs in long form. */) | |||
| 17430 | w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos); | 17437 | w->cursor.x, w->cursor.y, w->cursor.hpos, w->cursor.vpos); |
| 17431 | fprintf (stderr, "=============================================\n"); | 17438 | fprintf (stderr, "=============================================\n"); |
| 17432 | dump_glyph_matrix (w->current_matrix, | 17439 | dump_glyph_matrix (w->current_matrix, |
| 17433 | NILP (glyphs) ? 0 : XINT (glyphs)); | 17440 | TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 0); |
| 17434 | return Qnil; | 17441 | return Qnil; |
| 17435 | } | 17442 | } |
| 17436 | 17443 | ||
| @@ -17453,7 +17460,7 @@ GLYPH > 1 or omitted means dump glyphs in long form. */) | |||
| 17453 | (Lisp_Object row, Lisp_Object glyphs) | 17460 | (Lisp_Object row, Lisp_Object glyphs) |
| 17454 | { | 17461 | { |
| 17455 | struct glyph_matrix *matrix; | 17462 | struct glyph_matrix *matrix; |
| 17456 | int vpos; | 17463 | EMACS_INT vpos; |
| 17457 | 17464 | ||
| 17458 | CHECK_NUMBER (row); | 17465 | CHECK_NUMBER (row); |
| 17459 | matrix = XWINDOW (selected_window)->current_matrix; | 17466 | matrix = XWINDOW (selected_window)->current_matrix; |
| @@ -17461,7 +17468,7 @@ GLYPH > 1 or omitted means dump glyphs in long form. */) | |||
| 17461 | if (vpos >= 0 && vpos < matrix->nrows) | 17468 | if (vpos >= 0 && vpos < matrix->nrows) |
| 17462 | dump_glyph_row (MATRIX_ROW (matrix, vpos), | 17469 | dump_glyph_row (MATRIX_ROW (matrix, vpos), |
| 17463 | vpos, | 17470 | vpos, |
| 17464 | INTEGERP (glyphs) ? XINT (glyphs) : 2); | 17471 | TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2); |
| 17465 | return Qnil; | 17472 | return Qnil; |
| 17466 | } | 17473 | } |
| 17467 | 17474 | ||
| @@ -17475,13 +17482,13 @@ GLYPH > 1 or omitted means dump glyphs in long form. */) | |||
| 17475 | { | 17482 | { |
| 17476 | struct frame *sf = SELECTED_FRAME (); | 17483 | struct frame *sf = SELECTED_FRAME (); |
| 17477 | struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix; | 17484 | struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix; |
| 17478 | int vpos; | 17485 | EMACS_INT vpos; |
| 17479 | 17486 | ||
| 17480 | CHECK_NUMBER (row); | 17487 | CHECK_NUMBER (row); |
| 17481 | vpos = XINT (row); | 17488 | vpos = XINT (row); |
| 17482 | if (vpos >= 0 && vpos < m->nrows) | 17489 | if (vpos >= 0 && vpos < m->nrows) |
| 17483 | dump_glyph_row (MATRIX_ROW (m, vpos), vpos, | 17490 | dump_glyph_row (MATRIX_ROW (m, vpos), vpos, |
| 17484 | INTEGERP (glyphs) ? XINT (glyphs) : 2); | 17491 | TYPE_RANGED_INTEGERP (int, glyphs) ? XINT (glyphs) : 2); |
| 17485 | return Qnil; | 17492 | return Qnil; |
| 17486 | } | 17493 | } |
| 17487 | 17494 | ||
| @@ -17994,9 +18001,9 @@ extend_face_to_end_of_line (struct it *it) | |||
| 17994 | trailing whitespace. */ | 18001 | trailing whitespace. */ |
| 17995 | 18002 | ||
| 17996 | static int | 18003 | static int |
| 17997 | trailing_whitespace_p (EMACS_INT charpos) | 18004 | trailing_whitespace_p (ptrdiff_t charpos) |
| 17998 | { | 18005 | { |
| 17999 | EMACS_INT bytepos = CHAR_TO_BYTE (charpos); | 18006 | ptrdiff_t bytepos = CHAR_TO_BYTE (charpos); |
| 18000 | int c = 0; | 18007 | int c = 0; |
| 18001 | 18008 | ||
| 18002 | while (bytepos < ZV_BYTE | 18009 | while (bytepos < ZV_BYTE |
| @@ -18312,8 +18319,8 @@ unproduce_glyphs (struct it *it, int n) | |||
| 18312 | and ROW->maxpos. */ | 18319 | and ROW->maxpos. */ |
| 18313 | static void | 18320 | static void |
| 18314 | find_row_edges (struct it *it, struct glyph_row *row, | 18321 | find_row_edges (struct it *it, struct glyph_row *row, |
| 18315 | EMACS_INT min_pos, EMACS_INT min_bpos, | 18322 | ptrdiff_t min_pos, ptrdiff_t min_bpos, |
| 18316 | EMACS_INT max_pos, EMACS_INT max_bpos) | 18323 | ptrdiff_t max_pos, ptrdiff_t max_bpos) |
| 18317 | { | 18324 | { |
| 18318 | /* FIXME: Revisit this when glyph ``spilling'' in continuation | 18325 | /* FIXME: Revisit this when glyph ``spilling'' in continuation |
| 18319 | lines' rows is implemented for bidi-reordered rows. */ | 18326 | lines' rows is implemented for bidi-reordered rows. */ |
| @@ -18406,11 +18413,11 @@ display_line (struct it *it) | |||
| 18406 | int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0); | 18413 | int wrap_row_ascent IF_LINT (= 0), wrap_row_height IF_LINT (= 0); |
| 18407 | int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0); | 18414 | int wrap_row_phys_ascent IF_LINT (= 0), wrap_row_phys_height IF_LINT (= 0); |
| 18408 | int wrap_row_extra_line_spacing IF_LINT (= 0); | 18415 | int wrap_row_extra_line_spacing IF_LINT (= 0); |
| 18409 | EMACS_INT wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0); | 18416 | ptrdiff_t wrap_row_min_pos IF_LINT (= 0), wrap_row_min_bpos IF_LINT (= 0); |
| 18410 | EMACS_INT wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0); | 18417 | ptrdiff_t wrap_row_max_pos IF_LINT (= 0), wrap_row_max_bpos IF_LINT (= 0); |
| 18411 | int cvpos; | 18418 | int cvpos; |
| 18412 | EMACS_INT min_pos = ZV + 1, max_pos = 0; | 18419 | ptrdiff_t min_pos = ZV + 1, max_pos = 0; |
| 18413 | EMACS_INT min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0); | 18420 | ptrdiff_t min_bpos IF_LINT (= 0), max_bpos IF_LINT (= 0); |
| 18414 | 18421 | ||
| 18415 | /* We always start displaying at hpos zero even if hscrolled. */ | 18422 | /* We always start displaying at hpos zero even if hscrolled. */ |
| 18416 | xassert (it->hpos == 0 && it->current_x == 0); | 18423 | xassert (it->hpos == 0 && it->current_x == 0); |
| @@ -18482,10 +18489,10 @@ display_line (struct it *it) | |||
| 18482 | do \ | 18489 | do \ |
| 18483 | { \ | 18490 | { \ |
| 18484 | int composition_p = (IT)->what == IT_COMPOSITION; \ | 18491 | int composition_p = (IT)->what == IT_COMPOSITION; \ |
| 18485 | EMACS_INT current_pos = \ | 18492 | ptrdiff_t current_pos = \ |
| 18486 | composition_p ? (IT)->cmp_it.charpos \ | 18493 | composition_p ? (IT)->cmp_it.charpos \ |
| 18487 | : IT_CHARPOS (*(IT)); \ | 18494 | : IT_CHARPOS (*(IT)); \ |
| 18488 | EMACS_INT current_bpos = \ | 18495 | ptrdiff_t current_bpos = \ |
| 18489 | composition_p ? CHAR_TO_BYTE (current_pos) \ | 18496 | composition_p ? CHAR_TO_BYTE (current_pos) \ |
| 18490 | : IT_BYTEPOS (*(IT)); \ | 18497 | : IT_BYTEPOS (*(IT)); \ |
| 18491 | if (current_pos < min_pos) \ | 18498 | if (current_pos < min_pos) \ |
| @@ -19114,8 +19121,8 @@ See also `bidi-paragraph-direction'. */) | |||
| 19114 | use current_matrix if it is up to date, but this seems fast | 19121 | use current_matrix if it is up to date, but this seems fast |
| 19115 | enough as it is. */ | 19122 | enough as it is. */ |
| 19116 | struct bidi_it itb; | 19123 | struct bidi_it itb; |
| 19117 | EMACS_INT pos = BUF_PT (buf); | 19124 | ptrdiff_t pos = BUF_PT (buf); |
| 19118 | EMACS_INT bytepos = BUF_PT_BYTE (buf); | 19125 | ptrdiff_t bytepos = BUF_PT_BYTE (buf); |
| 19119 | int c; | 19126 | int c; |
| 19120 | 19127 | ||
| 19121 | set_buffer_temp (buf); | 19128 | set_buffer_temp (buf); |
| @@ -19401,7 +19408,7 @@ display_mode_line (struct window *w, enum face_id face_id, Lisp_Object format) | |||
| 19401 | { | 19408 | { |
| 19402 | struct it it; | 19409 | struct it it; |
| 19403 | struct face *face; | 19410 | struct face *face; |
| 19404 | int count = SPECPDL_INDEX (); | 19411 | ptrdiff_t count = SPECPDL_INDEX (); |
| 19405 | 19412 | ||
| 19406 | init_iterator (&it, w, -1, -1, NULL, face_id); | 19413 | init_iterator (&it, w, -1, -1, NULL, face_id); |
| 19407 | /* Don't extend on a previously drawn mode-line. | 19414 | /* Don't extend on a previously drawn mode-line. |
| @@ -19537,7 +19544,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19537 | { | 19544 | { |
| 19538 | /* A string: output it and check for %-constructs within it. */ | 19545 | /* A string: output it and check for %-constructs within it. */ |
| 19539 | unsigned char c; | 19546 | unsigned char c; |
| 19540 | EMACS_INT offset = 0; | 19547 | ptrdiff_t offset = 0; |
| 19541 | 19548 | ||
| 19542 | if (SCHARS (elt) > 0 | 19549 | if (SCHARS (elt) > 0 |
| 19543 | && (!NILP (props) || risky)) | 19550 | && (!NILP (props) || risky)) |
| @@ -19634,7 +19641,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19634 | && (mode_line_target != MODE_LINE_DISPLAY | 19641 | && (mode_line_target != MODE_LINE_DISPLAY |
| 19635 | || it->current_x < it->last_visible_x)) | 19642 | || it->current_x < it->last_visible_x)) |
| 19636 | { | 19643 | { |
| 19637 | EMACS_INT last_offset = offset; | 19644 | ptrdiff_t last_offset = offset; |
| 19638 | 19645 | ||
| 19639 | /* Advance to end of string or next format specifier. */ | 19646 | /* Advance to end of string or next format specifier. */ |
| 19640 | while ((c = SREF (elt, offset++)) != '\0' && c != '%') | 19647 | while ((c = SREF (elt, offset++)) != '\0' && c != '%') |
| @@ -19642,7 +19649,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19642 | 19649 | ||
| 19643 | if (offset - 1 != last_offset) | 19650 | if (offset - 1 != last_offset) |
| 19644 | { | 19651 | { |
| 19645 | EMACS_INT nchars, nbytes; | 19652 | ptrdiff_t nchars, nbytes; |
| 19646 | 19653 | ||
| 19647 | /* Output to end of string or up to '%'. Field width | 19654 | /* Output to end of string or up to '%'. Field width |
| 19648 | is length of string. Don't output more than | 19655 | is length of string. Don't output more than |
| @@ -19661,9 +19668,9 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19661 | break; | 19668 | break; |
| 19662 | case MODE_LINE_STRING: | 19669 | case MODE_LINE_STRING: |
| 19663 | { | 19670 | { |
| 19664 | EMACS_INT bytepos = last_offset; | 19671 | ptrdiff_t bytepos = last_offset; |
| 19665 | EMACS_INT charpos = string_byte_to_char (elt, bytepos); | 19672 | ptrdiff_t charpos = string_byte_to_char (elt, bytepos); |
| 19666 | EMACS_INT endpos = (precision <= 0 | 19673 | ptrdiff_t endpos = (precision <= 0 |
| 19667 | ? string_byte_to_char (elt, offset) | 19674 | ? string_byte_to_char (elt, offset) |
| 19668 | : charpos + nchars); | 19675 | : charpos + nchars); |
| 19669 | 19676 | ||
| @@ -19675,8 +19682,8 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19675 | break; | 19682 | break; |
| 19676 | case MODE_LINE_DISPLAY: | 19683 | case MODE_LINE_DISPLAY: |
| 19677 | { | 19684 | { |
| 19678 | EMACS_INT bytepos = last_offset; | 19685 | ptrdiff_t bytepos = last_offset; |
| 19679 | EMACS_INT charpos = string_byte_to_char (elt, bytepos); | 19686 | ptrdiff_t charpos = string_byte_to_char (elt, bytepos); |
| 19680 | 19687 | ||
| 19681 | if (precision <= 0) | 19688 | if (precision <= 0) |
| 19682 | nchars = string_byte_to_char (elt, offset) - charpos; | 19689 | nchars = string_byte_to_char (elt, offset) - charpos; |
| @@ -19689,7 +19696,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19689 | } | 19696 | } |
| 19690 | else /* c == '%' */ | 19697 | else /* c == '%' */ |
| 19691 | { | 19698 | { |
| 19692 | EMACS_INT percent_position = offset; | 19699 | ptrdiff_t percent_position = offset; |
| 19693 | 19700 | ||
| 19694 | /* Get the specified minimum width. Zero means | 19701 | /* Get the specified minimum width. Zero means |
| 19695 | don't pad. */ | 19702 | don't pad. */ |
| @@ -19711,7 +19718,7 @@ display_mode_element (struct it *it, int depth, int field_width, int precision, | |||
| 19711 | else if (c != 0) | 19718 | else if (c != 0) |
| 19712 | { | 19719 | { |
| 19713 | int multibyte; | 19720 | int multibyte; |
| 19714 | EMACS_INT bytepos, charpos; | 19721 | ptrdiff_t bytepos, charpos; |
| 19715 | const char *spec; | 19722 | const char *spec; |
| 19716 | Lisp_Object string; | 19723 | Lisp_Object string; |
| 19717 | 19724 | ||
| @@ -19984,7 +19991,7 @@ static int | |||
| 19984 | store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string, | 19991 | store_mode_line_string (const char *string, Lisp_Object lisp_string, int copy_string, |
| 19985 | int field_width, int precision, Lisp_Object props) | 19992 | int field_width, int precision, Lisp_Object props) |
| 19986 | { | 19993 | { |
| 19987 | EMACS_INT len; | 19994 | ptrdiff_t len; |
| 19988 | int n = 0; | 19995 | int n = 0; |
| 19989 | 19996 | ||
| 19990 | if (string != NULL) | 19997 | if (string != NULL) |
| @@ -20085,7 +20092,7 @@ are the selected window and the WINDOW's buffer). */) | |||
| 20085 | struct buffer *old_buffer = NULL; | 20092 | struct buffer *old_buffer = NULL; |
| 20086 | int face_id; | 20093 | int face_id; |
| 20087 | int no_props = INTEGERP (face); | 20094 | int no_props = INTEGERP (face); |
| 20088 | int count = SPECPDL_INDEX (); | 20095 | ptrdiff_t count = SPECPDL_INDEX (); |
| 20089 | Lisp_Object str; | 20096 | Lisp_Object str; |
| 20090 | int string_start = 0; | 20097 | int string_start = 0; |
| 20091 | 20098 | ||
| @@ -20171,7 +20178,7 @@ are the selected window and the WINDOW's buffer). */) | |||
| 20171 | the positive integer D to BUF using a minimal field width WIDTH. */ | 20178 | the positive integer D to BUF using a minimal field width WIDTH. */ |
| 20172 | 20179 | ||
| 20173 | static void | 20180 | static void |
| 20174 | pint2str (register char *buf, register int width, register EMACS_INT d) | 20181 | pint2str (register char *buf, register int width, register ptrdiff_t d) |
| 20175 | { | 20182 | { |
| 20176 | register char *p = buf; | 20183 | register char *p = buf; |
| 20177 | 20184 | ||
| @@ -20215,11 +20222,11 @@ static const char power_letter[] = | |||
| 20215 | }; | 20222 | }; |
| 20216 | 20223 | ||
| 20217 | static void | 20224 | static void |
| 20218 | pint2hrstr (char *buf, int width, EMACS_INT d) | 20225 | pint2hrstr (char *buf, int width, ptrdiff_t d) |
| 20219 | { | 20226 | { |
| 20220 | /* We aim to represent the nonnegative integer D as | 20227 | /* We aim to represent the nonnegative integer D as |
| 20221 | QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */ | 20228 | QUOTIENT.TENTHS * 10 ^ (3 * EXPONENT). */ |
| 20222 | EMACS_INT quotient = d; | 20229 | ptrdiff_t quotient = d; |
| 20223 | int remainder = 0; | 20230 | int remainder = 0; |
| 20224 | /* -1 means: do not use TENTHS. */ | 20231 | /* -1 means: do not use TENTHS. */ |
| 20225 | int tenths = -1; | 20232 | int tenths = -1; |
| @@ -20499,7 +20506,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20499 | return ""; | 20506 | return ""; |
| 20500 | else | 20507 | else |
| 20501 | { | 20508 | { |
| 20502 | EMACS_INT col = current_column (); | 20509 | ptrdiff_t col = current_column (); |
| 20503 | w->column_number_displayed = make_number (col); | 20510 | w->column_number_displayed = make_number (col); |
| 20504 | pint2str (decode_mode_spec_buf, field_width, col); | 20511 | pint2str (decode_mode_spec_buf, field_width, col); |
| 20505 | return decode_mode_spec_buf; | 20512 | return decode_mode_spec_buf; |
| @@ -20531,23 +20538,23 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20531 | 20538 | ||
| 20532 | case 'i': | 20539 | case 'i': |
| 20533 | { | 20540 | { |
| 20534 | EMACS_INT size = ZV - BEGV; | 20541 | ptrdiff_t size = ZV - BEGV; |
| 20535 | pint2str (decode_mode_spec_buf, field_width, size); | 20542 | pint2str (decode_mode_spec_buf, field_width, size); |
| 20536 | return decode_mode_spec_buf; | 20543 | return decode_mode_spec_buf; |
| 20537 | } | 20544 | } |
| 20538 | 20545 | ||
| 20539 | case 'I': | 20546 | case 'I': |
| 20540 | { | 20547 | { |
| 20541 | EMACS_INT size = ZV - BEGV; | 20548 | ptrdiff_t size = ZV - BEGV; |
| 20542 | pint2hrstr (decode_mode_spec_buf, field_width, size); | 20549 | pint2hrstr (decode_mode_spec_buf, field_width, size); |
| 20543 | return decode_mode_spec_buf; | 20550 | return decode_mode_spec_buf; |
| 20544 | } | 20551 | } |
| 20545 | 20552 | ||
| 20546 | case 'l': | 20553 | case 'l': |
| 20547 | { | 20554 | { |
| 20548 | EMACS_INT startpos, startpos_byte, line, linepos, linepos_byte; | 20555 | ptrdiff_t startpos, startpos_byte, line, linepos, linepos_byte; |
| 20549 | EMACS_INT topline, nlines, height; | 20556 | ptrdiff_t topline, nlines, height; |
| 20550 | EMACS_INT junk; | 20557 | ptrdiff_t junk; |
| 20551 | 20558 | ||
| 20552 | /* %c and %l are ignored in `frame-title-format'. */ | 20559 | /* %c and %l are ignored in `frame-title-format'. */ |
| 20553 | if (mode_line_target == MODE_LINE_TITLE) | 20560 | if (mode_line_target == MODE_LINE_TITLE) |
| @@ -20608,10 +20615,10 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20608 | else if (nlines < height + 25 || nlines > height * 3 + 50 | 20615 | else if (nlines < height + 25 || nlines > height * 3 + 50 |
| 20609 | || linepos == BUF_BEGV (b)) | 20616 | || linepos == BUF_BEGV (b)) |
| 20610 | { | 20617 | { |
| 20611 | EMACS_INT limit = BUF_BEGV (b); | 20618 | ptrdiff_t limit = BUF_BEGV (b); |
| 20612 | EMACS_INT limit_byte = BUF_BEGV_BYTE (b); | 20619 | ptrdiff_t limit_byte = BUF_BEGV_BYTE (b); |
| 20613 | EMACS_INT position; | 20620 | ptrdiff_t position; |
| 20614 | EMACS_INT distance = | 20621 | ptrdiff_t distance = |
| 20615 | (height * 2 + 30) * line_number_display_limit_width; | 20622 | (height * 2 + 30) * line_number_display_limit_width; |
| 20616 | 20623 | ||
| 20617 | if (startpos - distance > limit) | 20624 | if (startpos - distance > limit) |
| @@ -20673,8 +20680,8 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20673 | 20680 | ||
| 20674 | case 'p': | 20681 | case 'p': |
| 20675 | { | 20682 | { |
| 20676 | EMACS_INT pos = marker_position (w->start); | 20683 | ptrdiff_t pos = marker_position (w->start); |
| 20677 | EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b); | 20684 | ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); |
| 20678 | 20685 | ||
| 20679 | if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) | 20686 | if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) |
| 20680 | { | 20687 | { |
| @@ -20704,9 +20711,9 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20704 | /* Display percentage of size above the bottom of the screen. */ | 20711 | /* Display percentage of size above the bottom of the screen. */ |
| 20705 | case 'P': | 20712 | case 'P': |
| 20706 | { | 20713 | { |
| 20707 | EMACS_INT toppos = marker_position (w->start); | 20714 | ptrdiff_t toppos = marker_position (w->start); |
| 20708 | EMACS_INT botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); | 20715 | ptrdiff_t botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); |
| 20709 | EMACS_INT total = BUF_ZV (b) - BUF_BEGV (b); | 20716 | ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); |
| 20710 | 20717 | ||
| 20711 | if (botpos >= BUF_ZV (b)) | 20718 | if (botpos >= BUF_ZV (b)) |
| 20712 | { | 20719 | { |
| @@ -20746,7 +20753,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20746 | 20753 | ||
| 20747 | case '@': | 20754 | case '@': |
| 20748 | { | 20755 | { |
| 20749 | int count = inhibit_garbage_collection (); | 20756 | ptrdiff_t count = inhibit_garbage_collection (); |
| 20750 | Lisp_Object val = call1 (intern ("file-remote-p"), | 20757 | Lisp_Object val = call1 (intern ("file-remote-p"), |
| 20751 | BVAR (current_buffer, directory)); | 20758 | BVAR (current_buffer, directory)); |
| 20752 | unbind_to (count, Qnil); | 20759 | unbind_to (count, Qnil); |
| @@ -20815,17 +20822,17 @@ decode_mode_spec (struct window *w, register int c, int field_width, | |||
| 20815 | 20822 | ||
| 20816 | Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ | 20823 | Set *BYTE_POS_PTR to 1 if we found COUNT lines, 0 if we hit LIMIT. */ |
| 20817 | 20824 | ||
| 20818 | static EMACS_INT | 20825 | static ptrdiff_t |
| 20819 | display_count_lines (EMACS_INT start_byte, | 20826 | display_count_lines (ptrdiff_t start_byte, |
| 20820 | EMACS_INT limit_byte, EMACS_INT count, | 20827 | ptrdiff_t limit_byte, ptrdiff_t count, |
| 20821 | EMACS_INT *byte_pos_ptr) | 20828 | ptrdiff_t *byte_pos_ptr) |
| 20822 | { | 20829 | { |
| 20823 | register unsigned char *cursor; | 20830 | register unsigned char *cursor; |
| 20824 | unsigned char *base; | 20831 | unsigned char *base; |
| 20825 | 20832 | ||
| 20826 | register EMACS_INT ceiling; | 20833 | register ptrdiff_t ceiling; |
| 20827 | register unsigned char *ceiling_addr; | 20834 | register unsigned char *ceiling_addr; |
| 20828 | EMACS_INT orig_count = count; | 20835 | ptrdiff_t orig_count = count; |
| 20829 | 20836 | ||
| 20830 | /* If we are not in selective display mode, | 20837 | /* If we are not in selective display mode, |
| 20831 | check only for newlines. */ | 20838 | check only for newlines. */ |
| @@ -20959,13 +20966,13 @@ display_count_lines (EMACS_INT start_byte, | |||
| 20959 | 20966 | ||
| 20960 | static int | 20967 | static int |
| 20961 | display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_string, | 20968 | display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_string, |
| 20962 | EMACS_INT face_string_pos, EMACS_INT start, struct it *it, | 20969 | ptrdiff_t face_string_pos, ptrdiff_t start, struct it *it, |
| 20963 | int field_width, int precision, int max_x, int multibyte) | 20970 | int field_width, int precision, int max_x, int multibyte) |
| 20964 | { | 20971 | { |
| 20965 | int hpos_at_start = it->hpos; | 20972 | int hpos_at_start = it->hpos; |
| 20966 | int saved_face_id = it->face_id; | 20973 | int saved_face_id = it->face_id; |
| 20967 | struct glyph_row *row = it->glyph_row; | 20974 | struct glyph_row *row = it->glyph_row; |
| 20968 | EMACS_INT it_charpos; | 20975 | ptrdiff_t it_charpos; |
| 20969 | 20976 | ||
| 20970 | /* Initialize the iterator IT for iteration over STRING beginning | 20977 | /* Initialize the iterator IT for iteration over STRING beginning |
| 20971 | with index START. */ | 20978 | with index START. */ |
| @@ -20980,7 +20987,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st | |||
| 20980 | FACE_STRING, if that's given. */ | 20987 | FACE_STRING, if that's given. */ |
| 20981 | if (STRINGP (face_string)) | 20988 | if (STRINGP (face_string)) |
| 20982 | { | 20989 | { |
| 20983 | EMACS_INT endptr; | 20990 | ptrdiff_t endptr; |
| 20984 | struct face *face; | 20991 | struct face *face; |
| 20985 | 20992 | ||
| 20986 | it->face_id | 20993 | it->face_id |
| @@ -22461,7 +22468,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) | |||
| 22461 | 22468 | ||
| 22462 | static int | 22469 | static int |
| 22463 | draw_glyphs (struct window *w, int x, struct glyph_row *row, | 22470 | draw_glyphs (struct window *w, int x, struct glyph_row *row, |
| 22464 | enum glyph_row_area area, EMACS_INT start, EMACS_INT end, | 22471 | enum glyph_row_area area, ptrdiff_t start, ptrdiff_t end, |
| 22465 | enum draw_glyphs_face hl, int overlaps) | 22472 | enum draw_glyphs_face hl, int overlaps) |
| 22466 | { | 22473 | { |
| 22467 | struct glyph_string *head, *tail; | 22474 | struct glyph_string *head, *tail; |
| @@ -23912,7 +23919,7 @@ x_produce_glyphs (struct it *it) | |||
| 23912 | XChar2b char2b; | 23919 | XChar2b char2b; |
| 23913 | struct font_metrics *pcm; | 23920 | struct font_metrics *pcm; |
| 23914 | int font_not_found_p; | 23921 | int font_not_found_p; |
| 23915 | EMACS_INT pos; | 23922 | ptrdiff_t pos; |
| 23916 | 23923 | ||
| 23917 | for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--) | 23924 | for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--) |
| 23918 | if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t') | 23925 | if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t') |
| @@ -24312,7 +24319,7 @@ x_insert_glyphs (struct glyph *start, int len) | |||
| 24312 | struct glyph_row *row; | 24319 | struct glyph_row *row; |
| 24313 | struct glyph *glyph; | 24320 | struct glyph *glyph; |
| 24314 | int frame_x, frame_y; | 24321 | int frame_x, frame_y; |
| 24315 | EMACS_INT hpos; | 24322 | ptrdiff_t hpos; |
| 24316 | 24323 | ||
| 24317 | xassert (updated_window && updated_row); | 24324 | xassert (updated_window && updated_row); |
| 24318 | BLOCK_INPUT; | 24325 | BLOCK_INPUT; |
| @@ -24459,8 +24466,7 @@ get_specified_cursor_type (Lisp_Object arg, int *width) | |||
| 24459 | 24466 | ||
| 24460 | if (CONSP (arg) | 24467 | if (CONSP (arg) |
| 24461 | && EQ (XCAR (arg), Qbar) | 24468 | && EQ (XCAR (arg), Qbar) |
| 24462 | && INTEGERP (XCDR (arg)) | 24469 | && RANGED_INTEGERP (0, XCDR (arg), INT_MAX)) |
| 24463 | && XINT (XCDR (arg)) >= 0) | ||
| 24464 | { | 24470 | { |
| 24465 | *width = XINT (XCDR (arg)); | 24471 | *width = XINT (XCDR (arg)); |
| 24466 | return BAR_CURSOR; | 24472 | return BAR_CURSOR; |
| @@ -24474,8 +24480,7 @@ get_specified_cursor_type (Lisp_Object arg, int *width) | |||
| 24474 | 24480 | ||
| 24475 | if (CONSP (arg) | 24481 | if (CONSP (arg) |
| 24476 | && EQ (XCAR (arg), Qhbar) | 24482 | && EQ (XCAR (arg), Qhbar) |
| 24477 | && INTEGERP (XCDR (arg)) | 24483 | && RANGED_INTEGERP (0, XCDR (arg), INT_MAX)) |
| 24478 | && XINT (XCDR (arg)) >= 0) | ||
| 24479 | { | 24484 | { |
| 24480 | *width = XINT (XCDR (arg)); | 24485 | *width = XINT (XCDR (arg)); |
| 24481 | return HBAR_CURSOR; | 24486 | return HBAR_CURSOR; |
| @@ -25315,7 +25320,7 @@ cursor_in_mouse_face_p (struct window *w) | |||
| 25315 | change non-linearly with glyph rows. */ | 25320 | change non-linearly with glyph rows. */ |
| 25316 | static void | 25321 | static void |
| 25317 | rows_from_pos_range (struct window *w, | 25322 | rows_from_pos_range (struct window *w, |
| 25318 | EMACS_INT start_charpos, EMACS_INT end_charpos, | 25323 | ptrdiff_t start_charpos, ptrdiff_t end_charpos, |
| 25319 | struct glyph_row **start, struct glyph_row **end) | 25324 | struct glyph_row **start, struct glyph_row **end) |
| 25320 | { | 25325 | { |
| 25321 | struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 25326 | struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| @@ -25443,9 +25448,9 @@ rows_from_pos_range (struct window *w, | |||
| 25443 | static void | 25448 | static void |
| 25444 | mouse_face_from_buffer_pos (Lisp_Object window, | 25449 | mouse_face_from_buffer_pos (Lisp_Object window, |
| 25445 | Mouse_HLInfo *hlinfo, | 25450 | Mouse_HLInfo *hlinfo, |
| 25446 | EMACS_INT mouse_charpos, | 25451 | ptrdiff_t mouse_charpos, |
| 25447 | EMACS_INT start_charpos, | 25452 | ptrdiff_t start_charpos, |
| 25448 | EMACS_INT end_charpos, | 25453 | ptrdiff_t end_charpos, |
| 25449 | Lisp_Object before_string, | 25454 | Lisp_Object before_string, |
| 25450 | Lisp_Object after_string, | 25455 | Lisp_Object after_string, |
| 25451 | Lisp_Object cover_string) | 25456 | Lisp_Object cover_string) |
| @@ -25454,7 +25459,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 25454 | struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | 25459 | struct glyph_row *first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); |
| 25455 | struct glyph_row *r1, *r2; | 25460 | struct glyph_row *r1, *r2; |
| 25456 | struct glyph *glyph, *end; | 25461 | struct glyph *glyph, *end; |
| 25457 | EMACS_INT ignore, pos; | 25462 | ptrdiff_t ignore, pos; |
| 25458 | int x; | 25463 | int x; |
| 25459 | 25464 | ||
| 25460 | xassert (NILP (cover_string) || STRINGP (cover_string)); | 25465 | xassert (NILP (cover_string) || STRINGP (cover_string)); |
| @@ -25776,7 +25781,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, | |||
| 25776 | Value is non-zero if a glyph was found. */ | 25781 | Value is non-zero if a glyph was found. */ |
| 25777 | 25782 | ||
| 25778 | static int | 25783 | static int |
| 25779 | fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, | 25784 | fast_find_string_pos (struct window *w, ptrdiff_t pos, Lisp_Object object, |
| 25780 | int *hpos, int *vpos, int *x, int *y, int right_p) | 25785 | int *hpos, int *vpos, int *x, int *y, int right_p) |
| 25781 | { | 25786 | { |
| 25782 | int yb = window_text_bottom_y (w); | 25787 | int yb = window_text_bottom_y (w); |
| @@ -25846,7 +25851,7 @@ fast_find_string_pos (struct window *w, EMACS_INT pos, Lisp_Object object, | |||
| 25846 | static void | 25851 | static void |
| 25847 | mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, | 25852 | mouse_face_from_string_pos (struct window *w, Mouse_HLInfo *hlinfo, |
| 25848 | Lisp_Object object, | 25853 | Lisp_Object object, |
| 25849 | EMACS_INT startpos, EMACS_INT endpos) | 25854 | ptrdiff_t startpos, ptrdiff_t endpos) |
| 25850 | { | 25855 | { |
| 25851 | int yb = window_text_bottom_y (w); | 25856 | int yb = window_text_bottom_y (w); |
| 25852 | struct glyph_row *r; | 25857 | struct glyph_row *r; |
| @@ -26016,8 +26021,8 @@ on_hot_spot_p (Lisp_Object hot_spot, int x, int y) | |||
| 26016 | { | 26021 | { |
| 26017 | struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); | 26022 | struct Lisp_Vector *v = XVECTOR (XCDR (hot_spot)); |
| 26018 | Lisp_Object *poly = v->contents; | 26023 | Lisp_Object *poly = v->contents; |
| 26019 | int n = v->header.size; | 26024 | ptrdiff_t n = v->header.size; |
| 26020 | int i; | 26025 | ptrdiff_t i; |
| 26021 | int inside = 0; | 26026 | int inside = 0; |
| 26022 | Lisp_Object lx, ly; | 26027 | Lisp_Object lx, ly; |
| 26023 | int x0, y0; | 26028 | int x0, y0; |
| @@ -26095,7 +26100,9 @@ Returns the alist element for the first matching AREA in MAP. */) | |||
| 26095 | CHECK_NUMBER (x); | 26100 | CHECK_NUMBER (x); |
| 26096 | CHECK_NUMBER (y); | 26101 | CHECK_NUMBER (y); |
| 26097 | 26102 | ||
| 26098 | return find_hot_spot (map, XINT (x), XINT (y)); | 26103 | return find_hot_spot (map, |
| 26104 | clip_to_bounds (INT_MIN, XINT (x), INT_MAX), | ||
| 26105 | clip_to_bounds (INT_MIN, XINT (y), INT_MAX)); | ||
| 26099 | } | 26106 | } |
| 26100 | 26107 | ||
| 26101 | 26108 | ||
| @@ -26154,7 +26161,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 26154 | Cursor cursor = No_Cursor; | 26161 | Cursor cursor = No_Cursor; |
| 26155 | Lisp_Object pointer = Qnil; | 26162 | Lisp_Object pointer = Qnil; |
| 26156 | int dx, dy, width, height; | 26163 | int dx, dy, width, height; |
| 26157 | EMACS_INT charpos; | 26164 | ptrdiff_t charpos; |
| 26158 | Lisp_Object string, object = Qnil; | 26165 | Lisp_Object string, object = Qnil; |
| 26159 | Lisp_Object pos, help; | 26166 | Lisp_Object pos, help; |
| 26160 | 26167 | ||
| @@ -26294,7 +26301,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, | |||
| 26294 | int gpos; | 26301 | int gpos; |
| 26295 | int gseq_length; | 26302 | int gseq_length; |
| 26296 | int total_pixel_width; | 26303 | int total_pixel_width; |
| 26297 | EMACS_INT begpos, endpos, ignore; | 26304 | ptrdiff_t begpos, endpos, ignore; |
| 26298 | 26305 | ||
| 26299 | int vpos, hpos; | 26306 | int vpos, hpos; |
| 26300 | 26307 | ||
| @@ -26521,14 +26528,14 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26521 | && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) | 26528 | && XFASTINT (w->last_overlay_modified) == BUF_OVERLAY_MODIFF (b)) |
| 26522 | { | 26529 | { |
| 26523 | int hpos, vpos, dx, dy, area; | 26530 | int hpos, vpos, dx, dy, area; |
| 26524 | EMACS_INT pos; | 26531 | ptrdiff_t pos; |
| 26525 | struct glyph *glyph; | 26532 | struct glyph *glyph; |
| 26526 | Lisp_Object object; | 26533 | Lisp_Object object; |
| 26527 | Lisp_Object mouse_face = Qnil, position; | 26534 | Lisp_Object mouse_face = Qnil, position; |
| 26528 | Lisp_Object *overlay_vec = NULL; | 26535 | Lisp_Object *overlay_vec = NULL; |
| 26529 | ptrdiff_t i, noverlays; | 26536 | ptrdiff_t i, noverlays; |
| 26530 | struct buffer *obuf; | 26537 | struct buffer *obuf; |
| 26531 | EMACS_INT obegv, ozv; | 26538 | ptrdiff_t obegv, ozv; |
| 26532 | int same_region; | 26539 | int same_region; |
| 26533 | 26540 | ||
| 26534 | /* Find the glyph under X/Y. */ | 26541 | /* Find the glyph under X/Y. */ |
| @@ -26686,7 +26693,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26686 | /* The mouse-highlighting comes from a display string | 26693 | /* The mouse-highlighting comes from a display string |
| 26687 | with a mouse-face. */ | 26694 | with a mouse-face. */ |
| 26688 | Lisp_Object s, e; | 26695 | Lisp_Object s, e; |
| 26689 | EMACS_INT ignore; | 26696 | ptrdiff_t ignore; |
| 26690 | 26697 | ||
| 26691 | s = Fprevious_single_property_change | 26698 | s = Fprevious_single_property_change |
| 26692 | (make_number (pos + 1), Qmouse_face, object, Qnil); | 26699 | (make_number (pos + 1), Qmouse_face, object, Qnil); |
| @@ -26718,7 +26725,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26718 | /* If we are on a display string with no mouse-face, | 26725 | /* If we are on a display string with no mouse-face, |
| 26719 | check if the text under it has one. */ | 26726 | check if the text under it has one. */ |
| 26720 | struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); | 26727 | struct glyph_row *r = MATRIX_ROW (w->current_matrix, vpos); |
| 26721 | EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); | 26728 | ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r); |
| 26722 | pos = string_buffer_position (object, start); | 26729 | pos = string_buffer_position (object, start); |
| 26723 | if (pos > 0) | 26730 | if (pos > 0) |
| 26724 | { | 26731 | { |
| @@ -26813,7 +26820,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26813 | else | 26820 | else |
| 26814 | { | 26821 | { |
| 26815 | Lisp_Object obj = glyph->object; | 26822 | Lisp_Object obj = glyph->object; |
| 26816 | EMACS_INT charpos = glyph->charpos; | 26823 | ptrdiff_t charpos = glyph->charpos; |
| 26817 | 26824 | ||
| 26818 | /* Try text properties. */ | 26825 | /* Try text properties. */ |
| 26819 | if (STRINGP (obj) | 26826 | if (STRINGP (obj) |
| @@ -26828,8 +26835,8 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26828 | see if the buffer text ``under'' it does. */ | 26835 | see if the buffer text ``under'' it does. */ |
| 26829 | struct glyph_row *r | 26836 | struct glyph_row *r |
| 26830 | = MATRIX_ROW (w->current_matrix, vpos); | 26837 | = MATRIX_ROW (w->current_matrix, vpos); |
| 26831 | EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); | 26838 | ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r); |
| 26832 | EMACS_INT p = string_buffer_position (obj, start); | 26839 | ptrdiff_t p = string_buffer_position (obj, start); |
| 26833 | if (p > 0) | 26840 | if (p > 0) |
| 26834 | { | 26841 | { |
| 26835 | help = Fget_char_property (make_number (p), | 26842 | help = Fget_char_property (make_number (p), |
| @@ -26869,7 +26876,7 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26869 | if (NILP (pointer)) | 26876 | if (NILP (pointer)) |
| 26870 | { | 26877 | { |
| 26871 | Lisp_Object obj = glyph->object; | 26878 | Lisp_Object obj = glyph->object; |
| 26872 | EMACS_INT charpos = glyph->charpos; | 26879 | ptrdiff_t charpos = glyph->charpos; |
| 26873 | 26880 | ||
| 26874 | /* Try text properties. */ | 26881 | /* Try text properties. */ |
| 26875 | if (STRINGP (obj) | 26882 | if (STRINGP (obj) |
| @@ -26884,8 +26891,8 @@ note_mouse_highlight (struct frame *f, int x, int y) | |||
| 26884 | see if the buffer text ``under'' it does. */ | 26891 | see if the buffer text ``under'' it does. */ |
| 26885 | struct glyph_row *r | 26892 | struct glyph_row *r |
| 26886 | = MATRIX_ROW (w->current_matrix, vpos); | 26893 | = MATRIX_ROW (w->current_matrix, vpos); |
| 26887 | EMACS_INT start = MATRIX_ROW_START_CHARPOS (r); | 26894 | ptrdiff_t start = MATRIX_ROW_START_CHARPOS (r); |
| 26888 | EMACS_INT p = string_buffer_position (obj, start); | 26895 | ptrdiff_t p = string_buffer_position (obj, start); |
| 26889 | if (p > 0) | 26896 | if (p > 0) |
| 26890 | pointer = Fget_char_property (make_number (p), | 26897 | pointer = Fget_char_property (make_number (p), |
| 26891 | Qpointer, w->buffer); | 26898 | Qpointer, w->buffer); |
| @@ -28164,23 +28171,16 @@ start_hourglass (void) | |||
| 28164 | { | 28171 | { |
| 28165 | #if defined (HAVE_WINDOW_SYSTEM) | 28172 | #if defined (HAVE_WINDOW_SYSTEM) |
| 28166 | EMACS_TIME delay; | 28173 | EMACS_TIME delay; |
| 28167 | int secs, usecs = 0; | 28174 | int secs = DEFAULT_HOURGLASS_DELAY, usecs = 0; |
| 28168 | 28175 | ||
| 28169 | cancel_hourglass (); | 28176 | cancel_hourglass (); |
| 28170 | 28177 | ||
| 28171 | if (INTEGERP (Vhourglass_delay) | 28178 | if (NUMBERP (Vhourglass_delay)) |
| 28172 | && XINT (Vhourglass_delay) > 0) | ||
| 28173 | secs = XFASTINT (Vhourglass_delay); | ||
| 28174 | else if (FLOATP (Vhourglass_delay) | ||
| 28175 | && XFLOAT_DATA (Vhourglass_delay) > 0) | ||
| 28176 | { | 28179 | { |
| 28177 | Lisp_Object tem; | 28180 | double duration = extract_float (Vhourglass_delay); |
| 28178 | tem = Ftruncate (Vhourglass_delay, Qnil); | 28181 | if (0 < duration) |
| 28179 | secs = XFASTINT (tem); | 28182 | duration_to_sec_usec (duration, &secs, &usecs); |
| 28180 | usecs = (XFLOAT_DATA (Vhourglass_delay) - secs) * 1000000; | ||
| 28181 | } | 28183 | } |
| 28182 | else | ||
| 28183 | secs = DEFAULT_HOURGLASS_DELAY; | ||
| 28184 | 28184 | ||
| 28185 | EMACS_SET_SECS_USECS (delay, secs, usecs); | 28185 | EMACS_SET_SECS_USECS (delay, secs, usecs); |
| 28186 | hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, | 28186 | hourglass_atimer = start_atimer (ATIMER_RELATIVE, delay, |
diff --git a/src/xfaces.c b/src/xfaces.c index 9faa7c79e0b..ee41ab69b0b 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -922,7 +922,7 @@ the pixmap. Bits are stored row by row, each row occupies | |||
| 922 | else if (CONSP (object)) | 922 | else if (CONSP (object)) |
| 923 | { | 923 | { |
| 924 | /* Otherwise OBJECT must be (WIDTH HEIGHT DATA), WIDTH and | 924 | /* Otherwise OBJECT must be (WIDTH HEIGHT DATA), WIDTH and |
| 925 | HEIGHT must be integers > 0, and DATA must be string large | 925 | HEIGHT must be ints > 0, and DATA must be string large |
| 926 | enough to hold a bitmap of the specified size. */ | 926 | enough to hold a bitmap of the specified size. */ |
| 927 | Lisp_Object width, height, data; | 927 | Lisp_Object width, height, data; |
| 928 | 928 | ||
| @@ -942,11 +942,11 @@ the pixmap. Bits are stored row by row, each row occupies | |||
| 942 | } | 942 | } |
| 943 | 943 | ||
| 944 | if (STRINGP (data) | 944 | if (STRINGP (data) |
| 945 | && INTEGERP (width) && 0 < XINT (width) | 945 | && RANGED_INTEGERP (1, width, INT_MAX) |
| 946 | && INTEGERP (height) && 0 < XINT (height)) | 946 | && RANGED_INTEGERP (1, height, INT_MAX)) |
| 947 | { | 947 | { |
| 948 | EMACS_INT bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1) | 948 | int bytes_per_row = ((XINT (width) + BITS_PER_CHAR - 1) |
| 949 | / BITS_PER_CHAR); | 949 | / BITS_PER_CHAR); |
| 950 | if (XINT (height) <= SBYTES (data) / bytes_per_row) | 950 | if (XINT (height) <= SBYTES (data) / bytes_per_row) |
| 951 | pixmap_p = 1; | 951 | pixmap_p = 1; |
| 952 | } | 952 | } |
| @@ -1604,7 +1604,9 @@ compare_fonts_by_sort_order (const void *v1, const void *v2) | |||
| 1604 | else | 1604 | else |
| 1605 | { | 1605 | { |
| 1606 | if (INTEGERP (val1)) | 1606 | if (INTEGERP (val1)) |
| 1607 | result = INTEGERP (val2) ? XINT (val1) - XINT (val2) : -1; | 1607 | result = (INTEGERP (val2) && XINT (val1) >= XINT (val2) |
| 1608 | ? XINT (val1) > XINT (val2) | ||
| 1609 | : -1); | ||
| 1608 | else | 1610 | else |
| 1609 | result = INTEGERP (val2) ? 1 : 0; | 1611 | result = INTEGERP (val2) ? 1 : 0; |
| 1610 | } | 1612 | } |
| @@ -1633,8 +1635,10 @@ the face font sort order. */) | |||
| 1633 | (Lisp_Object family, Lisp_Object frame) | 1635 | (Lisp_Object family, Lisp_Object frame) |
| 1634 | { | 1636 | { |
| 1635 | Lisp_Object font_spec, list, *drivers, vec; | 1637 | Lisp_Object font_spec, list, *drivers, vec; |
| 1636 | int i, nfonts, ndrivers; | 1638 | ptrdiff_t i, nfonts; |
| 1639 | EMACS_INT ndrivers; | ||
| 1637 | Lisp_Object result; | 1640 | Lisp_Object result; |
| 1641 | USE_SAFE_ALLOCA; | ||
| 1638 | 1642 | ||
| 1639 | if (NILP (frame)) | 1643 | if (NILP (frame)) |
| 1640 | frame = selected_frame; | 1644 | frame = selected_frame; |
| @@ -1670,7 +1674,7 @@ the face font sort order. */) | |||
| 1670 | font_props_for_sorting[i++] = FONT_REGISTRY_INDEX; | 1674 | font_props_for_sorting[i++] = FONT_REGISTRY_INDEX; |
| 1671 | 1675 | ||
| 1672 | ndrivers = XINT (Flength (list)); | 1676 | ndrivers = XINT (Flength (list)); |
| 1673 | drivers = alloca (sizeof (Lisp_Object) * ndrivers); | 1677 | SAFE_ALLOCA_LISP (drivers, ndrivers); |
| 1674 | for (i = 0; i < ndrivers; i++, list = XCDR (list)) | 1678 | for (i = 0; i < ndrivers; i++, list = XCDR (list)) |
| 1675 | drivers[i] = XCAR (list); | 1679 | drivers[i] = XCAR (list); |
| 1676 | vec = Fvconcat (ndrivers, drivers); | 1680 | vec = Fvconcat (ndrivers, drivers); |
| @@ -1702,6 +1706,7 @@ the face font sort order. */) | |||
| 1702 | result = Fcons (v, result); | 1706 | result = Fcons (v, result); |
| 1703 | } | 1707 | } |
| 1704 | 1708 | ||
| 1709 | SAFE_FREE (); | ||
| 1705 | return result; | 1710 | return result; |
| 1706 | } | 1711 | } |
| 1707 | 1712 | ||
| @@ -2263,7 +2268,7 @@ merge_face_heights (Lisp_Object from, Lisp_Object to, Lisp_Object invalid) | |||
| 2263 | { | 2268 | { |
| 2264 | if (INTEGERP (to)) | 2269 | if (INTEGERP (to)) |
| 2265 | /* relative X absolute => absolute */ | 2270 | /* relative X absolute => absolute */ |
| 2266 | result = make_number ((EMACS_INT)(XFLOAT_DATA (from) * XINT (to))); | 2271 | result = make_number (XFLOAT_DATA (from) * XINT (to)); |
| 2267 | else if (FLOATP (to)) | 2272 | else if (FLOATP (to)) |
| 2268 | /* relative X relative => relative */ | 2273 | /* relative X relative => relative */ |
| 2269 | result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to)); | 2274 | result = make_float (XFLOAT_DATA (from) * XFLOAT_DATA (to)); |
| @@ -2683,8 +2688,7 @@ Value is a vector of face attributes. */) | |||
| 2683 | property `face' of the Lisp face name. */ | 2688 | property `face' of the Lisp face name. */ |
| 2684 | if (next_lface_id == lface_id_to_name_size) | 2689 | if (next_lface_id == lface_id_to_name_size) |
| 2685 | lface_id_to_name = | 2690 | lface_id_to_name = |
| 2686 | xpalloc (lface_id_to_name, &lface_id_to_name_size, 1, | 2691 | xpalloc (lface_id_to_name, &lface_id_to_name_size, 1, MAX_FACE_ID, |
| 2687 | min (INT_MAX, MOST_POSITIVE_FIXNUM), | ||
| 2688 | sizeof *lface_id_to_name); | 2692 | sizeof *lface_id_to_name); |
| 2689 | 2693 | ||
| 2690 | lface_id_to_name[next_lface_id] = face; | 2694 | lface_id_to_name[next_lface_id] = face; |
| @@ -5277,7 +5281,7 @@ static int | |||
| 5277 | realize_basic_faces (struct frame *f) | 5281 | realize_basic_faces (struct frame *f) |
| 5278 | { | 5282 | { |
| 5279 | int success_p = 0; | 5283 | int success_p = 0; |
| 5280 | int count = SPECPDL_INDEX (); | 5284 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5281 | 5285 | ||
| 5282 | /* Block input here so that we won't be surprised by an X expose | 5286 | /* Block input here so that we won't be surprised by an X expose |
| 5283 | event, for instance, without having the faces set up. */ | 5287 | event, for instance, without having the faces set up. */ |
| @@ -5960,9 +5964,9 @@ compute_char_face (struct frame *f, int ch, Lisp_Object prop) | |||
| 5960 | The face returned is suitable for displaying ASCII characters. */ | 5964 | The face returned is suitable for displaying ASCII characters. */ |
| 5961 | 5965 | ||
| 5962 | int | 5966 | int |
| 5963 | face_at_buffer_position (struct window *w, EMACS_INT pos, | 5967 | face_at_buffer_position (struct window *w, ptrdiff_t pos, |
| 5964 | EMACS_INT region_beg, EMACS_INT region_end, | 5968 | ptrdiff_t region_beg, ptrdiff_t region_end, |
| 5965 | EMACS_INT *endptr, EMACS_INT limit, | 5969 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 5966 | int mouse, int base_face_id) | 5970 | int mouse, int base_face_id) |
| 5967 | { | 5971 | { |
| 5968 | struct frame *f = XFRAME (w->frame); | 5972 | struct frame *f = XFRAME (w->frame); |
| @@ -5971,7 +5975,7 @@ face_at_buffer_position (struct window *w, EMACS_INT pos, | |||
| 5971 | ptrdiff_t i, noverlays; | 5975 | ptrdiff_t i, noverlays; |
| 5972 | Lisp_Object *overlay_vec; | 5976 | Lisp_Object *overlay_vec; |
| 5973 | Lisp_Object frame; | 5977 | Lisp_Object frame; |
| 5974 | EMACS_INT endpos; | 5978 | ptrdiff_t endpos; |
| 5975 | Lisp_Object propname = mouse ? Qmouse_face : Qface; | 5979 | Lisp_Object propname = mouse ? Qmouse_face : Qface; |
| 5976 | Lisp_Object limit1, end; | 5980 | Lisp_Object limit1, end; |
| 5977 | struct face *default_face; | 5981 | struct face *default_face; |
| @@ -5997,7 +6001,7 @@ face_at_buffer_position (struct window *w, EMACS_INT pos, | |||
| 5997 | 6001 | ||
| 5998 | /* Look at properties from overlays. */ | 6002 | /* Look at properties from overlays. */ |
| 5999 | { | 6003 | { |
| 6000 | EMACS_INT next_overlay; | 6004 | ptrdiff_t next_overlay; |
| 6001 | 6005 | ||
| 6002 | GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0); | 6006 | GET_OVERLAYS_AT (pos, overlay_vec, noverlays, &next_overlay, 0); |
| 6003 | if (next_overlay < endpos) | 6007 | if (next_overlay < endpos) |
| @@ -6072,9 +6076,9 @@ face_at_buffer_position (struct window *w, EMACS_INT pos, | |||
| 6072 | simply disregards the `face' properties of all overlays. */ | 6076 | simply disregards the `face' properties of all overlays. */ |
| 6073 | 6077 | ||
| 6074 | int | 6078 | int |
| 6075 | face_for_overlay_string (struct window *w, EMACS_INT pos, | 6079 | face_for_overlay_string (struct window *w, ptrdiff_t pos, |
| 6076 | EMACS_INT region_beg, EMACS_INT region_end, | 6080 | ptrdiff_t region_beg, ptrdiff_t region_end, |
| 6077 | EMACS_INT *endptr, EMACS_INT limit, | 6081 | ptrdiff_t *endptr, ptrdiff_t limit, |
| 6078 | int mouse, Lisp_Object overlay) | 6082 | int mouse, Lisp_Object overlay) |
| 6079 | { | 6083 | { |
| 6080 | struct frame *f = XFRAME (w->frame); | 6084 | struct frame *f = XFRAME (w->frame); |
| @@ -6161,9 +6165,9 @@ face_for_overlay_string (struct window *w, EMACS_INT pos, | |||
| 6161 | 6165 | ||
| 6162 | int | 6166 | int |
| 6163 | face_at_string_position (struct window *w, Lisp_Object string, | 6167 | face_at_string_position (struct window *w, Lisp_Object string, |
| 6164 | EMACS_INT pos, EMACS_INT bufpos, | 6168 | ptrdiff_t pos, ptrdiff_t bufpos, |
| 6165 | EMACS_INT region_beg, EMACS_INT region_end, | 6169 | ptrdiff_t region_beg, ptrdiff_t region_end, |
| 6166 | EMACS_INT *endptr, enum face_id base_face_id, | 6170 | ptrdiff_t *endptr, enum face_id base_face_id, |
| 6167 | int mouse_p) | 6171 | int mouse_p) |
| 6168 | { | 6172 | { |
| 6169 | Lisp_Object prop, position, end, limit; | 6173 | Lisp_Object prop, position, end, limit; |
| @@ -6246,7 +6250,7 @@ face_at_string_position (struct window *w, Lisp_Object string, | |||
| 6246 | */ | 6250 | */ |
| 6247 | 6251 | ||
| 6248 | int | 6252 | int |
| 6249 | merge_faces (struct frame *f, Lisp_Object face_name, EMACS_INT face_id, | 6253 | merge_faces (struct frame *f, Lisp_Object face_name, int face_id, |
| 6250 | int base_face_id) | 6254 | int base_face_id) |
| 6251 | { | 6255 | { |
| 6252 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 6256 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
diff --git a/src/xfns.c b/src/xfns.c index 998c803a7ad..4a7c17e1152 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1200,7 +1200,7 @@ x_set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1200 | if (FRAME_MINIBUF_ONLY_P (f)) | 1200 | if (FRAME_MINIBUF_ONLY_P (f)) |
| 1201 | return; | 1201 | return; |
| 1202 | 1202 | ||
| 1203 | if (INTEGERP (value)) | 1203 | if (TYPE_RANGED_INTEGERP (int, value)) |
| 1204 | nlines = XINT (value); | 1204 | nlines = XINT (value); |
| 1205 | else | 1205 | else |
| 1206 | nlines = 0; | 1206 | nlines = 0; |
| @@ -1286,8 +1286,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) | |||
| 1286 | if (FRAME_MINIBUF_ONLY_P (f)) | 1286 | if (FRAME_MINIBUF_ONLY_P (f)) |
| 1287 | return; | 1287 | return; |
| 1288 | 1288 | ||
| 1289 | /* Use VALUE only if an integer >= 0. */ | 1289 | /* Use VALUE only if an int >= 0. */ |
| 1290 | if (INTEGERP (value) && XINT (value) >= 0) | 1290 | if (RANGED_INTEGERP (0, value, INT_MAX)) |
| 1291 | nlines = XFASTINT (value); | 1291 | nlines = XFASTINT (value); |
| 1292 | else | 1292 | else |
| 1293 | nlines = 0; | 1293 | nlines = 0; |
| @@ -2787,8 +2787,8 @@ x_icon (struct frame *f, Lisp_Object parms) | |||
| 2787 | icon_y = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); | 2787 | icon_y = x_frame_get_and_record_arg (f, parms, Qicon_top, 0, 0, RES_TYPE_NUMBER); |
| 2788 | if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) | 2788 | if (!EQ (icon_x, Qunbound) && !EQ (icon_y, Qunbound)) |
| 2789 | { | 2789 | { |
| 2790 | CHECK_NUMBER (icon_x); | 2790 | CHECK_TYPE_RANGED_INTEGER (int, icon_x); |
| 2791 | CHECK_NUMBER (icon_y); | 2791 | CHECK_TYPE_RANGED_INTEGER (int, icon_y); |
| 2792 | } | 2792 | } |
| 2793 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) | 2793 | else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) |
| 2794 | error ("Both left and top icon corners of icon must be specified"); | 2794 | error ("Both left and top icon corners of icon must be specified"); |
| @@ -3072,7 +3072,7 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3072 | int minibuffer_only = 0; | 3072 | int minibuffer_only = 0; |
| 3073 | long window_prompting = 0; | 3073 | long window_prompting = 0; |
| 3074 | int width, height; | 3074 | int width, height; |
| 3075 | int count = SPECPDL_INDEX (); | 3075 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3076 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 3076 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 3077 | Lisp_Object display; | 3077 | Lisp_Object display; |
| 3078 | struct x_display_info *dpyinfo = NULL; | 3078 | struct x_display_info *dpyinfo = NULL; |
| @@ -4191,11 +4191,11 @@ FRAME. Default is to change on the edit X window. */) | |||
| 4191 | if (! NILP (format)) | 4191 | if (! NILP (format)) |
| 4192 | { | 4192 | { |
| 4193 | CHECK_NUMBER (format); | 4193 | CHECK_NUMBER (format); |
| 4194 | element_format = XFASTINT (format); | ||
| 4195 | 4194 | ||
| 4196 | if (element_format != 8 && element_format != 16 | 4195 | if (XINT (format) != 8 && XINT (format) != 16 |
| 4197 | && element_format != 32) | 4196 | && XINT (format) != 32) |
| 4198 | error ("FORMAT must be one of 8, 16 or 32"); | 4197 | error ("FORMAT must be one of 8, 16 or 32"); |
| 4198 | element_format = XINT (format); | ||
| 4199 | } | 4199 | } |
| 4200 | 4200 | ||
| 4201 | if (CONSP (value)) | 4201 | if (CONSP (value)) |
| @@ -4553,7 +4553,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4553 | Lisp_Object frame; | 4553 | Lisp_Object frame; |
| 4554 | Lisp_Object name; | 4554 | Lisp_Object name; |
| 4555 | int width, height; | 4555 | int width, height; |
| 4556 | int count = SPECPDL_INDEX (); | 4556 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4557 | struct gcpro gcpro1, gcpro2, gcpro3; | 4557 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 4558 | int face_change_count_before = face_change_count; | 4558 | int face_change_count_before = face_change_count; |
| 4559 | Lisp_Object buffer; | 4559 | Lisp_Object buffer; |
| @@ -4948,7 +4948,7 @@ Text larger than the specified size is clipped. */) | |||
| 4948 | int i, width, height, seen_reversed_p; | 4948 | int i, width, height, seen_reversed_p; |
| 4949 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 4949 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| 4950 | int old_windows_or_buffers_changed = windows_or_buffers_changed; | 4950 | int old_windows_or_buffers_changed = windows_or_buffers_changed; |
| 4951 | int count = SPECPDL_INDEX (); | 4951 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4952 | 4952 | ||
| 4953 | specbind (Qinhibit_redisplay, Qt); | 4953 | specbind (Qinhibit_redisplay, Qt); |
| 4954 | 4954 | ||
| @@ -5058,10 +5058,8 @@ Text larger than the specified size is clipped. */) | |||
| 5058 | w->left_col = w->top_line = make_number (0); | 5058 | w->left_col = w->top_line = make_number (0); |
| 5059 | 5059 | ||
| 5060 | if (CONSP (Vx_max_tooltip_size) | 5060 | if (CONSP (Vx_max_tooltip_size) |
| 5061 | && INTEGERP (XCAR (Vx_max_tooltip_size)) | 5061 | && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) |
| 5062 | && XINT (XCAR (Vx_max_tooltip_size)) > 0 | 5062 | && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) |
| 5063 | && INTEGERP (XCDR (Vx_max_tooltip_size)) | ||
| 5064 | && XINT (XCDR (Vx_max_tooltip_size)) > 0) | ||
| 5065 | { | 5063 | { |
| 5066 | w->total_cols = XCAR (Vx_max_tooltip_size); | 5064 | w->total_cols = XCAR (Vx_max_tooltip_size); |
| 5067 | w->total_lines = XCDR (Vx_max_tooltip_size); | 5065 | w->total_lines = XCDR (Vx_max_tooltip_size); |
| @@ -5207,7 +5205,7 @@ DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0, | |||
| 5207 | Value is t if tooltip was open, nil otherwise. */) | 5205 | Value is t if tooltip was open, nil otherwise. */) |
| 5208 | (void) | 5206 | (void) |
| 5209 | { | 5207 | { |
| 5210 | int count; | 5208 | ptrdiff_t count; |
| 5211 | Lisp_Object deleted, frame, timer; | 5209 | Lisp_Object deleted, frame, timer; |
| 5212 | struct gcpro gcpro1, gcpro2; | 5210 | struct gcpro gcpro1, gcpro2; |
| 5213 | 5211 | ||
| @@ -5349,7 +5347,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5349 | Arg al[10]; | 5347 | Arg al[10]; |
| 5350 | int ac = 0; | 5348 | int ac = 0; |
| 5351 | XmString dir_xmstring, pattern_xmstring; | 5349 | XmString dir_xmstring, pattern_xmstring; |
| 5352 | int count = SPECPDL_INDEX (); | 5350 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5353 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 5351 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 5354 | 5352 | ||
| 5355 | check_x (); | 5353 | check_x (); |
| @@ -5518,7 +5516,7 @@ Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 5518 | char *fn; | 5516 | char *fn; |
| 5519 | Lisp_Object file = Qnil; | 5517 | Lisp_Object file = Qnil; |
| 5520 | Lisp_Object decoded_file; | 5518 | Lisp_Object decoded_file; |
| 5521 | int count = SPECPDL_INDEX (); | 5519 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5522 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 5520 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 5523 | char *cdef_file; | 5521 | char *cdef_file; |
| 5524 | 5522 | ||
| @@ -5581,7 +5579,7 @@ If FRAME is omitted or nil, it defaults to the selected frame. */) | |||
| 5581 | Lisp_Object font_param; | 5579 | Lisp_Object font_param; |
| 5582 | char *default_name = NULL; | 5580 | char *default_name = NULL; |
| 5583 | struct gcpro gcpro1, gcpro2; | 5581 | struct gcpro gcpro1, gcpro2; |
| 5584 | int count = SPECPDL_INDEX (); | 5582 | ptrdiff_t count = SPECPDL_INDEX (); |
| 5585 | 5583 | ||
| 5586 | check_x (); | 5584 | check_x (); |
| 5587 | 5585 | ||
diff --git a/src/xfont.c b/src/xfont.c index 2c3ca911623..8b1e37aa146 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -248,7 +248,7 @@ xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont, | |||
| 248 | } | 248 | } |
| 249 | else if (VECTORP (chars)) | 249 | else if (VECTORP (chars)) |
| 250 | { | 250 | { |
| 251 | int i; | 251 | ptrdiff_t i; |
| 252 | 252 | ||
| 253 | for (i = ASIZE (chars) - 1; i >= 0; i--) | 253 | for (i = ASIZE (chars) - 1; i >= 0; i--) |
| 254 | { | 254 | { |
diff --git a/src/xmenu.c b/src/xmenu.c index cf58e85af10..f7497955e93 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -315,7 +315,7 @@ for instance using the window manager, then this produces a quit and | |||
| 315 | Lisp_Object title; | 315 | Lisp_Object title; |
| 316 | const char *error_name; | 316 | const char *error_name; |
| 317 | Lisp_Object selection; | 317 | Lisp_Object selection; |
| 318 | int specpdl_count = SPECPDL_INDEX (); | 318 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 319 | 319 | ||
| 320 | /* Decode the dialog items from what was specified. */ | 320 | /* Decode the dialog items from what was specified. */ |
| 321 | title = Fcar (contents); | 321 | title = Fcar (contents); |
| @@ -968,7 +968,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) | |||
| 968 | 968 | ||
| 969 | struct buffer *prev = current_buffer; | 969 | struct buffer *prev = current_buffer; |
| 970 | Lisp_Object buffer; | 970 | Lisp_Object buffer; |
| 971 | int specpdl_count = SPECPDL_INDEX (); | 971 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 972 | int previous_menu_items_used = f->menu_bar_items_used; | 972 | int previous_menu_items_used = f->menu_bar_items_used; |
| 973 | Lisp_Object *previous_items | 973 | Lisp_Object *previous_items |
| 974 | = (Lisp_Object *) alloca (previous_menu_items_used | 974 | = (Lisp_Object *) alloca (previous_menu_items_used |
| @@ -1434,7 +1434,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, | |||
| 1434 | GtkWidget *menu; | 1434 | GtkWidget *menu; |
| 1435 | GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */ | 1435 | GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */ |
| 1436 | struct next_popup_x_y popup_x_y; | 1436 | struct next_popup_x_y popup_x_y; |
| 1437 | int specpdl_count = SPECPDL_INDEX (); | 1437 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 1438 | 1438 | ||
| 1439 | if (! FRAME_X_P (f)) | 1439 | if (! FRAME_X_P (f)) |
| 1440 | abort (); | 1440 | abort (); |
| @@ -1590,7 +1590,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, | |||
| 1590 | 1590 | ||
| 1591 | { | 1591 | { |
| 1592 | int fact = 4 * sizeof (LWLIB_ID); | 1592 | int fact = 4 * sizeof (LWLIB_ID); |
| 1593 | int specpdl_count = SPECPDL_INDEX (); | 1593 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 1594 | record_unwind_protect (pop_down_menu, | 1594 | record_unwind_protect (pop_down_menu, |
| 1595 | Fcons (make_number (menu_id >> (fact)), | 1595 | Fcons (make_number (menu_id >> (fact)), |
| 1596 | make_number (menu_id & ~(-1 << (fact))))); | 1596 | make_number (menu_id & ~(-1 << (fact))))); |
| @@ -1909,7 +1909,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) | |||
| 1909 | 1909 | ||
| 1910 | if (menu) | 1910 | if (menu) |
| 1911 | { | 1911 | { |
| 1912 | int specpdl_count = SPECPDL_INDEX (); | 1912 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 1913 | record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); | 1913 | record_unwind_protect (pop_down_menu, make_save_value (menu, 0)); |
| 1914 | 1914 | ||
| 1915 | /* Display the menu. */ | 1915 | /* Display the menu. */ |
| @@ -1965,7 +1965,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) | |||
| 1965 | /* Process events that apply to the dialog box. | 1965 | /* Process events that apply to the dialog box. |
| 1966 | Also handle timers. */ | 1966 | Also handle timers. */ |
| 1967 | { | 1967 | { |
| 1968 | int count = SPECPDL_INDEX (); | 1968 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1969 | int fact = 4 * sizeof (LWLIB_ID); | 1969 | int fact = 4 * sizeof (LWLIB_ID); |
| 1970 | 1970 | ||
| 1971 | /* xdialog_show_unwind is responsible for popping the dialog box down. */ | 1971 | /* xdialog_show_unwind is responsible for popping the dialog box down. */ |
| @@ -2262,7 +2262,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, | |||
| 2262 | int maxwidth; | 2262 | int maxwidth; |
| 2263 | int dummy_int; | 2263 | int dummy_int; |
| 2264 | unsigned int dummy_uint; | 2264 | unsigned int dummy_uint; |
| 2265 | int specpdl_count = SPECPDL_INDEX (); | 2265 | ptrdiff_t specpdl_count = SPECPDL_INDEX (); |
| 2266 | 2266 | ||
| 2267 | if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) | 2267 | if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) |
| 2268 | abort (); | 2268 | abort (); |
| @@ -89,8 +89,8 @@ parse_region (Lisp_Object start, Lisp_Object end, Lisp_Object base_url, int html | |||
| 89 | xmlDoc *doc; | 89 | xmlDoc *doc; |
| 90 | Lisp_Object result = Qnil; | 90 | Lisp_Object result = Qnil; |
| 91 | const char *burl = ""; | 91 | const char *burl = ""; |
| 92 | EMACS_INT bytes; | 92 | ptrdiff_t bytes; |
| 93 | EMACS_INT istart, iend; | 93 | ptrdiff_t istart, iend; |
| 94 | 94 | ||
| 95 | LIBXML_TEST_VERSION; | 95 | LIBXML_TEST_VERSION; |
| 96 | 96 | ||
diff --git a/src/xrdb.c b/src/xrdb.c index 4237ed11c53..0c916da9ff8 100644 --- a/src/xrdb.c +++ b/src/xrdb.c | |||
| @@ -126,7 +126,7 @@ x_get_customization_string (XrmDatabase db, const char *name, | |||
| 126 | Return NULL otherwise. */ | 126 | Return NULL otherwise. */ |
| 127 | 127 | ||
| 128 | static char * | 128 | static char * |
| 129 | magic_file_p (const char *string, EMACS_INT string_len, const char *class, | 129 | magic_file_p (const char *string, ptrdiff_t string_len, const char *class, |
| 130 | const char *escaped_suffix) | 130 | const char *escaped_suffix) |
| 131 | { | 131 | { |
| 132 | char *lang = getenv ("LANG"); | 132 | char *lang = getenv ("LANG"); |
diff --git a/src/xselect.c b/src/xselect.c index adee1872dba..9eee4ee9593 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -81,13 +81,13 @@ static Lisp_Object clean_local_selection_data (Lisp_Object); | |||
| 81 | 81 | ||
| 82 | #ifdef TRACE_SELECTION | 82 | #ifdef TRACE_SELECTION |
| 83 | #define TRACE0(fmt) \ | 83 | #define TRACE0(fmt) \ |
| 84 | fprintf (stderr, "%d: " fmt "\n", getpid ()) | 84 | fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid ()) |
| 85 | #define TRACE1(fmt, a0) \ | 85 | #define TRACE1(fmt, a0) \ |
| 86 | fprintf (stderr, "%d: " fmt "\n", getpid (), a0) | 86 | fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0) |
| 87 | #define TRACE2(fmt, a0, a1) \ | 87 | #define TRACE2(fmt, a0, a1) \ |
| 88 | fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1) | 88 | fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0, a1) |
| 89 | #define TRACE3(fmt, a0, a1, a2) \ | 89 | #define TRACE3(fmt, a0, a1, a2) \ |
| 90 | fprintf (stderr, "%d: " fmt "\n", getpid (), a0, a1, a2) | 90 | fprintf (stderr, "%"pMd": " fmt "\n", (printmax_t) getpid (), a0, a1, a2) |
| 91 | #else | 91 | #else |
| 92 | #define TRACE0(fmt) (void) 0 | 92 | #define TRACE0(fmt) (void) 0 |
| 93 | #define TRACE1(fmt, a0) (void) 0 | 93 | #define TRACE1(fmt, a0) (void) 0 |
| @@ -392,7 +392,6 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 392 | { | 392 | { |
| 393 | Lisp_Object local_value; | 393 | Lisp_Object local_value; |
| 394 | Lisp_Object handler_fn, value, check; | 394 | Lisp_Object handler_fn, value, check; |
| 395 | int count; | ||
| 396 | 395 | ||
| 397 | local_value = LOCAL_SELECTION (selection_symbol, dpyinfo); | 396 | local_value = LOCAL_SELECTION (selection_symbol, dpyinfo); |
| 398 | 397 | ||
| @@ -409,7 +408,7 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, | |||
| 409 | /* Don't allow a quit within the converter. | 408 | /* Don't allow a quit within the converter. |
| 410 | When the user types C-g, he would be surprised | 409 | When the user types C-g, he would be surprised |
| 411 | if by luck it came during a converter. */ | 410 | if by luck it came during a converter. */ |
| 412 | count = SPECPDL_INDEX (); | 411 | ptrdiff_t count = SPECPDL_INDEX (); |
| 413 | specbind (Qinhibit_quit, Qt); | 412 | specbind (Qinhibit_quit, Qt); |
| 414 | 413 | ||
| 415 | CHECK_SYMBOL (target_type); | 414 | CHECK_SYMBOL (target_type); |
| @@ -603,7 +602,7 @@ x_reply_selection_request (struct input_event *event, | |||
| 603 | Window window = SELECTION_EVENT_REQUESTOR (event); | 602 | Window window = SELECTION_EVENT_REQUESTOR (event); |
| 604 | ptrdiff_t bytes_remaining; | 603 | ptrdiff_t bytes_remaining; |
| 605 | int max_bytes = selection_quantum (display); | 604 | int max_bytes = selection_quantum (display); |
| 606 | int count = SPECPDL_INDEX (); | 605 | ptrdiff_t count = SPECPDL_INDEX (); |
| 607 | struct selection_data *cs; | 606 | struct selection_data *cs; |
| 608 | 607 | ||
| 609 | reply->type = SelectionNotify; | 608 | reply->type = SelectionNotify; |
| @@ -792,7 +791,7 @@ x_handle_selection_request (struct input_event *event) | |||
| 792 | Atom property = SELECTION_EVENT_PROPERTY (event); | 791 | Atom property = SELECTION_EVENT_PROPERTY (event); |
| 793 | Lisp_Object local_selection_data; | 792 | Lisp_Object local_selection_data; |
| 794 | int success = 0; | 793 | int success = 0; |
| 795 | int count = SPECPDL_INDEX (); | 794 | ptrdiff_t count = SPECPDL_INDEX (); |
| 796 | GCPRO2 (local_selection_data, target_symbol); | 795 | GCPRO2 (local_selection_data, target_symbol); |
| 797 | 796 | ||
| 798 | if (!dpyinfo) goto DONE; | 797 | if (!dpyinfo) goto DONE; |
| @@ -1140,7 +1139,7 @@ static void | |||
| 1140 | wait_for_property_change (struct prop_location *location) | 1139 | wait_for_property_change (struct prop_location *location) |
| 1141 | { | 1140 | { |
| 1142 | int secs, usecs; | 1141 | int secs, usecs; |
| 1143 | int count = SPECPDL_INDEX (); | 1142 | ptrdiff_t count = SPECPDL_INDEX (); |
| 1144 | 1143 | ||
| 1145 | if (property_change_reply_object) | 1144 | if (property_change_reply_object) |
| 1146 | abort (); | 1145 | abort (); |
| @@ -1701,7 +1700,7 @@ selection_data_to_lisp_data (Display *display, const unsigned char *data, | |||
| 1701 | v = Fmake_vector (make_number (size / 2), make_number (0)); | 1700 | v = Fmake_vector (make_number (size / 2), make_number (0)); |
| 1702 | for (i = 0; i < size / 2; i++) | 1701 | for (i = 0; i < size / 2; i++) |
| 1703 | { | 1702 | { |
| 1704 | EMACS_INT j = ((short *) data) [i]; | 1703 | short j = ((short *) data) [i]; |
| 1705 | Faset (v, make_number (i), make_number (j)); | 1704 | Faset (v, make_number (i), make_number (j)); |
| 1706 | } | 1705 | } |
| 1707 | return v; | 1706 | return v; |
| @@ -2601,13 +2600,12 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from, | |||
| 2601 | if (x_check_property_data (values) == -1) | 2600 | if (x_check_property_data (values) == -1) |
| 2602 | error ("Bad data in VALUES, must be number, cons or string"); | 2601 | error ("Bad data in VALUES, must be number, cons or string"); |
| 2603 | 2602 | ||
| 2604 | event.xclient.type = ClientMessage; | 2603 | if (XINT (format) != 8 && XINT (format) != 16 && XINT (format) != 32) |
| 2605 | event.xclient.format = XFASTINT (format); | ||
| 2606 | |||
| 2607 | if (event.xclient.format != 8 && event.xclient.format != 16 | ||
| 2608 | && event.xclient.format != 32) | ||
| 2609 | error ("FORMAT must be one of 8, 16 or 32"); | 2604 | error ("FORMAT must be one of 8, 16 or 32"); |
| 2610 | 2605 | ||
| 2606 | event.xclient.type = ClientMessage; | ||
| 2607 | event.xclient.format = XINT (format); | ||
| 2608 | |||
| 2611 | if (FRAMEP (dest) || NILP (dest)) | 2609 | if (FRAMEP (dest) || NILP (dest)) |
| 2612 | { | 2610 | { |
| 2613 | struct frame *fdest = check_x_frame (dest); | 2611 | struct frame *fdest = check_x_frame (dest); |
diff --git a/src/xterm.c b/src/xterm.c index 4d3b572ade9..f40deca1e88 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3678,24 +3678,23 @@ x_find_modifier_meanings (struct x_display_info *dpyinfo) | |||
| 3678 | /* Convert between the modifier bits X uses and the modifier bits | 3678 | /* Convert between the modifier bits X uses and the modifier bits |
| 3679 | Emacs uses. */ | 3679 | Emacs uses. */ |
| 3680 | 3680 | ||
| 3681 | EMACS_INT | 3681 | int |
| 3682 | x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state) | 3682 | x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state) |
| 3683 | { | 3683 | { |
| 3684 | EMACS_INT mod_meta = meta_modifier; | 3684 | int mod_meta = meta_modifier; |
| 3685 | EMACS_INT mod_alt = alt_modifier; | 3685 | int mod_alt = alt_modifier; |
| 3686 | EMACS_INT mod_hyper = hyper_modifier; | 3686 | int mod_hyper = hyper_modifier; |
| 3687 | EMACS_INT mod_super = super_modifier; | 3687 | int mod_super = super_modifier; |
| 3688 | Lisp_Object tem; | 3688 | Lisp_Object tem; |
| 3689 | 3689 | ||
| 3690 | tem = Fget (Vx_alt_keysym, Qmodifier_value); | 3690 | tem = Fget (Vx_alt_keysym, Qmodifier_value); |
| 3691 | if (INTEGERP (tem)) mod_alt = XINT (tem); | 3691 | if (INTEGERP (tem)) mod_alt = XINT (tem) & INT_MAX; |
| 3692 | tem = Fget (Vx_meta_keysym, Qmodifier_value); | 3692 | tem = Fget (Vx_meta_keysym, Qmodifier_value); |
| 3693 | if (INTEGERP (tem)) mod_meta = XINT (tem); | 3693 | if (INTEGERP (tem)) mod_meta = XINT (tem) & INT_MAX; |
| 3694 | tem = Fget (Vx_hyper_keysym, Qmodifier_value); | 3694 | tem = Fget (Vx_hyper_keysym, Qmodifier_value); |
| 3695 | if (INTEGERP (tem)) mod_hyper = XINT (tem); | 3695 | if (INTEGERP (tem)) mod_hyper = XINT (tem) & INT_MAX; |
| 3696 | tem = Fget (Vx_super_keysym, Qmodifier_value); | 3696 | tem = Fget (Vx_super_keysym, Qmodifier_value); |
| 3697 | if (INTEGERP (tem)) mod_super = XINT (tem); | 3697 | if (INTEGERP (tem)) mod_super = XINT (tem) & INT_MAX; |
| 3698 | |||
| 3699 | 3698 | ||
| 3700 | return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) | 3699 | return ( ((state & (ShiftMask | dpyinfo->shift_lock_mask)) ? shift_modifier : 0) |
| 3701 | | ((state & ControlMask) ? ctrl_modifier : 0) | 3700 | | ((state & ControlMask) ? ctrl_modifier : 0) |
| @@ -3708,10 +3707,10 @@ x_x_to_emacs_modifiers (struct x_display_info *dpyinfo, int state) | |||
| 3708 | static int | 3707 | static int |
| 3709 | x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state) | 3708 | x_emacs_to_x_modifiers (struct x_display_info *dpyinfo, EMACS_INT state) |
| 3710 | { | 3709 | { |
| 3711 | int mod_meta = meta_modifier; | 3710 | EMACS_INT mod_meta = meta_modifier; |
| 3712 | int mod_alt = alt_modifier; | 3711 | EMACS_INT mod_alt = alt_modifier; |
| 3713 | int mod_hyper = hyper_modifier; | 3712 | EMACS_INT mod_hyper = hyper_modifier; |
| 3714 | int mod_super = super_modifier; | 3713 | EMACS_INT mod_super = super_modifier; |
| 3715 | 3714 | ||
| 3716 | Lisp_Object tem; | 3715 | Lisp_Object tem; |
| 3717 | 3716 | ||
| @@ -6456,9 +6455,10 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, | |||
| 6456 | 6455 | ||
| 6457 | /* Now non-ASCII. */ | 6456 | /* Now non-ASCII. */ |
| 6458 | if (HASH_TABLE_P (Vx_keysym_table) | 6457 | if (HASH_TABLE_P (Vx_keysym_table) |
| 6459 | && (NATNUMP (c = Fgethash (make_number (keysym), | 6458 | && (c = Fgethash (make_number (keysym), |
| 6460 | Vx_keysym_table, | 6459 | Vx_keysym_table, |
| 6461 | Qnil)))) | 6460 | Qnil), |
| 6461 | NATNUMP (c))) | ||
| 6462 | { | 6462 | { |
| 6463 | inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c)) | 6463 | inev.ie.kind = (SINGLE_BYTE_CHAR_P (XFASTINT (c)) |
| 6464 | ? ASCII_KEYSTROKE_EVENT | 6464 | ? ASCII_KEYSTROKE_EVENT |
| @@ -7731,7 +7731,7 @@ x_connection_closed (Display *dpy, const char *error_message) | |||
| 7731 | { | 7731 | { |
| 7732 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); | 7732 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); |
| 7733 | Lisp_Object frame, tail; | 7733 | Lisp_Object frame, tail; |
| 7734 | int idx = SPECPDL_INDEX (); | 7734 | ptrdiff_t idx = SPECPDL_INDEX (); |
| 7735 | 7735 | ||
| 7736 | error_msg = (char *) alloca (strlen (error_message) + 1); | 7736 | error_msg = (char *) alloca (strlen (error_message) + 1); |
| 7737 | strcpy (error_msg, error_message); | 7737 | strcpy (error_msg, error_message); |
diff --git a/src/xterm.h b/src/xterm.h index 11d5d50d952..d244aa4be0b 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -775,8 +775,7 @@ enum | |||
| 775 | struct scroll_bar | 775 | struct scroll_bar |
| 776 | { | 776 | { |
| 777 | /* These fields are shared by all vectors. */ | 777 | /* These fields are shared by all vectors. */ |
| 778 | EMACS_INT size_from_Lisp_Vector_struct; | 778 | struct vectorlike_header header; |
| 779 | struct Lisp_Vector *next_from_Lisp_Vector_struct; | ||
| 780 | 779 | ||
| 781 | /* The window we're a scroll bar for. */ | 780 | /* The window we're a scroll bar for. */ |
| 782 | Lisp_Object window; | 781 | Lisp_Object window; |
| @@ -817,12 +816,6 @@ struct scroll_bar | |||
| 817 | unsigned int fringe_extended_p : 1; | 816 | unsigned int fringe_extended_p : 1; |
| 818 | }; | 817 | }; |
| 819 | 818 | ||
| 820 | /* The number of elements a vector holding a struct scroll_bar needs. */ | ||
| 821 | #define SCROLL_BAR_VEC_SIZE \ | ||
| 822 | ((sizeof (struct scroll_bar) \ | ||
| 823 | - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *)) \ | ||
| 824 | / sizeof (Lisp_Object)) | ||
| 825 | |||
| 826 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ | 819 | /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ |
| 827 | #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) | 820 | #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) |
| 828 | 821 | ||
| @@ -991,7 +984,7 @@ extern void x_mouse_leave (struct x_display_info *); | |||
| 991 | #ifdef USE_X_TOOLKIT | 984 | #ifdef USE_X_TOOLKIT |
| 992 | extern int x_dispatch_event (XEvent *, Display *); | 985 | extern int x_dispatch_event (XEvent *, Display *); |
| 993 | #endif | 986 | #endif |
| 994 | extern EMACS_INT x_x_to_emacs_modifiers (struct x_display_info *, int); | 987 | extern int x_x_to_emacs_modifiers (struct x_display_info *, int); |
| 995 | extern int x_display_pixel_height (struct x_display_info *); | 988 | extern int x_display_pixel_height (struct x_display_info *); |
| 996 | extern int x_display_pixel_width (struct x_display_info *); | 989 | extern int x_display_pixel_width (struct x_display_info *); |
| 997 | 990 | ||