diff options
| author | Paul Eggert | 2011-04-05 22:19:39 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-04-05 22:19:39 -0700 |
| commit | 41cf7d1aec986e1b92ca14231ac4ec242c233d45 (patch) | |
| tree | 7360e455dc2e0043a31fda1d29cc6323aa213104 /src | |
| parent | 1e3cdd8228651f226beb6ac75453968a6c64feff (diff) | |
| parent | b69769da408705e40929b793d79d3bfe6a3a5a48 (diff) | |
| download | emacs-41cf7d1aec986e1b92ca14231ac4ec242c233d45.tar.gz emacs-41cf7d1aec986e1b92ca14231ac4ec242c233d45.zip | |
Fix more problems found by GCC 4.6.0's static checks.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 164 | ||||
| -rw-r--r-- | src/alloc.c | 4 | ||||
| -rw-r--r-- | src/buffer.c | 5 | ||||
| -rw-r--r-- | src/bytecode.c | 8 | ||||
| -rw-r--r-- | src/casefiddle.c | 3 | ||||
| -rw-r--r-- | src/coding.c | 57 | ||||
| -rw-r--r-- | src/composite.c | 16 | ||||
| -rw-r--r-- | src/composite.h | 33 | ||||
| -rw-r--r-- | src/deps.mk | 1 | ||||
| -rw-r--r-- | src/dired.c | 2 | ||||
| -rw-r--r-- | src/eval.c | 14 | ||||
| -rw-r--r-- | src/fileio.c | 72 | ||||
| -rw-r--r-- | src/filelock.c | 38 | ||||
| -rw-r--r-- | src/fns.c | 15 | ||||
| -rw-r--r-- | src/font.c | 27 | ||||
| -rw-r--r-- | src/fontset.c | 11 | ||||
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/image.c | 12 | ||||
| -rw-r--r-- | src/indent.c | 13 | ||||
| -rw-r--r-- | src/intervals.c | 13 | ||||
| -rw-r--r-- | src/keyboard.c | 26 | ||||
| -rw-r--r-- | src/lisp.h | 11 | ||||
| -rw-r--r-- | src/lread.c | 35 | ||||
| -rw-r--r-- | src/menu.c | 2 | ||||
| -rw-r--r-- | src/minibuf.c | 4 | ||||
| -rw-r--r-- | src/print.c | 6 | ||||
| -rw-r--r-- | src/process.c | 71 | ||||
| -rw-r--r-- | src/search.c | 23 | ||||
| -rw-r--r-- | src/sound.c | 2 | ||||
| -rw-r--r-- | src/syntax.c | 7 | ||||
| -rw-r--r-- | src/sysdep.c | 18 | ||||
| -rw-r--r-- | src/term.c | 15 | ||||
| -rw-r--r-- | src/textprop.c | 5 | ||||
| -rw-r--r-- | src/xdisp.c | 1 | ||||
| -rw-r--r-- | src/xfaces.c | 22 | ||||
| -rw-r--r-- | src/xfns.c | 12 | ||||
| -rw-r--r-- | src/xfont.c | 33 | ||||
| -rw-r--r-- | src/xmenu.c | 2 | ||||
| -rw-r--r-- | src/xselect.c | 10 | ||||
| -rw-r--r-- | src/xterm.c | 13 |
40 files changed, 453 insertions, 375 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index d12969fe46a..8a2e2396d74 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,167 @@ | |||
| 1 | 2011-04-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Fix more problems found by GCC 4.6.0's static checks. | ||
| 4 | |||
| 5 | * xmenu.c (Fx_popup_dialog): Don't assume string is free of formats. | ||
| 6 | |||
| 7 | * menu.c (Fx_popup_menu): Don't assume error_name lacks printf formats. | ||
| 8 | |||
| 9 | * lisp.h (message, message_nolog, fatal): Mark as printf-like. | ||
| 10 | |||
| 11 | * xdisp.c (vmessage): Mark as a printf-like function. | ||
| 12 | |||
| 13 | * term.c (vfatal, maybe_fatal): Mark as printf-like functions. | ||
| 14 | |||
| 15 | * sound.c (sound_warning): Don't crash if arg contains a printf format. | ||
| 16 | |||
| 17 | * image.c (tiff_error_handler, tiff_warning_handler): Mark as | ||
| 18 | printf-like functions. | ||
| 19 | (tiff_load): Add casts to remove these marks before passing them | ||
| 20 | to system-supplied API. | ||
| 21 | |||
| 22 | * eval.c (Fsignal): Remove excess argument to 'fatal'. | ||
| 23 | |||
| 24 | * coding.c (EMIT_ONE_BYTE, EMIT_TWO_BYTES): Use unsigned, not int. | ||
| 25 | This avoids several warnings with gcc -Wstrict-overflow. | ||
| 26 | (DECODE_COMPOSITION_RULE): If the rule is invalid, goto invalid_code | ||
| 27 | directly, rather than having caller test rule sign. This avoids | ||
| 28 | some unnecessary tests. | ||
| 29 | * composite.h (COMPOSITION_ENCODE_RULE_VALID): New macro. | ||
| 30 | (COMPOSITION_ENCODE_RULE): Arguments now must be valid. This | ||
| 31 | affects only one use, in DECODE_COMPOSITION_RULE, which is changed. | ||
| 32 | |||
| 33 | * xfont.c (xfont_text_extents): Remove var that was set but not used. | ||
| 34 | (xfont_open): Avoid unnecessary tests. | ||
| 35 | |||
| 36 | * composite.c (composition_gstring_put_cache): Use unsigned integer. | ||
| 37 | |||
| 38 | * composite.h, composite.c (composition_gstring_put_cache): | ||
| 39 | Use EMACS_INT, not int, for length. | ||
| 40 | |||
| 41 | * composite.h (COMPOSITION_DECODE_REFS): New macro, | ||
| 42 | breaking out part of COMPOSITION_DECODE_RULE. | ||
| 43 | (COMPOSITION_DECODE_RULE): Use it. | ||
| 44 | * composite.c (get_composition_id): Remove unused local vars, | ||
| 45 | by using the new macro. | ||
| 46 | |||
| 47 | * textprop.c (set_text_properties_1): Change while to do-while, | ||
| 48 | since the condition is always true at first. | ||
| 49 | |||
| 50 | * intervals.c (graft_intervals_into_buffer): Mark var as used. | ||
| 51 | (interval_deletion_adjustment): Return unsigned value. | ||
| 52 | All uses changed. | ||
| 53 | |||
| 54 | * process.c (list_processes_1, create_pty, read_process_output): | ||
| 55 | (exec_sentinel): Remove vars that were set but not used. | ||
| 56 | (create_pty): Remove unnecessary "volatile"s. | ||
| 57 | (Fnetwork_interface_info): Avoid possibility of int overflow. | ||
| 58 | (read_process_output): Do adaptive read buffering even if carryover. | ||
| 59 | (read_process_output): Simplify nbytes computation if buffered. | ||
| 60 | |||
| 61 | * bytecode.c (exec_byte_code): Rename local to avoid shadowing. | ||
| 62 | |||
| 63 | * syntax.c (scan_words): Remove var that was set but not used. | ||
| 64 | (update_syntax_table): Use unsigned instead of int. | ||
| 65 | |||
| 66 | * lread.c (lisp_file_lexically_bound_p): Use ints rather than endptrs. | ||
| 67 | (lisp_file_lexically_bound_p, read1): Use unsigned instead of int. | ||
| 68 | (safe_to_load_p): Make the end-of-loop test the inverse of the in-loop. | ||
| 69 | |||
| 70 | * print.c (print_error_message): Avoid int overflow. | ||
| 71 | |||
| 72 | * font.c (font_list_entities): Redo for clarity, | ||
| 73 | so that reader need not know FONT_DPI_INDEX + 1 == FONT_SPACING_INDEX. | ||
| 74 | |||
| 75 | * font.c (font_find_for_lface, Ffont_get_glyphs): Remove unused vars. | ||
| 76 | (font_score): Avoid potential overflow in diff calculation. | ||
| 77 | |||
| 78 | * fns.c (substring_both): Remove var that is set but not used. | ||
| 79 | (sxhash): Redo loop for clarity and to avoid wraparound warning. | ||
| 80 | |||
| 81 | * eval.c (funcall_lambda): Rename local to avoid shadowing. | ||
| 82 | |||
| 83 | * alloc.c (mark_object_loop_halt, mark_object): Use size_t, not int. | ||
| 84 | Otherwise, GCC 4.6.0 optimizes the loop check away since the check | ||
| 85 | can always succeed if overflow has undefined behavior. | ||
| 86 | |||
| 87 | * search.c (boyer_moore, wordify): Remove vars set but not used. | ||
| 88 | (wordify): Omit three unnecessary tests. | ||
| 89 | |||
| 90 | * indent.c (MULTIBYTE_BYTES_WIDTH): Don't compute wide_column. | ||
| 91 | All callers changed. This avoids the need for an unused var. | ||
| 92 | |||
| 93 | * casefiddle.c (casify_region): Remove var that is set but not used. | ||
| 94 | |||
| 95 | * dired.c (file_name_completion): Remove var that is set but not used. | ||
| 96 | |||
| 97 | * fileio.c (Finsert_file_contents): Make EOF condition clearer. | ||
| 98 | |||
| 99 | * fileio.c (Finsert_file_contents): Avoid signed integer overflow. | ||
| 100 | (Finsert_file_contents): Remove unnecessary code checking fd. | ||
| 101 | |||
| 102 | * minibuf.c (read_minibuf_noninteractive): Use size_t for sizes. | ||
| 103 | Check for integer overflow on size calculations. | ||
| 104 | |||
| 105 | * buffer.c (Fprevious_overlay_change): Remove var that is set | ||
| 106 | but not used. | ||
| 107 | |||
| 108 | * keyboard.c (menu_bar_items, read_char_minibuf_menu_prompt): | ||
| 109 | Remove vars that are set but not used. | ||
| 110 | (timer_check_2): Don't assume timer-list and idle-timer-list are lists. | ||
| 111 | (timer_check_2): Mark vars as initialized. | ||
| 112 | |||
| 113 | * gtkutil.c (xg_get_file_with_chooser): Mark var as initialized. | ||
| 114 | |||
| 115 | * image.c (lookup_image): Remove var that is set but not used. | ||
| 116 | (xbm_load): Use parse_p, for gcc -Werror=unused-but-set-variable. | ||
| 117 | |||
| 118 | * fontset.c (Finternal_char_font, Ffontset_info): Remove vars | ||
| 119 | that are set but not used. | ||
| 120 | |||
| 121 | * xfns.c (make_invisible_cursor): Don't return garbage | ||
| 122 | if XCreateBitmapFromData fails (Bug#8410). | ||
| 123 | |||
| 124 | * xselect.c (x_get_local_selection, x_handle_property_notify): | ||
| 125 | Remove vars that are set but not used. | ||
| 126 | |||
| 127 | * xfns.c (x_create_tip_frame): Remove var that is set but not used. | ||
| 128 | (make_invisible_cursor): Initialize a possibly-uninitialized variable. | ||
| 129 | |||
| 130 | * xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]: | ||
| 131 | Remove var that is set but not used. | ||
| 132 | (scroll_bar_windows_size): Now size_t, not int. | ||
| 133 | (x_send_scroll_bar_event): Use size_t, not int, for sizes. | ||
| 134 | Check for overflow. | ||
| 135 | |||
| 136 | * xfaces.c (realize_named_face): Remove vars that are set but not used. | ||
| 137 | (map_tty_color) [!defined MSDOS]: Likewise. | ||
| 138 | |||
| 139 | * term.c (tty_write_glyphs): Use size_t; this avoids overflow warning. | ||
| 140 | |||
| 141 | * coding.c: Remove vars that are set but not used. | ||
| 142 | (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused. | ||
| 143 | All callers changed. | ||
| 144 | (decode_coding_utf_8, decode_coding_utf_16 decode_coding_emacs_mule): | ||
| 145 | (decode_coding_iso_2022, encode_coding_sjis, encode_coding_big5): | ||
| 146 | (decode_coding_charset): Remove vars that are set but not used. | ||
| 147 | |||
| 148 | * bytecode.c (Fbyte_code) [!defined BYTE_CODE_SAFE]: Remove var | ||
| 149 | that is set but not used. | ||
| 150 | |||
| 151 | * print.c (print_object): Remove var that is set but not used. | ||
| 152 | |||
| 153 | Replace 2 copies of readlink code with 1 gnulib version (Bug#8401). | ||
| 154 | The gnulib version avoids calling malloc in the usual case, | ||
| 155 | and on 64-bit hosts doesn't have some arbitrary 32-bit limits. | ||
| 156 | * fileio.c (Ffile_symlink_p): Use emacs_readlink. | ||
| 157 | * filelock.c (current_lock_owner): Likewise. | ||
| 158 | * lisp.h (READLINK_BUFSIZE, emacs_readlink): New function. | ||
| 159 | * sysdep.c: Include allocator.h, careadlinkat.h. | ||
| 160 | (emacs_no_realloc_allocator): New static constant. | ||
| 161 | (emacs_readlink): New function. | ||
| 162 | * deps.mk (sysdep.o): Depend on ../lib/allocator.h and on | ||
| 163 | ../lib/careadlinkat.h. | ||
| 164 | |||
| 1 | 2011-04-04 Stefan Monnier <monnier@iro.umontreal.ca> | 165 | 2011-04-04 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 166 | ||
| 3 | * keyboard.c (safe_run_hook_funcall): Fix last change (don't stop at the | 167 | * keyboard.c (safe_run_hook_funcall): Fix last change (don't stop at the |
diff --git a/src/alloc.c b/src/alloc.c index 07f1caae46b..54c4760abab 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -5221,7 +5221,7 @@ int last_marked_index; | |||
| 5221 | links of a list, in mark_object. In debugging, | 5221 | links of a list, in mark_object. In debugging, |
| 5222 | the call to abort will hit a breakpoint. | 5222 | the call to abort will hit a breakpoint. |
| 5223 | Normally this is zero and the check never goes off. */ | 5223 | Normally this is zero and the check never goes off. */ |
| 5224 | static int mark_object_loop_halt; | 5224 | static size_t mark_object_loop_halt; |
| 5225 | 5225 | ||
| 5226 | static void | 5226 | static void |
| 5227 | mark_vectorlike (struct Lisp_Vector *ptr) | 5227 | mark_vectorlike (struct Lisp_Vector *ptr) |
| @@ -5278,7 +5278,7 @@ mark_object (Lisp_Object arg) | |||
| 5278 | void *po; | 5278 | void *po; |
| 5279 | struct mem_node *m; | 5279 | struct mem_node *m; |
| 5280 | #endif | 5280 | #endif |
| 5281 | int cdr_count = 0; | 5281 | size_t cdr_count = 0; |
| 5282 | 5282 | ||
| 5283 | loop: | 5283 | loop: |
| 5284 | 5284 | ||
diff --git a/src/buffer.c b/src/buffer.c index cdcd2ccecff..a0054e32d0a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -4047,7 +4047,6 @@ If there are no overlay boundaries from (point-min) to POS, | |||
| 4047 | the value is (point-min). */) | 4047 | the value is (point-min). */) |
| 4048 | (Lisp_Object pos) | 4048 | (Lisp_Object pos) |
| 4049 | { | 4049 | { |
| 4050 | int noverlays; | ||
| 4051 | EMACS_INT prevpos; | 4050 | EMACS_INT prevpos; |
| 4052 | Lisp_Object *overlay_vec; | 4051 | Lisp_Object *overlay_vec; |
| 4053 | int len; | 4052 | int len; |
| @@ -4065,8 +4064,8 @@ the value is (point-min). */) | |||
| 4065 | /* Put all the overlays we want in a vector in overlay_vec. | 4064 | /* Put all the overlays we want in a vector in overlay_vec. |
| 4066 | Store the length in len. | 4065 | Store the length in len. |
| 4067 | prevpos gets the position of the previous change. */ | 4066 | prevpos gets the position of the previous change. */ |
| 4068 | noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | 4067 | overlays_at (XINT (pos), 1, &overlay_vec, &len, |
| 4069 | (EMACS_INT *) 0, &prevpos, 1); | 4068 | (EMACS_INT *) 0, &prevpos, 1); |
| 4070 | 4069 | ||
| 4071 | xfree (overlay_vec); | 4070 | xfree (overlay_vec); |
| 4072 | return make_number (prevpos); | 4071 | return make_number (prevpos); |
diff --git a/src/bytecode.c b/src/bytecode.c index 5d94cb0fb39..b4a5354a0a4 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -447,8 +447,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 447 | #ifdef BYTE_CODE_SAFE | 447 | #ifdef BYTE_CODE_SAFE |
| 448 | int const_length = XVECTOR (vector)->size; | 448 | int const_length = XVECTOR (vector)->size; |
| 449 | Lisp_Object *stacke; | 449 | Lisp_Object *stacke; |
| 450 | #endif | ||
| 451 | int bytestr_length; | 450 | int bytestr_length; |
| 451 | #endif | ||
| 452 | struct byte_stack stack; | 452 | struct byte_stack stack; |
| 453 | Lisp_Object *top; | 453 | Lisp_Object *top; |
| 454 | Lisp_Object result; | 454 | Lisp_Object result; |
| @@ -475,7 +475,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 475 | convert them back to the originally intended unibyte form. */ | 475 | convert them back to the originally intended unibyte form. */ |
| 476 | bytestr = Fstring_as_unibyte (bytestr); | 476 | bytestr = Fstring_as_unibyte (bytestr); |
| 477 | 477 | ||
| 478 | #ifdef BYTE_CODE_SAFE | ||
| 478 | bytestr_length = SBYTES (bytestr); | 479 | bytestr_length = SBYTES (bytestr); |
| 480 | #endif | ||
| 479 | vectorp = XVECTOR (vector)->contents; | 481 | vectorp = XVECTOR (vector)->contents; |
| 480 | 482 | ||
| 481 | stack.byte_string = bytestr; | 483 | stack.byte_string = bytestr; |
| @@ -936,12 +938,12 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, | |||
| 936 | 938 | ||
| 937 | case Bsave_window_excursion: /* Obsolete since 24.1. */ | 939 | case Bsave_window_excursion: /* Obsolete since 24.1. */ |
| 938 | { | 940 | { |
| 939 | register int count = SPECPDL_INDEX (); | 941 | register int count1 = SPECPDL_INDEX (); |
| 940 | record_unwind_protect (Fset_window_configuration, | 942 | record_unwind_protect (Fset_window_configuration, |
| 941 | Fcurrent_window_configuration (Qnil)); | 943 | Fcurrent_window_configuration (Qnil)); |
| 942 | BEFORE_POTENTIAL_GC (); | 944 | BEFORE_POTENTIAL_GC (); |
| 943 | TOP = Fprogn (TOP); | 945 | TOP = Fprogn (TOP); |
| 944 | unbind_to (count, TOP); | 946 | unbind_to (count1, TOP); |
| 945 | AFTER_POTENTIAL_GC (); | 947 | AFTER_POTENTIAL_GC (); |
| 946 | break; | 948 | break; |
| 947 | } | 949 | } |
diff --git a/src/casefiddle.c b/src/casefiddle.c index 43ecd38dc7d..9f286d73a5e 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c | |||
| @@ -200,7 +200,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) | |||
| 200 | register int inword = flag == CASE_DOWN; | 200 | register int inword = flag == CASE_DOWN; |
| 201 | register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); | 201 | register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 202 | EMACS_INT start, end; | 202 | EMACS_INT start, end; |
| 203 | EMACS_INT start_byte, end_byte; | 203 | EMACS_INT start_byte; |
| 204 | 204 | ||
| 205 | /* Position of first and last changes. */ | 205 | /* Position of first and last changes. */ |
| 206 | EMACS_INT first = -1, last IF_LINT (= 0); | 206 | EMACS_INT first = -1, last IF_LINT (= 0); |
| @@ -222,7 +222,6 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e) | |||
| 222 | modify_region (current_buffer, start, end, 0); | 222 | modify_region (current_buffer, start, end, 0); |
| 223 | record_change (start, end - start); | 223 | record_change (start, end - start); |
| 224 | start_byte = CHAR_TO_BYTE (start); | 224 | start_byte = CHAR_TO_BYTE (start); |
| 225 | end_byte = CHAR_TO_BYTE (end); | ||
| 226 | 225 | ||
| 227 | SETUP_BUFFER_SYNTAX_TABLE(); /* For syntax_prefix_flag_p. */ | 226 | SETUP_BUFFER_SYNTAX_TABLE(); /* For syntax_prefix_flag_p. */ |
| 228 | 227 | ||
diff --git a/src/coding.c b/src/coding.c index 9e28a1c9f9b..555c29cbdf3 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -753,7 +753,7 @@ static struct coding_system coding_categories[coding_category_max]; | |||
| 753 | produced_chars++; \ | 753 | produced_chars++; \ |
| 754 | if (multibytep) \ | 754 | if (multibytep) \ |
| 755 | { \ | 755 | { \ |
| 756 | int ch = (c); \ | 756 | unsigned ch = (c); \ |
| 757 | if (ch >= 0x80) \ | 757 | if (ch >= 0x80) \ |
| 758 | ch = BYTE8_TO_CHAR (ch); \ | 758 | ch = BYTE8_TO_CHAR (ch); \ |
| 759 | CHAR_STRING_ADVANCE (ch, dst); \ | 759 | CHAR_STRING_ADVANCE (ch, dst); \ |
| @@ -770,7 +770,7 @@ static struct coding_system coding_categories[coding_category_max]; | |||
| 770 | produced_chars += 2; \ | 770 | produced_chars += 2; \ |
| 771 | if (multibytep) \ | 771 | if (multibytep) \ |
| 772 | { \ | 772 | { \ |
| 773 | int ch; \ | 773 | unsigned ch; \ |
| 774 | \ | 774 | \ |
| 775 | ch = (c1); \ | 775 | ch = (c1); \ |
| 776 | if (ch >= 0x80) \ | 776 | if (ch >= 0x80) \ |
| @@ -1296,13 +1296,10 @@ decode_coding_utf_8 (struct coding_system *coding) | |||
| 1296 | int consumed_chars = 0, consumed_chars_base = 0; | 1296 | int consumed_chars = 0, consumed_chars_base = 0; |
| 1297 | int multibytep = coding->src_multibyte; | 1297 | int multibytep = coding->src_multibyte; |
| 1298 | enum utf_bom_type bom = CODING_UTF_8_BOM (coding); | 1298 | enum utf_bom_type bom = CODING_UTF_8_BOM (coding); |
| 1299 | Lisp_Object attr, charset_list; | ||
| 1300 | int eol_dos = | 1299 | int eol_dos = |
| 1301 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 1300 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 1302 | int byte_after_cr = -1; | 1301 | int byte_after_cr = -1; |
| 1303 | 1302 | ||
| 1304 | CODING_GET_INFO (coding, attr, charset_list); | ||
| 1305 | |||
| 1306 | if (bom != utf_without_bom) | 1303 | if (bom != utf_without_bom) |
| 1307 | { | 1304 | { |
| 1308 | int c1, c2, c3; | 1305 | int c1, c2, c3; |
| @@ -1610,13 +1607,10 @@ decode_coding_utf_16 (struct coding_system *coding) | |||
| 1610 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); | 1607 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); |
| 1611 | enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); | 1608 | enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding); |
| 1612 | int surrogate = CODING_UTF_16_SURROGATE (coding); | 1609 | int surrogate = CODING_UTF_16_SURROGATE (coding); |
| 1613 | Lisp_Object attr, charset_list; | ||
| 1614 | int eol_dos = | 1610 | int eol_dos = |
| 1615 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 1611 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 1616 | int byte_after_cr1 = -1, byte_after_cr2 = -1; | 1612 | int byte_after_cr1 = -1, byte_after_cr2 = -1; |
| 1617 | 1613 | ||
| 1618 | CODING_GET_INFO (coding, attr, charset_list); | ||
| 1619 | |||
| 1620 | if (bom == utf_with_bom) | 1614 | if (bom == utf_with_bom) |
| 1621 | { | 1615 | { |
| 1622 | int c, c1, c2; | 1616 | int c, c1, c2; |
| @@ -1736,11 +1730,8 @@ encode_coding_utf_16 (struct coding_system *coding) | |||
| 1736 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); | 1730 | enum utf_bom_type bom = CODING_UTF_16_BOM (coding); |
| 1737 | int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian; | 1731 | int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian; |
| 1738 | int produced_chars = 0; | 1732 | int produced_chars = 0; |
| 1739 | Lisp_Object attrs, charset_list; | ||
| 1740 | int c; | 1733 | int c; |
| 1741 | 1734 | ||
| 1742 | CODING_GET_INFO (coding, attrs, charset_list); | ||
| 1743 | |||
| 1744 | if (bom != utf_without_bom) | 1735 | if (bom != utf_without_bom) |
| 1745 | { | 1736 | { |
| 1746 | ASSURE_DESTINATION (safe_room); | 1737 | ASSURE_DESTINATION (safe_room); |
| @@ -2342,7 +2333,6 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2342 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); | 2333 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3); |
| 2343 | int consumed_chars = 0, consumed_chars_base; | 2334 | int consumed_chars = 0, consumed_chars_base; |
| 2344 | int multibytep = coding->src_multibyte; | 2335 | int multibytep = coding->src_multibyte; |
| 2345 | Lisp_Object attrs, charset_list; | ||
| 2346 | int char_offset = coding->produced_char; | 2336 | int char_offset = coding->produced_char; |
| 2347 | int last_offset = char_offset; | 2337 | int last_offset = char_offset; |
| 2348 | int last_id = charset_ascii; | 2338 | int last_id = charset_ascii; |
| @@ -2351,8 +2341,6 @@ decode_coding_emacs_mule (struct coding_system *coding) | |||
| 2351 | int byte_after_cr = -1; | 2341 | int byte_after_cr = -1; |
| 2352 | struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; | 2342 | struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status; |
| 2353 | 2343 | ||
| 2354 | CODING_GET_INFO (coding, attrs, charset_list); | ||
| 2355 | |||
| 2356 | if (cmp_status->state != COMPOSING_NO) | 2344 | if (cmp_status->state != COMPOSING_NO) |
| 2357 | { | 2345 | { |
| 2358 | int i; | 2346 | int i; |
| @@ -3265,15 +3253,14 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3265 | */ | 3253 | */ |
| 3266 | 3254 | ||
| 3267 | /* Decode a composition rule C1 and maybe one more byte from the | 3255 | /* Decode a composition rule C1 and maybe one more byte from the |
| 3268 | source, and set RULE to the encoded composition rule, NBYTES to the | 3256 | source, and set RULE to the encoded composition rule. If the rule |
| 3269 | length of the composition rule. If the rule is invalid, set RULE | 3257 | is invalid, goto invalid_code. */ |
| 3270 | to some negative value. */ | ||
| 3271 | 3258 | ||
| 3272 | #define DECODE_COMPOSITION_RULE(rule, nbytes) \ | 3259 | #define DECODE_COMPOSITION_RULE(rule) \ |
| 3273 | do { \ | 3260 | do { \ |
| 3274 | rule = c1 - 32; \ | 3261 | rule = c1 - 32; \ |
| 3275 | if (rule < 0) \ | 3262 | if (rule < 0) \ |
| 3276 | break; \ | 3263 | goto invalid_code; \ |
| 3277 | if (rule < 81) /* old format (before ver.21) */ \ | 3264 | if (rule < 81) /* old format (before ver.21) */ \ |
| 3278 | { \ | 3265 | { \ |
| 3279 | int gref = (rule) / 9; \ | 3266 | int gref = (rule) / 9; \ |
| @@ -3281,17 +3268,16 @@ detect_coding_iso_2022 (struct coding_system *coding, | |||
| 3281 | if (gref == 4) gref = 10; \ | 3268 | if (gref == 4) gref = 10; \ |
| 3282 | if (nref == 4) nref = 10; \ | 3269 | if (nref == 4) nref = 10; \ |
| 3283 | rule = COMPOSITION_ENCODE_RULE (gref, nref); \ | 3270 | rule = COMPOSITION_ENCODE_RULE (gref, nref); \ |
| 3284 | nbytes = 1; \ | ||
| 3285 | } \ | 3271 | } \ |
| 3286 | else /* new format (after ver.21) */ \ | 3272 | else /* new format (after ver.21) */ \ |
| 3287 | { \ | 3273 | { \ |
| 3288 | int b; \ | 3274 | int b; \ |
| 3289 | \ | 3275 | \ |
| 3290 | ONE_MORE_BYTE (b); \ | 3276 | ONE_MORE_BYTE (b); \ |
| 3277 | if (! COMPOSITION_ENCODE_RULE_VALID (rule - 81, b - 32)) \ | ||
| 3278 | goto invalid_code; \ | ||
| 3291 | rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \ | 3279 | rule = COMPOSITION_ENCODE_RULE (rule - 81, b - 32); \ |
| 3292 | if (rule >= 0) \ | 3280 | rule += 0x100; /* Distinguish it from the old format. */ \ |
| 3293 | rule += 0x100; /* to destinguish it from the old format */ \ | ||
| 3294 | nbytes = 2; \ | ||
| 3295 | } \ | 3281 | } \ |
| 3296 | } while (0) | 3282 | } while (0) |
| 3297 | 3283 | ||
| @@ -3476,7 +3462,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3476 | struct charset *charset; | 3462 | struct charset *charset; |
| 3477 | int c; | 3463 | int c; |
| 3478 | struct composition_status *cmp_status = CODING_ISO_CMP_STATUS (coding); | 3464 | struct composition_status *cmp_status = CODING_ISO_CMP_STATUS (coding); |
| 3479 | Lisp_Object attrs, charset_list; | 3465 | Lisp_Object attrs = CODING_ID_ATTRS (coding->id); |
| 3480 | int char_offset = coding->produced_char; | 3466 | int char_offset = coding->produced_char; |
| 3481 | int last_offset = char_offset; | 3467 | int last_offset = char_offset; |
| 3482 | int last_id = charset_ascii; | 3468 | int last_id = charset_ascii; |
| @@ -3485,10 +3471,7 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3485 | int byte_after_cr = -1; | 3471 | int byte_after_cr = -1; |
| 3486 | int i; | 3472 | int i; |
| 3487 | 3473 | ||
| 3488 | CODING_GET_INFO (coding, attrs, charset_list); | ||
| 3489 | setup_iso_safe_charsets (attrs); | 3474 | setup_iso_safe_charsets (attrs); |
| 3490 | /* Charset list may have been changed. */ | ||
| 3491 | charset_list = CODING_ATTR_CHARSET_LIST (attrs); | ||
| 3492 | coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs)); | 3475 | coding->safe_charsets = SDATA (CODING_ATTR_SAFE_CHARSETS (attrs)); |
| 3493 | 3476 | ||
| 3494 | if (cmp_status->state != COMPOSING_NO) | 3477 | if (cmp_status->state != COMPOSING_NO) |
| @@ -3558,11 +3541,9 @@ decode_coding_iso_2022 (struct coding_system *coding) | |||
| 3558 | || cmp_status->state == COMPOSING_COMPONENT_RULE) | 3541 | || cmp_status->state == COMPOSING_COMPONENT_RULE) |
| 3559 | && c1 != ISO_CODE_ESC) | 3542 | && c1 != ISO_CODE_ESC) |
| 3560 | { | 3543 | { |
| 3561 | int rule, nbytes; | 3544 | int rule; |
| 3562 | 3545 | ||
| 3563 | DECODE_COMPOSITION_RULE (rule, nbytes); | 3546 | DECODE_COMPOSITION_RULE (rule); |
| 3564 | if (rule < 0) | ||
| 3565 | goto invalid_code; | ||
| 3566 | STORE_COMPOSITION_RULE (rule); | 3547 | STORE_COMPOSITION_RULE (rule); |
| 3567 | continue; | 3548 | continue; |
| 3568 | } | 3549 | } |
| @@ -4878,13 +4859,12 @@ encode_coding_sjis (struct coding_system *coding) | |||
| 4878 | int produced_chars = 0; | 4859 | int produced_chars = 0; |
| 4879 | Lisp_Object attrs, charset_list, val; | 4860 | Lisp_Object attrs, charset_list, val; |
| 4880 | int ascii_compatible; | 4861 | int ascii_compatible; |
| 4881 | struct charset *charset_roman, *charset_kanji, *charset_kana; | 4862 | struct charset *charset_kanji, *charset_kana; |
| 4882 | struct charset *charset_kanji2; | 4863 | struct charset *charset_kanji2; |
| 4883 | int c; | 4864 | int c; |
| 4884 | 4865 | ||
| 4885 | CODING_GET_INFO (coding, attrs, charset_list); | 4866 | CODING_GET_INFO (coding, attrs, charset_list); |
| 4886 | val = charset_list; | 4867 | val = XCDR (charset_list); |
| 4887 | charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | ||
| 4888 | charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | 4868 | charset_kana = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
| 4889 | charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | 4869 | charset_kanji = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); |
| 4890 | charset_kanji2 = NILP (val) ? NULL : CHARSET_FROM_ID (XINT (XCAR (val))); | 4870 | charset_kanji2 = NILP (val) ? NULL : CHARSET_FROM_ID (XINT (XCAR (val))); |
| @@ -4970,12 +4950,11 @@ encode_coding_big5 (struct coding_system *coding) | |||
| 4970 | int produced_chars = 0; | 4950 | int produced_chars = 0; |
| 4971 | Lisp_Object attrs, charset_list, val; | 4951 | Lisp_Object attrs, charset_list, val; |
| 4972 | int ascii_compatible; | 4952 | int ascii_compatible; |
| 4973 | struct charset *charset_roman, *charset_big5; | 4953 | struct charset *charset_big5; |
| 4974 | int c; | 4954 | int c; |
| 4975 | 4955 | ||
| 4976 | CODING_GET_INFO (coding, attrs, charset_list); | 4956 | CODING_GET_INFO (coding, attrs, charset_list); |
| 4977 | val = charset_list; | 4957 | val = XCDR (charset_list); |
| 4978 | charset_roman = CHARSET_FROM_ID (XINT (XCAR (val))), val = XCDR (val); | ||
| 4979 | charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val))); | 4958 | charset_big5 = CHARSET_FROM_ID (XINT (XCAR (val))); |
| 4980 | ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); | 4959 | ascii_compatible = ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)); |
| 4981 | 4960 | ||
| @@ -5433,7 +5412,8 @@ decode_coding_charset (struct coding_system *coding) | |||
| 5433 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); | 5412 | = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2); |
| 5434 | int consumed_chars = 0, consumed_chars_base; | 5413 | int consumed_chars = 0, consumed_chars_base; |
| 5435 | int multibytep = coding->src_multibyte; | 5414 | int multibytep = coding->src_multibyte; |
| 5436 | Lisp_Object attrs, charset_list, valids; | 5415 | Lisp_Object attrs = CODING_ID_ATTRS (coding->id); |
| 5416 | Lisp_Object valids; | ||
| 5437 | int char_offset = coding->produced_char; | 5417 | int char_offset = coding->produced_char; |
| 5438 | int last_offset = char_offset; | 5418 | int last_offset = char_offset; |
| 5439 | int last_id = charset_ascii; | 5419 | int last_id = charset_ascii; |
| @@ -5441,7 +5421,6 @@ decode_coding_charset (struct coding_system *coding) | |||
| 5441 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); | 5421 | !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos); |
| 5442 | int byte_after_cr = -1; | 5422 | int byte_after_cr = -1; |
| 5443 | 5423 | ||
| 5444 | CODING_GET_INFO (coding, attrs, charset_list); | ||
| 5445 | valids = AREF (attrs, coding_attr_charset_valids); | 5424 | valids = AREF (attrs, coding_attr_charset_valids); |
| 5446 | 5425 | ||
| 5447 | while (1) | 5426 | while (1) |
diff --git a/src/composite.c b/src/composite.c index bc5644a4612..c18f9e8b56e 100644 --- a/src/composite.c +++ b/src/composite.c | |||
| @@ -354,7 +354,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 354 | 354 | ||
| 355 | for (i = 1; i < glyph_len; i += 2) | 355 | for (i = 1; i < glyph_len; i += 2) |
| 356 | { | 356 | { |
| 357 | int rule, gref, nref, xoff, yoff; | 357 | int rule, gref, nref; |
| 358 | int this_width; | 358 | int this_width; |
| 359 | float this_left; | 359 | float this_left; |
| 360 | 360 | ||
| @@ -376,7 +376,7 @@ get_composition_id (EMACS_INT charpos, EMACS_INT bytepos, EMACS_INT nchars, | |||
| 376 | | | | 376 | | | |
| 377 | 6---7---8 -- descent | 377 | 6---7---8 -- descent |
| 378 | */ | 378 | */ |
| 379 | COMPOSITION_DECODE_RULE (rule, gref, nref, xoff, yoff); | 379 | COMPOSITION_DECODE_REFS (rule, gref, nref); |
| 380 | this_left = (leftmost | 380 | this_left = (leftmost |
| 381 | + (gref % 3) * (rightmost - leftmost) / 2.0 | 381 | + (gref % 3) * (rightmost - leftmost) / 2.0 |
| 382 | - (nref % 3) * this_width / 2.0); | 382 | - (nref % 3) * this_width / 2.0); |
| @@ -661,22 +661,22 @@ gstring_lookup_cache (Lisp_Object header) | |||
| 661 | } | 661 | } |
| 662 | 662 | ||
| 663 | Lisp_Object | 663 | Lisp_Object |
| 664 | composition_gstring_put_cache (Lisp_Object gstring, int len) | 664 | composition_gstring_put_cache (Lisp_Object gstring, EMACS_INT len) |
| 665 | { | 665 | { |
| 666 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); | 666 | struct Lisp_Hash_Table *h = XHASH_TABLE (gstring_hash_table); |
| 667 | unsigned hash; | 667 | unsigned hash; |
| 668 | Lisp_Object header, copy; | 668 | Lisp_Object header, copy; |
| 669 | int i; | 669 | EMACS_INT i; |
| 670 | 670 | ||
| 671 | header = LGSTRING_HEADER (gstring); | 671 | header = LGSTRING_HEADER (gstring); |
| 672 | hash = h->hashfn (h, header); | 672 | hash = h->hashfn (h, header); |
| 673 | if (len < 0) | 673 | if (len < 0) |
| 674 | { | 674 | { |
| 675 | len = LGSTRING_GLYPH_LEN (gstring); | 675 | EMACS_UINT j, glyph_len = LGSTRING_GLYPH_LEN (gstring); |
| 676 | for (i = 0; i < len; i++) | 676 | for (j = 0; j < glyph_len; j++) |
| 677 | if (NILP (LGSTRING_GLYPH (gstring, i))) | 677 | if (NILP (LGSTRING_GLYPH (gstring, j))) |
| 678 | break; | 678 | break; |
| 679 | len = i; | 679 | len = j; |
| 680 | } | 680 | } |
| 681 | 681 | ||
| 682 | copy = Fmake_vector (make_number (len + 2), Qnil); | 682 | copy = Fmake_vector (make_number (len + 2), Qnil); |
diff --git a/src/composite.h b/src/composite.h index b8943fbfdc3..cfb5db0dc6a 100644 --- a/src/composite.h +++ b/src/composite.h | |||
| @@ -126,27 +126,37 @@ extern Lisp_Object composition_temp; | |||
| 126 | ->contents[(n) * 2 - 1]) | 126 | ->contents[(n) * 2 - 1]) |
| 127 | 127 | ||
| 128 | /* Decode encoded composition rule RULE_CODE into GREF (global | 128 | /* Decode encoded composition rule RULE_CODE into GREF (global |
| 129 | reference point code), NREF (new reference point code), XOFF | 129 | reference point code), NREF (new ref. point code). Don't check RULE_CODE; |
| 130 | (horizontal offset) YOFF (vertical offset). Don't check RULE_CODE, | ||
| 131 | always set GREF and NREF to valid values. By side effect, | 130 | always set GREF and NREF to valid values. By side effect, |
| 132 | RULE_CODE is modified. */ | 131 | RULE_CODE is modified. */ |
| 133 | 132 | ||
| 134 | #define COMPOSITION_DECODE_RULE(rule_code, gref, nref, xoff, yoff) \ | 133 | #define COMPOSITION_DECODE_REFS(rule_code, gref, nref) \ |
| 135 | do { \ | 134 | do { \ |
| 136 | xoff = (rule_code) >> 16; \ | ||
| 137 | yoff = ((rule_code) >> 8) & 0xFF; \ | ||
| 138 | rule_code &= 0xFF; \ | 135 | rule_code &= 0xFF; \ |
| 139 | gref = (rule_code) / 12; \ | 136 | gref = (rule_code) / 12; \ |
| 140 | if (gref > 12) gref = 11; \ | 137 | if (gref > 12) gref = 11; \ |
| 141 | nref = (rule_code) % 12; \ | 138 | nref = (rule_code) % 12; \ |
| 142 | } while (0) | 139 | } while (0) |
| 143 | 140 | ||
| 141 | /* Like COMPOSITION_DECODE_REFS (RULE_CODE, GREF, NREF), but also | ||
| 142 | decode RULE_CODE into XOFF and YOFF (vertical offset). */ | ||
| 143 | |||
| 144 | #define COMPOSITION_DECODE_RULE(rule_code, gref, nref, xoff, yoff) \ | ||
| 145 | do { \ | ||
| 146 | xoff = (rule_code) >> 16; \ | ||
| 147 | yoff = ((rule_code) >> 8) & 0xFF; \ | ||
| 148 | COMPOSITION_DECODE_REFS (rule_code, gref, nref); \ | ||
| 149 | } while (0) | ||
| 150 | |||
| 151 | /* Nonzero if the global reference point GREF and new reference point NREF are | ||
| 152 | valid. */ | ||
| 153 | #define COMPOSITION_ENCODE_RULE_VALID(gref, nref) \ | ||
| 154 | ((unsigned) (gref) < 12 && (unsigned) (nref) < 12) | ||
| 155 | |||
| 144 | /* Return encoded composition rule for the pair of global reference | 156 | /* Return encoded composition rule for the pair of global reference |
| 145 | point GREF and new reference point NREF. If arguments are invalid, | 157 | point GREF and new reference point NREF. Arguments must be valid. */ |
| 146 | return -1. */ | ||
| 147 | #define COMPOSITION_ENCODE_RULE(gref, nref) \ | 158 | #define COMPOSITION_ENCODE_RULE(gref, nref) \ |
| 148 | ((unsigned) (gref) < 12 && (unsigned) (nref) < 12 \ | 159 | ((gref) * 12 + (nref)) |
| 149 | ? (gref) * 12 + (nref) : -1) | ||
| 150 | 160 | ||
| 151 | /* Data structure that records information about a composition | 161 | /* Data structure that records information about a composition |
| 152 | currently used in some buffers or strings. | 162 | currently used in some buffers or strings. |
| @@ -281,7 +291,7 @@ enum lglyph_indices | |||
| 281 | else \ | 291 | else \ |
| 282 | ASET ((g), LGLYPH_IX_CODE, make_number (val)); \ | 292 | ASET ((g), LGLYPH_IX_CODE, make_number (val)); \ |
| 283 | } while (0) | 293 | } while (0) |
| 284 | 294 | ||
| 285 | #define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val)) | 295 | #define LGLYPH_SET_WIDTH(g, val) ASET ((g), LGLYPH_IX_WIDTH, make_number (val)) |
| 286 | #define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number (val)) | 296 | #define LGLYPH_SET_LBEARING(g, val) ASET ((g), LGLYPH_IX_LBEARING, make_number (val)) |
| 287 | #define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_number (val)) | 297 | #define LGLYPH_SET_RBEARING(g, val) ASET ((g), LGLYPH_IX_RBEARING, make_number (val)) |
| @@ -300,7 +310,7 @@ struct composition_it; | |||
| 300 | struct face; | 310 | struct face; |
| 301 | struct font_metrics; | 311 | struct font_metrics; |
| 302 | 312 | ||
| 303 | extern Lisp_Object composition_gstring_put_cache (Lisp_Object, int); | 313 | extern Lisp_Object composition_gstring_put_cache (Lisp_Object, EMACS_INT); |
| 304 | extern Lisp_Object composition_gstring_from_id (int); | 314 | extern Lisp_Object composition_gstring_from_id (int); |
| 305 | extern int composition_gstring_p (Lisp_Object); | 315 | extern int composition_gstring_p (Lisp_Object); |
| 306 | extern int composition_gstring_width (Lisp_Object, EMACS_INT, EMACS_INT, | 316 | extern int composition_gstring_width (Lisp_Object, EMACS_INT, EMACS_INT, |
| @@ -321,4 +331,3 @@ extern EMACS_INT composition_adjust_point (EMACS_INT, EMACS_INT); | |||
| 321 | EXFUN (Fcomposition_get_gstring, 4); | 331 | EXFUN (Fcomposition_get_gstring, 4); |
| 322 | 332 | ||
| 323 | #endif /* not EMACS_COMPOSITE_H */ | 333 | #endif /* not EMACS_COMPOSITE_H */ |
| 324 | |||
diff --git a/src/deps.mk b/src/deps.mk index d84e80dca44..be5d3694fca 100644 --- a/src/deps.mk +++ b/src/deps.mk | |||
| @@ -187,6 +187,7 @@ sysdep.o: sysdep.c syssignal.h systty.h systime.h syswait.h blockinput.h \ | |||
| 187 | process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ | 187 | process.h dispextern.h termhooks.h termchar.h termopts.h coding.h \ |
| 188 | frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ | 188 | frame.h atimer.h window.h msdos.h dosfns.h keyboard.h cm.h lisp.h \ |
| 189 | globals.h $(config_h) composite.h sysselect.h gnutls.h \ | 189 | globals.h $(config_h) composite.h sysselect.h gnutls.h \ |
| 190 | ../lib/allocator.h ../lib/careadlinkat.h \ | ||
| 190 | ../lib/unistd.h ../lib/ignore-value.h | 191 | ../lib/unistd.h ../lib/ignore-value.h |
| 191 | term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ | 192 | term.o: term.c termchar.h termhooks.h termopts.h lisp.h globals.h $(config_h) \ |
| 192 | cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ | 193 | cm.h frame.h disptab.h keyboard.h character.h charset.h coding.h ccl.h \ |
diff --git a/src/dired.c b/src/dired.c index 176f14925b4..186cfd1420b 100644 --- a/src/dired.c +++ b/src/dired.c | |||
| @@ -639,8 +639,6 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v | |||
| 639 | 639 | ||
| 640 | { | 640 | { |
| 641 | Lisp_Object regexps; | 641 | Lisp_Object regexps; |
| 642 | Lisp_Object zero; | ||
| 643 | XSETFASTINT (zero, 0); | ||
| 644 | 642 | ||
| 645 | /* Ignore this element if it fails to match all the regexps. */ | 643 | /* Ignore this element if it fails to match all the regexps. */ |
| 646 | if (completion_ignore_case) | 644 | if (completion_ignore_case) |
diff --git a/src/eval.c b/src/eval.c index 9b6605eed2e..93da7799bec 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -1757,7 +1757,7 @@ See also the function `condition-case'. */) | |||
| 1757 | data = Fcons (error_symbol, data); | 1757 | data = Fcons (error_symbol, data); |
| 1758 | 1758 | ||
| 1759 | string = Ferror_message_string (data); | 1759 | string = Ferror_message_string (data); |
| 1760 | fatal ("%s", SDATA (string), 0); | 1760 | fatal ("%s", SDATA (string)); |
| 1761 | } | 1761 | } |
| 1762 | 1762 | ||
| 1763 | /* Internal version of Fsignal that never returns. | 1763 | /* Internal version of Fsignal that never returns. |
| @@ -3206,26 +3206,26 @@ funcall_lambda (Lisp_Object fun, size_t nargs, | |||
| 3206 | optional = 1; | 3206 | optional = 1; |
| 3207 | else | 3207 | else |
| 3208 | { | 3208 | { |
| 3209 | Lisp_Object val; | 3209 | Lisp_Object arg; |
| 3210 | if (rest) | 3210 | if (rest) |
| 3211 | { | 3211 | { |
| 3212 | val = Flist (nargs - i, &arg_vector[i]); | 3212 | arg = Flist (nargs - i, &arg_vector[i]); |
| 3213 | i = nargs; | 3213 | i = nargs; |
| 3214 | } | 3214 | } |
| 3215 | else if (i < nargs) | 3215 | else if (i < nargs) |
| 3216 | val = arg_vector[i++]; | 3216 | arg = arg_vector[i++]; |
| 3217 | else if (!optional) | 3217 | else if (!optional) |
| 3218 | xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs)); | 3218 | xsignal2 (Qwrong_number_of_arguments, fun, make_number (nargs)); |
| 3219 | else | 3219 | else |
| 3220 | val = Qnil; | 3220 | arg = Qnil; |
| 3221 | 3221 | ||
| 3222 | /* Bind the argument. */ | 3222 | /* Bind the argument. */ |
| 3223 | if (!NILP (lexenv) && SYMBOLP (next)) | 3223 | if (!NILP (lexenv) && SYMBOLP (next)) |
| 3224 | /* Lexically bind NEXT by adding it to the lexenv alist. */ | 3224 | /* Lexically bind NEXT by adding it to the lexenv alist. */ |
| 3225 | lexenv = Fcons (Fcons (next, val), lexenv); | 3225 | lexenv = Fcons (Fcons (next, arg), lexenv); |
| 3226 | else | 3226 | else |
| 3227 | /* Dynamically bind NEXT. */ | 3227 | /* Dynamically bind NEXT. */ |
| 3228 | specbind (next, val); | 3228 | specbind (next, arg); |
| 3229 | } | 3229 | } |
| 3230 | } | 3230 | } |
| 3231 | 3231 | ||
diff --git a/src/fileio.c b/src/fileio.c index 85431dfd5b1..dec53968947 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -2579,9 +2579,8 @@ points to a nonexistent file. */) | |||
| 2579 | { | 2579 | { |
| 2580 | Lisp_Object handler; | 2580 | Lisp_Object handler; |
| 2581 | char *buf; | 2581 | char *buf; |
| 2582 | int bufsize; | ||
| 2583 | int valsize; | ||
| 2584 | Lisp_Object val; | 2582 | Lisp_Object val; |
| 2583 | char readlink_buf[READLINK_BUFSIZE]; | ||
| 2585 | 2584 | ||
| 2586 | CHECK_STRING (filename); | 2585 | CHECK_STRING (filename); |
| 2587 | filename = Fexpand_file_name (filename, Qnil); | 2586 | filename = Fexpand_file_name (filename, Qnil); |
| @@ -2594,36 +2593,15 @@ points to a nonexistent file. */) | |||
| 2594 | 2593 | ||
| 2595 | filename = ENCODE_FILE (filename); | 2594 | filename = ENCODE_FILE (filename); |
| 2596 | 2595 | ||
| 2597 | bufsize = 50; | 2596 | buf = emacs_readlink (SSDATA (filename), readlink_buf); |
| 2598 | buf = NULL; | 2597 | if (! buf) |
| 2599 | do | 2598 | return Qnil; |
| 2600 | { | ||
| 2601 | bufsize *= 2; | ||
| 2602 | buf = (char *) xrealloc (buf, bufsize); | ||
| 2603 | memset (buf, 0, bufsize); | ||
| 2604 | |||
| 2605 | errno = 0; | ||
| 2606 | valsize = readlink (SSDATA (filename), buf, bufsize); | ||
| 2607 | if (valsize == -1) | ||
| 2608 | { | ||
| 2609 | #ifdef ERANGE | ||
| 2610 | /* HP-UX reports ERANGE if buffer is too small. */ | ||
| 2611 | if (errno == ERANGE) | ||
| 2612 | valsize = bufsize; | ||
| 2613 | else | ||
| 2614 | #endif | ||
| 2615 | { | ||
| 2616 | xfree (buf); | ||
| 2617 | return Qnil; | ||
| 2618 | } | ||
| 2619 | } | ||
| 2620 | } | ||
| 2621 | while (valsize >= bufsize); | ||
| 2622 | 2599 | ||
| 2623 | val = make_string (buf, valsize); | 2600 | val = build_string (buf); |
| 2624 | if (buf[0] == '/' && strchr (buf, ':')) | 2601 | if (buf[0] == '/' && strchr (buf, ':')) |
| 2625 | val = concat2 (build_string ("/:"), val); | 2602 | val = concat2 (build_string ("/:"), val); |
| 2626 | xfree (buf); | 2603 | if (buf != readlink_buf) |
| 2604 | xfree (buf); | ||
| 2627 | val = DECODE_FILE (val); | 2605 | val = DECODE_FILE (val); |
| 2628 | return val; | 2606 | return val; |
| 2629 | } | 2607 | } |
| @@ -3225,7 +3203,6 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3225 | if (stat (SSDATA (filename), &st) < 0) | 3203 | if (stat (SSDATA (filename), &st) < 0) |
| 3226 | #endif /* WINDOWSNT */ | 3204 | #endif /* WINDOWSNT */ |
| 3227 | { | 3205 | { |
| 3228 | if (fd >= 0) emacs_close (fd); | ||
| 3229 | badopen: | 3206 | badopen: |
| 3230 | if (NILP (visit)) | 3207 | if (NILP (visit)) |
| 3231 | report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); | 3208 | report_file_error ("Opening input file", Fcons (orig_filename, Qnil)); |
| @@ -3261,9 +3238,16 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3261 | 3238 | ||
| 3262 | record_unwind_protect (close_file_unwind, make_number (fd)); | 3239 | record_unwind_protect (close_file_unwind, make_number (fd)); |
| 3263 | 3240 | ||
| 3264 | /* Can happen on any platform that uses long as type of off_t, but allows | 3241 | |
| 3265 | file sizes to exceed 2Gb, so give a suitable message. */ | 3242 | /* Arithmetic overflow can occur if an Emacs integer cannot represent the |
| 3266 | if (! not_regular && st.st_size < 0) | 3243 | file size, or if the calculations below overflow. The calculations below |
| 3244 | double the file size twice, so check that it can be multiplied by 4 | ||
| 3245 | safely. | ||
| 3246 | |||
| 3247 | Also check whether the size is negative, which can happen on a platform | ||
| 3248 | that allows file sizes greater than the maximum off_t value. */ | ||
| 3249 | if (! not_regular | ||
| 3250 | && ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM / 4)) | ||
| 3267 | error ("Maximum buffer size exceeded"); | 3251 | error ("Maximum buffer size exceeded"); |
| 3268 | 3252 | ||
| 3269 | /* Prevent redisplay optimizations. */ | 3253 | /* Prevent redisplay optimizations. */ |
| @@ -3290,18 +3274,6 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3290 | { | 3274 | { |
| 3291 | XSETINT (end, st.st_size); | 3275 | XSETINT (end, st.st_size); |
| 3292 | 3276 | ||
| 3293 | /* Arithmetic overflow can occur if an Emacs integer cannot | ||
| 3294 | represent the file size, or if the calculations below | ||
| 3295 | overflow. The calculations below double the file size | ||
| 3296 | twice, so check that it can be multiplied by 4 safely. */ | ||
| 3297 | if (XINT (end) != st.st_size | ||
| 3298 | /* Actually, it should test either INT_MAX or LONG_MAX | ||
| 3299 | depending on which one is used for EMACS_INT. But in | ||
| 3300 | any case, in practice, this test is redundant with the | ||
| 3301 | one above. | ||
| 3302 | || st.st_size > INT_MAX / 4 */) | ||
| 3303 | error ("Maximum buffer size exceeded"); | ||
| 3304 | |||
| 3305 | /* The file size returned from stat may be zero, but data | 3277 | /* The file size returned from stat may be zero, but data |
| 3306 | may be readable nonetheless, for example when this is a | 3278 | may be readable nonetheless, for example when this is a |
| 3307 | file in the /proc filesystem. */ | 3279 | file in the /proc filesystem. */ |
| @@ -3635,6 +3607,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3635 | EMACS_INT bufpos; | 3607 | EMACS_INT bufpos; |
| 3636 | unsigned char *decoded; | 3608 | unsigned char *decoded; |
| 3637 | EMACS_INT temp; | 3609 | EMACS_INT temp; |
| 3610 | EMACS_INT this = 0; | ||
| 3638 | int this_count = SPECPDL_INDEX (); | 3611 | int this_count = SPECPDL_INDEX (); |
| 3639 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); | 3612 | int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); |
| 3640 | Lisp_Object conversion_buffer; | 3613 | Lisp_Object conversion_buffer; |
| @@ -3661,7 +3634,6 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3661 | /* try is reserved in some compilers (Microsoft C) */ | 3634 | /* try is reserved in some compilers (Microsoft C) */ |
| 3662 | EMACS_INT trytry = min (total - how_much, | 3635 | EMACS_INT trytry = min (total - how_much, |
| 3663 | READ_BUF_SIZE - unprocessed); | 3636 | READ_BUF_SIZE - unprocessed); |
| 3664 | EMACS_INT this; | ||
| 3665 | 3637 | ||
| 3666 | /* Allow quitting out of the actual I/O. */ | 3638 | /* Allow quitting out of the actual I/O. */ |
| 3667 | immediate_quit = 1; | 3639 | immediate_quit = 1; |
| @@ -3670,11 +3642,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3670 | immediate_quit = 0; | 3642 | immediate_quit = 0; |
| 3671 | 3643 | ||
| 3672 | if (this <= 0) | 3644 | if (this <= 0) |
| 3673 | { | 3645 | break; |
| 3674 | if (this < 0) | ||
| 3675 | how_much = this; | ||
| 3676 | break; | ||
| 3677 | } | ||
| 3678 | 3646 | ||
| 3679 | how_much += this; | 3647 | how_much += this; |
| 3680 | 3648 | ||
| @@ -3697,7 +3665,7 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 3697 | /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0 | 3665 | /* At this point, HOW_MUCH should equal TOTAL, or should be <= 0 |
| 3698 | if we couldn't read the file. */ | 3666 | if we couldn't read the file. */ |
| 3699 | 3667 | ||
| 3700 | if (how_much < 0) | 3668 | if (this < 0) |
| 3701 | error ("IO error reading %s: %s", | 3669 | error ("IO error reading %s: %s", |
| 3702 | SDATA (orig_filename), emacs_strerror (errno)); | 3670 | SDATA (orig_filename), emacs_strerror (errno)); |
| 3703 | 3671 | ||
diff --git a/src/filelock.c b/src/filelock.c index 2138eaa502b..13b27c72f19 100644 --- a/src/filelock.c +++ b/src/filelock.c | |||
| @@ -396,36 +396,16 @@ within_one_second (time_t a, time_t b) | |||
| 396 | static int | 396 | static int |
| 397 | current_lock_owner (lock_info_type *owner, char *lfname) | 397 | current_lock_owner (lock_info_type *owner, char *lfname) |
| 398 | { | 398 | { |
| 399 | int len, ret; | 399 | int ret; |
| 400 | size_t len; | ||
| 400 | int local_owner = 0; | 401 | int local_owner = 0; |
| 401 | char *at, *dot, *colon; | 402 | char *at, *dot, *colon; |
| 402 | char *lfinfo = 0; | 403 | char readlink_buf[READLINK_BUFSIZE]; |
| 403 | int bufsize = 50; | 404 | char *lfinfo = emacs_readlink (lfname, readlink_buf); |
| 404 | /* Read arbitrarily-long contents of symlink. Similar code in | ||
| 405 | file-symlink-p in fileio.c. */ | ||
| 406 | do | ||
| 407 | { | ||
| 408 | bufsize *= 2; | ||
| 409 | lfinfo = (char *) xrealloc (lfinfo, bufsize); | ||
| 410 | errno = 0; | ||
| 411 | len = readlink (lfname, lfinfo, bufsize); | ||
| 412 | #ifdef ERANGE | ||
| 413 | /* HP-UX reports ERANGE if the buffer is too small. */ | ||
| 414 | if (len == -1 && errno == ERANGE) | ||
| 415 | len = bufsize; | ||
| 416 | #endif | ||
| 417 | } | ||
| 418 | while (len >= bufsize); | ||
| 419 | 405 | ||
| 420 | /* If nonexistent lock file, all is well; otherwise, got strange error. */ | 406 | /* If nonexistent lock file, all is well; otherwise, got strange error. */ |
| 421 | if (len == -1) | 407 | if (!lfinfo) |
| 422 | { | 408 | return errno == ENOENT ? 0 : -1; |
| 423 | xfree (lfinfo); | ||
| 424 | return errno == ENOENT ? 0 : -1; | ||
| 425 | } | ||
| 426 | |||
| 427 | /* Link info exists, so `len' is its length. Null terminate. */ | ||
| 428 | lfinfo[len] = 0; | ||
| 429 | 409 | ||
| 430 | /* Even if the caller doesn't want the owner info, we still have to | 410 | /* Even if the caller doesn't want the owner info, we still have to |
| 431 | read it to determine return value, so allocate it. */ | 411 | read it to determine return value, so allocate it. */ |
| @@ -441,7 +421,8 @@ current_lock_owner (lock_info_type *owner, char *lfname) | |||
| 441 | dot = strrchr (lfinfo, '.'); | 421 | dot = strrchr (lfinfo, '.'); |
| 442 | if (!at || !dot) | 422 | if (!at || !dot) |
| 443 | { | 423 | { |
| 444 | xfree (lfinfo); | 424 | if (lfinfo != readlink_buf) |
| 425 | xfree (lfinfo); | ||
| 445 | return -1; | 426 | return -1; |
| 446 | } | 427 | } |
| 447 | len = at - lfinfo; | 428 | len = at - lfinfo; |
| @@ -467,7 +448,8 @@ current_lock_owner (lock_info_type *owner, char *lfname) | |||
| 467 | owner->host[len] = 0; | 448 | owner->host[len] = 0; |
| 468 | 449 | ||
| 469 | /* We're done looking at the link info. */ | 450 | /* We're done looking at the link info. */ |
| 470 | xfree (lfinfo); | 451 | if (lfinfo != readlink_buf) |
| 452 | xfree (lfinfo); | ||
| 471 | 453 | ||
| 472 | /* On current host? */ | 454 | /* On current host? */ |
| 473 | if (STRINGP (Fsystem_name ()) | 455 | if (STRINGP (Fsystem_name ()) |
| @@ -1247,17 +1247,10 @@ substring_both (Lisp_Object string, EMACS_INT from, EMACS_INT from_byte, | |||
| 1247 | { | 1247 | { |
| 1248 | Lisp_Object res; | 1248 | Lisp_Object res; |
| 1249 | EMACS_INT size; | 1249 | EMACS_INT size; |
| 1250 | EMACS_INT size_byte; | ||
| 1251 | 1250 | ||
| 1252 | CHECK_VECTOR_OR_STRING (string); | 1251 | CHECK_VECTOR_OR_STRING (string); |
| 1253 | 1252 | ||
| 1254 | if (STRINGP (string)) | 1253 | size = STRINGP (string) ? SCHARS (string) : ASIZE (string); |
| 1255 | { | ||
| 1256 | size = SCHARS (string); | ||
| 1257 | size_byte = SBYTES (string); | ||
| 1258 | } | ||
| 1259 | else | ||
| 1260 | size = ASIZE (string); | ||
| 1261 | 1254 | ||
| 1262 | if (!(0 <= from && from <= to && to <= size)) | 1255 | if (!(0 <= from && from <= to && to <= size)) |
| 1263 | args_out_of_range_3 (string, make_number (from), make_number (to)); | 1256 | args_out_of_range_3 (string, make_number (from), make_number (to)); |
| @@ -4226,9 +4219,9 @@ sxhash (Lisp_Object obj, int depth) | |||
| 4226 | { | 4219 | { |
| 4227 | double val = XFLOAT_DATA (obj); | 4220 | double val = XFLOAT_DATA (obj); |
| 4228 | unsigned char *p = (unsigned char *) &val; | 4221 | unsigned char *p = (unsigned char *) &val; |
| 4229 | unsigned char *e = p + sizeof val; | 4222 | size_t i; |
| 4230 | for (hash = 0; p < e; ++p) | 4223 | for (hash = 0, i = 0; i < sizeof val; i++) |
| 4231 | hash = SXHASH_COMBINE (hash, *p); | 4224 | hash = SXHASH_COMBINE (hash, p[i]); |
| 4232 | break; | 4225 | break; |
| 4233 | } | 4226 | } |
| 4234 | 4227 | ||
diff --git a/src/font.c b/src/font.c index 6b2e2f2712d..e01f67a95f6 100644 --- a/src/font.c +++ b/src/font.c | |||
| @@ -2076,12 +2076,11 @@ font_score (Lisp_Object entity, Lisp_Object *spec_prop) | |||
| 2076 | for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++) | 2076 | for (i = FONT_WEIGHT_INDEX; i <= FONT_WIDTH_INDEX; i++) |
| 2077 | if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i])) | 2077 | if (! NILP (spec_prop[i]) && ! EQ (AREF (entity, i), spec_prop[i])) |
| 2078 | { | 2078 | { |
| 2079 | int diff = (XINT (AREF (entity, i)) >> 8) - (XINT (spec_prop[i]) >> 8); | 2079 | EMACS_INT diff = ((XINT (AREF (entity, i)) >> 8) |
| 2080 | 2080 | - (XINT (spec_prop[i]) >> 8)); | |
| 2081 | if (diff < 0) | 2081 | if (diff < 0) |
| 2082 | diff = - diff; | 2082 | diff = - diff; |
| 2083 | if (diff > 0) | 2083 | score |= min (diff, 127) << sort_shift_bits[i]; |
| 2084 | score |= min (diff, 127) << sort_shift_bits[i]; | ||
| 2085 | } | 2084 | } |
| 2086 | 2085 | ||
| 2087 | /* Score the size. Maximum difference is 127. */ | 2086 | /* Score the size. Maximum difference is 127. */ |
| @@ -2698,14 +2697,12 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec) | |||
| 2698 | for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) | 2697 | for (i = FONT_FOUNDRY_INDEX; i <= FONT_REGISTRY_INDEX; i++) |
| 2699 | ASET (scratch_font_spec, i, AREF (spec, i)); | 2698 | ASET (scratch_font_spec, i, AREF (spec, i)); |
| 2700 | for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) | 2699 | for (i = FONT_WEIGHT_INDEX; i < FONT_EXTRA_INDEX; i++) |
| 2701 | { | 2700 | if (i != FONT_SPACING_INDEX) |
| 2702 | ASET (scratch_font_spec, i, Qnil); | 2701 | { |
| 2703 | if (! NILP (AREF (spec, i))) | 2702 | ASET (scratch_font_spec, i, Qnil); |
| 2704 | need_filtering = 1; | 2703 | if (! NILP (AREF (spec, i))) |
| 2705 | if (i == FONT_DPI_INDEX) | 2704 | need_filtering = 1; |
| 2706 | /* Skip FONT_SPACING_INDEX */ | 2705 | } |
| 2707 | i++; | ||
| 2708 | } | ||
| 2709 | ASET (scratch_font_spec, FONT_SPACING_INDEX, AREF (spec, FONT_SPACING_INDEX)); | 2706 | ASET (scratch_font_spec, FONT_SPACING_INDEX, AREF (spec, FONT_SPACING_INDEX)); |
| 2710 | ASET (scratch_font_spec, FONT_EXTRA_INDEX, AREF (spec, FONT_EXTRA_INDEX)); | 2707 | ASET (scratch_font_spec, FONT_EXTRA_INDEX, AREF (spec, FONT_EXTRA_INDEX)); |
| 2711 | 2708 | ||
| @@ -3071,7 +3068,7 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) | |||
| 3071 | { | 3068 | { |
| 3072 | Lisp_Object work; | 3069 | Lisp_Object work; |
| 3073 | Lisp_Object frame, entities, val; | 3070 | Lisp_Object frame, entities, val; |
| 3074 | Lisp_Object size, foundry[3], *family, registry[3], adstyle[3]; | 3071 | Lisp_Object foundry[3], *family, registry[3], adstyle[3]; |
| 3075 | int pixel_size; | 3072 | int pixel_size; |
| 3076 | int i, j, k, l; | 3073 | int i, j, k, l; |
| 3077 | 3074 | ||
| @@ -3102,7 +3099,6 @@ font_find_for_lface (FRAME_PTR f, Lisp_Object *attrs, Lisp_Object spec, int c) | |||
| 3102 | work = Fcopy_font_spec (spec); | 3099 | work = Fcopy_font_spec (spec); |
| 3103 | ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); | 3100 | ASET (work, FONT_TYPE_INDEX, AREF (spec, FONT_TYPE_INDEX)); |
| 3104 | XSETFRAME (frame, f); | 3101 | XSETFRAME (frame, f); |
| 3105 | size = AREF (spec, FONT_SIZE_INDEX); | ||
| 3106 | pixel_size = font_pixel_size (f, spec); | 3102 | pixel_size = font_pixel_size (f, spec); |
| 3107 | if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX])) | 3103 | if (pixel_size == 0 && INTEGERP (attrs[LFACE_HEIGHT_INDEX])) |
| 3108 | { | 3104 | { |
| @@ -4723,10 +4719,9 @@ the corresponding element is nil. */) | |||
| 4723 | Lisp_Object g; | 4719 | Lisp_Object g; |
| 4724 | int c = XFASTINT (chars[i]); | 4720 | int c = XFASTINT (chars[i]); |
| 4725 | unsigned code; | 4721 | unsigned code; |
| 4726 | EMACS_INT cod; | ||
| 4727 | struct font_metrics metrics; | 4722 | struct font_metrics metrics; |
| 4728 | 4723 | ||
| 4729 | cod = code = font->driver->encode_char (font, c); | 4724 | code = font->driver->encode_char (font, c); |
| 4730 | if (code == FONT_INVALID_CODE) | 4725 | if (code == FONT_INVALID_CODE) |
| 4731 | continue; | 4726 | continue; |
| 4732 | g = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); | 4727 | g = Fmake_vector (make_number (LGLYPH_SIZE), Qnil); |
diff --git a/src/fontset.c b/src/fontset.c index b5d8a0db434..eea65535c78 100644 --- a/src/fontset.c +++ b/src/fontset.c | |||
| @@ -1815,7 +1815,6 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 1815 | int c; | 1815 | int c; |
| 1816 | struct frame *f; | 1816 | struct frame *f; |
| 1817 | struct face *face; | 1817 | struct face *face; |
| 1818 | int cs_id; | ||
| 1819 | 1818 | ||
| 1820 | if (NILP (position)) | 1819 | if (NILP (position)) |
| 1821 | { | 1820 | { |
| @@ -1824,11 +1823,10 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 1824 | f = XFRAME (selected_frame); | 1823 | f = XFRAME (selected_frame); |
| 1825 | face_id = lookup_basic_face (f, DEFAULT_FACE_ID); | 1824 | face_id = lookup_basic_face (f, DEFAULT_FACE_ID); |
| 1826 | pos = -1; | 1825 | pos = -1; |
| 1827 | cs_id = -1; | ||
| 1828 | } | 1826 | } |
| 1829 | else | 1827 | else |
| 1830 | { | 1828 | { |
| 1831 | Lisp_Object window, charset; | 1829 | Lisp_Object window; |
| 1832 | struct window *w; | 1830 | struct window *w; |
| 1833 | 1831 | ||
| 1834 | CHECK_NUMBER_COERCE_MARKER (position); | 1832 | CHECK_NUMBER_COERCE_MARKER (position); |
| @@ -1850,11 +1848,6 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, | |||
| 1850 | f = XFRAME (w->frame); | 1848 | f = XFRAME (w->frame); |
| 1851 | face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, | 1849 | face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, |
| 1852 | pos + 100, 0, -1); | 1850 | pos + 100, 0, -1); |
| 1853 | charset = Fget_char_property (position, Qcharset, Qnil); | ||
| 1854 | if (CHARSETP (charset)) | ||
| 1855 | cs_id = XINT (CHARSET_SYMBOL_ID (charset)); | ||
| 1856 | else | ||
| 1857 | cs_id = -1; | ||
| 1858 | } | 1851 | } |
| 1859 | if (! CHAR_VALID_P (c, 0)) | 1852 | if (! CHAR_VALID_P (c, 0)) |
| 1860 | return Qnil; | 1853 | return Qnil; |
| @@ -1900,7 +1893,6 @@ information about the derived fonts from the default fontset. The | |||
| 1900 | format is the same as above. */) | 1893 | format is the same as above. */) |
| 1901 | (Lisp_Object fontset, Lisp_Object frame) | 1894 | (Lisp_Object fontset, Lisp_Object frame) |
| 1902 | { | 1895 | { |
| 1903 | FRAME_PTR f; | ||
| 1904 | Lisp_Object *realized[2], fontsets[2], tables[2]; | 1896 | Lisp_Object *realized[2], fontsets[2], tables[2]; |
| 1905 | Lisp_Object val, elt; | 1897 | Lisp_Object val, elt; |
| 1906 | int c, i, j, k; | 1898 | int c, i, j, k; |
| @@ -1908,7 +1900,6 @@ format is the same as above. */) | |||
| 1908 | (*check_window_system_func) (); | 1900 | (*check_window_system_func) (); |
| 1909 | 1901 | ||
| 1910 | fontset = check_fontset_name (fontset, &frame); | 1902 | fontset = check_fontset_name (fontset, &frame); |
| 1911 | f = XFRAME (frame); | ||
| 1912 | 1903 | ||
| 1913 | /* Recode fontsets realized on FRAME from the base fontset FONTSET | 1904 | /* Recode fontsets realized on FRAME from the base fontset FONTSET |
| 1914 | in the table `realized'. */ | 1905 | in the table `realized'. */ |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 4e5ecce76c7..4b53915c416 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -1704,7 +1704,7 @@ xg_get_file_with_chooser (FRAME_PTR f, | |||
| 1704 | { | 1704 | { |
| 1705 | char msgbuf[1024]; | 1705 | char msgbuf[1024]; |
| 1706 | 1706 | ||
| 1707 | GtkWidget *filewin, *wtoggle, *wbox, *wmessage; | 1707 | GtkWidget *filewin, *wtoggle, *wbox, *wmessage IF_LINT (= NULL); |
| 1708 | GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)); | 1708 | GtkWindow *gwin = GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)); |
| 1709 | GtkFileChooserAction action = (mustmatch_p ? | 1709 | GtkFileChooserAction action = (mustmatch_p ? |
| 1710 | GTK_FILE_CHOOSER_ACTION_OPEN : | 1710 | GTK_FILE_CHOOSER_ACTION_OPEN : |
diff --git a/src/image.c b/src/image.c index b37ba398d83..260bc6eb260 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1708,7 +1708,6 @@ postprocess_image (struct frame *f, struct image *img) | |||
| 1708 | int | 1708 | int |
| 1709 | lookup_image (struct frame *f, Lisp_Object spec) | 1709 | lookup_image (struct frame *f, Lisp_Object spec) |
| 1710 | { | 1710 | { |
| 1711 | struct image_cache *c; | ||
| 1712 | struct image *img; | 1711 | struct image *img; |
| 1713 | unsigned hash; | 1712 | unsigned hash; |
| 1714 | EMACS_TIME now; | 1713 | EMACS_TIME now; |
| @@ -1718,8 +1717,6 @@ lookup_image (struct frame *f, Lisp_Object spec) | |||
| 1718 | xassert (FRAME_WINDOW_P (f)); | 1717 | xassert (FRAME_WINDOW_P (f)); |
| 1719 | xassert (valid_image_p (spec)); | 1718 | xassert (valid_image_p (spec)); |
| 1720 | 1719 | ||
| 1721 | c = FRAME_IMAGE_CACHE (f); | ||
| 1722 | |||
| 1723 | /* Look up SPEC in the hash table of the image cache. */ | 1720 | /* Look up SPEC in the hash table of the image cache. */ |
| 1724 | hash = sxhash (spec, 0); | 1721 | hash = sxhash (spec, 0); |
| 1725 | img = search_image_cache (f, spec, hash); | 1722 | img = search_image_cache (f, spec, hash); |
| @@ -2878,6 +2875,7 @@ xbm_load (struct frame *f, struct image *img) | |||
| 2878 | /* Parse the image specification. */ | 2875 | /* Parse the image specification. */ |
| 2879 | memcpy (fmt, xbm_format, sizeof fmt); | 2876 | memcpy (fmt, xbm_format, sizeof fmt); |
| 2880 | parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); | 2877 | parsed_p = parse_image_spec (img->spec, fmt, XBM_LAST, Qxbm); |
| 2878 | (void) parsed_p; | ||
| 2881 | xassert (parsed_p); | 2879 | xassert (parsed_p); |
| 2882 | 2880 | ||
| 2883 | /* Get specified width, and height. */ | 2881 | /* Get specified width, and height. */ |
| @@ -6716,6 +6714,8 @@ tiff_size_of_memory (thandle_t data) | |||
| 6716 | } | 6714 | } |
| 6717 | 6715 | ||
| 6718 | 6716 | ||
| 6717 | static void tiff_error_handler (const char *, const char *, va_list) | ||
| 6718 | ATTRIBUTE_FORMAT_PRINTF (2, 0); | ||
| 6719 | static void | 6719 | static void |
| 6720 | tiff_error_handler (const char *title, const char *format, va_list ap) | 6720 | tiff_error_handler (const char *title, const char *format, va_list ap) |
| 6721 | { | 6721 | { |
| @@ -6728,6 +6728,8 @@ tiff_error_handler (const char *title, const char *format, va_list ap) | |||
| 6728 | } | 6728 | } |
| 6729 | 6729 | ||
| 6730 | 6730 | ||
| 6731 | static void tiff_warning_handler (const char *, const char *, va_list) | ||
| 6732 | ATTRIBUTE_FORMAT_PRINTF (2, 0); | ||
| 6731 | static void | 6733 | static void |
| 6732 | tiff_warning_handler (const char *title, const char *format, va_list ap) | 6734 | tiff_warning_handler (const char *title, const char *format, va_list ap) |
| 6733 | { | 6735 | { |
| @@ -6759,8 +6761,8 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6759 | specified_file = image_spec_value (img->spec, QCfile, NULL); | 6761 | specified_file = image_spec_value (img->spec, QCfile, NULL); |
| 6760 | specified_data = image_spec_value (img->spec, QCdata, NULL); | 6762 | specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 6761 | 6763 | ||
| 6762 | fn_TIFFSetErrorHandler (tiff_error_handler); | 6764 | fn_TIFFSetErrorHandler ((TIFFErrorHandler) tiff_error_handler); |
| 6763 | fn_TIFFSetWarningHandler (tiff_warning_handler); | 6765 | fn_TIFFSetWarningHandler ((TIFFErrorHandler) tiff_warning_handler); |
| 6764 | 6766 | ||
| 6765 | if (NILP (specified_data)) | 6767 | if (NILP (specified_data)) |
| 6766 | { | 6768 | { |
diff --git a/src/indent.c b/src/indent.c index b3028a27b38..8732b2ca5cc 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -271,14 +271,13 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob | |||
| 271 | 271 | ||
| 272 | DP is a display table or NULL. | 272 | DP is a display table or NULL. |
| 273 | 273 | ||
| 274 | This macro is used in current_column_1, Fmove_to_column, and | 274 | This macro is used in scan_for_column and in |
| 275 | compute_motion. */ | 275 | compute_motion. */ |
| 276 | 276 | ||
| 277 | #define MULTIBYTE_BYTES_WIDTH(p, dp, bytes, width) \ | 277 | #define MULTIBYTE_BYTES_WIDTH(p, dp, bytes, width) \ |
| 278 | do { \ | 278 | do { \ |
| 279 | int ch; \ | 279 | int ch; \ |
| 280 | \ | 280 | \ |
| 281 | wide_column = 0; \ | ||
| 282 | ch = STRING_CHAR_AND_LENGTH (p, bytes); \ | 281 | ch = STRING_CHAR_AND_LENGTH (p, bytes); \ |
| 283 | if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ | 282 | if (BYTES_BY_CHAR_HEAD (*p) != bytes) \ |
| 284 | width = bytes * 4; \ | 283 | width = bytes * 4; \ |
| @@ -288,8 +287,6 @@ skip_invisible (EMACS_INT pos, EMACS_INT *next_boundary_p, EMACS_INT to, Lisp_Ob | |||
| 288 | width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ | 287 | width = XVECTOR (DISP_CHAR_VECTOR (dp, ch))->size; \ |
| 289 | else \ | 288 | else \ |
| 290 | width = CHAR_WIDTH (ch); \ | 289 | width = CHAR_WIDTH (ch); \ |
| 291 | if (width > 1) \ | ||
| 292 | wide_column = width; \ | ||
| 293 | } \ | 290 | } \ |
| 294 | } while (0) | 291 | } while (0) |
| 295 | 292 | ||
| @@ -666,7 +663,7 @@ scan_for_column (EMACS_INT *endpos, EMACS_INT *goalcol, EMACS_INT *prevcol) | |||
| 666 | { | 663 | { |
| 667 | /* Start of multi-byte form. */ | 664 | /* Start of multi-byte form. */ |
| 668 | unsigned char *ptr; | 665 | unsigned char *ptr; |
| 669 | int bytes, width, wide_column; | 666 | int bytes, width; |
| 670 | 667 | ||
| 671 | ptr = BYTE_POS_ADDR (scan_byte); | 668 | ptr = BYTE_POS_ADDR (scan_byte); |
| 672 | MULTIBYTE_BYTES_WIDTH (ptr, dp, bytes, width); | 669 | MULTIBYTE_BYTES_WIDTH (ptr, dp, bytes, width); |
| @@ -1657,14 +1654,14 @@ compute_motion (EMACS_INT from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ | |||
| 1657 | { | 1654 | { |
| 1658 | /* Start of multi-byte form. */ | 1655 | /* Start of multi-byte form. */ |
| 1659 | unsigned char *ptr; | 1656 | unsigned char *ptr; |
| 1660 | int mb_bytes, mb_width, wide_column; | 1657 | int mb_bytes, mb_width; |
| 1661 | 1658 | ||
| 1662 | pos_byte--; /* rewind POS_BYTE */ | 1659 | pos_byte--; /* rewind POS_BYTE */ |
| 1663 | ptr = BYTE_POS_ADDR (pos_byte); | 1660 | ptr = BYTE_POS_ADDR (pos_byte); |
| 1664 | MULTIBYTE_BYTES_WIDTH (ptr, dp, mb_bytes, mb_width); | 1661 | MULTIBYTE_BYTES_WIDTH (ptr, dp, mb_bytes, mb_width); |
| 1665 | pos_byte += mb_bytes; | 1662 | pos_byte += mb_bytes; |
| 1666 | if (wide_column) | 1663 | if (mb_width > 1 && BYTES_BY_CHAR_HEAD (*ptr) == mb_bytes) |
| 1667 | wide_column_end_hpos = hpos + wide_column; | 1664 | wide_column_end_hpos = hpos + mb_width; |
| 1668 | hpos += mb_width; | 1665 | hpos += mb_width; |
| 1669 | } | 1666 | } |
| 1670 | else if (VECTORP (charvec)) | 1667 | else if (VECTORP (charvec)) |
diff --git a/src/intervals.c b/src/intervals.c index 351677ad27e..729e6810f74 100644 --- a/src/intervals.c +++ b/src/intervals.c | |||
| @@ -1312,7 +1312,7 @@ delete_interval (register INTERVAL i) | |||
| 1312 | Do this by recursing down TREE to the interval in question, and | 1312 | Do this by recursing down TREE to the interval in question, and |
| 1313 | deleting the appropriate amount of text. */ | 1313 | deleting the appropriate amount of text. */ |
| 1314 | 1314 | ||
| 1315 | static EMACS_INT | 1315 | static EMACS_UINT |
| 1316 | interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | 1316 | interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, |
| 1317 | register EMACS_INT amount) | 1317 | register EMACS_INT amount) |
| 1318 | { | 1318 | { |
| @@ -1324,7 +1324,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1324 | /* Left branch */ | 1324 | /* Left branch */ |
| 1325 | if (relative_position < LEFT_TOTAL_LENGTH (tree)) | 1325 | if (relative_position < LEFT_TOTAL_LENGTH (tree)) |
| 1326 | { | 1326 | { |
| 1327 | EMACS_INT subtract = interval_deletion_adjustment (tree->left, | 1327 | EMACS_UINT subtract = interval_deletion_adjustment (tree->left, |
| 1328 | relative_position, | 1328 | relative_position, |
| 1329 | amount); | 1329 | amount); |
| 1330 | tree->total_length -= subtract; | 1330 | tree->total_length -= subtract; |
| @@ -1335,7 +1335,7 @@ interval_deletion_adjustment (register INTERVAL tree, register EMACS_INT from, | |||
| 1335 | else if (relative_position >= (TOTAL_LENGTH (tree) | 1335 | else if (relative_position >= (TOTAL_LENGTH (tree) |
| 1336 | - RIGHT_TOTAL_LENGTH (tree))) | 1336 | - RIGHT_TOTAL_LENGTH (tree))) |
| 1337 | { | 1337 | { |
| 1338 | EMACS_INT subtract; | 1338 | EMACS_UINT subtract; |
| 1339 | 1339 | ||
| 1340 | relative_position -= (tree->total_length | 1340 | relative_position -= (tree->total_length |
| 1341 | - RIGHT_TOTAL_LENGTH (tree)); | 1341 | - RIGHT_TOTAL_LENGTH (tree)); |
| @@ -1377,7 +1377,7 @@ static void | |||
| 1377 | adjust_intervals_for_deletion (struct buffer *buffer, | 1377 | adjust_intervals_for_deletion (struct buffer *buffer, |
| 1378 | EMACS_INT start, EMACS_INT length) | 1378 | EMACS_INT start, EMACS_INT length) |
| 1379 | { | 1379 | { |
| 1380 | register EMACS_INT left_to_delete = length; | 1380 | register EMACS_UINT left_to_delete = length; |
| 1381 | register INTERVAL tree = BUF_INTERVALS (buffer); | 1381 | register INTERVAL tree = BUF_INTERVALS (buffer); |
| 1382 | Lisp_Object parent; | 1382 | Lisp_Object parent; |
| 1383 | EMACS_INT offset; | 1383 | EMACS_INT offset; |
| @@ -1677,7 +1677,7 @@ graft_intervals_into_buffer (INTERVAL source, EMACS_INT position, | |||
| 1677 | EMACS_INT length, struct buffer *buffer, | 1677 | EMACS_INT length, struct buffer *buffer, |
| 1678 | int inherit) | 1678 | int inherit) |
| 1679 | { | 1679 | { |
| 1680 | register INTERVAL under, over, this, prev; | 1680 | register INTERVAL under, over, this; |
| 1681 | register INTERVAL tree; | 1681 | register INTERVAL tree; |
| 1682 | EMACS_INT over_used; | 1682 | EMACS_INT over_used; |
| 1683 | 1683 | ||
| @@ -1767,7 +1767,8 @@ graft_intervals_into_buffer (INTERVAL source, EMACS_INT position, | |||
| 1767 | /* This call may have some effect because previous_interval may | 1767 | /* This call may have some effect because previous_interval may |
| 1768 | update `position' fields of intervals. Thus, don't ignore it | 1768 | update `position' fields of intervals. Thus, don't ignore it |
| 1769 | for the moment. Someone please tell me the truth (K.Handa). */ | 1769 | for the moment. Someone please tell me the truth (K.Handa). */ |
| 1770 | prev = previous_interval (under); | 1770 | INTERVAL prev = previous_interval (under); |
| 1771 | (void) prev; | ||
| 1771 | #if 0 | 1772 | #if 0 |
| 1772 | /* But, this code surely has no effect. And, anyway, | 1773 | /* But, this code surely has no effect. And, anyway, |
| 1773 | END_NONSTICKY_P is unreliable now. */ | 1774 | END_NONSTICKY_P is unreliable now. */ |
diff --git a/src/keyboard.c b/src/keyboard.c index f766dd7d697..ae4fddb2c89 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -4234,7 +4234,8 @@ static EMACS_TIME | |||
| 4234 | timer_check_2 (void) | 4234 | timer_check_2 (void) |
| 4235 | { | 4235 | { |
| 4236 | EMACS_TIME nexttime; | 4236 | EMACS_TIME nexttime; |
| 4237 | EMACS_TIME now, idleness_now; | 4237 | EMACS_TIME now; |
| 4238 | EMACS_TIME idleness_now IF_LINT (= {0}); | ||
| 4238 | Lisp_Object timers, idle_timers, chosen_timer; | 4239 | Lisp_Object timers, idle_timers, chosen_timer; |
| 4239 | struct gcpro gcpro1, gcpro2, gcpro3; | 4240 | struct gcpro gcpro1, gcpro2, gcpro3; |
| 4240 | 4241 | ||
| @@ -4271,10 +4272,12 @@ timer_check_2 (void) | |||
| 4271 | Lisp_Object *vector; | 4272 | Lisp_Object *vector; |
| 4272 | Lisp_Object timer = Qnil, idle_timer = Qnil; | 4273 | Lisp_Object timer = Qnil, idle_timer = Qnil; |
| 4273 | EMACS_TIME timer_time, idle_timer_time; | 4274 | EMACS_TIME timer_time, idle_timer_time; |
| 4274 | EMACS_TIME difference, timer_difference, idle_timer_difference; | 4275 | EMACS_TIME difference; |
| 4276 | EMACS_TIME timer_difference IF_LINT (= {0}); | ||
| 4277 | EMACS_TIME idle_timer_difference IF_LINT (= {0}); | ||
| 4275 | 4278 | ||
| 4276 | /* Skip past invalid timers and timers already handled. */ | 4279 | /* Skip past invalid timers and timers already handled. */ |
| 4277 | if (!NILP (timers)) | 4280 | if (CONSP (timers)) |
| 4278 | { | 4281 | { |
| 4279 | timer = XCAR (timers); | 4282 | timer = XCAR (timers); |
| 4280 | if (!VECTORP (timer) || XVECTOR (timer)->size != 8) | 4283 | if (!VECTORP (timer) || XVECTOR (timer)->size != 8) |
| @@ -4292,7 +4295,7 @@ timer_check_2 (void) | |||
| 4292 | continue; | 4295 | continue; |
| 4293 | } | 4296 | } |
| 4294 | } | 4297 | } |
| 4295 | if (!NILP (idle_timers)) | 4298 | if (CONSP (idle_timers)) |
| 4296 | { | 4299 | { |
| 4297 | timer = XCAR (idle_timers); | 4300 | timer = XCAR (idle_timers); |
| 4298 | if (!VECTORP (timer) || XVECTOR (timer)->size != 8) | 4301 | if (!VECTORP (timer) || XVECTOR (timer)->size != 8) |
| @@ -4315,7 +4318,7 @@ timer_check_2 (void) | |||
| 4315 | based on the next ordinary timer. | 4318 | based on the next ordinary timer. |
| 4316 | TIMER_DIFFERENCE is the distance in time from NOW to when | 4319 | TIMER_DIFFERENCE is the distance in time from NOW to when |
| 4317 | this timer becomes ripe (negative if it's already ripe). */ | 4320 | this timer becomes ripe (negative if it's already ripe). */ |
| 4318 | if (!NILP (timers)) | 4321 | if (CONSP (timers)) |
| 4319 | { | 4322 | { |
| 4320 | timer = XCAR (timers); | 4323 | timer = XCAR (timers); |
| 4321 | vector = XVECTOR (timer)->contents; | 4324 | vector = XVECTOR (timer)->contents; |
| @@ -4327,7 +4330,7 @@ timer_check_2 (void) | |||
| 4327 | 4330 | ||
| 4328 | /* Set IDLE_TIMER, IDLE_TIMER_TIME and IDLE_TIMER_DIFFERENCE | 4331 | /* Set IDLE_TIMER, IDLE_TIMER_TIME and IDLE_TIMER_DIFFERENCE |
| 4329 | based on the next idle timer. */ | 4332 | based on the next idle timer. */ |
| 4330 | if (!NILP (idle_timers)) | 4333 | if (CONSP (idle_timers)) |
| 4331 | { | 4334 | { |
| 4332 | idle_timer = XCAR (idle_timers); | 4335 | idle_timer = XCAR (idle_timers); |
| 4333 | vector = XVECTOR (idle_timer)->contents; | 4336 | vector = XVECTOR (idle_timer)->contents; |
| @@ -4341,7 +4344,7 @@ timer_check_2 (void) | |||
| 4341 | and set CHOSEN_TIMER, VECTOR and DIFFERENCE accordingly. | 4344 | and set CHOSEN_TIMER, VECTOR and DIFFERENCE accordingly. |
| 4342 | Also step down the list where we found that timer. */ | 4345 | Also step down the list where we found that timer. */ |
| 4343 | 4346 | ||
| 4344 | if (! NILP (timers) && ! NILP (idle_timers)) | 4347 | if (CONSP (timers) && CONSP (idle_timers)) |
| 4345 | { | 4348 | { |
| 4346 | EMACS_TIME temp; | 4349 | EMACS_TIME temp; |
| 4347 | EMACS_SUB_TIME (temp, timer_difference, idle_timer_difference); | 4350 | EMACS_SUB_TIME (temp, timer_difference, idle_timer_difference); |
| @@ -4358,7 +4361,7 @@ timer_check_2 (void) | |||
| 4358 | difference = idle_timer_difference; | 4361 | difference = idle_timer_difference; |
| 4359 | } | 4362 | } |
| 4360 | } | 4363 | } |
| 4361 | else if (! NILP (timers)) | 4364 | else if (CONSP (timers)) |
| 4362 | { | 4365 | { |
| 4363 | chosen_timer = timer; | 4366 | chosen_timer = timer; |
| 4364 | timers = XCDR (timers); | 4367 | timers = XCDR (timers); |
| @@ -7358,8 +7361,6 @@ menu_bar_items (Lisp_Object old) | |||
| 7358 | 7361 | ||
| 7359 | Lisp_Object def, tail; | 7362 | Lisp_Object def, tail; |
| 7360 | 7363 | ||
| 7361 | Lisp_Object result; | ||
| 7362 | |||
| 7363 | int mapno; | 7364 | int mapno; |
| 7364 | Lisp_Object oquit; | 7365 | Lisp_Object oquit; |
| 7365 | 7366 | ||
| @@ -7420,8 +7421,6 @@ menu_bar_items (Lisp_Object old) | |||
| 7420 | 7421 | ||
| 7421 | /* Look up in each map the dummy prefix key `menu-bar'. */ | 7422 | /* Look up in each map the dummy prefix key `menu-bar'. */ |
| 7422 | 7423 | ||
| 7423 | result = Qnil; | ||
| 7424 | |||
| 7425 | for (mapno = nmaps - 1; mapno >= 0; mapno--) | 7424 | for (mapno = nmaps - 1; mapno >= 0; mapno--) |
| 7426 | if (!NILP (maps[mapno])) | 7425 | if (!NILP (maps[mapno])) |
| 7427 | { | 7426 | { |
| @@ -8495,7 +8494,6 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8495 | int notfirst = 0; | 8494 | int notfirst = 0; |
| 8496 | int i = nlength; | 8495 | int i = nlength; |
| 8497 | Lisp_Object obj; | 8496 | Lisp_Object obj; |
| 8498 | int ch; | ||
| 8499 | Lisp_Object orig_defn_macro; | 8497 | Lisp_Object orig_defn_macro; |
| 8500 | 8498 | ||
| 8501 | /* Loop over elements of map. */ | 8499 | /* Loop over elements of map. */ |
| @@ -8665,8 +8663,6 @@ read_char_minibuf_menu_prompt (int commandflag, int nmaps, Lisp_Object *maps) | |||
| 8665 | return obj; | 8663 | return obj; |
| 8666 | else if (XINT (obj) == -2) | 8664 | else if (XINT (obj) == -2) |
| 8667 | return obj; | 8665 | return obj; |
| 8668 | else | ||
| 8669 | ch = XINT (obj); | ||
| 8670 | 8666 | ||
| 8671 | if (! EQ (obj, menu_prompt_more_char) | 8667 | if (! EQ (obj, menu_prompt_more_char) |
| 8672 | && (!INTEGERP (menu_prompt_more_char) | 8668 | && (!INTEGERP (menu_prompt_more_char) |
diff --git a/src/lisp.h b/src/lisp.h index 580dbd11013..f3016d521d1 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1016,7 +1016,7 @@ struct Lisp_Symbol | |||
| 1016 | /* Interned state of the symbol. This is an enumerator from | 1016 | /* Interned state of the symbol. This is an enumerator from |
| 1017 | enum symbol_interned. */ | 1017 | enum symbol_interned. */ |
| 1018 | unsigned interned : 2; | 1018 | unsigned interned : 2; |
| 1019 | 1019 | ||
| 1020 | /* Non-zero means that this variable has been explicitly declared | 1020 | /* Non-zero means that this variable has been explicitly declared |
| 1021 | special (with `defvar' etc), and shouldn't be lexically bound. */ | 1021 | special (with `defvar' etc), and shouldn't be lexically bound. */ |
| 1022 | unsigned declared_special : 1; | 1022 | unsigned declared_special : 1; |
| @@ -2627,8 +2627,8 @@ extern void restore_message (void); | |||
| 2627 | extern Lisp_Object current_message (void); | 2627 | extern Lisp_Object current_message (void); |
| 2628 | extern void set_message (const char *s, Lisp_Object, EMACS_INT, int); | 2628 | extern void set_message (const char *s, Lisp_Object, EMACS_INT, int); |
| 2629 | extern void clear_message (int, int); | 2629 | extern void clear_message (int, int); |
| 2630 | extern void message (const char *, ...); | 2630 | extern void message (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2631 | extern void message_nolog (const char *, ...); | 2631 | extern void message_nolog (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); |
| 2632 | extern void message1 (const char *); | 2632 | extern void message1 (const char *); |
| 2633 | extern void message1_nolog (const char *); | 2633 | extern void message1_nolog (const char *); |
| 2634 | extern void message2 (const char *, EMACS_INT, int); | 2634 | extern void message2 (const char *, EMACS_INT, int); |
| @@ -3348,6 +3348,8 @@ extern int emacs_open (const char *, int, int); | |||
| 3348 | extern int emacs_close (int); | 3348 | extern int emacs_close (int); |
| 3349 | extern int emacs_read (int, char *, unsigned int); | 3349 | extern int emacs_read (int, char *, unsigned int); |
| 3350 | extern int emacs_write (int, const char *, unsigned int); | 3350 | extern int emacs_write (int, const char *, unsigned int); |
| 3351 | enum { READLINK_BUFSIZE = 1024 }; | ||
| 3352 | extern char *emacs_readlink (const char *, char [READLINK_BUFSIZE]); | ||
| 3351 | #ifndef HAVE_MEMSET | 3353 | #ifndef HAVE_MEMSET |
| 3352 | extern void *memset (void *, int, size_t); | 3354 | extern void *memset (void *, int, size_t); |
| 3353 | #endif | 3355 | #endif |
| @@ -3392,7 +3394,8 @@ extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, | |||
| 3392 | extern int *char_ins_del_vector; | 3394 | extern int *char_ins_del_vector; |
| 3393 | extern void mark_ttys (void); | 3395 | extern void mark_ttys (void); |
| 3394 | extern void syms_of_term (void); | 3396 | extern void syms_of_term (void); |
| 3395 | extern void fatal (const char *msgid, ...) NO_RETURN; | 3397 | extern void fatal (const char *msgid, ...) |
| 3398 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 2); | ||
| 3396 | 3399 | ||
| 3397 | /* Defined in terminal.c */ | 3400 | /* Defined in terminal.c */ |
| 3398 | EXFUN (Fframe_terminal, 1); | 3401 | EXFUN (Fframe_terminal, 1); |
diff --git a/src/lread.c b/src/lread.c index 6a24569f552..8777bc34545 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -818,7 +818,8 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun) | |||
| 818 | 818 | ||
| 819 | while (in_file_vars) | 819 | while (in_file_vars) |
| 820 | { | 820 | { |
| 821 | char var[100], *var_end, val[100], *val_end; | 821 | char var[100], val[100]; |
| 822 | unsigned i; | ||
| 822 | 823 | ||
| 823 | ch = READCHAR; | 824 | ch = READCHAR; |
| 824 | 825 | ||
| @@ -826,19 +827,18 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun) | |||
| 826 | while (ch == ' ' || ch == '\t') | 827 | while (ch == ' ' || ch == '\t') |
| 827 | ch = READCHAR; | 828 | ch = READCHAR; |
| 828 | 829 | ||
| 829 | var_end = var; | 830 | i = 0; |
| 830 | while (ch != ':' && ch != '\n' && ch != EOF) | 831 | while (ch != ':' && ch != '\n' && ch != EOF) |
| 831 | { | 832 | { |
| 832 | if (var_end < var + sizeof var - 1) | 833 | if (i < sizeof var - 1) |
| 833 | *var_end++ = ch; | 834 | var[i++] = ch; |
| 834 | UPDATE_BEG_END_STATE (ch); | 835 | UPDATE_BEG_END_STATE (ch); |
| 835 | ch = READCHAR; | 836 | ch = READCHAR; |
| 836 | } | 837 | } |
| 837 | 838 | ||
| 838 | while (var_end > var | 839 | while (i > 0 && (var[i - 1] == ' ' || var[i - 1] == '\t')) |
| 839 | && (var_end[-1] == ' ' || var_end[-1] == '\t')) | 840 | i--; |
| 840 | var_end--; | 841 | var[i] = '\0'; |
| 841 | *var_end = '\0'; | ||
| 842 | 842 | ||
| 843 | if (ch == ':') | 843 | if (ch == ':') |
| 844 | { | 844 | { |
| @@ -848,22 +848,21 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun) | |||
| 848 | while (ch == ' ' || ch == '\t') | 848 | while (ch == ' ' || ch == '\t') |
| 849 | ch = READCHAR; | 849 | ch = READCHAR; |
| 850 | 850 | ||
| 851 | val_end = val; | 851 | i = 0; |
| 852 | while (ch != ';' && ch != '\n' && ch != EOF && in_file_vars) | 852 | while (ch != ';' && ch != '\n' && ch != EOF && in_file_vars) |
| 853 | { | 853 | { |
| 854 | if (val_end < val + sizeof val - 1) | 854 | if (i < sizeof val - 1) |
| 855 | *val_end++ = ch; | 855 | val[i++] = ch; |
| 856 | UPDATE_BEG_END_STATE (ch); | 856 | UPDATE_BEG_END_STATE (ch); |
| 857 | ch = READCHAR; | 857 | ch = READCHAR; |
| 858 | } | 858 | } |
| 859 | if (! in_file_vars) | 859 | if (! in_file_vars) |
| 860 | /* The value was terminated by an end-marker, which | 860 | /* The value was terminated by an end-marker, which |
| 861 | remove. */ | 861 | remove. */ |
| 862 | val_end -= 3; | 862 | i -= 3; |
| 863 | while (val_end > val | 863 | while (i > 0 && (val[i - 1] == ' ' || val[i - 1] == '\t')) |
| 864 | && (val_end[-1] == ' ' || val_end[-1] == '\t')) | 864 | i--; |
| 865 | val_end--; | 865 | val[i] = '\0'; |
| 866 | *val_end = '\0'; | ||
| 867 | 866 | ||
| 868 | if (strcmp (var, "lexical-binding") == 0) | 867 | if (strcmp (var, "lexical-binding") == 0) |
| 869 | /* This is it... */ | 868 | /* This is it... */ |
| @@ -908,7 +907,7 @@ safe_to_load_p (int fd) | |||
| 908 | if (i == 4) | 907 | if (i == 4) |
| 909 | version = buf[i]; | 908 | version = buf[i]; |
| 910 | 909 | ||
| 911 | if (i == nbytes | 910 | if (i >= nbytes |
| 912 | || fast_c_string_match_ignore_case (Vbytecomp_version_regexp, | 911 | || fast_c_string_match_ignore_case (Vbytecomp_version_regexp, |
| 913 | buf + i) < 0) | 912 | buf + i) < 0) |
| 914 | safe_p = 0; | 913 | safe_p = 0; |
| @@ -2320,7 +2319,7 @@ static Lisp_Object | |||
| 2320 | read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) | 2319 | read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) |
| 2321 | { | 2320 | { |
| 2322 | register int c; | 2321 | register int c; |
| 2323 | int uninterned_symbol = 0; | 2322 | unsigned uninterned_symbol = 0; |
| 2324 | int multibyte; | 2323 | int multibyte; |
| 2325 | 2324 | ||
| 2326 | *pch = 0; | 2325 | *pch = 0; |
diff --git a/src/menu.c b/src/menu.c index a9098deed7e..3bfb74863ae 100644 --- a/src/menu.c +++ b/src/menu.c | |||
| @@ -1340,7 +1340,7 @@ no quit occurs and `x-popup-menu' returns nil. */) | |||
| 1340 | 1340 | ||
| 1341 | UNGCPRO; | 1341 | UNGCPRO; |
| 1342 | 1342 | ||
| 1343 | if (error_name) error (error_name); | 1343 | if (error_name) error ("%s", error_name); |
| 1344 | return selection; | 1344 | return selection; |
| 1345 | } | 1345 | } |
| 1346 | 1346 | ||
diff --git a/src/minibuf.c b/src/minibuf.c index 4adf665f8f4..54cb9c1acd7 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -229,7 +229,7 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 229 | Lisp_Object defalt, | 229 | Lisp_Object defalt, |
| 230 | int allow_props, int inherit_input_method) | 230 | int allow_props, int inherit_input_method) |
| 231 | { | 231 | { |
| 232 | int size, len; | 232 | size_t size, len; |
| 233 | char *line, *s; | 233 | char *line, *s; |
| 234 | Lisp_Object val; | 234 | Lisp_Object val; |
| 235 | 235 | ||
| @@ -244,6 +244,8 @@ read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, | |||
| 244 | && (len = strlen (line), | 244 | && (len = strlen (line), |
| 245 | len == size - 1 && line[len - 1] != '\n')) | 245 | len == size - 1 && line[len - 1] != '\n')) |
| 246 | { | 246 | { |
| 247 | if ((size_t) -1 / 2 < size) | ||
| 248 | memory_full (); | ||
| 247 | size *= 2; | 249 | size *= 2; |
| 248 | line = (char *) xrealloc (line, size); | 250 | line = (char *) xrealloc (line, size); |
| 249 | } | 251 | } |
diff --git a/src/print.c b/src/print.c index 17a896bba8d..c076e1ec973 100644 --- a/src/print.c +++ b/src/print.c | |||
| @@ -929,7 +929,7 @@ print_error_message (Lisp_Object data, Lisp_Object stream, const char *context, | |||
| 929 | else | 929 | else |
| 930 | write_string_1 ("peculiar error", -1, stream); | 930 | write_string_1 ("peculiar error", -1, stream); |
| 931 | 931 | ||
| 932 | for (i = 0; CONSP (tail); tail = XCDR (tail), i++) | 932 | for (i = 0; CONSP (tail); tail = XCDR (tail), i = 1) |
| 933 | { | 933 | { |
| 934 | Lisp_Object obj; | 934 | Lisp_Object obj; |
| 935 | 935 | ||
| @@ -1407,7 +1407,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1407 | print_string (obj, printcharfun); | 1407 | print_string (obj, printcharfun); |
| 1408 | else | 1408 | else |
| 1409 | { | 1409 | { |
| 1410 | register EMACS_INT i, i_byte; | 1410 | register EMACS_INT i_byte; |
| 1411 | struct gcpro gcpro1; | 1411 | struct gcpro gcpro1; |
| 1412 | unsigned char *str; | 1412 | unsigned char *str; |
| 1413 | EMACS_INT size_byte; | 1413 | EMACS_INT size_byte; |
| @@ -1431,7 +1431,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1431 | str = SDATA (obj); | 1431 | str = SDATA (obj); |
| 1432 | size_byte = SBYTES (obj); | 1432 | size_byte = SBYTES (obj); |
| 1433 | 1433 | ||
| 1434 | for (i = 0, i_byte = 0; i_byte < size_byte;) | 1434 | for (i_byte = 0; i_byte < size_byte;) |
| 1435 | { | 1435 | { |
| 1436 | /* Here, we must convert each multi-byte form to the | 1436 | /* Here, we must convert each multi-byte form to the |
| 1437 | corresponding character code before handing it to PRINTCHAR. */ | 1437 | corresponding character code before handing it to PRINTCHAR. */ |
diff --git a/src/process.c b/src/process.c index 1abfbd3f2a4..a9a8eb79ede 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -1344,11 +1344,7 @@ list_processes_1 (Lisp_Object query_only) | |||
| 1344 | symbol = XCAR (p->status); | 1344 | symbol = XCAR (p->status); |
| 1345 | 1345 | ||
| 1346 | if (EQ (symbol, Qsignal)) | 1346 | if (EQ (symbol, Qsignal)) |
| 1347 | { | 1347 | Fprinc (symbol, Qnil); |
| 1348 | Lisp_Object tem; | ||
| 1349 | tem = Fcar (Fcdr (p->status)); | ||
| 1350 | Fprinc (symbol, Qnil); | ||
| 1351 | } | ||
| 1352 | else if (NETCONN1_P (p) || SERIALCONN1_P (p)) | 1348 | else if (NETCONN1_P (p) || SERIALCONN1_P (p)) |
| 1353 | { | 1349 | { |
| 1354 | if (EQ (symbol, Qexit)) | 1350 | if (EQ (symbol, Qexit)) |
| @@ -2150,10 +2146,7 @@ void | |||
| 2150 | create_pty (Lisp_Object process) | 2146 | create_pty (Lisp_Object process) |
| 2151 | { | 2147 | { |
| 2152 | int inchannel, outchannel; | 2148 | int inchannel, outchannel; |
| 2153 | 2149 | int pty_flag = 0; | |
| 2154 | /* Use volatile to protect variables from being clobbered by longjmp. */ | ||
| 2155 | volatile int forkin, forkout; | ||
| 2156 | volatile int pty_flag = 0; | ||
| 2157 | 2150 | ||
| 2158 | inchannel = outchannel = -1; | 2151 | inchannel = outchannel = -1; |
| 2159 | 2152 | ||
| @@ -2169,11 +2162,11 @@ create_pty (Lisp_Object process) | |||
| 2169 | #ifdef O_NOCTTY | 2162 | #ifdef O_NOCTTY |
| 2170 | /* Don't let this terminal become our controlling terminal | 2163 | /* Don't let this terminal become our controlling terminal |
| 2171 | (in case we don't have one). */ | 2164 | (in case we don't have one). */ |
| 2172 | forkout = forkin = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0); | 2165 | int forkout = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0); |
| 2173 | #else | 2166 | #else |
| 2174 | forkout = forkin = emacs_open (pty_name, O_RDWR, 0); | 2167 | int forkout = emacs_open (pty_name, O_RDWR, 0); |
| 2175 | #endif | 2168 | #endif |
| 2176 | if (forkin < 0) | 2169 | if (forkout < 0) |
| 2177 | report_file_error ("Opening pty", Qnil); | 2170 | report_file_error ("Opening pty", Qnil); |
| 2178 | #if defined (DONT_REOPEN_PTY) | 2171 | #if defined (DONT_REOPEN_PTY) |
| 2179 | /* In the case that vfork is defined as fork, the parent process | 2172 | /* In the case that vfork is defined as fork, the parent process |
| @@ -2181,8 +2174,6 @@ create_pty (Lisp_Object process) | |||
| 2181 | tty options setup. So we setup tty before forking. */ | 2174 | tty options setup. So we setup tty before forking. */ |
| 2182 | child_setup_tty (forkout); | 2175 | child_setup_tty (forkout); |
| 2183 | #endif /* DONT_REOPEN_PTY */ | 2176 | #endif /* DONT_REOPEN_PTY */ |
| 2184 | #else | ||
| 2185 | forkin = forkout = -1; | ||
| 2186 | #endif /* not USG, or USG_SUBTTY_WORKS */ | 2177 | #endif /* not USG, or USG_SUBTTY_WORKS */ |
| 2187 | pty_flag = 1; | 2178 | pty_flag = 1; |
| 2188 | } | 2179 | } |
| @@ -3958,7 +3949,7 @@ FLAGS is the current flags of the interface. */) | |||
| 3958 | const struct ifflag_def *fp; | 3949 | const struct ifflag_def *fp; |
| 3959 | int fnum; | 3950 | int fnum; |
| 3960 | 3951 | ||
| 3961 | any++; | 3952 | any = 1; |
| 3962 | for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++) | 3953 | for (fp = ifflag_table; flags != 0 && fp->flag_sym; fp++) |
| 3963 | { | 3954 | { |
| 3964 | if (flags & fp->flag_bit) | 3955 | if (flags & fp->flag_bit) |
| @@ -3986,7 +3977,7 @@ FLAGS is the current flags of the interface. */) | |||
| 3986 | register struct Lisp_Vector *p = XVECTOR (hwaddr); | 3977 | register struct Lisp_Vector *p = XVECTOR (hwaddr); |
| 3987 | int n; | 3978 | int n; |
| 3988 | 3979 | ||
| 3989 | any++; | 3980 | any = 1; |
| 3990 | for (n = 0; n < 6; n++) | 3981 | for (n = 0; n < 6; n++) |
| 3991 | p->contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]); | 3982 | p->contents[n] = make_number (((unsigned char *)&rq.ifr_hwaddr.sa_data[0])[n]); |
| 3992 | elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); | 3983 | elt = Fcons (make_number (rq.ifr_hwaddr.sa_family), hwaddr); |
| @@ -3998,7 +3989,7 @@ FLAGS is the current flags of the interface. */) | |||
| 3998 | #if defined(SIOCGIFNETMASK) && (defined(HAVE_STRUCT_IFREQ_IFR_NETMASK) || defined(HAVE_STRUCT_IFREQ_IFR_ADDR)) | 3989 | #if defined(SIOCGIFNETMASK) && (defined(HAVE_STRUCT_IFREQ_IFR_NETMASK) || defined(HAVE_STRUCT_IFREQ_IFR_ADDR)) |
| 3999 | if (ioctl (s, SIOCGIFNETMASK, &rq) == 0) | 3990 | if (ioctl (s, SIOCGIFNETMASK, &rq) == 0) |
| 4000 | { | 3991 | { |
| 4001 | any++; | 3992 | any = 1; |
| 4002 | #ifdef HAVE_STRUCT_IFREQ_IFR_NETMASK | 3993 | #ifdef HAVE_STRUCT_IFREQ_IFR_NETMASK |
| 4003 | elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask)); | 3994 | elt = conv_sockaddr_to_lisp (&rq.ifr_netmask, sizeof (rq.ifr_netmask)); |
| 4004 | #else | 3995 | #else |
| @@ -4012,7 +4003,7 @@ FLAGS is the current flags of the interface. */) | |||
| 4012 | #if defined(SIOCGIFBRDADDR) && defined(HAVE_STRUCT_IFREQ_IFR_BROADADDR) | 4003 | #if defined(SIOCGIFBRDADDR) && defined(HAVE_STRUCT_IFREQ_IFR_BROADADDR) |
| 4013 | if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0) | 4004 | if (ioctl (s, SIOCGIFBRDADDR, &rq) == 0) |
| 4014 | { | 4005 | { |
| 4015 | any++; | 4006 | any = 1; |
| 4016 | elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof (rq.ifr_broadaddr)); | 4007 | elt = conv_sockaddr_to_lisp (&rq.ifr_broadaddr, sizeof (rq.ifr_broadaddr)); |
| 4017 | } | 4008 | } |
| 4018 | #endif | 4009 | #endif |
| @@ -4022,7 +4013,7 @@ FLAGS is the current flags of the interface. */) | |||
| 4022 | #if defined(SIOCGIFADDR) && defined(HAVE_STRUCT_IFREQ_IFR_ADDR) | 4013 | #if defined(SIOCGIFADDR) && defined(HAVE_STRUCT_IFREQ_IFR_ADDR) |
| 4023 | if (ioctl (s, SIOCGIFADDR, &rq) == 0) | 4014 | if (ioctl (s, SIOCGIFADDR, &rq) == 0) |
| 4024 | { | 4015 | { |
| 4025 | any++; | 4016 | any = 1; |
| 4026 | elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr)); | 4017 | elt = conv_sockaddr_to_lisp (&rq.ifr_addr, sizeof (rq.ifr_addr)); |
| 4027 | } | 4018 | } |
| 4028 | #endif | 4019 | #endif |
| @@ -5171,15 +5162,22 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5171 | } | 5162 | } |
| 5172 | else | 5163 | else |
| 5173 | #endif | 5164 | #endif |
| 5174 | if (proc_buffered_char[channel] < 0) | ||
| 5175 | { | 5165 | { |
| 5166 | int buffered = 0 <= proc_buffered_char[channel]; | ||
| 5167 | if (buffered) | ||
| 5168 | { | ||
| 5169 | chars[carryover] = proc_buffered_char[channel]; | ||
| 5170 | proc_buffered_char[channel] = -1; | ||
| 5171 | } | ||
| 5176 | #ifdef HAVE_GNUTLS | 5172 | #ifdef HAVE_GNUTLS |
| 5177 | if (XPROCESS (proc)->gnutls_p) | 5173 | if (XPROCESS (proc)->gnutls_p) |
| 5178 | nbytes = emacs_gnutls_read (channel, XPROCESS (proc), | 5174 | nbytes = emacs_gnutls_read (channel, XPROCESS (proc), |
| 5179 | chars + carryover, readmax); | 5175 | chars + carryover + buffered, |
| 5176 | readmax - buffered); | ||
| 5180 | else | 5177 | else |
| 5181 | #endif | 5178 | #endif |
| 5182 | nbytes = emacs_read (channel, chars + carryover, readmax); | 5179 | nbytes = emacs_read (channel, chars + carryover + buffered, |
| 5180 | readmax - buffered); | ||
| 5183 | #ifdef ADAPTIVE_READ_BUFFERING | 5181 | #ifdef ADAPTIVE_READ_BUFFERING |
| 5184 | if (nbytes > 0 && p->adaptive_read_buffering) | 5182 | if (nbytes > 0 && p->adaptive_read_buffering) |
| 5185 | { | 5183 | { |
| @@ -5193,7 +5191,7 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5193 | delay += READ_OUTPUT_DELAY_INCREMENT * 2; | 5191 | delay += READ_OUTPUT_DELAY_INCREMENT * 2; |
| 5194 | } | 5192 | } |
| 5195 | } | 5193 | } |
| 5196 | else if (delay > 0 && (nbytes == readmax)) | 5194 | else if (delay > 0 && nbytes == readmax - buffered) |
| 5197 | { | 5195 | { |
| 5198 | delay -= READ_OUTPUT_DELAY_INCREMENT; | 5196 | delay -= READ_OUTPUT_DELAY_INCREMENT; |
| 5199 | if (delay == 0) | 5197 | if (delay == 0) |
| @@ -5207,22 +5205,8 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5207 | } | 5205 | } |
| 5208 | } | 5206 | } |
| 5209 | #endif | 5207 | #endif |
| 5210 | } | 5208 | nbytes += buffered; |
| 5211 | else | 5209 | nbytes += buffered && nbytes <= 0; |
| 5212 | { | ||
| 5213 | chars[carryover] = proc_buffered_char[channel]; | ||
| 5214 | proc_buffered_char[channel] = -1; | ||
| 5215 | #ifdef HAVE_GNUTLS | ||
| 5216 | if (XPROCESS (proc)->gnutls_p) | ||
| 5217 | nbytes = emacs_gnutls_read (channel, XPROCESS (proc), | ||
| 5218 | chars + carryover + 1, readmax - 1); | ||
| 5219 | else | ||
| 5220 | #endif | ||
| 5221 | nbytes = emacs_read (channel, chars + carryover + 1, readmax - 1); | ||
| 5222 | if (nbytes < 0) | ||
| 5223 | nbytes = 1; | ||
| 5224 | else | ||
| 5225 | nbytes = nbytes + 1; | ||
| 5226 | } | 5210 | } |
| 5227 | 5211 | ||
| 5228 | p->decoding_carryover = 0; | 5212 | p->decoding_carryover = 0; |
| @@ -5249,15 +5233,17 @@ read_process_output (Lisp_Object proc, register int channel) | |||
| 5249 | outstream = p->filter; | 5233 | outstream = p->filter; |
| 5250 | if (!NILP (outstream)) | 5234 | if (!NILP (outstream)) |
| 5251 | { | 5235 | { |
| 5252 | Lisp_Object obuffer, okeymap; | ||
| 5253 | Lisp_Object text; | 5236 | Lisp_Object text; |
| 5254 | int outer_running_asynch_code = running_asynch_code; | 5237 | int outer_running_asynch_code = running_asynch_code; |
| 5255 | int waiting = waiting_for_user_input_p; | 5238 | int waiting = waiting_for_user_input_p; |
| 5256 | 5239 | ||
| 5257 | /* No need to gcpro these, because all we do with them later | 5240 | /* No need to gcpro these, because all we do with them later |
| 5258 | is test them for EQness, and none of them should be a string. */ | 5241 | is test them for EQness, and none of them should be a string. */ |
| 5242 | #if 0 | ||
| 5243 | Lisp_Object obuffer, okeymap; | ||
| 5259 | XSETBUFFER (obuffer, current_buffer); | 5244 | XSETBUFFER (obuffer, current_buffer); |
| 5260 | okeymap = BVAR (current_buffer, keymap); | 5245 | okeymap = BVAR (current_buffer, keymap); |
| 5246 | #endif | ||
| 5261 | 5247 | ||
| 5262 | /* We inhibit quit here instead of just catching it so that | 5248 | /* We inhibit quit here instead of just catching it so that |
| 5263 | hitting ^G when a filter happens to be running won't screw | 5249 | hitting ^G when a filter happens to be running won't screw |
| @@ -6540,7 +6526,7 @@ exec_sentinel_error_handler (Lisp_Object error_val) | |||
| 6540 | static void | 6526 | static void |
| 6541 | exec_sentinel (Lisp_Object proc, Lisp_Object reason) | 6527 | exec_sentinel (Lisp_Object proc, Lisp_Object reason) |
| 6542 | { | 6528 | { |
| 6543 | Lisp_Object sentinel, obuffer, odeactivate, okeymap; | 6529 | Lisp_Object sentinel, odeactivate; |
| 6544 | register struct Lisp_Process *p = XPROCESS (proc); | 6530 | register struct Lisp_Process *p = XPROCESS (proc); |
| 6545 | int count = SPECPDL_INDEX (); | 6531 | int count = SPECPDL_INDEX (); |
| 6546 | int outer_running_asynch_code = running_asynch_code; | 6532 | int outer_running_asynch_code = running_asynch_code; |
| @@ -6552,8 +6538,11 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason) | |||
| 6552 | /* No need to gcpro these, because all we do with them later | 6538 | /* No need to gcpro these, because all we do with them later |
| 6553 | is test them for EQness, and none of them should be a string. */ | 6539 | is test them for EQness, and none of them should be a string. */ |
| 6554 | odeactivate = Vdeactivate_mark; | 6540 | odeactivate = Vdeactivate_mark; |
| 6541 | #if 0 | ||
| 6542 | Lisp_Object obuffer, okeymap; | ||
| 6555 | XSETBUFFER (obuffer, current_buffer); | 6543 | XSETBUFFER (obuffer, current_buffer); |
| 6556 | okeymap = BVAR (current_buffer, keymap); | 6544 | okeymap = BVAR (current_buffer, keymap); |
| 6545 | #endif | ||
| 6557 | 6546 | ||
| 6558 | /* There's no good reason to let sentinels change the current | 6547 | /* There's no good reason to let sentinels change the current |
| 6559 | buffer, and many callers of accept-process-output, sit-for, and | 6548 | buffer, and many callers of accept-process-output, sit-for, and |
diff --git a/src/search.c b/src/search.c index 682fa185bbb..fa44e1300d7 100644 --- a/src/search.c +++ b/src/search.c | |||
| @@ -1674,7 +1674,6 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 1674 | int translate_prev_byte1 = 0; | 1674 | int translate_prev_byte1 = 0; |
| 1675 | int translate_prev_byte2 = 0; | 1675 | int translate_prev_byte2 = 0; |
| 1676 | int translate_prev_byte3 = 0; | 1676 | int translate_prev_byte3 = 0; |
| 1677 | int translate_prev_byte4 = 0; | ||
| 1678 | 1677 | ||
| 1679 | /* The general approach is that we are going to maintain that we know | 1678 | /* The general approach is that we are going to maintain that we know |
| 1680 | the first (closest to the present position, in whatever direction | 1679 | the first (closest to the present position, in whatever direction |
| @@ -1730,11 +1729,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, | |||
| 1730 | { | 1729 | { |
| 1731 | translate_prev_byte2 = str[cblen - 3]; | 1730 | translate_prev_byte2 = str[cblen - 3]; |
| 1732 | if (cblen > 3) | 1731 | if (cblen > 3) |
| 1733 | { | 1732 | translate_prev_byte3 = str[cblen - 4]; |
| 1734 | translate_prev_byte3 = str[cblen - 4]; | ||
| 1735 | if (cblen > 4) | ||
| 1736 | translate_prev_byte4 = str[cblen - 5]; | ||
| 1737 | } | ||
| 1738 | } | 1733 | } |
| 1739 | } | 1734 | } |
| 1740 | 1735 | ||
| @@ -2091,7 +2086,7 @@ set_search_regs (EMACS_INT beg_byte, EMACS_INT nbytes) | |||
| 2091 | static Lisp_Object | 2086 | static Lisp_Object |
| 2092 | wordify (Lisp_Object string, int lax) | 2087 | wordify (Lisp_Object string, int lax) |
| 2093 | { | 2088 | { |
| 2094 | register unsigned char *p, *o; | 2089 | register unsigned char *o; |
| 2095 | register EMACS_INT i, i_byte, len, punct_count = 0, word_count = 0; | 2090 | register EMACS_INT i, i_byte, len, punct_count = 0, word_count = 0; |
| 2096 | Lisp_Object val; | 2091 | Lisp_Object val; |
| 2097 | int prev_c = 0; | 2092 | int prev_c = 0; |
| @@ -2099,7 +2094,6 @@ wordify (Lisp_Object string, int lax) | |||
| 2099 | int whitespace_at_end; | 2094 | int whitespace_at_end; |
| 2100 | 2095 | ||
| 2101 | CHECK_STRING (string); | 2096 | CHECK_STRING (string); |
| 2102 | p = SDATA (string); | ||
| 2103 | len = SCHARS (string); | 2097 | len = SCHARS (string); |
| 2104 | 2098 | ||
| 2105 | for (i = 0, i_byte = 0; i < len; ) | 2099 | for (i = 0, i_byte = 0; i < len; ) |
| @@ -2111,7 +2105,7 @@ wordify (Lisp_Object string, int lax) | |||
| 2111 | if (SYNTAX (c) != Sword) | 2105 | if (SYNTAX (c) != Sword) |
| 2112 | { | 2106 | { |
| 2113 | punct_count++; | 2107 | punct_count++; |
| 2114 | if (i > 0 && SYNTAX (prev_c) == Sword) | 2108 | if (SYNTAX (prev_c) == Sword) |
| 2115 | word_count++; | 2109 | word_count++; |
| 2116 | } | 2110 | } |
| 2117 | 2111 | ||
| @@ -2124,10 +2118,11 @@ wordify (Lisp_Object string, int lax) | |||
| 2124 | whitespace_at_end = 0; | 2118 | whitespace_at_end = 0; |
| 2125 | } | 2119 | } |
| 2126 | else | 2120 | else |
| 2127 | whitespace_at_end = 1; | 2121 | { |
| 2128 | 2122 | whitespace_at_end = 1; | |
| 2129 | if (!word_count) | 2123 | if (!word_count) |
| 2130 | return empty_unibyte_string; | 2124 | return empty_unibyte_string; |
| 2125 | } | ||
| 2131 | 2126 | ||
| 2132 | adjust = - punct_count + 5 * (word_count - 1) | 2127 | adjust = - punct_count + 5 * (word_count - 1) |
| 2133 | + ((lax && !whitespace_at_end) ? 2 : 4); | 2128 | + ((lax && !whitespace_at_end) ? 2 : 4); |
| @@ -2155,7 +2150,7 @@ wordify (Lisp_Object string, int lax) | |||
| 2155 | memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig); | 2150 | memcpy (o, SDATA (string) + i_byte_orig, i_byte - i_byte_orig); |
| 2156 | o += i_byte - i_byte_orig; | 2151 | o += i_byte - i_byte_orig; |
| 2157 | } | 2152 | } |
| 2158 | else if (i > 0 && SYNTAX (prev_c) == Sword && --word_count) | 2153 | else if (SYNTAX (prev_c) == Sword && --word_count) |
| 2159 | { | 2154 | { |
| 2160 | *o++ = '\\'; | 2155 | *o++ = '\\'; |
| 2161 | *o++ = 'W'; | 2156 | *o++ = 'W'; |
diff --git a/src/sound.c b/src/sound.c index a2fe7ccc8ce..a972809e2c7 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -344,7 +344,7 @@ sound_perror (const char *msg) | |||
| 344 | static void | 344 | static void |
| 345 | sound_warning (const char *msg) | 345 | sound_warning (const char *msg) |
| 346 | { | 346 | { |
| 347 | message (msg); | 347 | message ("%s", msg); |
| 348 | } | 348 | } |
| 349 | 349 | ||
| 350 | 350 | ||
diff --git a/src/syntax.c b/src/syntax.c index 0a1525b54ea..56176f32418 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -175,7 +175,8 @@ update_syntax_table (EMACS_INT charpos, int count, int init, | |||
| 175 | Lisp_Object object) | 175 | Lisp_Object object) |
| 176 | { | 176 | { |
| 177 | Lisp_Object tmp_table; | 177 | Lisp_Object tmp_table; |
| 178 | int cnt = 0, invalidate = 1; | 178 | unsigned cnt = 0; |
| 179 | int invalidate = 1; | ||
| 179 | INTERVAL i; | 180 | INTERVAL i; |
| 180 | 181 | ||
| 181 | if (init) | 182 | if (init) |
| @@ -1219,7 +1220,7 @@ scan_words (register EMACS_INT from, register EMACS_INT count) | |||
| 1219 | register EMACS_INT from_byte = CHAR_TO_BYTE (from); | 1220 | register EMACS_INT from_byte = CHAR_TO_BYTE (from); |
| 1220 | register enum syntaxcode code; | 1221 | register enum syntaxcode code; |
| 1221 | int ch0, ch1; | 1222 | int ch0, ch1; |
| 1222 | Lisp_Object func, script, pos; | 1223 | Lisp_Object func, pos; |
| 1223 | 1224 | ||
| 1224 | immediate_quit = 1; | 1225 | immediate_quit = 1; |
| 1225 | QUIT; | 1226 | QUIT; |
| @@ -1259,7 +1260,6 @@ scan_words (register EMACS_INT from, register EMACS_INT count) | |||
| 1259 | } | 1260 | } |
| 1260 | else | 1261 | else |
| 1261 | { | 1262 | { |
| 1262 | script = CHAR_TABLE_REF (Vchar_script_table, ch0); | ||
| 1263 | while (1) | 1263 | while (1) |
| 1264 | { | 1264 | { |
| 1265 | if (from == end) break; | 1265 | if (from == end) break; |
| @@ -1310,7 +1310,6 @@ scan_words (register EMACS_INT from, register EMACS_INT count) | |||
| 1310 | } | 1310 | } |
| 1311 | else | 1311 | else |
| 1312 | { | 1312 | { |
| 1313 | script = CHAR_TABLE_REF (Vchar_script_table, ch1); | ||
| 1314 | while (1) | 1313 | while (1) |
| 1315 | { | 1314 | { |
| 1316 | if (from == beg) | 1315 | if (from == beg) |
diff --git a/src/sysdep.c b/src/sysdep.c index 1bb400421f0..a165a9ca52f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -31,6 +31,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 31 | #endif /* HAVE_LIMITS_H */ | 31 | #endif /* HAVE_LIMITS_H */ |
| 32 | #include <unistd.h> | 32 | #include <unistd.h> |
| 33 | 33 | ||
| 34 | #include <allocator.h> | ||
| 35 | #include <careadlinkat.h> | ||
| 34 | #include <ignore-value.h> | 36 | #include <ignore-value.h> |
| 35 | 37 | ||
| 36 | #include "lisp.h" | 38 | #include "lisp.h" |
| @@ -1866,6 +1868,22 @@ emacs_write (int fildes, const char *buf, unsigned int nbyte) | |||
| 1866 | } | 1868 | } |
| 1867 | return (bytes_written); | 1869 | return (bytes_written); |
| 1868 | } | 1870 | } |
| 1871 | |||
| 1872 | static struct allocator const emacs_norealloc_allocator = | ||
| 1873 | { xmalloc, NULL, xfree, memory_full }; | ||
| 1874 | |||
| 1875 | /* Get the symbolic link value of FILENAME. Return a pointer to a | ||
| 1876 | NUL-terminated string. If readlink fails, return NULL and set | ||
| 1877 | errno. If the value fits in INITIAL_BUF, return INITIAL_BUF. | ||
| 1878 | Otherwise, allocate memory and return a pointer to that memory. If | ||
| 1879 | memory allocation fails, diagnose and fail without returning. If | ||
| 1880 | successful, store the length of the symbolic link into *LINKLEN. */ | ||
| 1881 | char * | ||
| 1882 | emacs_readlink (char const *filename, char initial_buf[READLINK_BUFSIZE]) | ||
| 1883 | { | ||
| 1884 | return careadlinkat (AT_FDCWD, filename, initial_buf, READLINK_BUFSIZE, | ||
| 1885 | &emacs_norealloc_allocator, careadlinkatcwd); | ||
| 1886 | } | ||
| 1869 | 1887 | ||
| 1870 | #ifdef USG | 1888 | #ifdef USG |
| 1871 | /* | 1889 | /* |
diff --git a/src/term.c b/src/term.c index fc7726298c5..39c9592e28f 100644 --- a/src/term.c +++ b/src/term.c | |||
| @@ -85,8 +85,10 @@ static void set_tty_hooks (struct terminal *terminal); | |||
| 85 | static void dissociate_if_controlling_tty (int fd); | 85 | static void dissociate_if_controlling_tty (int fd); |
| 86 | static void delete_tty (struct terminal *); | 86 | static void delete_tty (struct terminal *); |
| 87 | static void maybe_fatal (int must_succeed, struct terminal *terminal, | 87 | static void maybe_fatal (int must_succeed, struct terminal *terminal, |
| 88 | const char *str1, const char *str2, ...) NO_RETURN; | 88 | const char *str1, const char *str2, ...) |
| 89 | static void vfatal (const char *str, va_list ap) NO_RETURN; | 89 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (4, 5); |
| 90 | static void vfatal (const char *str, va_list ap) | ||
| 91 | NO_RETURN ATTRIBUTE_FORMAT_PRINTF (1, 0); | ||
| 90 | 92 | ||
| 91 | 93 | ||
| 92 | #define OUTPUT(tty, a) \ | 94 | #define OUTPUT(tty, a) \ |
| @@ -707,6 +709,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 707 | { | 709 | { |
| 708 | unsigned char *conversion_buffer; | 710 | unsigned char *conversion_buffer; |
| 709 | struct coding_system *coding; | 711 | struct coding_system *coding; |
| 712 | size_t n, stringlen; | ||
| 710 | 713 | ||
| 711 | struct tty_display_info *tty = FRAME_TTY (f); | 714 | struct tty_display_info *tty = FRAME_TTY (f); |
| 712 | 715 | ||
| @@ -734,13 +737,12 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 734 | the tail. */ | 737 | the tail. */ |
| 735 | coding->mode &= ~CODING_MODE_LAST_BLOCK; | 738 | coding->mode &= ~CODING_MODE_LAST_BLOCK; |
| 736 | 739 | ||
| 737 | while (len > 0) | 740 | for (stringlen = len; stringlen != 0; stringlen -= n) |
| 738 | { | 741 | { |
| 739 | /* Identify a run of glyphs with the same face. */ | 742 | /* Identify a run of glyphs with the same face. */ |
| 740 | int face_id = string->face_id; | 743 | int face_id = string->face_id; |
| 741 | int n; | ||
| 742 | 744 | ||
| 743 | for (n = 1; n < len; ++n) | 745 | for (n = 1; n < stringlen; ++n) |
| 744 | if (string[n].face_id != face_id) | 746 | if (string[n].face_id != face_id) |
| 745 | break; | 747 | break; |
| 746 | 748 | ||
| @@ -748,7 +750,7 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 748 | tty_highlight_if_desired (tty); | 750 | tty_highlight_if_desired (tty); |
| 749 | turn_on_face (f, face_id); | 751 | turn_on_face (f, face_id); |
| 750 | 752 | ||
| 751 | if (n == len) | 753 | if (n == stringlen) |
| 752 | /* This is the last run. */ | 754 | /* This is the last run. */ |
| 753 | coding->mode |= CODING_MODE_LAST_BLOCK; | 755 | coding->mode |= CODING_MODE_LAST_BLOCK; |
| 754 | conversion_buffer = encode_terminal_code (string, n, coding); | 756 | conversion_buffer = encode_terminal_code (string, n, coding); |
| @@ -762,7 +764,6 @@ tty_write_glyphs (struct frame *f, struct glyph *string, int len) | |||
| 762 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); | 764 | fwrite (conversion_buffer, 1, coding->produced, tty->termscript); |
| 763 | UNBLOCK_INPUT; | 765 | UNBLOCK_INPUT; |
| 764 | } | 766 | } |
| 765 | len -= n; | ||
| 766 | string += n; | 767 | string += n; |
| 767 | 768 | ||
| 768 | /* Turn appearance modes off. */ | 769 | /* Turn appearance modes off. */ |
diff --git a/src/textprop.c b/src/textprop.c index cd89efeb38d..53f92ec936b 100644 --- a/src/textprop.c +++ b/src/textprop.c | |||
| @@ -1379,8 +1379,8 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1379 | i = next_interval (i); | 1379 | i = next_interval (i); |
| 1380 | } | 1380 | } |
| 1381 | 1381 | ||
| 1382 | /* We are starting at the beginning of an interval, I */ | 1382 | /* We are starting at the beginning of an interval I. LEN is positive. */ |
| 1383 | while (len > 0) | 1383 | do |
| 1384 | { | 1384 | { |
| 1385 | if (i == 0) | 1385 | if (i == 0) |
| 1386 | abort (); | 1386 | abort (); |
| @@ -1412,6 +1412,7 @@ set_text_properties_1 (Lisp_Object start, Lisp_Object end, Lisp_Object propertie | |||
| 1412 | 1412 | ||
| 1413 | i = next_interval (i); | 1413 | i = next_interval (i); |
| 1414 | } | 1414 | } |
| 1415 | while (len > 0); | ||
| 1415 | } | 1416 | } |
| 1416 | 1417 | ||
| 1417 | DEFUN ("remove-text-properties", Fremove_text_properties, | 1418 | DEFUN ("remove-text-properties", Fremove_text_properties, |
diff --git a/src/xdisp.c b/src/xdisp.c index e6a7f4254ef..fbdd553aa51 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -774,6 +774,7 @@ static int store_mode_line_noprop (const char *, int, int); | |||
| 774 | static void handle_stop (struct it *); | 774 | static void handle_stop (struct it *); |
| 775 | static void handle_stop_backwards (struct it *, EMACS_INT); | 775 | static void handle_stop_backwards (struct it *, EMACS_INT); |
| 776 | static int single_display_spec_intangible_p (Lisp_Object); | 776 | static int single_display_spec_intangible_p (Lisp_Object); |
| 777 | static void vmessage (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); | ||
| 777 | static void ensure_echo_area_buffers (void); | 778 | static void ensure_echo_area_buffers (void); |
| 778 | static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); | 779 | static Lisp_Object unwind_with_echo_area_buffer (Lisp_Object); |
| 779 | static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); | 780 | static Lisp_Object with_echo_area_buffer_unwind_data (struct window *); |
diff --git a/src/xfaces.c b/src/xfaces.c index 0fc5dd6f8a3..8a64855bd8f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -5444,7 +5444,6 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id) | |||
| 5444 | Lisp_Object lface = lface_from_face_name (f, symbol, 0); | 5444 | Lisp_Object lface = lface_from_face_name (f, symbol, 0); |
| 5445 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; | 5445 | Lisp_Object attrs[LFACE_VECTOR_SIZE]; |
| 5446 | Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; | 5446 | Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; |
| 5447 | struct face *new_face; | ||
| 5448 | 5447 | ||
| 5449 | /* The default face must exist and be fully specified. */ | 5448 | /* The default face must exist and be fully specified. */ |
| 5450 | get_lface_attributes_no_remap (f, Qdefault, attrs, 1); | 5449 | get_lface_attributes_no_remap (f, Qdefault, attrs, 1); |
| @@ -5464,7 +5463,7 @@ realize_named_face (struct frame *f, Lisp_Object symbol, int id) | |||
| 5464 | merge_face_vectors (f, symbol_attrs, attrs, 0); | 5463 | merge_face_vectors (f, symbol_attrs, attrs, 0); |
| 5465 | 5464 | ||
| 5466 | /* Realize the face. */ | 5465 | /* Realize the face. */ |
| 5467 | new_face = realize_face (c, attrs, id); | 5466 | realize_face (c, attrs, id); |
| 5468 | } | 5467 | } |
| 5469 | 5468 | ||
| 5470 | 5469 | ||
| @@ -5761,21 +5760,16 @@ map_tty_color (struct frame *f, struct face *face, enum lface_attribute_index id | |||
| 5761 | { | 5760 | { |
| 5762 | Lisp_Object frame, color, def; | 5761 | Lisp_Object frame, color, def; |
| 5763 | int foreground_p = idx == LFACE_FOREGROUND_INDEX; | 5762 | int foreground_p = idx == LFACE_FOREGROUND_INDEX; |
| 5764 | unsigned long default_pixel, default_other_pixel, pixel; | 5763 | unsigned long default_pixel = |
| 5764 | foreground_p ? FACE_TTY_DEFAULT_FG_COLOR : FACE_TTY_DEFAULT_BG_COLOR; | ||
| 5765 | unsigned long pixel = default_pixel; | ||
| 5766 | #ifdef MSDOS | ||
| 5767 | unsigned long default_other_pixel = | ||
| 5768 | foreground_p ? FACE_TTY_DEFAULT_BG_COLOR : FACE_TTY_DEFAULT_FG_COLOR; | ||
| 5769 | #endif | ||
| 5765 | 5770 | ||
| 5766 | xassert (idx == LFACE_FOREGROUND_INDEX || idx == LFACE_BACKGROUND_INDEX); | 5771 | xassert (idx == LFACE_FOREGROUND_INDEX || idx == LFACE_BACKGROUND_INDEX); |
| 5767 | 5772 | ||
| 5768 | if (foreground_p) | ||
| 5769 | { | ||
| 5770 | pixel = default_pixel = FACE_TTY_DEFAULT_FG_COLOR; | ||
| 5771 | default_other_pixel = FACE_TTY_DEFAULT_BG_COLOR; | ||
| 5772 | } | ||
| 5773 | else | ||
| 5774 | { | ||
| 5775 | pixel = default_pixel = FACE_TTY_DEFAULT_BG_COLOR; | ||
| 5776 | default_other_pixel = FACE_TTY_DEFAULT_FG_COLOR; | ||
| 5777 | } | ||
| 5778 | |||
| 5779 | XSETFRAME (frame, f); | 5773 | XSETFRAME (frame, f); |
| 5780 | color = face->lface[idx]; | 5774 | color = face->lface[idx]; |
| 5781 | 5775 | ||
diff --git a/src/xfns.c b/src/xfns.c index e50d6887179..8e5639681df 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -855,19 +855,20 @@ make_invisible_cursor (struct frame *f) | |||
| 855 | static char const no_data[] = { 0 }; | 855 | static char const no_data[] = { 0 }; |
| 856 | Pixmap pix; | 856 | Pixmap pix; |
| 857 | XColor col; | 857 | XColor col; |
| 858 | Cursor c; | 858 | Cursor c = 0; |
| 859 | 859 | ||
| 860 | x_catch_errors (dpy); | 860 | x_catch_errors (dpy); |
| 861 | pix = XCreateBitmapFromData (dpy, FRAME_X_DISPLAY_INFO (f)->root_window, | 861 | pix = XCreateBitmapFromData (dpy, FRAME_X_DISPLAY_INFO (f)->root_window, |
| 862 | no_data, 1, 1); | 862 | no_data, 1, 1); |
| 863 | if (! x_had_errors_p (dpy) && pix != None) | 863 | if (! x_had_errors_p (dpy) && pix != None) |
| 864 | { | 864 | { |
| 865 | Cursor pixc; | ||
| 865 | col.pixel = 0; | 866 | col.pixel = 0; |
| 866 | col.red = col.green = col.blue = 0; | 867 | col.red = col.green = col.blue = 0; |
| 867 | col.flags = DoRed | DoGreen | DoBlue; | 868 | col.flags = DoRed | DoGreen | DoBlue; |
| 868 | c = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0); | 869 | pixc = XCreatePixmapCursor (dpy, pix, pix, &col, &col, 0, 0); |
| 869 | if (x_had_errors_p (dpy) || c == None) | 870 | if (! x_had_errors_p (dpy) && pixc != None) |
| 870 | c = 0; | 871 | c = pixc; |
| 871 | XFreePixmap (dpy, pix); | 872 | XFreePixmap (dpy, pix); |
| 872 | } | 873 | } |
| 873 | 874 | ||
| @@ -4579,7 +4580,6 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4579 | struct frame *f; | 4580 | struct frame *f; |
| 4580 | Lisp_Object frame; | 4581 | Lisp_Object frame; |
| 4581 | Lisp_Object name; | 4582 | Lisp_Object name; |
| 4582 | long window_prompting = 0; | ||
| 4583 | int width, height; | 4583 | int width, height; |
| 4584 | int count = SPECPDL_INDEX (); | 4584 | int count = SPECPDL_INDEX (); |
| 4585 | struct gcpro gcpro1, gcpro2, gcpro3; | 4585 | struct gcpro gcpro1, gcpro2, gcpro3; |
| @@ -4757,7 +4757,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, | |||
| 4757 | 4757 | ||
| 4758 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; | 4758 | f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; |
| 4759 | 4759 | ||
| 4760 | window_prompting = x_figure_window_size (f, parms, 0); | 4760 | x_figure_window_size (f, parms, 0); |
| 4761 | 4761 | ||
| 4762 | { | 4762 | { |
| 4763 | XSetWindowAttributes attrs; | 4763 | XSetWindowAttributes attrs; |
diff --git a/src/xfont.c b/src/xfont.c index 3e0fcd2cd75..eaa1a3ea59b 100644 --- a/src/xfont.c +++ b/src/xfont.c | |||
| @@ -844,22 +844,25 @@ xfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) | |||
| 844 | font->average_width = XINT (val) / 10; | 844 | font->average_width = XINT (val) / 10; |
| 845 | if (font->average_width < 0) | 845 | if (font->average_width < 0) |
| 846 | font->average_width = - font->average_width; | 846 | font->average_width = - font->average_width; |
| 847 | if (font->average_width == 0 | 847 | else |
| 848 | && encoding->ascii_compatible_p) | ||
| 849 | { | 848 | { |
| 850 | int width = font->space_width, n = pcm != NULL; | 849 | if (font->average_width == 0 |
| 850 | && encoding->ascii_compatible_p) | ||
| 851 | { | ||
| 852 | int width = font->space_width, n = pcm != NULL; | ||
| 851 | 853 | ||
| 852 | for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) | 854 | for (char2b.byte2 = 33; char2b.byte2 <= 126; char2b.byte2++) |
| 853 | if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL) | 855 | if ((pcm = xfont_get_pcm (xfont, &char2b)) != NULL) |
| 854 | width += pcm->width, n++; | 856 | width += pcm->width, n++; |
| 855 | if (n > 0) | 857 | if (n > 0) |
| 856 | font->average_width = width / n; | 858 | font->average_width = width / n; |
| 859 | } | ||
| 860 | if (font->average_width == 0) | ||
| 861 | /* No easy way other than this to get a reasonable | ||
| 862 | average_width. */ | ||
| 863 | font->average_width | ||
| 864 | = (xfont->min_bounds.width + xfont->max_bounds.width) / 2; | ||
| 857 | } | 865 | } |
| 858 | if (font->average_width == 0) | ||
| 859 | /* No easy way other than this to get a reasonable | ||
| 860 | average_width. */ | ||
| 861 | font->average_width | ||
| 862 | = (xfont->min_bounds.width + xfont->max_bounds.width) / 2; | ||
| 863 | } | 866 | } |
| 864 | 867 | ||
| 865 | BLOCK_INPUT; | 868 | BLOCK_INPUT; |
| @@ -966,11 +969,11 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f | |||
| 966 | { | 969 | { |
| 967 | XFontStruct *xfont = ((struct xfont_info *) font)->xfont; | 970 | XFontStruct *xfont = ((struct xfont_info *) font)->xfont; |
| 968 | int width = 0; | 971 | int width = 0; |
| 969 | int i, first, x; | 972 | int i, first; |
| 970 | 973 | ||
| 971 | if (metrics) | 974 | if (metrics) |
| 972 | memset (metrics, 0, sizeof (struct font_metrics)); | 975 | memset (metrics, 0, sizeof (struct font_metrics)); |
| 973 | for (i = 0, x = 0, first = 1; i < nglyphs; i++) | 976 | for (i = 0, first = 1; i < nglyphs; i++) |
| 974 | { | 977 | { |
| 975 | XChar2b char2b; | 978 | XChar2b char2b; |
| 976 | static XCharStruct *pcm; | 979 | static XCharStruct *pcm; |
diff --git a/src/xmenu.c b/src/xmenu.c index 8ecef00c88e..6e175e69039 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -341,7 +341,7 @@ for instance using the window manager, then this produces a quit and | |||
| 341 | unbind_to (specpdl_count, Qnil); | 341 | unbind_to (specpdl_count, Qnil); |
| 342 | discard_menu_items (); | 342 | discard_menu_items (); |
| 343 | 343 | ||
| 344 | if (error_name) error (error_name); | 344 | if (error_name) error ("%s", error_name); |
| 345 | return selection; | 345 | return selection; |
| 346 | } | 346 | } |
| 347 | #endif | 347 | #endif |
diff --git a/src/xselect.c b/src/xselect.c index 451b2a0b13f..430b7232659 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -391,7 +391,7 @@ static Lisp_Object | |||
| 391 | x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, int local_request) | 391 | x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, int local_request) |
| 392 | { | 392 | { |
| 393 | Lisp_Object local_value; | 393 | Lisp_Object local_value; |
| 394 | Lisp_Object handler_fn, value, type, check; | 394 | Lisp_Object handler_fn, value, check; |
| 395 | int count; | 395 | int count; |
| 396 | 396 | ||
| 397 | local_value = assq_no_quit (selection_symbol, Vselection_alist); | 397 | local_value = assq_no_quit (selection_symbol, Vselection_alist); |
| @@ -469,7 +469,6 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, in | |||
| 469 | check = value; | 469 | check = value; |
| 470 | if (CONSP (value) | 470 | if (CONSP (value) |
| 471 | && SYMBOLP (XCAR (value))) | 471 | && SYMBOLP (XCAR (value))) |
| 472 | type = XCAR (value), | ||
| 473 | check = XCDR (value); | 472 | check = XCDR (value); |
| 474 | 473 | ||
| 475 | if (STRINGP (check) | 474 | if (STRINGP (check) |
| @@ -1203,9 +1202,9 @@ wait_for_property_change (struct prop_location *location) | |||
| 1203 | void | 1202 | void |
| 1204 | x_handle_property_notify (XPropertyEvent *event) | 1203 | x_handle_property_notify (XPropertyEvent *event) |
| 1205 | { | 1204 | { |
| 1206 | struct prop_location *prev = 0, *rest = property_change_wait_list; | 1205 | struct prop_location *rest; |
| 1207 | 1206 | ||
| 1208 | while (rest) | 1207 | for (rest = property_change_wait_list; rest; rest = rest->next) |
| 1209 | { | 1208 | { |
| 1210 | if (!rest->arrived | 1209 | if (!rest->arrived |
| 1211 | && rest->property == event->atom | 1210 | && rest->property == event->atom |
| @@ -1226,9 +1225,6 @@ x_handle_property_notify (XPropertyEvent *event) | |||
| 1226 | 1225 | ||
| 1227 | return; | 1226 | return; |
| 1228 | } | 1227 | } |
| 1229 | |||
| 1230 | prev = rest; | ||
| 1231 | rest = rest->next; | ||
| 1232 | } | 1228 | } |
| 1233 | } | 1229 | } |
| 1234 | 1230 | ||
diff --git a/src/xterm.c b/src/xterm.c index dc1fd3cbbd1..92df7ae8746 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -4165,7 +4165,7 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name, | |||
| 4165 | x_send_scroll_bar_event and x_scroll_bar_to_input_event. */ | 4165 | x_send_scroll_bar_event and x_scroll_bar_to_input_event. */ |
| 4166 | 4166 | ||
| 4167 | static struct window **scroll_bar_windows; | 4167 | static struct window **scroll_bar_windows; |
| 4168 | static int scroll_bar_windows_size; | 4168 | static size_t scroll_bar_windows_size; |
| 4169 | 4169 | ||
| 4170 | 4170 | ||
| 4171 | /* Send a client message with message type Xatom_Scrollbar for a | 4171 | /* Send a client message with message type Xatom_Scrollbar for a |
| @@ -4180,7 +4180,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) | |||
| 4180 | XClientMessageEvent *ev = (XClientMessageEvent *) &event; | 4180 | XClientMessageEvent *ev = (XClientMessageEvent *) &event; |
| 4181 | struct window *w = XWINDOW (window); | 4181 | struct window *w = XWINDOW (window); |
| 4182 | struct frame *f = XFRAME (w->frame); | 4182 | struct frame *f = XFRAME (w->frame); |
| 4183 | int i; | 4183 | size_t i; |
| 4184 | 4184 | ||
| 4185 | BLOCK_INPUT; | 4185 | BLOCK_INPUT; |
| 4186 | 4186 | ||
| @@ -4201,10 +4201,12 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) | |||
| 4201 | 4201 | ||
| 4202 | if (i == scroll_bar_windows_size) | 4202 | if (i == scroll_bar_windows_size) |
| 4203 | { | 4203 | { |
| 4204 | int new_size = max (10, 2 * scroll_bar_windows_size); | 4204 | size_t new_size = max (10, 2 * scroll_bar_windows_size); |
| 4205 | size_t nbytes = new_size * sizeof *scroll_bar_windows; | 4205 | size_t nbytes = new_size * sizeof *scroll_bar_windows; |
| 4206 | size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows; | 4206 | size_t old_nbytes = scroll_bar_windows_size * sizeof *scroll_bar_windows; |
| 4207 | 4207 | ||
| 4208 | if ((size_t) -1 / sizeof *scroll_bar_windows < new_size) | ||
| 4209 | memory_full (); | ||
| 4208 | scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, | 4210 | scroll_bar_windows = (struct window **) xrealloc (scroll_bar_windows, |
| 4209 | nbytes); | 4211 | nbytes); |
| 4210 | memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes); | 4212 | memset (&scroll_bar_windows[i], 0, nbytes - old_nbytes); |
| @@ -4240,14 +4242,12 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) | |||
| 4240 | { | 4242 | { |
| 4241 | XClientMessageEvent *ev = (XClientMessageEvent *) event; | 4243 | XClientMessageEvent *ev = (XClientMessageEvent *) event; |
| 4242 | Lisp_Object window; | 4244 | Lisp_Object window; |
| 4243 | struct frame *f; | ||
| 4244 | struct window *w; | 4245 | struct window *w; |
| 4245 | 4246 | ||
| 4246 | w = scroll_bar_windows[ev->data.l[0]]; | 4247 | w = scroll_bar_windows[ev->data.l[0]]; |
| 4247 | scroll_bar_windows[ev->data.l[0]] = NULL; | 4248 | scroll_bar_windows[ev->data.l[0]] = NULL; |
| 4248 | 4249 | ||
| 4249 | XSETWINDOW (window, w); | 4250 | XSETWINDOW (window, w); |
| 4250 | f = XFRAME (w->frame); | ||
| 4251 | 4251 | ||
| 4252 | ievent->kind = SCROLL_BAR_CLICK_EVENT; | 4252 | ievent->kind = SCROLL_BAR_CLICK_EVENT; |
| 4253 | ievent->frame_or_window = window; | 4253 | ievent->frame_or_window = window; |
| @@ -4255,7 +4255,8 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) | |||
| 4255 | #ifdef USE_GTK | 4255 | #ifdef USE_GTK |
| 4256 | ievent->timestamp = CurrentTime; | 4256 | ievent->timestamp = CurrentTime; |
| 4257 | #else | 4257 | #else |
| 4258 | ievent->timestamp = XtLastTimestampProcessed (FRAME_X_DISPLAY (f)); | 4258 | ievent->timestamp = |
| 4259 | XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (w->frame))); | ||
| 4259 | #endif | 4260 | #endif |
| 4260 | ievent->part = ev->data.l[1]; | 4261 | ievent->part = ev->data.l[1]; |
| 4261 | ievent->code = ev->data.l[2]; | 4262 | ievent->code = ev->data.l[2]; |