]> code.delx.au - gnu-emacs/blob - src/ChangeLog
Merge from trunk.
[gnu-emacs] / src / ChangeLog
1 2011-09-30 Paul Eggert <eggert@cs.ucla.edu>
2
3 * alloc.c (pure_bytes_used_lisp, pure_bytes_used_non_lisp):
4 (allocate_vectorlike, buffer_memory_full, struct sdata, SDATA_SIZE)
5 (string_bytes, check_sblock, allocate_string_data):
6 (compact_small_strings, Fmake_bool_vector, make_string)
7 (make_unibyte_string, make_multibyte_string)
8 (make_string_from_bytes, make_specified_string)
9 (allocate_vectorlike, Fmake_vector, find_string_data_in_pure)
10 (make_pure_string, make_pure_c_string, make_pure_vector, Fpurecopy)
11 (mark_vectorlike):
12 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
13 (allocate_pseudovector):
14 Use int, not EMACS_INT, where int is wide enough.
15 (inhibit_garbage_collection, Fgarbage_collect):
16 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
17 * bidi.c (bidi_mirror_char): Use EMACS_INT, not int, where
18 int might not be wide enough.
19 (bidi_cache_search, bidi_cache_find, bidi_init_it)
20 (bidi_count_bytes, bidi_char_at_pos, bidi_fetch_char)
21 (bidi_at_paragraph_end, bidi_find_paragraph_start)
22 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak)
23 (bidi_level_of_next_char, bidi_move_to_visually_next):
24 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
25 * buffer.c (copy_overlays, Fgenerate_new_buffer_name)
26 (Fkill_buffer, Fset_buffer_major_mode)
27 (advance_to_char_boundary, Fbuffer_swap_text)
28 (Fset_buffer_multibyte, overlays_at, overlays_in)
29 (overlay_touches_p, struct sortvec, record_overlay_string)
30 (overlay_strings, recenter_overlay_lists)
31 (adjust_overlays_for_insert, adjust_overlays_for_delete)
32 (fix_start_end_in_overlays, fix_overlays_before, modify_overlay)
33 (Fmove_overlay, Fnext_overlay_change, Fprevious_overlay_change)
34 (Foverlay_recenter, last_overlay_modification_hooks_used)
35 (report_overlay_modification, evaporate_overlays, enlarge_buffer_text):
36 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
37 (validate_region): Omit unnecessary test for b <= e, since
38 that's guaranteed by the previous test.
39 (adjust_overlays_for_delete): Avoid pos + length overflow.
40 (Fmove_overlay, Fdelete_overlay, add_overlay_mod_hooklist)
41 (report_overlay_modification):
42 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
43 (Foverlays_at, Fnext_overlay_change, Fprevious_overlay_change):
44 Omit pointer cast, which isn't needed anyway, and doesn't work
45 after the EMACS_INT -> ptrdiff_t change.
46 * buffer.h: Adjust decls to match defn changes elsewhere.
47 (struct buffer_text, struct buffer):
48 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
49 Use EMACS_INT, not int, where int might not be wide enough.
50 * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, to avoid
51 needless 32-bit limit on 64-bit hosts. Remove unnecessary
52 memory-full test. Use EMACS_INT, not ptrdiff_t or int, where
53 ptrdiff_t or int might not be wide enough.
54 * callint.c (Fcall_interactively):
55 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
56 * callproc.c (call_process_kill, Fcall_process):
57 Don't assume pid_t fits into an Emacs fixnum.
58 (call_process_cleanup, Fcall_process, child_setup):
59 Don't assume pid_t fits into int.
60 (call_process_cleanup, Fcall_process, delete_temp_file)
61 (Fcall_process_region):
62 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
63 (Fcall_process): Simplify handling of volatile integers.
64 Use int, not EMACS_INT, where int will do.
65 * casefiddle.c (casify_object, casify_region, operate_on_word)
66 (Fupcase_word, Fdowncase_word, Fcapitalize_word):
67 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
68 (casify_object): Avoid integer overflow when overallocating buffer.
69 * casetab.c (set_identity, shuffle): Prefer int to unsigned when
70 either works. Use lint_assume to convince GCC 4.6.1 that it's OK.
71 * category.c (Fchar_category_set): Don't assume fixnum fits in int.
72 * category.h (CATEGORYP): Don't assume arg is nonnegative.
73 * ccl.c (GET_CCL_INT): Remove; no longer needed, since the
74 integers are now checked earlier. All uses replaced with XINT.
75 (ccl_driver):
76 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
77 For CCL_MapSingle, check that content and value are in int range.
78 (ccl_driver, Fregister_code_conversion_map):
79 Check that Vcode_version_map_vector is a vector.
80 (resolve_symbol_ccl_program): Check that vector header is in range.
81 Always copy the vector, so that we can check its contents reliably
82 now rather than having to recheck each instruction as it's being
83 executed. Check that vector words fit in 'int'.
84 (ccl_get_compiled_code, Fregister_ccl_program)
85 (Fregister_code_conversion_map): Use ptrdiff_t, not int, for
86 program indexes, to avoid needless 32-bit limit on 64-bit hosts.
87 (Fccl_execute, Fccl_execute_on_string): Check that initial reg
88 contents are in range.
89 (Fccl_execute_on_string): Check that status is in range.
90 * ccl.h (struct ccl_program.idx): Now ptrdiff_t, not int.
91 * character.c (char_resolve_modifier_mask, Fchar_resolve_modifiers):
92 Accept and return EMACS_INT, not int, because callers can pass values
93 out of 'int' range.
94 (c_string_width, strwidth, lisp_string_width, chars_in_text)
95 (multibyte_chars_in_text, parse_str_as_multibyte)
96 (str_as_multibyte, count_size_as_multibyte, str_to_multibyte)
97 (str_as_unibyte, str_to_unibyte, string_count_byte8)
98 (string_escape_byte8, Fget_byte):
99 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
100 (Funibyte_string): Use CHECK_CHARACTER, not CHECK_NATNUM, to
101 avoid mishandling large integers.
102 * character.h: Adjust decls to match defn changes elsewhere.
103 * charset.c (load_charset_map_from_file, find_charsets_in_text)
104 (Ffind_charset_region):
105 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
106 (load_charset_map_from_file): Redo idx calculation to avoid overflow.
107 (load_charset_map_from_vector, Fdefine_charset_internal):
108 Don't assume fixnum fits in int.
109 (load_charset_map_from_vector, Fmap_charset_chars):
110 Remove now-unnecessary CHECK_NATNUMs.
111 (Fdefine_charset_internal): Check ranges here, more carefully.
112 Don't rely on undefined behavior with signed left shift overflow.
113 Don't assume unsigned int fits into fixnum, or that fixnum fits
114 into unsigned int. Don't require max_code to be a valid fixnum;
115 that's not true for gb10830 4-byte on a 32-bit host. Allow
116 invalid_code to be a cons, for the same reason. Require code_offset
117 to be a character. Avoid int overflow if max_char is close
118 to INT_MAX.
119 (CODE_POINT_TO_INDEX): On 32-bit hosts, return int, not unsigned;
120 this is intended anyway and avoids some undefined behavior.
121 (load_charset_map): Pass unsigned, not int, as 2nd arg of
122 INDEX_TO_CODE_POINT, as that's what it expects.
123 (Funify_charset, encode_char): Don't stuff unsigned vals into int vars.
124 * charset.h (DECODE_CHAR): Return int, not unsigned;
125 this is what was intended anyway, and it avoids undefined behavior.
126 (CHARSET_OFFSET): Remove unused macro, instead of fixing its
127 integer-overflow issues.
128 (ENCODE_CHAR): Return unsigned on all hosts, not just on 32-bit hosts.
129 Formerly, it returned EMACS_INT on 64-bit hosts in the common case
130 where the argument is EMACS_INT, and this behavior is not intended.
131 * chartab.c (Fmake_char_table, Fset_char_table_range)
132 (uniprop_get_decoder, uniprop_get_encoder):
133 Don't assume fixnum fits in int.
134 * cmds.c (move_point): New function, that does the gist of
135 Fforward_char and Fbackward_char, but does so while checking
136 for integer overflow more accurately.
137 (Fforward_char, Fbackward_char): Use it.
138 (Fforward_line, Fend_of_line, internal_self_insert)
139 (internal_self_insert):
140 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
141 Fix a FIXME, by checking for integer overflow when calculating
142 target_clm and actual_clm.
143 * coding.c (detect_coding_XXX, encode_coding_XXX, CODING_DECODE_CHAR)
144 (ASSURE_DESTINATION, coding_alloc_by_realloc)
145 (coding_alloc_by_making_gap, alloc_destination)
146 (detect_coding_utf_8, encode_coding_utf_8, decode_coding_utf_16)
147 (encode_coding_utf_16, detect_coding_emacs_mule)
148 (decode_coding_emacs_mule, encode_coding_emacs_mule)
149 (detect_coding_iso_2022, decode_coding_iso_2022)
150 (encode_invocation_designation, encode_designation_at_bol)
151 (encode_coding_iso_2022, detect_coding_sjis, detect_coding_big5)
152 (decode_coding_sjis, decode_coding_big5, encode_coding_sjis)
153 (encode_coding_big5, detect_coding_ccl, decode_coding_ccl)
154 (encode_coding_ccl, encode_coding_raw_text)
155 (detect_coding_charset, decode_coding_charset)
156 (encode_coding_charset, detect_eol, decode_eol, produce_chars)
157 (produce_composition, produce_charset, produce_annotation)
158 (decode_coding, handle_composition_annotation)
159 (handle_charset_annotation, consume_chars, decode_coding_gap)
160 (decode_coding_object, encode_coding_object, detect_coding_system)
161 (Ffind_coding_systems_region_internal, Fcheck_coding_systems_region)
162 (code_convert_region, code_convert_string)
163 (Fdefine_coding_system_internal):
164 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
165 (setup_iso_safe_charsets, consume_chars, Funencodable_char_position)
166 (Fdefine_coding_system_internal):
167 Don't assume fixnums fit in int.
168 (decode_coding_gap, decode_coding_object, encode_coding_object)
169 (Fread_coding_system, Fdetect_coding_region)
170 (Funencodable_char_position, Fcheck_coding_systems_region)
171 (get_translation, handle_composition_annotation, consume_chars):
172 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
173 (consume_chars): Rewrite to avoid calculating an address outside buffer.
174 (Ffind_operation_coding_system): NATNUMP can eval its arg twice.
175 Don't access memory outside of the args array.
176 (Fdefine_coding_system_internal): Check for charset-id overflow.
177 (ENCODE_ISO_CHARACTER): Use unsigned, not int, to store the unsigned
178 result of ENCODE_CHAR.
179 * coding.h: Adjust decls to match defn changes elsewhere.
180 (struct coding_system):
181 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
182 * composite.c (get_composition_id, find_composition)
183 (run_composition_function, update_compositions)
184 (compose_text, composition_gstring_put_cache)
185 (composition_gstring_p, composition_gstring_width)
186 (fill_gstring_header, fill_gstring_body, autocmp_chars)
187 (composition_compute_stop_pos, composition_reseat_it)
188 (composition_update_it, struct position_record)
189 (find_automatic_composition, composition_adjust_point)
190 (Fcomposition_get_gstring, Ffind_composition_internal):
191 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
192 (update_compositions):
193 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
194 * composite.h: Adjust decls to match defn changes elsewhere.
195 (struct composition):
196 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
197 * data.c (let_shadows_buffer_binding_p, let_shadows_global_binding_p):
198 Do not attempt to compute the address of the object just before a
199 buffer; this is not portable.
200 (Faref, Faset):
201 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
202 (Faset): Use int, not EMACS_INT, where int is wide enough.
203 (Fstring_to_number): Don't assume fixnums fit in int.
204 (Frem): Don't assume arg is nonnegative.
205 * dbusbind.c (xd_append_arg): Check for integers out of range.
206 (Fdbus_call_method): Don't overflow the timeout int.
207 * dired.c (directory_files_internal, file_name_completion, scmp)
208 (file_name_completion_stat):
209 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
210 (file_name_completion): Don't overflow matchcount.
211 (file_name_completion_stat): Use SAFE_ALLOCA, not alloca.
212 * dispextern.h: Adjust decls to match defn changes elsewhere.
213 (struct text_pos, struct glyph, struct bidi_saved_info)
214 (struct bidi_string_data, struct bidi_it, struct composition_it)
215 (struct it):
216 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
217 (struct display_pos, struct composition_it, struct it):
218 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
219 * dispnew.c (increment_matrix_positions)
220 (increment_row_positions, mode_line_string)
221 (marginal_area_string):
222 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
223 (change_frame_size_1, Fredisplay, Fframe_or_buffer_changed_p):
224 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
225 (duration_to_sec_usec): New function, to check for overflow better.
226 (Fsleep_for, sit_for): Use it.
227 * doc.c (get_doc_string, store_function_docstring):
228 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
229 (get_doc_string, Fsnarf_documentation):
230 Use int, not EMACS_INT, where int is wide enough.
231 (get_doc_string):
232 Use SAFE_ALLOCA, not alloca.
233 Check for overflow when converting EMACS_INT to off_t.
234 * doprnt.c (doprnt):
235 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
236 * editfns.c (init_editfns, Fuser_uid, Fuser_real_uid):
237 Don't assume uid_t fits into fixnum.
238 (buildmark, Fgoto_char, overlays_around, find_field, Fdelete_field)
239 (Ffield_string, Ffield_string_no_properties, Ffield_beginning)
240 (Ffield_end, Fconstrain_to_field, Fline_beginning_position)
241 (Fline_end_position, Fprevious_char, Fchar_after, Fchar_before)
242 (general_insert_function)
243 (Finsert_char, make_buffer_string, make_buffer_string_both)
244 (update_buffer_properties, Fbuffer_substring)
245 (Fbuffer_substring_no_properties, Fcompare_buffer_substrings)
246 (Fsubst_char_in_region, check_translation)
247 (Ftranslate_region_internal, save_restriction_restore, Fformat)
248 (transpose_markers, Ftranspose_regions):
249 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
250 (clip_to_bounds): Move to lisp.h as an inline function).
251 (Fconstrain_to_field): Don't assume integers are nonnegative.
252 (Fline_beginning_position, Fsave_excursion, Fsave_current_buffer):
253 (Fsubst_char_in_region, Fsave_restriction):
254 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
255 (Femacs_pid): Don't assume pid_t fits into fixnum.
256 (lo_time): Use int, not EMACS_INT, when int suffices.
257 (lisp_time_argument): Check for usec out of range.
258 (Fencode_time): Don't assume fixnum fits in int.
259 * emacs.c (gdb_valbits, gdb_gctypebits): Now int, not EMACS_INT.
260 (gdb_data_seg_bits): Now uintptr_t, not EMACS_INT.
261 (PVEC_FLAG, gdb_array_mark_flag): Now ptrdiff_t, not EMACS_INT.
262 (init_cmdargs, Fdump_emacs):
263 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
264 (Fkill_emacs): Don't assume fixnum fits in int; instead, take just
265 the bottom (typically) 32 bits of the fixnum.
266 * eval.c (specpdl_size, call_debugger):
267 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
268 (when_entered_debugger, Fbacktrace_debug):
269 Don't assume fixnum can fit in int.
270 (Fdefvaralias, Fdefvar): Do not attempt to compute the address of
271 the object just before a buffer; this is not portable.
272 (FletX, Flet, Funwind_protect, do_autoload, Feval, funcall_lambda)
273 (grow_specpdl, unbind_to):
274 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
275 (Fapply, apply_lambda): Don't assume ptrdiff_t can hold fixnum.
276 (grow_specpdl): Simplify allocation by using xpalloc.
277 (Fprog1, Fprog2): Don't assume list length fits in int. Simplify.
278 * fileio.c (Ffind_file_name_handler, Fcopy_file, Frename_file)
279 (Finsert_file_contents, Fwrite_region, Fdo_auto_save):
280 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
281 (Ffind_file_name_handler, non_regular_inserted, Finsert_file_contents)
282 (a_write, e_write):
283 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
284 (Fcopy_file, non_regular_nbytes, read_non_regular)
285 (Finsert_file_contents):
286 Use int, not EMACS_INT, where int is wide enough.
287 (READ_BUF_SIZE): Verify that it fits in int.
288 (Finsert_file_contents): Check that counts are in proper range,
289 rather than assuming fixnums fit into ptrdiff_t etc.
290 Don't assume fixnums fit into int.
291 (Fdo_auto_save, Fset_buffer_auto_saved)
292 (Fclear_buffer_auto_save_failure):
293 Don't assume time_t is signed, or that it fits in int.
294 * floatfns.c (Fexpt): Avoid undefined signed * signed overflow.
295 * fns.c (Fcompare_strings, Fstring_lessp, struct textprop_rec, concat)
296 (string_char_byte_cache_charpos, string_char_byte_cache_bytepos)
297 (string_char_to_byte, string_byte_to_char)
298 (string_make_multibyte, string_to_multibyte)
299 (string_make_unibyte, Fstring_as_unibyte, Fstring_as_multibyte)
300 (Fstring_to_unibyte, Fsubstring, Fsubstring_no_properties)
301 (substring_both, Fdelete, internal_equal, Ffillarray)
302 (Fclear_string, mapcar1)
303 (Fbase64_encode_region, Fbase64_encode_string, base64_encode_1)
304 (Fbase64_decode_region, Fbase64_decode_string, base64_decode_1)
305 (larger_vector, make_hash_table, maybe_resize_hash_table)
306 (hash_lookup, hash_remove_from_table, hash_clear, sweep_weak_table)
307 (Fmaphash, secure_hash):
308 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
309 (concat): Check for string index and length overflow.
310 (Fmapconcat): Don't assume fixnums fit into ptrdiff_t.
311 (Frequire):
312 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
313 (larger_vector): New API (vec, incr_min, size_max) replaces old
314 one (vec, new_size, init). This catches size overflow.
315 INIT was removed because it was always Qnil.
316 All callers changed.
317 (INDEX_SIZE_BOUND): New macro, which calculates more precisely
318 the upper bound on a hash table index size.
319 (make_hash_table, maybe_resize_hash_table): Use it.
320 (secure_hash): Computer start_byte and end_byte only after
321 they're known to be in ptrdiff_t range.
322 * font.c (font_intern_prop, font_at, font_range, Ffont_shape_gstring)
323 (Ffont_get_glyphs, Ffont_at):
324 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
325 (font_style_to_value, font_prop_validate_style, font_expand_wildcards)
326 (Flist_fonts, Fopen_font):
327 Don't assume fixnum can fit in int.
328 (check_gstring): Don't assume index can fit in int.
329 (font_match_p): Check that fixnum is a character, not a nonnegative
330 fixnum, since the later code needs to stuff it into an int.
331 (font_find_for_lface): Use SAFE_ALLOCA_LISP, not alloca.
332 (font_fill_lglyph_metrics): Use unsigned, not EMACS_INT, to avoid
333 conversion overflow issues.
334 (Fopen_font): Check for integer out of range.
335 (Ffont_get_glyphs): Don't assume index can fit in int.
336 * font.h: Adjust decls to match defn changes elsewhere.
337 * fontset.c (reorder_font_vector): Redo score calculation to avoid
338 integer overflow.
339 (num_auto_fontsets, fontset_from_font): Use ptrdiff_t, not
340 printmax_t, where ptrdiff_t is wide enough.
341 (Finternal_char_font):
342 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
343 * frame.c (Fset_mouse_position, Fset_mouse_pixel_position)
344 (Fset_frame_height, Fset_frame_width, Fset_frame_size)
345 (Fset_frame_position, x_set_frame_parameters)
346 (x_set_line_spacing, x_set_border_width)
347 (x_set_internal_border_width, x_set_alpha, x_figure_window_size):
348 Check that fixnums are in proper range for system types.
349 (frame_name_fnn_p, Fframe_parameter, Fmodify_frame_parameters):
350 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
351 (Fmodify_frame_parameters): Don't assume fixnum fits in int.
352 Use SAFE_ALLOCA_LISP, not alloca.
353 * frame.h (struct frame): Use intptr_t, not EMACS_INT, where
354 intptr_t is wide enough.
355 * fringe.c (lookup_fringe_bitmap, get_logical_fringe_bitmap)
356 (Fdefine_fringe_bitmap): Don't assume fixnum fits in int.
357 (Ffringe_bitmaps_at_pos): Don't assume index fits in int.
358 Check for fixnum out of range.
359 * ftfont.c (ftfont_list): Don't assume index fits in int.
360 Check that fixnums are in proper range for system types.
361 (ftfont_shape_by_flt):
362 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
363 * gnutls.c (emacs_gnutls_write, emacs_gnutls_read):
364 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
365 (Fgnutls_error_fatalp, Fgnutls_error_string, Fgnutls_boot):
366 Check that fixnums are in proper range for system types.
367 * gnutls.h: Adjust decls to match defn changes elsewhere.
368 * gtkutil.c (xg_dialog_run):
369 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
370 (update_frame_tool_bar):
371 Check that fixnums are in proper range for system types.
372 * image.c (parse_image_spec): Redo count calculation to avoid overflow.
373 (lookup_image): Check that fixnums are in range for system types.
374 * indent.c (last_known_column, last_known_column_point):
375 (current_column_bol_cache):
376 (skip_invisible, current_column, check_display_width):
377 (check_display_width, scan_for_column, current_column_1)
378 (Findent_to, Fcurrent_indentation, position_indentation)
379 (indented_beyond_p, Fmove_to_column, compute_motion):
380 (Fcompute_motion, Fvertical_motion):
381 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
382 (last_known_column_modified): Use EMACS_INT, not int.
383 (check_display_width):
384 (Fcompute_motion):
385 Check that fixnums and floats are in proper range for system types.
386 (compute_motion): Don't assume index or fixnum fits in int.
387 (compute_motion, Fcompute_motion):
388 Use int, not EMACS_INT, when it is wide enough.
389 (vmotion): Omit local var start_hpos that is always 0; that way
390 we don't need to worry about overflow in expressions involving it.
391 * indent.h: Adjust decls to match defn changes elsewhere.
392 (struct position):
393 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
394 Use int, not EMACS_INT, where int is wide enough.
395 Remove unused members ovstring_chars_done and tab_offset;
396 all uses removed.
397 * insdel.c (move_gap, move_gap_both, gap_left, gap_right)
398 (adjust_markers_for_delete, adjust_markers_for_insert, adjust_point)
399 (adjust_markers_for_replace, make_gap_larger, make_gap_smaller)
400 (make_gap, copy_text, insert, insert_and_inherit)
401 (insert_before_markers, insert_before_markers_and_inherit)
402 (insert_1, count_combining_before, count_combining_after)
403 (insert_1_both, insert_from_string)
404 (insert_from_string_before_markers, insert_from_string_1)
405 (insert_from_gap, insert_from_buffer, insert_from_buffer_1)
406 (adjust_after_replace, adjust_after_insert, replace_range)
407 (replace_range_2, del_range, del_range_1, del_range_byte)
408 (del_range_both, del_range_2, modify_region)
409 (prepare_to_modify_buffer, signal_before_change)
410 (signal_after_change, Fcombine_after_change_execute):
411 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
412 * intervals.c (traverse_intervals, rotate_right, rotate_left)
413 (balance_an_interval, split_interval_right, split_interval_left)
414 (find_interval, next_interval, update_interval)
415 (adjust_intervals_for_insertion, delete_node, delete_interval)
416 (interval_deletion_adjustment, adjust_intervals_for_deletion)
417 (static_offset_intervals, offset_intervals)
418 (merge_interval_right, merge_interval_left, make_new_interval)
419 (graft_intervals_into_buffer, temp_set_point_both)
420 (temp_set_point, set_point, adjust_for_invis_intang)
421 (set_point_both, move_if_not_intangible, get_property_and_range)
422 (get_local_map, copy_intervals, copy_intervals_to_string)
423 (compare_string_intervals, set_intervals_multibyte_1):
424 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
425 * intervals.h: Adjust decls to match defn changes elsewhere.
426 (struct interval):
427 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
428 * keyboard.c (this_command_key_count, this_single_command_key_start)
429 (before_command_key_count, before_command_echo_length, echo_now)
430 (echo_length, recursive_edit_1, Frecursive_edit, Ftrack_mouse)
431 (command_loop_1, safe_run_hooks, read_char, timer_check_2)
432 (menu_item_eval_property, read_key_sequence, Fread_key_sequence)
433 (Fread_key_sequence_vector, Fexecute_extended_command, Fsuspend_emacs):
434 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
435 (last_non_minibuf_size, last_point_position, echo_truncate)
436 (command_loop_1, adjust_point_for_property, read_char, gen_help_event)
437 (make_lispy_position, make_lispy_event, parse_modifiers_uncached)
438 (parse_modifiers, modify_event_symbol, Fexecute_extended_command)
439 (stuff_buffered_input):
440 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
441 (last_auto_save, command_loop_1, read_char):
442 Use EMACS_INT, not int, to avoid integer overflow.
443 (record_char): Avoid overflow in total_keys computation.
444 (parse_modifiers_uncached): Redo index calculation to avoid overflow.
445 * keyboard.h: Adjust decls to match defn changes elsewhere.
446 * keymap.c (Fdefine_key, Fcurrent_active_maps, accessible_keymaps_1)
447 (Fkey_description, Fdescribe_vector, Flookup_key):
448 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
449 (click_position): New function, to check that positions are in range.
450 (Fcurrent_active_maps):
451 (describe_command):
452 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
453 (Faccessible_keymaps, Fkey_description):
454 (preferred_sequence_p):
455 Don't assume fixnum can fit into int.
456 (Fkey_description): Use SAFE_ALLOCA_LISP, not alloca.
457 Check for integer overflow in size calculations.
458 (Ftext_char_description): Use CHECK_CHARACTER, not CHECK_NUMBER, to
459 avoid mishandling large integers.
460 * lisp.h: Adjust decls to match defn changes elsewhere.
461 (ARRAY_MARK_FLAG, PSEUDOVECTOR_FLAG, struct Lisp_String)
462 (struct vectorlike_header, struct Lisp_Subr, struct Lisp_Hash_Table)
463 (struct Lisp_Marker):
464 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
465 (clip_to_bounds): Now an inline function, moved here from editfns.c.
466 (GLYPH_CODE_P): Check for overflow in system types, subsuming the
467 need for GLYPH_CODE_CHAR_VALID_P and doing proper checking ourselves.
468 All callers changed.
469 (GLYPH_CODE_CHAR, GLYPH_CODE_FACE):
470 Assume the arg has valid form, since it always does.
471 (TYPE_RANGED_INTEGERP): Avoid bug when checking against a wide
472 unsigned integer system type.
473 (CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER): New macros.
474 (struct catchtag, specpdl_size, SPECPDL_INDEX, USE_SAFE_ALLOCA):
475 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
476 (struct catchtag): Use EMACS_INT, not int, since it may be a fixnum.
477 (duration_to_sec_usec): New decl.
478 * lread.c (read_from_string_index, read_from_string_index_byte)
479 (read_from_string_limit, readchar, unreadchar, openp)
480 (read_internal_start, read1, oblookup):
481 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
482 (Fload, readevalloop, Feval_buffer, Feval_region):
483 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
484 (openp): Check for out-of-range argument to 'access'.
485 (read1): Use int, not EMACS_INT, where int is wide enough.
486 Don't assume fixnum fits into int.
487 (read_filtered_event): Use duration_to_sec_usec
488 to do proper overflow checking on durations.
489 * macros.c (Fstart_kbd_macro): Use xpalloc to check for overflow
490 in size calculation.
491 (Fexecute_kbd_macro):
492 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
493 * marker.c (cached_charpos, cached_bytepos, CONSIDER)
494 (byte_char_debug_check, buf_charpos_to_bytepos, verify_bytepos)
495 (buf_bytepos_to_charpos, Fset_marker, set_marker_restricted)
496 (set_marker_both, set_marker_restricted_both, marker_position)
497 (marker_byte_position, Fbuffer_has_markers_at):
498 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
499 (Fset_marker, set_marker_restricted): Don't assume fixnum fits in int.
500 * menu.c (ensure_menu_items): Renamed from grow_menu_items.
501 It now merely ensures that the menu is large enough, without
502 necessarily growing it, as this avoids some integer overflow issues.
503 All callers changed.
504 (keymap_panes, parse_single_submenu, Fx_popup_menu):
505 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
506 (parse_single_submenu, Fx_popup_menu): Don't assume fixnum fits in int.
507 Use SAFE_ALLOCA_LISP, not alloca.
508 (find_and_return_menu_selection): Avoid unnecessary casts of pointers
509 to EMACS_INT. Check that fixnums are in proper range for system types.
510 * minibuf.c (minibuf_prompt_width, string_to_object)
511 (Fminibuffer_contents, Fminibuffer_contents_no_properties)
512 (Fminibuffer_completion_contents, Ftry_completion, Fall_completions):
513 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
514 (get_minibuffer, read_minibuf_unwind):
515 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
516 (read_minibuf): Omit unnecessary arg BACKUP_N, which is always nil;
517 this simplifies overflow checking. All callers changed.
518 (read_minibuf, Fread_buffer, Ftry_completion, Fall_completions)
519 (Ftest_completion):
520 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
521 * nsfns.m (check_ns_display_info): Don't assume fixnum fits in long.
522 (x_set_menu_bar_lines, x_set_tool_bar_lines, Fx_create_frame):
523 Check that fixnums are in proper range for system types.
524 (Fx_create_frame, Fx_show_tip):
525 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
526 * nsfont.m (ns_findfonts, nsfont_list_family):
527 Don't assume fixnum fits in long.
528 * nsmenu.m (ns_update_menubar, ns_menu_show, ns_popup_dialog):
529 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
530 (ns_update_menubar): Use intptr_t, not EMACS_INT, when intptr_t is
531 wide enough.
532 * nsselect.m (ns_get_local_selection, clean_local_selection_data):
533 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
534 * print.c (print_buffer_size, print_buffer_pos, print_buffer_pos_byte)
535 (PRINTDECLARE, PRINTPREPARE):
536 (strout, print_string):
537 (print, print_preprocess, print_check_string_charset_prop)
538 (print_object):
539 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
540 (PRINTDECLARE):
541 (temp_output_buffer_setup, Fprin1_to_string, print_object):
542 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
543 (PRINTPREPARE): Use int, not ptrdiff_t, where int is wide enough.
544 (PRINTFINISH): Use SAFE_ALLOCA, not alloca.
545 (printchar, strout): Use xpalloc to catch size calculation overflow.
546 (Fexternal_debugging_output): Use CHECK_CHARACTER, not CHECK_NUMBER,
547 to avoid mishandling large integers.
548 (print_error_message): Use SAFE_ALLOCA, not alloca.
549 (print_object): Use int, not EMACS_INT, where int is wide enough.
550 * process.c (Fdelete_process): Don't assume pid fits into EMACS_INT.
551 (Fset_process_window_size, Fformat_network_address)
552 (get_lisp_to_sockaddr_size, set_socket_option, Fmake_network_process)
553 (Fsignal_process, sigchld_handler):
554 Check that fixnums are in proper range for system types.
555 (Fformat_network_address, read_process_output, send_process)
556 (Fprocess_send_region, status_notify):
557 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
558 (Fformat_network_address, Fmake_serial_process, Fmake_network_process)
559 (wait_reading_process_output, read_process_output, exec_sentinel):
560 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
561 (conv_lisp_to_sockaddr): Don't assume fixnums fit into int.
562 (Faccept_process_output): Use duration_to_sec_usec to do proper
563 overflow checking on durations.
564 * puresize.h (PURESIZE_RATIO): Shrink this to 8/6 on 32-bit hosts
565 configured --with-wide-int.
566 * scroll.c (calculate_scrolling, calculate_direct_scrolling)
567 (line_ins_del): Use int, not EMACS_INT, where int is wide enough.
568 * search.c (looking_at_1, string_match_1):
569 (fast_string_match, fast_c_string_match_ignore_case)
570 (fast_string_match_ignore_case, fast_looking_at, scan_buffer)
571 (scan_newline, find_before_next_newline, search_command)
572 (trivial_regexp_p, search_buffer, simple_search, boyer_moore)
573 (set_search_regs, wordify):
574 (Freplace_match):
575 (Fmatch_data):
576 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
577 (string_match_1, search_buffer, set_search_regs):
578 (Fmatch_data):
579 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
580 (wordify): Check for overflow in size calculation.
581 (Freplace_match): Avoid potential buffer overflow in search_regs.start.
582 (Fset_match_data): Don't assume fixnum fits in ptrdiff_t.
583 Check that fixnums are in proper range for system types.
584 * sound.c (struct sound_device)
585 (wav_play, au_play, vox_write, alsa_period_size, alsa_write):
586 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
587 (Fplay_sound_internal):
588 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
589 * syntax.c (ST_COMMENT_STYLE, ST_STRING_STYLE):
590 In definitions, make it clearer that these values must be out of range
591 for the respective integer ranges. This fixes a bug with
592 ST_STRING_STYLE and non-ASCII characters.
593 (struct lisp_parse_state, find_start_modiff)
594 (Finternal_describe_syntax_value, scan_lists, scan_sexps_forward):
595 (Fparse_partial_sexp):
596 Don't assume fixnums can fit in int.
597 (struct lisp_parse_state, find_start_pos, find_start_value)
598 (find_start_value_byte, find_start_begv)
599 (update_syntax_table, char_quoted, dec_bytepos)
600 (find_defun_start, prev_char_comend_first, back_comment):
601 (scan_words, skip_chars, skip_syntaxes, forw_comment, Fforward_comment)
602 (scan_lists, Fbackward_prefix_chars, scan_sexps_forward):
603 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
604 (Finternal_describe_syntax_value): Check that match_lisp is a
605 character, not an integer, since the code stuffs it into int.
606 (scan_words, scan_sexps_forward):
607 Check that fixnums are in proper range for system types.
608 (Fforward_word):
609 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
610 (scan_sexps_forward):
611 Use CHARACTERP, not INTEGERP, since the value must fit into int.
612 (Fparse_partial_sexp): Fix doc; element 8 is not ignored.
613 * syntax.h: Adjust decls to match defn changes elsewhere.
614 (struct gl_state_s):
615 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
616 * sysdep.c (wait_for_termination_1, wait_for_termination)
617 (interruptible_wait_for_termination, mkdir):
618 Don't assume pid_t fits in int; on 64-bit AIX pid_t is 64-bit.
619 (emacs_read, emacs_write):
620 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
621 (system_process_attributes): Don't assume uid_t, gid_t, and
622 double all fit in int or even EMACS_INT.
623 * term.c (set_tty_color_mode):
624 Check that fixnums are in proper range for system types.
625 * termhooks.h (struct input_event):
626 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
627 * textprop.c (validate_interval_range, interval_of)
628 (Fadd_text_properties, set_text_properties_1)
629 (Fremove_text_properties, Fremove_list_of_text_properties)
630 (Ftext_property_any, Ftext_property_not_all)
631 (copy_text_properties, text_property_list, extend_property_ranges)
632 (verify_interval_modification):
633 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
634 (Fnext_single_char_property_change)
635 (Fprevious_single_char_property_change):
636 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
637 (copy_text_properties):
638 Check for integer overflow in index calculation.
639 * undo.c (last_boundary_position, record_point, record_insert)
640 (record_delete, record_marker_adjustment, record_change)
641 (record_property_change):
642 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
643 (truncate_undo_list, Fprimitive_undo): Don't assume fixnum fits in int.
644 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
645 * w32fns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip)
646 (Fx_hide_tip, Fx_file_dialog):
647 * w32menu.c (set_frame_menubar):
648 Use ptrdiff_t, not int, for consistency with rest of code.
649 * window.c (window_scroll_preserve_hpos, window_scroll_preserve_vpos)
650 (select_window, Fdelete_other_windows_internal)
651 (window_scroll_pixel_based, window_scroll_line_based)
652 (Frecenter, Fset_window_configuration):
653 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
654 (Fset_window_hscroll, run_window_configuration_change_hook)
655 (set_window_buffer, temp_output_buffer_show, scroll_command)
656 (Fscroll_other_window, Frecenter):
657 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
658 (Fwindow_line_height, window_scroll, Fscroll_left, Fscroll_right):
659 Don't assume fixnum fits in int.
660 (Fset_window_scroll_bars):
661 Check that fixnums are in proper range for system types.
662 * xdisp.c (help_echo_pos, pos_visible_p, string_pos_nchars_ahead)
663 (string_pos, c_string_pos, number_of_chars, init_iterator)
664 (in_ellipses_for_invisible_text_p, init_from_display_pos)
665 (compute_stop_pos, next_overlay_change, compute_display_string_pos)
666 (compute_display_string_end, handle_face_prop)
667 (face_before_or_after_it_pos, handle_invisible_prop)
668 (handle_display_prop, handle_display_spec, handle_single_display_spec)
669 (display_prop_intangible_p, string_buffer_position_lim)
670 (string_buffer_position, handle_composition_prop, load_overlay_strings)
671 (get_overlay_strings_1, get_overlay_strings)
672 (iterate_out_of_display_property, forward_to_next_line_start)
673 (back_to_previous_visible_line_start, reseat, reseat_to_string)
674 (get_next_display_element, set_iterator_to_next)
675 (get_visually_first_element, compute_stop_pos_backwards)
676 (handle_stop_backwards, next_element_from_buffer)
677 (move_it_in_display_line_to, move_it_in_display_line)
678 (move_it_to, move_it_vertically_backward, move_it_by_lines)
679 (add_to_log, message_dolog, message_log_check_duplicate)
680 (message2, message2_nolog, message3, message3_nolog
681 (with_echo_area_buffer, display_echo_area_1, resize_mini_window_1)
682 (current_message_1, truncate_echo_area, truncate_message_1)
683 (set_message, set_message_1, store_mode_line_noprop)
684 (hscroll_window_tree, debug_delta, debug_delta_bytes, debug_end_vpos)
685 (text_outside_line_unchanged_p, check_point_in_composition)
686 (reconsider_clip_changes)
687 (redisplay_internal, set_cursor_from_row, try_scrolling)
688 (try_cursor_movement, set_vertical_scroll_bar, redisplay_window)
689 (redisplay_window, find_last_unchanged_at_beg_row)
690 (find_first_unchanged_at_end_row, row_containing_pos, try_window_id)
691 (trailing_whitespace_p, find_row_edges, display_line)
692 (RECORD_MAX_MIN_POS, Fcurrent_bidi_paragraph_direction)
693 (display_mode_element, store_mode_line_string)
694 (pint2str, pint2hrstr, decode_mode_spec)
695 (display_count_lines, display_string, draw_glyphs)
696 (x_produce_glyphs, x_insert_glyphs)
697 (rows_from_pos_range, mouse_face_from_buffer_pos)
698 (fast_find_string_pos, mouse_face_from_string_pos)
699 (note_mode_line_or_margin_highlight, note_mouse_highlight):
700 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
701 (safe_call, init_from_display_pos, handle_fontified_prop)
702 (handle_single_display_spec, load_overlay_strings)
703 (with_echo_area_buffer, setup_echo_area_for_printing)
704 (display_echo_area, echo_area_display)
705 (x_consider_frame_title, prepare_menu_bars, update_menu_bar)
706 (update_tool_bar, hscroll_window_tree, redisplay_internal)
707 (redisplay_window, dump_glyph_row, display_mode_line)
708 (Fformat_mode_line, decode_mode_spec, on_hot_spot_p):
709 (handle_display_spec, display_prop_string_p):
710 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
711 (handle_single_display_spec, build_desired_tool_bar_string)
712 (redisplay_tool_bar, scroll_window_tree, Fdump_glyph_matrix)
713 (get_specified_cursor_type):
714 Check that fixnums are in proper range for system types.
715 (struct overlay_entry, resize_mini_window, Fdump_glyph_row)
716 (Flookup_image_map):
717 Don't assume fixnums fit in int.
718 (compare_overlay_entries):
719 Avoid mishandling comparisons due to subtraction overflow.
720 (load_overlay_strings): Use SAFE_NALLOCA, not alloca.
721 (last_escape_glyph_face_id, last_glyphless_glyph_face_id):
722 (handle_tool_bar_click):
723 Use int, not unsigned, since we prefer signed and the signedness
724 doesn't matter here.
725 (get_next_display_element, next_element_from_display_vector):
726 Use int, not EMACS_INT, when int is wide enough.
727 (start_hourglass): Use duration_to_sec_usec to do proper
728 overflow checking on durations.
729 * xfaces.c (Fbitmap_spec_p):
730 Check that fixnums are in proper range for system types.
731 (compare_fonts_by_sort_order):
732 Avoid mishandling comparisons due to subtraction overflow.
733 (Fx_family_fonts, realize_basic_faces):
734 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
735 (Fx_family_fonts):
736 Don't assume fixnum fits in int.
737 Use SAFE_ALLOCA_LISP, not alloca.
738 (merge_face_heights): Remove unnecessary cast to EMACS_INT.
739 (Finternal_make_lisp_face): Don't allocate more than MAX_FACE_ID.
740 (face_at_buffer_position, face_for_overlay_string)
741 (face_at_string_position):
742 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
743 (merge_faces): Use int, not EMACS_INT, where int is wide enough.
744 * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines, x_icon_verify)
745 (Fx_show_tip):
746 Check that fixnums are in proper range for system types.
747 (Fx_create_frame, x_create_tip_frame, Fx_show_tip)
748 (Fx_hide_tip, Fx_file_dialog, Fx_select_font):
749 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
750 (Fx_change_window_property): Don't assume fixnums fit in int.
751 * xfont.c (xfont_chars_supported):
752 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
753 * xmenu.c (Fx_popup_dialog, set_frame_menubar)
754 (create_and_show_popup_menu, create_and_show_dialog, xmenu_show):
755 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
756 * xml.c (parse_region):
757 * xrdb.c (magic_file_p):
758 Use ptrdiff_t, not EMACS_INT, where ptrdiff_t is wide enough.
759 * xselect.c (TRACE1): Don't assume pid_t promotes to int.
760 (x_get_local_selection, x_reply_selection_request)
761 (x_handle_selection_request, wait_for_property_change):
762 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
763 (selection_data_to_lisp_data): Use short, not EMACS_INT, where
764 short is wide enough.
765 (x_send_client_event): Don't assume fixnum fits in int.
766 * xterm.c (x_x_to_emacs_modifiers):
767 Don't assume EMACS_INT overflows nicely into int.
768 (x_emacs_to_x_modifiers): Use EMACS_INT, not int, because values
769 may come from Lisp.
770 (handle_one_xevent): NATNUMP can eval its arg twice.
771 (x_connection_closed):
772 Use ptrdiff_t, not int, to avoid needless 32-bit limit on 64-bit hosts.
773 * xterm.h: Adjust decls to match defn changes elsewhere.
774 (struct scroll_bar): Use struct vectorlike_header
775 rather than rolling our own approximation.
776 (SCROLL_BAR_VEC_SIZE): Remove; not used.
777
778 2011-09-30 Paul Eggert <eggert@cs.ucla.edu>
779
780 Remove dependency on glibc malloc internals.
781 * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
782 Move back here from lisp.h, but with their new implementations.
783 (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
784 (XMALLOC_OVERRUN_SIZE_SIZE): Move these new lisp.h macros here.
785 * charset.c (charset_table_init): New static var.
786 (syms_of_charset): Use it instead of xmalloc. This removes a
787 dependency on glibc malloc internals. See Eli Zaretskii's comment in
788 <http://lists.gnu.org/archive/html/emacs-devel/2011-09/msg00815.html>.
789 * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
790 Move back to alloc.c.
791 (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
792 (XMALLOC_OVERRUN_SIZE_SIZE): Move to alloc.c.
793
794 2011-09-30 Jan Djärv <jan.h.d@swipnet.se>
795
796 * nsterm.m (windowDidResize): Call x_set_window_size only when
797 ns_in_resize is true. Otherwise set pixelwidth/height and
798 call change_frame_size (Bug#9628).
799
800 2011-09-30 Paul Eggert <eggert@cs.ucla.edu>
801
802 Port --enable-checking=all to Fedora 14 x86-64.
803 * charset.c (syms_of_charset): Also account for glibc malloc's
804 internal overhead when calculating the initial malloc maximum.
805
806 Port --enable-checking=all to Fedora 14 x86.
807 * alloc.c (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
808 Move to lisp.h.
809 (xmalloc_put_size, xmalloc_get_size, overrun_check_malloc)
810 (overrun_check_realloc, overrun_check_free):
811 Use XMALLOC_OVERRUN_SIZE_SIZE, not sizeof (size_t).
812 That way, xmalloc returns a properly-aligned pointer even if
813 XMALLOC_OVERRUN_CHECK is defined. The old debugging code happened
814 to align OK on typical 64-bit hosts, but not on Fedora 14 x86.
815 * charset.c (syms_of_charset): Take XMALLOC_OVERRUN_CHECK_OVERHEAD
816 into account when calculating the initial malloc maximum.
817 * lisp.h (XMALLOC_OVERRUN_CHECK_OVERHEAD, XMALLOC_OVERRUN_CHECK_SIZE):
818 Move here from alloc.c, so that charset.c can use it too.
819 Properly align; the old code wasn't right for common 32-bit hosts
820 when configured with --enable-checking=all.
821 (XMALLOC_BASE_ALIGNMENT, COMMON_MULTIPLE, XMALLOC_HEADER_ALIGNMENT)
822 (XMALLOC_OVERRUN_SIZE_SIZE): New macros.
823
824 2011-09-29 Eli Zaretskii <eliz@gnu.org>
825
826 * sysdep.c (snprintf) [!EOVERFLOW]: If EOVERFLOW is not defined,
827 use EDOM.
828
829 2011-09-28 Eli Zaretskii <eliz@gnu.org>
830
831 * xdisp.c (compute_display_string_end): If there's no display
832 string at CHARPOS, return -1.
833
834 * bidi.c (bidi_fetch_char): When compute_display_string_end
835 returns a negative value, treat the character as a normal
836 character not covered by a display string. (Bug#9624)
837
838 2011-09-28 Juanma Barranquero <lekktu@gmail.com>
839
840 * lread.c (Fread_from_string): Fix typo in docstring.
841
842 2011-09-27 Eli Zaretskii <eliz@gnu.org>
843
844 * xdisp.c (handle_invisible_prop): If invisible text ends on a
845 newline, reseat the iterator instead of bidi-iterating there one
846 character at a time. (Bug#9610)
847 (BUFFER_POS_REACHED_P, move_it_in_display_line_to): Bail out when
848 past TO_CHARPOS if the bidi iterator is at base embedding level.
849
850 2011-09-27 Andreas Schwab <schwab@linux-m68k.org>
851
852 * lread.c (readevalloop): Use correct code for NBSP.
853 (read1): Likewise. (Bug#9608)
854
855 2011-09-25 Michael Albinus <michael.albinus@gmx.de>
856
857 * dbusbind.c (Fdbus_register_signal): When service is not
858 registered, use nil in Vdbus_registered_objects_table. (Bug#9581)
859
860 2011-09-25 Glenn Morris <rgm@gnu.org>
861
862 * buffer.c (truncate-lines): Doc fix.
863
864 2011-09-24 Chong Yidong <cyd@stupidchicken.com>
865
866 * window.c (Fwindow_prev_buffers, Fset_window_prev_buffers)
867 (Fset_window_next_buffers): Doc fix.
868
869 2011-09-24 Glenn Morris <rgm@gnu.org>
870
871 * minibuf.c (read_minibuf): Disable line truncation. (Bug#5715)
872
873 2011-09-24 Paul Eggert <eggert@cs.ucla.edu>
874
875 Fix minor problems found by static checking.
876 * xdisp.c (string_from_display_spec): Don't assume vecsize fits in int.
877 * indent.c (Fvertical_motion): Fix == vs = typo.
878
879 2011-09-24 Eli Zaretskii <eliz@gnu.org>
880
881 * dispnew.c (syms_of_display) <redisplay-dont-pause>: Default
882 value is now t. Doc fix.
883
884 * indent.c (Fvertical_motion): Compute and apply the overshoot
885 logic also when moving up, not only when moving down. Fix the
886 confusing name and values of the it_overshoot_expected variable;
887 logic changed accordingly. (Bug#9254) (Bug#9549)
888
889 * xdisp.c (pos_visible_p): Produce correct pixel coordinates when
890 CHARPOS is covered by a display string which includes newlines.
891 (move_it_vertically_backward): Avoid inflooping when START_CHARPOS
892 is covered by a display string with embedded newlines.
893
894 2011-09-24 Michael Albinus <michael.albinus@gmx.de>
895
896 * dbusbind.c (Fdbus_register_signal): Add match rule to
897 Vdbus_registered_objects_table. (Bug#9581)
898 (Fdbus_register_method, Vdbus_registered_objects_table): Fix
899 docstring.
900
901 2011-09-24 Jim Meyering <meyering@redhat.com>
902
903 Do not ignore write error for any output size.
904 The previous change was incomplete.
905 While it makes emacs --batch detect the vast majority of stdout
906 write failures, errors were still ignored whenever the output size is
907 k * (BUFSIZ+1) - 4. E.g., on a system with BUFSIZ of 4096,
908 $ emacs --batch --eval '(print (format "%4093d" 0))' > /dev/full \
909 && echo FAIL: ignored write error
910 FAIL: ignored write error
911 $ emacs --batch --eval '(print (format "%20481d" 0))' > /dev/full \
912 && echo FAIL: ignored write error
913 FAIL: ignored write error
914 * emacs.c (Fkill_emacs): Also test ferror. (Bug#9574)
915
916 2011-09-23 Andreas Schwab <schwab@linux-m68k.org>
917
918 * emacs.c (Fkill_emacs): In noninteractive mode exit
919 non-successfully if a write error occurred on stdout. (Bug#9574)
920
921 2011-09-21 Eli Zaretskii <eliz@gnu.org>
922
923 * xdisp.c (pop_it): Allow it->object that is a cons cell to pass
924 the xassert test.
925
926 * dispextern.h (struct it): Update the comment documenting what
927 can it->OBJECT be.
928
929 2011-09-20 Eli Zaretskii <eliz@gnu.org>
930
931 * xdisp.c (set_cursor_from_row): If the row ends in a newline from
932 a display string, extend search for cursor position to end of row.
933 (find_row_edges): If the row ends in a newline from a display
934 string, increment its MATRIX_ROW_END_CHARPOS by one. (Bug#9549)
935 Handle the case of a display string with multiple newlines.
936 (Fcurrent_bidi_paragraph_direction): Fix search for previous
937 non-empty line. Fixes confusing cursor motion with arrow keys at
938 the beginning of a line that starts with whitespace.
939
940 2011-09-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
941
942 * lread.c (Fread_from_string): Document what FINAL-STRING-INDEX is
943 (bug#9493).
944
945 2011-09-18 Chong Yidong <cyd@stupidchicken.com>
946
947 * xfns.c (Fx_create_frame): Handle the bitmapIcon resource as
948 boolean (Bug#9154).
949
950 2011-09-18 Eli Zaretskii <eliz@gnu.org>
951
952 * xdisp.c (display_line): Record maximum and minimum buffer
953 positions even if no glyphs were produced (e.g., by a zero-width
954 stretch). Fixes bug#9530 on a TTY. Under word-wrap, don't record
955 buffer positions that will be removed from the glyph row because
956 they don't fit.
957 (produce_stretch_glyph): Fix a bug in :align-to on a TTY when the
958 column is beyond frame width: don't subtract 1 "pixel" when
959 computing width of the stretch.
960 (reseat_at_next_visible_line_start): Undo the change made on
961 2011-09-17 that saved paragraph information and restored it after
962 the call to `reseat'. (Bug#9545)
963
964 2011-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
965
966 * xdisp.c (expose_window): Save original value of phys_cursor_on_p
967 and turn window cursor on if cleared (Bug#9415).
968
969 2011-09-18 Andreas Schwab <schwab@linux-m68k.org>
970
971 * search.c (boyer_moore): Take unibyte characters from pattern
972 literally. (Bug#9458)
973
974 2011-09-18 Eli Zaretskii <eliz@gnu.org>
975
976 * xdisp.c (reseat_at_next_visible_line_start): Fix last change.
977
978 2011-09-18 Paul Eggert <eggert@cs.ucla.edu>
979
980 Fix minor problem found by static checking.
981 * xdisp.c (reseat_at_next_visible_line_start): Mark locals as
982 initialized, to pacify gcc -Wuninitialized.
983
984 * fileio.c: Report proper errno when syscall falls.
985 (Finsert_file_contents): Save and restore errno,
986 so that report_file_error outputs the correct diagnostic.
987 (Fwrite_region) [CLASH_DETECTION]: Likewise.
988
989 2011-09-18 Eli Zaretskii <eliz@gnu.org>
990
991 * .gdbinit (pgx): Fix references to fields of `struct glyph'.
992
993 2011-09-17 Eli Zaretskii <eliz@gnu.org>
994
995 * xdisp.c (produce_stretch_glyph): Another fix for changes made on
996 2011-08-30T17:32:44Z!eliz@gnu.org. (Bug#9530)
997
998 2011-09-17 Eli Zaretskii <eliz@gnu.org>
999
1000 * xdisp.c (reseat_at_next_visible_line_start): Keep information
1001 about the current paragraph and restore it after the call to
1002 reseat.
1003
1004 * bidi.c (MAX_PARAGRAPH_SEARCH): New macro.
1005 (bidi_find_paragraph_start): Search back for paragraph beginning
1006 at most MAX_PARAGRAPH_SEARCH lines; if not found, return BEGV_BYTE.
1007 (bidi_move_to_visually_next): Only trigger paragraph-related
1008 computations when the last character is a newline or at EOB, not
1009 just any NEUTRAL_B. (Bug#9470)
1010
1011 * xdisp.c (set_cursor_from_row): Don't invoke special treatment of
1012 truncated lines if point is covered by a display string. (Bug#9524)
1013
1014 2011-09-16 Paul Eggert <eggert@cs.ucla.edu>
1015
1016 * xselect.c: Relax test for outgoing X longs (Bug#9498).
1017 (cons_to_x_long): New function.
1018 (lisp_data_to_selection_data): Use it. Correct the test for
1019 short-versus-long data; it was negated. Break out of vector
1020 loop, for efficiency, when a long datum is discovered.
1021
1022 2011-09-16 Stefan Monnier <monnier@iro.umontreal.ca>
1023
1024 * eval.c (Fquote): Document its non-consing behavior (bug#9482).
1025
1026 2011-09-16 Eli Zaretskii <eliz@gnu.org>
1027
1028 * image.c (tiff_handler): Work around a bug in MinGW GCC 3.x (see
1029 GCC PR/17406) by declaring this function with external scope.
1030
1031 2011-09-15 Paul Eggert <eggert@cs.ucla.edu>
1032
1033 * editfns.c (Fformat): Fix bug in text-property fix (Bug#9514).
1034 Don't mishandle (length (format "%%")) and (format "%4000s%%" "").
1035
1036 2011-09-15 Andreas Schwab <schwab@linux-m68k.org>
1037
1038 * editfns.c (Fformat): Correctly handle text properties on "%%".
1039
1040 2011-09-15 Eli Zaretskii <eliz@gnu.org>
1041
1042 * xterm.c (x_draw_composite_glyph_string_foreground):
1043 * w32term.c (x_draw_composite_glyph_string_foreground):
1044 * term.c (encode_terminal_code):
1045 * composite.c (composition_update_it, get_composition_id):
1046 * xdisp.c (get_next_display_element)
1047 (fill_composite_glyph_string): Add comments about special meaning
1048 of TAB characters in a composition.
1049
1050 2011-09-15 Paul Eggert <eggert@cs.ucla.edu>
1051
1052 * editfns.c (Fformat): Fix off-by-1 bug for "%%b" (Bug#9514).
1053 This occurs when processing a multibyte format.
1054 Problem reported by Wolfgang Jenker.
1055
1056 2011-09-15 Johan Bockgård <bojohan@gnu.org>
1057
1058 * xdisp.c (try_cursor_movement): Only check for exact match if
1059 cursor hpos found by set_cursor_from_row is valid. (Bug#9495)
1060
1061 2011-09-14 Paul Eggert <eggert@cs.ucla.edu>
1062
1063 Remove unused external symbols.
1064 * dispextern.h (calc_pixel_width_or_height): Remove decl.
1065 * xdisp.c (calc_pixel_width_or_height): Now static.
1066 * doprnt.c (exprintf) [! (HAVE_X_WINDOWS && USE_X_TOOLKIT)]: Remove.
1067 * indent.c (check_display_width):
1068 * w32term.c: Fix comment to match code.
1069 * xterm.c, xterm.h (x_catching_errors): Remove.
1070
1071 2011-09-14 Paul Eggert <eggert@cs.ucla.edu>
1072
1073 * xselect.c: Use signed conversions more consistently (Bug#9498).
1074 (selection_data_to_lisp_data): Assume incoming selection data are
1075 signed integers, not unsigned. This is to be consistent with
1076 outgoing selection data, which was modified to use signed integers
1077 in as part of the fix to Bug#9196 in response to Jan D.'s comment
1078 in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9196#32> that X11
1079 expects long, not unsigned long.
1080
1081 2011-09-14 Eli Zaretskii <eliz@gnu.org>
1082
1083 * xdisp.c (try_window_reusing_current_matrix): Fix incorrect
1084 computation of loop end. Reported by Johan Bockgård
1085 <bojohan@gnu.org>.
1086
1087 2011-09-13 Chong Yidong <cyd@stupidchicken.com>
1088
1089 * frame.c (Fother_visible_frames_p): Function deleted.
1090
1091 2011-09-12 Eli Zaretskii <eliz@gnu.org>
1092
1093 * indent.c (compute_motion): Process display vector front to back
1094 rather than the other way around. (Bug#2496)
1095
1096 2011-09-12 Stefan Monnier <monnier@iro.umontreal.ca>
1097
1098 * fileio.c (Finsert_file_contents): Don't assume beg_offset is 0.
1099
1100 2011-09-11 Chong Yidong <cyd@stupidchicken.com>
1101
1102 * minibuf.c (Fread_from_minibuffer): Doc fix.
1103
1104 2011-09-11 Eli Zaretskii <eliz@gnu.org>
1105
1106 * xdisp.c (produce_stretch_glyph): Fix a typo made in changes from
1107 2011-08-30T17:32:44Z!eliz@gnu.org. (Bug#9475)
1108
1109 2011-09-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
1110
1111 * fileio.c (Fvisited_file_modtime): Document `(-1 65535)' as a
1112 value for non-existent files.
1113
1114 2011-09-11 Eli Zaretskii <eliz@gnu.org>
1115
1116 * fileio.c (Finsert_file_contents): If the file cannot be opened,
1117 set its "size" to -1. This will set the modtime_size field of
1118 the corresponding buffer to -1, which is what
1119 verify-visited-file-modtime expects for files that do not exist.
1120 (Bug#9139)
1121
1122 2011-09-11 Paul Eggert <eggert@cs.ucla.edu>
1123
1124 * keymap.h (KEY_DESCRIPTION_SIZE, push_key_description): Move decls
1125 here ...
1126 * lisp.h: ... from here. push_key_description is no longer
1127 defined in keyboard.c, so its declaration should not be in
1128 lisp.h's "Defined in keyboard.c" section, and KEY_DESCRIPTION_SIZE
1129 logically belongs with push_key_description.
1130
1131 2011-09-10 Paul Eggert <eggert@cs.ucla.edu>
1132
1133 * buffer.h: Include <sys/types.h> instead of <time.h>.
1134 Otherwise, off_t wasn't defined on FreeBSD 9.0-BETA2 i386.
1135 Problem reported by Herbert J. Skuhra.
1136
1137 2011-09-10 Lars Magne Ingebrigtsen <larsi@gnus.org>
1138
1139 * xml.c (parse_region): Make the parsing work for
1140 non-comment-starting XML files again (bug#9144).
1141
1142 2011-09-10 Andreas Schwab <schwab@linux-m68k.org>
1143
1144 * image.c (gif_load): Fix calculation of bottom and right corner.
1145 (Bug#9468)
1146
1147 2011-09-10 Eli Zaretskii <eliz@gnu.org>
1148
1149 * xdisp.c (MAX_DISP_SCAN): Decrease to 250. Prevents sluggish
1150 redisplay in small windows.
1151
1152 2011-09-09 Eli Zaretskii <eliz@gnu.org>
1153
1154 * frame.c (x_report_frame_params): Cast to avoid compiler warnings.
1155
1156 2011-09-08 Martin Rudalics <rudalics@gmx.at>
1157
1158 * window.c (Fset_window_prev_buffers, Fset_window_next_buffers):
1159 Operate on live windows only.
1160
1161 2011-09-08 Juanma Barranquero <lekktu@gmail.com>
1162
1163 * emacs.c (my_heap_start): #ifdef to avoid warnings when unused.
1164
1165 2011-09-07 Eli Zaretskii <eliz@gnu.org>
1166
1167 * xdisp.c (move_it_in_display_line_to): Call RESTORE_IT on ppos_it
1168 only under bidi iteration.
1169
1170 2011-09-07 Jan Djärv <jan.h.d@swipnet.se>
1171
1172 * gtkutil.c (xg_make_tool_item): Insert comment about eventbox.
1173
1174 2011-09-06 Paul Eggert <eggert@cs.ucla.edu>
1175
1176 isnan: Fix porting problem to Solaris 10 with bundled gcc.
1177 Without this fix, the command to link temacs failed due to an
1178 undefined symbol __builtin_isnan. This is because
1179 /usr/include/iso/math_c99.h #defines isnan(x) to
1180 __builtin_isnan(x), but the bundled gcc, which identifies itself
1181 as gcc 3.4.3 (csl-sol210-3_4-branch+sol_rpath), does not have
1182 a __builtin_isnan.
1183 * floatfns.c (isnan): #undef, and then #define to a clone of
1184 what's in data.c.
1185 (Fisnan): Always define, since it's always available now.
1186 (syms_of_floatfns): Always define isnan at the Lisp level.
1187
1188 2011-09-06 Paul Eggert <eggert@cs.ucla.edu>
1189
1190 * Makefile.in (gl-stamp): move-if-change now in build-aux (Bug#9169).
1191
1192 2011-09-06 Paul Eggert <eggert@cs.ucla.edu>
1193
1194 * fileio.c: Fix bugs with large file offsets (Bug#9428).
1195 The previous code assumed that file offsets (off_t values) fit in
1196 EMACS_INT variables, which is not true on typical 32-bit hosts.
1197 The code messed up by falsely reporting buffer overflow in cases
1198 such as (insert-file-contents "big" nil 1 2) into an empty buffer
1199 when "big" contains more than 2**29 bytes, even though this
1200 inserts just one byte and does not overflow the buffer.
1201 (Finsert_file_contents): Store file offsets as off_t
1202 values, not as EMACS_INT values. Check for overflow when
1203 converting between EMACS_INT and off_t. When checking for
1204 buffer overflow or for overlap, take the offsets into account.
1205 Don't use EMACS_INT for small values where int suffices.
1206 When checking for overlap, fix a typo: ZV was used where
1207 ZV_BYTE was intended.
1208 (Fwrite_region): Don't assume off_t fits into 'long'.
1209 * buffer.h (struct buffer.modtime_size): Now off_t, not EMACS_INT.
1210
1211 2011-09-05 Michael Albinus <michael.albinus@gmx.de>
1212
1213 * dbusbind.c (xd_signature_cat): Rename from signature_cat.
1214
1215 2011-09-04 Paul Eggert <eggert@cs.ucla.edu>
1216
1217 sprintf-related integer and memory overflow issues (Bug#9412).
1218
1219 * doprnt.c (doprnt): Support printing ptrdiff_t and intmax_t values.
1220 (esprintf, exprintf, evxprintf): New functions.
1221 * keyboard.c (command_loop_level): Now EMACS_INT, not int.
1222 (cmd_error): kbd macro iterations count is now EMACS_INT, not int.
1223 (modify_event_symbol): Do not assume that the length of
1224 name_alist_or_stem is safe to alloca and fits in int.
1225 (Fexecute_extended_command): Likewise for function name and binding.
1226 (Frecursion_depth): Wrap around reliably on integer overflow.
1227 * keymap.c (push_key_description): First arg is now EMACS_INT, not int,
1228 since some callers pass EMACS_INT values.
1229 (Fsingle_key_description): Don't crash if symbol name contains more
1230 than MAX_ALLOCA bytes.
1231 * minibuf.c (minibuf_level): Now EMACS_INT, not int.
1232 (get_minibuffer): Arg is now EMACS_INT, not int.
1233 * lisp.h (get_minibuffer, push_key_description): Reflect API changes.
1234 (esprintf, exprintf, evxprintf): New decls.
1235 * window.h (command_loop_level, minibuf_level): Reflect API changes.
1236
1237 * dbusbind.c (signature_cat): New function.
1238 (xd_signature, Fdbus_register_signal):
1239 Do not overrun buffer; instead, report string overflow.
1240
1241 * dispnew.c (add_window_display_history): Don't overrun buffer.
1242 Truncate instead; this is OK since it's just a log.
1243
1244 * editfns.c (Fcurrent_time_zone): Don't overrun buffer
1245 even if the time zone offset is outlandishly large.
1246 Don't mishandle offset == INT_MIN.
1247
1248 * emacs.c (main) [NS_IMPL_COCOA]: Don't overrun buffer
1249 when creating daemon; the previous buffer-overflow check was incorrect.
1250
1251 * eval.c (verror): Simplify by rewriting in terms of evxprintf,
1252 which has the guts of the old verror function.
1253
1254 * filelock.c (lock_file_1, lock_file): Don't blindly alloca long name;
1255 use SAFE_ALLOCA instead. Use esprintf to avoid int-overflow issues.
1256
1257 * font.c: Include <float.h>, for DBL_MAX_10_EXP.
1258 (font_unparse_xlfd): Don't blindly alloca long strings.
1259 Don't assume XINT result fits in int, or that XFLOAT_DATA * 10
1260 fits in int, when using sprintf. Use single snprintf to count
1261 length of string rather than counting it via multiple sprintfs;
1262 that's simpler and more reliable.
1263 (font_unparse_fcname): Use it to avoid sprintf buffer overrun.
1264 (generate_otf_features) [0 && HAVE_LIBOTF]: Use esprintf, not
1265 sprintf, in case result does not fit in int.
1266
1267 * fontset.c (num_auto_fontsets): Now printmax_t, not int.
1268 (fontset_from_font): Print it.
1269
1270 * frame.c (tty_frame_count): Now printmax_t, not int.
1271 (make_terminal_frame, set_term_frame_name): Print it.
1272 (x_report_frame_params): In X, window IDs are unsigned long,
1273 not signed long, so print them as unsigned.
1274 (validate_x_resource_name): Check for implausibly long names,
1275 and don't assume name length fits in 'int'.
1276 (x_get_resource_string): Don't blindly alloca invocation name;
1277 use SAFE_ALLOCA. Use esprintf, not sprintf, in case result does
1278 not fit in int.
1279
1280 * gtkutil.c: Include <float.h>, for DBL_MAX_10_EXP.
1281 (xg_check_special_colors, xg_set_geometry):
1282 Make sprintf buffers a bit bigger, to avoid potential buffer overrun.
1283
1284 * lread.c (dir_warning): Don't blindly alloca buffer; use SAFE_ALLOCA.
1285 Use esprintf, not sprintf, in case result does not fit in int.
1286
1287 * macros.c (executing_kbd_macro_iterations): Now EMACS_INT, not int.
1288 (Fend_kbd_macro): Don't mishandle MOST_NEGATIVE_FIXNUM by treating
1289 it as a large positive number.
1290 (Fexecute_kbd_macro): Don't assume repeat count fits in int.
1291 * macros.h (executing_kbd_macro_iterations): Now EMACS_INT, not int.
1292
1293 * nsterm.m ((NSSize)windowWillResize): Use esprintf, not sprintf,
1294 in case result does not fit in int.
1295
1296 * print.c (float_to_string): Detect width overflow more reliably.
1297 (print_object): Make sprintf buffer a bit bigger, to avoid potential
1298 buffer overrun. Don't assume list length fits in 'int'. Treat
1299 print length of 0 as 0, not as infinity; to be consistent with other
1300 uses of print length in this function. Don't overflow print length
1301 index. Don't assume hash table size fits in 'long', or that
1302 vectorlike size fits in 'unsigned long'.
1303
1304 * process.c (make_process): Use printmax_t, not int, to format
1305 process-name gensyms.
1306
1307 * sysdep.c (snprintf) [! HAVE_SNPRINTF]: New function.
1308
1309 * term.c (produce_glyphless_glyph): Make sprintf buffer a bit bigger
1310 to avoid potential buffer overrun.
1311
1312 * xfaces.c (x_update_menu_appearance): Don't overrun buffer
1313 if X resource line is longer than 512 bytes.
1314
1315 * xfns.c (x_window): Make sprintf buffer a bit bigger
1316 to avoid potential buffer overrun.
1317
1318 * xterm.c (x_io_error_quitter): Don't overrun sprintf buffer.
1319
1320 * xterm.h (x_check_errors): Add ATTRIBUTE_FORMAT_PRINTF.
1321
1322 2011-09-04 Paul Eggert <eggert@cs.ucla.edu>
1323
1324 Integer overflow fixes for scrolling, etc.
1325 Without these, Emacs silently mishandles large integers sometimes.
1326 For example, "C-u 4294967297 M-x recenter" was treated as if
1327 it were "C-u 1 M-x recenter" on a typical 64-bit host.
1328
1329 * xdisp.c (try_window_id): Check Emacs fixnum range before
1330 converting to 'int'.
1331
1332 * window.c (window_scroll_line_based, Frecenter):
1333 Check that an Emacs fixnum is in range before assigning it to 'int'.
1334 (Frecenter, Fmove_to_window_line): Use EMACS_INT, not int, for
1335 values converted from Emacs fixnums.
1336 (Frecenter): Don't wrap around a line count if it is out of 'int'
1337 range; instead, treat it as an extreme value.
1338 (Fset_window_configuration, compare_window_configurations):
1339 Use ptrdiff_t, not int, for index that might exceed 2 GiB.
1340
1341 * search.c (Freplace_match): Use ptrdiff_t, not int, for indexes
1342 that can exceed INT_MAX. Check that EMACS_INT value is in range
1343 before assigning it to the (possibly-narrower) index.
1344 (match_limit): Don't assume that a fixnum can fit in 'int'.
1345
1346 * print.c (print_object): Use ptrdiff_t, not int, for index that can
1347 exceed INT_MAX.
1348
1349 * indent.c (position_indentation): Now takes ptrdiff_t, not int.
1350 (Fvertical_motion): Don't wrap around LINES values that don't fit
1351 in 'int'. Instead, treat them as extreme values. This is good
1352 enough for windows, which can't have more than INT_MAX lines anyway.
1353
1354 2011-09-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
1355
1356 * Require libxml/parser.h to avoid compilation warning.
1357
1358 * emacs.c (shut_down_emacs): Call xmlCleanupParser on shutdown.
1359
1360 * xml.c (parse_region): Don't call xmlCleanupParser after parsing,
1361 since this reportedly can destroy thread storage.
1362
1363 2011-08-30 Chong Yidong <cyd@stupidchicken.com>
1364
1365 * syntax.c (find_defun_start): Update all cache variables if
1366 exiting early (Bug#9401).
1367
1368 2011-08-30 Eli Zaretskii <eliz@gnu.org>
1369
1370 * image.c (x_bitmap_pixmap): Cast to int to avoid compiler warnings.
1371
1372 * xdisp.c (produce_stretch_glyph): No longer static, compiled also
1373 when HAVE_WINDOW_SYSTEM is not defined. Support both GUI and TTY
1374 frames. Call tty_append_glyph in the TTY case. (Bug#9402)
1375
1376 * term.c (tty_append_glyph): New function.
1377 (produce_stretch_glyph): Static function and its prototype deleted.
1378
1379 * dispextern.h (produce_stretch_glyph, tty_append_glyph): Add
1380 prototypes.
1381
1382 2011-08-29 Paul Eggert <eggert@cs.ucla.edu>
1383
1384 * image.c (parse_image_spec): Check for nonnegative, not for positive,
1385 when checking :margin (Bug#9390).
1386 (IMAGE_NON_NEGATIVE_INTEGER_VALUE_OR_PAIR):
1387 Renamed from IMAGE_POSITIVE_INTEGER_VALUE_OR_PAIR,
1388 so that the name doesn't mislead. All uses changed.
1389
1390 2011-08-28 Johan Bockgård <bojohan@gnu.org>
1391
1392 * term.c (init_tty) [HAVE_GPM]: Move mouse settings after
1393 set_tty_hooks.
1394
1395 2011-08-27 Eli Zaretskii <eliz@gnu.org>
1396
1397 * xdisp.c (move_it_to): Don't bail out early when reaching
1398 position beyond to_charpos, if we are scanning backwards.
1399 (move_it_vertically_backward): When DY == 0, make sure we get to
1400 the first character in the line after the newline.
1401
1402 2011-08-27 Paul Eggert <eggert@cs.ucla.edu>
1403
1404 * ccl.c: Improve and simplify overflow checking (Bug#9196).
1405 (ccl_driver): Do not generate an out-of-range pointer.
1406 (Fccl_execute_on_string): Remove unnecessary check for
1407 integer overflow, noted by Stefan Monnier in
1408 <http://lists.gnu.org/archive/html/emacs-devel/2011-08/msg00979.html>.
1409 Remove a FIXME that didn't need fixing.
1410 Simplify the newly-introduced buffer reallocation code.
1411
1412 2011-08-27 Juanma Barranquero <lekktu@gmail.com>
1413
1414 * makefile.w32-in ($(BLD)/alloc.$(O)): Depend on lib/verify.h.
1415
1416 2011-08-26 Paul Eggert <eggert@cs.ucla.edu>
1417
1418 Integer and memory overflow issues (Bug#9196).
1419
1420 * doc.c (get_doc_string): Rework so that
1421 get_doc_string_buffer_size is the actual buffer size, rather than
1422 being 1 less than the actual buffer size; this makes xpalloc more
1423 convenient.
1424
1425 * image.c (x_allocate_bitmap_record, cache_image):
1426 * xselect.c (Fx_register_dnd_atom):
1427 Simplify previous changes by using xpalloc.
1428
1429 * buffer.c (overlay_str_len): Now ptrdiff_t, not EMACS_INT,
1430 since either will do and ptrdiff_t is convenient with xpalloc.
1431
1432 * charset.c (charset_table_size)
1433 (struct charset_sort_data.priority): Now ptrdiff_t.
1434 (charset_compare): Don't overflow if priorities differ greatly.
1435 (Fsort_charsets): Don't assume list length fits in int.
1436 Check for size-calculation overflow when allocating sort data.
1437 (syms_of_charset): Allocate an initial charset table that is
1438 just under 64 KiB, to avoid problems with glibc malloc and mmap.
1439
1440 * cmds.c (internal_self_insert): Check for size-calculation overflow.
1441
1442 * composite.h (struct composition.glyph_len): Now int, not unsigned.
1443 The actual value is always <= INT_MAX, and leaving it unsigned made
1444 overflow checking harder.
1445
1446 * dispextern.h (struct glyph_matrix.rows_allocated)
1447 (struct face_cache.size): Now ptrdiff_t, for convenience in use
1448 with xpalloc. The values are still always <= INT_MAX.
1449
1450 * indent.c (compute_motion): Adjust to region_cache_forward sig change.
1451
1452 * lisp.h (xnmalloc, xnrealloc, xpalloc): New decls.
1453 (SAFE_NALLOCA): New macro.
1454
1455 * region-cache.c (struct boundary.pos, find_cache_boundary)
1456 (move_cache_gap, insert_cache_boundary, delete_cache_boundaries)
1457 (set_cache_region, invalidate_region_cache)
1458 (revalidate_region_cache, know_region_cache, region_cache_forward)
1459 (region_cache_backward, pp_cache):
1460 Use ptrdiff_t, not EMACS_INT, since either will do. This is needed
1461 so that ptrdiff_t * can be passed to xpalloc.
1462 (struct region_cache): Similarly, for gap_start, gap_len, cache_len,
1463 beg_unchanged, end_unchanged, buffer_beg, buffer_end members.
1464 (pp_cache): Don't assume cache_len fits in int.
1465 * region-cache.h: Adjust extern decls to match.
1466
1467 * search.c (scan_buffer, Freplace_match): Use ptrdiff_t, not
1468 EMACS_INT, since either will do, for xpalloc.
1469
1470 * alloc.c: Include verify.h, and check that int fits in ptrdiff_t.
1471 (xnmalloc, xnrealloc, xpalloc): New functions.
1472
1473 * bidi.c (bidi_shelve_header_size): New constant.
1474 (bidi_cache_ensure_space, bidi_shelve_cache): Use it.
1475 (bidi_cache_ensure_space): Avoid integer overflow when allocating.
1476
1477 * bidi.c (bidi_cache_shrink):
1478 * buffer.c (overlays_at, overlays_in, record_overlay_string)
1479 (overlay_strings):
1480 Don't update size of array until after memory allocation succeeds,
1481 because xmalloc/xrealloc may not return.
1482 (struct sortstrlist.bytes): Now ptrdiff_t, as EMACS_INT doesn't help
1483 now that we have proper integer overflow checking.
1484 (record_overlay_string, overlay_strings): Catch overflows when
1485 calculating size of overlay_str_buf.
1486
1487 * callproc.c (Fcall_process): Check for size overflow when
1488 calculating size of args2.
1489 (child_setup): Avoid overflow by using size_t rather than ptrdiff_t.
1490 Normally we prefer signed values, but sticking with ptrdiff_t would
1491 require adding more-complicated checks.
1492
1493 * ccl.c (Fccl_execute_on_string): Check for memory overflow.
1494 Use ptrdiff_t rather than EMACS_INT where ptrdiff_t will do.
1495 Redo buffer-overflow calculations to avoid integer overflow.
1496 Add a FIXME comment where memory seems to be over-allocated.
1497
1498 * character.c (Fstring): Check for size-calculation overflow.
1499
1500 * coding.c (produce_chars): Redo buffer-overflow calculations to avoid
1501 unnecessary integer overflow. Check for size overflow.
1502 (encode_coding_object): Don't update size until xmalloc succeeds.
1503
1504 * composite.c (get_composition_id): Check for overflow in glyph
1505 length calculations.
1506
1507 Integer and memory overflow fixes for display code.
1508 * dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int.
1509 * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool)
1510 (scrolling_window): Check for overflow in size calculations.
1511 (line_draw_cost, realloc_glyph_pool, add_row_entry):
1512 Don't assume glyph table len fits in int.
1513 (struct row_entry.bucket, row_entry_pool_size, row_entry_idx)
1514 (row_table_size): Now ptrdiff_t, not int.
1515 (scrolling_window): Avoid overflow in size calculations.
1516 Don't update size until allocation succeeds.
1517 * fns.c (concat): Check for overflow in size calculations.
1518 (next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT.
1519 * lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
1520 (NEXT_ALMOST_PRIME_LIMIT): New constant.
1521
1522 * doc.c (get_doc_string_buffer_size): Now ptrdiff_t, not int.
1523 (get_doc_string): Check for size calculation overflow.
1524 Don't update size until allocation succeeds.
1525 (get_doc_string, Fsubstitute_command_keys): Use ptrdiff_t, not
1526 EMACS_INT, where ptrdiff_t will do.
1527 (Fsubstitute_command_keys): Check for string overflow.
1528
1529 * editfns.c (set_time_zone_rule): Don't assume environment length
1530 fits in int.
1531 (message_length): Now ptrdiff_t, not int.
1532 (Fmessage_box): Don't update size until allocation succeeds.
1533 Don't assume message length fits in int.
1534 (Fformat): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t will do.
1535
1536 * emacs.c (main): Do not reallocate argv, since there is a null at
1537 the end that can be overwritten, and this way there's no need to
1538 worry about size-calculation overflow.
1539 (sort_args): Check for size-calculation overflow.
1540
1541 * eval.c (init_eval_once, grow_specpdl): Don't update size until
1542 alloc succeeds.
1543 (call_debugger, grow_specpdl): Redo calculations to avoid overflow.
1544
1545 * frame.c (set_menu_bar_lines, x_set_frame_parameters)
1546 (x_set_scroll_bar_width, x_figure_window_size):
1547 Check for integer overflow.
1548 (x_set_alpha): Do not assume XINT fits in int.
1549
1550 * frame.h (struct frame): Use int, not EMACS_INT, where int works.
1551 This is for the members text_lines, text_cols, total_lines, total_cols,
1552 where the system imposes an 'int' limit.
1553
1554 * fringe.c (Fdefine_fringe_bitmap):
1555 Don't update size until alloc works.
1556
1557 * ftfont.c (ftfont_get_open_type_spec, setup_otf_gstring)
1558 (ftfont_shape_by_flt): Check for integer overflow in size calculations.
1559
1560 * gtkutil.c (get_utf8_string, xg_store_widget_in_map):
1561 Check for size-calculation overflow.
1562 (get_utf8_string): Use ptrdiff_t, not size_t, where either will
1563 do, as we prefer signed integers.
1564 (id_to_widget.max_size, id_to_widget.used)
1565 (xg_store_widget_in_map, xg_remove_widget_from_map)
1566 (xg_get_widget_from_map, xg_get_scroll_id_for_window)
1567 (xg_remove_scroll_bar, xg_update_scrollbar_pos):
1568 Use and return ptrdiff_t, not int.
1569 (xg_gtk_scroll_destroy): Don't assume ptrdiff_t fits in int.
1570 * gtkutil.h: Change prototypes to match the above.
1571
1572 * image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): Remove; these
1573 are duplicate now that they've been promoted to lisp.h.
1574 (x_allocate_bitmap_record, x_alloc_image_color)
1575 (make_image_cache, cache_image, xpm_load):
1576 Don't update size until alloc is done.
1577 (xpm_load, lookup_rgb_color, lookup_pixel_color, x_to_xcolors)
1578 (x_detect_edges):
1579 Check for size calculation overflow.
1580 (ct_colors_allocated_max): New constant.
1581 (x_to_xcolors, x_detect_edges): Reorder multiplicands to avoid
1582 overflow.
1583
1584 * keyboard.c (read_char, menu_bar_items, tool_bar_items)
1585 (read_char_x_menu_prompt, read_char_minibuf_menu_width)
1586 (read_char_minibuf_menu_prompt, follow_key, read_key_sequence):
1587 Use ptrdiff_t, not int, to count maps.
1588 (read_char_minibuf_menu_prompt): Check for overflow in size
1589 calculations. Don't update size until allocation succeeds. Redo
1590 calculations to avoid overflow.
1591 * keyboard.h: Change prototypes to match the above.
1592
1593 * keymap.c (cmm_size, current_minor_maps): Use ptrdiff_t, not int,
1594 to count maps.
1595 (current_minor_maps): Check for size calculation overflow.
1596 * keymap.h: Change prototypes to match the above.
1597
1598 * lread.c (read1, init_obarray): Don't update size until alloc done.
1599
1600 * macros.c (Fstart_kbd_macro): Don't update size until alloc done.
1601 (store_kbd_macro_char): Reorder multiplicands to avoid overflow.
1602
1603 * nsterm.h (struct ns_color_table.size, struct ns_color_table.avail):
1604 Now ptrdiff_t, not int.
1605 * nsterm.m (ns_index_color): Use ptrdiff_t, not int, for table indexes.
1606 (ns_draw_fringe_bitmap): Rewrite to avoid overflow.
1607
1608 * process.c (Fnetwork_interface_list): Check for overflow
1609 in size calculation.
1610
1611 * region-cache.c (move_cache_gap): Check for size calculation overflow.
1612
1613 * scroll.c (do_line_insertion_deletion_costs): Check for size calc
1614 overflow. Don't bother calling xmalloc when xrealloc will do.
1615
1616 * search.c (Freplace_match): Check for size calculation overflow.
1617 (Fset_match_data): Don't assume list lengths fit in 'int'.
1618
1619 * sysdep.c (system_process_attributes): Use ptrdiff_t, not int,
1620 for command line length. Do not attempt to address one before the
1621 beginning of an array, as that's not portable.
1622
1623 * term.c (max_frame_lines): Remove; unused.
1624 (encode_terminal_src_size, encode_terminal_dst_size): Now ptrdiff_t,
1625 not int.
1626 (encode_terminal_code, calculate_costs): Check for size
1627 calculation overflow.
1628 (encode_terminal_code): Use ptrdiff_t, not int, to record glyph
1629 table lengths and related sizes. Don't update size until alloc
1630 done. Redo calculations to avoid overflow.
1631 (calculate_costs): Don't bother calling xmalloc when xrealloc will do.
1632
1633 * termcap.c (tgetent): Use ptrdiff_t, not int, to record results of
1634 subtracting pointers.
1635 (gobble_line): Check for overflow more carefully. Don't update size
1636 until alloc done.
1637
1638 * tparam.c (tparam1): Use ptrdiff_t, not int, for sizes.
1639 Don't update size until alloc done.
1640 Redo size calculations to avoid overflow.
1641 Check for size calculation overflow.
1642 (main) [DEBUG]: Fix typo in invoking tparam1.
1643
1644 * xdisp.c (store_mode_line_noprop_char, x_consider_frame_title):
1645 Use ptrdiff_t, not int, for sizes.
1646 (store_mode_line_noprop_char): Don't update size until alloc done.
1647
1648 * xfaces.c (lface_id_to_name_size, Finternal_make_lisp_face):
1649 Use ptrdiff_t, not int, for sizes.
1650 (Finternal_make_lisp_face, cache_face):
1651 Check for size calculation overflow.
1652 (cache_face): Treat size calculation overflows as if they were
1653 memory exhaustion (the usual treatment), rather than aborting.
1654
1655 * xfns.c (x_encode_text, x_set_name_internal)
1656 (Fx_change_window_property): Use ptrdiff_t, not int, to count
1657 sizes, since they can exceed INT_MAX in size. Check for size
1658 calculation overflow.
1659
1660 * xgselect.c (gfds_size): Now ptrdiff_t, for convenience with xpalloc.
1661 (xg_select): Check for size calculation overflow.
1662 Don't update size until alloc done.
1663
1664 * xrdb.c (get_environ_db): Don't assume path length fits in int,
1665 as sprintf is limited to int lengths.
1666
1667 * xselect.c (X_LONG_SIZE, X_SHRT_MAX, X_SHRT_MIN, X_LONG_MAX)
1668 (X_LONG_MIN): New macros.
1669 Use them to make the following changes clearer.
1670 (MAX_SELECTION_QUANTUM): Make the other bounds on this value clearer.
1671 This change doesn't affect the value now, but it may help remind
1672 future maintainers not to raise the value too much later.
1673 (SELECTION_QUANTUM): Remove, replacing with ...
1674 (selection_quantum): ... new function, which avoids overflow.
1675 All uses changed.
1676 (struct selection_data.size): Now ptrdiff_t, not int, to avoid
1677 assumption that selection length fits in 'int'.
1678 (x_reply_selection_request, x_handle_selection_request)
1679 (x_get_window_property, receive_incremental_selection)
1680 (x_get_window_property_as_lisp_data, selection_data_to_lisp_data)
1681 (lisp_data_to_selection_data, clean_local_selection_data):
1682 Use ptrdiff_t, not int, to record length of selection.
1683 (x_reply_selection_request, x_get_window_property)
1684 (receive_incremental_selection, x_property_data_to_lisp):
1685 Redo calculations to avoid overflow.
1686 (x_reply_selection_request): When sending hint, ceiling it at
1687 X_LONG_MAX rather than relying on wraparound overflow to send
1688 something.
1689 (x_get_window_property, receive_incremental_selection)
1690 (lisp_data_to_selection_data, x_property_data_to_lisp):
1691 Check for size-calculation overflow.
1692 (x_get_window_property, receive_incremental_selection)
1693 (lisp_data_to_selection_data, Fx_register_dnd_atom):
1694 Don't store size until memory allocation succeeds.
1695 (x_get_window_property): Plug memory leak on memory exhaustion.
1696 Don't double-block input; malloc is safe here. Don't assume 2**34
1697 - 4 fits in unsigned long. Add an xassert to check
1698 XGetWindowProperty overflow. Be more careful about overflow
1699 calculations, and distinguish size from memory overflow better.
1700 (receive_incremental_selection): When tracing, don't assume
1701 unsigned int is less than INT_MAX.
1702 (x_selection_data_to_lisp_data): Remove unnecessary (and in theory
1703 harmful) conversions of unsigned short to int.
1704 (lisp_data_to_selection_data): Don't assume that integers
1705 in the range -65535 through -1 fit in an X unsigned short.
1706 Don't assume that ULONG_MAX == X_ULONG_MAX. Don't store into
1707 result parameters unless successful. Rely on cons_to_unsigned
1708 to report problems with elements; the old code wasn't right anyway.
1709 (x_check_property_data): Check for int overflow; we cannot use
1710 a wider type due to X limits.
1711 (x_handle_dnd_message): Use unsigned int, to avoid int overflow.
1712
1713 * xsmfns.c (smc_save_yourself_CB): Check for size calc overflow.
1714
1715 * xterm.c (x_color_cells, x_send_scrollbar_event, handle_one_xevent)
1716 (x_term_init): Check for size calculation overflow.
1717 (x_color_cells): Don't store size until memory allocation succeeds.
1718 (handle_one_xevent): Use ptrdiff_t, not int, for byte counts.
1719 Don't assume alloca size is less than MAX_ALLOCA.
1720 (x_term_init): Don't assume length fits in int (sprintf is limited
1721 to int size).
1722
1723 Use ptrdiff_t for composition IDs.
1724 * character.c (lisp_string_width):
1725 * composite.c (composition_table_size, n_compositions)
1726 (get_composition_id, composition_gstring_from_id):
1727 * dispextern.h (struct glyph_string.cmp_id, struct composition_it.id):
1728 * xdisp.c (BUILD_COMPOSITE_GLYPH_STRING):
1729 * window.c (Frecenter):
1730 Use ptrdiff_t, not int, for composition IDs.
1731 * composite.c (get_composition_id): Check for integer overflow.
1732 * composite.h: Adjust prototypes to match the above changes.
1733
1734 Use ptrdiff_t for hash table indexes.
1735 * category.c (hash_get_category_set):
1736 * ccl.c (ccl_driver):
1737 * charset.h (struct charset.hash_index, CHECK_CHARSET_GET_ID):
1738 * coding.c (coding_system_charset_list, detect_coding_system):
1739 * coding.h (struct coding_system.id):
1740 * composite.c (get_composition_id, gstring_lookup_cache):
1741 * fns.c (hash_lookup, hash_put, Fgethash, Fputhash):
1742 * image.c (xpm_get_color_table_h):
1743 * lisp.h (hash_lookup, hash_put):
1744 * minibuf.c (Ftest_completion):
1745 Use ptrdiff_t for hash table indexes, not int (which is too
1746 narrow, on 64-bit hosts) or EMACS_INT (which is too wide, on
1747 32-bit --with-wide-int hosts).
1748
1749 * charset.c (Fdefine_charset_internal): Check for integer overflow.
1750 Add a FIXME comment about memory leaks.
1751 (syms_of_charset): Don't assume xmalloc returns.
1752
1753 Don't assume that stated character widths fit in int.
1754 * character.c (Fchar_width, c_string_width, lisp_string_width):
1755 * character.h (CHAR_WIDTH):
1756 * indent.c (MULTIBYTE_BYTES_WIDTH):
1757 Use sanitize_char_width to avoid undefined and/or bad behavior
1758 with outlandish widths.
1759 * character.h (sanitize_tab_width): Renamed from sanitize_width,
1760 now that we have two such functions. All uses changed.
1761 (sanitize_char_width): New inline function.
1762
1763 Don't assume that tab-width fits in int.
1764 * character.h (sanitize_width): New inline function.
1765 (SANE_TAB_WIDTH): New macro.
1766 (ASCII_CHAR_WIDTH): Use it.
1767 * indent.c (sane_tab_width): Remove. All uses replaced by
1768 SANE_TAB_WIDTH (current_buffer).
1769 * xdisp.c (init_iterator): Use SANE_TAB_WIDTH.
1770
1771 * fileio.c: Integer overflow issues with file modes.
1772 (Fset_file_modes, auto_save_1): Don't assume EMACS_INT fits in int.
1773
1774 * charset.c (read_hex): New arg OVERFLOW. All uses changed.
1775 Remove unreachable code.
1776 (read_hex, load_charset_map_from_file): Check for integer overflow.
1777
1778 * xterm.c: don't go over XClientMessageEvent limit
1779 (scroll_bar_windows_size): Now ptrdiff_t, as we prefer signed.
1780 (x_send_scroll_bar_event): Likewise. Check that the size does not
1781 exceed limits imposed by XClientMessageEvent, as well as the usual
1782 ptrdiff_t and size_t limits.
1783
1784 * keyboard.c: Overflow, signedness and related fixes.
1785 (make_lispy_movement): Use same integer type in forward decl
1786 that is used in the definition.
1787 (read_key_sequence, keyremap_step):
1788 Change bufsize argument back to int, undoing my 2011-03-30 change.
1789 We prefer signed types, and int is wide enough here.
1790 (parse_tool_bar_item): Don't assume tool_bar_max_label_size is less
1791 than TYPE_MAXIMUM (EMACS_INT) / 2. Don't let the label size grow
1792 larger than STRING_BYTES_BOUND. Use ptrdiff_t for Emacs string
1793 length, not size_t. Use ptrdiff_t for index, not int.
1794 (keyremap_step, read_key_sequence): Redo bufsize check to avoid
1795 possibility of integer overflow.
1796
1797 Overflow, signedness and related fixes for images.
1798
1799 * dispextern.h (struct it.stack[0].u.image.image_id)
1800 (struct_it.image_id, struct image.id, struct image_cache.size)
1801 (struct image_cache.used, struct image_cache.ref_count):
1802 * gtkutil.c (update_frame_tool_bar):
1803 * image.c (x_reference_bitmap, Fimage_size, Fimage_mask_p)
1804 (Fimage_metadata, free_image_cache, clear_image_cache, lookup_image)
1805 (cache_image, mark_image_cache, x_kill_gs_process, Flookup_image):
1806 * nsmenu.m (update_frame_tool_bar):
1807 * xdisp.c (calc_pixel_width_or_height):
1808 * xfns.c (image_cache_refcount):
1809 Image IDs are now ptrdiff_t, not int, to avoid arbitrary limits
1810 on typical 64-bit hosts.
1811
1812 * image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros.
1813 (x_bitmap_pixmap, x_create_x_image_and_pixmap):
1814 Omit unnecessary casts to int.
1815 (parse_image_spec): Check that integers fall into 'int' range
1816 when the callers expect that.
1817 (image_ascent): Redo ascent calculation to avoid int overflow.
1818 (clear_image_cache): Avoid overflow when sqrt (INT_MAX) < nimages.
1819 (lookup_image): Remove unnecessary tests.
1820 (xbm_image_p): Locals are now of int, not EMACS_INT,
1821 since parse_image_check makes sure they fit into int.
1822 (png_load, gif_load, svg_load_image):
1823 Prefer int to unsigned where either will do.
1824 (tiff_handler): New function, combining the cores of the
1825 old tiff_error_handler and tiff_warning_handler. This
1826 function is rewritten to use vsnprintf and thereby avoid
1827 stack buffer overflows. It uses only the features of vsnprintf
1828 that are common to both POSIX and native Microsoft.
1829 (tiff_error_handler, tiff_warning_handler): Use it.
1830 (tiff_load, gif_load, imagemagick_load_image):
1831 Don't assume :index value fits in 'int'.
1832 (gif_load): Omit unnecessary cast to double, and avoid double-rounding.
1833 (imagemagick_load_image): Check that crop parameters fit into
1834 the integer types that MagickCropImage accepts. Don't assume
1835 Vimagemagick_render_type has a nonnegative value. Don't assume
1836 size_t fits in 'long'.
1837 (gs_load): Use printmax_t to print the widest integers possible.
1838 Check for integer overflow when computing image height and width.
1839
1840 2011-08-26 Eli Zaretskii <eliz@gnu.org>
1841
1842 * xdisp.c (redisplay_window): Don't force window start if point
1843 will be invisible in the resulting window. (Bug#9324)
1844
1845 2011-08-25 Eli Zaretskii <eliz@gnu.org>
1846
1847 * xdisp.c (compute_display_string_pos): Return 2 in DISP_PROP when
1848 the display spec is of the form `(space ...)'.
1849 (handle_display_spec): Return the value returned by
1850 handle_single_display_spec, not just 1 or zero.
1851 (handle_single_display_spec): If the display spec is of the form
1852 `(space ...)', and specifies display in the text area, return 2
1853 rather than 1.
1854 (try_cursor_movement): Check for the need to scroll more
1855 accurately, and prefer exact match for point under bidi. Don't
1856 advance `row' beyond the last row of the window.
1857
1858 * dispextern.h (struct bidi_it): Rename the disp_prop_p member
1859 into disp_prop; all users changed.
1860
1861 * bidi.c (bidi_fetch_char): If compute_display_string_pos returns
1862 DISP_PROP = 2, substitute the u+2029 PARAGRAPH SEPARATOR character
1863 for the text covered by the display property.
1864
1865 2011-08-25 Chong Yidong <cyd@stupidchicken.com>
1866
1867 * buffer.c (Fbury_buffer_internal): Rename from Funrecord_buffer.
1868 Change return value to nil.
1869 (Frecord_buffer): Delete unused function.
1870
1871 2011-08-24 Eli Zaretskii <eliz@gnu.org>
1872
1873 * xdisp.c (Fcurrent_bidi_paragraph_direction): For unibyte
1874 buffers, return left-to-right.
1875 (set_cursor_from_row): Consider candidate row a win if its glyph
1876 represents a newline and point is on that newline. Fixes cursor
1877 positioning on the newline at EOL of R2L text within L2R
1878 paragraph, and vice versa.
1879 (try_cursor_movement): Check continued rows, in addition to
1880 continuation rows. Fixes unwarranted scroll when point enters a
1881 continued line of R2L text within an L2R paragraph, or vice versa.
1882 (cursor_row_p): Consider the case of point being equal to
1883 MATRIX_ROW_END_CHARPOS. Prevents cursor being stuck when moving
1884 from the end of a short line to the beginning of a continued line
1885 of R2L text within L2R paragraph.
1886 (RECORD_MAX_MIN_POS): For max_pos, use IT_CHARPOS even for
1887 composed characters.
1888
1889 * bidi.c (bidi_check_type): Use xassert.
1890 (bidi_cache_iterator_state): Update the disp_pos and disp_prop_p
1891 members.
1892
1893 2011-08-23 Eli Zaretskii <eliz@gnu.org>
1894
1895 * bidi.c (bidi_get_type): Abort if we get zero as the bidi type of
1896 a character.
1897
1898 2011-08-23 Chong Yidong <cyd@stupidchicken.com>
1899
1900 * nsfont.m (ns_otf_to_script): Fix typo.
1901
1902 2011-08-22 Kenichi Handa <handa@m17n.org>
1903
1904 * chartab.c (Fset_char_table_extra_slot): Do not inhibit setting a
1905 extra slot even if the purpose is char-code-property-table.
1906
1907 2011-08-23 Eli Zaretskii <eliz@gnu.org>
1908
1909 * xdisp.c (redisplay_window): When computing centering_position,
1910 account for the height of the header line. (Bug#8874)
1911
1912 * dispnew.c (buffer_posn_from_coords): Use buf_charpos_to_bytepos
1913 instead of CHAR_TO_BYTE. Fixes a crash when a completion
1914 candidate is selected by the mouse, and that candidate has a
1915 composed character under the mouse.
1916
1917 * xdisp.c (x_produce_glyphs): Set it->nglyphs to 1. Fixes pixel
1918 coordinates reported by pos-visible-in-window-p for a composed
1919 character in column zero.
1920
1921 2011-08-23 Stefan Monnier <monnier@iro.umontreal.ca>
1922
1923 * cmds.c (Fself_insert_command): Mention post-self-insert-hook.
1924
1925 2011-08-22 Eli Zaretskii <eliz@gnu.org>
1926
1927 * xdisp.c (BUFFER_POS_REACHED_P): If this is a composition,
1928 consider it a hit if to_charpos is anywhere in the range of the
1929 composed buffer positions.
1930
1931 2011-08-22 Chong Yidong <cyd@stupidchicken.com>
1932
1933 * image.c (gif_load): Don't assume that each subimage has the same
1934 dimensions as the base image. Handle disposal method that is
1935 "undefined" by the gif spec (Bug#9335).
1936
1937 2011-08-20 Chong Yidong <cyd@stupidchicken.com>
1938
1939 * eval.c (Fsignal): Handle `debug' symbol in error handler (Bug#9329).
1940 (Fcondition_case): Document `debug' symbol in error handler.
1941
1942 2011-08-19 Eli Zaretskii <eliz@gnu.org>
1943
1944 * xfaces.c (face_at_buffer_position): Avoid repeated evaluation of
1945 face ID by FACE_FROM_ID, and avoid a crash when mouse is moved
1946 from an Org mode buffer to a Speedbar frame.
1947
1948 * xdisp.c (RECORD_MAX_MIN_POS): If the display element comes from
1949 a composition, take its buffer position from IT->cmp_it.charpos.
1950 Fixes cursor positioning at the beginning of a line that begins
1951 with a composed character.
1952
1953 2011-08-18 Eli Zaretskii <eliz@gnu.org>
1954
1955 * bidi.c (bidi_get_type): If bidi_type_table reports zero as the
1956 character bidirectional type, use STRONG_L instead. Fixes crashes
1957 in a buffer produced by `describe-categories'.
1958
1959 * dispextern.h (struct bidi_it): Move disp_pos and disp_prop_p
1960 members before the level stack, so they would be saved and
1961 restored when copying iterator state. Fixes incorrect reordering
1962 around TABs covered by display properties.
1963
1964 2011-08-18 Andreas Schwab <schwab@linux-m68k.org>
1965
1966 * process.c (Fnetwork_interface_list): Correctly determine buffer
1967 size.
1968
1969 2011-08-17 Chong Yidong <cyd@stupidchicken.com>
1970
1971 * eval.c (internal_condition_case, internal_condition_case_1)
1972 (internal_condition_case_2, internal_condition_case_n):
1973 Remove unnecessary aborts (Bug#9081).
1974
1975 2011-08-17 Eli Zaretskii <eliz@gnu.org>
1976
1977 * lread.c (Fload) [DOS_NT]: If `openp' returns -2, but the file
1978 has no `load' handler, try opening the file locally. (Bug#9311)
1979
1980 2011-08-16 Ken Brown <kbrown@cornell.edu>
1981
1982 * gmalloc.c: Expand comment.
1983
1984 2011-08-16 Eli Zaretskii <eliz@gnu.org>
1985
1986 * xdisp.c (set_cursor_from_row): Don't accept a previous candidate
1987 if it fails the cursor_row_p test. Fixes cursor positioning at ZV.
1988
1989 2011-08-16 Ken Brown <kbrown@cornell.edu>
1990
1991 Fix memory allocation problems in Cygwin build (Bug#9273).
1992
1993 * unexcw.c ( __malloc_initialized): Declare external variable.
1994 (fixup_executable): Force the dumped emacs to reinitialize malloc.
1995
1996 * gmalloc.c [CYGWIN] (bss_sbrk_heapbase, bss_sbrk_heapinfo):
1997 New variables.
1998 (malloc_initialize_1) [CYGWIN]: Prepare for reinitializing the
1999 dumped emacs.
2000 (_free_internal_nolock) [CYGWIN]: Ignore requests to free storage
2001 in the static heap.
2002 [CYGWIN] (special_realloc): New function.
2003 (_realloc_internal_nolock) [CYGWIN]: Use the new function on
2004 requests to realloc storage in the static heap.
2005
2006 2011-08-15 Paul Eggert <eggert@cs.ucla.edu>
2007
2008 * bidi.c (bidi_initialize): Remove unused local.
2009
2010 2011-08-15 Eli Zaretskii <eliz@gnu.org>
2011
2012 * biditype.h: File removed.
2013
2014 * bidimirror.h: File removed.
2015
2016 * deps.mk (bidi.o): Remove biditype.h and
2017 bidimirror.h.
2018
2019 * makefile.w32-in ($(BLD)/bidi.$(O)): Remove biditype.h and
2020 bidimirror.h.
2021
2022 * dispextern.h: Fix a typo in the comment to bidi_type_t.
2023
2024 * chartab.c: Improve commentary for the uniprop_table API.
2025
2026 * bidi.c (bidi_paragraph_init): Support zero value of
2027 bidi_ignore_explicit_marks_for_paragraph_level.
2028 (bidi_initialize): Use uniprop_table instead of including
2029 biditype.h and bidimirror.h.
2030
2031 * xdisp.c (move_it_in_display_line_to): Don't reset pixel
2032 coordinates of the iterator when restoring from ppos_it.
2033 (Bug#9296)
2034
2035 2011-08-14 Kenichi Handa <handa@m17n.org>
2036
2037 * process.c (create_process): Call setup_process_coding_systems
2038 after the pid of the process is set to -1 (Bug#8162).
2039
2040 2011-08-14 Eli Zaretskii <eliz@gnu.org>
2041
2042 * xdisp.c (move_it_in_display_line_to): Don't invoke
2043 IT_RESET_X_ASCENT_DESCENT when iterator position was restored from
2044 ppos_it. Fixes vertical cursor motion when line beginning is
2045 covered by an image. (Bug#9296)
2046
2047 2011-08-14 Jan Djärv <jan.h.d@swipnet.se>
2048
2049 * nsterm.h (ns_run_ascript): Declare.
2050 (NSAPP_DATA2_RUNASSCRIPT): Define.
2051
2052 * nsfns.m (as_script, as_result, as_status): New static variables.
2053 (ns_run_ascript): New function.
2054 (Fns_do_applescript): Set variables as_*. Make an NSApplicationDefined
2055 event with data2 set to NSAPP_DATA2_RUNASSCRIPT, post it and then start
2056 the event loop. Get status from as_status (Bug#7276).
2057
2058 * nsterm.m (sendEvent): If event is NSApplicationDefined and
2059 data2 is NSAPP_DATA2_RUNASSCRIPT, call ns_run_ascript and then exit
2060 the event loop (Bug#7276).
2061
2062 2011-08-14 Andreas Schwab <schwab@linux-m68k.org>
2063
2064 * gnutls.c (QCgnutls_bootprop_priority)
2065 (QCgnutls_bootprop_trustfiles, QCgnutls_bootprop_keylist)
2066 (QCgnutls_bootprop_crlfiles, QCgnutls_bootprop_callbacks)
2067 (QCgnutls_bootprop_loglevel, QCgnutls_bootprop_hostname)
2068 (QCgnutls_bootprop_min_prime_bits, QCgnutls_bootprop_verify_flags)
2069 (QCgnutls_bootprop_verify_hostname_error)
2070 (QCgnutls_bootprop_callbacks_verify): Rename from
2071 Qgnutls_bootprop_..., all uses changed.
2072
2073 * xfaces.c (QCignore_defface): Rename from Qignore_defface, all
2074 uses changed.
2075
2076 2011-08-14 Paul Eggert <eggert@cs.ucla.edu>
2077
2078 * xfaces.c (Qframe_set_background_mode): Now static.
2079 * dispextern.h (Qframe_set_background_mode): Remove decl.
2080
2081 * process.c (Fnetwork_interface_info): Declare local only if needed.
2082
2083 2011-08-13 Jan Djärv <jan.h.d@swipnet.se>
2084
2085 * process.c: Include ifaddrs.h and net/if_dl.h if available (Bug#8477).
2086 (Fnetwork_interface_list): Allocate in increments of bytes instead
2087 of sizeof (struct ifreq). Iterate over ifconf.ifc_req by counting
2088 bytes (Bug#8477). Count bytes correctly when ifr_addr is a struct
2089 sockaddr.
2090 (struct ifflag_def): notrailers is smart on OSX.
2091 (Fnetwork_interface_info): Handle case when ifr_flags is negative.
2092 Get hardware address with getifaddrs if available.
2093
2094 2011-08-12 Eli Zaretskii <eliz@gnu.org>
2095
2096 * xdisp.c (iterate_out_of_display_property): xassert that
2097 IT->position is set to within IT->object's boundaries. Break from
2098 the loop as soon as EOB is reached; avoids infloops in redisplay
2099 when IT->position is set up wrongly due to some bug.
2100 Set IT->current to match the bidi iterator unconditionally.
2101 (push_display_prop): Allow GET_FROM_STRING as IT->method on
2102 entry. Force push_it to save on the stack the current
2103 buffer/string position, to be restored by pop_it. Fix flags in
2104 the iterator structure wrt the object coming from a display
2105 property, as `line-prefix' and `wrap-prefix' are not ``replacing''
2106 properties. (Bug#9284)
2107
2108 2011-08-09 Andreas Schwab <schwab@linux-m68k.org>
2109
2110 * fontset.c (fontset_get_font_group): Add proper type checks.
2111 (Bug#9172)
2112
2113 2011-08-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2114
2115 * unexmacosx.c (print_load_command_name): Add cases LC_FUNCTION_STARTS
2116 and LC_VERSION_MIN_MACOSX.
2117 (copy_linkedit_data) [LC_FUNCTION_STARTS]: New function.
2118 (dump_it) [LC_FUNCTION_STARTS]: Use it.
2119
2120 2011-08-08 Eli Zaretskii <eliz@gnu.org>
2121
2122 * xdisp.c (forward_to_next_line_start): Allow to use the
2123 no-display-properties-and-no-overlays under bidi display.
2124 Set disp_pos in the bidi iterator to avoid searches for display
2125 properties and overlays.
2126
2127 2011-08-08 Chong Yidong <cyd@stupidchicken.com>
2128
2129 * editfns.c (Fset_time_zone_rule): Document relationship with the
2130 setenv function.
2131
2132 * ftfont.c (ftfont_pattern_entity): Copy the extras argument to
2133 the font entity extracted from the cache (Bug#8109).
2134
2135 2011-08-07 Chong Yidong <cyd@stupidchicken.com>
2136
2137 * composite.c (autocmp_chars): Don't reset point. That is done by
2138 restore_point_unwind (Bug#5984).
2139
2140 2011-08-07 Juri Linkov <juri@jurta.org>
2141
2142 * editfns.c (Fformat_time_string): Doc fix, add tag `usage:'
2143 to show the arg `TIME' instead of `TIMEVAL'.
2144
2145 2011-08-06 Eli Zaretskii <eliz@gnu.org>
2146
2147 * xdisp.c (set_cursor_from_row): Fix cursor positioning when a
2148 display property strides EOL and includes a newline, as in
2149 longlines-mode. (Bug#9254)
2150 (move_it_in_display_line_to): Fix vertical-motion in a buffer with
2151 word-wrap under bidirectional display. (Bug#9224)
2152
2153 * bidi.c (bidi_unshelve_cache): Don't reset the cache if JUST_FREE
2154 is non-zero, even if the data buffer is NULL. Fixes a crash in
2155 vertical-motion with longlines-mode. (Bug#9254)
2156
2157 2011-08-05 Eli Zaretskii <eliz@gnu.org>
2158
2159 * bidi.c <bidi_cache_total_alloc>: Now static.
2160 (bidi_initialize): Initialize bidi_cache_total_alloc.
2161
2162 * xdisp.c (display_line): Release buffer allocated for shelved bidi
2163 cache. (Bug#9221)
2164
2165 * bidi.c (bidi_shelve_cache, bidi_unshelve_cache): Track total
2166 amount allocated this far in `bidi_cache_total_alloc'.
2167 (bidi_unshelve_cache): Accept an additional argument JUST_FREE; if
2168 non-zero, only free the data buffer without restoring the cache
2169 contents. All callers changed.
2170
2171 * dispextern.h (bidi_unshelve_cache): Update prototype.
2172
2173 * xdisp.c (SAVE_IT, pos_visible_p, move_it_in_display_line_to)
2174 (move_it_in_display_line, move_it_to)
2175 (move_it_vertically_backward, move_it_by_lines): Replace the call
2176 to xfree to an equivalent call to bidi_unshelve_cache.
2177 (move_it_in_display_line_to): Fix logic of returning
2178 MOVE_POS_MATCH_OR_ZV in the bidi case. (Bug#9224)
2179
2180 2011-08-05 Eli Zaretskii <eliz@gnu.org>
2181
2182 * xdisp.c (set_cursor_from_row): Prefer the candidate glyph that
2183 came from a string character with a `cursor' property. (Bug#9229)
2184
2185 2011-08-04 Jan Djärv <jan.h.d@swipnet.se>
2186
2187 * Makefile.in (LIB_PTHREAD): New variable.
2188 (LIBES): Add LIB_PTHREAD (Bug#9216).
2189
2190 * alloc.c, emacs.c, gmalloc.c, gtkutil.c, keyboard.c, syssignal.h:
2191 Rename HAVE_GTK_AND_PTHREAD to HAVE_PTHREAD (Bug#9216).
2192
2193 2011-08-04 Andreas Schwab <schwab@linux-m68k.org>
2194
2195 * regex.c (re_iswctype): Remove some redundant boolean
2196 conversions.
2197
2198 2011-08-04 Jan Djärv <jan.h.d@swipnet.se>
2199
2200 * xterm.c (x_find_topmost_parent): New function.
2201 (x_set_frame_alpha): Find topmost parent window with
2202 x_find_topmost_parent and set the property there also (bug#9181).
2203 (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify.
2204
2205 2011-08-04 Paul Eggert <eggert@cs.ucla.edu>
2206
2207 * callproc.c (Fcall_process): Avoid vfork clobbering
2208 the local vars buffer, coding_systems, current_dir.
2209
2210 2011-08-03 Stefan Monnier <monnier@iro.umontreal.ca>
2211
2212 * keymap.c (Fmake_composed_keymap): Move to subr.el.
2213
2214 2011-08-03 Paul Eggert <eggert@cs.ucla.edu>
2215
2216 * fontset.c (dump_fontset) [FONTSET_DEBUG]: Declare EXTERNALLY_VISIBLE
2217 so that it is not optimized away.
2218
2219 * xdisp.c (compute_display_string_pos): Remove unused local.
2220
2221 2011-08-02 Eli Zaretskii <eliz@gnu.org>
2222
2223 Fix slow cursor motion and scrolling in large buffers with
2224 selective display, like Org Mode buffers. (Bug#9218)
2225
2226 * dispextern.h (struct bidi_it): New member disp_prop_p.
2227
2228 * xdisp.c: Remove one-slot cache of display string positions.
2229 (compute_display_string_pos): Accept an additional argument
2230 DISP_PROP_P; callers changed. Scan at most 5K characters forward
2231 for a display string or property. If found, set DISP_PROP_P
2232 non-zero.
2233
2234 * bidi.c (bidi_fetch_char): Accept an additional argument
2235 DISP_PROP_P, and pass it to compute_display_string_pos.
2236 Only handle text covered by a display string if DISP_PROP_P is returned
2237 non-zero. All callers of bidi_fetch_char changed.
2238
2239 2011-08-02 Stefan Monnier <monnier@iro.umontreal.ca>
2240
2241 * keymap.c (Fdefine_key): Fix Lisp_Object/int mixup; apply some CSE.
2242
2243 2010-12-03 Don March <don@ohspite.net>
2244
2245 * keymap.c (Fdefine_key): Fix non-prefix key error message when
2246 last character M-[char] is translated to ESC [char] (bug#7541).
2247
2248 2011-08-02 Kenichi Handa <handa@m17n.org>
2249
2250 * lisp.h (uniprop_table): Extern it.
2251
2252 * chartab.c (uniprop_table): Make it non-static.
2253
2254 2011-08-01 Eli Zaretskii <eliz@gnu.org>
2255
2256 * xdisp.c (forward_to_next_line_start): Accept additional argument
2257 BIDI_IT_PREV, and store into it the state of the bidi iterator had
2258 on the newline.
2259 (reseat_at_next_visible_line_start): Use the bidi iterator state
2260 returned by forward_to_next_line_start to restore the state of
2261 it->bidi_it after backing up to previous newline. (Bug#9212)
2262
2263 2011-07-30 Andreas Schwab <schwab@linux-m68k.org>
2264
2265 * regex.c (re_comp): Protoize.
2266 (re_exec): Fix return type.
2267 (regexec): Fix type of `ret'. (Bug#9203)
2268
2269 2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
2270
2271 * image.c (check_image_size): Use 1024x1024 if unknown frame (Bug#9189).
2272 This is needed if max-image-size is a floating-point number.
2273
2274 2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
2275
2276 * print.c (print_object): Print empty symbol as ##.
2277
2278 * lread.c (read1): Read ## as empty symbol.
2279
2280 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com>
2281
2282 * nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
2283 setting frame foreground color (Bug#9175).
2284 (x_set_background_color): Likewise.
2285
2286 * nsmenu.m (-setText): Size tooltip dimensions precisely to
2287 contents (Bug#9176).
2288 (EmacsTooltip -init): Remove bezels and add shadows to
2289 tooltip windows.
2290
2291 * nsterm.m (ns_dumpglyphs_stretch): Avoid overwriting left fringe
2292 or scroll bar (Bug#8470).
2293
2294 * nsfont.m (nsfont_open): Remove assignment to voffset and
2295 unnecessary vars hshink, expand, hd, full_height, min_height.
2296 (nsfont_draw): Use s->ybase as baseline for glyph drawing (Bug#8913).
2297
2298 * nsterm.h (nsfont_info): Remove voffset field.
2299
2300 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com>
2301
2302 Implement strike-through and overline on NextStep (Bug#8863).
2303
2304 * nsfont.m (nsfont_open): Use underline position provided by font,
2305 instead of hard-coded value of 2.
2306 (nsfont_draw): Call ns_draw_text_decoration instead.
2307
2308 * nsterm.h: Add declaration for ns_draw_text_decoration.
2309
2310 * nsterm.m (ns_draw_text_decoration): New function for drawing
2311 underline, overline, and strike-through.
2312 (ns_dumpglyphs_image, ns_dumpglyphs_stretch): Add call to
2313 ns_draw_text_decoration. Change treatment of cursor drawing to
2314 accommodate underlining, etc.
2315
2316 2011-07-28 Eli Zaretskii <eliz@gnu.org>
2317
2318 * buffer.c (init_buffer_once): Set bidi-display-reordering to t by
2319 default.
2320
2321 2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
2322
2323 * alloc.c (memory_full) [!SYNC_INPUT]: Fix signal-related race.
2324 Without this fix, if a signal arrives just after memory fills up,
2325 'malloc' might be invoked reentrantly.
2326
2327 * image.c (x_check_image_size) [!HAVE_X_WINDOWS]: Return 1.
2328 In other words, assume that every image size is allowed, on non-X
2329 hosts. This assumption is probably wrong, but it lets Emacs compile.
2330
2331 2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
2332
2333 * regex.c (re_iswctype): Convert return values to boolean.
2334
2335 2011-07-28 Eli Zaretskii <eliz@fencepost.gnu.org>
2336
2337 * xdisp.c (compute_display_string_pos): Don't use cached display
2338 string position if the buffer had its restriction changed.
2339 (Bug#9184)
2340
2341 2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
2342
2343 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering.
2344
2345 2011-07-28 Paul Eggert <eggert@cs.ucla.edu>
2346
2347 Integer signedness and overflow and related fixes. (Bug#9079)
2348
2349 * bidi.c: Integer size and overflow fixes.
2350 (bidi_cache_size, bidi_cache_idx, bidi_cache_last_idx)
2351 (bidi_cache_start, bidi_cache_fetch_state, bidi_cache_search)
2352 (bidi_cache_find_level_change, bidi_cache_ensure_space)
2353 (bidi_cache_iterator_state, bidi_cache_find, bidi_cache_start_stack)
2354 (bidi_find_other_level_edge):
2355 Use ptrdiff_t instead of EMACS_INT where either will do.
2356 This works better on 32-bit hosts configured --with-wide-int.
2357 (bidi_cache_ensure_space): Check for size-calculation overflow.
2358 Use % rather than repeated addition, for better worst-case speed.
2359 Don't set bidi_cache_size until after xrealloc returns, because it
2360 might not return.
2361 (bidi_dump_cached_states): Use ptrdiff_t, not int, to avoid overflow.
2362 (bidi_cache_ensure_space): Also check that the bidi cache size
2363 does not exceed that of the largest Lisp string or buffer. See Eli
2364 Zaretskii in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9079#29>.
2365
2366 * alloc.c (__malloc_size_t): Remove.
2367 All uses replaced by size_t. See Andreas Schwab's note
2368 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9079#8>.
2369
2370 * image.c: Improve checking for integer overflow.
2371 (check_image_size): Assume that f is nonnull, since
2372 it is always nonnull in practice. This is one less thing to
2373 worry about when checking for integer overflow later.
2374 (x_check_image_size): New function, which checks for integer
2375 overflow issues inside X.
2376 (x_create_x_image_and_pixmap, xbm_read_bitmap_data): Use it.
2377 This removes the need for a memory_full check.
2378 (xbm_image_p): Rewrite to avoid integer multiplication overflow.
2379 (Create_Pixmap_From_Bitmap_Data, xbm_load): Use x_check_image_size.
2380 (xbm_read_bitmap_data): Change locals back to 'int', since
2381 their values must fit in 'int'.
2382 (xpm_load_image, png_load, tiff_load):
2383 Invoke x_create_x_image_and_pixmap earlier,
2384 to avoid much needless work if the image is too large.
2385 (tiff_load): Treat overly large images as if
2386 x_create_x_image_and_pixmap failed, not as malloc failures.
2387 (gs_load): Use x_check_image_size.
2388
2389 * gtkutil.c: Omit integer casts.
2390 (xg_get_pixbuf_from_pixmap): Remove unnecessary cast.
2391 (xg_set_toolkit_scroll_bar_thumb): Rewrite to avoid need for cast.
2392
2393 * image.c (png_load): Don't assume height * row_bytes fits in 'int'.
2394
2395 * xfaces.c (Fbitmap_spec_p): Fix integer overflow bug.
2396 Without this fix, (bitmap-spec-p '(34359738368 1 "x"))
2397 would wrongly return t on a 64-bit host.
2398
2399 * dispnew.c (init_display): Use *_RANGE_OVERFLOW macros.
2400 The plain *_OVERFLOW macros run afoul of GCC bug 49705
2401 <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49705>
2402 and therefore cause GCC to emit a bogus diagnostic in some cases.
2403
2404 * image.c: Integer signedness and overflow and related fixes.
2405 This is not an exhaustive set of fixes, but it's time to
2406 record what I've got.
2407 (lookup_pixel_color, check_image_size): Remove redundant decls.
2408 (check_image_size): Don't assume that arbitrary EMACS_INT values
2409 fit in 'int', or that arbitrary 'double' values fit in 'int'.
2410 (x_alloc_image_color, x_create_x_image_and_pixmap, png_load)
2411 (tiff_load, imagemagick_load_image):
2412 Check for overflow in size calculations.
2413 (x_create_x_image_and_pixmap): Remove unnecessary test for
2414 xmalloc returning NULL; that can't happen.
2415 (xbm_read_bitmap_data): Don't assume sizes fit into 'int'.
2416 (xpm_color_bucket): Use better integer hashing function.
2417 (xpm_cache_color): Don't possibly over-allocate memory.
2418 (struct png_memory_storage, tiff_memory_source, tiff_seek_in_memory)
2419 (gif_memory_source):
2420 Use ptrdiff_t, not int or size_t, to record sizes.
2421 (png_load): Don't assume values greater than 2**31 fit in 'int'.
2422 (our_stdio_fill_input_buffer): Prefer ptrdiff_t to size_t when
2423 either works, as we prefer signed integers.
2424 (tiff_read_from_memory, tiff_write_from_memory):
2425 Return tsize_t, not size_t, since that's what the TIFF API wants.
2426 (tiff_read_from_memory): Don't fail simply because the read would
2427 go past EOF; instead, return a short read.
2428 (tiff_load): Omit no-longer-needed casts.
2429 (Fimagemagick_types): Don't assume size fits into 'int'.
2430
2431 Improve hashing quality when configured --with-wide-int.
2432 * fns.c (hash_string): New function, taken from sxhash_string.
2433 Do not discard information about ASCII character case; this
2434 discarding is no longer needed.
2435 (sxhash-string): Use it. Change sig to match it. Caller changed.
2436 * lisp.h: Declare it.
2437 * lread.c (hash_string): Remove, since we now use fns.c's version.
2438 The fns.c version returns a wider integer if --with-wide-int is
2439 specified, so this should help the quality of the hashing a bit.
2440
2441 * emacs.c: Integer overflow minor fix.
2442 (heap_bss_diff): Now uprintmax_t, not unsigned long. All used changed.
2443 Define only if GNU_LINUX.
2444 (main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX.
2445
2446 * dispnew.c: Integer signedness and overflow fixes.
2447 Remove unnecessary forward decls, that were a maintenance hassle.
2448 (history_tick): Now uprintmax_t, so it's more likely to avoid overflow.
2449 All uses changed.
2450 (adjust_glyph_matrix, realloc_glyph_pool, adjust_frame_message_buffer)
2451 (scrolling_window): Use ptrdiff_t, not int, for byte count.
2452 (prepare_desired_row, line_draw_cost):
2453 Use int, not unsigned, where either works.
2454 (save_current_matrix, restore_current_matrix):
2455 Use ptrdiff_t, not size_t, where either works.
2456 (init_display): Check for overflow more accurately, and without
2457 relying on undefined behavior.
2458
2459 * editfns.c (pWIDE, pWIDElen, signed_wide, unsigned_wide):
2460 Remove, replacing with the new symbols in lisp.h. All uses changed.
2461 * fileio.c (make_temp_name):
2462 * filelock.c (lock_file_1, lock_file):
2463 * xdisp.c (message_dolog):
2464 Don't assume PRIdMAX etc. works; this isn't portable to pre-C99 hosts.
2465 Use pMd etc. instead.
2466 * lisp.h (printmax_t, uprintmax_t, pMd, pMu): New types and macros,
2467 replacing the pWIDE etc. symbols removed from editfns.c.
2468
2469 * keyboard.h (num_input_events): Now uintmax_t.
2470 This is (very slightly) less likely to mess up due to wraparound.
2471 All uses changed.
2472
2473 * buffer.c: Integer signedness fixes.
2474 (alloc_buffer_text, enlarge_buffer_text):
2475 Use ptrdiff_t rather than size_t when either will do, as we prefer
2476 signed integers.
2477
2478 * alloc.c: Integer signedness and overflow fixes.
2479 Do not impose an arbitrary 32-bit limit on malloc sizes when debugging.
2480 (__malloc_size_t): Default to size_t, not to int.
2481 (pure_size, pure_bytes_used_before_overflow, stack_copy_size)
2482 (Fgarbage_collect, mark_object_loop_halt, mark_object):
2483 Prefer ptrdiff_t to size_t when either would do, as we prefer
2484 signed integers.
2485 (XMALLOC_OVERRUN_CHECK_OVERHEAD): New macro.
2486 (xmalloc_overrun_check_header, xmalloc_overrun_check_trailer):
2487 Now const. Initialize with values that are in range even if char
2488 is signed.
2489 (XMALLOC_PUT_SIZE, XMALLOC_GET_SIZE): Remove, replacing with ...
2490 (xmalloc_put_size, xmalloc_get_size): New functions. All uses changed.
2491 These functions do the right thing with sizes > 2**32.
2492 (check_depth): Now ptrdiff_t, not int.
2493 (overrun_check_malloc, overrun_check_realloc, overrun_check_free):
2494 Adjust to new way of storing sizes. Check for size overflow bugs
2495 in rest of code.
2496 (STRING_BYTES_MAX): Adjust to new overheads. The old code was
2497 slightly wrong anyway, as it missed one instance of
2498 XMALLOC_OVERRUN_CHECK_OVERHEAD.
2499 (refill_memory_reserve): Omit needless cast to size_t.
2500 (mark_object_loop_halt): Mark as externally visible.
2501
2502 * xselect.c: Integer signedness and overflow fixes.
2503 (Fx_register_dnd_atom, x_handle_dnd_message):
2504 Use ptrdiff_t, not size_t, since we prefer signed.
2505 (Fx_register_dnd_atom): Check for ptrdiff_t (and size_t) overflow.
2506 * xterm.h (struct x_display_info): Use ptrdiff_t, not size_t, for
2507 x_dnd_atoms_size and x_dnd_atoms_length.
2508
2509 * doprnt.c: Prefer signed to unsigned when either works.
2510 * eval.c (verror):
2511 * doprnt.c (doprnt):
2512 * lisp.h (doprnt):
2513 * xdisp.c (vmessage):
2514 Use ptrdiff_t, not size_t, when using or implementing doprnt,
2515 since the sizes cannot exceed ptrdiff_t bounds anyway, and we
2516 prefer signed arithmetic to avoid comparison confusion.
2517 * doprnt.c (doprnt): Avoid a "+ 1" that can't overflow,
2518 but is a bit tricky.
2519
2520 Assume freestanding C89 headers, string.h, stdlib.h.
2521 * data.c, doprnt.c, floatfns.c, print.c:
2522 Include float.h unconditionally.
2523 * gmalloc.c: Assume C89-at-least behavior for preprocessor,
2524 limits.h, stddef.h, string.h. Use memset instead of 'flood'.
2525 * regex.c: Likewise for stddef.h, string.h.
2526 (ISASCII): Remove; can assume it returns 1 now. All uses removed.
2527 * s/aix4-2.h (HAVE_STRING_H): Remove obsolete undef.
2528 * s/ms-w32.h (HAVE_LIMITS_H, HAVE_STRING_H, HAVE_STDLIB_H)
2529 (STDC_HEADERS): Remove obsolete defines.
2530 * sysdep.c: Include limits.h unconditionally.
2531
2532 Assume support for memcmp, memcpy, memmove, memset.
2533 * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset):
2534 * regex.c (memcmp, memcpy):
2535 Remove; we assume C89 now.
2536
2537 * gmalloc.c (memcpy, memset, memmove): Remove; we assume C89 now.
2538 (__malloc_safe_bcopy): Remove; no longer needed.
2539
2540 * lisp.h (struct vectorlike_header, struct Lisp_Subr): Signed sizes.
2541 Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally
2542 well either way, and we prefer signed to unsigned.
2543
2544 2011-07-27 Lars Magne Ingebrigtsen <larsi@gnus.org>
2545
2546 * gnutls.c (emacs_gnutls_read): Don't message anything if the peer
2547 closes the connection while we're reading (bug#9182).
2548
2549 2011-07-25 Jan Djärv <jan.h.d@swipnet.se>
2550
2551 * nsmenu.m (ns_popup_dialog): Add an "ok" button if no buttons
2552 are specified (Bug#9168).
2553
2554 2011-07-25 Paul Eggert <eggert@cs.ucla.edu>
2555
2556 * bidi.c (bidi_dump_cached_states): Fix printf format mismatch.
2557 Found by GCC static checking and --with-wide-int on a 32-bit host.
2558
2559 2011-07-25 Eli Zaretskii <eliz@gnu.org>
2560
2561 * xdisp.c (compute_display_string_pos): Fix logic of caching
2562 previous display string position. Initialize cached_prev_pos to
2563 -1. Fixes slow-down at the beginning of a buffer.
2564
2565 2011-07-24 Eli Zaretskii <eliz@gnu.org>
2566
2567 * xfaces.c (check_lface_attrs) [HAVE_WINDOW_SYSTEM]: Allow `nil'
2568 for attrs[LFACE_FONTSET_INDEX].
2569
2570 2011-07-23 Paul Eggert <eggert@cs.ucla.edu>
2571
2572 * xml.c (parse_region): Remove unused local
2573 that was recently introduced.
2574
2575 2011-07-23 Eli Zaretskii <eliz@gnu.org>
2576
2577 * xfns.c (unwind_create_frame) [GLYPH_DEBUG]: Adapt to changes in
2578 2008-02-22T17:42:09Z!monnier@iro.umontreal.ca.
2579
2580 * xdisp.c (move_it_in_display_line_to): Record the best matching
2581 position for TO_CHARPOS while scanning the line, and restore it on
2582 exit if none of the characters scanned was an exact match.
2583 Fixes vertical-motion and pos-visible-in-window-p under bidi redisplay
2584 when exact match is impossible due to invisible text, and the
2585 lines are truncated.
2586
2587 2011-07-23 Jan Djärv <jan.h.d@swipnet.se>
2588
2589 * nsterm.m (initFrameFromEmacs): Set NSTitledWindowMask in styleMask
2590 for OSX >= 10.7.
2591
2592 2011-07-22 Eli Zaretskii <eliz@gnu.org>
2593
2594 Fix a significant slow-down of cursor motion with C-n, C-p,
2595 C-f/C-b, and C-v/M-v that couldn't keep up with keyboard
2596 auto-repeat under bidi redisplay in fontified buffers.
2597 * xdisp.c (compute_stop_pos_backwards): New function.
2598 (next_element_from_buffer): Call compute_stop_pos_backwards to
2599 find a suitable prev_stop when we find ourselves before
2600 base_level_stop.
2601 (reseat): Don't look for prev_stop, as that could mean a very long
2602 run.
2603 <cached_disp_pos, cached_disp_buffer, cached_disp_modiff>
2604 <cached_disp_overlay_modiff>: Cache for last found display string
2605 position.
2606 (compute_display_string_pos): Return the cached position if asked
2607 about the same buffer in the same area of character positions, and
2608 the buffer wasn't changed since the time the display string
2609 position was cached.
2610
2611 2011-07-22 Eli Zaretskii <eliz@gnu.org>
2612
2613 * xdisp.c (rows_from_pos_range): Don't ignore glyphs whose object
2614 is an integer, which is important for empty lines. (Bug#9149)
2615
2616 2011-07-22 Chong Yidong <cyd@stupidchicken.com>
2617
2618 * frame.c (Fmodify_frame_parameters): In tty case, update the
2619 default face if necessary (Bug#4238).
2620
2621 2011-07-21 Chong Yidong <cyd@stupidchicken.com>
2622
2623 * editfns.c (Fstring_to_char): No need to explain what a character
2624 is in the docstring (Bug#6576).
2625
2626 2011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
2627
2628 * xml.c (parse_region): Make sure we always return a tree.
2629
2630 2011-07-20 HAMANO Kiyoto <khiker.mail@gmail.com>
2631
2632 * xml.c (parse_region): If a document contains only comments,
2633 return that, too.
2634
2635 2011-07-20 Lars Magne Ingebrigtsen <larsi@gnus.org>
2636
2637 * xml.c (make_dom): Return comments, too.
2638
2639 2011-07-19 Paul Eggert <eggert@cs.ucla.edu>
2640
2641 Port to OpenBSD.
2642 See http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00688.html
2643 and the surrounding thread.
2644 * minibuf.c (read_minibuf_noninteractive): Rewrite to use getchar
2645 rather than fgets, and retry after EINTR. Otherwise, 'emacs
2646 --batch -f byte-compile-file' fails on OpenBSD if an inactivity
2647 timer goes off.
2648 * s/openbsd.h (BROKEN_SIGIO): Define.
2649 * unexelf.c (unexec) [__OpenBSD__]:
2650 Don't update the .mdebug section of the Alpha COFF symbol table.
2651
2652 2011-07-19 Lars Magne Ingebrigtsen <larsi@gnus.org>
2653
2654 * lread.c (syms_of_lread): Clarify when `lexical-binding' is used
2655 (bug#8460).
2656
2657 2011-07-18 Paul Eggert <eggert@cs.ucla.edu>
2658
2659 * fileio.c (Fcopy_file) [!MSDOS]: Tighten created file's mask.
2660 This fixes some race conditions on the permissions of any newly
2661 created file.
2662
2663 * alloc.c (valid_pointer_p): Use pipe, not open.
2664 This fixes some permissions issues when debugging.
2665
2666 * fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002)
2667 If fchown fails to set both uid and gid, try to set just gid,
2668 as that is sometimes allowed. Adjust the file's mode to eliminate
2669 setuid or setgid bits that are inappropriate if fchown fails.
2670
2671 2011-07-18 Stefan Monnier <monnier@iro.umontreal.ca>
2672
2673 * xdisp.c (next_element_from_string, next_element_from_buffer): Use EQ
2674 to compare Lisp_Objects.
2675 * gnutls.c (syms_of_gnutls): Rename Vgnutls_log_level to
2676 global_gnutls_log_level, don't mistake it for a Lisp_Object.
2677 (init_gnutls_functions, emacs_gnutls_handle_error): Fix up uses.
2678
2679 2011-07-17 Andreas Schwab <schwab@linux-m68k.org>
2680
2681 * lread.c (read_integer): Unread even EOF character.
2682 (read1): Likewise. Properly record start position of symbol.
2683
2684 * lread.c (read1): Read `#:' as empty uninterned symbol if no
2685 symbol character follows.
2686
2687 2011-07-17 Paul Eggert <eggert@cs.ucla.edu>
2688
2689 * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002)
2690 This works around a problem with the previous change to Fcopy_file.
2691 Recent glibc declares fchown with __attribute__((warn_unused_result)),
2692 and without this change, GCC might complain about discarding
2693 fchown's return value.
2694
2695 2011-07-16 Juanma Barranquero <lekktu@gmail.com>
2696
2697 * makefile.w32-in (GLOBAL_SOURCES): Add gnutls.c (followup to bug#9059).
2698
2699 2011-07-16 Paul Eggert <eggert@cs.ucla.edu>
2700
2701 * fileio.c (Fcopy_file): Don't diagnose fchown failures. (Bug#9002)
2702
2703 2011-07-16 Lars Magne Ingebrigtsen <larsi@gnus.org>
2704
2705 * gnutls.c (syms_of_gnutls): Define `gnutls-log-level' here, since
2706 it's used from the C level.
2707
2708 * process.c: Use the same condition for POLL_FOR_INPUT in both
2709 keyboard.c and process.c (bug#1858).
2710
2711 2011-07-09 Lawrence Mitchell <wence@gmx.li>
2712
2713 * gnutls.c (Qgnutls_bootprop_min_prime_bits): New variable.
2714 (Fgnutls_boot): Use it.
2715
2716 2011-07-15 Andreas Schwab <schwab@linux-m68k.org>
2717
2718 * doc.c (Fsubstitute_command_keys): Revert last change.
2719
2720 2011-07-15 Lars Magne Ingebrigtsen <larsi@gnus.org>
2721
2722 * doc.c (Fsubstitute_command_keys): Clarify that \= really only
2723 quotes the next character, and doesn't affect other longer
2724 sequences (bug#8935).
2725
2726 * lread.c (syms_of_lread): Clarify that is isn't only
2727 `eval-buffer' and `eval-defun' that's affected by
2728 `lexical-binding' (bug#8460).
2729
2730 2011-07-15 Eli Zaretskii <eliz@gnu.org>
2731
2732 * xdisp.c (move_it_in_display_line_to): Fix vertical motion with
2733 bidi redisplay when a line includes both an image and is
2734 truncated.
2735
2736 2011-07-14 Paul Eggert <eggert@cs.ucla.edu>
2737
2738 Fix minor problems found by static checking.
2739 * bidi.c (bidi_cache_size): Now EMACS_INT, not size_t.
2740 (elsz): Now a signed constant, not a size_t var. We prefer signed
2741 types to unsigned, to avoid integer comparison confusion. Without
2742 this change, GCC 4.6.1 with -Wunsafe-loop-optimizations complains
2743 "cannot optimize loop, the loop counter may overflow", a symptom
2744 of the confusion.
2745 * indent.c (Fvertical_motion): Mark locals as initialized.
2746 * xdisp.c (reseat_to_string): Fix pointer signedness issue.
2747
2748 2011-07-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
2749
2750 * search.c (Fre_search_backward): Mention `case-fold-search' in
2751 all the re_search_* functions (bug#8138).
2752
2753 * keyboard.c (Fopen_dribble_file): Document when the file is
2754 closed (bug#8056).
2755
2756 2011-07-14 Eli Zaretskii <eliz@gnu.org>
2757
2758 * bidi.c (bidi_dump_cached_states): Fix format of displaying
2759 bidi_cache_idx.
2760
2761 Support bidi reordering of display and overlay strings.
2762 * xdisp.c (compute_display_string_pos)
2763 (compute_display_string_end): Accept additional argument STRING.
2764 (init_iterator, reseat_1): Initialize bidi_it->string.s to NULL.
2765 (reseat_to_string): Initialize bidi_it->string.s and
2766 bidi_it->string.schars.
2767 (Fcurrent_bidi_paragraph_direction): Initialize itb.string.s to
2768 NULL (avoids a crash in bidi_paragraph_init).
2769 Initialize itb.string.lstring.
2770 (init_iterator): Call bidi_init_it only of a valid
2771 buffer position was specified. Initialize paragraph_embedding to
2772 L2R.
2773 (reseat_to_string): Initialize the bidi iterator.
2774 (display_string): If we need to ignore text properties of
2775 LISP_STRING, set IT->stop_charpos to IT->end_charpos. (The
2776 original value of -1 will not work with bidi.)
2777 (compute_display_string_pos): First arg is now struct
2778 `text_pos *'; all callers changed. Support display properties on
2779 Lisp strings.
2780 (compute_display_string_end): Support display properties on Lisp
2781 strings.
2782 (init_iterator, reseat_1, reseat_to_string): Initialize the
2783 string.bufpos member to 0 (zero, for compatibility with IT_CHARPOS
2784 when iterating on a string not from display properties).
2785 (compute_display_string_pos, compute_display_string_end):
2786 Fix calculation of the object to scan. Fixes an error when using
2787 arrow keys.
2788 (next_element_from_buffer): Don't abort when IT_CHARPOS is before
2789 base_level_stop; instead, set base_level_stop to BEGV.
2790 Fixes crashes in vertical-motion.
2791 (next_element_from_buffer): Improve commentary for when
2792 the iterator is before prev_stop.
2793 (init_iterator): Initialize bidi_p from the default value of
2794 bidi-display-reordering, not from buffer-local value. Use the
2795 buffer-local value only if initializing for buffer iteration.
2796 (handle_invisible_prop): Support invisible properties on strings
2797 that are being bidi-reordered.
2798 (set_iterator_to_next): Support bidi reordering of C strings and
2799 Lisp strings.
2800 (next_element_from_string): Support bidi reordering of Lisp
2801 strings.
2802 (handle_stop_backwards): Support Lisp strings as well.
2803 (display_string): Support display of R2L glyph rows.
2804 Use IT_STRING_CHARPOS when displaying from a Lisp string.
2805 (init_iterator): Don't initialize it->bidi_p for strings
2806 here.
2807 (reseat_to_string): Initialize it->bidi_p for strings here.
2808 (next_element_from_string, next_element_from_c_string)
2809 (next_element_from_buffer): Add xassert's for correspondence
2810 between IT's object being iterated and it->bidi_it.string
2811 structure.
2812 (face_before_or_after_it_pos): Support bidi iteration.
2813 (next_element_from_c_string): Handle the case of the first string
2814 character that is not the first one in the visual order.
2815 (get_visually_first_element): New function, refactored from common
2816 parts of next_element_from_buffer, next_element_from_string, and
2817 next_element_from_c_string.
2818 (tool_bar_lines_needed, redisplay_tool_bar)
2819 (display_menu_bar): Force left-to-right direction. Add a FIXME
2820 comment for making that be controlled by a user option.
2821 (push_it, pop_it): Save and restore the state of the
2822 bidi iterator. Save and restore the bidi_p flag.
2823 (pop_it): Iterate out of display property for string iteration as
2824 well.
2825 (iterate_out_of_display_property): Support iteration over strings.
2826 (handle_single_display_spec): Set up it->bidi_it for iteration
2827 over a display string, and call bidi_init_it.
2828 (handle_single_display_spec, next_overlay_string)
2829 (get_overlay_strings_1, push_display_prop): Set up the bidi
2830 iterator for displaying display or overlay strings.
2831 (forward_to_next_line_start): Don't use the shortcut if
2832 bidi-iterating.
2833 (back_to_previous_visible_line_start): If handle_display_prop
2834 pushed the iterator stack, restore the internal state of the bidi
2835 iterator by calling bidi_pop_it same number of times.
2836 (reseat_at_next_visible_line_start): If ON_NEWLINE_P is non-zero,
2837 and we are bidi-iterating, don't decrement the iterator position;
2838 instead, set the first_elt flag in the bidi iterator, to produce
2839 the same effect.
2840 (reseat_1): Remove redundant setting of string_from_display_prop_p.
2841 (push_display_prop): xassert that we are iterating a buffer.
2842 (push_it, pop_it): Save and restore paragraph_embedding member.
2843 (handle_single_display_spec, next_overlay_string)
2844 (get_overlay_strings_1, reseat_1, reseat_to_string)
2845 (push_display_prop): Set up the `unibyte' member of bidi_it.string
2846 correctly. Don't assume unibyte strings are not bidi-reordered.
2847 (compute_display_string_pos)
2848 (compute_display_string_end): Fix handling the case of C string.
2849 (push_it, pop_it): Save and restore from_disp_prop_p.
2850 (handle_single_display_spec, push_display_prop): Set the
2851 from_disp_prop_p flag.
2852 (get_overlay_strings_1): Reset the from_disp_prop_p flag.
2853 (pop_it): Call iterate_out_of_display_property only if we are
2854 popping after iteration over a string that came from a display
2855 property. Fix a typo in popping stretch info. Add an assertion
2856 for verifying that the iterator position is in sync with the bidi
2857 iterator.
2858 (handle_single_display_spec, get_overlay_strings_1)
2859 (push_display_prop): Fix initialization of paragraph direction for
2860 string when that of the parent object is not yet determined.
2861 (reseat_1): Call bidi_init_it to resync the bidi
2862 iterator with IT's position. (Bug#7616)
2863 (find_row_edges): If ROW->start.pos gives position
2864 smaller than min_pos, use it as ROW->minpos. (Bug#7616)
2865 (handle_stop, back_to_previous_visible_line_start, reseat_1):
2866 Reset the from_disp_prop_p flag.
2867 (SAVE_IT, RESTORE_IT): New macros.
2868 (pos_visible_p, face_before_or_after_it_pos)
2869 (back_to_previous_visible_line_start)
2870 (move_it_in_display_line_to, move_it_in_display_line)
2871 (move_it_to, move_it_vertically_backward, move_it_by_lines)
2872 (try_scrolling, redisplay_window, display_line): Use them when
2873 saving a temporary copy of the iterator and restoring it back.
2874 (back_to_previous_visible_line_start, reseat_1)
2875 (init_iterator): Empty the bidi cache "stack".
2876 (move_it_in_display_line_to): If iterator ended up at
2877 EOL, but we never saw any buffer positions smaller than
2878 to_charpos, return MOVE_POS_MATCH_OR_ZV. Fixes vertical cursor
2879 motion in bidi-reordered lines.
2880 (move_it_in_display_line_to): Record prev_method and prev_pos
2881 immediately before the call to set_iterator_to_next. Fixes cursor
2882 motion in bidi-reordered lines with stretch glyphs and strings
2883 displayed in margins. (Bug#8133) (Bug#8867)
2884 Return MOVE_POS_MATCH_OR_ZV only if iterator position is past
2885 TO_CHARPOS.
2886 (pos_visible_p): Support positions in bidi-reordered lines.
2887 Save and restore bidi cache.
2888
2889 * bidi.c (bidi_level_of_next_char): clen should be EMACS_NT, not int.
2890 (bidi_paragraph_info): Delete unused struct.
2891 (bidi_cache_idx, bidi_cache_last_idx): Declare EMACS_INT.
2892 (bidi_cache_start): New variable.
2893 (bidi_cache_reset): Reset bidi_cache_idx to bidi_cache_start, not
2894 to zero.
2895 (bidi_cache_fetch_state, bidi_cache_search)
2896 (bidi_cache_find_level_change, bidi_cache_iterator_state)
2897 (bidi_cache_find, bidi_peek_at_next_level)
2898 (bidi_level_of_next_char, bidi_find_other_level_edge)
2899 (bidi_move_to_visually_next): Compare cache index with
2900 bidi_cache_start rather than with zero.
2901 (bidi_fetch_char): Accept new argument STRING; all callers
2902 changed. Support iteration over a string. Support strings with
2903 display properties. Support unibyte strings. Fix the type of
2904 `len' according to what STRING_CHAR_AND_LENGTH expects.
2905 (bidi_paragraph_init, bidi_resolve_explicit_1)
2906 (bidi_resolve_explicit, bidi_resolve_weak)
2907 (bidi_level_of_next_char, bidi_move_to_visually_next):
2908 Support iteration over a string.
2909 (bidi_set_sor_type, bidi_resolve_explicit_1)
2910 (bidi_resolve_explicit, bidi_type_of_next_char): ignore_bn_limit
2911 can now be zero (for strings); special values 0 and -1 were
2912 changed to -1 and -2, respectively.
2913 (bidi_char_at_pos): New function.
2914 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak):
2915 Call it instead of FETCH_MULTIBYTE_CHAR.
2916 (bidi_move_to_visually_next): Abort if charpos or bytepos were not
2917 initialized to valid values.
2918 (bidi_init_it): Don't initialize charpos and bytepos with invalid
2919 values.
2920 (bidi_level_of_next_char): Allow the sentinel "position" to pass
2921 the test for valid cached positions. Fix the logic for looking up
2922 the sentinel state in the cache. GCPRO the Lisp string we are
2923 iterating.
2924 (bidi_push_it, bidi_pop_it): New functions.
2925 (bidi_initialize): Initialize the bidi cache start stack pointer.
2926 (bidi_cache_ensure_space): New function, refactored from part of
2927 bidi_cache_iterator_state. Don't assume the required size is just
2928 one BIDI_CACHE_CHUNK away.
2929 (bidi_cache_start_stack, bidi_push_it): Use IT_STACK_SIZE.
2930 (bidi_count_bytes, bidi_char_at_pos): New functions.
2931 (bidi_cache_search): Don't assume bidi_cache_last_idx is
2932 always valid if bidi_cache_idx is valid.
2933 (bidi_cache_find_level_change): xassert that bidi_cache_last_idx
2934 is valid if it's going to be used.
2935 (bidi_shelve_cache, bidi_unshelve_cache): New functions.
2936 (bidi_cache_fetch_state, bidi_cache_search)
2937 (bidi_cache_find_level_change, bidi_cache_ensure_space)
2938 (bidi_cache_iterator_state, bidi_cache_find)
2939 (bidi_find_other_level_edge, bidi_cache_start_stack):
2940 All variables related to cache indices are now EMACS_INT.
2941
2942 * dispextern.h (struct bidi_string_data): New structure.
2943 (struct bidi_it): New member `string'. Make flag members be 1-bit
2944 fields, and put them last in the struct.
2945 (compute_display_string_pos, compute_display_string_end):
2946 Update prototypes.
2947 (bidi_push_it, bidi_pop_it): Add prototypes.
2948 (struct iterator_stack_entry): New members bidi_p,
2949 paragraph_embedding, and from_disp_prop_p.
2950 (struct it): Member bidi_p is now a bit field 1 bit wide.
2951 (bidi_shelve_cache, bidi_unshelve_cache):
2952 Declare prototypes.
2953
2954 * .gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector)
2955 (xpr, xfont, xbacktrace): Use "header.size" when accessing vectors
2956 and vector-like objects.
2957
2958 * dispnew.c (buffer_posn_from_coords): Save and restore the bidi
2959 cache around display iteration.
2960
2961 * window.c (Fwindow_end, window_scroll_pixel_based)
2962 (displayed_window_lines, Frecenter): Save and restore the bidi
2963 cache around display iteration.
2964
2965 2011-07-14 Lars Magne Ingebrigtsen <larsi@gnus.org>
2966
2967 * editfns.c (Fdelete_region): Clarify the use of the named
2968 parameters (bug#6788).
2969
2970 2011-07-14 Martin Rudalics <rudalics@gmx.at>
2971
2972 * indent.c (Fvertical_motion): Set and restore w->pointm when
2973 saving and restoring the window's buffer (Bug#9006).
2974
2975 2011-07-13 Lars Magne Ingebrigtsen <larsi@gnus.org>
2976
2977 * editfns.c (Fstring_to_char): Clarify just what is returned
2978 (bug#6576). Text by Eli Zaretskii.
2979
2980 2011-07-13 Juanma Barranquero <lekktu@gmail.com>
2981
2982 * gnutls.c (init_gnutls_functions): Honor gnutls_log_level (bug#9059).
2983
2984 2011-07-13 Eli Zaretskii <eliz@gnu.org>
2985
2986 * buffer.c (mmap_find): Fix a typo.
2987
2988 2011-07-13 Johan Bockgård <bojohan@gnu.org>
2989
2990 Fix execution of x selection hooks.
2991 * xselect.c (Qx_lost_selection_functions)
2992 (Qx_sent_selection_functions): New vars.
2993 (syms_of_xselect): DEFSYM them.
2994 (x_handle_selection_request): Pass Qx_sent_selection_functions
2995 rather than Vx_sent_selection_functions to Frun_hook_with_args.
2996 (x_handle_selection_clear,x_clear_frame_selections):
2997 Pass Qx_lost_selection_functions rather than
2998 Vx_lost_selection_functions to Frun_hook_with_args.
2999
3000 2011-07-13 Paul Eggert <eggert@cs.ucla.edu>
3001
3002 * buffer.c (Fget_buffer_create): Initialize inhibit_shrinking.
3003 The old code sometimes used this field without initializing it.
3004
3005 * alloc.c (gc_sweep): Don't read past end of array.
3006 In theory, the old code could also have corrupted Emacs internals,
3007 though it'd be very unlikely.
3008
3009 2011-07-12 Andreas Schwab <schwab@linux-m68k.org>
3010
3011 * character.c (Fcharacterp): Don't advertise optional ignored
3012 argument. (Bug#4026)
3013
3014 2011-07-12 Lars Magne Ingebrigtsen <larsi@gnus.org>
3015
3016 * keymap.c (syms_of_keymap): Clarify that "modifier" is "modifier
3017 key" (bug#4257).
3018
3019 * window.c (Fset_window_start): Doc fix (bug#4199).
3020 (Fset_window_hscroll): Ditto.
3021
3022 2011-07-12 Paul Eggert <eggert@cs.ucla.edu>
3023
3024 Fix minor new problems caught by GCC 4.6.1.
3025 * term.c (init_tty): Remove unused local.
3026 * xsettings.c (store_monospaced_changed): Define this function only
3027 if (defined HAVE_GSETTINGS || defined HAVE_GCONF), as it's
3028 not used otherwise.
3029
3030 2011-07-12 Chong Yidong <cyd@stupidchicken.com>
3031
3032 * xdisp.c (Vresize_mini_windows): Minor doc fix (Bug#3300).
3033
3034 2011-07-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
3035
3036 * xdisp.c (syms_of_xdisp): Make it explicit that the mini-windows
3037 are the mini-buffer and the echo area (bug#3320).
3038
3039 * term.c (init_tty): Remove support for supdup, c10 and perq
3040 terminals, which are no longer supported (bug#1482).
3041
3042 2011-07-10 Johan Bockgård <bojohan@gnu.org>
3043
3044 * xdisp.c (Ftool_bar_lines_needed): Fix WINDOWP check.
3045
3046 2011-07-10 Jan Djärv <jan.h.d@swipnet.se>
3047
3048 * xmenu.c (menu_highlight_callback): Only pass frame to show_help_event
3049 for non-popups (Bug#3642).
3050
3051 2011-07-10 Andreas Schwab <schwab@linux-m68k.org>
3052
3053 * alloc.c (reset_malloc_hooks): Protoize.
3054 * buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge)
3055 (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Likewise.
3056 * cm.c (losecursor): Likewise.
3057 * data.c (fmod): Likewise.
3058 * dispnew.c (swap_glyphs_in_rows): Likewise.
3059 * emacs.c (memory_warning_signal): Likewise.
3060 * floatfns.c (float_error): Likewise.
3061 * font.c (check_gstring, check_otf_features, otf_tag_symbol)
3062 (otf_open, font_otf_capability, generate_otf_features)
3063 (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor):
3064 Likewise.
3065 * image.c (pbm_read_file): Likewise.
3066 * indent.c (string_display_width): Likewise.
3067 * intervals.c (check_for_interval, search_for_interval)
3068 (inc_interval_count, count_intervals, root_interval)
3069 (adjust_intervals_for_insertion, make_new_interval): Likewise.
3070 * lread.c (defalias): Likewise.
3071 * ralloc.c (r_alloc_check): Likewise.
3072 * regex.c (set_image_of_range_1, set_image_of_range)
3073 (regex_grow_registers): Likewise.
3074 * sysdep.c (strerror): Likewise.
3075 * termcap.c (valid_filename_p, tprint, main): Likewise.
3076 * tparam.c (main): Likewise.
3077 * unexhp9k800.c (run_time_remap, save_data_space)
3078 (update_file_ptrs, read_header, write_header, calculate_checksum)
3079 (copy_file, copy_rest, display_header): Likewise.
3080 * widget.c (mark_shell_size_user_specified, create_frame_gcs):
3081 Likewise.
3082 * xdisp.c (check_it): Likewise.
3083 * xfaces.c (register_color, unregister_color, unregister_colors):
3084 Likewise.
3085 * xfns.c (print_fontset_result): Likewise.
3086 * xrdb.c (member, fatal, main): Likewise.
3087
3088 2011-07-10 Paul Eggert <eggert@cs.ucla.edu>
3089
3090 Fix minor problems found by static checking (Bug#9031).
3091 * chartab.c (char_table_set_range, map_sub_char_table):
3092 Remove unused locals.
3093 (uniprop_table): Now static.
3094 * composite.c (_work_char): Remove unused static var.
3095
3096 2011-07-09 Juanma Barranquero <lekktu@gmail.com>
3097
3098 * chartab.c (uniprop_table_uncompress): Remove unused local variable.
3099
3100 2011-07-09 Jan Djärv <jan.h.d@swipnet.se>
3101
3102 * gtkutil.c (qttip_cb): Remove code without function.
3103
3104 2011-07-09 Eli Zaretskii <eliz@gnu.org>
3105
3106 * w32.c (pthread_sigmask): New stub.
3107
3108 2011-07-08 Paul Eggert <eggert@cs.ucla.edu>
3109
3110 Use pthread_sigmask, not sigprocmask (Bug#9010).
3111 sigprocmask is portable only for single-threaded applications, and
3112 Emacs can be multi-threaded when it uses GTK.
3113 * Makefile.in (LIB_PTHREAD_SIGMASK): New macro.
3114 (LIBES): Use it.
3115 * callproc.c (Fcall_process):
3116 * process.c (create_process):
3117 * sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask):
3118 Use pthread_sigmask, not sigprocmask.
3119
3120 2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
3121
3122 * gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget.
3123 (xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was
3124 wrong (Bug#8591).
3125
3126 2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
3127
3128 * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment.
3129 Put text in x->ttip_lbl instead of gtk_tooltip_set_text (Bug#8591).
3130 (xg_hide_tooltip): Fix comment.
3131
3132 * nsterm.m (initFrameFromEmacs): Don't use ns_return_types
3133 in registerServicesMenuSendTypes.
3134 (validRequestorForSendType): Don't check ns_return_types.
3135
3136 * nsfns.m (Fx_open_connection): Put NSStringPboardType into
3137 ns_return_type.
3138
3139 2011-07-08 Jason Rumney <jasonr@gnu.org>
3140
3141 * w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using
3142 frame struct members of non-existent frames (Bug#6284).
3143
3144 2011-07-08 Jan Djärv <jan.h.d@swipnet.se>
3145
3146 * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and
3147 variable firstTime not needed on OSX >= 10.6.
3148 (setPosition): setFloatValue:knobProportion: is deprecated on OSX
3149 >= 10.5. Use setKnobProportion, setDoubleValue.
3150
3151 * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4)
3152 (MAC_OS_X_VERSION_10_5): Define if not defined.
3153 (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6.
3154 (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6.
3155 (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6.
3156
3157 * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods
3158 cString and lossyCString on OSX >= 10.4
3159
3160 * nsmenu.m (fillWithWidgetValue): Don't use depercated method
3161 sizeToFit on OSX >= 10.2.
3162
3163 * nsimage.m (allocInitFromFile): Don't use deprecated method
3164 bestRepresentationForDevice on OSX >= 10.6.
3165
3166 * nsfns.m (check_ns_display_info): Cast to long and use %ld in error
3167 to avoid warning.
3168
3169 * emacs.c: Declare unexec_init_emacs_zone.
3170
3171 * nsgui.h: Fix compiler warning about gnulib redefining verify.
3172
3173 * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842).
3174
3175 * nsmenu.m (ns_update_menubar): Remove useless setDelegate call
3176 on svcsMenu (Bug#8842).
3177
3178 * nsfns.m (Fx_open_connection): Remove NSStringPboardType from
3179 ns_return_types.
3180 (Fns_list_services): Just return Qnil on 10.6, code not working there.
3181
3182 * nsterm.m (QUTF8_STRING): Declare.
3183 (initFrameFromEmacs): Call registerServicesMenuSendTypes.
3184 (validRequestorForSendType): Return type is (id).
3185 Change indexOfObjectIdenticalTo to indexOfObject.
3186 Check if we have local selection before returning self (Bug#8842).
3187 (writeSelectionToPasteboard): Put local selection into paste board
3188 if we have a local selection (Bug#8842).
3189 (syms_of_nsterm): DEFSYM QUTF8_STRING.
3190
3191 * nsterm.h (MAC_OS_X_VERSION_10_6): Define here instead of nsterm.m.
3192 (ns_get_local_selection): Declare.
3193
3194 2011-07-07 Lars Magne Ingebrigtsen <larsi@gnus.org>
3195
3196 * keymap.c (describe_map_tree): Don't insert a double newline at
3197 the end of the buffer (bug#1169) and return whether we inserted
3198 something.
3199
3200 * callint.c (Fcall_interactively): Change "reading args" to
3201 "providing args" to try to clarify what it does (bug#1010).
3202
3203 2011-07-07 Kenichi Handa <handa@m17n.org>
3204
3205 * composite.c (composition_compute_stop_pos): Ignore a static
3206 composition starting before CHARPOS (Bug#8915).
3207
3208 * xdisp.c (handle_composition_prop): Likewise.
3209
3210 2011-07-07 Eli Zaretskii <eliz@gnu.org>
3211
3212 * term.c (produce_glyphs) <xassert>: Allow IT_GLYPHLESS in it->what.
3213 (Bug#9015)
3214
3215 2011-07-07 Kenichi Handa <handa@m17n.org>
3216
3217 * character.h (unicode_category_t): New enum type.
3218
3219 * chartab.c (uniprop_decoder_t, uniprop_encoder_t): New types.
3220 (Qchar_code_property_table): New variable.
3221 (UNIPROP_TABLE_P, UNIPROP_GET_DECODER)
3222 (UNIPROP_COMPRESSED_FORM_P): New macros.
3223 (char_table_ascii): Uncompress the compressed values.
3224 (sub_char_table_ref): New arg is_uniprop. Callers changed.
3225 Uncompress the compressed values.
3226 (sub_char_table_ref_and_range): Likewise.
3227 (char_table_ref_and_range): Uncompress the compressed values.
3228 (sub_char_table_set): New arg is_uniprop. Callers changed.
3229 Uncompress the compressed values.
3230 (sub_char_table_set_range): Args changed. Callers changed.
3231 (char_table_set_range): Adjuted for the above change.
3232 (map_sub_char_table): Delete args default_val and parent. Add arg
3233 top. Give decoded values to a Lisp function.
3234 (map_char_table): Adjust for the above change. Give decoded
3235 values to a Lisp function. Gcpro more variables.
3236 (uniprop_table_uncompress)
3237 (uniprop_decode_value_run_length): New functions.
3238 (uniprop_decoder, uniprop_decoder_count): New variables.
3239 (uniprop_get_decoder, uniprop_encode_value_character)
3240 (uniprop_encode_value_run_length, uniprop_encode_value_numeric):
3241 New functions.
3242 (uniprop_encoder, uniprop_encoder_count): New variables.
3243 (uniprop_get_encoder, uniprop_table)
3244 (Funicode_property_table_internal, Fget_unicode_property_internal)
3245 (Fput_unicode_property_internal): New functions.
3246 (syms_of_chartab): DEFSYM Qchar_code_property_table, defsubr
3247 Sunicode_property_table_internal, Sget_unicode_property_internal,
3248 and Sput_unicode_property_internal. Defvar_lisp
3249 char-code-property-alist.
3250
3251 * composite.c (CHAR_COMPOSABLE_P): Adjust for the change of
3252 Vunicode_category_table.
3253
3254 * font.c (font_range): Adjust for the change of
3255 Vunicode_category_table.
3256
3257 2011-07-07 Dan Nicolaescu <dann@ics.uci.edu>
3258
3259 * m/iris4d.h: Remove file, move contents ...
3260 * s/irix6-5.h: ... here.
3261
3262 2011-07-06 Paul Eggert <eggert@cs.ucla.edu>
3263
3264 Remove unportable assumption about struct layout (Bug#8884).
3265 * alloc.c (mark_buffer):
3266 * buffer.c (reset_buffer_local_variables, Fbuffer_local_variables)
3267 (clone_per_buffer_values): Don't assume that
3268 sizeof (struct buffer) is a multiple of sizeof (Lisp_Object).
3269 This isn't true in general, and it's particularly not true
3270 if Emacs is configured with --with-wide-int.
3271 * buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER):
3272 New macros, used in the buffer.c change.
3273
3274 2011-07-05 Jan Djärv <jan.h.d@swipnet.se>
3275
3276 * xsettings.c: Use both GConf and GSettings if both are available.
3277 (store_config_changed_event): Add comment.
3278 (dpyinfo_valid, store_font_name_changed, map_tool_bar_style)
3279 (store_tool_bar_style_changed): New functions.
3280 (store_monospaced_changed): Add comment. Call dpyinfo_valid.
3281 (struct xsettings): Move font inside HAVE_XFT.
3282 (GSETTINGS_TOOL_BAR_STYLE, GSETTINGS_FONT_NAME): New defines.
3283 (GSETTINGS_MONO_FONT): Rename from SYSTEM_MONO_FONT.
3284 Move inside HAVE_XFT.
3285 (something_changed_gsettingsCB): Rename from something_changedCB.
3286 Check for changes in GSETTINGS_TOOL_BAR_STYLE and GSETTINGS_FONT_NAME
3287 also.
3288 (GCONF_TOOL_BAR_STYLE, GCONF_FONT_NAME): New defines.
3289 (GCONF_MONO_FONT): Rename from SYSTEM_MONO_FONT. Move inside HAVE_XFT.
3290 (something_changed_gconfCB): Rename from something_changedCB.
3291 Check for changes in GCONF_TOOL_BAR_STYLE and GCONF_FONT_NAME also.
3292 (parse_settings): Move check for font inside HAVE_XFT.
3293 (read_settings, apply_xft_settings): Add comment.
3294 (read_and_apply_settings): Add comment. Call map_tool_bar_style and
3295 store_tool_bar_style_changed. Move check for font inside HAVE_XFT and
3296 call store_font_name_changed.
3297 (xft_settings_event): Add comment.
3298 (init_gsettings): Add comment. Get values for GSETTINGS_TOOL_BAR_STYLE
3299 and GSETTINGS_FONT_NAME. Move check for fonts within HAVE_XFT.
3300 (init_gconf): Add comment. Get values for GCONF_TOOL_BAR_STYLE
3301 and GCONF_FONT_NAME. Move check for fonts within HAVE_XFT.
3302 (xsettings_initialize): Call init_gsettings last.
3303 (xsettings_get_system_font, xsettings_get_system_normal_font):
3304 Add comment.
3305
3306 2011-07-05 Paul Eggert <eggert@cs.ucla.edu>
3307
3308 Random fixes. E.g., (random) never returned negative values.
3309 * fns.c (Frandom): Use GET_EMACS_TIME for random seed, and add the
3310 subseconds part to the entropy, as that's a bit more random.
3311 Prefer signed to unsigned, since the signedness doesn't matter and
3312 in general we prefer signed. When given a limit, use a
3313 denominator equal to INTMASK + 1, not to VALMASK + 1, because the
3314 latter isn't right if USE_2_TAGS_FOR_INTS.
3315 * sysdep.c (get_random): Return a value in the range 0..INTMASK,
3316 not 0..VALMASK. Don't discard "excess" bits that random () returns.
3317
3318 2011-07-04 Stefan Monnier <monnier@iro.umontreal.ca>
3319
3320 * textprop.c (text_property_stickiness):
3321 Obey Vtext_property_default_nonsticky.
3322 (syms_of_textprop): Add `display' to Vtext_property_default_nonsticky.
3323 * w32fns.c (syms_of_w32fns):
3324 * xfns.c (syms_of_xfns): Don't Add `display' since it's there by default.
3325
3326 2011-07-04 Paul Eggert <eggert@cs.ucla.edu>
3327
3328 * fileio.c (barf_or_query_if_file_exists): Use S_ISDIR.
3329 This is more efficient than Ffile_directory_p and avoids a minor race.
3330
3331 2011-07-04 Lars Magne Ingebrigtsen <larsi@gnus.org>
3332
3333 * buffer.c (Foverlay_put): Say what the return value is
3334 (bug#7835).
3335
3336 * fileio.c (barf_or_query_if_file_exists): Check first if the file
3337 is a directory before asking whether to use the file name
3338 (bug#7564).
3339 (barf_or_query_if_file_exists): Make the "File is a directory"
3340 error be more correct.
3341
3342 * fns.c (Frequire): Remove the mention of the .gz files, since
3343 that's installation-specific, but keep the mention of
3344 `get-load-suffixes'.
3345
3346 2011-07-04 Paul Eggert <eggert@cs.ucla.edu>
3347
3348 * editfns.c (Fformat_time_string): Don't assume strlen fits in int.
3349 Report string overflow if the output is too long.
3350
3351 2011-07-04 Juanma Barranquero <lekktu@gmail.com>
3352
3353 * gnutls.c (Fgnutls_boot): Don't mention :verify-error.
3354 (syms_of_gnutls): Remove duplicate DEFSYM for
3355 Qgnutls_bootprop_verify_hostname_error, an error for
3356 Qgnutls_bootprop_verify_error (which is no longer used).
3357
3358 * eval.c (find_handler_clause): Remove parameters `sig' and `data',
3359 unused since 2011-01-26T20:02:07Z!monnier@iro.umontreal.ca. All callers changed.
3360 Also (re)move comments that are misplaced or no longer relevant.
3361
3362 2011-07-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
3363
3364 * callint.c (Finteractive): Clarify the meaning of "@" (bug#8813).
3365
3366 2011-07-03 Chong Yidong <cyd@stupidchicken.com>
3367
3368 * xfaces.c (Finternal_merge_in_global_face): Modify the foreground
3369 and background color parameters if they have been changed.
3370
3371 2011-07-03 Lars Magne Ingebrigtsen <larsi@gnus.org>
3372
3373 * editfns.c (Fformat): Clarify the - and 0 flags (bug#6659).
3374
3375 2011-07-03 Paul Eggert <eggert@cs.ucla.edu>
3376
3377 * xsettings.c (SYSTEM_FONT): Define only when used.
3378 No need to define when HAVE_GSETTINGS || !HAVE_XFT.
3379
3380 * keymap.c (access_keymap_1): Now static.
3381
3382 2011-07-02 Chong Yidong <cyd@stupidchicken.com>
3383
3384 * keyboard.c (command_loop_1): If a down-mouse event is unbound,
3385 leave any prefix arg for the up event (Bug#1586).
3386
3387 2011-07-02 Lars Magne Ingebrigtsen <larsi@gnus.org>
3388
3389 * lread.c (syms_of_lread): Mention single symbols defined by
3390 `defvar' or `defconst' (bug#7154).
3391
3392 * fns.c (Frequire): Mention .el.gz files (bug#7314).
3393 (Frequire): Mention get-load-suffixes.
3394
3395 2011-07-02 Martin Rudalics <rudalics@gmx.at>
3396
3397 * window.h (window): Remove clone_number slot.
3398 * window.c (Fwindow_clone_number, Fset_window_clone_number):
3399 Remove.
3400 (make_parent_window, make_window, saved_window)
3401 (Fset_window_configuration, save_window_save): Don't deal with
3402 clone numbers.
3403 * buffer.c (Qclone_number): Remove declaration.
3404 (sort_overlays, overlay_strings): Don't deal with clone numbers.
3405
3406 2011-07-02 Stefan Monnier <monnier@iro.umontreal.ca>
3407
3408 Add multiple inheritance to keymaps.
3409 * keymap.c (Fmake_composed_keymap): New function.
3410 (Fset_keymap_parent): Simplify.
3411 (fix_submap_inheritance): Remove.
3412 (access_keymap_1): New function extracted from access_keymap to handle
3413 embedded parents and handle lists of maps.
3414 (access_keymap): Use it.
3415 (Fkeymap_prompt, map_keymap_internal, map_keymap, store_in_keymap)
3416 (Fcopy_keymap): Handle embedded parents.
3417 (Fcommand_remapping, define_as_prefix): Simplify.
3418 (Fkey_binding): Simplify.
3419 (syms_of_keymap): Move minibuffer-local-completion-map,
3420 minibuffer-local-filename-completion-map,
3421 minibuffer-local-must-match-map, and
3422 minibuffer-local-filename-must-match-map to Elisp.
3423 (syms_of_keymap): Defsubr make-composed-keymap.
3424 * keyboard.c (menu_bar_items): Use map_keymap_canonical.
3425 (parse_menu_item): Trivial simplification.
3426
3427 2011-07-01 Glenn Morris <rgm@gnu.org>
3428
3429 * Makefile.in (SETTINGS_LIBS): Fix typo.
3430
3431 2011-07-01 Kazuhiro Ito <kzhr@d1.dion.ne.jp> (tiny patch)
3432
3433 * coding.c (Fencode_coding_string): Record the last coding system
3434 used, as the function doc string says (bug#8738).
3435
3436 2011-07-01 Jan Djärv <jan.h.d@swipnet.se>
3437
3438 * xsettings.c (store_monospaced_changed): Take new font as arg and
3439 check for change against current_mono_font.
3440 (EMACS_TYPE_SETTINGS): Remove this and related defines.
3441 (emacs_settings_constructor, emacs_settings_get_property)
3442 (emacs_settings_set_property, emacs_settings_class_init)
3443 (emacs_settings_init, gsettings_obj): Remove.
3444 (something_changedCB): New function for HAVE_GSETTINGS.
3445 (something_changedCB): HAVE_GCONF: Call store_monospaced_changed
3446 with value as argument.
3447 (init_gsettings): Check that GSETTINGS_SCHEMA exists before calling
3448 g_settings_new (Bug#8967). Do not create gsettings_obj.
3449 Remove calls to g_settings_bind. Connect something_changedCB to
3450 "changed".
3451
3452 * xgselect.c: Add defined (HAVE_GSETTINGS).
3453 (xgselect_initialize): Ditto.
3454
3455 * process.c: Add defined (HAVE_GSETTINGS) for xgselect.h
3456 (wait_reading_process_output): Add defined (HAVE_GSETTINGS) for
3457 xg_select.
3458
3459 2011-07-01 Paul Eggert <eggert@cs.ucla.edu>
3460
3461 * eval.c (struct backtrace): Simplify and port the data structure.
3462 Do not assume that "int nargs : BITS_PER_INT - 2;" produces a
3463 signed bit field, as this assumption is not portable and it makes
3464 Emacs crash when compiled with Sun C 5.8 on sparc. Do not use
3465 "char debug_on_exit : 1" as this is not portable either; instead,
3466 use the portable "unsigned int debug_on_exit : 1". Remove unused
3467 member evalargs. Remove obsolete comments about cc bombing out.
3468
3469 2011-06-30 Jan Djärv <jan.h.d@swipnet.se>
3470
3471 * xsettings.c: Include glib-object.h, gio/gio.h if HAVE_GSETTINGS.
3472 Let HAVE_GSETTINGS override HAVE_GCONF.
3473 (store_monospaced_changed): New function.
3474 (EMACS_SETTINGS): A new type derived from GObject to handle
3475 GSettings notifications.
3476 (emacs_settings_constructor, emacs_settings_get_property)
3477 (emacs_settings_set_property, emacs_settings_class_init):
3478 New functions.
3479 (gsettings_client, gsettings_obj): New variables.
3480 (GSETTINGS_SCHEMA): New define.
3481 (something_changedCB): Call store_monospaced_changed.
3482 (init_gsettings): New function.
3483 (xsettings_initialize): Call init_gsettings.
3484 (syms_of_xsettings): Initialize gsettings_client, gsettings_obj
3485 to NULL.
3486
3487 * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Rename from
3488 GCONF_CFLAGS/LIBS.
3489
3490 2011-06-29 Martin Rudalics <rudalics@gmx.at>
3491
3492 * window.c (resize_root_window, grow_mini_window)
3493 (shrink_mini_window): Rename Qresize_root_window to
3494 Qwindow_resize_root_window and Qresize_root_window_vertically to
3495 Qwindow_resize_root_window_vertically.
3496
3497 2011-06-28 Paul Eggert <eggert@cs.ucla.edu>
3498
3499 * gnutls.c (Qgnutls_bootprop_verify_error): Remove unused var.
3500
3501 2011-06-27 Juanma Barranquero <lekktu@gmail.com>
3502
3503 * makefile.w32-in: Redesign dependencies so they reflect more
3504 clearly which files are directly included by each source file,
3505 and not through other includes.
3506
3507 2011-06-27 Martin Rudalics <rudalics@gmx.at>
3508
3509 * buffer.c (Qclone_number): Declare static and DEFSYM it.
3510 (sort_overlays, overlay_strings): When an overlay's clone number
3511 matches the window's clone number process the overlay even if
3512 the overlay's window property doesn't match the current window.
3513
3514 * window.c (Fwindow_vchild): Rename to Fwindow_top_child.
3515 (Fwindow_hchild): Rename to Fwindow_left_child.
3516 (Fwindow_next): Rename to Fwindow_next_sibling.
3517 (Fwindow_prev): Rename to Fwindow_prev_sibling.
3518 (resize_window_check): Rename to window_resize_check.
3519 (resize_window_apply): Rename to window_resize_apply.
3520 (Fresize_window_apply): Rename to Fwindow_resize_apply.
3521 (Fdelete_other_windows_internal, resize_frame_windows)
3522 (Fsplit_window_internal, Fdelete_window_internal)
3523 (grow_mini_window, shrink_mini_window)
3524 (Fresize_mini_window_internal): Fix callers accordingly.
3525
3526 2011-06-26 Jan Djärv <jan.h.d@swipnet.se>
3527
3528 * emacsgtkfixed.h: State that this is only used with Gtk+3.
3529 (emacs_fixed_set_min_size): Remove.
3530 (emacs_fixed_new): Take frame as argument.
3531
3532 * emacsgtkfixed.c: State that this is only used with Gtk+3.
3533 (_EmacsFixedPrivate): Remove minwidth/height.
3534 Add struct frame *f.
3535 (emacs_fixed_init): Initialize priv->f.
3536 (get_parent_class, emacs_fixed_set_min_size): Remove.
3537 (emacs_fixed_new): Set priv->f to argument.
3538 (emacs_fixed_get_preferred_width)
3539 (emacs_fixed_get_preferred_height): Use min_width/height from
3540 frames size_hint to set minimum and natural (Bug#8919).
3541 (XSetWMSizeHints, XSetWMNormalHints): Override these functions
3542 and use min_width/height from frames size_hint to set
3543 min_width/height (Bug#8919).
3544
3545 * gtkutil.c (xg_create_frame_widgets): Pass f to emacs_fixed_new.
3546 (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size.
3547 Fix indentation.
3548
3549 2011-06-26 Eli Zaretskii <eliz@gnu.org>
3550
3551 * bidi.c (bidi_paragraph_init): Test for ZV_BYTE before calling
3552 bidi_at_paragraph_end, since fast_looking_at doesn't like to be
3553 called at ZV.
3554
3555 2011-06-26 Chong Yidong <cyd@stupidchicken.com>
3556
3557 * process.c (wait_reading_process_output): Bypass select if
3558 waiting for a cell while ignoring keyboard input, and input is
3559 pending. Suggested by Jan Djärv (Bug#8869).
3560
3561 2011-06-25 Paul Eggert <eggert@cs.ucla.edu>
3562
3563 Use gnulib's dup2 module instead of rolling our own.
3564 * sysdep.c (dup2) [!HAVE_DUP2]: Remove; gnulib now does this.
3565
3566 2011-06-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
3567
3568 * dispnew.c (scrolling_window): Before scrolling, turn off a
3569 mouse-highlight in the window being scrolled.
3570
3571 2011-06-24 Juanma Barranquero <lekktu@gmail.com>
3572
3573 Move DEFSYM to lisp.h and use everywhere.
3574
3575 * character.h (DEFSYM): Move declaration...
3576 * lisp.h (DEFSYM): ...here.
3577
3578 * gnutls.c:
3579 * minibuf.c:
3580 * w32menu.c:
3581 * w32proc.c:
3582 * w32select.c: Don't include character.h.
3583
3584 * alloc.c (syms_of_alloc):
3585 * buffer.c (syms_of_buffer):
3586 * bytecode.c (syms_of_bytecode):
3587 * callint.c (syms_of_callint):
3588 * casefiddle.c (syms_of_casefiddle):
3589 * casetab.c (init_casetab_once):
3590 * category.c (init_category_once, syms_of_category):
3591 * ccl.c (syms_of_ccl):
3592 * cmds.c (syms_of_cmds):
3593 * composite.c (syms_of_composite):
3594 * dbusbind.c (syms_of_dbusbind):
3595 * dired.c (syms_of_dired):
3596 * dispnew.c (syms_of_display):
3597 * doc.c (syms_of_doc):
3598 * editfns.c (syms_of_editfns):
3599 * emacs.c (syms_of_emacs):
3600 * eval.c (syms_of_eval):
3601 * fileio.c (syms_of_fileio):
3602 * fns.c (syms_of_fns):
3603 * frame.c (syms_of_frame):
3604 * fringe.c (syms_of_fringe):
3605 * insdel.c (syms_of_insdel):
3606 * keymap.c (syms_of_keymap):
3607 * lread.c (init_obarray, syms_of_lread):
3608 * macros.c (syms_of_macros):
3609 * msdos.c (syms_of_msdos):
3610 * print.c (syms_of_print):
3611 * process.c (syms_of_process):
3612 * search.c (syms_of_search):
3613 * sound.c (syms_of_sound):
3614 * syntax.c (init_syntax_once, syms_of_syntax):
3615 * terminal.c (syms_of_terminal):
3616 * textprop.c (syms_of_textprop):
3617 * undo.c (syms_of_undo):
3618 * w32.c (globals_of_w32):
3619 * window.c (syms_of_window):
3620 * xdisp.c (syms_of_xdisp):
3621 * xfaces.c (syms_of_xfaces):
3622 * xfns.c (syms_of_xfns):
3623 * xmenu.c (syms_of_xmenu):
3624 * xsettings.c (syms_of_xsettings):
3625 * xterm.c (syms_of_xterm): Use DEFSYM.
3626
3627 2011-06-24 Teodor Zlatanov <tzz@lifelogs.com>
3628
3629 * gnutls.c (syms_of_gnutls): Use the DEFSYM macro from character.h.
3630
3631 2011-06-23 Paul Eggert <eggert@cs.ucla.edu>
3632
3633 Integer and buffer overflow fixes (Bug#8873).
3634
3635 * print.c (printchar, strout): Check for string overflow.
3636 (PRINTPREPARE, printchar, strout):
3637 Don't set size unless allocation succeeds.
3638
3639 * minibuf.c (read_minibuf_noninteractive): Use ptrdiff_t, not int,
3640 for sizes. Check for string overflow more accurately.
3641 Simplify newline removal at end; this suppresses a GCC 4.6.0 warning.
3642
3643 * macros.c: Integer and buffer overflow fixes.
3644 * keyboard.h (struct keyboard.kbd_macro_bufsize):
3645 * macros.c (Fstart_kbd_macro, store_kbd_macro_char):
3646 Use ptrdiff_t, not int, for sizes.
3647 Don't increment bufsize until after realloc succeeds.
3648 Check for size-calculation overflow.
3649 (Fstart_kbd_macro): Use EMACS_INT, not int, for XINT result.
3650
3651 * lisp.h (DEFVAR_KBOARD): Use offsetof instead of char * finagling.
3652
3653 * lread.c: Integer overflow fixes.
3654 (read_integer): Radix is now EMACS_INT, not int,
3655 to improve quality of diagnostics for out-of-range radices.
3656 Calculate buffer size correctly for out-of-range radices.
3657 (read1): Check for integer overflow in radices, and in
3658 read-circle numbers.
3659 (read_escape): Avoid int overflow.
3660 (Fload, openp, read_buffer_size, read1)
3661 (substitute_object_recurse, read_vector, read_list, map_obarray):
3662 Use ptrdiff_t, not int, for sizes.
3663 (read1): Use EMACS_INT, not int, for sizes.
3664 Check for size overflow.
3665
3666 * image.c (cache_image): Check for size arithmetic overflow.
3667
3668 * lread.c: Integer overflow issues.
3669 (saved_doc_string_size, saved_doc_string_length)
3670 (prev_saved_doc_string_size, prev_saved_doc_string_length):
3671 Now ptrdiff_t, not int.
3672 (read1): Don't assume doc string length fits in int. Check for
3673 out-of-range doc string lengths.
3674 (read_list): Don't assume file position fits in int.
3675 (read_escape): Check for hex character overflow.
3676
3677 2011-06-22 Leo Liu <sdl.web@gmail.com>
3678
3679 * minibuf.c (Fcompleting_read_default, Vcompleting_read_function):
3680 Move to minibuffer.el.
3681
3682 2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
3683
3684 Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking.
3685 The following patches are for when GLYPH_DEBUG && !XASSERT.
3686 * dispextern.h (trace_redisplay_p, dump_glyph_string):
3687 * dispnew.c (flush_stdout):
3688 * xdisp.c (dump_glyph_row, dump_glyph_matrix, dump_glyph):
3689 Mark as externally visible.
3690 * dispnew.c (check_window_matrix_pointers): Now static.
3691 * dispnew.c (window_to_frame_vpos):
3692 * xfns.c (unwind_create_frame):
3693 * xterm.c (x_check_font): Remove unused local.
3694 * scroll.c (CHECK_BOUNDS):
3695 * xfaces.c (cache_fache): Rename local to avoid shadowing.
3696 * xfns.c, w32fns.c (image_cache_refcount, dpyinfo_refcount): Now static.
3697 * xdisp.c (check_window_end): Now a no-op if !XASSERTS.
3698 (debug_first_unchanged_at_end_vpos, debug_last_unchanged_at_beg_vpos)
3699 (debug_dvpos, debug_dy, debug_delta, debug_delta_bytes, debug_end_vpos):
3700 Now static.
3701 (debug_method_add): Use va_list and vsprintf rather than relying
3702 on undefined behavior with wrong number of arguments.
3703 (dump_glyph, dump_glyph_row, Fdump_glyph_matrix):
3704 Don't assume ptrdiff_t and EMACS_INT are the same width as int.
3705 In this code, it's OK to assume C99 behavior for ptrdiff_t formats
3706 since we're not interested in debugging glyphs with old libraries.
3707 * xfaces.c (cache_face): Move debugging code earlier; this pacifies
3708 GCC 4.6.0's static checking.
3709
3710 2011-06-22 Paul Eggert <eggert@cs.ucla.edu>
3711
3712 Integer overflow and signedness fixes (Bug#8873).
3713 A few related buffer overrun fixes, too.
3714
3715 * font.c (font_score): Use EMACS_INT, not int, to store XINT value.
3716
3717 * dispextern.h (struct face.stipple):
3718 * image.c (x_bitmap_height, x_bitmap_width, x_bitmap_pixmap)
3719 (x_bitmap_mask, x_allocate_bitmap_record)
3720 (x_create_bitmap_from_data, x_create_bitmap_from_file)
3721 (x_destroy_bitmap, x_destroy_all_bitmaps, x_create_bitmap_mask)
3722 (x_create_bitmap_from_xpm_data):
3723 * nsterm.h (struct ns_display_info.bitmaps_size, .bitmaps_last):
3724 * w32term.h (struct w32_display_info.icon_bitmap_id, .bitmaps_size)
3725 (.bitmaps_last):
3726 * xfaces.c (load_pixmap):
3727 * xterm.c (x_bitmap_icon, x_wm_set_icon_pixmap):
3728 * xterm.h (struct x_display_info.icon_bitmap_id, .bitmaps_size)
3729 (.bitmaps_last, struct x_output.icon_bitmap):
3730 Use ptrdiff_t, not int, for bitmap indexes.
3731 (x_allocate_bitmap_record): Check for size overflow.
3732 * dispextern.h, lisp.h: Adjust to API changes elsewhere.
3733
3734 Use ptrdiff_t, not int, for overlay counts.
3735 * buffer.h (overlays_at, sort_overlays, GET_OVERLAYS_AT):
3736 * editfns.c (overlays_around, get_pos_property):
3737 * textprop.c (get_char_property_and_overlay):
3738 * xdisp.c (next_overlay_change, note_mouse_highlight):
3739 * xfaces.c (face_at_buffer_position):
3740 * buffer.c (OVERLAY_COUNT_MAX): New macro.
3741 (overlays_at, overlays_in, sort_overlays, Foverlays_at)
3742 (Fnext_overlay_change, Fprevious_overlay_change)
3743 (mouse_face_overlay_overlaps, Foverlays_in):
3744 Use ptrdiff_t, not int, for sizes.
3745 (overlays_at, overlays_in): Check for size-calculation overflow.
3746
3747 * xterm.c (xim_initialize, same_x_server): Strlen may not fit in int.
3748
3749 * xsmfns.c (smc_save_yourself_CB, x_session_initialize): Avoid strlen.
3750 (x_session_initialize): Do not assume string length fits in int.
3751
3752 * xsettings.c (apply_xft_settings): Fix potential buffer overrun.
3753 This is unlikely, but can occur if DPI is outlandish.
3754
3755 * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font):
3756 * xselect.c (Fx_get_atom_name): Avoid need for strlen.
3757
3758 * xrdb.c: Don't assume strlen fits in int; avoid some strlens.
3759 * xrdb.c (magic_file_p, search_magic_path):
3760 Omit last arg SUFFIX; it was always 0. All callers changed.
3761 (magic_file_p): Use ptrdiff_t, not int. Check for size overflow.
3762
3763 * xfont.c (xfont_match): Avoid need for strlen.
3764
3765 * xfns.c: Don't assume strlen fits in int.
3766 (xic_create_fontsetname, x_window): Use ptrdiff_t, not int.
3767
3768 * xdisp.c (message_log_check_duplicate): Return intmax_t,
3769 not unsigned long, as we prefer signed integers. All callers changed.
3770 Detect integer overflow in repeat count.
3771 (message_dolog): Don't assume print length fits in 39 bytes.
3772 (display_mode_element): Don't assume strlen fits in int.
3773
3774 * termcap.c: Don't assume sizes fit in int and never overflow.
3775 (struct termcap_buffer, tgetent): Use ptrdiff_t, not int, for sizes.
3776 (gobble_line): Check for size-calculation overflow.
3777
3778 * minibuf.c (Fread_buffer):
3779 * lread.c (intern, intern_c_string):
3780 * image.c (xpm_scan) [HAVE_NS && !HAVE_XPM]:
3781 Don't assume string length fits in int.
3782
3783 * keyboard.c (parse_tool_bar_item):
3784 * gtkutil.c (style_changed_cb): Avoid need for strlen.
3785
3786 * font.c: Don't assume string length fits in int.
3787 (font_parse_xlfd, font_parse_fcname, font_unparse_fcname):
3788 Use ptrdiff_t, not int.
3789 (font_intern_prop): Don't assume string length fits in int.
3790 Don't assume integer property fits in fixnum.
3791 * font.h (font_intern_prop): 2nd arg is now ptrdiff_t, not int.
3792
3793 * filelock.c: Fix some buffer overrun and integer overflow issues.
3794 (get_boot_time): Don't assume gzip command string fits in 100 bytes.
3795 Reformulate so as not to need the command string.
3796 Invoke gzip -cd rather than gunzip, as it's more portable.
3797 (lock_info_type, lock_file_1, lock_file):
3798 Don't assume pid_t and time_t fit in unsigned long.
3799 (LOCK_PID_MAX): Remove; we now use more-reliable bounds.
3800 (current_lock_owner): Prefer signed type for sizes.
3801 Use memcpy, not strncpy, where memcpy is what is really wanted.
3802 Don't assume (via atoi) that time_t and pid_t fit in int.
3803 Check for time_t and/or pid_t out of range, e.g., via a network share.
3804 Don't alloca where an auto var works fine.
3805
3806 * fileio.c: Fix some integer overflow issues.
3807 (file_name_as_directory, Fexpand_file_name, Fsubstitute_in_file_name):
3808 Don't assume string length fits in int.
3809 (directory_file_name): Don't assume string length fits in long.
3810 (make_temp_name): Don't assume pid fits in int, or that its print
3811 length is less than 20.
3812
3813 * data.c (Fsubr_name): Rewrite to avoid a strlen call.
3814
3815 * coding.c (make_subsidiaries): Don't assume string length fits in int.
3816
3817 * callproc.c (child_setup): Rewrite to avoid two strlen calls.
3818
3819 * process.c (Fformat_network_address): Use EMACS_INT, not EMACS_UINT.
3820 We prefer signed integers, even for size calculations.
3821
3822 * emacs.c: Don't assume string length fits in 'int'.
3823 (DEFINE_DUMMY_FUNCTION, sort_args): Use ptrdiff_t, not int.
3824 (main): Don't invoke strlen when not needed.
3825
3826 * dbusbind.c (XD_ERROR): Don't arbitrarily truncate string.
3827 (XD_DEBUG_MESSAGE): Don't waste a byte.
3828
3829 * callproc.c (getenv_internal_1, getenv_internal)
3830 (Fgetenv_internal):
3831 * buffer.c (init_buffer): Don't assume string length fits in 'int'.
3832
3833 * lread.c (invalid_syntax): Omit length argument.
3834 All uses changed. This doesn't fix a bug, but it simplifies the
3835 code away from its former Hollerith-constant appearance, and it's
3836 one less 'int' to worry about when looking at integer-overflow issues.
3837 (string_to_number): Simplify 2011-04-26 change by invoking xsignal1.
3838
3839 * lisp.h (DEFUN): Remove bogus use of sizeof (struct Lisp_Subr).
3840 This didn't break anything, but it didn't help either.
3841 It's confusing to put a bogus integer in a place where the actual
3842 value does not matter.
3843 (LIST_END_P): Remove unused macro and its bogus comment.
3844 (make_fixnum_or_float): Remove unnecessary cast to EMACS_INT.
3845
3846 * lisp.h (union Lisp_Object.i): EMACS_INT, not EMACS_UINT.
3847 This is for consistency with the ordinary, non-USE_LISP_UNION_TYPE,
3848 implementation.
3849 (struct Lisp_Bool_Vector.size): EMACS_INT, not EMACS_UINT.
3850 We prefer signed types, and the value cannot exceed the EMACS_INT
3851 range anyway (because otherwise the length would not be representable).
3852 (XSET) [USE_LISP_UNION_TYPE]: Use uintptr_t and intptr_t,
3853 not EMACS_UINT and EMACS_INT, when converting pointer to integer.
3854 This avoids a GCC warning when WIDE_EMACS_INT.
3855
3856 * indent.c (sane_tab_width): New function.
3857 (current_column, scan_for_column, Findent_to, position_indentation)
3858 (compute_motion): Use it. This is just for clarity.
3859 (Fcompute_motion): Don't assume hscroll and tab offset fit in int.
3860
3861 * image.c (xbm_image_p): Don't assume stated width, height fit in int.
3862
3863 * lisp.h (lint_assume): New macro.
3864 * composite.c (composition_gstring_put_cache):
3865 * ftfont.c (ftfont_shape_by_flt): Use it to pacify GCC 4.6.0.
3866
3867 * editfns.c, insdel.c:
3868 Omit unnecessary forward decls, to simplify future changes.
3869
3870 * ftfont.c (ftfont_shape_by_flt): Use signed integers for lengths.
3871
3872 * font.c (Ffont_shape_gstring): Don't assume glyph len fits in 'int'.
3873
3874 * fns.c (Ffillarray): Don't assume bool vector size fits in 'int'.
3875 Use much-faster test for byte-length change.
3876 Don't assume string byte-length fits in 'int'.
3877 Check that character arg fits in 'int'.
3878 (mapcar1): Declare byte as byte, for clarity.
3879
3880 * alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication.
3881
3882 * fns.c (concat): Catch string overflow earlier.
3883 Do not rely on integer wraparound.
3884
3885 * dispextern.h (struct it.overlay_strings_charpos)
3886 (struct it.selective): Now EMACS_INT, not int.
3887 * xdisp.c (forward_to_next_line_start)
3888 (back_to_previous_visible_line_start)
3889 (reseat_at_next_visible_line_start, next_element_from_buffer):
3890 Don't arbitrarily truncate the value of 'selective' to int.
3891
3892 * xdisp.c (init_iterator): Use XINT, not XFASTINT; it might be < 0.
3893
3894 * composite.c: Don't truncate sizes to 'int'.
3895 (composition_gstring_p, composition_reseat_it)
3896 (composition_adjust_point): Use EMACS_INT, not int.
3897 (get_composition_id, composition_gstring_put_cache): Use EMACS_INT,
3898 not EMACS_UINT, for indexes.
3899
3900 * category.h (CATEGORY_SET_P): Remove unnecessary cast to EMACS_INT.
3901
3902 * buffer.c: Include <verify.h>.
3903 (struct sortvec.priority, struct sortstr.priority):
3904 Now EMACS_INT, not int.
3905 (compare_overlays, cmp_for_strings): Avoid subtraction overflow.
3906 (struct sortstr.size, record_overlay_string)
3907 (struct sortstrlist.size, struct sortlist.used):
3908 Don't truncate size to int.
3909 (record_overlay_string): Check for size-calculation overflow.
3910 (init_buffer_once): Check at compile-time, not run-time.
3911
3912 2011-06-22 Jim Meyering <meyering@redhat.com>
3913
3914 Don't leak an XBM-image-sized buffer
3915 * image.c (xbm_load): Free the image buffer after using it.
3916
3917 2011-06-21 Paul Eggert <eggert@cs.ucla.edu>
3918
3919 Port to Sun C.
3920 * composite.c (find_automatic_composition): Omit needless 'return 0;'
3921 that Sun C diagnosed.
3922 * fns.c (secure_hash): Fix pointer signedness issue.
3923 * intervals.c (static_offset_intervals): New function.
3924 (offset_intervals): Use it.
3925
3926 2011-06-21 Leo Liu <sdl.web@gmail.com>
3927
3928 * deps.mk (fns.o):
3929 * makefile.w32-in ($(BLD)/fns.$(O)): Include sha256.h and
3930 sha512.h.
3931
3932 * fns.c (secure_hash): Rename from crypto_hash_function and change
3933 the first arg to accept symbols.
3934 (Fsecure_hash): New primitive.
3935 (syms_of_fns): New symbols.
3936
3937 2011-06-20 Deniz Dogan <deniz@dogan.se>
3938
3939 * process.c (Fset_process_buffer): Clarify return value in
3940 docstring.
3941
3942 2011-06-18 Chong Yidong <cyd@stupidchicken.com>
3943
3944 * dispnew.c (add_window_display_history): Use BVAR.
3945
3946 * xdisp.c (debug_method_add): Use BVAR.
3947 (check_window_end, dump_glyph_matrix, dump_glyph)
3948 (dump_glyph_row, dump_glyph_string): Convert arglist to ANSI C.
3949
3950 * xfaces.c (check_lface_attrs, check_lface, dump_realized_face):
3951 Likewise.
3952
3953 * xfns.c (Fx_create_frame, x_create_tip_frame): Delay image cache
3954 check till after the cache is created in init_frame_faces.
3955
3956 2011-06-17 Stefan Monnier <monnier@iro.umontreal.ca>
3957
3958 * fns.c (Fsafe_length): Yet another int/Lisp_Object mixup.
3959
3960 2011-06-16 Paul Eggert <eggert@cs.ucla.edu>
3961
3962 * lisp.h: Include <limits.h>, for INT_MAX, LONG_MAX, LLONG_MAX.
3963 Without this, prin1 mishandles Lisp_Misc_Save_Value printing on
3964 hosts with pre-C99 libraries, because pD is wrongly defined to "t".
3965
3966 Improve buffer-overflow checking (Bug#8873).
3967 * fileio.c (Finsert_file_contents):
3968 * insdel.c (insert_from_buffer_1, replace_range, replace_range_2):
3969 Remove the old (too-loose) buffer overflow checks.
3970 They weren't needed, since make_gap checks for buffer overflow.
3971 * insdel.c (make_gap_larger): Catch buffer overflows that were missed.
3972 The old code merely checked for Emacs fixnum overflow, and relied
3973 on undefined (wraparound) behavior. The new code avoids undefined
3974 behavior, and also checks for ptrdiff_t and/or size_t overflow.
3975
3976 * editfns.c (Finsert_char): Don't dump core with very negative counts.
3977 Tune. Don't use wider integers than needed. Don't use alloca.
3978 Use a bigger 'string' buffer. Rewrite to avoid 'n > 0' test.
3979
3980 * insdel.c (replace_range): Fix buf overflow when insbytes < outgoing.
3981
3982 * insdel.c, lisp.h (buffer_overflow): New function.
3983 (insert_from_buffer_1, replace_range, replace_range_2):
3984 * insdel.c (make_gap_larger):
3985 * editfns.c (Finsert_char):
3986 * fileio.c (Finsert_file_contents): Use it, to normalize wording.
3987
3988 * buffer.h (BUF_BYTES_MAX): Cast to ptrdiff_t so that it's signed.
3989
3990 2011-06-15 Paul Eggert <eggert@cs.ucla.edu>
3991
3992 Integer overflow and signedness fixes (Bug#8873).
3993
3994 * ccl.c (ASCENDING_ORDER): New macro, to work around GCC bug 43772.
3995 (GET_CCL_RANGE, IN_INT_RANGE): Use it.
3996
3997 * fileio.c: Don't assume EMACS_INT fits in off_t.
3998 (emacs_lseek): New static function.
3999 (Finsert_file_contents, Fwrite_region): Use it.
4000 Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate.
4001
4002 * fns.c (Fload_average): Don't assume 100 * load average fits in int.
4003
4004 * fns.c: Don't overflow int when computing a list length.
4005 * fns.c (QUIT_COUNT_HEURISTIC): New constant.
4006 (Flength, Fsafe_length): Use EMACS_INT, not int, to avoid unwanted
4007 truncation on 64-bit hosts. Check for QUIT every
4008 QUIT_COUNT_HEURISTIC entries rather than every other entry; that's
4009 faster and is responsive enough.
4010 (Flength): Report an error instead of overflowing an integer.
4011 (Fsafe_length): Return a float if the value is not representable
4012 as a fixnum. This shouldn't happen except in contrived situations.
4013 (Fnthcdr, Fsort): Don't assume list length fits in int.
4014 (Fcopy_sequence): Don't assume vector length fits in int.
4015
4016 * alloc.c: Check that resized vectors' lengths fit in fixnums.
4017 (header_size, word_size): New constants.
4018 (allocate_vectorlike): Don't check size overflow here.
4019 (allocate_vector): Check it here instead, since this is the only
4020 caller of allocate_vectorlike that could cause overflow.
4021 Check that the new vector's length is representable as a fixnum.
4022
4023 * fns.c (next_almost_prime): Don't return a multiple of 3 or 5.
4024 The previous code was bogus. For example, next_almost_prime (32)
4025 returned 39, which is undesirable as it is a multiple of 3; and
4026 next_almost_prime (24) returned 25, which is a multiple of 5 so
4027 why was the code bothering to check for multiples of 7?
4028
4029 * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, for vector length.
4030
4031 * eval.c, doprnt.c (SIZE_MAX): Remove; inttypes.h defines this now.
4032
4033 Variadic C functions now count arguments with ptrdiff_t.
4034 This partly undoes my 2011-03-30 change, which replaced int with size_t.
4035 Back then I didn't know that the Emacs coding style prefers signed int.
4036 Also, in the meantime I found a few more instances where arguments
4037 were being counted with int, which may truncate counts on 64-bit
4038 machines, or EMACS_INT, which may be unnecessarily wide.
4039 * lisp.h (struct Lisp_Subr.function.aMANY)
4040 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call):
4041 Arg counts are now ptrdiff_t, not size_t.
4042 All variadic functions and their callers changed accordingly.
4043 (struct gcpro.nvars): Now size_t, not size_t. All uses changed.
4044 * bytecode.c (exec_byte_code): Check maxdepth for overflow,
4045 to avoid potential buffer overrun. Don't assume arg counts fit in 'int'.
4046 * callint.c (Fcall_interactively): Check arg count for overflow,
4047 to avoid potential buffer overrun. Use signed char, not 'int',
4048 for 'varies' array, so that we needn't bother to check its size
4049 calculation for overflow.
4050 * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args.
4051 * eval.c (apply_lambda):
4052 * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length.
4053 (struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed.
4054 (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
4055
4056 * callint.c (Fcall_interactively): Don't use index var as event count.
4057
4058 * vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
4059 * mem-limits.h (SIZE): Remove; no longer used.
4060
4061 * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works.
4062
4063 Remove unnecessary casts.
4064 * xterm.c (x_term_init):
4065 * xfns.c (x_set_border_pixel):
4066 * widget.c (create_frame_gcs): Remove casts to unsigned long etc.
4067 These aren't needed now that we assume ANSI C.
4068
4069 * sound.c (Fplay_sound_internal): Remove cast to unsigned long.
4070 It's more likely to cause problems (due to unsigned overflow)
4071 than to cure them.
4072
4073 * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts.
4074
4075 * unexelf.c (unexec): Don't assume BSS addr fits in unsigned.
4076
4077 * xterm.c (handle_one_xevent): Omit unnecessary casts to unsigned.
4078
4079 * keyboard.c (modify_event_symbol): Don't limit alist len to UINT_MAX.
4080
4081 * lisp.h (CHAR_TABLE_SET): Omit now-redundant test.
4082
4083 * lread.c (Fload): Don't compare a possibly-garbage time_t value.
4084
4085 GLYPH_CODE_FACE returns EMACS_INT, not int.
4086 * dispextern.h (merge_faces):
4087 * xfaces.c (merge_faces):
4088 * xdisp.c (get_next_display_element, next_element_from_display_vector):
4089 Don't assume EMACS_INT fits in int.
4090
4091 * character.h (CHAR_VALID_P): Remove unused parameter.
4092 * fontset.c, lisp.h, xdisp.c: All uses changed.
4093
4094 * editfns.c (Ftranslate_region_internal): Omit redundant test.
4095
4096 * fns.c (concat): Minor tuning based on overflow analysis.
4097 This doesn't fix any bugs. Use int to hold character, instead
4098 of constantly refetching from Emacs object. Use XFASTINT, not
4099 XINT, for value known to be a character. Don't bother comparing
4100 a single byte to 0400, as it's always less.
4101
4102 * floatfns.c (Fexpt):
4103 * fileio.c (make_temp_name): Omit unnecessary cast to unsigned.
4104
4105 * editfns.c (Ftranslate_region_internal): Use int, not EMACS_INT
4106 for characters.
4107
4108 * doc.c (get_doc_string): Omit (unsigned)c that mishandled negatives.
4109
4110 * data.c (Faset): If ARRAY is a string, check that NEWELT is a char.
4111 Without this fix, on a 64-bit host (aset S 0 4294967386) would
4112 incorrectly succeed when S was a string, because 4294967386 was
4113 truncated before it was used.
4114
4115 * chartab.c (Fchar_table_range): Use CHARACTERP to check range.
4116 Otherwise, an out-of-range integer could cause undefined behavior
4117 on a 64-bit host.
4118
4119 * composite.c: Use int, not EMACS_INT, for characters.
4120 (fill_gstring_body, composition_compute_stop_pos): Use int, not
4121 EMACS_INT, for values that are known to be in character range.
4122 This doesn't fix any bugs but is the usual style inside Emacs and
4123 may generate better code on 32-bit machines.
4124
4125 Make sure a 64-bit char is never passed to ENCODE_CHAR.
4126 This is for reasons similar to the recent CHAR_STRING fix.
4127 * charset.c (Fencode_char): Check that character arg is actually
4128 a character. Pass an int to ENCODE_CHAR.
4129 * charset.h (ENCODE_CHAR): Verify that the character argument is no
4130 wider than 'int', as a compile-time check to prevent future regressions
4131 in this area.
4132
4133 * character.c (char_string): Remove unnecessary casts.
4134
4135 Make sure a 64-bit char is never passed to CHAR_STRING.
4136 Otherwise, CHAR_STRING would do the wrong thing on a 64-bit platform,
4137 by silently ignoring the top 32 bits, allowing some values
4138 that were far too large to be valid characters.
4139 * character.h: Include <verify.h>.
4140 (CHAR_STRING, CHAR_STRING_ADVANCE): Verify that the character
4141 arguments are no wider than unsigned, as a compile-time check
4142 to prevent future regressions in this area.
4143 * data.c (Faset):
4144 * editfns.c (Fchar_to_string, general_insert_function, Finsert_char)
4145 (Fsubst_char_in_region):
4146 * fns.c (concat):
4147 * xdisp.c (decode_mode_spec_coding):
4148 Adjust to CHAR_STRING's new requirement.
4149 * editfns.c (Finsert_char, Fsubst_char_in_region):
4150 * fns.c (concat): Check that character args are actually
4151 characters. Without this test, these functions did the wrong
4152 thing with wildly out-of-range values on 64-bit hosts.
4153
4154 Remove incorrect casts to 'unsigned' that lose info on 64-bit hosts.
4155 These casts should not be needed on 32-bit hosts, either.
4156 * keyboard.c (read_char):
4157 * lread.c (Fload): Remove casts to unsigned.
4158
4159 * lisp.h (UNSIGNED_CMP): New macro.
4160 This fixes comparison bugs on 64-bit hosts.
4161 (ASCII_CHAR_P): Use it.
4162 * casefiddle.c (casify_object):
4163 * character.h (ASCII_BYTE_P, CHAR_VALID_P)
4164 (SINGLE_BYTE_CHAR_P, CHAR_STRING):
4165 * composite.h (COMPOSITION_ENCODE_RULE_VALID):
4166 * dispextern.h (FACE_FROM_ID):
4167 * keyboard.c (read_char): Use UNSIGNED_CMP.
4168
4169 * xmenu.c (dialog_selection_callback) [!USE_GTK]: Cast to intptr_t,
4170 not to EMACS_INT, to avoid GCC warning.
4171
4172 * xfns.c (x_set_scroll_bar_default_width): Remove unused 'int' locals.
4173
4174 * buffer.h (PTR_BYTE_POS, BUF_PTR_BYTE_POS): Remove harmful cast.
4175 The cast incorrectly truncated 64-bit byte offsets to 32 bits, and
4176 isn't needed on 32-bit machines.
4177
4178 * buffer.c (Fgenerate_new_buffer_name):
4179 Use EMACS_INT for count, not int.
4180 (advance_to_char_boundary): Return EMACS_INT, not int.
4181
4182 * data.c (Qcompiled_function): Now static.
4183
4184 * window.c (window_body_lines): Now static.
4185
4186 * image.c (gif_load): Rename local to avoid shadowing.
4187
4188 * lisp.h (SAFE_ALLOCA_LISP): Check for integer overflow.
4189 (struct Lisp_Save_Value): Use ptrdiff_t, not int, for 'integer' member.
4190 * alloc.c (make_save_value): Integer argument is now of type
4191 ptrdiff_t, not int.
4192 (mark_object): Use ptrdiff_t, not int.
4193 * lisp.h (pD): New macro.
4194 * print.c (print_object): Use it.
4195
4196 * alloc.c: Use EMACS_INT, not int, to count objects.
4197 (total_conses, total_markers, total_symbols, total_vector_size)
4198 (total_free_conses, total_free_markers, total_free_symbols)
4199 (total_free_floats, total_floats, total_free_intervals)
4200 (total_intervals, total_strings, total_free_strings):
4201 Now EMACS_INT, not int. All uses changed.
4202 (Fgarbage_collect): Compute overall total using a double, so that
4203 integer overflow is less likely to be a problem. Check for overflow
4204 when converting back to an integer.
4205 (n_interval_blocks, n_string_blocks, n_float_blocks, n_cons_blocks)
4206 (n_vectors, n_symbol_blocks, n_marker_blocks): Remove.
4207 These were 'int' variables that could overflow on 64-bit hosts;
4208 they were never used, so remove them instead of repairing them.
4209 (nzombies, ngcs, max_live, max_zombies): Now EMACS_INT, not 'int'.
4210 (inhibit_garbage_collection): Set gc_cons_threshold to max value.
4211 Previously, this ceilinged at INT_MAX, but that doesn't work on
4212 64-bit machines.
4213 (allocate_pseudovector): Don't use EMACS_INT when int would do.
4214
4215 * alloc.c (Fmake_bool_vector): Don't assume vector size fits in int.
4216 (allocate_vectorlike): Check for ptrdiff_t overflow.
4217 (mark_vectorlike, mark_char_table, mark_object): Avoid EMACS_UINT
4218 when a (possibly-narrower) signed value would do just as well.
4219 We prefer using signed arithmetic, to avoid comparison confusion.
4220
4221 * alloc.c: Catch some string size overflows that we were missing.
4222 (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0,
4223 for convenience in STRING_BYTES_MAX.
4224 (STRING_BYTES_MAX): New macro, superseding the old one in lisp.h.
4225 The definition here is exact; the one in lisp.h was approximate.
4226 (allocate_string_data): Check for string overflow. This catches
4227 some instances we weren't catching before. Also, it catches
4228 size_t overflow on (unusual) hosts where SIZE_MAX <= min
4229 (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits
4230 and ptrdiff_t and EMACS_INT are both 64 bits.
4231
4232 * character.c, coding.c, doprnt.c, editfns.c, eval.c:
4233 All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND.
4234 * lisp.h (STRING_BYTES_BOUND): Rename from STRING_BYTES_MAX.
4235
4236 * character.c (string_escape_byte8): Fix nbytes/nchars typo.
4237
4238 * alloc.c (Fmake_string): Check for out-of-range init.
4239
4240 2011-06-15 Stefan Monnier <monnier@iro.umontreal.ca>
4241
4242 * eval.c (Fdefvaralias): Also mark the target as variable-special-p.
4243
4244 2011-06-14 Jan Djärv <jan.h.d@swipnet.se>
4245
4246 * xfns.c (x_set_scroll_bar_default_width): Remove argument to
4247 xg_get_default_scrollbar_width.
4248
4249 * gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3.
4250 (int_gtk_range_get_value): Move to the scroll bar part of the file.
4251 (style_changed_cb): Call update_theme_scrollbar_width and call
4252 x_set_scroll_bar_default_width and xg_frame_set_char_size for
4253 all frames (Bug#8505).
4254 (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505).
4255 Call gtk_window_set_resizable if HAVE_GTK3.
4256 (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width
4257 and height if HAVE_GTK3 (Bug#8505).
4258 (scroll_bar_width_for_theme): New variable.
4259 (update_theme_scrollbar_width): New function.
4260 (xg_get_default_scrollbar_width): Move code to
4261 update_theme_scrollbar_width, just return scroll_bar_width_for_theme.
4262 (xg_initialize): Call update_theme_scrollbar_width.
4263
4264 * gtkutil.h (xg_get_default_scrollbar_width): Remove argument.
4265
4266 * emacsgtkfixed.c, emacsgtkfixed.h: New files.
4267
4268 2011-06-12 Martin Rudalics <rudalics@gmx.at>
4269
4270 * frame.c (make_frame): Call other_buffer_safely instead of
4271 other_buffer.
4272
4273 * window.c (temp_output_buffer_show): Call display_buffer with
4274 second argument Vtemp_buffer_show_specifiers and reset latter
4275 immediately after the call.
4276 (Vtemp_buffer_show_specifiers): New variable.
4277 (auto_window_vscroll_p, next_screen_context_lines)
4278 (Vscroll_preserve_screen_position): Remove leading asterisks from
4279 doc-strings.
4280
4281 2011-06-12 Paul Eggert <eggert@cs.ucla.edu>
4282
4283 Fix minor problems found by GCC 4.6.0 static checking.
4284 * buffer.c (Qclone_number): Remove for now, as it's unused.
4285 (record_buffer, Funrecord_buffer): Rename local to avoid shadowing.
4286 (record_buffer): Remove unused local.
4287 * frame.c (other_visible_frames, frame_buffer_list): Now static.
4288 (set_frame_buffer_list): Remove; unused.
4289 * frame.h (other_visible_frames): Remove decl.
4290 * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF.
4291 * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls.
4292 (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only
4293 if HAVE_GPM.
4294 * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF.
4295 * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor):
4296 Define only if HAVE_GPM.
4297 * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static.
4298 (update_hints_inhibit): Remove; never set. All uses removed.
4299 * widgetprv.h (emacsFrameClassRec): Remove decl.
4300 * window.c (delete_deletable_window): Now returns void, since it
4301 wasn't returning anything.
4302 (compare_window_configurations): Remove unused locals.
4303 * xfns.c (x_set_scroll_bar_default_width): Remove unused locals.
4304 * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF.
4305 (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers
4306 the same widths as pointers. This follows up on the 2011-05-06 patch.
4307 * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID.
4308 * xterm.h: Likewise.
4309 (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF.
4310
4311 2011-06-12 Juanma Barranquero <lekktu@gmail.com>
4312
4313 * makefile.w32-in: Update dependencies.
4314 (LISP_H): Add lib/intprops.h.
4315
4316 2011-06-11 Chong Yidong <cyd@stupidchicken.com>
4317
4318 * image.c (gif_load): Add animation frame delay to the metadata.
4319 (syms_of_image): Use DEFSYM. New symbol `delay'.
4320
4321 2011-06-11 Martin Rudalics <rudalics@gmx.at>
4322
4323 * window.c (delete_deletable_window): Re-add.
4324 (Fset_window_configuration): Rewrite to handle dead buffers and
4325 consequently deletable windows.
4326 (window_tree, Fwindow_tree): Remove. Supply functionality in
4327 window.el.
4328 (compare_window_configurations): Simplify code.
4329
4330 2011-06-11 Andreas Schwab <schwab@linux-m68k.org>
4331
4332 * image.c (imagemagick_load_image): Fix type mismatch.
4333 (Fimagemagick_types): Likewise.
4334
4335 * window.h (replace_buffer_in_windows): Declare.
4336
4337 2011-06-11 Martin Rudalics <rudalics@gmx.at>
4338
4339 * buffer.c: New Lisp objects Qbuffer_list_update_hook and
4340 Qclone_number. Remove external declaration of Qdelete_window.
4341 (Fbuffer_list): Rewrite doc-string. Minor restructuring of
4342 code.
4343 (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer):
4344 Run Qbuffer_list_update_hook if allowed.
4345 (Fother_buffer): Rewrite doc-string. Major rewrite for new
4346 buffer list implementation.
4347 (other_buffer_safely): New function.
4348 (Fkill_buffer): Replace call to replace_buffer_in_all_windows by
4349 calls to replace_buffer_in_windows and
4350 replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook
4351 if allowed.
4352 (record_buffer): Inhibit quitting and rewrite using quittable
4353 functions. Run Qbuffer_list_update_hook if allowed.
4354 (Frecord_buffer, Funrecord_buffer): New functions.
4355 (switch_to_buffer_1, Fswitch_to_buffer): Remove.
4356 Move switch-to-buffer to window.el.
4357 (bury-buffer): Move to window.el.
4358 (Vbuffer_list_update_hook): New variable.
4359
4360 * lisp.h (other_buffer_safely): Add prototype in buffer.c
4361 section.
4362
4363 * window.h (resize_frame_windows): Move up in code.
4364 (Fwindow_frame): Remove EXFUN.
4365 (replace_buffer_in_all_windows): Remove prototype.
4366 (replace_buffer_in_windows_safely): Add prototype.
4367
4368 * window.c: Declare Qdelete_window static again. Move down
4369 declaration of select_count.
4370 (Fnext_window, Fprevious_window): Rewrite doc-strings.
4371 (Fother_window): Move to window.el.
4372 (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER
4373 cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case.
4374 (Fdelete_windows_on, Freplace_buffer_in_windows): Move to
4375 window.el.
4376 (replace_buffer_in_windows): Implement by calling
4377 Qreplace_buffer_in_windows.
4378 (replace_buffer_in_all_windows): Remove with some functionality
4379 moved into replace_buffer_in_windows_safely.
4380 (replace_buffer_in_windows_safely): New function.
4381 (select_window_norecord, select_frame_norecord): Move in front
4382 of run_window_configuration_change_hook. Remove now obsolete
4383 declarations.
4384 (Fset_window_buffer): Rewrite doc-string.
4385 Call Qrecord_window_buffer.
4386 (keys_of_window): Move binding for other-window to window.el.
4387
4388 2011-06-11 Chong Yidong <cyd@stupidchicken.com>
4389
4390 * dispextern.h (struct image): Replace data member, whose int_val
4391 and ptr_val fields were not used by anything, with a single
4392 lisp_val object.
4393
4394 * image.c (Fimage_metadata, make_image, mark_image, tiff_load)
4395 (gif_clear_image, gif_load, imagemagick_load_image)
4396 (gs_clear_image, gs_load): Callers changed.
4397
4398 2011-06-10 Paul Eggert <eggert@cs.ucla.edu>
4399
4400 * buffer.h: Include <time.h>, for time_t.
4401 Needed to build on FreeBSD 8.2. Problem reported by Herbert J. Skuhra.
4402
4403 Fix minor problems found by static checking.
4404
4405 * image.c (PixelGetMagickColor): Declare if ImageMagick headers don't.
4406
4407 Make identifiers static if they are not used in other modules.
4408 * data.c (Qcompiled_function, Qframe, Qvector):
4409 * image.c (QimageMagick, Qsvg):
4410 * minibuf.c (Qmetadata):
4411 * window.c (resize_window_check, resize_root_window): Now static.
4412 * window.h (resize_window_check, resize_root_window): Remove decls.
4413
4414 * window.c (window_deletion_count, delete_deletable_window):
4415 Remove; unused.
4416 (window_body_lines): Now static.
4417 (Fdelete_other_windows_internal): Mark vars as initialized.
4418 Make sure 'resize_failed' is initialized.
4419 (run_window_configuration_change_hook): Rename local to avoid shadowing.
4420 (resize_window_apply): Remove unused local.
4421 * window.h (delete_deletable_window): Remove decl.
4422
4423 * image.c (gif_load, svg_load_image): Rename locals to avoid shadowing.
4424 (imagemagick_load_image): Fix pointer signedness problem by changing
4425 last arg from unsigned char * to char *. All uses changed.
4426 Also, fix a local for similar reasons.
4427 Remove unused locals. Remove locals to avoid shadowing.
4428 (fn_rsvg_handle_free): Remove; unused.
4429 (svg_load, svg_load_image): Fix pointer signedness problem.
4430 (imagemagick_load_image): Don't use garbage pointer image_wand.
4431
4432 * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
4433
4434 2011-06-10 Chong Yidong <cyd@stupidchicken.com>
4435
4436 * image.c (gif_load): Fix omitted cast error introduced by
4437 2011-06-06 change.
4438
4439 2011-06-10 Martin Rudalics <rudalics@gmx.at>
4440
4441 * window.h (resize_proportionally, orig_total_lines)
4442 (orig_top_line): Remove from window structure.
4443 (set_window_height, set_window_width, change_window_heights)
4444 (Fdelete_window): Remove prototypes.
4445 (resize_frame_windows): Remove duplicate declaration.
4446
4447 2011-06-10 Eli Zaretskii <eliz@gnu.org>
4448
4449 * window.h (resize_frame_windows, resize_window_check)
4450 (delete_deletable_window, resize_root_window)
4451 (resize_frame_windows): Declare prototypes.
4452
4453 * window.c (resize_window_apply): Make definition be "static" to
4454 match the prototype.
4455
4456 2011-06-10 Martin Rudalics <rudalics@gmx.at>
4457
4458 * window.c: Remove declarations of Qwindow_size_fixed,
4459 window_min_size_1, window_min_size_2, window_min_size,
4460 size_window, window_fixed_size_p, enlarge_window, delete_window.
4461 Remove static from declaration of Qdelete_window, it's
4462 temporarily needed by Fbury_buffer.
4463 (replace_window): Don't assign orig_top_line and
4464 orig_total_lines.
4465 (Fdelete_window, delete_window): Remove. Window deletion is
4466 handled by window.el.
4467 (window_loop): Remove DELETE_OTHER_WINDOWS case.
4468 Replace Fdelete_window calls with calls to Qdelete_window.
4469 (Fdelete_other_windows): Remove. Deleting other windows is
4470 handled by window.el.
4471 (window_fixed_size_p): Remove. Fixed-sizeness of windows is
4472 handled in window.el.
4473 (window_min_size_2, window_min_size_1, window_min_size): Remove.
4474 Window minimum sizes are handled in window.el.
4475 (shrink_windows, size_window, set_window_height)
4476 (set_window_width, change_window_heights, window_height)
4477 (window_width, CURBEG, CURSIZE, enlarge_window)
4478 (adjust_window_trailing_edge, Fadjust_window_trailing_edge)
4479 (Fenlarge_window, Fshrink_window): Remove. Window resizing is
4480 handled in window.el.
4481 (make_dummy_parent): Rename to make_parent_window and give it a
4482 second argument horflag.
4483 (make_window): Don't set resize_proportionally any more.
4484 (Fsplit_window): Remove. Windows are split in window.el.
4485 (save_restore_action, save_restore_orig_size)
4486 (shrink_window_lowest_first, save_restore_orig_size): Remove.
4487 Resize mini windows in window.el.
4488 (grow_mini_window, shrink_mini_window): Implement by calling
4489 Qresize_root_window_vertically, resize_window_check and
4490 resize_window_apply.
4491 (saved_window, Fset_window_configuration, save_window_save):
4492 Do not handle orig_top_line, orig_total_lines, and
4493 resize_proportionally.
4494 (window_min_height, window_min_width): Move to window.el.
4495 (keys_of_window): Move bindings for delete-other-windows,
4496 split-window, delete-window and enlarge-window to window.el.
4497
4498 * buffer.c: Temporarily extern Qdelete_window.
4499 (Fbury_buffer): Temporarily call Qdelete_window instead of
4500 Fdelete_window (Fbury_buffer will move to window.el soon).
4501
4502 * frame.c (set_menu_bar_lines_1): Remove code handling
4503 orig_top_line and orig_total_lines.
4504
4505 * dispnew.c (adjust_frame_glyphs_initially): Don't use
4506 set_window_height but set heights directly.
4507 (change_frame_size_1): Use resize_frame_windows.
4508
4509 * xdisp.c (init_xdisp): Don't use set_window_height but set
4510 heights directly.
4511
4512 * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines):
4513 Use resize_frame_windows instead of change_window_heights and run
4514 run_window_configuration_change_hook.
4515
4516 * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows
4517 instead of change_window_heights and run
4518 run_window_configuration_change_hook.
4519
4520 2011-06-09 Martin Rudalics <rudalics@gmx.at>
4521
4522 * window.c (replace_window): Rename second argument REPLACEMENT to
4523 NEW. New third argument SETFLAG. Rewrite.
4524 (delete_window, make_dummy_parent): Call replace_window with
4525 third argument 1.
4526 (window_list_1): Move down in code.
4527 (run_window_configuration_change_hook): Move set_buffer part
4528 before select_frame_norecord part in order to unwind correctly.
4529 Rename count1 to count.
4530 (recombine_windows, delete_deletable_window, resize_root_window)
4531 (Fdelete_other_windows_internal)
4532 (Frun_window_configuration_change_hook, make_parent_window)
4533 (resize_window_check, resize_window_apply, Fresize_window_apply)
4534 (resize_frame_windows, Fsplit_window_internal)
4535 (Fdelete_window_internal, Fresize_mini_window_internal):
4536 New functions.
4537 (syms_of_window): New variables Vwindow_splits and Vwindow_nest.
4538
4539 2011-06-08 Martin Rudalics <rudalics@gmx.at>
4540
4541 * window.h (window): Add some new members to window structure -
4542 normal_lines, normal_cols, new_total, new_normal, clone_number,
4543 splits, nest, prev_buffers, next_buffers.
4544 (WINDOW_TOTAL_SIZE): Move here from window.c.
4545 (MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define here.
4546
4547 * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p):
4548 Remove.
4549 (make_dummy_parent): Set new members of windows structure.
4550 (make_window): Move down in code. Handle new members of window
4551 structure.
4552 (Fwindow_clone_number, Fwindow_splits, Fset_window_splits)
4553 (Fwindow_nest, Fset_window_nest, Fwindow_new_total)
4554 (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers)
4555 (Fset_window_prev_buffers, Fwindow_next_buffers)
4556 (Fset_window_next_buffers, Fset_window_clone_number):
4557 New functions.
4558 (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start)
4559 (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p):
4560 Doc-string fixes.
4561 (Fwindow_parameters, Fwindow_parameter, Fset_window_parameter):
4562 Argument WINDOW can be now internal window too.
4563 (Fwindow_use_time): Move up in code.
4564 (Fget_buffer_window): Rename argument FRAME to ALL-FRAMES.
4565 Rewrite doc-string.
4566 (Fset_window_configuration, saved_window)
4567 (Fcurrent_window_configuration, save_window_save): Handle new
4568 members of window structure.
4569 (WINDOW_TOTAL_SIZE, MIN_SAFE_WINDOW_WIDTH)
4570 (MIN_SAFE_WINDOW_HEIGHT): Move to window.h.
4571 (syms_of_window): New Lisp objects Qrecord_window_buffer,
4572 Qwindow_deletable_p, Qdelete_window, Qreplace_buffer_in_windows,
4573 Qget_mru_window, Qresize_root_window,
4574 Qresize_root_window_vertically, Qsafe, Qabove, Qbelow,
4575 Qauto_buffer_name; staticpro them.
4576
4577 2011-06-07 Martin Rudalics <rudalics@gmx.at>
4578
4579 * window.c (Fwindow_total_size, Fwindow_left_column)
4580 (Fwindow_top_line, window_body_lines, Fwindow_body_size)
4581 (Fwindow_list_1): New functions.
4582 (window_box_text_cols): Replace with window_body_cols.
4583 (Fwindow_width, Fscroll_left, Fscroll_right):
4584 Use window_body_cols instead of window_box_text_cols.
4585 (delete_window, Fset_window_configuration):
4586 Call delete_all_subwindows with window as argument.
4587 (delete_all_subwindows): Take a window as argument and not a
4588 structure. Rewrite.
4589 (window_loop): Remove handling of GET_LRU_WINDOW and
4590 GET_LARGEST_WINDOW.
4591 (Fget_lru_window, Fget_largest_window): Move to window.el.
4592
4593 * window.h: Extern window_body_cols instead of
4594 window_box_text_cols. delete_all_subwindows now takes a
4595 Lisp_Object as argument.
4596
4597 * indent.c (compute_motion, Fcompute_motion):
4598 Use window_body_cols instead of window_box_text_cols.
4599
4600 * frame.c (delete_frame): Call delete_all_subwindows with root
4601 window as argument.
4602
4603 2011-06-07 Daniel Colascione <dan.colascione@gmail.com>
4604
4605 * fns.c (Fputhash): Document return value.
4606
4607 2011-06-06 Chong Yidong <cyd@stupidchicken.com>
4608
4609 * image.c (gif_load): Implement gif89a spec "no disposal" method.
4610
4611 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
4612
4613 Cons<->int and similar integer overflow fixes (Bug#8794).
4614
4615 Check for overflow when converting integer to cons and back.
4616 * charset.c (Fdefine_charset_internal, Fdecode_char):
4617 Use cons_to_unsigned to catch overflow.
4618 (Fencode_char): Use INTEGER_TO_CONS.
4619 * composite.h (LGLYPH_CODE): Use cons_to_unsigned.
4620 (LGLYPH_SET_CODE): Use INTEGER_TO_CONS.
4621 * data.c (long_to_cons, cons_to_long): Remove.
4622 (cons_to_unsigned, cons_to_signed): New functions.
4623 These signal an error for invalid or out-of-range values.
4624 * dired.c (Ffile_attributes): Use INTEGER_TO_CONS.
4625 * fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER.
4626 * font.c (Ffont_variation_glyphs):
4627 * fontset.c (Finternal_char_font): Use INTEGER_TO_CONS.
4628 * lisp.h: Include <intprops.h>.
4629 (INTEGER_TO_CONS, CONS_TO_INTEGER): New macros.
4630 (cons_to_signed, cons_to_unsigned): New decls.
4631 (long_to_cons, cons_to_long): Remove decls.
4632 * undo.c (record_first_change): Use INTEGER_TO_CONS.
4633 (Fprimitive_undo): Use CONS_TO_INTEGER.
4634 * xfns.c (Fx_window_property): Likewise.
4635 * xselect.c: Include <limits.h>.
4636 (x_own_selection, selection_data_to_lisp_data):
4637 Use INTEGER_TO_CONS.
4638 (x_handle_selection_request, x_handle_selection_clear)
4639 (x_get_foreign_selection, Fx_disown_selection_internal)
4640 (Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER.
4641 (lisp_data_to_selection_data): Use cons_to_unsigned.
4642 (x_fill_property_data): Use cons_to_signed.
4643 Report values out of range.
4644
4645 Check for buffer and string overflow more precisely.
4646 * buffer.h (BUF_BYTES_MAX): New macro.
4647 * lisp.h (STRING_BYTES_MAX): New macro.
4648 * alloc.c (Fmake_string):
4649 * character.c (string_escape_byte8):
4650 * coding.c (coding_alloc_by_realloc):
4651 * doprnt.c (doprnt):
4652 * editfns.c (Fformat):
4653 * eval.c (verror):
4654 Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM,
4655 since they may not be the same number.
4656 * editfns.c (Finsert_char):
4657 * fileio.c (Finsert_file_contents):
4658 Likewise for BUF_BYTES_MAX.
4659
4660 * image.c: Use ptrdiff_t, not int, for sizes.
4661 (slurp_file): Switch from int to ptrdiff_t.
4662 All uses changed.
4663 (slurp_file): Check that file size fits in both size_t (for
4664 malloc) and ptrdiff_t (for sanity and safety).
4665
4666 * fileio.c (Fverify_visited_file_modtime): Avoid time overflow
4667 if b->modtime has its maximal value.
4668
4669 * dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits.
4670
4671 Don't assume time_t can fit into int.
4672 * buffer.h (struct buffer.modtime): Now time_t, not int.
4673 * fileio.c (Fvisited_file_modtime): No need for time_t cast now.
4674 * undo.c (Fprimitive_undo): Use time_t, not int, for time_t value.
4675
4676 Minor fixes for signed vs unsigned integers.
4677 * character.h (MAYBE_UNIFY_CHAR):
4678 * charset.c (maybe_unify_char):
4679 * keyboard.c (read_char, reorder_modifiers):
4680 XINT -> XFASTINT, since the integer must be nonnegative.
4681 * ftfont.c (ftfont_spec_pattern):
4682 * keymap.c (access_keymap, silly_event_symbol_error):
4683 XUINT -> XFASTINT, since the integer must be nonnegative.
4684 (Fsingle_key_description, preferred_sequence_p): XUINT -> XINT,
4685 since it makes no difference and we prefer signed.
4686 * keyboard.c (record_char): Use XUINT when all the neighbors do.
4687 (access_keymap): NATNUMP -> INTEGERP, since the integer must be
4688 nonnegative.
4689
4690 2011-06-06 Stefan Monnier <monnier@iro.umontreal.ca>
4691
4692 * window.h (Fwindow_frame): Declare.
4693
4694 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
4695
4696 * alloc.c: Simplify handling of large-request failures (Bug#8800).
4697 (SPARE_MEMORY): Always define.
4698 (LARGE_REQUEST): Remove.
4699 (memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST.
4700
4701 2011-06-06 Martin Rudalics <rudalics@gmx.at>
4702
4703 * lisp.h: Move EXFUNS for Fframe_root_window,
4704 Fframe_first_window and Fset_frame_selected_window to window.h.
4705
4706 * window.h: Move EXFUNS for Fframe_root_window,
4707 Fframe_first_window and Fset_frame_selected_window here from
4708 lisp.h.
4709
4710 * frame.c (Fwindow_frame, Fframe_first_window)
4711 (Fframe_root_window, Fframe_selected_window)
4712 (Fset_frame_selected_window): Move to window.c.
4713 (Factive_minibuffer_window): Move to minibuf.c.
4714 (Fother_visible_frames_p): New function.
4715
4716 * minibuf.c (Factive_minibuffer_window): Move here from frame.c.
4717
4718 * window.c (decode_window, decode_any_window): Move up in code.
4719 (Fwindowp, Fwindow_live_p): Rewrite doc-strings.
4720 (inhibit_frame_unsplittable): Remove unused variable.
4721 (Fwindow_buffer): Move up and rewrite doc-string.
4722 (Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next)
4723 (Fwindow_prev): New functions.
4724 (Fwindow_frame): Move here from frame.c. Accept any window as
4725 argument.
4726 (Fframe_root_window, Fframe_first_window)
4727 (Fframe_selected_window): Move here from frame.c. Accept frame
4728 or arbitrary window as argument. Update doc-strings.
4729 (Fminibuffer_window): Move up in code.
4730 (Fwindow_minibuffer_p): Move up in code and simplify.
4731 (Fset_frame_selected_window): Move here from frame.c.
4732 Marginal rewrite.
4733 (Fselected_window, select_window, Fselect_window): Move up in
4734 code. Minor doc-string fixes.
4735
4736 2011-06-06 Paul Eggert <eggert@cs.ucla.edu>
4737
4738 * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacOS (Bug#8800).
4739 Do not assume that spare memory exists; that assumption is valid
4740 only if SYSTEM_MALLOC.
4741 (LARGE_REQUEST): New macro, so that the issue of large requests
4742 is separated from the issue of spare memory.
4743
4744 2011-06-05 Andreas Schwab <schwab@linux-m68k.org>
4745
4746 * editfns.c (Fformat): Correctly handle zero flag with hexadecimal
4747 format. (Bug#8806)
4748
4749 * gtkutil.c (xg_get_default_scrollbar_width): Avoid warning.
4750
4751 * xfns.c (x_set_scroll_bar_default_width): Move declarations
4752 before statements.
4753
4754 2011-06-05 Jan Djärv <jan.h.d@swipnet.se>
4755
4756 * gtkutil.c (xg_get_default_scrollbar_width): New function.
4757
4758 * gtkutil.h: Declare xg_get_default_scrollbar_width.
4759
4760 * xfns.c (x_set_scroll_bar_default_width): If USE_GTK, get
4761 min width by calling x_set_scroll_bar_default_width (Bug#8505).
4762
4763 2011-06-05 Juanma Barranquero <lekktu@gmail.com>
4764
4765 * xdisp.c (single_display_spec_intangible_p): Remove declaration.
4766
4767 2011-06-04 Chong Yidong <cyd@stupidchicken.com>
4768
4769 * xselect.c (x_clipboard_manager_save): Remove redundant arg.
4770 (x_clipboard_manager_save): Add return value.
4771 (x_clipboard_manager_error_1, x_clipboard_manager_error_2):
4772 New error handlers.
4773 (x_clipboard_manager_save_frame, x_clipboard_manager_save_all):
4774 Obey Vx_select_enable_clipboard_manager. Catch errors in
4775 x_clipboard_manager_save (Bug#8779).
4776 (Vx_select_enable_clipboard_manager): New variable.
4777 (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790).
4778
4779 2011-06-04 Dan Nicolaescu <dann@ics.uci.edu>
4780
4781 * emacs.c (main): Warn when starting a GTK emacs in daemon mode.
4782
4783 2011-06-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
4784
4785 * fringe.c (update_window_fringes): Don't update overlay arrow bitmap
4786 in the current matrix if keep_current_p is non-zero.
4787
4788 2011-06-04 Eli Zaretskii <eliz@gnu.org>
4789
4790 * bidi.c (bidi_level_of_next_char): Fix last change.
4791
4792 2011-06-03 Eli Zaretskii <eliz@gnu.org>
4793
4794 Support bidi reordering of text covered by display properties.
4795
4796 * bidi.c (bidi_copy_it): Use offsetof instead of emulating it.
4797 (bidi_fetch_char, bidi_fetch_char_advance): New functions.
4798 (bidi_cache_search, bidi_cache_iterator_state)
4799 (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak)
4800 (bidi_level_of_next_char, bidi_move_to_visually_next):
4801 Support character positions inside a run of characters covered by a
4802 display string.
4803 (bidi_paragraph_init, bidi_resolve_explicit_1)
4804 (bidi_level_of_next_char): Call bidi_fetch_char and
4805 bidi_fetch_char_advance instead of FETCH_CHAR and
4806 FETCH_CHAR_ADVANCE.
4807 (bidi_init_it): Initialize new members.
4808 (LRE_CHAR, RLE_CHAR, PDF_CHAR, LRO_CHAR, RLO_CHAR): Remove macro
4809 definitions.
4810 (bidi_explicit_dir_char): Lookup character type in bidi_type_table,
4811 instead of using explicit *_CHAR codes.
4812 (bidi_resolve_explicit, bidi_resolve_weak):
4813 Use FETCH_MULTIBYTE_CHAR instead of FETCH_CHAR, as reordering of
4814 bidirectional text is supported only in multibyte buffers.
4815 (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use
4816 it to initialize the frame_window_p member of struct bidi_it.
4817 (bidi_cache_iterator_state, bidi_resolve_explicit_1)
4818 (bidi_resolve_explicit, bidi_resolve_weak)
4819 (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if
4820 bidi_it->nchars is non-positive.
4821 (bidi_level_of_next_char): Don't try to lookup the cache for the
4822 next/previous character if nothing is cached there yet, or if we
4823 were just reseat()'ed to a new position.
4824
4825 * xdisp.c (set_cursor_from_row): Set start and stop points
4826 according to the row's direction when priming the loop that looks
4827 for the glyph on which to display cursor.
4828 (single_display_spec_intangible_p): Function deleted.
4829 (display_prop_intangible_p): Reimplement to call
4830 handle_display_spec instead of single_display_spec_intangible_p.
4831 Accept 3 additional arguments needed by handle_display_spec.
4832 This fixes incorrect cursor motion across display property with complex
4833 values: lists, `(when COND...)' forms, etc.
4834 (single_display_spec_string_p): Support property values that are
4835 lists with the argument STRING its top-level element.
4836 (display_prop_string_p): Fix the condition for processing a
4837 property that is a list to be consistent with handle_display_spec.
4838 (handle_display_spec): New function, refactored from the
4839 last portion of handle_display_prop.
4840 (compute_display_string_pos): Accept additional argument
4841 FRAME_WINDOW_P. Call handle_display_spec to determine whether the
4842 value of a `display' property is a "replacing spec".
4843 (handle_single_display_spec): Accept 2 additional arguments BUFPOS
4844 and FRAME_WINDOW_P. If IT is NULL, don't set up the iterator from
4845 the display property, but just return a value indicating whether
4846 the display property will replace the characters it covers.
4847 (Fcurrent_bidi_paragraph_direction): Initialize the nchars and
4848 frame_window_p members of struct bidi_it.
4849 (compute_display_string_pos, compute_display_string_end):
4850 New functions.
4851 (push_it): Accept second argument POSITION, where pop_it should
4852 jump to continue iteration.
4853 (reseat_1): Initialize bidi_it.disp_pos.
4854
4855 * keyboard.c (adjust_point_for_property): Adjust the call to
4856 display_prop_intangible_p to its new signature.
4857
4858 * dispextern.h (struct bidi_it): New member frame_window_p.
4859 (bidi_init_it): Update prototypes.
4860 (display_prop_intangible_p): Update prototype.
4861 (compute_display_string_pos, compute_display_string_end):
4862 Declare prototypes.
4863 (struct bidi_it): New members nchars and disp_pos. ch_len is now
4864 EMACS_INT.
4865
4866 2011-06-02 Paul Eggert <eggert@cs.ucla.edu>
4867
4868 Malloc failure behavior now depends on size of allocation.
4869 * alloc.c (buffer_memory_full, memory_full): New arg NBYTES.
4870 * lisp.h: Change signatures accordingly.
4871 * alloc.c, buffer.c, editfns.c, menu.c, minibuf.c, xterm.c:
4872 All callers changed. (Bug#8762)
4873
4874 * gnutls.c: Use Emacs's memory allocators.
4875 Without this change, the gnutls library would invoke malloc etc.
4876 directly, which causes problems on non-SYNC_INPUT hosts, and which
4877 runs afoul of improving memory_full behavior. (Bug#8761)
4878 (fn_gnutls_global_set_mem_functions): New macro or function pointer.
4879 (emacs_gnutls_global_init): Use it to specify xmalloc, xrealloc,
4880 xfree instead of the default malloc, realloc, free.
4881 (Fgnutls_boot): No need to check for memory allocation failure,
4882 since xmalloc does that for us.
4883
4884 Remove arbitrary limit of 2**31 entries in hash tables. (Bug#8771)
4885 * category.c (hash_get_category_set):
4886 * ccl.c (ccl_driver):
4887 * charset.c (Fdefine_charset_internal):
4888 * charset.h (struct charset.hash_index):
4889 * composite.c (get_composition_id, gstring_lookup_cache)
4890 (composition_gstring_put_cache):
4891 * composite.h (struct composition.hash_index):
4892 * dispextern.h (struct image.hash):
4893 * fns.c (next_almost_prime, larger_vector, cmpfn_eql)
4894 (cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql)
4895 (hashfn_equal, hashfn_user_defined, make_hash_table)
4896 (maybe_resize_hash_table, hash_lookup, hash_put)
4897 (hash_remove_from_table, hash_clear, sweep_weak_table, SXHASH_COMBINE)
4898 (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector)
4899 (Fsxhash, Fgethash, Fputhash, Fmaphash):
4900 * image.c (make_image, search_image_cache, lookup_image)
4901 (xpm_put_color_table_h):
4902 * lisp.h (struct Lisp_Hash_Table):
4903 * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion):
4904 * print.c (print): Use 'EMACS_UINT' and 'EMACS_INT'
4905 for hashes and hash indexes, instead of 'unsigned' and 'int'.
4906 * alloc.c (allocate_vectorlike):
4907 Check for overflow in vector size calculations.
4908 * ccl.c (ccl_driver):
4909 Check for overflow when converting EMACS_INT to int.
4910 * fns.c, image.c: Remove unnecessary static decls that would otherwise
4911 need to be updated by these changes.
4912 * fns.c (make_hash_table, maybe_resize_hash_table):
4913 Check for integer overflow with large hash tables.
4914 (make_hash_table, maybe_resize_hash_table, Fmake_hash_table):
4915 Prefer the faster XFLOAT_DATA to XFLOATINT where either will do.
4916 (SXHASH_REDUCE): New macro.
4917 (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector):
4918 Use it instead of discarding useful hash info with large hash values.
4919 (sxhash_float): New function.
4920 (sxhash): Use it. No more need for "& INTMASK" due to above changes.
4921 * lisp.h (FIXNUM_BITS): New macro, useful for SXHASH_REDUCE etc.
4922 (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK):
4923 Rewrite to use FIXNUM_BITS, as this simplifies things.
4924 (next_almost_prime, larger_vector, sxhash, hash_lookup, hash_put):
4925 Adjust signatures to match updated version of code.
4926 (consing_since_gc): Now EMACS_INT, since a single hash table can
4927 use more than INT_MAX bytes.
4928
4929 2011-06-01 Dan Nicolaescu <dann@ics.uci.edu>
4930
4931 Make it possible to build with GCC-4.6+ -O2 -flto.
4932
4933 * emacs.c (__malloc_initialize_hook): Mark as EXTERNALLY_VISIBLE.
4934
4935 2011-06-01 Stefan Monnier <monnier@iro.umontreal.ca>
4936
4937 * minibuf.c (get_minibuffer, read_minibuf_unwind):
4938 Call minibuffer-inactive-mode.
4939
4940 2011-05-31 Juanma Barranquero <lekktu@gmail.com>
4941
4942 * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)):
4943 Update dependencies.
4944
4945 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
4946
4947 * data.c (init_data): Remove code for UTS, this system is not
4948 supported anymore.
4949
4950 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
4951
4952 Don't force ./temacs to start in terminal mode.
4953
4954 * frame.c (make_initial_frame): Initialize faces in all cases, not
4955 only when CANNOT_DUMP is defined.
4956 * dispnew.c (init_display): Remove CANNOT_DUMP condition.
4957
4958 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
4959
4960 * dispnew.c (add_window_display_history): Use const for the string
4961 pointer. Remove declaration, not needed.
4962
4963 2011-05-31 Paul Eggert <eggert@cs.ucla.edu>
4964
4965 Use 'inline', not 'INLINE'.
4966 <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00914.html>
4967 * alloc.c, fontset.c (INLINE): Remove.
4968 * alloc.c, bidi.c, charset.c, coding.c, dispnew.c, fns.c, image.c:
4969 * intervals.c, keyboard.c, process.c, syntax.c, textprop.c, w32term.c:
4970 * xdisp.c, xfaces.c, xterm.c: Replace all uses of INLINE with inline.
4971 * gmalloc.c (register_heapinfo): Use inline unconditionally.
4972 * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__.
4973
4974 2011-05-31 Dan Nicolaescu <dann@ics.uci.edu>
4975
4976 Make it possible to run ./temacs.
4977
4978 * callproc.c (set_initial_environment): Remove CANNOT_DUMP code,
4979 syms_of_callproc does the same thing. Remove test for
4980 "initialized", do it in the caller.
4981 * emacs.c (main): Avoid calling set_initial_environment when dumping.
4982
4983 2011-05-31 Stefan Monnier <monnier@iro.umontreal.ca>
4984
4985 * minibuf.c (Finternal_complete_buffer): Return `category' metadata.
4986 (read_minibuf): Use get_minibuffer.
4987 (syms_of_minibuf): Use DEFSYM.
4988 (Qmetadata): New var.
4989 * data.c (Qbuffer): Don't make it static.
4990 (syms_of_data): Use DEFSYM.
4991
4992 2011-05-31 Paul Eggert <eggert@cs.ucla.edu>
4993
4994 * ccl.c (CCL_CODE_RANGE): Allow negative numbers. (Bug#8751)
4995 (CCL_CODE_MIN): New macro.
4996
4997 2011-05-30 Paul Eggert <eggert@cs.ucla.edu>
4998
4999 * alloc.c (lisp_align_malloc): Omit unnecessary val==NULL tests.
5000
5001 * eval.c (Qdebug): Now static.
5002 * lisp.h (Qdebug): Remove decl. This reverts a part of the
5003 2011-04-26T11:26:05Z!dan.colascione@gmail.com that inadvertently undid part of
5004 2011-04-14T06:48:41Z!eggert@cs.ucla.edu.
5005
5006 2011-05-29 Chong Yidong <cyd@stupidchicken.com>
5007
5008 * image.c: Various fixes to ImageMagick code comments.
5009 (Fimagemagick_types): Doc fix.
5010
5011 2011-05-29 Paul Eggert <eggert@cs.ucla.edu>
5012
5013 Minor fixes prompted by GCC 4.6.0 warnings.
5014
5015 * xselect.c (converted_selections, conversion_fail_tag): Now static.
5016
5017 * emacs.c [HAVE_X_WINDOWS]: Include "xterm.h".
5018 (x_clipboard_manager_save_all): Move extern decl to ...
5019 * xterm.h: ... here, so that it can be checked for consistency.
5020
5021 2011-05-29 Chong Yidong <cyd@stupidchicken.com>
5022
5023 * xselect.c (x_clipboard_manager_save_frame)
5024 (x_clipboard_manager_save_all): New functions.
5025 (Fx_clipboard_manager_save): Lisp function deleted.
5026
5027 * emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all.
5028 * frame.c (delete_frame): Call x_clipboard_manager_save_frame.
5029
5030 * xterm.h: Update prototype.
5031
5032 2011-05-28 William Xu <william.xwl@gmail.com>
5033
5034 * nsterm.m (ns_term_shutdown): Synchronize user defaults before
5035 exiting (Bug#8239).
5036
5037 2011-05-28 Jim Meyering <meyering@redhat.com>
5038
5039 Avoid a sign-extension bug in crypto_hash_function.
5040 * fns.c (to_uchar): Define.
5041 (crypto_hash_function): Use it to convert some newly-signed
5042 variables to unsigned, to avoid sign-extension bugs. For example,
5043 without this change, (md5 "truc") would evaluate to
5044 45723a2aff78ff4fff7fff1114760e62 rather than the expected
5045 45723a2af3788c4ff17f8d1114760e62. Reported by Antoine Levitt in
5046 https://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00883.html.
5047
5048 2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
5049
5050 Integer overflow fixes.
5051
5052 * dbusbind.c: Serial number integer overflow fixes.
5053 (CHECK_DBUS_SERIAL_GET_SERIAL): New macro.
5054 (Fdbus_call_method_asynchronously, xd_read_message_1): Use a float
5055 to hold a serial number that is too large for a fixnum.
5056 (Fdbus_method_return_internal, Fdbus_method_error_internal):
5057 Check for serial numbers out of range. Decode any serial number
5058 that was so large that it became a float. (Bug#8722)
5059
5060 * dbusbind.c: Use XFASTINT rather than XUINT, and check for nonneg.
5061 (Fdbus_call_method, Fdbus_call_method_asynchronously):
5062 Use XFASTINT rather than XUINT when numbers are nonnegative.
5063 (xd_append_arg, Fdbus_method_return_internal):
5064 (Fdbus_method_error_internal): Likewise. Also, for unsigned
5065 arguments, check that Lisp number is nonnegative, rather than
5066 silently wrapping negative numbers around. (Bug#8722)
5067 (xd_read_message_1): Don't assume dbus_uint32_t can fit in int.
5068 (Bug#8722)
5069
5070 * data.c (arith_driver, Flsh): Avoid unnecessary casts to EMACS_UINT.
5071
5072 * ccl.c (ccl_driver): Redo slightly to avoid the need for 'unsigned'.
5073
5074 ccl: add integer overflow checks
5075 * ccl.c (CCL_CODE_MAX, GET_CCL_RANGE, GET_CCL_CODE, GET_CCL_INT):
5076 (IN_INT_RANGE): New macros.
5077 (ccl_driver): Use them to check for integer overflow when
5078 decoding a CCL program. Many of the new checks are whether XINT (x)
5079 fits in int; it doesn't always, on 64-bit hosts. The new version
5080 doesn't catch all possible integer overflows, but it's an
5081 improvement. (Bug#8719)
5082
5083 * alloc.c (make_event_array): Use XINT, not XUINT.
5084 There's no need for unsigned here.
5085
5086 * mem-limits.h (EXCEEDS_LISP_PTR) [!USE_LSB_TAG]: EMACS_UINT -> uintptr_t
5087 This follows up to the 2011-05-06 change that substituted uintptr_t
5088 for EMACS_INT. This case wasn't caught back then.
5089
5090 Rework Fformat to avoid integer overflow issues.
5091 * editfns.c: Include <float.h> unconditionally, as it's everywhere
5092 now (part of C89). Include <verify.h>.
5093 (MAX_10_EXP, CONVERTED_BYTE_SIZE): Remove; no longer needed.
5094 (pWIDE, pWIDElen, signed_wide, unsigned_wide): New defns.
5095 (Fformat): Avoid the prepass trying to compute sizes; it was only
5096 approximate and thus did not catch overflow reliably. Instead, walk
5097 through the format just once, formatting and computing sizes as we go,
5098 checking for integer overflow at every step, and allocating a larger
5099 buffer as needed. Keep track separately whether the format is
5100 multibyte. Keep only the most-recently calculated precision, rather
5101 than them all. Record whether each argument has been converted to
5102 string. Use EMACS_INT, not int, for byte and char and arg counts.
5103 Support field widths and precisions larger than INT_MAX. Avoid
5104 sprintf's undefined behavior with conversion specifications such as %#d
5105 and %.0c. Fix bug with strchr succeeding on '\0' when looking for
5106 flags. Fix bug with (format "%c" 256.0). Avoid integer overflow when
5107 formatting out-of-range floating point numbers with int
5108 formats. (Bug#8668)
5109
5110 * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN.
5111
5112 * data.c: Avoid integer truncation in expressions involving floats.
5113 * data.c: Include <intprops.h>.
5114 (arith_driver): When there's an integer overflow in an expression
5115 involving floating point, convert the integers to floating point
5116 so that the resulting value does not suffer from catastrophic
5117 integer truncation. For example, on a 64-bit host (* 4
5118 most-negative-fixnum 0.5) should yield about -4.6e+18, not zero.
5119 Do not rely on undefined behavior after integer overflow.
5120
5121 merge count_size_as_multibyte, parse_str_to_multibyte
5122 * character.c, character.h (count_size_as_multibyte):
5123 Rename from parse_str_to_multibyte; all uses changed.
5124 Check for integer overflow.
5125 * insdel.c, lisp.h (count_size_as_multibyte): Remove,
5126 since it's now a duplicate of the other. This is more of
5127 a character than a buffer op, so better that it's in character.c.
5128 * fns.c, print.c: Adjust to above changes.
5129
5130 2011-05-27 Stefan Monnier <monnier@iro.umontreal.ca>
5131
5132 * xselect.c (x_convert_selection): Yet another int/Lisp_Object mixup.
5133
5134 2011-05-27 Paul Eggert <eggert@cs.ucla.edu>
5135
5136 * xselect.c: Fix minor problems prompted by GCC 4.6.0 warnings.
5137 (x_handle_selection_request, frame_for_x_selection): Remove unused vars.
5138 (x_clipboard_manager_save): Now static.
5139 (Fx_clipboard_manager_save): Rename local to avoid shadowing.
5140
5141 * fns.c: Fix minor problems prompted by GCC 4.6.0 warnings.
5142 (crypto_hash_function): Now static.
5143 Fix pointer signedness problems. Avoid unnecessary initializations.
5144
5145 2011-05-27 Chong Yidong <cyd@stupidchicken.com>
5146
5147 * termhooks.h (Vselection_alist): Make it terminal-local.
5148
5149 * terminal.c (create_terminal): Initialize it.
5150
5151 * xselect.c: Support for clipboard managers.
5152 (Vselection_alist): Move to termhooks.h as terminal-local var.
5153 (LOCAL_SELECTION): New macro.
5154 (x_atom_to_symbol): Handle x_display_info_for_display fail case.
5155 (symbol_to_x_atom): Remove gratuitous arg.
5156 (x_handle_selection_request, lisp_data_to_selection_data)
5157 (x_get_foreign_selection, Fx_register_dnd_atom): Callers changed.
5158 (x_own_selection, x_get_local_selection, x_convert_selection):
5159 New arg, specifying work frame. Use terminal-local Vselection_alist.
5160 (some_frame_on_display): Delete unused function.
5161 (Fx_own_selection_internal, Fx_get_selection_internal)
5162 (Fx_disown_selection_internal, Fx_selection_owner_p)
5163 (Fx_selection_exists_p): New optional frame arg.
5164 (frame_for_x_selection, Fx_clipboard_manager_save): New functions.
5165 (x_handle_selection_clear): Don't treat other terminals with the
5166 same keyboard specially. Use the terminal-local Vselection_alist.
5167 (x_clear_frame_selections): Use Frun_hook_with_args.
5168
5169 * xterm.c (x_term_init): Intern ATOM and CLIPBOARD_MANAGER atoms.
5170
5171 * xterm.h: Add support for those atoms.
5172
5173 2011-05-26 Chong Yidong <cyd@stupidchicken.com>
5174
5175 * xselect.c: ICCCM-compliant handling of MULTIPLE targets.
5176 (converted_selections, conversion_fail_tag): New global variables.
5177 (x_selection_request_lisp_error): Free the above.
5178 (x_get_local_selection): Remove unnecessary code.
5179 (x_reply_selection_request): Args changed; handle arbitrary array
5180 of converted selections stored in converted_selections.
5181 Separate the XChangeProperty and SelectionNotify steps.
5182 (x_handle_selection_request): Rewrite to handle MULTIPLE target.
5183 (x_convert_selection): New function.
5184 (x_handle_selection_event): Simplify.
5185 (x_get_foreign_selection): Don't ignore incoming requests while
5186 waiting for an answer; this will fail when we implement
5187 SAVE_TARGETS, and seems unnecessary anyway.
5188 (selection_data_to_lisp_data): Recognize ATOM_PAIR type.
5189 (Vx_sent_selection_functions): Doc fix.
5190
5191 2011-05-26 Leo Liu <sdl.web@gmail.com>
5192
5193 * editfns.c (Ftranspose_regions): Allow empty regions. (Bug#8699)
5194
5195 2011-05-25 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
5196
5197 * dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p.
5198
5199 * dispnew.c (shift_glyph_matrix, scrolling_window): Mark scrolled row
5200 for fringe update if it has periodic bitmap.
5201 (row_equal_p): Also compare left_fringe_offset, right_fringe_offset,
5202 and fringe_bitmap_periodic_p.
5203
5204 * fringe.c (get_fringe_bitmap_data): New function.
5205 (draw_fringe_bitmap_1, update_window_fringes): Use it.
5206 (update_window_fringes): Record periodicity of fringe bitmap in glyph
5207 row. Mark glyph row for fringe update if periodicity changed.
5208
5209 * xdisp.c (try_window_reusing_current_matrix): Don't mark scrolled row
5210 for fringe update unless it has periodic bitmap.
5211
5212 2011-05-25 Kenichi Handa <handa@m17n.org>
5213
5214 * xdisp.c (get_next_display_element): Set correct it->face_id for
5215 a static composition.
5216
5217 2011-05-24 Leo Liu <sdl.web@gmail.com>
5218
5219 * deps.mk (fns.o):
5220 * makefile.w32-in ($(BLD)/fns.$(O)): Include sha1.h.
5221
5222 * fns.c (crypto_hash_function, Fsha1): New function.
5223 (Fmd5): Use crypto_hash_function.
5224 (syms_of_fns): Add Ssha1.
5225
5226 2011-05-22 Paul Eggert <eggert@cs.ucla.edu>
5227
5228 * gnutls.c: Remove unused macros.
5229 (fn_gnutls_transport_set_lowat, fn_gnutls_transport_set_pull_function):
5230 (fn_gnutls_transport_set_push_function) [!WINDOWSNT]:
5231 Remove macros that are defined and never used.
5232 Caught by gcc -Wunused-macros (GCC 4.6.0, Fedora 14).
5233
5234 2011-05-22 Chong Yidong <cyd@stupidchicken.com>
5235
5236 * xselect.c (syms_of_xselect): Remove unused symbol SAVE_TARGETS.
5237 (Fx_get_selection_internal): Minor cleanup.
5238 (Fx_own_selection_internal): Rename arguments for consistency with
5239 select.el.
5240
5241 2011-05-22 Paul Eggert <eggert@cs.ucla.edu>
5242
5243 * xselect.c (QSAVE_TARGETS): New static var, to fix build failure.
5244
5245 2011-05-22 Chong Yidong <cyd@stupidchicken.com>
5246
5247 * xselect.c (syms_of_xselect): Include character.h; use DEFSYM.
5248
5249 2011-05-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
5250
5251 * dispnew.c (scrolling_window): Don't exclude the case that the
5252 last enabled row in the desired matrix touches the bottom boundary.
5253
5254 2011-05-21 Glenn Morris <rgm@gnu.org>
5255
5256 * Makefile.in ($(etc)/DOC): Make second command line even shorter.
5257 (SOME_MACHINE_OBJECTS): Replace FONT_OBJ by its maximal expansion,
5258 and add some more files.
5259
5260 2011-05-20 Eli Zaretskii <eliz@gnu.org>
5261
5262 * callproc.c (Fcall_process) [MSDOS]: Fix arguments to
5263 report_file_error introduced by the change from 2011-05-07.
5264
5265 2011-05-20 Paul Eggert <eggert@cs.ucla.edu>
5266
5267 * systime.h (Time): Define only if emacs is defined.
5268 This is to allow ../lib-src/profile.c to be compiled on FreeBSD,
5269 where the include path doesn't have X11/X.h by default. See
5270 <http://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00561.html>.
5271
5272 2011-05-20 Kenichi Handa <handa@m17n.org>
5273
5274 * composite.c (find_automatic_composition): Fix previous change.
5275
5276 2011-05-20 Glenn Morris <rgm@gnu.org>
5277
5278 * lisp.mk: New file, split from Makefile.in.
5279 * Makefile.in (lisp): Move to separate file, inserted by @lisp_frag@.
5280 (shortlisp): Remove.
5281 ($(etc)/DOC): Edit lisp.mk rather than using $shortlisp.
5282
5283 2011-05-19 Glenn Morris <rgm@gnu.org>
5284
5285 * Makefile.in (MSDOS_SUPPORT_REAL, MSDOS_SUPPORT, NS_SUPPORT)
5286 (REAL_MOUSE_SUPPORT, GPM_MOUSE_SUPPORT, MOUSE_SUPPORT, TOOLTIP_SUPPORT)
5287 (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT, WINDOW_SUPPORT): Remove.
5288 (lisp): Set the order to that of loadup.el.
5289 (shortlisp): Make it a copy of $lisp.
5290 (SOME_MACHINE_LISP): Remove.
5291 ($(etc)/DOC): Depend just on $lisp, not $SOME_MACHINE_LISP too.
5292 Use just $shortlisp, not $SOME_MACHINE_LISP too.
5293
5294 2011-05-18 Kenichi Handa <handa@m17n.org>
5295
5296 * composite.c (CHAR_COMPOSABLE_P): Add more check for efficiency.
5297 (BACKWARD_CHAR): Wrap the arg STOP by parenthesis.
5298 (find_automatic_composition): Mostly rewrite for efficiency.
5299
5300 2011-05-18 Juanma Barranquero <lekktu@gmail.com>
5301
5302 * makefile.w32-in: Update dependencies.
5303
5304 2011-05-18 Christoph Scholtes <cschol2112@googlemail.com>
5305
5306 * menu.c: Include limits.h (fixes the MS-Windows build broken by
5307 2011-06-18T18:49:19Z!cyd@stupidchicken.com).
5308
5309 2011-05-18 Paul Eggert <eggert@cs.ucla.edu>
5310
5311 Fix some integer overflow issues, such as string length overflow.
5312
5313 * insdel.c (count_size_as_multibyte): Check for string overflow.
5314
5315 * character.c (lisp_string_width): Check for string overflow.
5316 Use EMACS_INT, not int, for string indexes and lengths; in
5317 particular, 2nd arg is now EMACS_INT, not int. Do not crash if
5318 the resulting string length overflows an EMACS_INT; instead,
5319 report a string overflow if no precision given. When checking for
5320 precision exhaustion, use a check that cannot possibly have
5321 integer overflow. (Bug#8675)
5322 * character.h (lisp_string_width): Adjust to new signature.
5323
5324 * alloc.c (string_overflow): New function.
5325 (Fmake_string): Use it. This doesn't change behavior, but saves
5326 a few bytes and will simplify future changes.
5327 * character.c (string_escape_byte8): Likewise.
5328 * lisp.h (string_overflow): New decl.
5329
5330 Fixups, following up to the user-interface timestamp change.
5331 * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time
5332 for UI timestamps, instead of unsigned long.
5333 * msdos.c (mouse_get_pos): Likewise.
5334 * w32inevt.c (movement_time, w32_console_mouse_position): Likewise.
5335 * w32gui.h (Time): Define by including "systime.h" rather than by
5336 declaring it ourselves. (Bug#8664)
5337
5338 * dispextern.h (struct image): Don't assume time_t <= unsigned long.
5339 * image.c (clear_image_cache): Likewise.
5340
5341 * term.c (term_mouse_position): Don't assume time_t wraparound.
5342
5343 Be more systematic about user-interface timestamps.
5344 Before, the code sometimes used 'Time', sometimes 'unsigned long',
5345 and sometimes 'EMACS_UINT', to represent these timestamps.
5346 This change causes it to use 'Time' uniformly, as that's what X uses.
5347 This makes the code easier to follow, and makes it easier to catch
5348 integer overflow bugs such as Bug#8664.
5349 * frame.c (Fmouse_position, Fmouse_pixel_position):
5350 Use Time, not unsigned long, for user-interface timestamps.
5351 * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise.
5352 (button_down_time, make_lispy_position, make_lispy_movement): Likewise.
5353 * keyboard.h (last_event_timestamp): Likewise.
5354 * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise.
5355 * menu.h (xmenu_show): Likewise.
5356 * term.c (term_mouse_position): Likewise.
5357 * termhooks.h (struct input_event.timestamp): Likewise.
5358 (struct terminal.mouse_position_hook): Likewise.
5359 * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise.
5360 * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise.
5361 * systime.h (Time): New decl. Pull it in from <X11/X.h> if
5362 HAVE_X_WINDOWS, otherwise define it as unsigned long, which is
5363 what it was before.
5364 * menu.h, termhooks.h: Include "systime.h", for Time.
5365
5366 * keyboard.c (make_lispy_event): Fix problem in integer overflow.
5367 Don't assume that the difference between two unsigned long values
5368 can fit into an integer. At this point, we know button_down_time
5369 <= event->timestamp, so the difference must be nonnegative, so
5370 there's no need to cast the result if double-click-time is
5371 nonnegative, as it should be; check that it's nonnegative, just in
5372 case. This bug is triggered when events are more than 2**31 ms
5373 apart (about 25 days). (Bug#8664)
5374
5375 * xselect.c (last_event_timestamp): Remove duplicate decl.
5376 (x_own_selection): Remove needless cast to unsigned long.
5377
5378 * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes
5379 that always fit in int. Use a sentinel instead of a counter, to
5380 avoid a temp and to allay GCC's concerns about possible int overflow.
5381 * frame.h (struct frame): Use int for menu_bar_items_used
5382 instead of EMACS_INT, since it always fits in int.
5383
5384 * menu.c (grow_menu_items): Check for int overflow.
5385
5386 * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils.
5387
5388 * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers.
5389 Before, the code was not consistent. These values cannot exceed
5390 2**31 - 1 so there's no need to make them unsigned.
5391 (x_x_to_emacs_modifiers): Accept int and return EMACS_INT.
5392 (x_emacs_to_x_modifiers): Accept EMACS_INT and return int.
5393 (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers
5394 as modifiers.
5395 * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change.
5396
5397 * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT.
5398 (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT.
5399 Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)),
5400 presumably because the widths might not match.
5401
5402 * window.c (size_window): Avoid needless test at loop start.
5403
5404 2011-05-18 Courtney Bane <emacs-bugs-7626@cbane.org> (tiny change)
5405
5406 * term.c (Fresume_tty): Restore hooks before reinitializing (bug#8687).
5407
5408 2011-05-12 Drew Adams <drew.adams@oracle.com>
5409
5410 * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655).
5411
5412 2011-05-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
5413
5414 * w32term.c (w32_draw_fringe_bitmap): Rename local vars `left' and
5415 `width' to `bar_area_x' and `bar_area_width', respectively.
5416 (x_scroll_run): Take account of fringe background extension.
5417
5418 * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]:
5419 Rename local vars `left' and `width' to `bar_area_x' and
5420 `bar_area_width', respectively.
5421 (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe
5422 background extension.
5423
5424 2011-05-10 Jim Meyering <meyering@redhat.com>
5425
5426 * xdisp.c (x_intersect_rectangles): Fix typo "the the -> the".
5427
5428 2011-05-10 Juanma Barranquero <lekktu@gmail.com>
5429
5430 * image.c (Finit_image_library): Return t for built-in image types,
5431 like pbm and xbm. (Bug#8640)
5432
5433 2011-05-09 Andreas Schwab <schwab@linux-m68k.org>
5434
5435 * w32menu.c (set_frame_menubar): Fix submenu allocation.
5436
5437 2011-05-07 Eli Zaretskii <eliz@gnu.org>
5438
5439 * w32console.c (Fset_screen_color): Doc fix.
5440 (Fget_screen_color): New function.
5441 (syms_of_ntterm): Defsubr it.
5442
5443 * callproc.c (call_process_cleanup) [MSDOS]: Don't close and
5444 unlink the temporary file if Fcall_process didn't create it in the
5445 first place.
5446 (Fcall_process) [MSDOS]: Don't create tempfile if stdout of the
5447 child process will be redirected to a file specified with `:file'.
5448 Don't try to re-open tempfile in that case, and set fd[0] to -1 as
5449 cue to call_process_cleanup not to close that handle.
5450
5451 2011-05-07 Ben Key <bkey76@gmail.com>
5452
5453 * makefile.w32-in: The bootstrap-temacs rule now makes use of
5454 one of two shell specific rules, either bootstrap-temacs-CMD or
5455 bootstrap-temacs-SH. The bootstrap-temacs-SH rule is identical
5456 to the previous implementation of the bootstrap-temacs rule.
5457 The bootstrap-temacs-CMD rule is similar to the previous
5458 implementation of the bootstrap-temacs rule except that it
5459 makes use of the ESC_CFLAGS variable instead of the CFLAGS
5460 variable.
5461
5462 These changes, along with some changes to nt/configure.bat,
5463 nt/gmake.defs, and nt/nmake.defs, are required to extend my
5464 earlier fix to add support for --cflags and --ldflags options
5465 that include quotes so that it works whether make uses cmd or
5466 sh as the shell.
5467
5468 2011-05-06 Michael Albinus <michael.albinus@gmx.de>
5469
5470 * dbusbind.c (QCdbus_type_unix_fd): Declare static.
5471 (xd_remove_watch): Don't check QCdbus_type_unix_fd for SYMBOLP, it
5472 is a constant.
5473 (Fdbus_init_bus, xd_read_queued_messages): Bus can be a symbol or
5474 a string. Handle both cases.
5475 (Fdbus_call_method_asynchronously, Fdbus_register_signal)
5476 (Fdbus_register_method): Use Qinvalid_function.
5477
5478 2011-05-06 Juanma Barranquero <lekktu@gmail.com>
5479
5480 * makefile.w32-in: Update dependencies.
5481 (LISP_H): Add inttypes.h and stdin.h.
5482 (PROCESS_H): Add unistd.h.
5483
5484 2011-05-06 Eli Zaretskii <eliz@gnu.org>
5485
5486 * lread.c: Include limits.h (fixes the MS-Windows build broken by
5487 2011-05-06T07:13:19Z!eggert@cs.ucla.edu).
5488
5489 2011-05-06 Paul Eggert <eggert@cs.ucla.edu>
5490
5491 * image.c (Finit_image_library) [!HAVE_NTGUI]: Omit unused local.
5492
5493 * term.c (vfatal): Remove stray call to va_end.
5494 It's not needed and the C Standard doesn't allow it here anyway.
5495
5496 Use C99's va_copy to avoid undefined behavior on x86-64 GNU/Linux.
5497 * eval.c (verror): doprnt a copy of ap, not the original. (Bug#8545)
5498
5499 * eval.c (verror): OK to create a string of up to MOST_POSITIVE_FIXNUM
5500 bytes.
5501
5502 * term.c: Don't include <stdarg.h>, as <lisp.h> does that.
5503
5504 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork clobbering.
5505
5506 * process.c (Fformat_network_address): Fix typo: args2 -> *args2.
5507
5508 * xmenu.c (set_frame_menubar): Fix typo: int * -> int (3 times).
5509
5510 * coding.c (detect_coding_charset): Fix typo: * 2 -> *4 (Bug#8601).
5511
5512 * charset.h (struct charset.code_space): Now has 15 elements, not 16.
5513 * charset.c (Fdefine_charset_internal): Don't initialize
5514 charset.code_space[15]. The value was garbage, on hosts with
5515 32-bit int (Bug#8600).
5516
5517 * lread.c (read_integer): Be more consistent with string-to-number.
5518 Use string_to_number to do the actual conversion; this avoids
5519 rounding errors and fixes some other screwups. Without this fix,
5520 for example, #x1fffffffffffffff was misread as -2305843009213693952.
5521 (digit_to_number): Move earlier, for benefit of read_integer.
5522 Return -1 if the digit is out of range for the base, -2 if it is
5523 not a digit in any supported base. (Bug#8602)
5524
5525 * doprnt.c (doprnt): Support arbitrary pI values, such as "I64".
5526
5527 * dispnew.c (scrolling_window): Return 1 if we scrolled,
5528 to match comment at start of function. This also removes a
5529 GCC warning about overflow in a 32+64-bit port.
5530
5531 * lisp.h (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Simplify.
5532
5533 * dbusbind.c: Do not use XPNTR on a value that may be an integer.
5534 Reported by Stefan Monnier in
5535 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00919.html>.
5536 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
5537 Use SYMBOLP-guarded XSYMBOL, not XPNTR.
5538
5539 * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t.
5540 (EMACS_UINTPTR): Likewise, with uintptr_t.
5541
5542 * lisp.h: Prefer 64-bit EMACS_INT if available.
5543 (EMACS_INT, EMACS_UINT, BITS_PER_EMACS_INT, pI): Define to 64-bit
5544 on 32-bit hosts that have 64-bit int, so that they can access
5545 large files.
5546 However, temporarily disable this change unless the temporary
5547 symbol WIDE_EMACS_INT is defined.
5548
5549 * lread.c, process.c: Do not include <inttypes.h>; lisp.h does it now.
5550
5551 Prefer intptr_t/uintptr_t for integers the same widths as pointers.
5552 This removes an assumption that EMACS_INT and long are the same
5553 width as pointers. The assumption is true for Emacs porting targets
5554 now, but we want to make other targets possible.
5555 * lisp.h: Include <inttypes.h>, for INTPTR_MAX, UINTPTR_MAX.
5556 (EMACS_INTPTR, EMACS_UINTPTR): New macros.
5557 In the rest of the code, change types of integers that hold casted
5558 pointers to EMACS_INTPTR and EMACS_UINTPTR, systematically
5559 replacing EMACS_INT, long, EMACS_UINT, and unsigned long.
5560 (XTYPE): Don't cast arg to EMACS_UINT; normally is not needed.
5561 (XSET): Cast type of XTYPE arg to EMACS_INTPTR; it is needed here.
5562 No need to cast type when ORing.
5563 (XPNTR): Return a value of type EMACS_INTPTR or EMACS_UINTPTR.
5564 * alloc.c (lisp_align_malloc): Remove a no-longer-needed cast.
5565 * doc.c (store_function_docstring): Use EMACS_INTPTR, so as not to
5566 assume EMACS_INT is the same width as char *.
5567 * gtkutil.c (xg_gtk_scroll_destroy, xg_tool_bar_button_cb):
5568 (xg_tool_bar_callback, xg_tool_bar_help_callback, xg_make_tool_item):
5569 Remove no-longer-needed casts.
5570 (xg_create_scroll_bar, xg_tool_bar_button_cb, xg_tool_bar_callback):
5571 (xg_tool_bar_help_callback, xg_make_tool_item):
5572 Use EMACS_INTPTR to hold an integer
5573 that will be cast to void *; this can avoid a GCC warning
5574 if EMACS_INT is not the same width as void *.
5575 * menu.c (find_and_call_menu_selection): Remove no-longer-needed cast.
5576 * xdisp.c (display_echo_area_1, resize_mini_window_1):
5577 (current_message_1, set_message_1):
5578 Use a local to convert to proper width without a cast.
5579 * xmenu.c (dialog_selection_callback): Likewise.
5580
5581 * sysdep.c (get_random): Don't assume EMACS_INT is no wider than long.
5582 Also, don't assume VALBITS / RAND_BITS is less than 5,
5583 and don't rely on undefined behavior when shifting a 1 left into
5584 the sign bit.
5585 * lisp.h (get_random): Change signature to match.
5586
5587 * lread.c (hash_string): Use size_t, not int, for hash computation.
5588 Normally we prefer signed values; but hashing is special, because
5589 it's better to use unsigned division on hash table sizes so that
5590 the remainder is nonnegative. Also, size_t is the natural width
5591 for hashing into memory. The previous code used 'int', which doesn't
5592 retain enough info to hash well into very large tables.
5593 (oblookup, oblookup_last_bucket_number, Funintern): Likewise.
5594
5595 * dbusbind.c: Don't possibly lose pointer info when converting.
5596 (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages):
5597 Use XPNTR rather than XHASH, so that the high-order bits of
5598 the pointer aren't lost when converting through void *.
5599
5600 * eval.c (Fautoload): Don't double-shift a pointer.
5601
5602 * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long.
5603
5604 2011-05-06 Juanma Barranquero <lekktu@gmail.com>
5605
5606 * gnutls.c (DEF_GNUTLS_FN):
5607 * image.c (DEF_IMGLIB_FN): Make function pointers static.
5608
5609 2011-05-05 Andreas Schwab <schwab@linux-m68k.org>
5610
5611 * lread.c (lisp_file_lexically_bound_p): Stop scanning at end
5612 marker. (Bug#8610)
5613
5614 2011-05-05 Eli Zaretskii <eliz@gnu.org>
5615
5616 * w32heap.c (allocate_heap) [USE_LISP_UNION_TYPE || USE_LSB_TAG]:
5617 New version that can reserve upto 2GB of heap space.
5618
5619 2011-05-05 Chong Yidong <cyd@stupidchicken.com>
5620
5621 * nsfns.m (Fns_read_file_name): Doc fix (Bug#8534).
5622
5623 2011-05-05 Teodor Zlatanov <tzz@lifelogs.com>
5624
5625 * gnutls.c (fn_gnutls_certificate_set_x509_key_file): Add alias to
5626 `gnutls_certificate_set_x509_key_file'.
5627
5628 2011-05-05 Juanma Barranquero <lekktu@gmail.com>
5629
5630 * makefile.w32-in ($(BLD)/image.$(O), $(BLD)/process.$(O)):
5631 Update dependencies.
5632
5633 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
5634
5635 * gnutls.h (emacs_gnutls_write, emacs_gnutls_read):
5636 * gnutls.c (emacs_gnutls_write, emacs_gnutls_read):
5637 Remove unused parameter `fildes'.
5638 * process.c (read_process_output, send_process): Don't pass it.
5639
5640 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
5641
5642 Fix previous change: the library cache is defined in w32.c.
5643 * image.c (CACHE_IMAGE_TYPE) [!HAVE_NTGUI]: Define to noop.
5644 (Finit_image_library): Wrap Vlibrary_cache on "#ifdef HAVE_NTGUI".
5645
5646 2011-05-04 Juanma Barranquero <lekktu@gmail.com>
5647
5648 Implement dynamic loading of GnuTLS on Windows.
5649
5650 * gnutls.h (GNUTLS_EMACS_ERROR_NOT_LOADED): New macro.
5651 (emacs_gnutls_write, emacs_gnutls_read): Mark as extern.
5652 (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
5653 Declare.
5654
5655 * gnutls.c (Qgnutls_dll): Define.
5656 (DEF_GNUTLS_FN, LOAD_GNUTLS_FN): New macros.
5657 (gnutls_*): Declare function pointers.
5658 (init_gnutls_functions): New function to initialize function pointers.
5659 (emacs_gnutls_handshake, Fgnutls_error_string, Fgnutls_deinit)
5660 (emacs_gnutls_global_init, Fgnutls_bye): Use function pointers.
5661 (emacs_gnutls_record_check_pending, emacs_gnutls_transport_set_errno):
5662 Wrappers for gnutls_record_check_pending and gnutls_transport_set_errno.
5663 (emacs_gnutls_write, emacs_gnutls_read)
5664 (emacs_gnutls_handle_error, Fgnutls_error_fatalp)
5665 (Fgnutls_available_p): New function.
5666 (Fgnutls_boot): Call Fgnutls_available_p. Use function pointers.
5667 (syms_of_gnutls) <Qgnutls_dll>: Initialize and staticpro it.
5668 (syms_of_gnutls) <Sgnutls_available_p>: defsubr it.
5669
5670 * image.c: Include w32.h.
5671 (Vimage_type_cache): Delete.
5672 (syms_of_image) <Vimage_type_cache>: Don't initialize and staticpro it.
5673 (CACHE_IMAGE_TYPE, Finit_image_library): Use Vlibrary_cache instead.
5674 (w32_delayed_load): Move to w32.c.
5675
5676 * w32.h (VlibraryCache, QCloaded_from, w32_delayed_load): Declare.
5677
5678 * w32.c (QCloaded_from, Vlibrary_cache): Define.
5679 (w32_delayed_load): Move from image.c. When loading a library, record
5680 its filename in the :loaded-from property of the library id.
5681 (globals_of_w32) <QCloaded_from, Vlibrary_cache>:
5682 Initialize and staticpro them.
5683 (emacs_gnutls_pull, emacs_gnutls_push): Call emacs_gnutls_* functions.
5684
5685 * process.c: Include lisp.h before w32.h, not after.
5686 (wait_reading_process_output): Call emacs_gnutls_record_check_pending
5687 instead of gnutls_record_check_pending.
5688
5689 * callproc.c, emacs.c: Include lisp.h before w32.h, not after.
5690
5691 2011-05-04 Teodor Zlatanov <tzz@lifelogs.com>
5692
5693 * gnutls.c (Fgnutls_boot): Support :keylist and :crlfiles options
5694 instead of :keyfiles. Give GnuTLS the keylist and the CRL lists
5695 as passed in.
5696
5697 2011-05-03 Jan Djärv <jan.h.d@swipnet.se>
5698
5699 * xterm.c (x_set_frame_alpha): Do not set property on anything
5700 else than FRAME_X_OUTER_WINDOW (Bug#8608).
5701
5702 2011-05-02 Juanma Barranquero <lekktu@gmail.com>
5703
5704 * sysdep.c (get_tty_size) [WINDOWSNT]: Implement. (Bug#8596)
5705
5706 2011-05-02 Juanma Barranquero <lekktu@gmail.com>
5707
5708 * gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon)
5709 (Qgnutls_x509pki, Qgnutls_e_interrupted, Qgnutls_e_again)
5710 (Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake)
5711 (gnutls_global_initialized, Qgnutls_bootprop_priority)
5712 (Qgnutls_bootprop_trustfiles, Qgnutls_bootprop_keyfiles)
5713 (Qgnutls_bootprop_callbacks, Qgnutls_bootprop_loglevel)
5714 (Qgnutls_bootprop_hostname, Qgnutls_bootprop_verify_flags)
5715 (Qgnutls_bootprop_verify_error, Qgnutls_bootprop_verify_hostname_error)
5716 (Qgnutls_bootprop_callbacks_verify): Make static.
5717
5718 2011-05-01 Andreas Schwab <schwab@linux-m68k.org>
5719
5720 * callproc.c: Indentation fixup.
5721
5722 * sysdep.c (wait_for_termination_1): Make static.
5723 (wait_for_termination, interruptible_wait_for_termination):
5724 Move after wait_for_termination_1.
5725
5726 2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org>
5727
5728 * sysdep.c (interruptible_wait_for_termination): New function
5729 which is like wait_for_termination, but allows keyboard
5730 interruptions.
5731
5732 * callproc.c (Fcall_process): Add (:file "file") as an option for
5733 the STDOUT buffer.
5734 (Fcall_process_region): Ditto.
5735
5736 2011-04-30 Eli Zaretskii <eliz@gnu.org>
5737
5738 * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)'
5739 rather than `XVECTOR (FOO)->size'.
5740
5741 * process.c: Remove HAVE_INTTYPES_H condition from inclusion of
5742 inttypes.h, as a gnulib replacement is used if it not available in
5743 system headers.
5744
5745 2011-04-21 Eli Zaretskii <eliz@gnu.org>
5746
5747 Lift the MOST_POSITIVE_FIXNUM/4 limitation on visited files.
5748 * fileio.c (Finsert_file_contents): Don't limit file size to 1/4
5749 of MOST_POSITIVE_FIXNUM. (Bug#8528)
5750
5751 * coding.c (coding_alloc_by_realloc): Error out if destination
5752 will grow beyond MOST_POSITIVE_FIXNUM.
5753 (decode_coding_emacs_mule): Abort if there isn't enough place in
5754 charbuf for the composition carryover bytes. Reserve an extra
5755 space for up to 2 characters produced in a loop.
5756 (decode_coding_iso_2022): Abort if there isn't enough place in
5757 charbuf for the composition carryover bytes.
5758
5759 2011-04-21 Eli Zaretskii <eliz@gnu.org>
5760
5761 * doprnt.c (doprnt) [!HAVE_LONG_LONG_INT]: Error out instead of
5762 aborting when %lld or %lll format is passed.
5763 [!HAVE_UNSIGNED_LONG_LONG_INT]: Error out instead of aborting when
5764 %llo or %llx format is passed. (Bug#8545)
5765
5766 * window.c (window_scroll_line_based): Use a marker instead of
5767 simple variables to record original value of point. (Bug#7952)
5768
5769 * doprnt.c (doprnt): Fix the case where a multibyte sequence
5770 produced by %s or %c overflows available buffer space. (Bug#8545)
5771
5772 2011-04-28 Paul Eggert <eggert@cs.ucla.edu>
5773
5774 * doprnt.c (doprnt): Omit useless test; int overflow check (Bug#8545).
5775 (SIZE_MAX): Move defn after all includes, as they might #define it.
5776
5777 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
5778
5779 * w32.c (init_environment): Warn about defaulting HOME to C:\.
5780
5781 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
5782
5783 * keyboard.c (Qdelayed_warnings_hook): Define.
5784 (command_loop_1): Run `delayed-warnings-hook'
5785 if Vdelayed_warnings_list is non-nil.
5786 (syms_of_keyboard) <delayed-warnings-hook>: DEFSYM it.
5787 (syms_of_keyboard) <delayed-warnings-list>: DEFVAR_LISP it.
5788
5789 2011-04-28 Eli Zaretskii <eliz@gnu.org>
5790
5791 * doprnt.c (doprnt): Don't return value smaller than the buffer
5792 size if the message was truncated. (Bug#8545).
5793
5794 2011-04-28 Juanma Barranquero <lekktu@gmail.com>
5795
5796 * w32fns.c (Fx_change_window_property, Fx_delete_window_property)
5797 (Fx_window_property): #if-0 the whole functions, not just the bodies.
5798
5799 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
5800
5801 * doprnt.c (doprnt): Support "ll" length modifier, for long long.
5802
5803 2011-04-27 Juanma Barranquero <lekktu@gmail.com>
5804
5805 * makefile.w32-in: Update dependencies.
5806
5807 2011-04-27 Eli Zaretskii <eliz@gnu.org>
5808
5809 Improve `doprnt' and its usage. (Bug#8545)
5810 * doprnt.c (doprnt): Make sure `format' is never accessed beyond
5811 `format_end'. Remove support for %l as a conversion specifier.
5812 Don't use xrealloc. Improve diagnostics when the %l size modifier
5813 is used. Update the commentary.
5814
5815 * eval.c (verror): Simplify calculation of size_t.
5816
5817 * coding.c (Ffind_operation_coding_system): Fix diagnostic error
5818 messages.
5819
5820 2011-04-27 Yoshiaki Kasahara <kasahara@nc.kyushu-u.ac.jp> (tiny change)
5821
5822 * buffer.c (init_buffer) [USE_MMAP_FOR_BUFFERS]: Adjust to aliasing
5823 change.
5824
5825 2011-04-27 Paul Eggert <eggert@cs.ucla.edu>
5826
5827 * nsmenu.m: Replace all uses of XVECTOR with ASIZE and AREF.
5828 This makes this file independent of the recent pseudovector change.
5829
5830 2011-04-26 Paul Eggert <eggert@cs.ucla.edu>
5831
5832 * keyboard.c (handle_user_signal): Fix pointer signedness problem.
5833
5834 * gnutls.c (emacs_gnutls_handle_error): Remove unused local.
5835 (Fgnutls_boot): gnutls_certificate_verify_peers2 wants unsigned *.
5836 Remove unused local.
5837 (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0.
5838
5839 * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546)
5840 GCC 4.6.0 optimizes based on type-based alias analysis.
5841 For example, if b is of type struct buffer * and v of type struct
5842 Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size
5843 != &v->size, and therefore "v->size = 1; b->size = 2; return
5844 v->size;" must therefore return 1. This assumption is incorrect
5845 for Emacs, since it type-puns struct Lisp_Vector * with many other
5846 types. To fix this problem, this patch adds a new type struct
5847 vectorlike_header that documents the constraints on layout of vectors
5848 and pseudovectors, and helps optimizing compilers not get fooled
5849 by Emacs's type punning. It also adds the macros XSETTYPED_PVECTYPE
5850 XSETTYPED_PSEUDOVECTOR, TYPED_PSEUDOVECTORP, for similar reasons.
5851 * lisp.h (XSETTYPED_PVECTYPE): New macro, specifying the name of
5852 the size member.
5853 (XSETPVECTYPE): Rewrite in terms of new macro.
5854 (XSETPVECTYPESIZE): New macro, specifying both type and size.
5855 This is a bit clearer, and further avoids the possibility of
5856 undesirable aliasing.
5857 (XSETTYPED_PSEUDOVECTOR): New macro, specifying the size.
5858 (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR.
5859 (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE,
5860 since Lisp_Subr is a special case (no "next" field).
5861 (ASIZE): Now uses header.size rather than size.
5862 All previous uses of XVECTOR (foo)->size replaced to use this macro,
5863 to avoid the hassle of writing XVECTOR (foo)->header.size.
5864 (struct vectorlike_header): New type.
5865 (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the
5866 object, to help avoid aliasing.
5867 (PSEUDOVECTORP): Rewrite in terms of TYPED_PSEUDOVECTORP.
5868 (SUBRP): Likewise, since Lisp_Subr is a special case.
5869 * lisp.h (struct Lisp_Vector, struct Lisp_Char_Table):
5870 (struct Lisp_Sub_Char_Table, struct Lisp_Bool_Vector):
5871 (struct Lisp_Hash_Table): Combine first two members into a single
5872 struct vectorlike_header member. All uses of "size" and "next" members
5873 changed to be "header.size" and "header.next".
5874 * buffer.h (struct buffer): Likewise.
5875 * font.h (struct font_spec, struct font_entity, struct font): Likewise.
5876 * frame.h (struct frame): Likewise.
5877 * process.h (struct Lisp_Process): Likewise.
5878 * termhooks.h (struct terminal): Likewise.
5879 * window.c (struct save_window_data, struct saved_window): Likewise.
5880 * window.h (struct window): Likewise.
5881 * alloc.c (allocate_buffer, Fmake_bool_vector, allocate_pseudovector):
5882 Use XSETPVECTYPESIZE, not XSETPVECTYPE, to avoid aliasing problems.
5883 * buffer.c (init_buffer_once): Likewise.
5884 * lread.c (defsubr): Use XSETTYPED_PVECTYPE, since Lisp_Subr is a
5885 special case.
5886 * process.c (Fformat_network_address): Use local var for size,
5887 for brevity.
5888
5889 * bytecode.c (exec_byte_code): Don't use XVECTOR before CHECK_VECTOR.
5890
5891 Make the Lisp reader and string-to-float more consistent (Bug#8525)
5892 * data.c (atof): Remove decl; no longer used or needed.
5893 (digit_to_number): Move to lread.c.
5894 (Fstring_to_number): Use new string_to_number function, to be
5895 consistent with how the Lisp reader treats infinities and NaNs.
5896 Do not assume that floating-point numbers represent EMACS_INT
5897 without losing information; this is not true on most 64-bit hosts.
5898 Avoid double-rounding errors, by insisting on integers when
5899 parsing non-base-10 numbers, as the documentation specifies.
5900 * lisp.h (string_to_number): New decl, replacing ...
5901 (isfloat_string): Remove.
5902 * lread.c: Include <inttypes.h>, for uintmax_t and strtoumax.
5903 (read1): Do not accept +. and -. as integers; this
5904 appears to have been a coding error. Similarly, do not accept
5905 strings like +-1e0 as floating point numbers. Do not report
5906 overflow for integer overflows unless the base is not 10 which
5907 means we have no simple and reliable way to continue.
5908 Break out the floating-point parsing into a new
5909 function string_to_number, so that Fstring_to_number parses
5910 floating point numbers consistently with the Lisp reader.
5911 (digit_to_number): Move here from data.c. Make it static inline.
5912 (E_CHAR, EXP_INT): Remove, replacing with ...
5913 (E_EXP): New macro, to solve the "1.0e+" problem mentioned below.
5914 (string_to_number): New function, replacing isfloat_string.
5915 This function checks for valid syntax and produces the resulting
5916 Lisp float number too. Rework it so that string-to-number
5917 no longer mishandles examples like "1.0e+". Use strtoumax,
5918 so that overflow for non-base-10 numbers is reported only when
5919 there's no portable and simple way to convert to floating point.
5920
5921 * textprop.c (set_text_properties_1): Rewrite for clarity,
5922 and to avoid GCC warning about integer overflow.
5923
5924 * intervals.h (struct interval): Use EMACS_INT for members
5925 where EMACS_UINT might cause problems. See
5926 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html>.
5927 (CHECK_TOTAL_LENGTH): Remove cast to EMACS_INT; no longer needed.
5928 * intervals.c (interval_deletion_adjustment): Now returns EMACS_INT.
5929 All uses changed.
5930 (offset_intervals): Tell GCC not to worry about length overflow
5931 when negating a negative length.
5932
5933 * alloc.c (overrun_check_malloc, overrun_check_realloc): Now static.
5934 (overrun_check_free): Likewise.
5935
5936 * alloc.c (SDATA_SIZE) [!GC_CHECK_STRING_BYTES]: Avoid runtime check
5937 in the common case where SDATA_DATA_OFFSET is a multiple of Emacs
5938 word size.
5939
5940 * gnutls.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
5941 (gnutls_make_error): Rename local to avoid shadowing.
5942 (gnutls_emacs_global_deinit): ifdef out; not used.
5943 (Fgnutls_boot): Use const for pointer to readonly storage.
5944 Comment out unused local. Fix pointer signedness problems.
5945
5946 * lread.c (openp): Don't stuff size_t into an 'int'.
5947 Use <= on length, not < on length + 1, to avoid GCC 4.6.0 warning
5948 about possible signed overflow.
5949
5950 * gtkutil.c: Fix problems found by GCC 4.6.0 on Ubuntu 10.10.
5951 (GDK_KEY_g): Don't define if already defined.
5952 (xg_prepare_tooltip): Avoid pointer signedness problem.
5953 (xg_set_toolkit_scroll_bar_thumb): Redo to avoid two casts.
5954
5955 * process.c (Fnetwork_interface_info): Avoid left-shift undefined
5956 behavior with 1 << 31. GCC 4.6.0 warns about this on 32-bit hosts.
5957
5958 * xfns.c (Fx_window_property): Simplify a bit,
5959 to make a bit faster and to avoid GCC 4.6.0 warning.
5960 * xselect.c (x_get_window_property, x_handle_dnd_message): Likewise.
5961
5962 * fns.c (internal_equal): Don't assume size_t fits in int.
5963
5964 * alloc.c (compact_small_strings): Tighten assertion a little.
5965
5966 Replace pEd with more-general pI, and fix some printf arg casts.
5967 * lisp.h (pI): New macro, generalizing old pEd macro to other
5968 conversion specifiers. For example, use "...%"pI"d..." rather
5969 than "...%"pEd"...".
5970 (pEd): Remove. All uses replaced with similar uses of pI.
5971 * src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h: Likewise.
5972 * alloc.c (check_pure_size): Don't overflow by converting size to int.
5973 * bidi.c (bidi_dump_cached_states): Use pI to avoid cast.
5974 * data.c (Fnumber_to_string): Use pI instead of if-then-else-abort.
5975 * dbusbind.c (xd_append_arg): Use pI to avoid cast.
5976 (Fdbus_method_return_internal, Fdbus_method_error_internal): Likewise.
5977 * font.c (font_unparse_xlfd): Avoid potential buffer overrun on
5978 64-bit hosts.
5979 (font_unparse_xlfd, font_unparse_fcname): Use pI to avoid casts.
5980 * keyboard.c (record_char, modify_event_symbol): Use pI to avoid casts.
5981 * print.c (safe_debug_print, print_object): Likewise.
5982 (print_object): Don't overflow by converting EMACS_INT or EMACS_UINT
5983 to int.
5984 Use pI instead of if-then-else-abort. Use %p to avoid casts,
5985 avoiding the 0 flag, which is not portable.
5986 * process.c (Fmake_network_process): Use pI to avoid cast.
5987 * region-cache.c (pp_cache): Likewise.
5988 * xdisp.c (decode_mode_spec): Likewise.
5989 * xrdb.c (x_load_resources) [USE_MOTIF]: Use pI to avoid undefined
5990 behavior on 64-bit hosts with printf arg.
5991 * xselect.c (x_queue_event): Use %p to avoid casts, avoiding 0 flag.
5992 (x_stop_queuing_selection_requests): Likewise.
5993 (x_get_window_property): Don't truncate byte count to an 'int'
5994 when tracing.
5995
5996 * frame.c (frame_name_fnn_p): Get rid of strtol, which isn't right
5997 here, since it parses constructs like leading '-' and spaces,
5998 which are not wanted; and it overflows with large numbers.
5999 Instead, simply match F[0-9]+, which is what is wanted anyway.
6000
6001 * alloc.c: Remove unportable assumptions about struct layout.
6002 (SDATA_SELECTOR, SDATA_DATA_OFFSET): New macros.
6003 (SDATA_OF_STRING, SDATA_SIZE, allocate_string_data):
6004 (allocate_vectorlike, make_pure_vector): Use the new macros,
6005 plus offsetof, to remove unportable assumptions about struct layout.
6006 These assumptions hold on all porting targets that I know of, but
6007 they are not guaranteed, they're easy to remove, and removing them
6008 makes further changes easier.
6009
6010 * alloc.c (BLOCK BYTES): Fix typo by changing "ablock" to "ablocks".
6011 This doesn't fix a bug but makes the code clearer.
6012 (string_overrun_cookie): Now const. Use initializers that
6013 don't formally overflow signed char, to avoid warnings.
6014 (allocate_string_data) [GC_CHECK_STRING_OVERRUN]: Fix typo that
6015 can cause Emacs to crash when string overrun checking is enabled.
6016 (allocate_buffer): Don't assume sizeof (struct buffer) is a
6017 multiple of sizeof (EMACS_INT); it need not be, if
6018 alignof(EMACS_INT) < sizeof (EMACS_INT).
6019 (check_sblock, check_string_bytes, check_string_free_list): Protoize.
6020
6021 2011-04-26 Juanma Barranquero <lekktu@gmail.com>
6022
6023 * keyboard.c (QCrtl): Rename from Qrtl. All uses changed.
6024
6025 2011-04-26 Teodor Zlatanov <tzz@lifelogs.com>
6026
6027 * gnutls.c (emacs_gnutls_handshake): Return an error if we're not
6028 supposed to be handshaking. (Bug#8556)
6029 Reported by Paul Eggert <eggert@cs.ucla.edu>.
6030
6031 2011-04-26 Daniel Colascione <dan.colascione@gmail.com>
6032
6033 * lisp.h (Qdebug): List symbol.
6034 * eval.c (Qdebug): Restore global linkage.
6035 * keyboard.c (debug-on-event): New variable.
6036 (handle_user_signal): Break into debugger when debug-on-event
6037 matches the current signal symbol.
6038
6039 2011-04-25 Dan Nicolaescu <dann@ics.uci.edu>
6040
6041 * alloc.c (check_sblock, check_string_bytes)
6042 (check_string_free_list): Convert to standard C.
6043
6044 2011-04-25 Teodor Zlatanov <tzz@lifelogs.com>
6045
6046 * w32.c (emacs_gnutls_push): Fix typo.
6047
6048 2011-04-25 Eli Zaretskii <eliz@gnu.org>
6049
6050 * gnutls.c (emacs_gnutls_handshake): Avoid compiler warnings about
6051 "cast to pointer from integer of different size".
6052
6053 Improve doprnt and its use in verror. (Bug#8545)
6054 * doprnt.c (doprnt): Document the set of format control sequences
6055 supported by the function. Use SAFE_ALLOCA instead of always
6056 using `alloca'.
6057
6058 * eval.c (verror): Don't limit the buffer size at size_max-1, that
6059 is one byte too soon. Don't use xrealloc; instead xfree and
6060 xmalloc anew.
6061
6062 2011-04-24 Teodor Zlatanov <tzz@lifelogs.com>
6063
6064 * gnutls.h: Add GNUTLS_STAGE_CALLBACKS enum to denote we're in the
6065 callbacks stage.
6066
6067 * gnutls.c: Renamed global_initialized to
6068 gnutls_global_initialized. Added internals for the
6069 :verify-hostname-error, :verify-error, and :verify-flags
6070 parameters of `gnutls-boot' and documented those parameters in the
6071 docstring. Start callback support.
6072 (emacs_gnutls_handshake): Add Woe32 support. Retry handshake
6073 unless a fatal error occurred. Call gnutls_alert_send_appropriate
6074 on error. Return error code.
6075 (emacs_gnutls_write): Call emacs_gnutls_handle_error.
6076 (emacs_gnutls_read): Likewise.
6077 (Fgnutls_boot): Return handshake error code.
6078 (emacs_gnutls_handle_error): New function.
6079 (wsaerror_to_errno): Likewise.
6080
6081 * w32.h (emacs_gnutls_pull): Add prototype.
6082 (emacs_gnutls_push): Likewise.
6083
6084 * w32.c (emacs_gnutls_pull): New function for GnuTLS on Woe32.
6085 (emacs_gnutls_push): Likewise.
6086
6087 2011-04-24 Claudio Bley <claudio.bley@gmail.com> (tiny change)
6088
6089 * process.c (wait_reading_process_output): Check if GnuTLS
6090 buffered some data internally if no FDs are set for TLS
6091 connections.
6092
6093 * makefile.w32-in (OBJ2): Add gnutls.$(O).
6094 (LIBS): Link to USER_LIBS.
6095 ($(BLD)/gnutls.$(0)): New target.
6096
6097 2011-04-24 Eli Zaretskii <eliz@gnu.org>
6098
6099 * xdisp.c (handle_single_display_spec): Rename the
6100 display_replaced_before_p argument into display_replaced_p, to
6101 make it consistent with the commentary. Fix typos in the
6102 commentary.
6103
6104 * textprop.c (syms_of_textprop): Remove dead code.
6105 (copy_text_properties): Delete obsolete commentary about an
6106 interface that was deleted long ago. Fix typos in the description
6107 of arguments.
6108
6109 * msdos.c (XMenuActivate, XMenuAddSelection): Adjust argument list
6110 to changes in oldXMenu/XMenu.h from 2011-04-16.
6111 <menu_help_message, prev_menu_help_message>: Constify.
6112 (IT_menu_make_room): menu->help_text is now `const char **';
6113 adjust.
6114
6115 * msdos.h (XMenuActivate, XMenuAddSelection): Adjust prototypes
6116 to changes in oldXMenu/XMenu.h from 2011-04-16.
6117 (struct XMenu): Declare `help_text' `const char **'.
6118
6119 * xfaces.c <Qunspecified>: Make extern again.
6120
6121 * syntax.c: Include sys/types.h before including regex.h, as
6122 required by Posix.
6123
6124 * doc.c (get_doc_string): Improve the format passed to `error'.
6125
6126 * doprnt.c (doprnt): Improve commentary.
6127
6128 * term.c (init_tty) [MSDOS]: Fix 1st argument to maybe_fatal.
6129
6130 * Makefile.in (TAGS): Depend on $(M_FILE) and $(S_FILE), and scan
6131 them with etags.
6132
6133 * makefile.w32-in (globals.h): Add a dummy recipe, to make any
6134 changes in globals.h immediately force recompilation.
6135 (TAGS): Depend on $(CURDIR)/m/intel386.h and
6136 $(CURDIR)/s/ms-w32.h.
6137 (TAGS-gmake): Scan $(CURDIR)/m/intel386.h and $(CURDIR)/s/ms-w32.h.
6138
6139 * character.c (Fchar_direction): Function deleted.
6140 (syms_of_character): Don't defsubr it.
6141 <char-direction-table>: Deleted.
6142
6143 2011-04-23 Eli Zaretskii <eliz@gnu.org>
6144
6145 Fix doprnt so it could be used again safely in `verror'. (Bug#8435)
6146 * doprnt.c: Include limits.h.
6147 (SIZE_MAX): New macro.
6148 (doprnt): Return a size_t value. 2nd arg is now size_t.
6149 Many local variables are now size_t instead of int or unsigned.
6150 Improve overflow protection. Support `l' modifier for integer
6151 conversions. Support %l conversion. Don't assume an EMACS_INT
6152 argument for integer conversions and for %c.
6153
6154 * lisp.h (doprnt): Restore prototype.
6155
6156 * makefile.w32-in ($(BLD)/callint.$(O)): Depend on
6157 $(SRC)/character.h.
6158
6159 * Makefile.in (base_obj): Add back doprnt.o.
6160
6161 * deps.mk (doprnt.o): Add back prerequisites.
6162 (callint.o): Depend on character.h.
6163
6164 * eval.c (internal_lisp_condition_case): Include the handler
6165 representation in the error message.
6166 (verror): Call doprnt instead of vsnprintf. Fix an off-by-one bug
6167 when breaking from the loop.
6168
6169 * xdisp.c (vmessage): Call doprnt instead of vsnprintf.
6170
6171 * callint.c (Fcall_interactively): When displaying error message
6172 about invalid control letter, pass the character's codepoint, not
6173 a pointer to its multibyte form. Improve display of the character
6174 in octal and display also its hex code.
6175
6176 * character.c (char_string): Use %x to display the (unsigned)
6177 codepoint of an invalid character, to avoid displaying a bogus
6178 negative value.
6179
6180 * font.c (check_otf_features): Pass SDATA of SYMBOL_NAME to
6181 `error', not SYMBOL_NAME itself.
6182
6183 * coding.c (Fencode_sjis_char, Fencode_big5_char): Use %c for
6184 character arguments to `error'.
6185
6186 * charset.c (check_iso_charset_parameter): Fix incorrect argument
6187 to `error' in error message about FINAL_CHAR argument. Make sure
6188 FINAL_CHAR is a character, and use %c when it is passed as
6189 argument to `error'.
6190
6191 2011-04-23 Eli Zaretskii <eliz@gnu.org>
6192
6193 * s/ms-w32.h (localtime): Redirect to sys_localtime.
6194
6195 * w32.c: Include <time.h>.
6196 (sys_localtime): New function.
6197
6198 2011-04-23 Chong Yidong <cyd@stupidchicken.com>
6199
6200 * xdisp.c (init_xdisp): Initialize echo_area_window (Bug#6451).
6201
6202 * buffer.c (syms_of_buffer): Doc fix (Bug#6902).
6203
6204 2011-04-23 Samuel Thibault <sthibault@debian.org> (tiny change)
6205
6206 * sysdep.c (wait_for_termination): On GNU Hurd, kill returns -1 on
6207 zombies (Bug#8467).
6208
6209 2011-04-19 Eli Zaretskii <eliz@gnu.org>
6210
6211 * syntax.h (SETUP_SYNTAX_TABLE_FOR_OBJECT): Fix setting of
6212 gl_state.e_property when gl_state.object is Qt.
6213
6214 * insdel.c (make_gap_larger): Remove limitation of buffer size
6215 to <= INT_MAX.
6216
6217 2011-04-18 Chong Yidong <cyd@stupidchicken.com>
6218
6219 * xdisp.c (lookup_glyphless_char_display)
6220 (produce_glyphless_glyph): Handle cons cell entry in
6221 glyphless-char-display.
6222 (Vglyphless_char_display): Document it.
6223
6224 * term.c (produce_glyphless_glyph): Handle cons cell entry in
6225 glyphless-char-display.
6226
6227 2011-04-17 Chong Yidong <cyd@stupidchicken.com>
6228
6229 * xdisp.c (get_next_display_element): Remove unnecessary ifdefs.
6230
6231 * termhooks.h (FRAME_WINDOW_P): Remove duplicated definitions.
6232
6233 * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): Add missing
6234 definition for no-X builds.
6235
6236 2011-04-16 Paul Eggert <eggert@cs.ucla.edu>
6237
6238 Static checks with GCC 4.6.0 and non-default toolkits.
6239
6240 * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
6241
6242 * process.c (keyboard_bit_set): Define only if SIGIO.
6243 (send_process_trap): Mark it with NO_RETURN if it doesn't return.
6244 (send_process): Repair possible setjmp clobbering.
6245
6246 * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
6247
6248 * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
6249
6250 * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
6251
6252 * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
6253 Define only if needed.
6254
6255 * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
6256 by pacifying GCC about it. Maybe it's time to retire it?
6257 * xfaces.c (USG, __TIMEVAL__): Likewise.
6258
6259 * dispextern.h (struct redisplay_interface): Rename param
6260 to avoid shadowing.
6261 * termhooks.h (struct terminal): Likewise.
6262 * xterm.c (xembed_send_message): Likewise.
6263
6264 * insdel.c (make_gap_smaller): Define only if
6265 USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
6266
6267 * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
6268 it.
6269
6270 * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
6271 so that we aren't warned about unused symbols.
6272
6273 * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
6274
6275 * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
6276
6277 * xfns.c (x_real_positions): Mark locals as initialized.
6278
6279 * xmenu.c (xmenu_show): Don't use uninitialized vars.
6280
6281 * xterm.c: Fix problems found by static analysis with other toolkits.
6282 (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
6283 (x_dispatch_event): Declare static if USE_GTK, and
6284 define if USE_GTK || USE_X_TOOLKIT.
6285 (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
6286 * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
6287 * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only
6288 if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
6289
6290 * xmenu.c (menu_help_callback): Pointer type fixes.
6291 Use const pointers when pointing at readonly data. Avoid pointer
6292 signedness clashes.
6293 (FALSE): Remove unused macro.
6294 (update_frame_menubar): Remove unused decl.
6295
6296 * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
6297
6298 * menu.c (push_submenu_start, push_submenu_end): Do not define unless
6299 USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
6300 (single_menu_item): Rename local to avoid shadowing.
6301
6302 * keyboard.c (make_lispy_event): Remove unused local var.
6303
6304 * frame.c, frame.h (x_get_resource_string): Bring this back, but
6305 only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
6306
6307 * bitmaps: Change bitmaps from unsigned char back to the X11
6308 compatible char. Avoid the old compiler warnings about
6309 out-of-range initializers by using, for example, '\xab' rather
6310 than 0xab.
6311
6312 * xgselect.c (xgselect_initialize): Check vs interface
6313 even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
6314
6315 * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
6316
6317 * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
6318 to read-only memory.
6319
6320 * fns.c (vector): Remove; this old hack is no longer needed.
6321
6322 * xsmfns.c (create_client_leader_window): Rename shadowing arg.
6323 Remove unused var.
6324 (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
6325
6326 * xrdb.c (x_load_resources): Omit unused local.
6327
6328 * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
6329 (x_window): Rename locals to avoid shadowing.
6330 (USG): Use the kludged USG macro, to pacify gcc.
6331
6332 * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
6333 (x_term_init): Remove local to avoid shadowing.
6334
6335 * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
6336
6337 * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
6338 USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
6339
6340 2011-04-16 Eli Zaretskii <eliz@gnu.org>
6341
6342 * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
6343
6344 Fix regex.c, syntax.c and friends for buffers > 2GB.
6345 * syntax.h (struct gl_state_s): Declare character position members
6346 EMACS_INT.
6347
6348 * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT.
6349
6350 * textprop.c (verify_interval_modification, interval_of):
6351 Declare arguments EMACS_INT.
6352
6353 * intervals.c (adjust_intervals_for_insertion): Declare arguments
6354 EMACS_INT.
6355
6356 * intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'.
6357
6358 * indent.c (Fvertical_motion): Local variable it_start is now
6359 EMACS_INT.
6360
6361 * regex.c (re_match, re_match_2, re_match_2_internal)
6362 (bcmp_translate, regcomp, regexec, print_double_string)
6363 (group_in_compile_stack, re_search, re_search_2, regex_compile)
6364 (re_compile_pattern, re_exec): Declare arguments and local
6365 variables `size_t' and `ssize_t' and return values `regoff_t', as
6366 appropriate.
6367 (POP_FAILURE_REG_OR_COUNT) <pfreg>: Declare `long'.
6368 (CHECK_INFINITE_LOOP) <failure>: Declare `ssize_t'.
6369 <compile_stack_type>: `size' and `avail' are now `size_t'.
6370
6371 * regex.h <regoff_t>: Use ssize_t, not int.
6372 (re_search, re_search_2, re_match, re_match_2): Arguments that
6373 specify buffer/string position and length are now ssize_t and
6374 size_t. Return type is regoff_t.
6375
6376 2011-04-16 Ben Key <bkey76@gmail.com>
6377
6378 * nsfont.m: Fixed bugs in ns_get_family and
6379 ns_descriptor_to_entity that were caused by using free to
6380 deallocate memory blocks that were allocated by xmalloc (via
6381 xstrdup). This caused Emacs to crash when compiled with
6382 XMALLOC_OVERRUN_CHECK defined (when Emacs was configured with
6383 --enable-checking=xmallocoverrun). xfree is now used to
6384 deallocate these memory blocks.
6385
6386 2011-04-15 Paul Eggert <eggert@cs.ucla.edu>
6387
6388 * sysdep.c (emacs_read): Remove unnecessary check vs MAX_RW_COUNT.
6389
6390 emacs_write: Accept and return EMACS_INT for sizes.
6391 See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html
6392 et seq.
6393 * gnutls.c, gnutls.h (emacs_gnutls_read, emacs_gnutls_write):
6394 Accept and return EMACS_INT.
6395 (emacs_gnutls_write): Return the number of bytes written on
6396 partial writes.
6397 * sysdep.c, lisp.h (emacs_read, emacs_write): Likewise.
6398 (emacs_read, emacs_write): Remove check for negative size, as the
6399 Emacs source code has been audited now.
6400 * sysdep.c (MAX_RW_COUNT): New macro, to work around kernel bugs.
6401 (emacs_read, emacs_write): Use it.
6402 * process.c (send_process): Adjust to the new signatures of
6403 emacs_write and emacs_gnutls_write. Do not attempt to store
6404 a byte offset into an 'int'; it might overflow.
6405 See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00483.html
6406
6407 * sound.c: Don't assume sizes fit in 'int'.
6408 (struct sound_device.period_size, alsa_period_size):
6409 Return EMACS_INT, not int.
6410 (struct sound_device.write, vox_write, alsa_write):
6411 Accept EMACS_INT, not int.
6412 (wav_play, au_play): Use EMACS_INT to store sizes and to
6413 record read return values.
6414
6415 2011-04-15 Ben Key <bkey76@gmail.com>
6416
6417 * keyboard.c (Qundefined): Don't declare static since it is used
6418 in nsfns.m.
6419 * xfaces.c (Qbold, Qexpanded, Qitalic, Qcondensed): Don't declare
6420 static since they are used in nsfont.m.
6421
6422 2011-04-15 Stefan Monnier <monnier@iro.umontreal.ca>
6423
6424 * process.c (Qprocessp): Don't declare static.
6425 * lisp.h (Qprocessp): Declare again.
6426
6427 2011-04-15 Juanma Barranquero <lekktu@gmail.com>
6428
6429 * font.c (Qopentype): Don't make static (used from w32uniscribe.c).
6430
6431 2011-04-14 Paul Eggert <eggert@cs.ucla.edu>
6432
6433 Improve C-level modularity by making more things 'static'.
6434
6435 Don't publish debugger-only interfaces to other modules.
6436 * lisp.h (safe_debug_print, debug_output_compilation_hack):
6437 (verify_bytepos, count_markers): Move decls to the only modules
6438 that need them.
6439 * region-cache.h (pp_cache): Likewise.
6440 * window.h (check_all_windows): Likewise.
6441 * marker.c, print.c, region-cache.c, window.c: Decls moved here.
6442
6443 * sysdep.c (croak): Now static, if
6444 defined TIOCNOTTY || defined USG5 || defined CYGWIN.
6445 * syssignal.h (croak): Declare only if not static.
6446
6447 * alloc.c (refill_memory_reserve): Now static if
6448 !defined REL_ALLOC || defined SYSTEM_MALLOC.
6449 * lisp.h (refill_memory_reserve): Declare only if not static.
6450
6451 * xsettings.c, xsettings.h (xsettings_get_system_normal_font):
6452 Define only if USE_LUCID.
6453
6454 * xrdb.c (x_customization_string, x_rm_string): Now static.
6455
6456 * xmenu.c (x_menu_wait_for_event): Export only if USE_MOTIF.
6457 * xterm.h (x_menu_wait_for_event): Declare only if USE_MOTIF.
6458
6459 * xdisp.c (draw_row_with_mouse_face): Now static.
6460 * dispextern.h (draw_row_with_mouse_fave): Remove decl.
6461
6462 * window.h (check_all_windows): Mark externally visible.
6463
6464 * window.c (window_deletion_count): Now static.
6465
6466 * undo.c: Make symbols static if they're not exported.
6467 (last_undo_buffer, last_boundary_position, pending_boundary):
6468 Now static.
6469
6470 * textprop.c (interval_insert_behind_hooks): Now static.
6471 (interval_insert_in_front_hooks): Likewise.
6472
6473 * term.c: Make symbols static if they're not exported.
6474 (tty_turn_off_highlight, get_tty_terminal, max_frame_cols):
6475 (max_frame_lines, tty_set_terminal_modes):
6476 (tty_reset_terminal_modes, tty_turn_off_highlight):
6477 (get_tty_terminal): Now static.
6478 (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM.
6479 * termhooks.h (term_mouse_moveto): Do not declare if
6480 HAVE_WINDOW_SYSTEM.
6481 * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes):
6482 (tty_turn_off_highlight, get_tty_terminal): Remove decls.
6483
6484 * sysdep.c: Make symbols static if they're not exported.
6485 (emacs_get_tty, emacs_set_tty, old_fcntl_flags, old_fcntl_owner):
6486 Now static.
6487 (sigprocmask_set, full_mask): Remove; unused.
6488 (wait_debugging): Mark as visible.
6489 * syssignal.h (SIGFULLMASK, full_mask): Remove decls.
6490 * systty.h (emacs_get_tty, emacs_set_tty): Remove decls.
6491
6492 * syntax.c (syntax_temp): Define only if !__GNUC__.
6493
6494 * sound.c (current_sound_device, current_sound): Now static.
6495
6496 * search.c (searchbufs, searchbuf_head): Now static.
6497
6498 * scroll.c (scroll_cost): Remove; unused.
6499 * dispextern.h (scroll_cost): Remove decl.
6500
6501 * region-cache.h (pp_cache): Mark as externally visible.
6502
6503 * process.c: Make symbols static if they're not exported.
6504 (process_tick, update_tick, create_process, chan_process):
6505 (Vprocess_alist, proc_buffered_char, datagram_access):
6506 (fd_callback_data, send_process_frame, process_sent_to): Now static.
6507 (deactivate_process): Mark defn as static, as well as decl.
6508 * lisp.h (create_process): Remove decl.
6509 * process.h (chan_process, Vprocess_alist): Remove decls.
6510
6511 * print.c: Make symbols static if they're not exported.
6512 (print_depth, new_backquote_output, being_printed, print_buffer):
6513 (print_buffer_size, print_buffer_pos, print_buffer_pos_byte):
6514 (print_interval, print_number_index, initial_stderr_stream):
6515 Now static.
6516 * lisp.h (Fprinc): Remove decl.
6517 (debug_output_compilation_hack): Mark as externally visible.
6518
6519 * sysdep.c (croak): Move decl from here to syssignal.h.
6520 * syssignal.h (croak): Put it here, so the API can be checked when
6521 'croak' is called from dissociate_if_controlling_tty.
6522
6523 * minibuf.c: Make symbols static if they're not exported.
6524 (minibuf_save_list, choose_minibuf_frame): Now static.
6525 * lisp.h (choose_minibuf_frame): Remove decl.
6526
6527 * lisp.h (verify_bytepos, count_markers): Mark as externally visible.
6528
6529 * lread.c: Make symbols static if they're not exported.
6530 (read_objects, initial_obarray, oblookup_last_bucket_number):
6531 Now static.
6532 (make_symbol): Remove; unused.
6533 * lisp.h (initial_obarray, make_symbol): Remove decls.
6534
6535 * keyboard.c: Make symbols static if they're not exported.
6536 (single_kboard, recent_keys_index, total_keys, recent_keys):
6537 (this_command_key_count_reset, raw_keybuf, raw_keybuf_count):
6538 (this_single_command_key_start, echoing, last_auto_save):
6539 (read_key_sequence_cmd, dribble, recursive_edit_unwind):
6540 (command_loop, echo_now, keyboard_init_hook, help_char_p):
6541 (quit_throw_to_read_char, command_loop_2, top_level_1, poll_timer):
6542 (Vlispy_mouse_stem, double_click_count):
6543 Now static.
6544 (force_auto_save_soon): Define only if SIGDANGER.
6545 (ignore_mouse_drag_p): Now static if
6546 !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS.
6547 (print_help): Remove; unused.
6548 (stop_character, last_timer_event): Mark as externally visible.
6549 * keyboard.h (ignore_mouse_drag_p): Declare only if
6550 defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS.
6551 (echo_now, help_char_p, quit_throw_to_read_char): Remove decls.
6552 * lisp.h (echoing): Remove decl.
6553 (force_auto_save_soon): Declare only if SIGDANGER.
6554 * xdisp.c (redisplay_window): Simplify code, to make it more
6555 obvious that ignore_mouse_drag_p is not accessed if !defined
6556 USE_GTK && !defined HAVE_NS.
6557
6558 * intervals.c: Make symbols static if they're not exported.
6559 (merge_properties_sticky, merge_interval_right, delete_interval):
6560 Now static.
6561 * intervals.h (merge_interval_right, delete_interval): Remove decls.
6562
6563 * insdel.c: Make symbols static if they're not exported.
6564 However, leave prepare_to_modify_buffer alone. It's never
6565 called from outside this function, but that appears to be a bug.
6566 (combine_after_change_list, combine_after_change_buffer):
6567 (adjust_after_replace, signal_before_change): Now static.
6568 (adjust_after_replace_noundo): Remove; unused.
6569 * lisp.h (adjust_after_replace, adjust_after_replace_noundo):
6570 (signal_before_change): Remove decls.
6571
6572 * indent.c (val_compute_motion, val_vmotion): Now static.
6573
6574 * image.c: Make symbols static if they're not exported.
6575 * dispextern.h (x_create_bitmap_from_xpm_data): Do not declare
6576 if USE_GTK.
6577 * image.c (x_create_bitmap_from_xpm_data): Do not define if USE_GTK.
6578 (xpm_color_cache, ct_table, ct_colors_allocated): Now static.
6579
6580 * fringe.c (standard_bitmaps): Now static.
6581 (max_used_fringe_bitmap): Now static, unless HAVE_NS.
6582
6583 * frame.c: Make symbols static if they're not exported.
6584 (x_report_frame_params, make_terminal_frame): Now static.
6585 (get_frame_param): Now static, unless HAVE_NS.
6586 (x_fullscreen_adjust): Define if WINDOWSNT, not if HAVE_WINDOW_SYSTEM.
6587 (x_get_resource_string): Remove; not used.
6588 * frame.h (make_terminal_frame, x_report_frame_params):
6589 (x_get_resource_string); Remove decls.
6590 (x_fullscreen_adjust): Declare only if WINDOWSNT.
6591 * lisp.h (get_frame_param): Declare only if HAVE_NS.
6592
6593 * font.c, fontset.c: Make symbols static if they're not exported.
6594 * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): New macro.
6595 (FACE_SUITABLE_FOR_CHAR_P): Use it.
6596 * font.c (font_close_object): Now static.
6597 * font.h (font_close_object): Remove.
6598 * fontset.c (FONTSET_OBJLIST): Remove.
6599 (free_realized_fontset) #if-0 the body, which does nothing.
6600 (face_suitable_for_char_p): #if-0, as it's never called.
6601 * fontset.h (face_suitable_for_char_p): Remove decl.
6602 * xfaces.c (face_at_string_position):
6603 Use FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P,
6604 since 0 is always ASCII.
6605
6606 * fns.c (weak_hash_tables): Now static.
6607
6608 * fileio.c: Make symbols static if they're not exported.
6609 (auto_saving, auto_save_mode_bits, auto_save_error_occurred):
6610 (Vwrite_region_annotation_buffers): Now static.
6611
6612 * eval.c: Make symbols static if they're not exported.
6613 (backtrace_list, lisp_eval_depth, when_entered_debugger): Now static.
6614 * lisp.h (backtrace_list): Remove decl.
6615
6616 * emacs.c: Make symbols static if they're not exported.
6617 (malloc_state_ptr, malloc_using_checking, syms_of_emacs):
6618 (fatal_error_code, fatal_error_signal_hook, standard_args):
6619 Now static.
6620 (fatal_error_signal): Now static, unless FLOAT_CATCH_SIGKILL.
6621 (DEFINE_DUMMY_FUNCTION): Mark function as externally visible.
6622 (__CTOR_LIST__, __DTOR_LIST__): Now externally visible.
6623 * lisp.h (fatal_error_signal_hook): Remove decl.
6624 (fatal_error_signal): Declare only if FLOAT_CATCH_SIGKILL.
6625
6626 * editfns.c: Move a (normally-unused) function to its only use.
6627 * editfns.c, lisp.h (get_operating_system_release): Remove.
6628 * process.c (init_process) [DARWIN_OS]: Do it inline, as it is not
6629 worth the hassle of breaking this out.
6630
6631 * xterm.c: Make symbols static if they're not exported.
6632 (x_raise_frame, x_lower_frame, x_wm_set_window_state):
6633 (x_wm_set_icon_pixmap, x_initialize, XTread_socket_fake_io_error):
6634 (x_destroy_window, x_delete_display):
6635 Now static.
6636 (x_dispatch_event): Now static if ! (USE_MOTIF || USE_X_TOOLKIT).
6637 (x_mouse_leave): Remove; unused.
6638 * xterm.h (x_display_info_for_name, x_raise_frame, x_lower_frame):
6639 (x_destroy_window, x_wm_set_window_state, x_wm_set_icon_pixmap):
6640 (x_delete_display, x_initialize, x_set_border_pixel, x_screen_planes):
6641 Remove decls.
6642 (x_mouse_leave): Declare only if WINDOWSNT.
6643 (x_dispatch_event): Declare only if USE_MOTIF or USE_X_TOOLKIT.
6644 (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS &&
6645 USE_X_TOOLKIT.
6646
6647 * ftxfont.c: Make symbols static if they're not exported.
6648 (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined
6649 HAVE_FREETYPE.
6650 * font.h (ftxfont_driver): Likewise.
6651
6652 * xfns.c: Make symbols static if they're not exported.
6653 (x_last_font_name, x_display_info_for_name):
6654 (x_set_foreground_color, x_set_background_color, x_set_mouse_color):
6655 (x_set_cursor_color, x_set_border_pixel, x_set_border_color):
6656 (x_set_cursor_type, x_set_icon_type, x_set_icon_name):
6657 (x_set_scroll_bar_foreground, x_set_scroll_bar_background):
6658 (x_explicitly_set_name, x_set_title, xic_defaut_fontset, tip_timer):
6659 (last_show_tip_args): Now static.
6660 (xic_defaut_fontset, xic_create_fontsetname): Define only if
6661 defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
6662 (x_screen_planes): Remove; unused.
6663 * dispextern.h (x_screen_planes): Remove decl.
6664
6665 * dispnew.c: Make symbols static if they're not exported.
6666 * dispextern.h (redraw_garbaged_frames, scrolling):
6667 (increment_row_positions): Remove.
6668 * dispnew.c (new_glyph_matrix, increment_row_positions, scrolling):
6669 (delayed_size_change, glyph_matrix_count, glyph_pool_count):
6670 Now static.
6671 (redraw_garbaged_frames): Remove; unused.
6672
6673 * xfaces.c: Make symbols static if they're not exported.
6674 * dispextern.h (ascii_face_of_lisp_face, free_realized_face):
6675 Remove decls.
6676 * xterm.h (defined_color): Remove decls.
6677 (x_free_dpy_colors): Declare only if USE_X_TOOLKIT.
6678 * xfaces.c (tty_suppress_bold_inverse_default_colors_p):
6679 (menu_face_changed_default, defined_color, free_realized_face):
6680 (x_free_dpy_colors): Define only if USE_X_TOOLKIT.
6681 (ascii_face_of_lisp_face): Remove; unused.
6682
6683 * xdisp.c: Make symbols static if they're not exported.
6684 * dispextern.h (scratch_glyph_row, window_box_edges):
6685 (glyph_to_pixel_coords, set_cursor_from_row):
6686 (get_next_display_element, set_iterator_to_next):
6687 (highlight_trailing_whitespace, frame_to_window_pixel_xy):
6688 (show_mouse_face): Remove decls
6689 * frame.h (message_buf_print): Likewise.
6690 * lisp.h (pop_message, set_message, check_point_in_composition):
6691 Likewise.
6692 * xterm.h (set_vertical_scroll_bar): Likewise.
6693 * xdisp.c (list_of_error, Vmessage_stack, line_number_displayed):
6694 (message_buf_print, scratch_glyph_row, displayed_buffer):
6695 (set_iterator_to_next, pop_message, set_message, set_cursor_from_row):
6696 (get_next_display_element, show_mouse_face, window_box_edges):
6697 (frame_to_window_pixel_xy, check_point_in_composition):
6698 (set_vertical_scroll_bar, highlight_trailing_whitespace): Now static.
6699 (glyph_to_pixel_coords): Remove; unused.
6700
6701 * dired.c (file_name_completion): Now static.
6702
6703 * dbusbind.c (xd_in_read_queued_messages): Now static.
6704
6705 * lisp.h (circular_list_error, FOREACH): Remove; unused.
6706 * data.c (circular_list_error): Remove.
6707
6708 * commands.h (last_point_position, last_point_position_buffer):
6709 (last_point_position_window): Remove decls.
6710 * keyboard.c: Make these variables static.
6711
6712 * coding.h (coding, code_convert_region, encode_coding_gap):
6713 Remove decls.
6714 * coding.c (Vsjis_coding_system, Vbig5_coding_system):
6715 (iso_code_class, detect_coding, code_convert_region): Now static.
6716 (encode_coding_gap): Remove; unused.
6717
6718 * chartab.c (chartab_chars, chartab_bits): Now static.
6719
6720 * charset.h (charset_iso_8859_1): Remove decl.
6721 * charset.c (charset_iso_8859_1, charset_emacs, map_charset_for_dump):
6722 Now static.
6723
6724 * ccl.h (check_ccl_update, Vccl_program_table): Remove decls.
6725 * ccl.c (Vccl_program_table): Now static.
6726 (check_ccl_update): Remove; unused.
6727
6728 * category.c (SET_CATEGORY_SET, set_category_set): Move here.
6729 * category.h: ... from here.
6730 * category.c (check_category_table, set_category_set): Now static.
6731
6732 * casetab.c (Vascii_upcase_table, Vascii_eqv_table): Now static.
6733 * lisp.h: Remove these decls.
6734
6735 * buffer.c (buffer_count): Remove unused var.
6736
6737 * bidi.c (bidi_dump_cached_states): Mark as externally visible,
6738 so that it's not optimized away.
6739 (bidi_ignore_explicit_marks_for_paragraph_level): Likewise.
6740 * dispextern.h (bidi_dump_cached_states): Remove, since it's
6741 exported only to the debugger.
6742
6743 * atimer.c (alarm_signal_handler, run_all_atimers): Now static.
6744 * atimer.h (run_all_atimers): Remove; not exported.
6745
6746 font.c: Make copy_font_spec and merge_font_spec ordinary C functions.
6747 * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it
6748 was inaccessible from Lisp.
6749 (merge_font_spec): Likewise, renaming from Fmerge_font_spec.
6750 * font.c, font.h, fontset.c, xfaces.c, xfont.c: Change all uses.
6751
6752 alloc.c: Import and export fewer symbols, and remove unused items.
6753 * lisp.h (suppress_checking, die): Declare only if ENABLE_CHECKING
6754 is defined.
6755 (suppress_checking): Add EXTERNALLY_VISIBLE attribute, so that
6756 it's not optimized away by whole-program optimization.
6757 (message_enable_multibyte, free_misc): Remove.
6758 (catchlist, handlerlist, mark_backtrace):
6759 Declare only if BYTE_MARK_STACK.
6760 (mark_byte_stack): Likewise, fixing a ifdef-vs-if typo.
6761 * alloc.c (pure): Export only if VIRT_ADDR_VARIES is defined.
6762 (message_enable_multibyte): Remove decl.
6763 (free_misc, interval_free_list, float_block, float_block_index):
6764 (n_float_blocks, float_free_list, cons_block, cons_block_index):
6765 (cons_free_list, last_marked_index):
6766 Now static.
6767 (suppress_checking, die): Define only if ENABLE_CHECKING is defined.
6768 * eval.c (catchlist, handlerlist): Export only if BYTE_MARK_STACK.
6769 (mark_backtrace): Define only if BYTE_MARK_STACK.
6770 * xdisp.c (message_enable_multibyte): Now static.
6771
6772 Declare Lisp_Object Q* variables to be 'static' if not exported.
6773 This makes it easier for human readers (and static analyzers)
6774 to see whether these variables are used from other modules.
6775 * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
6776 * ccl.c, character.c, charset.c, cmds.c, coding.c, composite.c:
6777 * data.c, dbusbind.c, dired.c, editfns.c, eval.c, fileio.c, fns.c:
6778 * font.c, frame.c, fringe.c, ftfont.c, image.c, keyboard.c, keymap.c:
6779 * lread.c, macros.c, minibuf.c, print.c, process.c, search.c:
6780 * sound.c, syntax.c, textprop.c, window.c, xdisp.c, xfaces.c, xfns.c:
6781 * xmenu.c, xselect.c:
6782 Declare Q* vars static if they are not used in other modules.
6783 * ccl.h, character.h, charset.h, coding.h, composite.h, font.h:
6784 * frame.h, intervals.h, keyboard.h, lisp.h, process.h, syntax.h:
6785 Remove decls of unexported vars.
6786 * keyboard.h (EVENT_HEAD_UNMODIFIED): Remove now-unused macro.
6787
6788 * lisp.h (DEFINE_FUNC): Make sname 'static'.
6789
6790 Make Emacs functions such as Fatom 'static' by default.
6791 This makes it easier for human readers (and static analyzers)
6792 to see whether these functions can be called from other modules.
6793 DEFUN now defines a static function. To make the function external
6794 so that it can be used in other C modules, use the new macro DEFUE.
6795 * lisp.h (Funibyte_char_to_multibyte, Fsyntax_table_p):
6796 (Finit_image_library):
6797 (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer):
6798 (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute):
6799 (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes):
6800 Remove decls, since these functions are now static.
6801 (Funintern, Fget_internal_run_time): New decls, since these functions
6802 were already external.
6803
6804 * alloc.c, buffer.c, callint.c, callproc.c, casefiddle.c, casetab.c:
6805 * ccl.c, character.c, chartab.c, cmds.c, coding.c, data.c, dispnew.c:
6806 * doc.c, editfns.c, emacs.c, eval.c, fileio.c, filelock.c, floatfns.c:
6807 * fns.c, font.c, fontset.c, frame.c, image.c, indent.c:
6808 * keyboard.c, keymap.c, lread.c:
6809 * macros.c, marker.c, menu.c, minibuf.c, print.c, process.c, search.c:
6810 * syntax.c, term.c, terminal.c, textprop.c, undo.c:
6811 * window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xsettings.c:
6812 Mark functions with DEFUE instead of DEFUN,
6813 if they are used in other modules.
6814 * buffer.c (Fset_buffer_major_mode, Fdelete_overlay): New forward
6815 decls for now-static functions.
6816 * buffer.h (Fdelete_overlay): Remove decl.
6817 * callproc.c (Fgetenv_internal): Mark as internal.
6818 * composite.c (Fremove_list_of_text_properties): Remove decl.
6819 (Fcomposition_get_gstring): New forward static decl.
6820 * composite.h (Fcomposite_get_gstring): Remove decl.
6821 * dired.c (Ffile_attributes): New forward static decl.
6822 * doc.c (Fdocumntation_property): New forward static decl.
6823 * eval.c (Ffetch_bytecode): New forward static decl.
6824 (Funintern): Remove extern decl; now in .h file where it belongs.
6825 * fileio.c (Fmake_symbolic_link): New forward static decl.
6826 * image.c (Finit_image_library): New forward static decl.
6827 * insdel.c (Fcombine_after_change_execute): Make forward decl static.
6828 * intervals.h (Fprevious_property_change):
6829 (Fremove_list_of_text_properties): Remove decls.
6830 * keyboard.c (Fthis_command_keys): Remove decl.
6831 (Fcommand_execute): New forward static decl.
6832 * keymap.c (Flookup_key): New forward static decl.
6833 (Fcopy_keymap): Now static.
6834 * keymap.h (Flookup_key): Remove decl.
6835 * process.c (Fget_process): New forward static decl.
6836 (Fprocess_datagram_address): Mark as internal.
6837 * syntax.c (Fsyntax_table_p): New forward static decl.
6838 (skip_chars): Remove duplicate decl.
6839 * textprop.c (Fprevious_property_change): New forward static decl.
6840 * window.c (Fset_window_fringes, Fset_window_scroll_bars):
6841 Now internal.
6842 (Fset_window_margins, Fset_window_vscroll): New forward static decls.
6843 * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
6844
6845 * editfns.c (Fformat): Remove unreachable code.
6846
6847 2011-04-14 Andreas Schwab <schwab@linux-m68k.org>
6848
6849 * fileio.c (Finsert_file_contents): Fix typo in 2005-05-13
6850 change. (Bug#8496)
6851
6852 2011-04-13 Eli Zaretskii <eliz@gnu.org>
6853
6854 * xdisp.c (handle_invisible_prop): Don't call bidi_paragraph_init
6855 when at ZV. (Bug#8487)
6856
6857 2011-04-12 Andreas Schwab <schwab@linux-m68k.org>
6858
6859 * charset.c (Fclear_charset_maps): Use xfree instead of free.
6860 (Bug#8437)
6861 * keyboard.c (parse_tool_bar_item): Likewise.
6862 * sound.c (sound_cleanup, alsa_close): Likewise.
6863 * termcap.c (tgetent): Likewise.
6864 * xfns.c (x_default_font_parameter): Likewise.
6865 * xsettings.c (read_and_apply_settings): Likewise.
6866
6867 * alloc.c (overrun_check_malloc, overrun_check_realloc)
6868 (overrun_check_free): Protoize.
6869
6870 2011-04-12 Paul Eggert <eggert@cs.ucla.edu>
6871
6872 * sysdep.c (emacs_read, emacs_write): Check for negative sizes
6873 since callers should never pass a negative size.
6874 Change the signature to match that of plain 'read' and 'write'; see
6875 <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>.
6876 * lisp.h: Update prototypes of emacs_write and emacs_read.
6877
6878 2011-04-11 Eli Zaretskii <eliz@gnu.org>
6879
6880 * xdisp.c (redisplay_window): Don't try to determine the character
6881 position of the scroll margin if the window start point w->startp
6882 is outside the buffer's accessible region. (Bug#8468)
6883
6884 2011-04-10 Eli Zaretskii <eliz@gnu.org>
6885
6886 Fix write-region and its subroutines for buffers > 2GB.
6887 * fileio.c (a_write, e_write): Modify declaration of arguments and
6888 local variables to support buffers larger than 2GB.
6889 (Fcopy_file): Use EMACS_INT for return value of emacs_read.
6890
6891 * sysdep.c (emacs_write, emacs_read): Use ssize_t for last
6892 argument, local variables, and return value.
6893
6894 * lisp.h: Update prototypes of emacs_write and emacs_read.
6895
6896 * sound.c (vox_write): Use ssize_t for return value of emacs_write.
6897
6898 2011-04-10 Paul Eggert <eggert@cs.ucla.edu>
6899
6900 * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.
6901
6902 Fix more problems found by GCC 4.6.0's static checks.
6903
6904 * xdisp.c (vmessage): Use a better test for character truncation.
6905
6906 * charset.c (load_charset_map): <, not <=, for optimization,
6907 and to avoid potential problems with integer overflow.
6908 * chartab.c (sub_char_table_set_range, char_table_set_range): Likewise.
6909 * casetab.c (set_identity, shuffle): Likewise.
6910 * editfns.c (Fformat): Likewise.
6911 * syntax.c (skip_chars): Likewise.
6912
6913 * xmenu.c (set_frame_menubar): Allocate smaller local vectors.
6914 This also lets GCC 4.6.0 generate slightly better loop code.
6915
6916 * callint.c (Fcall_interactively): <, not <=, for optimization.
6917 (Fcall_interactively): Count the number of arguments produced,
6918 not the number of arguments given. This is simpler and lets GCC
6919 4.6.0 generate slightly better code.
6920
6921 * ftfont.c: Distingish more carefully between FcChar8 and char.
6922 The previous code passed unsigned char * to a functions like
6923 strlen and xstrcasecmp that expect char *, which does not
6924 conform to the C standard.
6925 (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for
6926 arguments to FcPatternGetString, and explicitly cast FcChar8 * to
6927 char * when the C standard requires it.
6928
6929 * keyboard.c (read_char): Remove unused var.
6930
6931 * eval.c: Port to Windows vsnprintf (Bug#8435).
6932 Include <limits.h>.
6933 (SIZE_MAX): Define if the headers do not.
6934 (verror): Do not give up if vsnprintf returns a negative count.
6935 Instead, grow the buffer. This ports to Windows vsnprintf, which
6936 does not conform to C99. Problem reported by Eli Zaretskii.
6937 Also, simplify the allocation scheme, by avoiding the need for
6938 calling realloc, and removing the ALLOCATED variable.
6939
6940 * eval.c (verror): Initial buffer size is 4000 (not 200) bytes.
6941
6942 Remove invocations of doprnt, as Emacs now uses vsnprintf.
6943 But keep the doprint source code for now, as we might revamp it
6944 and use it again (Bug#8435).
6945 * lisp.h (doprnt): Remove.
6946 * Makefile.in (base_obj): Remove doprnt.o.
6947 * deps.mk (doprnt.o): Remove.
6948
6949 error: Print 32- and 64-bit integers portably (Bug#8435).
6950 Without this change, on typical 64-bit hosts error ("...%d...", N)
6951 was used to print both 32- and 64-bit integers N, which relied on
6952 undefined behavior.
6953 * lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
6954 New macro.
6955 * lisp.h (error, verror): Mark as printf-like functions.
6956 * eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
6957 Report overflow in size calculations when allocating printf buffer.
6958 Do not truncate output string at its first null byte.
6959 * xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
6960 Truncate the output at a character boundary, since vsnprintf does not
6961 do that.
6962 * charset.c (check_iso_charset_parameter): Convert internal
6963 character to string before calling 'error', since %c now has the
6964 printf meaning.
6965 * coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
6966 overflow when computing char to be passed to 'error'. Do not
6967 pass Lisp_Object to 'error'; pass the integer instead.
6968 * nsfns.m (Fns_do_applescript): Use int, not long, since it's
6969 formatted with plain %d.
6970
6971 * eval.c (internal_lisp_condition_case): Don't pass spurious arg.
6972
6973 * keyboard.c (access_keymap_keyremap): Print func name, not garbage.
6974
6975 * coding.c (Fdecode_sjis_char): Don't assume CODE fits in int.
6976
6977 * xterm.c (x_catch_errors): Remove duplicate declaration.
6978
6979 * term.c (maybe_fatal): Mark its 3rd arg as a printf format, too.
6980
6981 * xdisp.c, lisp.h (message_nolog): Remove; unused.
6982
6983 2011-04-10 Jim Meyering <meyering@redhat.com>
6984
6985 use ssize_t and size_t for read- and write-like emacs_gnutls_* functions
6986 * gnutls.c (emacs_gnutls_read): Adjust signature to be more read-like:
6987 return ssize_t not "int", and use size_t as the buffer length.
6988 (emacs_gnutls_write): Likewise, and make the buffer pointer "const".
6989 * gnutls.h: Update declarations.
6990 * process.c (read_process_output): Use ssize_t, to match.
6991 (send_process): Likewise.
6992
6993 2011-04-09 Chong Yidong <cyd@stupidchicken.com>
6994
6995 * image.c (Fimagemagick_types): Doc fix, and comment cleanup.
6996
6997 2011-04-09 Chong Yidong <cyd@stupidchicken.com>
6998
6999 * ftfont.c (get_adstyle_property, ftfont_pattern_entity):
7000 Use unsigned char, to match FcChar8 type definition.
7001
7002 * xterm.c (handle_one_xevent):
7003 * xmenu.c (create_and_show_popup_menu):
7004 * xselect.c (x_decline_selection_request)
7005 (x_reply_selection_request): Avoid type-punned deref of X events.
7006
7007 2011-04-09 Eli Zaretskii <eliz@gnu.org>
7008
7009 Fix some uses of `int' instead of EMACS_INT.
7010 * search.c (string_match_1, fast_string_match)
7011 (fast_c_string_match_ignore_case, fast_string_match_ignore_case)
7012 (scan_buffer, find_next_newline_no_quit)
7013 (find_before_next_newline, search_command, Freplace_match)
7014 (Fmatch_data): Make some `int' variables be EMACS_INT.
7015
7016 * xdisp.c (display_count_lines): 3rd argument and return value now
7017 EMACS_INT. All callers changed.
7018 (pint2hrstr): Last argument is now EMACS_INT.
7019
7020 * coding.c (detect_coding_utf_8, detect_coding_emacs_mule)
7021 (detect_coding_iso_2022, detect_coding_sjis, detect_coding_big5)
7022 (detect_coding_ccl, detect_coding_charset, decode_coding_utf_8)
7023 (decode_coding_utf_16, decode_coding_emacs_mule)
7024 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5)
7025 (decode_coding_ccl, decode_coding_charset)
7026 <consumed_chars, consumed_chars_base>: Declare EMACS_INT.
7027 (decode_coding_iso_2022, decode_coding_emacs_mule)
7028 (decode_coding_sjis, decode_coding_big5, decode_coding_charset)
7029 <char_offset, last_offset>: Declare EMACS_INT.
7030 (encode_coding_utf_8, encode_coding_utf_16)
7031 (encode_coding_emacs_mule, encode_invocation_designation)
7032 (encode_designation_at_bol, encode_coding_iso_2022)
7033 (encode_coding_sjis, encode_coding_big5, encode_coding_ccl)
7034 (encode_coding_raw_text, encode_coding_charset) <produced_chars>:
7035 Declare EMACS_INT.
7036 (ASSURE_DESTINATION): Declare more_bytes EMACS_INT.
7037 (encode_invocation_designation): Last argument P_NCHARS is now
7038 EMACS_INT.
7039 (decode_eol): Declare pos_byte, pos, and pos_end EMACS_INT.
7040 (produce_chars): from_nchars and to_nchars are now EMACS_INT.
7041
7042 * coding.h (struct coding_system) <head_ascii>: Declare EMACS_INT.
7043 All users changed.
7044
7045 * ccl.c (Fccl_execute_on_string): Declare some variables
7046 EMACS_INT.
7047
7048 2011-04-08 Samuel Thibault <sthibault@debian.org> (tiny change)
7049
7050 * term.c (init_tty): Fix incorrect ifdef placement (Bug#8450).
7051
7052 2011-03-19 Christoph Scholtes <cschol2112@googlemail.com>
7053
7054 * process.c (Fformat_network_address): Doc fix.
7055
7056 2011-04-08 T.V. Raman <tv.raman.tv@gmail.com> (tiny change)
7057
7058 * xml.c (parse_region): Avoid creating spurious whiespace nodes.
7059
7060 2011-04-08 Chong Yidong <cyd@stupidchicken.com>
7061
7062 * keyboard.c (read_char): Call Lisp function help-form-show,
7063 instead of using internal_with_output_to_temp_buffer.
7064 (Qhelp_form_show): New var.
7065 (syms_of_keyboard): Use DEFSYM macro.
7066
7067 * print.c (internal_with_output_to_temp_buffer): Function deleted.
7068
7069 * lisp.h (internal_with_output_to_temp_buffer): Remove prototype.
7070
7071 2011-04-06 Chong Yidong <cyd@stupidchicken.com>
7072
7073 * process.c (Flist_processes): Remove to Lisp.
7074 (list_processes_1): Delete.
7075
7076 2011-04-06 Eli Zaretskii <eliz@gnu.org>
7077
7078 * msdos.c (careadlinkat, careadlinkatcwd): MS-DOS replacements.
7079
7080 * w32.c (careadlinkat, careadlinkatcwd): New always-fail stubs.
7081
7082 2011-04-06 Paul Eggert <eggert@cs.ucla.edu>
7083
7084 Fix more problems found by GCC 4.6.0's static checks.
7085
7086 * xmenu.c (Fx_popup_dialog): Don't assume string is free of formats.
7087
7088 * menu.c (Fx_popup_menu): Don't assume error_name lacks printf formats.
7089
7090 * lisp.h (message, message_nolog, fatal): Mark as printf-like.
7091
7092 * xdisp.c (vmessage): Mark as a printf-like function.
7093
7094 * term.c (vfatal, maybe_fatal): Mark as printf-like functions.
7095
7096 * sound.c (sound_warning): Don't crash if arg contains a printf format.
7097
7098 * image.c (tiff_error_handler, tiff_warning_handler): Mark as
7099 printf-like functions.
7100 (tiff_load): Add casts to remove these marks before passing them
7101 to system-supplied API.
7102
7103 * eval.c (Fsignal): Remove excess argument to 'fatal'.
7104
7105 * coding.c (EMIT_ONE_BYTE, EMIT_TWO_BYTES): Use unsigned, not int.
7106 This avoids several warnings with gcc -Wstrict-overflow.
7107 (DECODE_COMPOSITION_RULE): If the rule is invalid, goto invalid_code
7108 directly, rather than having caller test rule sign. This avoids
7109 some unnecessary tests.
7110 * composite.h (COMPOSITION_ENCODE_RULE_VALID): New macro.
7111 (COMPOSITION_ENCODE_RULE): Arguments now must be valid. This
7112 affects only one use, in DECODE_COMPOSITION_RULE, which is changed.
7113
7114 * xfont.c (xfont_text_extents): Remove var that was set but not used.
7115 (xfont_open): Avoid unnecessary tests.
7116
7117 * composite.c (composition_gstring_put_cache): Use unsigned integer.
7118
7119 * composite.h, composite.c (composition_gstring_put_cache):
7120 Use EMACS_INT, not int, for length.
7121
7122 * composite.h (COMPOSITION_DECODE_REFS): New macro,
7123 breaking out part of COMPOSITION_DECODE_RULE.
7124 (COMPOSITION_DECODE_RULE): Use it.
7125 * composite.c (get_composition_id): Remove unused local vars,
7126 by using the new macro.
7127
7128 * textprop.c (set_text_properties_1): Change while to do-while,
7129 since the condition is always true at first.
7130
7131 * intervals.c (graft_intervals_into_buffer): Mark var as used.
7132 (interval_deletion_adjustment): Return unsigned value.
7133 All uses changed.
7134
7135 * process.c (list_processes_1, create_pty, read_process_output):
7136 (exec_sentinel): Remove vars that were set but not used.
7137 (create_pty): Remove unnecessary "volatile"s.
7138 (Fnetwork_interface_info): Avoid possibility of int overflow.
7139 (read_process_output): Do adaptive read buffering even if carryover.
7140 (read_process_output): Simplify nbytes computation if buffered.
7141
7142 * bytecode.c (exec_byte_code): Rename local to avoid shadowing.
7143
7144 * syntax.c (scan_words): Remove var that was set but not used.
7145 (update_syntax_table): Use unsigned instead of int.
7146
7147 * lread.c (lisp_file_lexically_bound_p): Use ints rather than endptrs.
7148 (lisp_file_lexically_bound_p, read1): Use unsigned instead of int.
7149 (safe_to_load_p): Make the end-of-loop test the inverse of the in-loop.
7150
7151 * print.c (print_error_message): Avoid int overflow.
7152
7153 * font.c (font_list_entities): Redo for clarity,
7154 so that reader need not know FONT_DPI_INDEX + 1 == FONT_SPACING_INDEX.
7155
7156 * font.c (font_find_for_lface, Ffont_get_glyphs): Remove unused vars.
7157 (font_score): Avoid potential overflow in diff calculation.
7158
7159 * fns.c (substring_both): Remove var that is set but not used.
7160 (sxhash): Redo loop for clarity and to avoid wraparound warning.
7161
7162 * eval.c (funcall_lambda): Rename local to avoid shadowing.
7163
7164 * alloc.c (mark_object_loop_halt, mark_object): Use size_t, not int.
7165 Otherwise, GCC 4.6.0 optimizes the loop check away since the check
7166 can always succeed if overflow has undefined behavior.
7167
7168 * search.c (boyer_moore, wordify): Remove vars set but not used.
7169 (wordify): Omit three unnecessary tests.
7170
7171 * indent.c (MULTIBYTE_BYTES_WIDTH): Don't compute wide_column.
7172 All callers changed. This avoids the need for an unused var.
7173
7174 * casefiddle.c (casify_region): Remove var that is set but not used.
7175
7176 * dired.c (file_name_completion): Remove var that is set but not used.
7177
7178 * fileio.c (Finsert_file_contents): Make EOF condition clearer.
7179
7180 * fileio.c (Finsert_file_contents): Avoid signed integer overflow.
7181 (Finsert_file_contents): Remove unnecessary code checking fd.
7182
7183 * minibuf.c (read_minibuf_noninteractive): Use size_t for sizes.
7184 Check for integer overflow on size calculations.
7185
7186 * buffer.c (Fprevious_overlay_change): Remove var that is set
7187 but not used.
7188
7189 * keyboard.c (menu_bar_items, read_char_minibuf_menu_prompt):
7190 Remove vars that are set but not used.
7191 (timer_check_2): Don't assume timer-list and idle-timer-list are lists.
7192 (timer_check_2): Mark vars as initialized.
7193
7194 * gtkutil.c (xg_get_file_with_chooser): Mark var as initialized.
7195
7196 * image.c (lookup_image): Remove var that is set but not used.
7197 (xbm_load): Use parse_p, for gcc -Werror=unused-but-set-variable.
7198
7199 * fontset.c (Finternal_char_font, Ffontset_info): Remove vars
7200 that are set but not used.
7201
7202 * xfns.c (make_invisible_cursor): Don't return garbage
7203 if XCreateBitmapFromData fails (Bug#8410).
7204
7205 * xselect.c (x_get_local_selection, x_handle_property_notify):
7206 Remove vars that are set but not used.
7207
7208 * xfns.c (x_create_tip_frame): Remove var that is set but not used.
7209 (make_invisible_cursor): Initialize a possibly-uninitialized variable.
7210
7211 * xterm.c (x_scroll_bar_to_input_event) [!USE_GTK]:
7212 Remove var that is set but not used.
7213 (scroll_bar_windows_size): Now size_t, not int.
7214 (x_send_scroll_bar_event): Use size_t, not int, for sizes.
7215 Check for overflow.
7216
7217 * xfaces.c (realize_named_face): Remove vars that are set but not used.
7218 (map_tty_color) [!defined MSDOS]: Likewise.
7219
7220 * term.c (tty_write_glyphs): Use size_t; this avoids overflow warning.
7221
7222 * coding.c: Remove vars that are set but not used.
7223 (DECODE_COMPOSITION_RULE): Remove 2nd arg, which is unused.
7224 All callers changed.
7225 (decode_coding_utf_8, decode_coding_utf_16 decode_coding_emacs_mule):
7226 (decode_coding_iso_2022, encode_coding_sjis, encode_coding_big5):
7227 (decode_coding_charset): Remove vars that are set but not used.
7228
7229 * bytecode.c (Fbyte_code) [!defined BYTE_CODE_SAFE]: Remove var
7230 that is set but not used.
7231
7232 * print.c (print_object): Remove var that is set but not used.
7233
7234 Replace 2 copies of readlink code with 1 gnulib version (Bug#8401).
7235 The gnulib version avoids calling malloc in the usual case,
7236 and on 64-bit hosts doesn't have some arbitrary 32-bit limits.
7237 * fileio.c (Ffile_symlink_p): Use emacs_readlink.
7238 * filelock.c (current_lock_owner): Likewise.
7239 * lisp.h (READLINK_BUFSIZE, emacs_readlink): New function.
7240 * sysdep.c: Include allocator.h, careadlinkat.h.
7241 (emacs_no_realloc_allocator): New static constant.
7242 (emacs_readlink): New function.
7243 * deps.mk (sysdep.o): Depend on ../lib/allocator.h and on
7244 ../lib/careadlinkat.h.
7245
7246 2011-04-04 Stefan Monnier <monnier@iro.umontreal.ca>
7247
7248 * keyboard.c (safe_run_hook_funcall): Fix last change (don't stop at the
7249 first non-nil return value).
7250
7251 2011-04-03 Jan Djärv <jan.h.d@swipnet.se>
7252
7253 * nsterm.m (ns_update_auto_hide_menu_bar): Define MAC_OS_X_VERSION_10_6
7254 if not defined (Bug#8403).
7255
7256 2011-04-02 Juanma Barranquero <lekktu@gmail.com>
7257
7258 * xdisp.c (display_count_lines): Remove parameter `start',
7259 unused since 1998-01-01T02:27:27Z!rms@gnu.org. All callers changed.
7260 (get_char_face_and_encoding): Remove parameter `multibyte_p',
7261 unused since 2008-05-14T01:40:23Z!handa@m17n.org. All callers changed.
7262 (fill_stretch_glyph_string): Remove parameters `row' and `area',
7263 unused at least since Kim's GUI unification at 2003-03-16T20:45:46Z!storm@cua.dk
7264 and thereabouts. All callers changed.
7265 (get_per_char_metric): Remove parameter `f', unused since
7266 2008-05-14T01:40:23Z!handa@m17n.org. All callers changed.
7267
7268 2011-04-02 Jim Meyering <meyering@redhat.com>
7269
7270 do not dereference NULL upon failed strdup
7271 * nsfont.m (ns_descriptor_to_entity): Use xstrdup, not strdup.
7272 (ns_get_family): Likewise.
7273
7274 2011-04-02 Juanma Barranquero <lekktu@gmail.com>
7275
7276 * eval.c (unwind_to_catch) [DEBUG_GCPRO]: Remove redundant assignment.
7277
7278 2011-04-02 Jan Djärv <jan.h.d@swipnet.se>
7279
7280 * nsterm.m (ns_update_auto_hide_menu_bar): Only for OSX 10.6 or
7281 later (Bug#8403).
7282
7283 2011-04-01 Stefan Monnier <monnier@iro.umontreal.ca>
7284
7285 Add lexical binding.
7286
7287 * window.c (Ftemp_output_buffer_show): New fun.
7288 (Fsave_window_excursion):
7289 * print.c (Fwith_output_to_temp_buffer): Move to subr.el.
7290
7291 * lread.c (lisp_file_lexically_bound_p): New function.
7292 (Fload): Bind Qlexical_binding.
7293 (readevalloop): Remove `evalfun' arg.
7294 Bind Qinternal_interpreter_environment.
7295 (Feval_buffer): Bind Qlexical_binding.
7296 (defvar_int, defvar_bool, defvar_lisp_nopro, defvar_kboard):
7297 Mark as dynamic.
7298 (syms_of_lread): Declare `lexical-binding'.
7299
7300 * lisp.h (struct Lisp_Symbol): New field `declared_special'.
7301
7302 * keyboard.c (eval_dyn): New fun.
7303 (menu_item_eval_property): Use it.
7304
7305 * image.c (parse_image_spec): Use Ffunctionp.
7306
7307 * fns.c (concat, mapcar1): Accept byte-code-functions.
7308
7309 * eval.c (Fsetq): Handle lexical vars.
7310 (Fdefun, Fdefmacro, Ffunction): Make closures when needed.
7311 (Fdefconst, Fdefvaralias, Fdefvar): Mark as dynamic.
7312 (FletX, Flet): Obey lexical binding.
7313 (Fcommandp): Handle closures.
7314 (Feval): New `lexical' arg.
7315 (eval_sub): New function extracted from Feval. Use it almost
7316 everywhere where Feval was used. Look up vars in lexical env.
7317 Handle closures.
7318 (Ffunctionp): Move from subr.el.
7319 (Ffuncall): Handle closures.
7320 (apply_lambda): Remove `eval_flags'.
7321 (funcall_lambda): Handle closures and new byte-code-functions.
7322 (Fspecial_variable_p): New function.
7323 (syms_of_eval): Initialize the Vinternal_interpreter_environment var,
7324 but without exporting it to Lisp.
7325
7326 * doc.c (Fdocumentation, store_function_docstring):
7327 * data.c (Finteractive_form): Handle closures.
7328
7329 * callint.c (Fcall_interactively): Preserve lexical-binding mode for
7330 interactive spec.
7331
7332 * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN):
7333 New byte-codes.
7334 (exec_byte_code): New function extracted from Fbyte_code to handle new
7335 calling convention for byte-code-functions. Add new byte-codes.
7336
7337 * buffer.c (defvar_per_buffer): Set new `declared_special' field.
7338
7339 * alloc.c (Fmake_symbol): Init new `declared_special' field.
7340
7341 2011-03-31 Juanma Barranquero <lekktu@gmail.com>
7342
7343 * xdisp.c (redisplay_internal): Fix prototype.
7344
7345 2011-03-31 Eli Zaretskii <eliz@gnu.org>
7346
7347 * xdisp.c (SCROLL_LIMIT): New macro.
7348 (try_scrolling): Use it when setting scroll_limit.
7349 Limit scrolling to 100 screen lines.
7350 (redisplay_window): Even when falling back on "recentering",
7351 position point in the window according to scroll-conservatively,
7352 scroll-margin, and scroll-*-aggressively variables. (Bug#6671)
7353
7354 (try_scrolling): When point is above the window, allow searching
7355 as far as scroll_max, or one screenful, to compute vertical
7356 distance from PT to the scroll margin position. This prevents
7357 try_scrolling from unnecessarily failing when
7358 scroll-conservatively is set to a value slightly larger than the
7359 window height. Clean up the case of PT below the margin at bottom
7360 of window: scroll_max can no longer be INT_MAX. When aggressive
7361 scrolling is in use, don't let point enter the opposite scroll
7362 margin as result of the scroll.
7363 (syms_of_xdisp) <scroll-conservatively>: Document the
7364 threshold of 100 lines for never-recentering scrolling.
7365
7366 2011-03-31 Juanma Barranquero <lekktu@gmail.com>
7367
7368 * dispextern.h (move_it_by_lines):
7369 * xdisp.c (move_it_by_lines): Remove parameter `need_y_p', unused
7370 since 2000-12-29T14:24:09Z!gerd@gnu.org. All callers changed.
7371 (message_log_check_duplicate): Remove parameters `prev_bol' and
7372 `this_bol', unused since 1998-01-01T02:27:27Z!rms@gnu.org. All callers changed.
7373 (redisplay_internal): Remove parameter `preserve_echo_area',
7374 unused since 1999-07-21T21:43:52Z!gerd@gnu.org. All callers changed.
7375
7376 * indent.c (Fvertical_motion):
7377 * window.c (window_scroll_pixel_based, Frecenter):
7378 Don't pass `need_y_p' to `move_it_by_lines'.
7379
7380 2011-03-30 Stefan Monnier <monnier@iro.umontreal.ca>
7381
7382 * eval.c (struct backtrace): Don't cheat with negative numbers, but do
7383 steal a few bits to be more compact.
7384 (interactive_p, Fbacktrace, Fbacktrace_frame, mark_backtrace):
7385 Remove unneeded casts.
7386
7387 * bytecode.c (Fbyte_code): CAR and CDR can GC.
7388
7389 2011-03-30 Zachary Kanfer <zkanfer@gmail.com> (tiny change)
7390
7391 * keyboard.c (Fexecute_extended_command): Do log the "suggest key
7392 binding" message (bug#7967).
7393
7394 2011-03-30 Paul Eggert <eggert@cs.ucla.edu>
7395
7396 Fix more problems found by GCC 4.6.0's static checks.
7397
7398 * unexelf.c (unexec) [! (defined _SYSTYPE_SYSV || defined __sgi)]:
7399 Remove unused local var.
7400
7401 * editfns.c (Fmessage_box): Remove unused local var.
7402
7403 * xdisp.c (try_window_reusing_current_matrix, x_produce_glyphs):
7404 (note_mode_line_or_margin_highlight, note_mouse_highlight):
7405 Omit unused local vars.
7406 * window.c (shrink_windows): Omit unused local var.
7407 * menu.c (digest_single_submenu): Omit unused local var.
7408 * dispnew.c (update_window) [PERIODIC_PREEMPTION_CHECKING]:
7409 Omit unused local var.
7410
7411 * keyboard.c (parse_modifiers_uncached, parse_modifiers):
7412 Don't assume string length fits in int.
7413 (keyremap_step, read_key_sequence): Use size_t for sizes.
7414 (read_key_sequence): Don't check last_real_key_start redundantly.
7415
7416 * callproc.c (Fcall_process, Fcall_process_region): Use SAFE_ALLOCA
7417 instead of alloca (Bug#8344).
7418
7419 * eval.c (Fbacktrace): Don't assume nargs fits in int.
7420 (Fbacktrace_frame): Don't assume nframes fits in int.
7421
7422 * syntax.c (scan_sexps_forward): Avoid pointer wraparound.
7423
7424 * xterm.c (x_make_frame_visible, same_x_server): Redo to avoid overflow
7425 concerns.
7426
7427 * term.c (produce_glyphless_glyph): Remove unnecessary test.
7428
7429 * cm.c (calccost): Turn while-do into do-while, for clarity.
7430
7431 * keyboard.c (syms_of_keyboard): Use the same style as later
7432 in this function when indexing through an array. This also
7433 works around GCC bug 48267.
7434
7435 * image.c (tiff_load): Fix off-by-one image count (Bug#8336).
7436
7437 * xselect.c (x_check_property_data): Return correct size (Bug#8335).
7438
7439 * chartab.c (sub_char_table_ref_and_range): Redo for slight
7440 efficiency gain, and to bypass a gcc -Wstrict-overflow warning.
7441
7442 * keyboard.c, keyboard.h (num_input_events): Now size_t.
7443 This avoids undefined behavior on integer overflow, and is a bit
7444 more convenient anyway since it is compared to a size_t variable.
7445
7446 Variadic C functions now count arguments with size_t, not int.
7447 This avoids an unnecessary limitation on 64-bit machines, which
7448 caused (substring ...) to crash on large vectors (Bug#8344).
7449 * lisp.h (struct Lisp_Subr.function.aMANY): Now takes size_t, not int.
7450 (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Likewise.
7451 All variadic functions and their callers changed accordingly.
7452 (struct gcpro.nvars): Now size_t, not int. All uses changed.
7453 * data.c (arith_driver, float_arith_driver): Likewise.
7454 * editfns.c (general_insert_function): Likewise.
7455 * eval.c (struct backtrace.nargs, interactive_p)
7456 (internal_condition_case_n, run_hook_with_args, apply_lambda)
7457 (funcall_lambda, mark_backtrace): Likewise.
7458 * fns.c (concat): Likewise.
7459 * frame.c (x_set_frame_parameters): Likewise.
7460 * fns.c (get_key_arg): Now accepts and returns size_t, and returns
7461 0 if not found, not -1. All callers changed.
7462
7463 * alloc.c (garbage_collect): Don't assume stack size fits in int.
7464 (stack_copy_size): Now size_t, not int.
7465 (stack_copy, stack_copy_size): Define only if MAX_SAVE_STACK > 0.
7466
7467 2011-03-28 Juanma Barranquero <lekktu@gmail.com>
7468
7469 * coding.c (encode_designation_at_bol): Remove parameter `charbuf_end',
7470 unused since 2002-03-01T01:17:24Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
7471 All callers changed.
7472
7473 * lisp.h (multibyte_char_to_unibyte):
7474 * character.c (multibyte_char_to_unibyte): Remove parameter `rev_tbl',
7475 unused since 2002-03-01T01:16:34Z!handa@m17n.org and 2008-02-01T16:01:31Z!miles@gnu.org.
7476 * character.h (CHAR_TO_BYTE8):
7477 * cmds.c (internal_self_insert):
7478 * editfns.c (general_insert_function):
7479 * keymap.c (push_key_description):
7480 * search.c (Freplace_match):
7481 * xdisp.c (message_dolog, set_message_1): All callers changed.
7482
7483 2011-03-28 Stefan Monnier <monnier@iro.umontreal.ca>
7484
7485 * keyboard.c (safe_run_hook_funcall): New function.
7486 (safe_run_hooks_1, safe_run_hooks_error, safe_run_hooks): On error,
7487 don't set the hook to nil, but remove the offending function instead.
7488 (Qcommand_hook_internal): Remove, unused.
7489 (syms_of_keyboard): Don't initialize Qcommand_hook_internal nor define
7490 Vcommand_hook_internal.
7491
7492 * eval.c (enum run_hooks_condition): Remove.
7493 (funcall_nil, funcall_not): New functions.
7494 (run_hook_with_args): Call each function through a `funcall' argument.
7495 Remove `cond' argument, now redundant.
7496 (Frun_hooks, Frun_hook_with_args, Frun_hook_with_args_until_success)
7497 (Frun_hook_with_args_until_failure): Adjust accordingly.
7498 (run_hook_wrapped_funcall, Frun_hook_wrapped): New functions.
7499
7500 2011-03-28 Juanma Barranquero <lekktu@gmail.com>
7501
7502 * dispextern.h (string_buffer_position): Remove declaration.
7503
7504 * print.c (strout): Remove parameter `multibyte', unused since
7505 1999-08-21T19:30:21Z!gerd@gnu.org. All callers changed.
7506
7507 * search.c (boyer_moore): Remove parameters `len', `pos' and `lim',
7508 never used since function introduction in 1998-02-08T21:33:56Z!rms@gnu.org.
7509 All callers changed.
7510
7511 * w32.c (_wsa_errlist): Use braces for struct initializers.
7512
7513 * xdisp.c (string_buffer_position_lim): Remove parameter `w',
7514 never used since function introduction in 2001-03-09T18:41:50Z!gerd@gnu.org.
7515 All callers changed.
7516 (string_buffer_position): Likewise. Also, make static (it's never
7517 used outside xdisp.c).
7518 (cursor_row_p): Remove parameter `w', unused since
7519 2000-10-17T16:08:57Z!gerd@gnu.org. All callers changed.
7520 (decode_mode_spec): Remove parameter `precision', introduced during
7521 Gerd Moellmann's rewrite at 1999-07-21T21:43:52Z!gerd@gnu.org, but never used.
7522 All callers changed.
7523
7524 2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
7525
7526 * nsterm.m (syms_of_nsterm): Use doc: for ns-auto-hide-menu-bar.
7527
7528 2011-03-27 Anders Lindgren <andlind@gmail.com>
7529
7530 * nsterm.m (ns_menu_bar_is_hidden): New variable.
7531 (ns_constrain_all_frames, ns_menu_bar_should_be_hidden)
7532 (ns_update_auto_hide_menu_bar): New functions.
7533 (ns_update_begin): Call ns_update_auto_hide_menu_bar.
7534 (applicationDidBecomeActive): Call ns_update_auto_hide_menu_bar and
7535 ns_constrain_all_frames.
7536 (constrainFrameRect): Return at once if ns_menu_bar_should_be_hidden.
7537 (syms_of_nsterm): DEFVAR ns-auto-hide-menu-bar, init to Qnil.
7538
7539 2011-03-27 Jan Djärv <jan.h.d@swipnet.se>
7540
7541 * nsmenu.m (runDialogAt): Remove argument to timer_check.
7542
7543 2011-03-27 Glenn Morris <rgm@gnu.org>
7544
7545 * syssignal.h: Replace RETSIGTYPE with void.
7546 * atimer.c, data.c, dispnew.c, emacs.c, floatfns.c, keyboard.c:
7547 * keyboard.h, lisp.h, process.c, sysdep.c, xterm.c:
7548 Replace SIGTYPE with void everywhere.
7549 * s/usg5-4-common.h (SIGTYPE): Remove definition.
7550 * s/template.h (SIGTYPE): Remove commented out definition.
7551
7552 2011-03-26 Eli Zaretskii <eliz@gnu.org>
7553
7554 * xdisp.c (redisplay_window): Don't check buffer's clip_changed
7555 flag as a prerequisite for invoking try_scrolling. (Bug#6671)
7556
7557 2011-03-26 Juanma Barranquero <lekktu@gmail.com>
7558
7559 * w32.c (read_unc_volume): Use parameter `henum', instead of
7560 global variable `wget_enum_handle'.
7561
7562 * keymap.c (describe_vector): Remove parameters `indices' and
7563 `char_table_depth', unused since 2002-03-01T01:43:26Z!handa@m17n.org.
7564 (describe_map, Fdescribe_vector): Adjust calls to `describe_vector'.
7565
7566 * keyboard.h (timer_check, show_help_echo): Remove unused parameters.
7567
7568 * keyboard.c (timer_check): Remove parameter `do_it_now',
7569 unused since 1996-04-12T06:01:29Z!rms@gnu.org.
7570 (show_help_echo): Remove parameter `ok_to_overwrite_keystroke_echo',
7571 unused since 2008-04-19T19:30:53Z!monnier@iro.umontreal.ca.
7572
7573 * keyboard.c (read_char):
7574 * w32menu.c (w32_menu_display_help):
7575 * xmenu.c (show_help_event, menu_help_callback):
7576 Adjust calls to `show_help_echo'.
7577
7578 * gtkutil.c (xg_maybe_add_timer):
7579 * keyboard.c (readable_events):
7580 * process.c (wait_reading_process_output):
7581 * xmenu.c (x_menu_wait_for_event): Adjust calls to `timer_check'.
7582
7583 * insdel.c (adjust_markers_gap_motion):
7584 Remove; no-op since 1998-01-02T21:29:48Z!rms@gnu.org.
7585 (gap_left, gap_right): Don't call it.
7586
7587 2011-03-25 Chong Yidong <cyd@stupidchicken.com>
7588
7589 * xdisp.c (handle_fontified_prop): Discard changes to clip_changed
7590 incurred during fontification.
7591
7592 2011-03-25 Juanma Barranquero <lekktu@gmail.com>
7593
7594 * buffer.c (defvar_per_buffer): Remove unused parameter `doc'.
7595 (DEFVAR_PER_BUFFER): Don't pass it.
7596
7597 * dispnew.c (row_equal_p, add_row_entry): Remove unused parameter `w'.
7598 (scrolling_window): Don't pass it.
7599
7600 2011-03-25 Juanma Barranquero <lekktu@gmail.com>
7601
7602 * dispextern.h (glyph_matric): Use #if GLYPH_DEBUG, not #ifdef.
7603
7604 * fileio.c (check_executable) [DOS_NT]: Remove unused variables `len'
7605 and `suffix'.
7606 (Fset_file_selinux_context) [HAVE_LIBSELINUX]: Move here declaration
7607 of variables specific to SELinux and computation of `encoded_absname'.
7608
7609 * image.c (XPutPixel): Remove unused variable `height'.
7610
7611 * keyboard.c (make_lispy_event): Remove unused variable `hpos'.
7612
7613 * unexw32.c (get_section_info): Remove unused variable `section'.
7614
7615 * w32.c (stat): Remove unused variables `drive_root' and `devtype'.
7616 (system_process_attributes): Remove unused variable `sess'.
7617 (sys_read): Remove unused variable `err'.
7618
7619 * w32fns.c (top): Wrap variables with #if GLYPH_DEBUG, not #ifdef.
7620 (w32_wnd_proc): Remove unused variable `isdead'.
7621 (unwind_create_frame): Use #if GLYPH_DEBUG, not #ifdef.
7622 (Fx_server_max_request_size): Remove unused variable `dpyinfo'.
7623 (x_create_tip_frame): Remove unused variable `tem'.
7624
7625 * w32inevt.c (w32_console_read_socket):
7626 Remove unused variable `no_events'.
7627
7628 * w32term.c (x_draw_composite_glyph_string_foreground):
7629 Remove unused variable `width'.
7630
7631 2011-03-24 Juanma Barranquero <lekktu@gmail.com>
7632
7633 * w32term.c (x_set_glyph_string_clipping):
7634 Don't pass uninitialized region to CombineRgn.
7635
7636 2011-03-23 Juanma Barranquero <lekktu@gmail.com>
7637
7638 * w32fns.c (x_set_menu_bar_lines): Remove unused variable `olines'.
7639 (w32_wnd_proc): Pass NULL to Windows API, not uninitialized buffer.
7640 (Fx_close_connection): Remove unused variable `i'.
7641
7642 * w32font.c (w32font_draw): Return number of glyphs.
7643 (w32font_open_internal): Remove unused variable `i'.
7644 (w32font_driver): Add missing initializer.
7645
7646 * w32menu.c (utf8to16): Remove unused variable `utf16'.
7647 (fill_in_menu): Remove unused variable `items_added'.
7648
7649 * w32term.c (last_mouse_press_frame): Remove static global variable.
7650 (w32_clip_to_row): Remove unused variable `f'.
7651 (x_delete_terminal): Remove unused variable `i'.
7652
7653 * w32uniscribe.c (uniscribe_shape): Remove unused variable `nclusters'.
7654 (NOTHING): Remove unused static global variable.
7655 (uniscribe_check_otf): Remove unused variable `table'.
7656 (uniscribe_font_driver): Add missing initializers.
7657
7658 2011-03-23 Julien Danjou <julien@danjou.info>
7659
7660 * term.c (Fsuspend_tty, Fresume_tty):
7661 * minibuf.c (read_minibuf, run_exit_minibuf_hook):
7662 * window.c (temp_output_buffer_show):
7663 * insdel.c (signal_before_change):
7664 * frame.c (Fhandle_switch_frame):
7665 * fileio.c (Fdo_auto_save):
7666 * emacs.c (Fkill_emacs):
7667 * editfns.c (save_excursion_restore):
7668 * cmds.c (internal_self_insert):
7669 * callint.c (Fcall_interactively):
7670 * buffer.c (Fkill_all_local_variables):
7671 * keyboard.c (Fcommand_execute, Fsuspend_emacs, safe_run_hooks_1):
7672 Use Frun_hooks.
7673 (command_loop_1): Use Frun_hooks. Call safe_run_hooks
7674 unconditionnaly since it does the check itself.
7675
7676 2011-03-23 Paul Eggert <eggert@cs.ucla.edu>
7677
7678 Fix more problems found by GCC 4.5.2's static checks.
7679
7680 * coding.c (encode_coding_raw_text): Avoid unnecessary test
7681 the first time through the loop, since we know p0 < p1 then.
7682 This also avoids a gcc -Wstrict-overflow warning.
7683
7684 * lisp.h (SAFE_ALLOCA, SAFE_ALLOCA_LISP): Avoid 'int' overflow
7685 leading to a memory leak, possible in functions like
7686 load_charset_map_from_file that can allocate an unbounded number
7687 of objects (Bug#8318).
7688
7689 * xmenu.c (set_frame_menubar): Use EMACS_UINT, not int, for indexes
7690 that could (at least in theory) be that large.
7691
7692 * xdisp.c (message_log_check_duplicate): Return unsigned long, not int.
7693 This is less likely to overflow, and avoids undefined behavior if
7694 overflow does occur. All callers changed. Use strtoul to scan
7695 for the unsigned long integer.
7696 (pint2hrstr): Simplify and tune code slightly.
7697 This also avoids a (bogus) GCC warning with gcc -Wstrict-overflow.
7698
7699 * scroll.c (do_scrolling): Work around GCC bug 48228.
7700 See <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48228>.
7701
7702 * frame.c (Fmodify_frame_parameters): Simplify loop counter.
7703 This also avoids a warning with gcc -Wstrict-overflow.
7704 (validate_x_resource_name): Simplify count usage.
7705 This also avoids a warning with gcc -Wstrict-overflow.
7706
7707 * fileio.c (Fcopy_file): Report error if fchown or fchmod
7708 fail (Bug#8306).
7709
7710 * emacs.c (Fdaemon_initialized): Do not ignore I/O errors (Bug#8303).
7711
7712 * process.c (Fmake_network_process): Use socklen_t, not int,
7713 where POSIX says socklen_t is required in portable programs.
7714 This fixes a porting bug on hosts like 64-bit HP-UX, where
7715 socklen_t is wider than int (Bug#8277).
7716 (Fmake_network_process, server_accept_connection):
7717 (wait_reading_process_output, read_process_output):
7718 Likewise.
7719
7720 * process.c: Rename or move locals to avoid shadowing.
7721 (list_processes_1, Fmake_network_process):
7722 (read_process_output_error_handler, exec_sentinel_error_handler):
7723 Rename or move locals.
7724 (Fmake_network_process): Define label "retry_connect" only if needed.
7725 (Fnetwork_interface_info): Fix pointer signedness.
7726 (process_send_signal): Add cast to avoid pointer signedness problem.
7727 (FIRST_PROC_DESC, IF_NON_BLOCKING_CONNECT): Remove unused macros.
7728 (create_process): Use 'volatile' to avoid vfork clobbering (Bug#8298).
7729
7730 Make tparam.h and terminfo.c consistent.
7731 * cm.c (tputs, tgoto, BC, UP): Remove extern decls.
7732 Include tparam.h instead, since it declares them.
7733 * cm.h (PC): Remove extern decl; tparam.h now does this.
7734 * deps.mk (cm.o, terminfo.o): Depend on tparam.h.
7735 * terminfo.c: Include tparam.h, to check interfaces.
7736 (tparm): Make 1st arg a const pointer in decl. Put it at top level.
7737 (tparam): Adjust signature to match interface in tparam.h;
7738 this removes some undefined behavior. Check that outstring and len
7739 are zero, which they always are with Emacs.
7740 * tparam.h (PC, BC, UP): New extern decls.
7741
7742 * xftfont.c (xftfont_shape): Now static, and defined only if needed.
7743 (xftfont_open): Rename locals to avoid shadowing.
7744
7745 * ftfont.c (ftfont_resolve_generic_family): Fix pointer signedness.
7746 (ftfont_otf_capability, ftfont_shape): Omit decls if not needed.
7747 (OTF_TAG_SYM): Omit macro if not needed.
7748 (ftfont_list): Remove unused local.
7749 (get_adstyle_property, ftfont_pattern_entity):
7750 (ftfont_lookup_cache, ftfont_open, ftfont_anchor_point):
7751 Rename locals to avoid shadowing.
7752
7753 * xfont.c (xfont_list_family): Mark var as initialized.
7754
7755 * xml.c (make_dom): Now static.
7756
7757 * composite.c (composition_compute_stop_pos): Rename local to
7758 avoid shadowing.
7759 (composition_reseat_it): Remove unused locals.
7760 (find_automatic_composition, composition_adjust_point): Likewise.
7761 (composition_update_it): Mark var as initialized.
7762 (find_automatic_composition): Mark vars as initialized,
7763 with a FIXME (Bug#8290).
7764
7765 character.h: Rename locals to avoid shadowing.
7766 * character.h (PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE):
7767 (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE, FETCH_CHAR_ADVANCE):
7768 (FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, BUF_INC_POS):
7769 (BUF_DEC_POS): Be more systematic about renaming local temporaries
7770 to avoid shadowing.
7771
7772 * textprop.c (property_change_between_p): Remove; unused.
7773
7774 * intervals.c (interval_start_pos): Now static.
7775
7776 * intervals.h (CHECK_TOTAL_LENGTH): Avoid empty "else".
7777
7778 * atimer.c (start_atimer, append_atimer_lists, set_alarm):
7779 Rename locals to avoid shadowing.
7780
7781 * sound.c (wav_play, au_play, Fplay_sound_internal):
7782 Fix pointer signedness.
7783 (alsa_choose_format): Remove unused local var.
7784 (wav_play): Initialize a variable to 0, to prevent undefined
7785 behavior (Bug#8278).
7786
7787 * region-cache.c (insert_cache_boundary): Redo var to avoid shadowing.
7788
7789 * region-cache.h (pp_cache): New decl, for gcc -Wmissing-prototypes.
7790
7791 * callproc.c (Fcall_process): Use 'volatile' to avoid vfork
7792 clobbering (Bug#8298).
7793 * sysdep.c (sys_subshell): Likewise.
7794 Previously, the sys_subshell 'volatile' was incorrectly IF_LINTted out.
7795
7796 * lisp.h (child_setup): Now NO_RETURN unless DOS_NT.
7797 This should get cleaned up, so that child_setup has the
7798 same signature on all platforms.
7799
7800 * callproc.c (call_process_cleanup): Now static.
7801 (relocate_fd): Rename locals to avoid shadowing.
7802
7803 2011-03-22 Chong Yidong <cyd@stupidchicken.com>
7804
7805 * xterm.c (x_clear_frame): Remove XClearWindow call. This appears
7806 not to be necessary, and produces flickering.
7807
7808 2011-03-20 Glenn Morris <rgm@gnu.org>
7809
7810 * config.in: Remove file.
7811
7812 2011-03-20 Juanma Barranquero <lekktu@gmail.com>
7813
7814 * minibuf.c (Vcompleting_read_function): Don't declare, global variables
7815 are now in src/globals.h.
7816 (syms_of_minibuf): Remove spurious & from previous change.
7817
7818 2011-03-20 Leo <sdl.web@gmail.com>
7819
7820 * minibuf.c (completing-read-function): New variable.
7821 (completing-read-default): Rename from completing-read.
7822 (completing-read): Call completing-read-function.
7823
7824 2011-03-19 Juanma Barranquero <lekktu@gmail.com>
7825
7826 * xfaces.c (Fx_load_color_file):
7827 Read color file from absolute filename (bug#8250).
7828
7829 2011-03-19 Juanma Barranquero <lekktu@gmail.com>
7830
7831 * makefile.w32-in: Update dependencies.
7832
7833 2011-03-17 Eli Zaretskii <eliz@gnu.org>
7834
7835 * makefile.w32-in ($(BLD)/unexw32.$(O)): Depend on $(SRC)/unexec.h.
7836
7837 2011-03-17 Paul Eggert <eggert@cs.ucla.edu>
7838
7839 Fix more problems found by GCC 4.5.2's static checks.
7840
7841 * process.c (make_serial_process_unwind, send_process_trap):
7842 (sigchld_handler): Now static.
7843
7844 * process.c (allocate_pty): Let PTY_ITERATION declare iteration vars.
7845 That way, the code declares only the vars that it needs.
7846 * s/aix4-2.h (PTY_ITERATION): Declare iteration vars.
7847 * s/cygwin.h (PTY_ITERATION): Likewise.
7848 * s/darwin.h (PTY_ITERATION): Likewise.
7849 * s/gnu-linux.h (PTY_ITERATION): Likewise.
7850
7851 * s/irix6-5.h (PTY_OPEN): Declare stb, to loosen coupling.
7852 * process.c (allocate_pty): Don't declare stb unless it's needed.
7853
7854 * bytecode.c (MAYBE_GC): Rewrite so as not to use empty "else".
7855 (CONSTANTLIM): Remove; unused.
7856 (METER_CODE, Bscan_buffer, Bread_char, Bset_mark):
7857 Define only if needed.
7858
7859 * unexelf.c (unexec): Name an expression,
7860 to avoid gcc -Wbad-function-cast warning.
7861 Use a different way to cause a compilation error if anyone uses
7862 n rather than nn, a way that does not involve shadowing.
7863 (ELF_BSS_SECTION_NAME, OLD_PROGRAM_H): Remove; unused.
7864
7865 * deps.mk (unexalpha.o): Remove; unused.
7866
7867 New file unexec.h, the (simple) interface for unexec (Bug#8267).
7868 * unexec.h: New file.
7869 * deps.mk (emacs.o, unexaix.o, unexcw.o, unexcoff.o, unexelf.o):
7870 (unexhp9k800.o, unexmacosx.o, unexsol.o, unexw32.o):
7871 Depend on unexec.h.
7872 * emacs.c [!defined CANNOT_DUMP]: Include unexec.h.
7873 * unexaix.c, unexcoff.c, unexcw.c, unexelf.c, unexhp9k800.c:
7874 * unexmacosx.c, unexsol.c, unexw32.c: Include unexec.h.
7875 Change as necessary to match prototype in unexec.h.
7876
7877 * syntax.c (Fforward_comment, scan_lists): Rename locals to avoid
7878 shadowing.
7879 (back_comment, skip_chars): Mark vars as initialized.
7880
7881 * character.h (FETCH_STRING_CHAR_ADVANCE_NO_CHECK, BUF_INC_POS):
7882 Rename locals to avoid shadowing.
7883
7884 * lread.c (read1): Rewrite so as not to use empty "else".
7885 (Fload, readevalloop, read1): Rename locals to avoid shadowing.
7886
7887 * print.c (Fredirect_debugging_output): Fix pointer signedess.
7888
7889 * lisp.h (debug_output_compilation_hack): Add decl here, to avoid
7890 warning when compiling print.c.
7891
7892 * font.c (font_unparse_fcname): Abort in an "impossible" situation
7893 instead of using an uninitialized var.
7894 (font_sort_entities): Mark var as initialized.
7895
7896 * character.h (FETCH_CHAR_ADVANCE): Rename locals to avoid shadowing.
7897
7898 * font.c (font_unparse_xlfd): Don't mix pointers to variables with
7899 pointers to constants.
7900 (font_parse_fcname): Remove unused vars.
7901 (font_delete_unmatched): Now static.
7902 (font_get_spec): Remove; unused.
7903 (font_style_to_value, font_prop_validate_style, font_unparse_fcname):
7904 (font_update_drivers, Ffont_get_glyphs, font_add_log):
7905 Rename or move locals to avoid shadowing.
7906
7907 * fns.c (require_nesting_list, require_unwind): Now static.
7908 (Ffillarray): Rename locals to avoid shadowing.
7909
7910 * floatfns.c (domain_error2): Define only if needed.
7911 (Ffrexp, Fldexp): Rename locals to avoid shadowing.
7912
7913 * alloc.c (mark_backtrace): Move decl from here ...
7914 * lisp.h: ... to here, so that it can be checked.
7915
7916 * eval.c (call_debugger, do_debug_on_call, grow_specpdl): Now static.
7917 (Fdefvar): Rewrite so as not to use empty "else".
7918 (lisp_indirect_variable): Name an expression,
7919 to avoid gcc -Wbad-function-cast warning.
7920 (Fdefvar): Rename locals to avoid shadowing.
7921
7922 * callint.c (quotify_arg, quotify_args): Now static.
7923 (Fcall_interactively): Rename locals to avoid shadowing.
7924 Use const pointer when appropriate.
7925
7926 * lisp.h (get_system_name, get_operating_system_release):
7927 Move decls here, to check interfaces.
7928 * process.c (get_operating_system_release): Move decl to lisp.h.
7929 * xrdb.c (get_system_name): Likewise.
7930 * editfns.c (init_editfns, Fuser_login_name, Fuser_uid):
7931 (Fuser_real_uid, Fuser_full_name): Remove unnecessary casts,
7932 some of which prompt warnings from gcc -Wbad-function-cast.
7933 (Fformat_time_string, Fencode_time, Finsert_char):
7934 (Ftranslate_region_internal, Fformat):
7935 Rename or remove local vars to avoid shadowing.
7936 (Ftranslate_region_internal): Mark var as initialized.
7937
7938 * doc.c (Fdocumentation, Fsnarf_documentation): Move locals to
7939 avoid shadowing.
7940
7941 * lisp.h (eassert): Check that the argument compiles, even if
7942 ENABLE_CHECKING is not defined.
7943
7944 * data.c (Findirect_variable): Name an expression, to avoid
7945 gcc -Wbad-function-cast warning.
7946 (default_value, arithcompare, arith_driver, arith_error): Now static.
7947 (store_symval_forwarding): Rename local to avoid shadowing.
7948 (Fmake_variable_buffer_local, Fmake_local_variable):
7949 Mark variables as initialized.
7950 (do_blv_forwarding, do_symval_forwarding): Remove; unused.
7951
7952 * alloc.c (check_cons_list): Do not define unless GC_CHECK_CONS_LIST.
7953 (Fmake_vector, Fvector, Fmake_byte_code, Fgarbage_collect):
7954 Rename locals to avoid shadowing.
7955 (mark_stack): Move local variables into the #ifdef region where
7956 they're used.
7957 (BLOCK_INPUT_ALLOC, UNBLOCK_INPUT_ALLOC): Define only if
7958 ! defined SYSTEM_MALLOC && ! defined SYNC_INPUT, as they are not
7959 needed otherwise.
7960 (CHECK_ALLOCATED): Define only if GC_CHECK_MARKED_OBJECTS.
7961 (GC_STRING_CHARS): Remove; not used.
7962 (Fmemory_limit): Cast sbrk's returned value to char *.
7963
7964 * lisp.h (check_cons_list): Declare if GC_CHECK_CONS_LIST; this
7965 avoids undefined behavior in theory.
7966
7967 * regex.c (IF_LINT): Add defn, for benefit of ../lib-src.
7968
7969 Use functions, not macros, for up- and down-casing (Bug#8254).
7970 * buffer.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
7971 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Remove. All callers changed
7972 to use the following functions instead of these macros.
7973 (downcase): Adjust to lack of DOWNCASE_TABLE. Return int, not
7974 EMACS_INT, since callers assume the returned value fits in int.
7975 (upcase1): Likewise, for UPCASE_TABLE.
7976 (uppercasep, lowercasep, upcase): New static inline functions.
7977 * editfns.c (Fchar_equal): Remove no-longer-needed workaround for
7978 the race-condition problem in the old DOWNCASE.
7979
7980 * regex.c (CHARSET_LOOKUP_RANGE_TABLE_RAW, POP_FAILURE_REG_OR_COUNT):
7981 Rename locals to avoid shadowing.
7982 (regex_compile, re_match_2_internal): Move locals to avoid shadowing.
7983 (regex_compile, re_search_2, re_match_2_internal):
7984 Remove unused local vars.
7985 (FREE_VAR): Rewrite so as not to use empty "else",
7986 which gcc can warn about.
7987 (regex_compile, re_match_2_internal): Mark locals as initialized.
7988 (RETALLOC_IF): Define only if needed.
7989 (WORDCHAR_P): Likewise. This one is never needed, but is used
7990 only in a comment talking about a compiler bug, so put inside
7991 the #if 0 of that comment.
7992 (CHARSET_LOOKUP_BITMAP, FAIL_STACK_FULL, RESET_FAIL_STACK):
7993 (PUSH_FAILURE_ELT, BUF_PUSH_3, STOP_ADDR_VSTRING):
7994 Remove; unused.
7995
7996 * search.c (boyer_moore): Rename locals to avoid shadowing.
7997 * character.h (FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE):
7998 (PREV_CHAR_BOUNDARY): Likewise.
7999
8000 * search.c (simple_search): Remove unused var.
8001
8002 * dired.c (compile_pattern): Move decl from here ...
8003 * lisp.h: ... to here, so that it can be checked.
8004 (struct re_registers): New forward decl.
8005
8006 * character.h (INC_POS, DEC_POS): Rename locals to avoid shadowing.
8007
8008 * indent.c (MULTIBYTE_BYTES_WIDTH): New args bytes, width.
8009 All uses changed.
8010 (MULTIBYTE_BYTES_WIDTH, scan_for_column, compute_motion):
8011 Rename locals to avoid shadowing.
8012 (Fvertical_motion): Mark locals as initialized.
8013
8014 * casefiddle.c (casify_object, casify_region): Now static.
8015 (casify_region): Mark local as initialized.
8016
8017 * cmds.c (internal_self_insert): Rename local to avoid shadowing.
8018
8019 * lisp.h (GCPRO2_VAR, GCPRO3_VAR, GCPRO4_VAR, GCPRO5_VAR, GCPRO6_VAR):
8020 New macros, so that the caller can use some names other than
8021 gcpro1, gcpro2, etc.
8022 (GCPRO2, GCPRO3, GCPRO4, GCPRO5, GCPRO6): Reimplement in terms
8023 of the new macros.
8024 (GCPRO1_VAR, UNGCPRO_VAR): Change the meaning of the second
8025 argument, for consistency with GCPRO2_VAR, etc: it is now the
8026 prefix of the variable, not the variable itself. All uses
8027 changed.
8028 * dired.c (directory_files_internal, file_name_completion):
8029 Rename locals to avoid shadowing.
8030
8031 Fix a race condition diagnosed by gcc -Wsequence-point (Bug#8254).
8032 An expression of the form (DOWNCASE (x) == DOWNCASE (y)), found in
8033 dired.c's scmp function, had undefined behavior.
8034 * lisp.h (DOWNCASE_TABLE, UPCASE_TABLE, DOWNCASE, UPPERCASEP):
8035 (NOCASEP, LOWERCASEP, UPCASE, UPCASE1): Move from here ...
8036 * buffer.h: ... to here, because these macros use current_buffer,
8037 and the new implementation with inline functions needs to have
8038 current_buffer in scope now, rather than later when the macros
8039 are used.
8040 (downcase, upcase1): New static inline functions.
8041 (DOWNCASE, UPCASE1): Reimplement using these functions.
8042 This avoids undefined behavior in expressions like
8043 DOWNCASE (x) == DOWNCASE (y), which previously suffered
8044 from race conditions in accessing the global variables
8045 case_temp1 and case_temp2.
8046 * casetab.c (case_temp1, case_temp2): Remove; no longer needed.
8047 * lisp.h (case_temp1, case_temp2): Remove their decls.
8048 * character.h (ASCII_CHAR_P): Move from here ...
8049 * lisp.h: ... to here, so that the inline functions mentioned
8050 above can use them.
8051
8052 * dired.c (directory_files_internal_unwind): Now static.
8053
8054 * fileio.c (file_name_as_directory, directory_file_name):
8055 (barf_or_query_if_file_exists, auto_save_error, auto_save_1):
8056 Now static.
8057 (file_name_as_directory): Use const pointers when appropriate.
8058 (Fexpand_file_name): Likewise. In particular, newdir might
8059 point at constant storage, so make it a const pointer.
8060 (Fmake_directory_internal, Fread_file_name): Remove unused vars.
8061 (Ffile_selinux_context, Fset_file_selinux_context): Fix pointer
8062 signedness issues.
8063 (Fset_file_times, Finsert_file_contents, auto_save_error):
8064 Rename locals to avoid shadowing.
8065
8066 * minibuf.c (choose_minibuf_frame_1): Now static.
8067 (Ftry_completion, Fall_completions): Rename or remove locals
8068 to avoid shadowing.
8069
8070 * marker.c (bytepos_to_charpos): Remove; unused.
8071
8072 * lisp.h (verify_bytepos, count_markers): New decls,
8073 so that gcc does not warn that these functions aren't declared.
8074
8075 * insdel.c (check_markers, make_gap_larger, make_gap_smaller):
8076 (reset_var_on_error, Fcombine_after_change_execute_1): Now static.
8077 (CHECK_MARKERS): Redo to avoid gcc -Wempty-body diagnostic.
8078 (copy_text): Remove unused local var.
8079
8080 * filelock.c (within_one_second): Now static.
8081 (lock_file_1): Rename local to avoid shadowing.
8082
8083 * buffer.c (fix_overlays_before): Mark locals as initialized.
8084 (fix_start_end_in_overlays): Likewise. This function should be
8085 simplified by using pointers-to-pointers, but that's a different
8086 matter.
8087 (switch_to_buffer_1): Now static.
8088 (Fkill_buffer, record_buffer, Fbury_buffer, Fset_buffer_multibyte):
8089 (report_overlay_modification): Rename locals to avoid shadowing.
8090
8091 * sysdep.c (system_process_attributes): Rename vars to avoid shadowing.
8092 Fix pointer signedness issue.
8093 (sys_subshell): Mark local as volatile if checking for lint,
8094 to suppress a gcc -Wclobbered warning that does not seem to be right.
8095 (MAXPATHLEN): Define only if needed.
8096
8097 * process.c (serial_open, serial_configure): Move decls from here ...
8098 * systty.h: ... to here, so that they can be checked.
8099
8100 * fns.c (get_random, seed_random): Move extern decls from here ...
8101 * lisp.h: ... to here, so that they can be checked.
8102
8103 * sysdep.c (reset_io): Now static.
8104 (wait_for_termination_signal): Remove; unused.
8105
8106 * keymap.c (keymap_parent, keymap_memberp, map_keymap_internal):
8107 (copy_keymap_item, append_key, push_text_char_description):
8108 Now static.
8109 (Fwhere_is_internal): Don't test CONSP (sequences) unnecessarily.
8110 (DENSE_TABLE_SIZE): Remove; unused.
8111 (get_keymap, access_keymap, Fdefine_key, Fwhere_is_internal):
8112 (describe_map_tree):
8113 Rename locals to avoid shadowing.
8114
8115 * keyboard.c: Declare functions static if they are not used elsewhere.
8116 (echo_char, echo_dash, cmd_error, top_level_2):
8117 (poll_for_input, handle_async_input): Now static.
8118 (read_char, kbd_buffer_get_event, make_lispy_position):
8119 (make_lispy_event, make_lispy_movement, apply_modifiers):
8120 (decode_keyboard_code, tty_read_avail_input, menu_bar_items):
8121 (parse_tool_bar_item, read_key_sequence, Fread_key_sequence):
8122 (Fread_key_sequence_vector): Rename locals to avoid shadowing.
8123 (read_key_sequence, read_char): Mark locals as initialized.
8124 (Fexit_recursive_edit, Fabort_recursive_edit): Mark with NO_RETURN.
8125
8126 * keyboard.h (make_ctrl_char): New decl.
8127 (mark_kboards): Move decl here ...
8128 * alloc.c (mark_kboards): ... from here.
8129
8130 * lisp.h (force_auto_save_soon): New decl.
8131
8132 * emacs.c (init_cmdargs): Rename local to avoid shadowing.
8133 (DEFINE_DUMMY_FUNCTION): New macro.
8134 (__do_global_ctors, __do_global_ctors_aux, __do_global_dtors, __main):
8135 Use it.
8136 (main): Add casts to avoid warnings
8137 if GCC considers string literals to be constants.
8138
8139 * lisp.h (fatal_error_signal): Add decl, since it's exported.
8140
8141 * dbusbind.c: Pointer signedness fixes.
8142 (xd_signature, xd_append_arg, xd_initialize):
8143 (Fdbus_call_method, Fdbus_call_method_asynchronously):
8144 (Fdbus_method_return_internal, Fdbus_method_error_internal):
8145 (Fdbus_send_signal, xd_read_message_1, Fdbus_register_service):
8146 (Fdbus_register_signal): Use SSDATA when the context wants char *.
8147
8148 * dbusbind.c (Fdbus_init_bus): Add cast to avoid warning
8149 if GCC considers string literals to be constants.
8150 (Fdbus_register_service, Fdbus_register_method): Remove unused vars.
8151
8152 2011-03-16 Stefan Monnier <monnier@iro.umontreal.ca>
8153
8154 * print.c (PRINT_CIRCLE_CANDIDATE_P): New macro.
8155 (print_preprocess, print_object): New macro to fix last change.
8156
8157 * print.c (print_preprocess): Don't forget font objects.
8158
8159 2011-03-16 Juanma Barranquero <lekktu@gmail.com>
8160
8161 * emacs.c (USAGE3): Doc fixes.
8162
8163 2011-03-15 Andreas Schwab <schwab@linux-m68k.org>
8164
8165 * coding.c (detect_coding_iso_2022): Reorganize code to clarify
8166 structure.
8167
8168 2011-03-14 Juanma Barranquero <lekktu@gmail.com>
8169
8170 * lisp.h (VWindow_system, Qfile_name_history):
8171 * keyboard.h (lispy_function_keys) [WINDOWSNT]:
8172 * w32term.h (w32_system_caret_hwnd, w32_system_caret_height)
8173 (w32_system_caret_x, w32_system_caret_y): Declare extern.
8174
8175 * w32select.c: Don't #include "keyboard.h".
8176 (run_protected): Add extern declaration for waiting_for_input.
8177
8178 * w32.c (Qlocal, noninteractive1, inhibit_window_system):
8179 * w32console.c (detect_input_pending, read_input_pending)
8180 (encode_terminal_code):
8181 * w32fns.c (quit_char, lispy_function_keys, Qtooltip)
8182 (w32_system_caret_hwnd, w32_system_caret_height, w32_system_caret_x)
8183 (w32_system_caret_y, Qfile_name_history):
8184 * w32font.c (w32font_driver, QCantialias, QCotf, QClang):
8185 * w32inevt.c (reinvoke_input_signal, lispy_function_keys):
8186 * w32menu.c (Qmenu_bar, QCtoggle, QCradio, Qoverriding_local_map)
8187 (Qoverriding_terminal_local_map, Qmenu_bar_update_hook):
8188 * w32proc.c (Qlocal, report_file_error):
8189 * w32term.c (Vwindow_system, updating_frame):
8190 * w32uniscribe.c (initialized, uniscribe_font_driver):
8191 Remove unneeded extern declarations.
8192
8193 2011-03-14 Chong Yidong <cyd@stupidchicken.com>
8194
8195 * buffer.c (Fmake_indirect_buffer): Fix incorrect assertions.
8196
8197 2011-03-13 Chong Yidong <cyd@stupidchicken.com>
8198
8199 * buffer.h (BUF_BEGV, BUF_BEGV_BYTE, BUF_ZV, BUF_ZV_BYTE, BUF_PT)
8200 (BUF_PT_BYTE): Rewrite to handle indirect buffers (Bug#8219).
8201 These macros can no longer be used for assignment.
8202
8203 * buffer.c (Fget_buffer_create, Fmake_indirect_buffer):
8204 Assign struct members directly, instead of using BUF_BEGV etc.
8205 (record_buffer_markers, fetch_buffer_markers): New functions for
8206 recording and fetching special buffer markers.
8207 (set_buffer_internal_1, set_buffer_temp): Use them.
8208
8209 * lread.c (unreadchar): Use SET_BUF_PT_BOTH.
8210
8211 * insdel.c (adjust_point): Use SET_BUF_PT_BOTH.
8212
8213 * intervals.c (temp_set_point_both): Use SET_BUF_PT_BOTH.
8214 (get_local_map): Use SET_BUF_BEGV_BOTH and SET_BUF_ZV_BOTH.
8215
8216 * xdisp.c (hscroll_window_tree):
8217 (reconsider_clip_changes): Use PT instead of BUF_PT.
8218
8219 2011-03-13 Eli Zaretskii <eliz@gnu.org>
8220
8221 * makefile.w32-in ($(BLD)/editfns.$(O)): Depend on
8222 $(EMACS_ROOT)/lib/intprops.h.
8223
8224 2011-03-13 Paul Eggert <eggert@cs.ucla.edu>
8225
8226 Fix more problems found by GCC 4.5.2's static checks.
8227
8228 * gtkutil.c (xg_get_pixbuf_from_pixmap): Add cast from char *
8229 to unsigned char * to avoid compiler diagnostic.
8230 (xg_free_frame_widgets): Make it clear that a local variable is
8231 needed only if USE_GTK_TOOLTIP.
8232 (gdk_window_get_screen): Make it clear that this macro is needed
8233 only if USE_GTK_TOOLTIP.
8234 (int_gtk_range_get_value): New function, which avoids a diagnostic
8235 from gcc -Wbad-function-cast.
8236 (xg_set_toolkit_scroll_bar_thumb): Use it.
8237 (xg_tool_bar_callback, xg_tool_item_stale_p): Rewrite to avoid
8238 diagnostic from gcc -Wbad-function-cast.
8239 (get_utf8_string, xg_get_file_with_chooser):
8240 Rename locals to avoid shadowing.
8241 (create_dialog): Move locals to avoid shadowing.
8242
8243 * xgselect.c (xg_select): Remove unused var.
8244
8245 * image.c (four_corners_best): Mark locals as initialized.
8246 (gif_load): Initialize transparent_p to zero (Bug#8238).
8247 Mark another local as initialized.
8248 (my_png_error, my_error_exit): Mark with NO_RETURN.
8249
8250 * image.c (clear_image_cache): Now static.
8251 (DIM, HAVE_STDLIB_H_1): Remove unused macros.
8252 (xpm_load): Redo to avoid "discards qualifiers" gcc warning.
8253 (x_edge_detection): Remove unnecessary cast that
8254 gcc -Wbad-function-cast diagnoses.
8255 (gif_load): Fix pointer signedness.
8256 (clear_image_cache, xbm_read_bitmap_data, x_detect_edges):
8257 (jpeg_load, gif_load): Rename locals to avoid shadowing.
8258
8259 2011-03-12 Paul Eggert <eggert@cs.ucla.edu>
8260
8261 Improve quality of tests for time stamp overflow.
8262 For example, without this patch (encode-time 0 0 0 1 1
8263 1152921504606846976) returns the obviously-bogus value (-948597
8264 62170) on my RHEL 5.5 x86-64 host. With the patch, it correctly
8265 reports time overflow. See
8266 <http://lists.gnu.org/archive/html/emacs-devel/2011-03/msg00470.html>.
8267 * deps.mk (editfns.o): Depend on ../lib/intprops.h.
8268 * editfns.c: Include limits.h and intprops.h.
8269 (TIME_T_MIN, TIME_T_MAX): New macros.
8270 (time_overflow): Move earlier, to before first use.
8271 (hi_time, lo_time): New functions, for an accurate test for
8272 out-of-range times.
8273 (Fcurrent_time, Fget_internal_run_time, make_time): Use them.
8274 (Fget_internal_run_time): Don't assume time_t fits in int.
8275 (make_time): Use list2 instead of Fcons twice.
8276 (Fdecode_time): More accurate test for out-of-range times.
8277 (check_tm_member): New function.
8278 (Fencode_time): Use it, to test for out-of-range times.
8279 (lisp_time_argument): Don't rely on undefined left-shift and
8280 right-shift behavior when checking for time stamp overflow.
8281
8282 * editfns.c (time_overflow): New function, refactoring common code.
8283 (Fformat_time_string, Fdecode_time, Fencode_time):
8284 (Fcurrent_time_string): Use it.
8285
8286 Move 'make_time' to be next to its inverse 'lisp_time_argument'.
8287 * dired.c (make_time): Move to ...
8288 * editfns.c (make_time): ... here.
8289 * systime.h: Note the move.
8290
8291 2011-03-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
8292
8293 * fringe.c (update_window_fringes): Remove unused variables.
8294
8295 * unexmacosx.c (copy_data_segment): Also copy __got section.
8296 (Bug#8223)
8297
8298 2011-03-12 Eli Zaretskii <eliz@gnu.org>
8299
8300 * termcap.c [MSDOS]: Include "msdos.h".
8301 (find_capability, tgetnum, tgetflag, tgetstr, tputs, tgetent):
8302 Constify `char *' arguments and their references according to
8303 prototypes in tparam.h.
8304
8305 * deps.mk (termcap.o): Depend on tparam.h and msdos.h.
8306
8307 * msdos.c (XMenuAddPane): 3rd argument is `const char *' now.
8308 Adapt all references accordingly.
8309
8310 * msdos.h (XMenuAddPane): 3rd argument is `const char *' now.
8311
8312 2011-03-11 Tom Tromey <tromey@redhat.com>
8313
8314 * buffer.c (syms_of_buffer): Remove obsolete comment.
8315
8316 2011-03-11 Eli Zaretskii <eliz@gnu.org>
8317
8318 * termhooks.h (encode_terminal_code): Declare prototype.
8319
8320 * msdos.c (encode_terminal_code): Don't declare prototype.
8321
8322 * term.c (encode_terminal_code): Now external again, used by
8323 w32console.c and msdos.c.
8324
8325 * makefile.w32-in ($(BLD)/term.$(O), ($(BLD)/tparam.$(O)):
8326 Depend on $(SRC)/tparam.h, see 2011-03-11T07:24:21Z!eggert@cs.ucla.edu.
8327
8328 2011-03-11 Paul Eggert <eggert@cs.ucla.edu>
8329
8330 Fix some minor problems found by GCC 4.5.2's static checks.
8331
8332 * fringe.c (update_window_fringes): Mark locals as initialized
8333 (Bug#8227).
8334 (destroy_fringe_bitmap, init_fringe_bitmap): Now static.
8335
8336 * alloc.c (mark_fringe_data): Move decl from here ...
8337 * lisp.h (mark_fringe_data) [HAVE_WINDOW_SYSTEM]: ... to here,
8338 to check its interface.
8339 (init_fringe_once): Do not declare unless HAVE_WINDOW_SYSTEM.
8340
8341 * fontset.c (free_realized_fontset): Now static.
8342 (Fset_fontset_font): Rename local to avoid shadowing.
8343 (fontset_font): Mark local as initialized.
8344 (FONTSET_SPEC, FONTSET_REPERTORY, RFONT_DEF_REPERTORY): Remove; unused.
8345
8346 * xrdb.c: Include "xterm.h", to check x_load_resources's interface.
8347
8348 * xselect.c (x_disown_buffer_selections): Remove; not used.
8349 (TRACE3) [!defined TRACE_SELECTION]: Remove; not used.
8350 (x_own_selection, Fx_disown_selection_internal): Rename locals
8351 to avoid shadowing.
8352 (x_handle_dnd_message): Remove local to avoid shadowing.
8353
8354 * lisp.h (GCPRO1_VAR, UNGCPRO_VAR): New macros,
8355 so that the caller can use some name other than gcpro1.
8356 (GCPRO1, UNGCPRO): Reimplement in terms of the new macros.
8357 * xfns.c (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
8358 (Fx_backspace_delete_keys_p):
8359 Use them to avoid shadowing, and rename vars to avoid shadowing.
8360 (x_decode_color, x_set_name, x_window): Now static.
8361 (Fx_create_frame): Add braces to silence GCC warning.
8362 (Fx_file_dialog, Fx_select_font): Fix pointer signedness.
8363 (x_real_positions, xg_set_icon_from_xpm_data, x_create_tip_frame):
8364 Remove unused locals.
8365 (Fx_create_frame, x_create_tip_frame, Fx_show_tip):
8366 (Fx_backspace_delete_keys_p): Rename locals to avoid shadowing.
8367 Some of these renamings use the new GCPRO1_VAR and UNGCPRO_VAR
8368 macros.
8369
8370 * xterm.h (x_mouse_leave): New decl.
8371
8372 * xterm.c (x_copy_dpy_color, x_focus_on_frame, x_unfocus_frame):
8373 Remove unused functions.
8374 (x_shift_glyphs_for_insert, XTflash, XTring_bell):
8375 (x_calc_absolute_position): Now static.
8376 (XTread_socket): Don't define label "out" unless it's used.
8377 Don't declare local "event" unless it's used.
8378 (x_iconify_frame, x_free_frame_resources): Don't declare locals
8379 unless they are used.
8380 (XEMBED_VERSION, xembed_set_info): Don't define unless needed.
8381 (x_fatal_error_signal): Remove; not used.
8382 (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position):
8383 (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor):
8384 (x_error_catcher, x_connection_closed, x_error_handler):
8385 (x_error_quitter, xembed_send_message, x_iconify_frame):
8386 (my_log_handler): Rename locals to avoid shadowing.
8387 (x_delete_glyphs, x_ins_del_lines): Mark with NO_RETURN.
8388 (x_connection_closed): Tell GCC not to suggest NO_RETURN.
8389
8390 * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font):
8391 Rename or move locals to avoid shadowing.
8392 (tty_defined_color, merge_face_heights): Now static.
8393 (free_realized_faces_for_fontset): Remove; not used.
8394 (Fx_list_fonts): Mark variable that gcc -Wuninitialized
8395 does not deduce is never used uninitialized.
8396 (STRDUPA, LSTRDUPA, FONT_POINT_SIZE_QUANTUM): Remove; not used.
8397 (LFACEP): Define only if XASSERTS, as it's not needed otherwise.
8398
8399 * terminal.c (store_terminal_param): Now static.
8400
8401 * xmenu.c (menu_highlight_callback): Now static.
8402 (set_frame_menubar): Remove unused local.
8403 (xmenu_show): Rename parameter to avoid shadowing.
8404 (xmenu_show, xdialog_show, xmenu_show): Make local pointers "const"
8405 since they might point to immutable storage.
8406 (next_menubar_widget_id): Declare only if USE_X_TOOLKIT,
8407 since it's unused otherwise.
8408
8409 * xdisp.c (produce_glyphless_glyph): Initialize lower_xoff.
8410 Add a FIXME, since the code still doesn't look right. (Bug#8215)
8411 (Fcurrent_bidi_paragraph_direction): Simplify slightly; this
8412 avoids a gcc -Wuninitialized diagnostic.
8413 (display_line, BUILD_COMPOSITE_GLYPH_STRING, draw_glyphs):
8414 (note_mouse_highlight): Mark variables that gcc -Wuninitialized
8415 does not deduce are never used uninitialized.
8416
8417 * lisp.h (IF_LINT): New macro, copied from ../lib-src/emacsclient.c.
8418
8419 * xdisp.c (redisplay_window): Rename local to avoid shadowing.
8420 * window.c (window_loop, size_window):
8421 (run_window_configuration_change_hook, enlarge_window): Likewise.
8422
8423 * window.c (display_buffer): Now static.
8424 (size_window): Mark variables that gcc -Wuninitialized
8425 does not deduce are never used uninitialized.
8426 * window.h (check_all_windows): New decl, to forestall
8427 gcc -Wmissing-prototypes diagnostic.
8428 * dispextern.h (bidi_dump_cached_states): Likewise.
8429
8430 * charset.h (CHECK_CHARSET_GET_CHARSET): Rename locals to avoid
8431 shadowing.
8432 * charset.c (map_charset_for_dump, Fchar_charset): Likewise.
8433 Include <limits.h>.
8434 (Fsort_charsets): Redo min/max calculation to shorten the code a bit
8435 and to avoid gcc -Wuninitialized warning.
8436 (load_charset_map): Mark variables that gcc -Wuninitialized
8437 does not deduce are never used uninitialized.
8438 (load_charset): Abort instead of using uninitialized var (Bug#8229).
8439
8440 * coding.c (coding_set_source, coding_set_destination):
8441 Use "else { /* comment */ }" rather than "else /* comment */;"
8442 for clarity, and to avoid gcc -Wempty-body warning.
8443 (Fdefine_coding_system_internal): Don't redeclare 'i' inside
8444 a block, when the outer 'i' will do.
8445 (decode_coding_utf_8, decode_coding_utf_16, detect_coding_emacs_mule):
8446 (emacs_mule_char, decode_coding_emacs_mule, detect_coding_iso_2022):
8447 (decode_coding_iso_2022, decode_coding_sjis, decode_coding_big5):
8448 (decode_coding_raw_text, decode_coding_charset, get_translation_table):
8449 (Fdecode_sjis_char, Fdefine_coding_system_internal):
8450 Rename locals to avoid shadowing.
8451 * character.h (FETCH_STRING_CHAR_ADVANCE): Likewise.
8452 * coding.c (emacs_mule_char, encode_invocation_designation):
8453 Now static, since they're not used elsewhere.
8454 (decode_coding_iso_2022): Add "default: abort ();" as a safety check.
8455 (decode_coding_object, encode_coding_object, detect_coding_system):
8456 (decode_coding_emacs_mule): Mark variables that gcc
8457 -Wuninitialized does not deduce are never used uninitialized.
8458 (detect_coding_iso_2022): Initialize a local variable that might
8459 be used uninitialized. Leave a FIXME because it's not clear that
8460 this initialization is needed. (Bug#8211)
8461 (ISO_CODE_LF, ISO_CODE_CR, CODING_ISO_FLAG_EUC_TW_SHIFT):
8462 (ONE_MORE_BYTE_NO_CHECK, UTF_BOM, UTF_16_INVALID_P):
8463 (SHIFT_OUT_OK, ENCODE_CONTROL_SEQUENCE_INTRODUCER):
8464 (ENCODE_DIRECTION_R2L, ENCODE_DIRECTION_L2R):
8465 Remove unused macros.
8466
8467 * category.c (hash_get_category_set): Remove unused local var.
8468 (copy_category_table): Now static, since it's not used elsewhere.
8469 * character.c (string_count_byte8): Likewise.
8470
8471 * ccl.c (CCL_WRITE_STRING, CCL_ENCODE_CHAR, Fccl_execute_on_string):
8472 (Fregister_code_conversion_map): Rename locals to avoid shadowing.
8473
8474 * chartab.c (copy_sub_char_table): Now static, since it's not used
8475 elsewhere.
8476 (sub_char_table_ref_and_range, char_table_ref_and_range):
8477 Rename locals to avoid shadowing.
8478 (ASET_RANGE, GET_SUB_CHAR_TABLE): Remove unused macros.
8479
8480 * bidi.c (bidi_check_type): Now static, since it's not used elsewhere.
8481 (BIDI_BOB): Remove unused macro.
8482
8483 * cm.c (cmgoto): Mark variables that gcc -Wuninitialized does not
8484 deduce are never used uninitialized.
8485 * term.c (encode_terminal_code): Likewise.
8486
8487 * term.c (encode_terminal_code): Now static. Remove unused local.
8488
8489 * tparam.h: New file.
8490 * term.c, tparam.h: Include it.
8491 * deps.mk (term.o, tparam.o): Depend on tparam.h.
8492 * term.c (tputs, tgetent, tgetflag, tgetnum, tparam, tgetstr):
8493 Move these decls to tparam.h, and make them agree with what
8494 is actually in tparam.c. The previous trick of using incompatible
8495 decls in different modules does not conform to the C standard.
8496 All callers of tparam changed to use tparam's actual API.
8497 * tparam.c (tparam1, tparam, tgoto):
8498 Use const pointers where appropriate.
8499
8500 * cm.c (calccost, cmgoto): Use const pointers where appropriate.
8501 * cm.h (struct cm): Likewise.
8502 * dispextern.h (do_line_insertion_deletion_costs): Likewise.
8503 * scroll.c (ins_del_costs, do_line_insertion_deletion_costs): Likewise.
8504 * term.c (tty_ins_del_lines, calculate_costs, struct fkey_table):
8505 (term_get_fkeys_1, append_glyphless_glyph, produce_glyphless_glyph):
8506 (turn_on_face, init_tty): Likewise.
8507 * termchar.h (struct tty_display_info): Likewise.
8508
8509 * term.c (term_mouse_position): Rename local to avoid shadowing.
8510
8511 * alloc.c (mark_ttys): Move decl from here ...
8512 * lisp.h (mark_ttys): ... to here, so that it's checked against defn.
8513
8514 2011-03-11 Andreas Schwab <schwab@linux-m68k.org>
8515
8516 * .gdbinit (pwinx, xbuffer): Fix access to buffer name.
8517
8518 2011-03-09 Juanma Barranquero <lekktu@gmail.com>
8519
8520 * search.c (compile_pattern_1): Remove argument regp, unused since
8521 revid:rms@gnu.org-19941211082627-3x1g1wyqkjmwloig.
8522 (compile_pattern): Don't pass it.
8523
8524 2011-03-08 Jan Djärv <jan.h.d@swipnet.se>
8525
8526 * xterm.h (DEFAULT_GDK_DISPLAY): New define.
8527 (GDK_WINDOW_XID, gtk_widget_get_preferred_size): New defines
8528 for ! HAVE_GTK3.
8529 (GTK_WIDGET_TO_X_WIN): Use GDK_WINDOW_XID.
8530
8531 * xmenu.c (menu_position_func): Call gtk_widget_get_preferred_size.
8532
8533 * gtkutil.c: Include gtkx.h if HAVE_GTK3. If ! HAVE_GTK3, define
8534 gdk_window_get_screen, gdk_window_get_geometry,
8535 gdk_x11_window_lookup_for_display and GDK_KEY_g.
8536 (xg_set_screen): Use DEFAULT_GDK_DISPLAY.
8537 (xg_get_pixbuf_from_pixmap): New function.
8538 (xg_get_pixbuf_from_pix_and_mask): Change parameters from GdkPixmap
8539 to Pixmap, take frame as parameter, remove GdkColormap parameter.
8540 Call xg_get_pixbuf_from_pixmap instead of
8541 gdk_pixbuf_get_from_drawable.
8542 (xg_get_image_for_pixmap): Do not make GdkPixmaps, call
8543 xg_get_pixbuf_from_pix_and_mask with Pixmap parameters instead.
8544 (xg_check_special_colors): Use GtkStyleContext and its functions
8545 for HAVE_GTK3.
8546 (xg_prepare_tooltip, xg_hide_tooltip): Call gdk_window_get_screen.
8547 (xg_prepare_tooltip, create_dialog, menubar_map_cb)
8548 (xg_update_frame_menubar, xg_tool_bar_detach_callback)
8549 (xg_tool_bar_attach_callback, xg_update_tool_bar_sizes):
8550 Call gtk_widget_get_preferred_size.
8551 (xg_frame_resized): gdk_window_get_geometry only takes 5
8552 parameters.
8553 (xg_win_to_widget, xg_event_is_for_menubar):
8554 Call gdk_x11_window_lookup_for_display.
8555 (xg_set_widget_bg): New function.
8556 (delete_cb): New function.
8557 (xg_create_frame_widgets): Connect delete-event to delete_cb.
8558 Call xg_set_widget_bg. Only set backgrund pixmap for ! HAVE_GTK3
8559 (xg_set_background_color): Call xg_set_widget_bg.
8560 (xg_set_frame_icon): Call xg_get_pixbuf_from_pix_and_mask.
8561 (xg_create_scroll_bar): vadj is a GtkAdjustment for HAVE_GTK3.
8562 Only call gtk_range_set_update_policy if ! HAVE_GTK3.
8563 (xg_make_tool_item): Only connect xg_tool_bar_item_expose_callback
8564 if ! HAVE_GTK3.
8565 (update_frame_tool_bar): Call gtk_widget_hide.
8566 (xg_initialize): Use GDK_KEY_g.
8567
8568 * xsmfns.c (gdk_set_sm_client_id): Define to gdk_set_sm_client_id
8569 if ! HAVE_GTK3
8570 (x_session_initialize): Call gdk_x11_set_sm_client_id.
8571
8572 * xterm.c (XFillRectangle): Use cairo routines for HAVE_GTK3.
8573 (x_term_init): Disable Xinput(2) with GDK_CORE_DEVICE_EVENTS.
8574 Load ~/emacs.d/gtkrc only for ! HAVE_GTK3.
8575
8576 2011-03-08 Juanma Barranquero <lekktu@gmail.com>
8577
8578 * w32xfns.c (select_palette): Check success of RealizePalette against
8579 GDI_ERROR, not zero.
8580
8581 See ChangeLog.11 for earlier changes.
8582
8583 ;; Local Variables:
8584 ;; coding: utf-8
8585 ;; End:
8586
8587 Copyright (C) 2011 Free Software Foundation, Inc.
8588
8589 This file is part of GNU Emacs.
8590
8591 GNU Emacs is free software: you can redistribute it and/or modify
8592 it under the terms of the GNU General Public License as published by
8593 the Free Software Foundation, either version 3 of the License, or
8594 (at your option) any later version.
8595
8596 GNU Emacs is distributed in the hope that it will be useful,
8597 but WITHOUT ANY WARRANTY; without even the implied warranty of
8598 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
8599 GNU General Public License for more details.
8600
8601 You should have received a copy of the GNU General Public License
8602 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.