X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/57b3e30bb29d904180b651422ab58341debe84cb..bf2da747e95a3902bf715076aeee947d657c94cd:/src/ChangeLog diff --git a/src/ChangeLog b/src/ChangeLog index 55ff323ab5..46d2cdb82f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,51 +1,671 @@ -2011-07-05 Eli Zaretskii +2011-07-29 Paul Eggert + + * process.c (Fnetwork_interface_list): Check for overflow + in size calculation. + + * nsterm.h (struct ns_color_table.size, struct ns_color_table.avail): + Now ptrdiff_t, not int. + * nsterm.m (ns_index_color): Use ptrdiff_t, not int, for table indexes. + (ns_draw_fringe_bitmap): Rewrite to avoid overflow. + + * minibuf.c (read_minibuf_noninteractive): Don't leak memory + on memory overflow. + + * macros.c: Integer and memory overflow fixes. + (Fstart_kbd_macro): Don't update size until alloc done. + (store_kbd_macro_char): Reorder multiplicands to avoid overflow. + + * lread.c (read1, init_obarray): Don't update size until alloc done. + + * keymap.c: Integer overflow fixes. + (cmm_size, current_minor_maps): Use ptrdiff_t, not int, to count maps. + (current_minor_maps): Check for size calculation overflow. + * keymap.h: Change prototypes to match the above. + + * keyboard.c: Integer and memory overflow fixes. + (read_char, menu_bar_items, tool_bar_items, read_char_x_menu_prompt) + (read_char_minibuf_menu_width, read_char_minibuf_menu_prompt) + (follow_key, read_key_sequence): Use ptrdiff_t, not int, to count maps. + (read_char_minibuf_menu_prompt): Check for overflow in size + calculations. Don't update size until allocation succeeds. Redo + calculations to avoid overflow. + * keyboard.h: Change prototypes to match the above. + + * image.c: Integer and memory overflow fixes. + (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): Remove; these are duplicate + now that they've been promoted to lisp.h. + (x_allocate_bitmap_record, x_alloc_image_color) + (make_image_cache, cache_image, xpm_load): + Don't update size until alloc is done. + (xpm_load, lookup_rgb_color, lookup_pixel_color, x_to_xcolors) + (x_detect_edges): + Check for size calculation overflow. + (ct_colors_allocated_max): New constant. + (x_to_xcolors, x_detect_edges): Reorder multiplicands to avoid + overflow. + +2011-07-28 Paul Eggert + + * gtkutil.c: Integer overflow fixes. + (get_utf8_string, xg_store_widget_in_map): + Check for size-calculation overflow. + (get_utf8_string): Use ptrdiff_t, not size_t, where either will + do, as we prefer signed integers. + (id_to_widget.max_size, id_to_widget.used) + (xg_store_widget_in_map, xg_remove_widget_from_map) + (xg_get_widget_from_map, xg_get_scroll_id_for_window) + (xg_remove_scroll_bar, xg_update_scrollbar_pos): + Use and return ptrdiff_t, not int. + (xg_gtk_scroll_destroy): Don't assume ptrdiff_t fits in int. + * gtkutil.h: Change prototypes to match the above. + + * ftfont.c: Check for size overflow. + (ftfont_get_open_type_spec, setup_otf_gstring, ftfont_shape_by_flt): + Check for integer overflow in size calculations. + + * fringe.c (Fdefine_fringe_bitmap): Don't update size until alloc works. + + * frame.h (struct frame): Use int, not EMACS_INT, where int works. + This is for the members text_lines, text_cols, total_lines, total_cols, + where the system imposes an 'int' limit. + + * frame.c: Integer overflow fixes. + (set_menu_bar_lines, x_set_frame_parameters, x_set_scroll_bar_width) + (x_figure_window_size): Check for integer overflow. + (x_set_alpha): Do not assume XINT fits in int. + + * eval.c: Integer and memory overflow fixes. + (init_eval_once, grow_specpdl): Don't update size until alloc succeeds. + (call_debugger, grow_specpdl): Redo calculations to avoid overflow. + + * emacs.c (main, sort_args): Check for size-calculation overflow. + + * editfns.c: Integer and memory overflow fixes. + (set_time_zone_rule): Don't assume environment length fits in int. + (message_length): Now ptrdiff_t, not int. + (Fmessage_box): Don't update size until allocation succeeds. + Don't assume message length fits in int. + (Fformat): Use ptrdiff_t, not EMACS_INT, where ptrdiff_t will do. + + * doc.c: Integer and memory overflow fixes. + (get_doc_string_buffer_size): Now ptrdiff_t, not int. + (get_doc_string): Check for size calculation overflow. + Don't update size until allocation succeeds. + (get_doc_string, Fsubstitute_command_keys): Use ptrdiff_t, not + EMACS_INT, where ptrdiff_t will do. + (Fsubstitute_command_keys): Check for string overflow. + + Integer and memory overflow fixes for display code. + * dispextern.h (struct glyph_pool.nglyphs): Now ptrdiff_t, not int. + * dispnew.c (adjust_glyph_matrix, realloc_glyph_pool, scrolling_window): + Check for overflow in size calculations. + (line_draw_cost, realloc_glyph_pool, add_row_entry): + Don't assume glyph table len fits in int. + (struct row_entry.bucket, row_entry_pool_size, row_entry_idx) + (row_table_size): Now ptrdiff_t, not int. + (scrolling_window): Avoid overflow in size calculations. + Don't update size until allocation succeeds. + * fns.c (concat): Check for overflow in size calculations. + (next_almost_prime): Verify NEXT_ALMOST_PRIME_LIMIT. + * lisp.h (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros. + (NEXT_ALMOST_PRIME_LIMIT): New constant. + + * composite.c: Integer overflow fixes. + (get_composition_id): Check for overflow in glyph length calculations. + + * coding.c: Integer and memory overflow fixes. + (produce_chars): Redo buffer-overflow calculations to avoid + unnecessary integer overflow. Check for size overflow. + (encode_coding_object): Don't update size until xmalloc succeeds. + + * character.c (Fstring): Check for size-calculation overflow. + + * ccl.c: Integer and memory overflow fixes. + (Fccl_execute_on_string): Check for memory overflow. + Use ptrdiff_t rather than EMACS_INT where ptrdiff_t will do. + Redo buffer-overflow calculations to avoid integer overflow. + + * callproc.c (child_setup): Don't assume strlen fits in int. + + * buffer.c: Memory overflow fixes. + (overlays_at, overlays_in, record_overlay_string, overlay_strings): + Don't update size of array until after memory allocation succeeds, + because xmalloc/xrealloc may not return. + + * bidi.c: Integer overflow fix. + (bidi_shelve_header_size): New constant. + (bidi_cache_ensure_space, bidi_shelve_cache): Use it. + (bidi_cache_ensure_space): Avoid integer overflow when allocating. + +2011-07-19 Paul Eggert + + Use ptrdiff_t for composition IDs. + * character.c (lisp_string_width): + * composite.c (composition_table_size, n_compositions) + (get_composition_id, composition_gstring_from_id): + * dispextern.h (struct glyph_string.cmp_id, struct composition_it.id): + * xdisp.c (BUILD_COMPOSITE_GLYPH_STRING): + * window.c (Frecenter): + Use ptrdiff_t, not int, for composition IDs. + * composite.c (get_composition_id): Check for integer overflow. + * composite.h: Adjust prototypes to match the above changes. + + Use ptrdiff_t for hash table indexes. + * category.c (hash_get_category_set): + * ccl.c (ccl_driver): + * charset.h (struct charset.hash_index, CHECK_CHARSET_GET_ID): + * coding.c (coding_system_charset_list, detect_coding_system): + * coding.h (struct coding_system.id): + * composite.c (get_composition_id, gstring_lookup_cache): + * fns.c (hash_lookup, hash_put, Fgethash, Fputhash): + * image.c (xpm_get_color_table_h): + * lisp.h (hash_lookup, hash_put): + * minibuf.c (Ftest_completion): + Use ptrdiff_t for hash table indexes, not int (which is too + narrow, on 64-bit hosts) or EMACS_INT (which is too wide, on + 32-bit --with-wide-int hosts). + + * charset.c (Fdefine_charset_internal): Check for integer overflow. + Add a FIXME comment about memory leaks. + (syms_of_charset): Don't assume xmalloc returns. + + Don't assume that stated character widths fit in int. + * character.c (Fchar_width, c_string_width, lisp_string_width): + * character.h (CHAR_WIDTH): + * indent.c (MULTIBYTE_BYTES_WIDTH): + Use sanitize_char_width to avoid undefined and/or bad behavior + with outlandish widths. + * character.h (sanitize_tab_width): Renamed from sanitize_width, + now that we have two such functions. All uses changed. + (sanitize_char_width): New inline function. + + Don't assume that tab-width fits in int. + * character.h (sanitize_width): New inline function. + (SANE_TAB_WIDTH): New macro. + (ASCII_CHAR_WIDTH): Use it. + * indent.c (sane_tab_width): Remove. All uses replaced by + SANE_TAB_WIDTH (current_buffer). + * xdisp.c (init_iterator): Use SANE_TAB_WIDTH. + + * fileio.c: Integer overflow issues with file modes. + (Fset_file_modes, auto_save_1): Don't assume EMACS_INT fits in int. + + * charset.c (read_hex): New arg OVERFLOW. All uses changed. + Remove unreachable code. + (read_hex, load_charset_map_from_file): Check for integer overflow. + + * xterm.c: don't go over XClientMessageEvent limit + (scroll_bar_windows_size): Now ptrdiff_t, as we prefer signed. + (x_send_scroll_bar_event): Likewise. Check that the size does not + exceed limits imposed by XClientMessageEvent, as well as the usual + ptrdiff_t and size_t limits. + + * keyboard.c: Overflow, signedness and related fixes. + (make_lispy_movement): Use same integer type in forward decl + that is used in the definition. + (read_key_sequence, keyremap_step): + Change bufsize argument back to int, undoing my 2011-03-30 change. + We prefer signed types, and int is wide enough here. + (parse_tool_bar_item): Don't assume tool_bar_max_label_size is less + than TYPE_MAXIMUM (EMACS_INT) / 2. Don't let the label size grow + larger than STRING_BYTES_BOUND. Use ptrdiff_t for Emacs string + length, not size_t. Use ptrdiff_t for index, not int. + (keyremap_step, read_key_sequence): Redo bufsize check to avoid + possibility of integer overflow. + + Overflow, signedness and related fixes for images. + + * dispextern.h (struct it.stack[0].u.image.image_id) + (struct_it.image_id, struct image.id, struct image_cache.size) + (struct image_cache.used, struct image_cache.ref_count): + * gtkutil.c (update_frame_tool_bar): + * image.c (x_reference_bitmap, Fimage_size, Fimage_mask_p) + (Fimage_metadata, free_image_cache, clear_image_cache, lookup_image) + (cache_image, mark_image_cache, x_kill_gs_process, Flookup_image): + * nsmenu.m (update_frame_tool_bar): + * xdisp.c (calc_pixel_width_or_height): + * xfns.c (image_cache_refcount): + Image IDs are now ptrdiff_t, not int, to avoid arbitrary limits + on typical 64-bit hosts. + + * image.c (RANGED_INTEGERP, TYPE_RANGED_INTEGERP): New macros. + (x_bitmap_pixmap, x_create_x_image_and_pixmap): + Omit unnecessary casts to int. + (parse_image_spec): Check that integers fall into 'int' range + when the callers expect that. + (image_ascent): Redo ascent calculation to avoid int overflow. + (clear_image_cache): Avoid overflow when sqrt (INT_MAX) < nimages. + (lookup_image): Remove unnecessary tests. + (xbm_image_p): Locals are now of int, not EMACS_INT, + since parse_image_check makes sure they fit into int. + (png_load, gif_load, svg_load_image): + Prefer int to unsigned where either will do. + (tiff_handler): New function, combining the cores of the + old tiff_error_handler and tiff_warning_handler. This + function is rewritten to use vsnprintf and thereby avoid + stack buffer overflows. It uses only the features of vsnprintf + that are common to both POSIX and native Microsoft. + (tiff_error_handler, tiff_warning_handler): Use it. + (tiff_load, gif_load, imagemagick_load_image): + Don't assume :index value fits in 'int'. + (gif_load): Omit unnecessary cast to double, and avoid double-rounding. + (imagemagick_load_image): Check that crop parameters fit into + the integer types that MagickCropImage accepts. Don't assume + Vimagemagick_render_type has a nonnegative value. Don't assume + size_t fits in 'long'. + (gs_load): Use printmax_t to print the widest integers possible. + Check for integer overflow when computing image height and width. + +2011-07-19 Paul Eggert + + Integer signedness and overflow and related fixes. (Bug#9079) + + * bidi.c: Integer size and overflow fixes. + (bidi_cache_size, bidi_cache_idx, bidi_cache_last_idx) + (bidi_cache_start, bidi_cache_fetch_state, bidi_cache_search) + (bidi_cache_find_level_change, bidi_cache_ensure_space) + (bidi_cache_iterator_state, bidi_cache_find, bidi_cache_start_stack) + (bidi_find_other_level_edge): + Use ptrdiff_t instead of EMACS_INT where either will do. + This works better on 32-bit hosts configured --with-wide-int. + (bidi_cache_ensure_space): Check for size-calculation overflow. + Use % rather than repeated addition, for better worst-case speed. + Don't set bidi_cache_size until after xrealloc returns, because it + might not return. + (bidi_dump_cached_states): Use ptrdiff_t, not int, to avoid overflow. + (bidi_cache_ensure_space): Also check that the bidi cache size + does not exceed that of the largest Lisp string or buffer. See Eli + Zaretskii in . + + * alloc.c (__malloc_size_t): Remove. + All uses replaced by size_t. See Andreas Schwab's note + . + + * image.c: Improve checking for integer overflow. + (check_image_size): Assume that f is nonnull, since + it is always nonnull in practice. This is one less thing to + worry about when checking for integer overflow later. + (x_check_image_size): New function, which checks for integer + overflow issues inside X. + (x_create_x_image_and_pixmap, xbm_read_bitmap_data): Use it. + This removes the need for a memory_full check. + (xbm_image_p): Rewrite to avoid integer multiplication overflow. + (Create_Pixmap_From_Bitmap_Data, xbm_load): Use x_check_image_size. + (xbm_read_bitmap_data): Change locals back to 'int', since + their values must fit in 'int'. + (xpm_load_image, png_load, tiff_load): + Invoke x_create_x_image_and_pixmap earlier, + to avoid much needless work if the image is too large. + (tiff_load): Treat overly large images as if + x_create_x_image_and_pixmap failed, not as malloc failures. + (gs_load): Use x_check_image_size. + + * gtkutil.c: Omit integer casts. + (xg_get_pixbuf_from_pixmap): Remove unnecessary cast. + (xg_set_toolkit_scroll_bar_thumb): Rewrite to avoid need for cast. + + * image.c (png_load): Don't assume height * row_bytes fits in 'int'. + + * xfaces.c (Fbitmap_spec_p): Fix integer overflow bug. + Without this fix, (bitmap-spec-p '(34359738368 1 "x")) + would wrongly return t on a 64-bit host. + + * dispnew.c (init_display): Use *_RANGE_OVERFLOW macros. + The plain *_OVERFLOW macros run afoul of GCC bug 49705 + + and therefore cause GCC to emit a bogus diagnostic in some cases. + + * image.c: Integer signedness and overflow and related fixes. + This is not an exhaustive set of fixes, but it's time to + record what I've got. + (lookup_pixel_color, check_image_size): Remove redundant decls. + (check_image_size): Don't assume that arbitrary EMACS_INT values + fit in 'int', or that arbitrary 'double' values fit in 'int'. + (x_alloc_image_color, x_create_x_image_and_pixmap, png_load) + (tiff_load, imagemagick_load_image): + Check for overflow in size calculations. + (x_create_x_image_and_pixmap): Remove unnecessary test for + xmalloc returning NULL; that can't happen. + (xbm_read_bitmap_data): Don't assume sizes fit into 'int'. + (xpm_color_bucket): Use better integer hashing function. + (xpm_cache_color): Don't possibly over-allocate memory. + (struct png_memory_storage, tiff_memory_source, tiff_seek_in_memory) + (gif_memory_source): + Use ptrdiff_t, not int or size_t, to record sizes. + (png_load): Don't assume values greater than 2**31 fit in 'int'. + (our_stdio_fill_input_buffer): Prefer ptrdiff_t to size_t when + either works, as we prefer signed integers. + (tiff_read_from_memory, tiff_write_from_memory): + Return tsize_t, not size_t, since that's what the TIFF API wants. + (tiff_read_from_memory): Don't fail simply because the read would + go past EOF; instead, return a short read. + (tiff_load): Omit no-longer-needed casts. + (Fimagemagick_types): Don't assume size fits into 'int'. + + Improve hashing quality when configured --with-wide-int. + * fns.c (hash_string): New function, taken from sxhash_string. + Do not discard information about ASCII character case; this + discarding is no longer needed. + (sxhash-string): Use it. Change sig to match it. Caller changed. + * lisp.h: Declare it. + * lread.c (hash_string): Remove, since we now use fns.c's version. + The fns.c version returns a wider integer if --with-wide-int is + specified, so this should help the quality of the hashing a bit. + + * emacs.c: Integer overflow minor fix. + (heap_bss_diff): Now uprintmax_t, not unsigned long. All used changed. + Define only if GNU_LINUX. + (main, Fdump_emacs): Set and use heap_bss_diff only if GNU_LINUX. + + * dispnew.c: Integer signedness and overflow fixes. + Remove unnecessary forward decls, that were a maintenance hassle. + (history_tick): Now uprintmax_t, so it's more likely to avoid overflow. + All uses changed. + (adjust_glyph_matrix, realloc_glyph_pool, adjust_frame_message_buffer) + (scrolling_window): Use ptrdiff_t, not int, for byte count. + (prepare_desired_row, line_draw_cost): + Use int, not unsigned, where either works. + (save_current_matrix, restore_current_matrix): + Use ptrdiff_t, not size_t, where either works. + (init_display): Check for overflow more accurately, and without + relying on undefined behavior. + + * editfns.c (pWIDE, pWIDElen, signed_wide, unsigned_wide): + Remove, replacing with the new symbols in lisp.h. All uses changed. + * fileio.c (make_temp_name): + * filelock.c (lock_file_1, lock_file): + * xdisp.c (message_dolog): + Don't assume PRIdMAX etc. works; this isn't portable to pre-C99 hosts. + Use pMd etc. instead. + * lisp.h (printmax_t, uprintmax_t, pMd, pMu): New types and macros, + replacing the pWIDE etc. symbols removed from editfns.c. + + * keyboard.h (num_input_events): Now uintmax_t. + This is (very slightly) less likely to mess up due to wraparound. + All uses changed. - * dispnew.c (buffer_posn_from_coords): Save and restore the bidi - cache around display iteration. + * buffer.c: Integer signedness fixes. + (alloc_buffer_text, enlarge_buffer_text): + Use ptrdiff_t rather than size_t when either will do, as we prefer + signed integers. + + * alloc.c: Integer signedness and overflow fixes. + Do not impose an arbitrary 32-bit limit on malloc sizes when debugging. + (__malloc_size_t): Default to size_t, not to int. + (pure_size, pure_bytes_used_before_overflow, stack_copy_size) + (Fgarbage_collect, mark_object_loop_halt, mark_object): + Prefer ptrdiff_t to size_t when either would do, as we prefer + signed integers. + (XMALLOC_OVERRUN_CHECK_OVERHEAD): New macro. + (xmalloc_overrun_check_header, xmalloc_overrun_check_trailer): + Now const. Initialize with values that are in range even if char + is signed. + (XMALLOC_PUT_SIZE, XMALLOC_GET_SIZE): Remove, replacing with ... + (xmalloc_put_size, xmalloc_get_size): New functions. All uses changed. + These functions do the right thing with sizes > 2**32. + (check_depth): Now ptrdiff_t, not int. + (overrun_check_malloc, overrun_check_realloc, overrun_check_free): + Adjust to new way of storing sizes. Check for size overflow bugs + in rest of code. + (STRING_BYTES_MAX): Adjust to new overheads. The old code was + slightly wrong anyway, as it missed one instance of + XMALLOC_OVERRUN_CHECK_OVERHEAD. + (refill_memory_reserve): Omit needless cast to size_t. + (mark_object_loop_halt): Mark as externally visible. + + * xselect.c: Integer signedness and overflow fixes. + (Fx_register_dnd_atom, x_handle_dnd_message): + Use ptrdiff_t, not size_t, since we prefer signed. + (Fx_register_dnd_atom): Check for ptrdiff_t (and size_t) overflow. + * xterm.h (struct x_display_info): Use ptrdiff_t, not size_t, for + x_dnd_atoms_size and x_dnd_atoms_length. + + * doprnt.c: Prefer signed to unsigned when either works. + * eval.c (verror): + * doprnt.c (doprnt): + * lisp.h (doprnt): + * xdisp.c (vmessage): + Use ptrdiff_t, not size_t, when using or implementing doprnt, + since the sizes cannot exceed ptrdiff_t bounds anyway, and we + prefer signed arithmetic to avoid comparison confusion. + * doprnt.c (doprnt): Avoid a "+ 1" that can't overflow, + but is a bit tricky. + + Assume freestanding C89 headers, string.h, stdlib.h. + * data.c, doprnt.c, floatfns.c, print.c: + Include float.h unconditionally. + * gmalloc.c: Assume C89-at-least behavior for preprocessor, + limits.h, stddef.h, string.h. Use memset instead of 'flood'. + * regex.c: Likewise for stddef.h, string.h. + (ISASCII): Remove; can assume it returns 1 now. All uses removed. + * s/aix4-2.h (HAVE_STRING_H): Remove obsolete undef. + * s/ms-w32.h (HAVE_LIMITS_H, HAVE_STRING_H, HAVE_STDLIB_H) + (STDC_HEADERS): Remove obsolete defines. + * sysdep.c: Include limits.h unconditionally. + + Assume support for memcmp, memcpy, memmove, memset. + * lisp.h, sysdep.c (memcmp, memcpy, memmove, memset): + * regex.c (memcmp, memcpy): + Remove; we assume C89 now. + + * gmalloc.c (memcpy, memset, memmove): Remove; we assume C89 now. + (__malloc_safe_bcopy): Remove; no longer needed. + + * lisp.h (struct vectorlike_header, struct Lisp_Subr): Signed sizes. + Use EMACS_INT, not EMACS_UINT, for sizes. The code works equally + well either way, and we prefer signed to unsigned. + +2011-07-19 Paul Eggert + + Port to OpenBSD. + See http://lists.gnu.org/archive/html/emacs-devel/2011-07/msg00688.html + and the surrounding thread. + * minibuf.c (read_minibuf_noninteractive): Rewrite to use getchar + rather than fgets, and retry after EINTR. Otherwise, 'emacs + --batch -f byte-compile-file' fails on OpenBSD if an inactivity + timer goes off. + * s/openbsd.h (BROKEN_SIGIO): Define. + * unexelf.c (unexec) [__OpenBSD__]: + Don't update the .mdebug section of the Alpha COFF symbol table. + +2011-07-19 Lars Magne Ingebrigtsen + + * lread.c (syms_of_lread): Clarify when `lexical-binding' is used + (bug#8460). + +2011-07-18 Paul Eggert + + * fileio.c (Fcopy_file) [!MSDOS]: Tighten created file's mask. + This fixes some race conditions on the permissions of any newly + created file. + + * alloc.c (valid_pointer_p): Use pipe, not open. + This fixes some permissions issues when debugging. + + * fileio.c (Fcopy_file): Adjust mode if fchown fails. (Bug#9002) + If fchown fails to set both uid and gid, try to set just gid, + as that is sometimes allowed. Adjust the file's mode to eliminate + setuid or setgid bits that are inappropriate if fchown fails. + +2011-07-18 Stefan Monnier + + * xdisp.c (next_element_from_string, next_element_from_buffer): Use EQ + to compare Lisp_Objects. + * gnutls.c (syms_of_gnutls): Rename Vgnutls_log_level to + global_gnutls_log_level, don't mistake it for a Lisp_Object. + (init_gnutls_functions, emacs_gnutls_handle_error): Fix up uses. + +2011-07-17 Andreas Schwab - * window.c (Fwindow_end, window_scroll_pixel_based) - (displayed_window_lines, Frecenter): Save and restore the bidi - cache around display iteration. + * lread.c (read_integer): Unread even EOF character. + (read1): Likewise. Properly record start position of symbol. - * bidi.c (bidi_unshelve_cache): Ensure we have enough space before - restoring the shelved cache. - (bidi_cache_ensure_space): Don't assume the required size is just - one BIDI_CACHE_CHUNK away. + * lread.c (read1): Read `#:' as empty uninterned symbol if no + symbol character follows. - * xdisp.c (back_to_previous_visible_line_start, reseat_1) - (init_iterator): Empty the bidi cache "stack". +2011-07-17 Paul Eggert -2011-07-03 Eli Zaretskii + * fileio.c (Fcopy_file): Pacify gcc re fchown. (Bug#9002) + This works around a problem with the previous change to Fcopy_file. + Recent glibc declares fchown with __attribute__((warn_unused_result)), + and without this change, GCC might complain about discarding + fchown's return value. - * bidi.c (bidi_shelve_cache, bidi_unshelve_cache): New functions. +2011-07-16 Juanma Barranquero - * dispextern.h (bidi_shelve_cache, bidi_unshelve_cache): Declare - prototypes. + * makefile.w32-in (GLOBAL_SOURCES): Add gnutls.c (followup to bug#9059). - * xdisp.c (SAVE_IT, RESTORE_IT): New macros. - (pos_visible_p, face_before_or_after_it_pos) - (back_to_previous_visible_line_start) - (move_it_in_display_line_to, move_it_in_display_line) - (move_it_to, move_it_vertically_backward, move_it_by_lines) - (try_scrolling, redisplay_window, display_line): Use them when - saving a temporary copy of the iterator and restoring it back. +2011-07-16 Paul Eggert -2011-07-02 Eli Zaretskii + * fileio.c (Fcopy_file): Don't diagnose fchown failures. (Bug#9002) - * xdisp.c (reseat_1): Call bidi_init_it to resync the bidi - iterator with IT's position. - (handle_stop, back_to_previous_visible_line_start, reseat_1): - Reset the from_disp_prop_p flag. +2011-07-16 Lars Magne Ingebrigtsen - * bidi.c (bidi_cache_search): Don't assume bidi_cache_last_idx is - always valid if bidi_cache_idx is valid. - (bidi_cache_find_level_change): xassert that bidi_cache_last_idx - is valid if it's going to be used. + * gnutls.c (syms_of_gnutls): Define `gnutls-log-level' here, since + it's used from the C level. + + * process.c: Use the same condition for POLL_FOR_INPUT in both + keyboard.c and process.c (bug#1858). + +2011-07-09 Lawrence Mitchell + + * gnutls.c (Qgnutls_bootprop_min_prime_bits): New variable. + (Fgnutls_boot): Use it. + +2011-07-15 Andreas Schwab + + * doc.c (Fsubstitute_command_keys): Revert last change. + +2011-07-15 Lars Magne Ingebrigtsen + + * doc.c (Fsubstitute_command_keys): Clarify that \= really only + quotes the next character, and doesn't affect other longer + sequences (bug#8935). + + * lread.c (syms_of_lread): Clarify that is isn't only + `eval-buffer' and `eval-defun' that's affected by + `lexical-binding' (bug#8460). + +2011-07-15 Eli Zaretskii + + * xdisp.c (move_it_in_display_line_to): Fix vertical motion with + bidi redisplay when a line includes both an image and is + truncated. + +2011-07-14 Paul Eggert + + Fix minor problems found by static checking. + * bidi.c (bidi_cache_size): Now EMACS_INT, not size_t. + (elsz): Now a signed constant, not a size_t var. We prefer signed + types to unsigned, to avoid integer comparison confusion. Without + this change, GCC 4.6.1 with -Wunsafe-loop-optimizations complains + "cannot optimize loop, the loop counter may overflow", a symptom + of the confusion. + * indent.c (Fvertical_motion): Mark locals as initialized. + * xdisp.c (reseat_to_string): Fix pointer signedness issue. + +2011-07-14 Lars Magne Ingebrigtsen + + * search.c (Fre_search_backward): Mention `case-fold-search' in + all the re_search_* functions (bug#8138). + + * keyboard.c (Fopen_dribble_file): Document when the file is + closed (bug#8056). + +2011-07-14 Eli Zaretskii - * dispextern.h (struct iterator_stack_entry, struct it): New - member from_disp_prop_p. + * bidi.c (bidi_dump_cached_states): Fix format of displaying + bidi_cache_idx. - * xdisp.c (push_it, pop_it): Save and restore from_disp_prop_p. + Support bidi reordering of display and overlay strings. + * xdisp.c (compute_display_string_pos) + (compute_display_string_end): Accept additional argument STRING. + (init_iterator, reseat_1): Initialize bidi_it->string.s to NULL. + (reseat_to_string): Initialize bidi_it->string.s and + bidi_it->string.schars. + (Fcurrent_bidi_paragraph_direction): Initialize itb.string.s to + NULL (avoids a crash in bidi_paragraph_init). Initialize + itb.string.lstring. + (init_iterator): Call bidi_init_it only of a valid + buffer position was specified. Initialize paragraph_embedding to + L2R. + (reseat_to_string): Initialize the bidi iterator. + (display_string): If we need to ignore text properties of + LISP_STRING, set IT->stop_charpos to IT->end_charpos. (The + original value of -1 will not work with bidi.) + (compute_display_string_pos): First arg is now struct + `text_pos *'; all callers changed. Support display properties on + Lisp strings. + (compute_display_string_end): Support display properties on Lisp + strings. + (init_iterator, reseat_1, reseat_to_string): Initialize the + string.bufpos member to 0 (zero, for compatibility with IT_CHARPOS + when iterating on a string not from display properties). + (compute_display_string_pos, compute_display_string_end): Fix + calculation of the object to scan. Fixes an error when using + arrow keys. + (next_element_from_buffer): Don't abort when IT_CHARPOS is before + base_level_stop; instead, set base_level_stop to BEGV. Fixes + crashes in vertical-motion. + (next_element_from_buffer): Improve commentary for when + the iterator is before prev_stop. + (init_iterator): Initialize bidi_p from the default value of + bidi-display-reordering, not from buffer-local value. Use the + buffer-local value only if initializing for buffer iteration. + (handle_invisible_prop): Support invisible properties on strings + that are being bidi-reordered. + (set_iterator_to_next): Support bidi reordering of C strings and + Lisp strings. + (next_element_from_string): Support bidi reordering of Lisp + strings. + (handle_stop_backwards): Support Lisp strings as well. + (display_string): Support display of R2L glyph rows. Use + IT_STRING_CHARPOS when displaying from a Lisp string. + (init_iterator): Don't initialize it->bidi_p for strings + here. + (reseat_to_string): Initialize it->bidi_p for strings here. + (next_element_from_string, next_element_from_c_string) + (next_element_from_buffer): Add xassert's for correspondence + between IT's object being iterated and it->bidi_it.string + structure. + (face_before_or_after_it_pos): Support bidi iteration. + (next_element_from_c_string): Handle the case of the first string + character that is not the first one in the visual order. + (get_visually_first_element): New function, refactored from common + parts of next_element_from_buffer, next_element_from_string, and + next_element_from_c_string. + (tool_bar_lines_needed, redisplay_tool_bar) + (display_menu_bar): Force left-to-right direction. Add a FIXME + comment for making that be controlled by a user option. + (push_it, pop_it): Save and restore the state of the + bidi iterator. Save and restore the bidi_p flag. + (pop_it): Iterate out of display property for string iteration as + well. + (iterate_out_of_display_property): Support iteration over strings. + (handle_single_display_spec): Set up it->bidi_it for iteration + over a display string, and call bidi_init_it. + (handle_single_display_spec, next_overlay_string) + (get_overlay_strings_1, push_display_prop): Set up the bidi + iterator for displaying display or overlay strings. + (forward_to_next_line_start): Don't use the shortcut if + bidi-iterating. + (back_to_previous_visible_line_start): If handle_display_prop + pushed the iterator stack, restore the internal state of the bidi + iterator by calling bidi_pop_it same number of times. + (reseat_at_next_visible_line_start): If ON_NEWLINE_P is non-zero, + and we are bidi-iterating, don't decrement the iterator position; + instead, set the first_elt flag in the bidi iterator, to produce + the same effect. + (reseat_1): Remove redundant setting of string_from_display_prop_p. + (push_display_prop): xassert that we are iterating a buffer. + (push_it, pop_it): Save and restore paragraph_embedding member. + (handle_single_display_spec, next_overlay_string) + (get_overlay_strings_1, reseat_1, reseat_to_string) + (push_display_prop): Set up the `unibyte' member of bidi_it.string + correctly. Don't assume unibyte strings are not bidi-reordered. + (compute_display_string_pos) + (compute_display_string_end): Fix handling the case of C string. + (push_it, pop_it): Save and restore from_disp_prop_p. (handle_single_display_spec, push_display_prop): Set the from_disp_prop_p flag. (get_overlay_strings_1): Reset the from_disp_prop_p flag. @@ -57,253 +677,1969 @@ (handle_single_display_spec, get_overlay_strings_1) (push_display_prop): Fix initialization of paragraph direction for string when that of the parent object is not yet determined. + (reseat_1): Call bidi_init_it to resync the bidi + iterator with IT's position. (Bug#7616) + (find_row_edges): If ROW->start.pos gives position + smaller than min_pos, use it as ROW->minpos. (Bug#7616) + (handle_stop, back_to_previous_visible_line_start, reseat_1): + Reset the from_disp_prop_p flag. + (SAVE_IT, RESTORE_IT): New macros. + (pos_visible_p, face_before_or_after_it_pos) + (back_to_previous_visible_line_start) + (move_it_in_display_line_to, move_it_in_display_line) + (move_it_to, move_it_vertically_backward, move_it_by_lines) + (try_scrolling, redisplay_window, display_line): Use them when + saving a temporary copy of the iterator and restoring it back. + (back_to_previous_visible_line_start, reseat_1) + (init_iterator): Empty the bidi cache "stack". + (move_it_in_display_line_to): If iterator ended up at + EOL, but we never saw any buffer positions smaller than + to_charpos, return MOVE_POS_MATCH_OR_ZV. Fixes vertical cursor + motion in bidi-reordered lines. + (move_it_in_display_line_to): Record prev_method and prev_pos + immediately before the call to set_iterator_to_next. Fixes cursor + motion in bidi-reordered lines with stretch glyphs and strings + displayed in margins. (Bug#8133) (Bug#8867) + Return MOVE_POS_MATCH_OR_ZV only if iterator position is past + TO_CHARPOS. + (pos_visible_p): Support positions in bidi-reordered lines. Save + and restore bidi cache. -2011-07-01 Eli Zaretskii + * bidi.c (bidi_level_of_next_char): clen should be EMACS_NT, not int. + (bidi_paragraph_info): Delete unused struct. + (bidi_cache_idx, bidi_cache_last_idx): Declare EMACS_INT. + (bidi_cache_start): New variable. + (bidi_cache_reset): Reset bidi_cache_idx to bidi_cache_start, not + to zero. + (bidi_cache_fetch_state, bidi_cache_search) + (bidi_cache_find_level_change, bidi_cache_iterator_state) + (bidi_cache_find, bidi_peek_at_next_level) + (bidi_level_of_next_char, bidi_find_other_level_edge) + (bidi_move_to_visually_next): Compare cache index with + bidi_cache_start rather than with zero. + (bidi_fetch_char): Accept new argument STRING; all callers + changed. Support iteration over a string. Support strings with + display properties. Support unibyte strings. Fix the type of + `len' according to what STRING_CHAR_AND_LENGTH expects. + (bidi_paragraph_init, bidi_resolve_explicit_1) + (bidi_resolve_explicit, bidi_resolve_weak) + (bidi_level_of_next_char, bidi_move_to_visually_next): Support + iteration over a string. + (bidi_set_sor_type, bidi_resolve_explicit_1) + (bidi_resolve_explicit, bidi_type_of_next_char): ignore_bn_limit + can now be zero (for strings); special values 0 and -1 were + changed to -1 and -2, respectively. + (bidi_char_at_pos): New function. + (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak): + Call it instead of FETCH_MULTIBYTE_CHAR. + (bidi_move_to_visually_next): Abort if charpos or bytepos were not + initialized to valid values. + (bidi_init_it): Don't initialize charpos and bytepos with invalid + values. + (bidi_level_of_next_char): Allow the sentinel "position" to pass + the test for valid cached positions. Fix the logic for looking up + the sentinel state in the cache. GCPRO the Lisp string we are + iterating. + (bidi_push_it, bidi_pop_it): New functions. + (bidi_initialize): Initialize the bidi cache start stack pointer. + (bidi_cache_ensure_space): New function, refactored from part of + bidi_cache_iterator_state. Don't assume the required size is just + one BIDI_CACHE_CHUNK away. + (bidi_cache_start_stack, bidi_push_it): Use IT_STACK_SIZE. + (bidi_count_bytes, bidi_char_at_pos): New functions. + (bidi_cache_search): Don't assume bidi_cache_last_idx is + always valid if bidi_cache_idx is valid. + (bidi_cache_find_level_change): xassert that bidi_cache_last_idx + is valid if it's going to be used. + (bidi_shelve_cache, bidi_unshelve_cache): New functions. + (bidi_cache_fetch_state, bidi_cache_search) + (bidi_cache_find_level_change, bidi_cache_ensure_space) + (bidi_cache_iterator_state, bidi_cache_find) + (bidi_find_other_level_edge, bidi_cache_start_stack): All + variables related to cache indices are now EMACS_INT. - * dispextern.h (struct bidi_string_data): New member `unibyte'. + * dispextern.h (struct bidi_string_data): New structure. + (struct bidi_it): New member `string'. Make flag members be 1-bit + fields, and put them last in the struct. + (compute_display_string_pos, compute_display_string_end): Update + prototypes. + (bidi_push_it, bidi_pop_it): Add prototypes. + (struct iterator_stack_entry): New members bidi_p, + paragraph_embedding, and from_disp_prop_p. + (struct it): Member bidi_p is now a bit field 1 bit wide. + (bidi_shelve_cache, bidi_unshelve_cache): Declare + prototypes. - * xdisp.c (handle_single_display_spec, next_overlay_string) - (get_overlay_strings_1, reseat_1, reseat_to_string) - (push_display_prop): Set up the `unibyte' member of bidi_it.string - correctly. Don't assume unibyte strings are not bidi-reordered. - (compute_display_string_pos) - (compute_display_string_end): Fix handling the case of C string. + * .gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector) + (xpr, xfont, xbacktrace): Use "header.size" when accessing vectors + and vector-like objects. + + * dispnew.c (buffer_posn_from_coords): Save and restore the bidi + cache around display iteration. + + * window.c (Fwindow_end, window_scroll_pixel_based) + (displayed_window_lines, Frecenter): Save and restore the bidi + cache around display iteration. + +2011-07-14 Lars Magne Ingebrigtsen + + * editfns.c (Fdelete_region): Clarify the use of the named + parameters (bug#6788). + +2011-07-14 Martin Rudalics + + * indent.c (Fvertical_motion): Set and restore w->pointm when + saving and restoring the window's buffer (Bug#9006). + +2011-07-13 Lars Magne Ingebrigtsen + + * editfns.c (Fstring_to_char): Clarify just what is returned + (bug#6576). Text by Eli Zaretskii. + +2011-07-13 Juanma Barranquero + + * gnutls.c (init_gnutls_functions): Honor gnutls_log_level (bug#9059). + +2011-07-13 Eli Zaretskii + + * buffer.c (mmap_find): Fix a typo. + +2011-07-13 Johan Bockgård + + Fix execution of x selection hooks. + * xselect.c (Qx_lost_selection_functions) + (Qx_sent_selection_functions): New vars. + (syms_of_xselect): DEFSYM them. + (x_handle_selection_request): Pass Qx_sent_selection_functions + rather than Vx_sent_selection_functions to Frun_hook_with_args. + (x_handle_selection_clear,x_clear_frame_selections): + Pass Qx_lost_selection_functions rather than + Vx_lost_selection_functions to Frun_hook_with_args. + +2011-07-13 Paul Eggert + + * buffer.c (Fget_buffer_create): Initialize inhibit_shrinking. + The old code sometimes used this field without initializing it. + + * alloc.c (gc_sweep): Don't read past end of array. + In theory, the old code could also have corrupted Emacs internals, + though it'd be very unlikely. + +2011-07-12 Andreas Schwab + + * character.c (Fcharacterp): Don't advertise optional ignored + argument. (Bug#4026) + +2011-07-12 Lars Magne Ingebrigtsen + + * keymap.c (syms_of_keymap): Clarify that "modifier" is "modifier + key" (bug#4257). + + * window.c (Fset_window_start): Doc fix (bug#4199). + (Fset_window_hscroll): Ditto. + +2011-07-12 Paul Eggert + + Fix minor new problems caught by GCC 4.6.1. + * term.c (init_tty): Remove unused local. + * xsettings.c (store_monospaced_changed): Define this function only + if (defined HAVE_GSETTINGS || defined HAVE_GCONF), as it's + not used otherwise. + +2011-07-12 Chong Yidong + + * xdisp.c (Vresize_mini_windows): Minor doc fix (Bug#3300). + +2011-07-11 Lars Magne Ingebrigtsen + + * xdisp.c (syms_of_xdisp): Make it explicit that the mini-windows + are the mini-buffer and the echo area (bug#3320). + + * term.c (init_tty): Remove support for supdup, c10 and perq + terminals, which are no longer supported (bug#1482). + +2011-07-10 Johan Bockgård + + * xdisp.c (Ftool_bar_lines_needed): Fix WINDOWP check. + +2011-07-10 Jan Djärv + + * xmenu.c (menu_highlight_callback): Only pass frame to show_help_event + for non-popups (Bug#3642). + +2011-07-10 Andreas Schwab + + * alloc.c (reset_malloc_hooks): Protoize. + * buffer.c (mmap_init, mmap_find, mmap_free_1, mmap_enlarge) + (mmap_set_vars, mmap_alloc, mmap_free, mmap_realloc): Likewise. + * cm.c (losecursor): Likewise. + * data.c (fmod): Likewise. + * dispnew.c (swap_glyphs_in_rows): Likewise. + * emacs.c (memory_warning_signal): Likewise. + * floatfns.c (float_error): Likewise. + * font.c (check_gstring, check_otf_features, otf_tag_symbol) + (otf_open, font_otf_capability, generate_otf_features) + (font_otf_DeviceTable, font_otf_ValueRecord, font_otf_Anchor): + Likewise. + * image.c (pbm_read_file): Likewise. + * indent.c (string_display_width): Likewise. + * intervals.c (check_for_interval, search_for_interval) + (inc_interval_count, count_intervals, root_interval) + (adjust_intervals_for_insertion, make_new_interval): Likewise. + * lread.c (defalias): Likewise. + * ralloc.c (r_alloc_check): Likewise. + * regex.c (set_image_of_range_1, set_image_of_range) + (regex_grow_registers): Likewise. + * sysdep.c (strerror): Likewise. + * termcap.c (valid_filename_p, tprint, main): Likewise. + * tparam.c (main): Likewise. + * unexhp9k800.c (run_time_remap, save_data_space) + (update_file_ptrs, read_header, write_header, calculate_checksum) + (copy_file, copy_rest, display_header): Likewise. + * widget.c (mark_shell_size_user_specified, create_frame_gcs): + Likewise. + * xdisp.c (check_it): Likewise. + * xfaces.c (register_color, unregister_color, unregister_colors): + Likewise. + * xfns.c (print_fontset_result): Likewise. + * xrdb.c (member, fatal, main): Likewise. + +2011-07-10 Paul Eggert + + Fix minor problems found by static checking (Bug#9031). + * chartab.c (char_table_set_range, map_sub_char_table): + Remove unused locals. + (uniprop_table): Now static. + * composite.c (_work_char): Remove unused static var. + +2011-07-09 Juanma Barranquero + + * chartab.c (uniprop_table_uncompress): Remove unused local variable. + +2011-07-09 Jan Djärv + + * gtkutil.c (qttip_cb): Remove code without function. + +2011-07-09 Eli Zaretskii + + * w32.c (pthread_sigmask): New stub. + +2011-07-08 Paul Eggert + + Use pthread_sigmask, not sigprocmask (Bug#9010). + sigprocmask is portable only for single-threaded applications, and + Emacs can be multi-threaded when it uses GTK. + * Makefile.in (LIB_PTHREAD_SIGMASK): New macro. + (LIBES): Use it. + * callproc.c (Fcall_process): + * process.c (create_process): + * sysdep.c (sys_sigblock, sys_sigunblock, sys_sigsetmask): + Use pthread_sigmask, not sigprocmask. + +2011-07-08 Jan Djärv + + * gtkutil.c (qttip_cb): Set line wrap to FALSE for tooltip widget. + (xg_prepare_tooltip): Revert text in x->ttip_lbl, margins was + wrong (Bug#8591). + +2011-07-08 Jan Djärv + + * gtkutil.c (xg_prepare_tooltip): Fix indentation and comment. + Put text in x->ttip_lbl instead of gtk_tooltip_set_text (Bug#8591). + (xg_hide_tooltip): Fix comment. + + * nsterm.m (initFrameFromEmacs): Don't use ns_return_types + in registerServicesMenuSendTypes. + (validRequestorForSendType): Don't check ns_return_types. + + * nsfns.m (Fx_open_connection): Put NSStringPboardType into + ns_return_type. + +2011-07-08 Jason Rumney + + * w32fns.c (w32_wnd_proc) [WM_TIMER, WM_SET_CURSOR]: Avoid using + frame struct members of non-existent frames (Bug#6284). + +2011-07-08 Jan Djärv + + * nsterm.m (keyDown): Call to wantsToDelayTextChangeNotifications and + variable firstTime not needed on OSX >= 10.6. + (setPosition): setFloatValue:knobProportion: is deprecated on OSX + >= 10.5. Use setKnobProportion, setDoubleValue. + + * nsterm.h (MAC_OS_X_VERSION_10_3, MAC_OS_X_VERSION_10_4) + (MAC_OS_X_VERSION_10_5): Define if not defined. + (EmacsView, EmacsTooltip): Implements NSWindowDelegate on OSX >= 10.6. + (EmacsMenu): Implements NSMenuDelegate on OSX >= 10.6. + (EmacsToolbar): Implements NSToolbarDelegate on OSX >= 10.6. + + * nsselect.m (ns_string_from_pasteboard): Don't use deprecated methods + cString and lossyCString on OSX >= 10.4 + + * nsmenu.m (fillWithWidgetValue): Don't use depercated method + sizeToFit on OSX >= 10.2. + + * nsimage.m (allocInitFromFile): Don't use deprecated method + bestRepresentationForDevice on OSX >= 10.6. + + * nsfns.m (check_ns_display_info): Cast to long and use %ld in error + to avoid warning. + + * emacs.c: Declare unexec_init_emacs_zone. + + * nsgui.h: Fix compiler warning about gnulib redefining verify. + + * nsselect.m (ns_get_local_selection): Change to extern (Bug#8842). + + * nsmenu.m (ns_update_menubar): Remove useless setDelegate call + on svcsMenu (Bug#8842). + + * nsfns.m (Fx_open_connection): Remove NSStringPboardType from + ns_return_types. + (Fns_list_services): Just return Qnil on 10.6, code not working there. + + * nsterm.m (QUTF8_STRING): Declare. + (initFrameFromEmacs): Call registerServicesMenuSendTypes. + (validRequestorForSendType): Return type is (id). + Change indexOfObjectIdenticalTo to indexOfObject. + Check if we have local selection before returning self (Bug#8842). + (writeSelectionToPasteboard): Put local selection into paste board + if we have a local selection (Bug#8842). + (syms_of_nsterm): DEFSYM QUTF8_STRING. + + * nsterm.h (MAC_OS_X_VERSION_10_6): Define here instead of nsterm.m. + (ns_get_local_selection): Declare. + +2011-07-07 Lars Magne Ingebrigtsen + + * keymap.c (describe_map_tree): Don't insert a double newline at + the end of the buffer (bug#1169) and return whether we inserted + something. + + * callint.c (Fcall_interactively): Change "reading args" to + "providing args" to try to clarify what it does (bug#1010). + +2011-07-07 Kenichi Handa + + * composite.c (composition_compute_stop_pos): Ignore a static + composition starting before CHARPOS (Bug#8915). + + * xdisp.c (handle_composition_prop): Likewise. + +2011-07-07 Eli Zaretskii + + * term.c (produce_glyphs) : Allow IT_GLYPHLESS in it->what. + (Bug#9015) + +2011-07-07 Kenichi Handa + + * character.h (unicode_category_t): New enum type. + + * chartab.c (uniprop_decoder_t, uniprop_encoder_t): New types. + (Qchar_code_property_table): New variable. + (UNIPROP_TABLE_P, UNIPROP_GET_DECODER) + (UNIPROP_COMPRESSED_FORM_P): New macros. + (char_table_ascii): Uncompress the compressed values. + (sub_char_table_ref): New arg is_uniprop. Callers changed. + Uncompress the compressed values. + (sub_char_table_ref_and_range): Likewise. + (char_table_ref_and_range): Uncompress the compressed values. + (sub_char_table_set): New arg is_uniprop. Callers changed. + Uncompress the compressed values. + (sub_char_table_set_range): Args changed. Callers changed. + (char_table_set_range): Adjuted for the above change. + (map_sub_char_table): Delete args default_val and parent. Add arg + top. Give decoded values to a Lisp function. + (map_char_table): Adjusted for the above change. Give decoded + values to a Lisp function. Gcpro more variables. + (uniprop_table_uncompress) + (uniprop_decode_value_run_length): New functions. + (uniprop_decoder, uniprop_decoder_count): New variables. + (uniprop_get_decoder, uniprop_encode_value_character) + (uniprop_encode_value_run_length, uniprop_encode_value_numeric): + New functions. + (uniprop_encoder, uniprop_encoder_count): New variables. + (uniprop_get_encoder, uniprop_table) + (Funicode_property_table_internal, Fget_unicode_property_internal) + (Fput_unicode_property_internal): New functions. + (syms_of_chartab): DEFSYM Qchar_code_property_table, defsubr + Sunicode_property_table_internal, Sget_unicode_property_internal, + and Sput_unicode_property_internal. Defvar_lisp + char-code-property-alist. + + * composite.c (CHAR_COMPOSABLE_P): Adjusted for the change of + Vunicode_category_table. + + * font.c (font_range): Adjusted for the change of + Vunicode_category_table. + +2011-07-07 Dan Nicolaescu + + * m/iris4d.h: Remove file, move contents ... + * s/irix6-5.h: ... here. + +2011-07-06 Paul Eggert + + Remove unportable assumption about struct layout (Bug#8884). + * alloc.c (mark_buffer): + * buffer.c (reset_buffer_local_variables, Fbuffer_local_variables) + (clone_per_buffer_values): Don't assume that + sizeof (struct buffer) is a multiple of sizeof (Lisp_Object). + This isn't true in general, and it's particularly not true + if Emacs is configured with --with-wide-int. + * buffer.h (FIRST_FIELD_PER_BUFFER, LAST_FIELD_PER_BUFFER): + New macros, used in the buffer.c change. + +2011-07-05 Jan Djärv + + * xsettings.c: Use both GConf and GSettings if both are available. + (store_config_changed_event): Add comment. + (dpyinfo_valid, store_font_name_changed, map_tool_bar_style) + (store_tool_bar_style_changed): New functions. + (store_monospaced_changed): Add comment. Call dpyinfo_valid. + (struct xsettings): Move font inside HAVE_XFT. + (GSETTINGS_TOOL_BAR_STYLE, GSETTINGS_FONT_NAME): New defines. + (GSETTINGS_MONO_FONT): Renamed from SYSTEM_MONO_FONT. + Move inside HAVE_XFT. + (something_changed_gsettingsCB): Renamed from something_changedCB. + Check for changes in GSETTINGS_TOOL_BAR_STYLE and GSETTINGS_FONT_NAME + also. + (GCONF_TOOL_BAR_STYLE, GCONF_FONT_NAME): New defines. + (GCONF_MONO_FONT): Renamed from SYSTEM_MONO_FONT. Move inside HAVE_XFT. + (something_changed_gconfCB): Renamed from something_changedCB. + Check for changes in GCONF_TOOL_BAR_STYLE and GCONF_FONT_NAME also. + (parse_settings): Move check for font inside HAVE_XFT. + (read_settings, apply_xft_settings): Add comment. + (read_and_apply_settings): Add comment. Call map_tool_bar_style and + store_tool_bar_style_changed. Move check for font inside HAVE_XFT and + call store_font_name_changed. + (xft_settings_event): Add comment. + (init_gsettings): Add comment. Get values for GSETTINGS_TOOL_BAR_STYLE + and GSETTINGS_FONT_NAME. Move check for fonts within HAVE_XFT. + (init_gconf): Add comment. Get values for GCONF_TOOL_BAR_STYLE + and GCONF_FONT_NAME. Move check for fonts within HAVE_XFT. + (xsettings_initialize): Call init_gsettings last. + (xsettings_get_system_font, xsettings_get_system_normal_font): Add + comment. + +2011-07-05 Paul Eggert + + Random fixes. E.g., (random) never returned negative values. + * fns.c (Frandom): Use GET_EMACS_TIME for random seed, and add the + subseconds part to the entropy, as that's a bit more random. + Prefer signed to unsigned, since the signedness doesn't matter and + in general we prefer signed. When given a limit, use a + denominator equal to INTMASK + 1, not to VALMASK + 1, because the + latter isn't right if USE_2_TAGS_FOR_INTS. + * sysdep.c (get_random): Return a value in the range 0..INTMASK, + not 0..VALMASK. Don't discard "excess" bits that random () returns. + +2011-07-04 Stefan Monnier + + * textprop.c (text_property_stickiness): + Obey Vtext_property_default_nonsticky. + (syms_of_textprop): Add `display' to Vtext_property_default_nonsticky. + * w32fns.c (syms_of_w32fns): + * xfns.c (syms_of_xfns): Don't Add `display' since it's there by default. + +2011-07-04 Paul Eggert + + * fileio.c (barf_or_query_if_file_exists): Use S_ISDIR. + This is more efficient than Ffile_directory_p and avoids a minor race. + +2011-07-04 Lars Magne Ingebrigtsen + + * buffer.c (Foverlay_put): Say what the return value is + (bug#7835). + + * fileio.c (barf_or_query_if_file_exists): Check first if the file + is a directory before asking whether to use the file name + (bug#7564). + (barf_or_query_if_file_exists): Make the "File is a directory" + error be more correct. + + * fns.c (Frequire): Remove the mention of the .gz files, since + that's installation-specific, but keep the mention of + `get-load-suffixes'. + +2011-07-04 Paul Eggert + + * editfns.c (Fformat_time_string): Don't assume strlen fits in int. + Report string overflow if the output is too long. + +2011-07-04 Juanma Barranquero + + * gnutls.c (Fgnutls_boot): Don't mention :verify-error. + (syms_of_gnutls): Remove duplicate DEFSYM for + Qgnutls_bootprop_verify_hostname_error, an error for + Qgnutls_bootprop_verify_error (which is no longer used). + + * eval.c (find_handler_clause): Remove parameters `sig' and `data', + unused since 2011-01-26T20:02:07Z!monnier@iro.umontreal.ca. All callers changed. + Also (re)move comments that are misplaced or no longer relevant. + +2011-07-03 Lars Magne Ingebrigtsen + + * callint.c (Finteractive): Clarify the meaning of "@" (bug#8813). + +2011-07-03 Chong Yidong + + * xfaces.c (Finternal_merge_in_global_face): Modify the foreground + and background color parameters if they have been changed. + +2011-07-03 Lars Magne Ingebrigtsen + + * editfns.c (Fformat): Clarify the - and 0 flags (bug#6659). + +2011-07-03 Paul Eggert + + * xsettings.c (SYSTEM_FONT): Define only when used. + No need to define when HAVE_GSETTINGS || !HAVE_XFT. + + * keymap.c (access_keymap_1): Now static. + +2011-07-02 Chong Yidong + + * keyboard.c (command_loop_1): If a down-mouse event is unbound, + leave any prefix arg for the up event (Bug#1586). + +2011-07-02 Lars Magne Ingebrigtsen + + * lread.c (syms_of_lread): Mention single symbols defined by + `defvar' or `defconst' (bug#7154). + + * fns.c (Frequire): Mention .el.gz files (bug#7314). + (Frequire): Mention get-load-suffixes. + +2011-07-02 Martin Rudalics + + * window.h (window): Remove clone_number slot. + * window.c (Fwindow_clone_number, Fset_window_clone_number): + Remove. + (make_parent_window, make_window, saved_window) + (Fset_window_configuration, save_window_save): Don't deal with + clone numbers. + * buffer.c (Qclone_number): Remove declaration. + (sort_overlays, overlay_strings): Don't deal with clone numbers. + +2011-07-02 Stefan Monnier + + Add multiple inheritance to keymaps. + * keymap.c (Fmake_composed_keymap): New function. + (Fset_keymap_parent): Simplify. + (fix_submap_inheritance): Remove. + (access_keymap_1): New function extracted from access_keymap to handle + embedded parents and handle lists of maps. + (access_keymap): Use it. + (Fkeymap_prompt, map_keymap_internal, map_keymap, store_in_keymap) + (Fcopy_keymap): Handle embedded parents. + (Fcommand_remapping, define_as_prefix): Simplify. + (Fkey_binding): Simplify. + (syms_of_keymap): Move minibuffer-local-completion-map, + minibuffer-local-filename-completion-map, + minibuffer-local-must-match-map, and + minibuffer-local-filename-must-match-map to Elisp. + (syms_of_keymap): Defsubr make-composed-keymap. + * keyboard.c (menu_bar_items): Use map_keymap_canonical. + (parse_menu_item): Trivial simplification. + +2011-07-01 Glenn Morris + + * Makefile.in (SETTINGS_LIBS): Fix typo. + +2011-07-01 Kazuhiro Ito (tiny patch) + + * coding.c (Fencode_coding_string): Record the last coding system + used, as the function doc string says (bug#8738). + +2011-07-01 Jan Djärv + + * xsettings.c (store_monospaced_changed): Take new font as arg and + check for change against current_mono_font. + (EMACS_TYPE_SETTINGS): Remove this and related defines. + (emacs_settings_constructor, emacs_settings_get_property) + (emacs_settings_set_property, emacs_settings_class_init) + (emacs_settings_init, gsettings_obj): Remove. + (something_changedCB): New function for HAVE_GSETTINGS. + (something_changedCB): HAVE_GCONF: Call store_monospaced_changed + with value as argument. + (init_gsettings): Check that GSETTINGS_SCHEMA exists before calling + g_settings_new (Bug#8967). Do not create gsettings_obj. + Remove calls to g_settings_bind. Connect something_changedCB to + "changed". + + * xgselect.c: Add defined (HAVE_GSETTINGS). + (xgselect_initialize): Ditto. + + * process.c: Add defined (HAVE_GSETTINGS) for xgselect.h + (wait_reading_process_output): Add defined (HAVE_GSETTINGS) for + xg_select. + +2011-07-01 Paul Eggert + + * eval.c (struct backtrace): Simplify and port the data structure. + Do not assume that "int nargs : BITS_PER_INT - 2;" produces a + signed bit field, as this assumption is not portable and it makes + Emacs crash when compiled with Sun C 5.8 on sparc. Do not use + "char debug_on_exit : 1" as this is not portable either; instead, + use the portable "unsigned int debug_on_exit : 1". Remove unused + member evalargs. Remove obsolete comments about cc bombing out. + +2011-06-30 Jan Djärv + + * xsettings.c: Include glib-object.h, gio/gio.h if HAVE_GSETTINGS. + Let HAVE_GSETTINGS override HAVE_GCONF. + (store_monospaced_changed): New function. + (EMACS_SETTINGS): A new type derived from GObject to handle + GSettings notifications. + (emacs_settings_constructor, emacs_settings_get_property) + (emacs_settings_set_property, emacs_settings_class_init): + New functions. + (gsettings_client, gsettings_obj): New variables. + (GSETTINGS_SCHEMA): New define. + (something_changedCB): Call store_monospaced_changed. + (init_gsettings): New function. + (xsettings_initialize): Call init_gsettings. + (syms_of_xsettings): Initialize gsettings_client, gsettings_obj + to NULL. + + * Makefile.in (SETTINGS_CFLAGS, SETTINGS_LIBS): Renamed from + GCONF_CFLAGS/LIBS. + +2011-06-29 Martin Rudalics + + * window.c (resize_root_window, grow_mini_window) + (shrink_mini_window): Rename Qresize_root_window to + Qwindow_resize_root_window and Qresize_root_window_vertically to + Qwindow_resize_root_window_vertically. + +2011-06-28 Paul Eggert + + * gnutls.c (Qgnutls_bootprop_verify_error): Remove unused var. + +2011-06-27 Juanma Barranquero + + * makefile.w32-in: Redesign dependencies so they reflect more + clearly which files are directly included by each source file, + and not through other includes. + +2011-06-27 Martin Rudalics + + * buffer.c (Qclone_number): Declare static and DEFSYM it. + (sort_overlays, overlay_strings): When an overlay's clone number + matches the window's clone number process the overlay even if + the overlay's window property doesn't match the current window. + + * window.c (Fwindow_vchild): Rename to Fwindow_top_child. + (Fwindow_hchild): Rename to Fwindow_left_child. + (Fwindow_next): Rename to Fwindow_next_sibling. + (Fwindow_prev): Rename to Fwindow_prev_sibling. + (resize_window_check): Rename to window_resize_check. + (resize_window_apply): Rename to window_resize_apply. + (Fresize_window_apply): Rename to Fwindow_resize_apply. + (Fdelete_other_windows_internal, resize_frame_windows) + (Fsplit_window_internal, Fdelete_window_internal) + (grow_mini_window, shrink_mini_window) + (Fresize_mini_window_internal): Fix callers accordingly. + +2011-06-26 Jan Djärv + + * emacsgtkfixed.h: State that this is only used with Gtk+3. + (emacs_fixed_set_min_size): Remove. + (emacs_fixed_new): Take frame as argument. + + * emacsgtkfixed.c: State that this is only used with Gtk+3. + (_EmacsFixedPrivate): Remove minwidth/height. + Add struct frame *f. + (emacs_fixed_init): Initialize priv->f. + (get_parent_class, emacs_fixed_set_min_size): Remove. + (emacs_fixed_new): Set priv->f to argument. + (emacs_fixed_get_preferred_width) + (emacs_fixed_get_preferred_height): Use min_width/height from + frames size_hint to set minimum and natural (Bug#8919). + (XSetWMSizeHints, XSetWMNormalHints): Override these functions + and use min_width/height from frames size_hint to set + min_width/height (Bug#8919). + + * gtkutil.c (xg_create_frame_widgets): Pass f to emacs_fixed_new. + (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size. + Fix indentation. + +2011-06-26 Eli Zaretskii + + * bidi.c (bidi_paragraph_init): Test for ZV_BYTE before calling + bidi_at_paragraph_end, since fast_looking_at doesn't like to be + called at ZV. + +2011-06-26 Chong Yidong + + * process.c (wait_reading_process_output): Bypass select if + waiting for a cell while ignoring keyboard input, and input is + pending. Suggested by Jan Djärv (Bug#8869). + +2011-06-25 Paul Eggert + + Use gnulib's dup2 module instead of rolling our own. + * sysdep.c (dup2) [!HAVE_DUP2]: Remove; gnulib now does this. + +2011-06-25 YAMAMOTO Mitsuharu + + * dispnew.c (scrolling_window): Before scrolling, turn off a + mouse-highlight in the window being scrolled. + +2011-06-24 Juanma Barranquero + + Move DEFSYM to lisp.h and use everywhere. + + * character.h (DEFSYM): Move declaration... + * lisp.h (DEFSYM): ...here. + + * gnutls.c: + * minibuf.c: + * w32menu.c: + * w32proc.c: + * w32select.c: Don't include character.h. + + * alloc.c (syms_of_alloc): + * buffer.c (syms_of_buffer): + * bytecode.c (syms_of_bytecode): + * callint.c (syms_of_callint): + * casefiddle.c (syms_of_casefiddle): + * casetab.c (init_casetab_once): + * category.c (init_category_once, syms_of_category): + * ccl.c (syms_of_ccl): + * cmds.c (syms_of_cmds): + * composite.c (syms_of_composite): + * dbusbind.c (syms_of_dbusbind): + * dired.c (syms_of_dired): + * dispnew.c (syms_of_display): + * doc.c (syms_of_doc): + * editfns.c (syms_of_editfns): + * emacs.c (syms_of_emacs): + * eval.c (syms_of_eval): + * fileio.c (syms_of_fileio): + * fns.c (syms_of_fns): + * frame.c (syms_of_frame): + * fringe.c (syms_of_fringe): + * insdel.c (syms_of_insdel): + * keymap.c (syms_of_keymap): + * lread.c (init_obarray, syms_of_lread): + * macros.c (syms_of_macros): + * msdos.c (syms_of_msdos): + * print.c (syms_of_print): + * process.c (syms_of_process): + * search.c (syms_of_search): + * sound.c (syms_of_sound): + * syntax.c (init_syntax_once, syms_of_syntax): + * terminal.c (syms_of_terminal): + * textprop.c (syms_of_textprop): + * undo.c (syms_of_undo): + * w32.c (globals_of_w32): + * window.c (syms_of_window): + * xdisp.c (syms_of_xdisp): + * xfaces.c (syms_of_xfaces): + * xfns.c (syms_of_xfns): + * xmenu.c (syms_of_xmenu): + * xsettings.c (syms_of_xsettings): + * xterm.c (syms_of_xterm): Use DEFSYM. + +2011-06-24 Teodor Zlatanov + + * gnutls.c (syms_of_gnutls): Use the DEFSYM macro from character.h. + +2011-06-23 Paul Eggert + + Integer and buffer overflow fixes (Bug#8873). + + * print.c (printchar, strout): Check for string overflow. + (PRINTPREPARE, printchar, strout): + Don't set size unless allocation succeeds. + + * minibuf.c (read_minibuf_noninteractive): Use ptrdiff_t, not int, + for sizes. Check for string overflow more accurately. + Simplify newline removal at end; this suppresses a GCC 4.6.0 warning. + + * macros.c: Integer and buffer overflow fixes. + * keyboard.h (struct keyboard.kbd_macro_bufsize): + * macros.c (Fstart_kbd_macro, store_kbd_macro_char): + Use ptrdiff_t, not int, for sizes. + Don't increment bufsize until after realloc succeeds. + Check for size-calculation overflow. + (Fstart_kbd_macro): Use EMACS_INT, not int, for XINT result. + + * lisp.h (DEFVAR_KBOARD): Use offsetof instead of char * finagling. + + * lread.c: Integer overflow fixes. + (read_integer): Radix is now EMACS_INT, not int, + to improve quality of diagnostics for out-of-range radices. + Calculate buffer size correctly for out-of-range radices. + (read1): Check for integer overflow in radices, and in + read-circle numbers. + (read_escape): Avoid int overflow. + (Fload, openp, read_buffer_size, read1) + (substitute_object_recurse, read_vector, read_list, map_obarray): + Use ptrdiff_t, not int, for sizes. + (read1): Use EMACS_INT, not int, for sizes. + Check for size overflow. + + * image.c (cache_image): Check for size arithmetic overflow. + + * lread.c: Integer overflow issues. + (saved_doc_string_size, saved_doc_string_length) + (prev_saved_doc_string_size, prev_saved_doc_string_length): + Now ptrdiff_t, not int. + (read1): Don't assume doc string length fits in int. Check for + out-of-range doc string lengths. + (read_list): Don't assume file position fits in int. + (read_escape): Check for hex character overflow. + +2011-06-22 Leo Liu + + * minibuf.c (Fcompleting_read_default, Vcompleting_read_function): + Move to minibuffer.el. + +2011-06-22 Paul Eggert + + Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking. + The following patches are for when GLYPH_DEBUG && !XASSERT. + * dispextern.h (trace_redisplay_p, dump_glyph_string): + * dispnew.c (flush_stdout): + * xdisp.c (dump_glyph_row, dump_glyph_matrix, dump_glyph): + Mark as externally visible. + * dispnew.c (check_window_matrix_pointers): Now static. + * dispnew.c (window_to_frame_vpos): + * xfns.c (unwind_create_frame): + * xterm.c (x_check_font): Remove unused local. + * scroll.c (CHECK_BOUNDS): + * xfaces.c (cache_fache): Rename local to avoid shadowing. + * xfns.c, w32fns.c (image_cache_refcount, dpyinfo_refcount): Now static. + * xdisp.c (check_window_end): Now a no-op if !XASSERTS. + (debug_first_unchanged_at_end_vpos, debug_last_unchanged_at_beg_vpos) + (debug_dvpos, debug_dy, debug_delta, debug_delta_bytes, debug_end_vpos): + Now static. + (debug_method_add): Use va_list and vsprintf rather than relying + on undefined behavior with wrong number of arguments. + (dump_glyph, dump_glyph_row, Fdump_glyph_matrix): + Don't assume ptrdiff_t and EMACS_INT are the same width as int. + In this code, it's OK to assume C99 behavior for ptrdiff_t formats + since we're not interested in debugging glyphs with old libraries. + * xfaces.c (cache_face): Move debugging code earlier; this pacifies + GCC 4.6.0's static checking. + +2011-06-22 Paul Eggert + + Integer overflow and signedness fixes (Bug#8873). + A few related buffer overrun fixes, too. + + * font.c (font_score): Use EMACS_INT, not int, to store XINT value. + + * dispextern.h (struct face.stipple): + * image.c (x_bitmap_height, x_bitmap_width, x_bitmap_pixmap) + (x_bitmap_mask, x_allocate_bitmap_record) + (x_create_bitmap_from_data, x_create_bitmap_from_file) + (x_destroy_bitmap, x_destroy_all_bitmaps, x_create_bitmap_mask) + (x_create_bitmap_from_xpm_data): + * nsterm.h (struct ns_display_info.bitmaps_size, .bitmaps_last): + * w32term.h (struct w32_display_info.icon_bitmap_id, .bitmaps_size) + (.bitmaps_last): + * xfaces.c (load_pixmap): + * xterm.c (x_bitmap_icon, x_wm_set_icon_pixmap): + * xterm.h (struct x_display_info.icon_bitmap_id, .bitmaps_size) + (.bitmaps_last, struct x_output.icon_bitmap): + Use ptrdiff_t, not int, for bitmap indexes. + (x_allocate_bitmap_record): Check for size overflow. + * dispextern.h, lisp.h: Adjust to API changes elsewhere. + + Use ptrdiff_t, not int, for overlay counts. + * buffer.h (overlays_at, sort_overlays, GET_OVERLAYS_AT): + * editfns.c (overlays_around, get_pos_property): + * textprop.c (get_char_property_and_overlay): + * xdisp.c (next_overlay_change, note_mouse_highlight): + * xfaces.c (face_at_buffer_position): + * buffer.c (OVERLAY_COUNT_MAX): New macro. + (overlays_at, overlays_in, sort_overlays, Foverlays_at) + (Fnext_overlay_change, Fprevious_overlay_change) + (mouse_face_overlay_overlaps, Foverlays_in): + Use ptrdiff_t, not int, for sizes. + (overlays_at, overlays_in): Check for size-calculation overflow. + + * xterm.c (xim_initialize, same_x_server): Strlen may not fit in int. + + * xsmfns.c (smc_save_yourself_CB, x_session_initialize): Avoid strlen. + (x_session_initialize): Do not assume string length fits in int. + + * xsettings.c (apply_xft_settings): Fix potential buffer overrun. + This is unlikely, but can occur if DPI is outlandish. + + * xsettings.c (Ffont_get_system_normal_font, Ffont_get_system_font): + * xselect.c (Fx_get_atom_name): Avoid need for strlen. + + * xrdb.c: Don't assume strlen fits in int; avoid some strlens. + * xrdb.c (magic_file_p, search_magic_path): + Omit last arg SUFFIX; it was always 0. All callers changed. + (magic_file_p): Use ptrdiff_t, not int. Check for size overflow. + + * xfont.c (xfont_match): Avoid need for strlen. + + * xfns.c: Don't assume strlen fits in int. + (xic_create_fontsetname, x_window): Use ptrdiff_t, not int. + + * xdisp.c (message_log_check_duplicate): Return intmax_t, + not unsigned long, as we prefer signed integers. All callers changed. + Detect integer overflow in repeat count. + (message_dolog): Don't assume print length fits in 39 bytes. + (display_mode_element): Don't assume strlen fits in int. + + * termcap.c: Don't assume sizes fit in int and never overflow. + (struct termcap_buffer, tgetent): Use ptrdiff_t, not int, for sizes. + (gobble_line): Check for size-calculation overflow. + + * minibuf.c (Fread_buffer): + * lread.c (intern, intern_c_string): + * image.c (xpm_scan) [HAVE_NS && !HAVE_XPM]: + Don't assume string length fits in int. + + * keyboard.c (parse_tool_bar_item): + * gtkutil.c (style_changed_cb): Avoid need for strlen. + + * font.c: Don't assume string length fits in int. + (font_parse_xlfd, font_parse_fcname, font_unparse_fcname): + Use ptrdiff_t, not int. + (font_intern_prop): Don't assume string length fits in int. + Don't assume integer property fits in fixnum. + * font.h (font_intern_prop): 2nd arg is now ptrdiff_t, not int. + + * filelock.c: Fix some buffer overrun and integer overflow issues. + (get_boot_time): Don't assume gzip command string fits in 100 bytes. + Reformulate so as not to need the command string. + Invoke gzip -cd rather than gunzip, as it's more portable. + (lock_info_type, lock_file_1, lock_file): + Don't assume pid_t and time_t fit in unsigned long. + (LOCK_PID_MAX): Remove; we now use more-reliable bounds. + (current_lock_owner): Prefer signed type for sizes. + Use memcpy, not strncpy, where memcpy is what is really wanted. + Don't assume (via atoi) that time_t and pid_t fit in int. + Check for time_t and/or pid_t out of range, e.g., via a network share. + Don't alloca where an auto var works fine. + + * fileio.c: Fix some integer overflow issues. + (file_name_as_directory, Fexpand_file_name, Fsubstitute_in_file_name): + Don't assume string length fits in int. + (directory_file_name): Don't assume string length fits in long. + (make_temp_name): Don't assume pid fits in int, or that its print + length is less than 20. + + * data.c (Fsubr_name): Rewrite to avoid a strlen call. + + * coding.c (make_subsidiaries): Don't assume string length fits in int. + + * callproc.c (child_setup): Rewrite to avoid two strlen calls. + + * process.c (Fformat_network_address): Use EMACS_INT, not EMACS_UINT. + We prefer signed integers, even for size calculations. + + * emacs.c: Don't assume string length fits in 'int'. + (DEFINE_DUMMY_FUNCTION, sort_args): Use ptrdiff_t, not int. + (main): Don't invoke strlen when not needed. + + * dbusbind.c (XD_ERROR): Don't arbitrarily truncate string. + (XD_DEBUG_MESSAGE): Don't waste a byte. + + * callproc.c (getenv_internal_1, getenv_internal) + (Fgetenv_internal): + * buffer.c (init_buffer): Don't assume string length fits in 'int'. + + * lread.c (invalid_syntax): Omit length argument. + All uses changed. This doesn't fix a bug, but it simplifies the + code away from its former Hollerith-constant appearance, and it's + one less 'int' to worry about when looking at integer-overflow issues. + (string_to_number): Simplify 2011-04-26 change by invoking xsignal1. + + * lisp.h (DEFUN): Remove bogus use of sizeof (struct Lisp_Subr). + This didn't break anything, but it didn't help either. + It's confusing to put a bogus integer in a place where the actual + value does not matter. + (LIST_END_P): Remove unused macro and its bogus comment. + (make_fixnum_or_float): Remove unnecessary cast to EMACS_INT. + + * lisp.h (union Lisp_Object.i): EMACS_INT, not EMACS_UINT. + This is for consistency with the ordinary, non-USE_LISP_UNION_TYPE, + implementation. + (struct Lisp_Bool_Vector.size): EMACS_INT, not EMACS_UINT. + We prefer signed types, and the value cannot exceed the EMACS_INT + range anyway (because otherwise the length would not be representable). + (XSET) [USE_LISP_UNION_TYPE]: Use uintptr_t and intptr_t, + not EMACS_UINT and EMACS_INT, when converting pointer to integer. + This avoids a GCC warning when WIDE_EMACS_INT. + + * indent.c (sane_tab_width): New function. + (current_column, scan_for_column, Findent_to, position_indentation) + (compute_motion): Use it. This is just for clarity. + (Fcompute_motion): Don't assume hscroll and tab offset fit in int. + + * image.c (xbm_image_p): Don't assume stated width, height fit in int. + + * lisp.h (lint_assume): New macro. + * composite.c (composition_gstring_put_cache): + * ftfont.c (ftfont_shape_by_flt): Use it to pacify GCC 4.6.0. + + * editfns.c, insdel.c: + Omit unnecessary forward decls, to simplify future changes. + + * ftfont.c (ftfont_shape_by_flt): Use signed integers for lengths. + + * font.c (Ffont_shape_gstring): Don't assume glyph len fits in 'int'. + + * fns.c (Ffillarray): Don't assume bool vector size fits in 'int'. + Use much-faster test for byte-length change. + Don't assume string byte-length fits in 'int'. + Check that character arg fits in 'int'. + (mapcar1): Declare byte as byte, for clarity. + + * alloc.c (Fmake_bool_vector): Avoid unnecessary multiplication. + + * fns.c (concat): Catch string overflow earlier. + Do not rely on integer wraparound. + + * dispextern.h (struct it.overlay_strings_charpos) + (struct it.selective): Now EMACS_INT, not int. + * xdisp.c (forward_to_next_line_start) + (back_to_previous_visible_line_start) + (reseat_at_next_visible_line_start, next_element_from_buffer): + Don't arbitrarily truncate the value of 'selective' to int. + + * xdisp.c (init_iterator): Use XINT, not XFASTINT; it might be < 0. + + * composite.c: Don't truncate sizes to 'int'. + (composition_gstring_p, composition_reseat_it) + (composition_adjust_point): Use EMACS_INT, not int. + (get_composition_id, composition_gstring_put_cache): Use EMACS_INT, + not EMACS_UINT, for indexes. + + * category.h (CATEGORY_SET_P): Remove unnecessary cast to EMACS_INT. + + * buffer.c: Include . + (struct sortvec.priority, struct sortstr.priority): + Now EMACS_INT, not int. + (compare_overlays, cmp_for_strings): Avoid subtraction overflow. + (struct sortstr.size, record_overlay_string) + (struct sortstrlist.size, struct sortlist.used): + Don't truncate size to int. + (record_overlay_string): Check for size-calculation overflow. + (init_buffer_once): Check at compile-time, not run-time. + +2011-06-22 Jim Meyering + + Don't leak an XBM-image-sized buffer + * image.c (xbm_load): Free the image buffer after using it. + +2011-06-21 Paul Eggert + + Port to Sun C. + * composite.c (find_automatic_composition): Omit needless 'return 0;' + that Sun C diagnosed. + * fns.c (secure_hash): Fix pointer signedness issue. + * intervals.c (static_offset_intervals): New function. + (offset_intervals): Use it. + +2011-06-21 Leo Liu + + * deps.mk (fns.o): + * makefile.w32-in ($(BLD)/fns.$(O)): Include sha256.h and + sha512.h. + + * fns.c (secure_hash): Rename from crypto_hash_function and change + the first arg to accept symbols. + (Fsecure_hash): New primitive. + (syms_of_fns): New symbols. + +2011-06-20 Deniz Dogan + + * process.c (Fset_process_buffer): Clarify return value in + docstring. + +2011-06-18 Chong Yidong - * bidi.c (bidi_count_bytes, bidi_char_at_pos): Accept an - additional argument UNIBYTE, and support unibyte strings. All - callers changed. - (bidi_fetch_char): Support unibyte strings. + * dispnew.c (add_window_display_history): Use BVAR. -2011-06-25 Eli Zaretskii + * xdisp.c (debug_method_add): Use BVAR. + (check_window_end, dump_glyph_matrix, dump_glyph) + (dump_glyph_row, dump_glyph_string): Convert arglist to ANSI C. - * xdisp.c (set_iterator_to_next, get_visually_first_element): Use - it->bidi_it.string.schars rather than it->string_nchars when - testing whether we're beyond string end, because string_nchars is - zero for strings that come from overlays and display properties. + * xfaces.c (check_lface_attrs, check_lface, dump_realized_face): + Likewise. - * bidi.c (bidi_cache_iterator_state): Fix a bug with testing - character positions against the cached range, when we use a - stacked cache. + * xfns.c (Fx_create_frame, x_create_tip_frame): Delay image cache + check till after the cache is created in init_frame_faces. + +2011-06-17 Stefan Monnier + + * fns.c (Fsafe_length): Yet another int/Lisp_Object mixup. + +2011-06-16 Paul Eggert + + * lisp.h: Include , for INT_MAX, LONG_MAX, LLONG_MAX. + Without this, prin1 mishandles Lisp_Misc_Save_Value printing on + hosts with pre-C99 libraries, because pD is wrongly defined to "t". + + Improve buffer-overflow checking (Bug#8873). + * fileio.c (Finsert_file_contents): + * insdel.c (insert_from_buffer_1, replace_range, replace_range_2): + Remove the old (too-loose) buffer overflow checks. + They weren't needed, since make_gap checks for buffer overflow. + * insdel.c (make_gap_larger): Catch buffer overflows that were missed. + The old code merely checked for Emacs fixnum overflow, and relied + on undefined (wraparound) behavior. The new code avoids undefined + behavior, and also checks for ptrdiff_t and/or size_t overflow. + + * editfns.c (Finsert_char): Don't dump core with very negative counts. + Tune. Don't use wider integers than needed. Don't use alloca. + Use a bigger 'string' buffer. Rewrite to avoid 'n > 0' test. + + * insdel.c (replace_range): Fix buf overflow when insbytes < outgoing. + + * insdel.c, lisp.h (buffer_overflow): New function. + (insert_from_buffer_1, replace_range, replace_range_2): + * insdel.c (make_gap_larger): + * editfns.c (Finsert_char): + * fileio.c (Finsert_file_contents): Use it, to normalize wording. + + * buffer.h (BUF_BYTES_MAX): Cast to ptrdiff_t so that it's signed. + +2011-06-15 Paul Eggert + + Integer overflow and signedness fixes (Bug#8873). + + * ccl.c (ASCENDING_ORDER): New macro, to work around GCC bug 43772. + (GET_CCL_RANGE, IN_INT_RANGE): Use it. + + * fileio.c: Don't assume EMACS_INT fits in off_t. + (emacs_lseek): New static function. + (Finsert_file_contents, Fwrite_region): Use it. + Use SEEK_SET, SEEK_CUR, SEEK_END as appropriate. + + * fns.c (Fload_average): Don't assume 100 * load average fits in int. + + * fns.c: Don't overflow int when computing a list length. + * fns.c (QUIT_COUNT_HEURISTIC): New constant. + (Flength, Fsafe_length): Use EMACS_INT, not int, to avoid unwanted + truncation on 64-bit hosts. Check for QUIT every + QUIT_COUNT_HEURISTIC entries rather than every other entry; that's + faster and is responsive enough. + (Flength): Report an error instead of overflowing an integer. + (Fsafe_length): Return a float if the value is not representable + as a fixnum. This shouldn't happen except in contrived situations. + (Fnthcdr, Fsort): Don't assume list length fits in int. + (Fcopy_sequence): Don't assume vector length fits in int. + + * alloc.c: Check that resized vectors' lengths fit in fixnums. + (header_size, word_size): New constants. + (allocate_vectorlike): Don't check size overflow here. + (allocate_vector): Check it here instead, since this is the only + caller of allocate_vectorlike that could cause overflow. + Check that the new vector's length is representable as a fixnum. + + * fns.c (next_almost_prime): Don't return a multiple of 3 or 5. + The previous code was bogus. For example, next_almost_prime (32) + returned 39, which is undesirable as it is a multiple of 3; and + next_almost_prime (24) returned 25, which is a multiple of 5 so + why was the code bothering to check for multiples of 7? + + * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, for vector length. + + * eval.c, doprnt.c (SIZE_MAX): Remove; inttypes.h defines this now. + + Variadic C functions now count arguments with ptrdiff_t. + This partly undoes my 2011-03-30 change, which replaced int with size_t. + Back then I didn't know that the Emacs coding style prefers signed int. + Also, in the meantime I found a few more instances where arguments + were being counted with int, which may truncate counts on 64-bit + machines, or EMACS_INT, which may be unnecessarily wide. + * lisp.h (struct Lisp_Subr.function.aMANY) + (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): + Arg counts are now ptrdiff_t, not size_t. + All variadic functions and their callers changed accordingly. + (struct gcpro.nvars): Now size_t, not size_t. All uses changed. + * bytecode.c (exec_byte_code): Check maxdepth for overflow, + to avoid potential buffer overrun. Don't assume arg counts fit in 'int'. + * callint.c (Fcall_interactively): Check arg count for overflow, + to avoid potential buffer overrun. Use signed char, not 'int', + for 'varies' array, so that we needn't bother to check its size + calculation for overflow. + * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args. + * eval.c (apply_lambda): + * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length. + (struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed. + (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args. + + * callint.c (Fcall_interactively): Don't use index var as event count. + + * vm-limit.c (check_memory_limits): Fix incorrect extern function decls. + * mem-limits.h (SIZE): Remove; no longer used. + + * xterm.c (x_alloc_nearest_color_1): Prefer int to long when int works. + + Remove unnecessary casts. + * xterm.c (x_term_init): + * xfns.c (x_set_border_pixel): + * widget.c (create_frame_gcs): Remove casts to unsigned long etc. + These aren't needed now that we assume ANSI C. + + * sound.c (Fplay_sound_internal): Remove cast to unsigned long. + It's more likely to cause problems (due to unsigned overflow) + than to cure them. + + * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts. + + * unexelf.c (unexec): Don't assume BSS addr fits in unsigned. + + * xterm.c (handle_one_xevent): Omit unnecessary casts to unsigned. + + * keyboard.c (modify_event_symbol): Don't limit alist len to UINT_MAX. + + * lisp.h (CHAR_TABLE_SET): Omit now-redundant test. + + * lread.c (Fload): Don't compare a possibly-garbage time_t value. + + GLYPH_CODE_FACE returns EMACS_INT, not int. + * dispextern.h (merge_faces): + * xfaces.c (merge_faces): + * xdisp.c (get_next_display_element, next_element_from_display_vector): + Don't assume EMACS_INT fits in int. + + * character.h (CHAR_VALID_P): Remove unused parameter. + * fontset.c, lisp.h, xdisp.c: All uses changed. + + * editfns.c (Ftranslate_region_internal): Omit redundant test. + + * fns.c (concat): Minor tuning based on overflow analysis. + This doesn't fix any bugs. Use int to hold character, instead + of constantly refetching from Emacs object. Use XFASTINT, not + XINT, for value known to be a character. Don't bother comparing + a single byte to 0400, as it's always less. + + * floatfns.c (Fexpt): + * fileio.c (make_temp_name): Omit unnecessary cast to unsigned. + + * editfns.c (Ftranslate_region_internal): Use int, not EMACS_INT + for characters. + + * doc.c (get_doc_string): Omit (unsigned)c that mishandled negatives. + + * data.c (Faset): If ARRAY is a string, check that NEWELT is a char. + Without this fix, on a 64-bit host (aset S 0 4294967386) would + incorrectly succeed when S was a string, because 4294967386 was + truncated before it was used. + + * chartab.c (Fchar_table_range): Use CHARACTERP to check range. + Otherwise, an out-of-range integer could cause undefined behavior + on a 64-bit host. + + * composite.c: Use int, not EMACS_INT, for characters. + (fill_gstring_body, composition_compute_stop_pos): Use int, not + EMACS_INT, for values that are known to be in character range. + This doesn't fix any bugs but is the usual style inside Emacs and + may generate better code on 32-bit machines. + + Make sure a 64-bit char is never passed to ENCODE_CHAR. + This is for reasons similar to the recent CHAR_STRING fix. + * charset.c (Fencode_char): Check that character arg is actually + a character. Pass an int to ENCODE_CHAR. + * charset.h (ENCODE_CHAR): Verify that the character argument is no + wider than 'int', as a compile-time check to prevent future regressions + in this area. + + * character.c (char_string): Remove unnecessary casts. + + Make sure a 64-bit char is never passed to CHAR_STRING. + Otherwise, CHAR_STRING would do the wrong thing on a 64-bit platform, + by silently ignoring the top 32 bits, allowing some values + that were far too large to be valid characters. + * character.h: Include . + (CHAR_STRING, CHAR_STRING_ADVANCE): Verify that the character + arguments are no wider than unsigned, as a compile-time check + to prevent future regressions in this area. + * data.c (Faset): + * editfns.c (Fchar_to_string, general_insert_function, Finsert_char) + (Fsubst_char_in_region): + * fns.c (concat): + * xdisp.c (decode_mode_spec_coding): + Adjust to CHAR_STRING's new requirement. + * editfns.c (Finsert_char, Fsubst_char_in_region): + * fns.c (concat): Check that character args are actually + characters. Without this test, these functions did the wrong + thing with wildly out-of-range values on 64-bit hosts. - * xdisp.c (push_it, pop_it): Save and restore it. + Remove incorrect casts to 'unsigned' that lose info on 64-bit hosts. + These casts should not be needed on 32-bit hosts, either. + * keyboard.c (read_char): + * lread.c (Fload): Remove casts to unsigned. + + * lisp.h (UNSIGNED_CMP): New macro. + This fixes comparison bugs on 64-bit hosts. + (ASCII_CHAR_P): Use it. + * casefiddle.c (casify_object): + * character.h (ASCII_BYTE_P, CHAR_VALID_P) + (SINGLE_BYTE_CHAR_P, CHAR_STRING): + * composite.h (COMPOSITION_ENCODE_RULE_VALID): + * dispextern.h (FACE_FROM_ID): + * keyboard.c (read_char): Use UNSIGNED_CMP. + + * xmenu.c (dialog_selection_callback) [!USE_GTK]: Cast to intptr_t, + not to EMACS_INT, to avoid GCC warning. + + * xfns.c (x_set_scroll_bar_default_width): Remove unused 'int' locals. + + * buffer.h (PTR_BYTE_POS, BUF_PTR_BYTE_POS): Remove harmful cast. + The cast incorrectly truncated 64-bit byte offsets to 32 bits, and + isn't needed on 32-bit machines. + + * buffer.c (Fgenerate_new_buffer_name): + Use EMACS_INT for count, not int. + (advance_to_char_boundary): Return EMACS_INT, not int. + + * data.c (Qcompiled_function): Now static. + + * window.c (window_body_lines): Now static. + + * image.c (gif_load): Rename local to avoid shadowing. + + * lisp.h (SAFE_ALLOCA_LISP): Check for integer overflow. + (struct Lisp_Save_Value): Use ptrdiff_t, not int, for 'integer' member. + * alloc.c (make_save_value): Integer argument is now of type + ptrdiff_t, not int. + (mark_object): Use ptrdiff_t, not int. + * lisp.h (pD): New macro. + * print.c (print_object): Use it. + + * alloc.c: Use EMACS_INT, not int, to count objects. + (total_conses, total_markers, total_symbols, total_vector_size) + (total_free_conses, total_free_markers, total_free_symbols) + (total_free_floats, total_floats, total_free_intervals) + (total_intervals, total_strings, total_free_strings): + Now EMACS_INT, not int. All uses changed. + (Fgarbage_collect): Compute overall total using a double, so that + integer overflow is less likely to be a problem. Check for overflow + when converting back to an integer. + (n_interval_blocks, n_string_blocks, n_float_blocks, n_cons_blocks) + (n_vectors, n_symbol_blocks, n_marker_blocks): Remove. + These were 'int' variables that could overflow on 64-bit hosts; + they were never used, so remove them instead of repairing them. + (nzombies, ngcs, max_live, max_zombies): Now EMACS_INT, not 'int'. + (inhibit_garbage_collection): Set gc_cons_threshold to max value. + Previously, this ceilinged at INT_MAX, but that doesn't work on + 64-bit machines. + (allocate_pseudovector): Don't use EMACS_INT when int would do. + + * alloc.c (Fmake_bool_vector): Don't assume vector size fits in int. + (allocate_vectorlike): Check for ptrdiff_t overflow. + (mark_vectorlike, mark_char_table, mark_object): Avoid EMACS_UINT + when a (possibly-narrower) signed value would do just as well. + We prefer using signed arithmetic, to avoid comparison confusion. + + * alloc.c: Catch some string size overflows that we were missing. + (XMALLOC_OVERRUN_CHECK_SIZE) [!XMALLOC_OVERRUN_CHECK]: Define to 0, + for convenience in STRING_BYTES_MAX. + (STRING_BYTES_MAX): New macro, superseding the old one in lisp.h. + The definition here is exact; the one in lisp.h was approximate. + (allocate_string_data): Check for string overflow. This catches + some instances we weren't catching before. Also, it catches + size_t overflow on (unusual) hosts where SIZE_MAX <= min + (PTRDIFF_MAX, MOST_POSITIVE_FIXNUM), e.g., when size_t is 32 bits + and ptrdiff_t and EMACS_INT are both 64 bits. + + * character.c, coding.c, doprnt.c, editfns.c, eval.c: + All uses of STRING_BYTES_MAX replaced by STRING_BYTES_BOUND. + * lisp.h (STRING_BYTES_BOUND): Renamed from STRING_BYTES_MAX. + + * character.c (string_escape_byte8): Fix nbytes/nchars typo. + + * alloc.c (Fmake_string): Check for out-of-range init. + +2011-06-15 Stefan Monnier + + * eval.c (Fdefvaralias): Also mark the target as variable-special-p. + +2011-06-14 Jan Djärv + + * xfns.c (x_set_scroll_bar_default_width): Remove argument to + xg_get_default_scrollbar_width. + + * gtkutil.c: Include emacsgtkfixed.h if HAVE_GTK3. + (int_gtk_range_get_value): Move to the scroll bar part of the file. + (style_changed_cb): Call update_theme_scrollbar_width and call + x_set_scroll_bar_default_width and xg_frame_set_char_size for + all frames (Bug#8505). + (xg_create_frame_widgets): Call emacs_fixed_new if HAVE_GTK3 (Bug#8505). + Call gtk_window_set_resizable if HAVE_GTK3. + (x_wm_set_size_hint): Call emacs_fixed_set_min_size with min width + and height if HAVE_GTK3 (Bug#8505). + (scroll_bar_width_for_theme): New variable. + (update_theme_scrollbar_width): New function. + (xg_get_default_scrollbar_width): Move code to + update_theme_scrollbar_width, just return scroll_bar_width_for_theme. + (xg_initialize): Call update_theme_scrollbar_width. + + * gtkutil.h (xg_get_default_scrollbar_width): Remove argument. + + * emacsgtkfixed.c, emacsgtkfixed.h: New files. + +2011-06-12 Martin Rudalics + + * frame.c (make_frame): Call other_buffer_safely instead of + other_buffer. + + * window.c (temp_output_buffer_show): Call display_buffer with + second argument Vtemp_buffer_show_specifiers and reset latter + immediately after the call. + (Vtemp_buffer_show_specifiers): New variable. + (auto_window_vscroll_p, next_screen_context_lines) + (Vscroll_preserve_screen_position): Remove leading asterisks from + doc-strings. + +2011-06-12 Paul Eggert + + Fix minor problems found by GCC 4.6.0 static checking. + * buffer.c (Qclone_number): Remove for now, as it's unused. + (record_buffer, Funrecord_buffer): Rename local to avoid shadowing. + (record_buffer): Remove unused local. + * frame.c (other_visible_frames, frame_buffer_list): Now static. + (set_frame_buffer_list): Remove; unused. + * frame.h (other_visible_frames): Remove decl. + * keyboard.h (menu_items_inuse): Declare only if USE_GTK || USE_MOTIF. + * lisp.h (frame_buffer_list, set_frame_buffer_list): Remove decls. + (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): Declare only + if HAVE_GPM. + * menu.c (menu_items_inuse): Now static unless USE_GTK || USE_MOTIF. + * process.c (add_gpm_wait_descriptor, delete_gpm_wait_descriptor): + Define only if HAVE_GPM. + * widget.c (EmacsFrameResize, emacsFrameClassRec): Now static. + (update_hints_inhibit): Remove; never set. All uses removed. + * widgetprv.h (emacsFrameClassRec): Remove decl. + * window.c (delete_deletable_window): Now returns void, since it + wasn't returning anything. + (compare_window_configurations): Remove unused locals. + * xfns.c (x_set_scroll_bar_default_width): Remove unused locals. + * xmenu.c (x_menu_set_in_use): Define only if USE_GTK || USE_MOTIF. + (dialog_selection_callback) [!USE_GTK]: Prefer intptr_t for integers + the same widths as pointers. This follows up on the 2011-05-06 patch. + * xterm.c (x_alloc_lighter_color_for_widget): Define only if USE_LUCID. + * xterm.h: Likewise. + (x_menu_set_in_use): Declare only if USE_GTK || USE_MOTIF. + +2011-06-12 Juanma Barranquero - * dispextern.h (struct iterator_stack_entry): New member - paragraph_embedding. + * makefile.w32-in: Update dependencies. + (LISP_H): Add lib/intprops.h. + +2011-06-11 Chong Yidong + + * image.c (gif_load): Add animation frame delay to the metadata. + (syms_of_image): Use DEFSYM. New symbol `delay'. + +2011-06-11 Martin Rudalics + + * window.c (delete_deletable_window): Re-add. + (Fset_window_configuration): Rewrite to handle dead buffers and + consequently deletable windows. + (window_tree, Fwindow_tree): Remove. Supply functionality in + window.el. + (compare_window_configurations): Simplify code. + +2011-06-11 Andreas Schwab + + * image.c (imagemagick_load_image): Fix type mismatch. + (Fimagemagick_types): Likewise. + + * window.h (replace_buffer_in_windows): Declare. + +2011-06-11 Martin Rudalics + + * buffer.c: New Lisp objects Qbuffer_list_update_hook and + Qclone_number. Remove external declaration of Qdelete_window. + (Fbuffer_list): Rewrite doc-string. Minor restructuring of + code. + (Fget_buffer_create, Fmake_indirect_buffer, Frename_buffer): Run + Qbuffer_list_update_hook if allowed. + (Fother_buffer): Rewrite doc-string. Major rewrite for new + buffer list implementation. + (other_buffer_safely): New function. + (Fkill_buffer): Replace call to replace_buffer_in_all_windows by + calls to replace_buffer_in_windows and + replace_buffer_in_windows_safely. Run Qbuffer_list_update_hook + if allowed. + (record_buffer): Inhibit quitting and rewrite using quittable + functions. Run Qbuffer_list_update_hook if allowed. + (Frecord_buffer, Funrecord_buffer): New functions. + (switch_to_buffer_1, Fswitch_to_buffer): Remove. Move + switch-to-buffer to window.el. + (bury-buffer): Move to window.el. + (Vbuffer_list_update_hook): New variable. + + * lisp.h (other_buffer_safely): Add prototype in buffer.c + section. + + * window.h (resize_frame_windows): Move up in code. + (Fwindow_frame): Remove EXFUN. + (replace_buffer_in_all_windows): Remove prototype. + (replace_buffer_in_windows_safely): Add prototype. + + * window.c: Declare Qdelete_window static again. Move down + declaration of select_count. + (Fnext_window, Fprevious_window): Rewrite doc-strings. + (Fother_window): Move to window.el. + (window_loop): Remove DELETE_BUFFER_WINDOWS and UNSHOW_BUFFER + cases. Add REPLACE_BUFFER_IN_WINDOWS_SAFELY case. + (Fdelete_windows_on, Freplace_buffer_in_windows): Move to + window.el. + (replace_buffer_in_windows): Implement by calling + Qreplace_buffer_in_windows. + (replace_buffer_in_all_windows): Remove with some functionality + moved into replace_buffer_in_windows_safely. + (replace_buffer_in_windows_safely): New function. + (select_window_norecord, select_frame_norecord): Move in front + of run_window_configuration_change_hook. Remove now obsolete + declarations. + (Fset_window_buffer): Rewrite doc-string. Call + Qrecord_window_buffer. + (keys_of_window): Move binding for other-window to window.el. + +2011-06-11 Chong Yidong + + * dispextern.h (struct image): Replace data member, whose int_val + and ptr_val fields were not used by anything, with a single + lisp_val object. + + * image.c (Fimage_metadata, make_image, mark_image, tiff_load) + (gif_clear_image, gif_load, imagemagick_load_image) + (gs_clear_image, gs_load): Callers changed. + +2011-06-10 Paul Eggert + + * buffer.h: Include , for time_t. + Needed to build on FreeBSD 8.2. Problem reported by Herbert J. Skuhra. + + Fix minor problems found by static checking. + + * image.c (PixelGetMagickColor): Declare if ImageMagick headers don't. + + Make identifiers static if they are not used in other modules. + * data.c (Qcompiled_function, Qframe, Qvector): + * image.c (QimageMagick, Qsvg): + * minibuf.c (Qmetadata): + * window.c (resize_window_check, resize_root_window): Now static. + * window.h (resize_window_check, resize_root_window): Remove decls. + + * window.c (window_deletion_count, delete_deletable_window): + Remove; unused. + (window_body_lines): Now static. + (Fdelete_other_windows_internal): Mark vars as initialized. + Make sure 'resize_failed' is initialized. + (run_window_configuration_change_hook): Rename local to avoid shadowing. + (resize_window_apply): Remove unused local. + * window.h (delete_deletable_window): Remove decl. - * xdisp.c (handle_single_display_spec, next_overlay_string) - (get_overlay_strings_1, push_display_prop): Set up the bidi - iterator for displaying display or overlay strings. - (forward_to_next_line_start): Don't use the shortcut if - bidi-iterating. - (back_to_previous_visible_line_start): If handle_display_prop - pushed the iterator stack, restore the internal state of the bidi - iterator by calling bidi_pop_it same number of times. - (reseat_at_next_visible_line_start): If ON_NEWLINE_P is non-zero, - and we are bidi-iterating, don't decrement the iterator position; - instead, set the first_elt flag in the bidi iterator, to produce - the same effect. - (reseat_1): Remove redundant setting of string_from_display_prop_p. - (push_display_prop): xassert that we are iterating a buffer. + * image.c (gif_load, svg_load_image): Rename locals to avoid shadowing. + (imagemagick_load_image): Fix pointer signedness problem by changing + last arg from unsigned char * to char *. All uses changed. + Also, fix a local for similar reasons. + Remove unused locals. Remove locals to avoid shadowing. + (fn_rsvg_handle_free): Remove; unused. + (svg_load, svg_load_image): Fix pointer signedness problem. + (imagemagick_load_image): Don't use garbage pointer image_wand. - * bidi.c (bidi_cache_start_stack, bidi_push_it): Use IT_STACK_SIZE. + * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals. -2011-06-24 Eli Zaretskii +2011-06-10 Chong Yidong - * xdisp.c (push_it, pop_it): Save and restore the state of the - bidi iterator. Save and restore the bidi_p flag. - (pop_it): Iterate out of display property for string iteration as - well. - (iterate_out_of_display_property): Support iteration over strings. - (handle_single_display_spec): Set up it->bidi_it for iteration - over a display string, and call bidi_init_it. + * image.c (gif_load): Fix omitted cast error introduced by + 2011-06-06 change. - * dispextern.h (struct iterator_stack_entry): New member bidi_p. - (struct it): Member bidi_p is now a bit field 1 bit wide. +2011-06-10 Martin Rudalics -2011-06-23 Eli Zaretskii + * window.h (resize_proportionally, orig_total_lines) + (orig_top_line): Remove from window structure. + (set_window_height, set_window_width, change_window_heights) + (Fdelete_window): Remove prototypes. + (resize_frame_windows): Remove duplicate declaration. - * dispextern.h (bidi_push_it, bidi_pop_it): Add prototypes. +2011-06-10 Eli Zaretskii - * bidi.c (bidi_push_it, bidi_pop_it): New functions. - (bidi_initialize): Initialize the bidi cache start stack pointer. - (bidi_cache_ensure_space): New function, refactored from part of - bidi_cache_iterator_state. + * window.h (resize_frame_windows, resize_window_check) + (delete_deletable_window, resize_root_window) + (resize_frame_windows): Declare prototypes. + + * window.c (resize_window_apply): Make definition be "static" to + match the prototype. + +2011-06-10 Martin Rudalics + + * window.c: Remove declarations of Qwindow_size_fixed, + window_min_size_1, window_min_size_2, window_min_size, + size_window, window_fixed_size_p, enlarge_window, delete_window. + Remove static from declaration of Qdelete_window, it's + temporarily needed by Fbury_buffer. + (replace_window): Don't assign orig_top_line and + orig_total_lines. + (Fdelete_window, delete_window): Remove. Window deletion is + handled by window.el. + (window_loop): Remove DELETE_OTHER_WINDOWS case. Replace + Fdelete_window calls with calls to Qdelete_window. + (Fdelete_other_windows): Remove. Deleting other windows is + handled by window.el. + (window_fixed_size_p): Remove. Fixed-sizeness of windows is + handled in window.el. + (window_min_size_2, window_min_size_1, window_min_size): Remove. + Window minimum sizes are handled in window.el. + (shrink_windows, size_window, set_window_height) + (set_window_width, change_window_heights, window_height) + (window_width, CURBEG, CURSIZE, enlarge_window) + (adjust_window_trailing_edge, Fadjust_window_trailing_edge) + (Fenlarge_window, Fshrink_window): Remove. Window resizing is + handled in window.el. + (make_dummy_parent): Rename to make_parent_window and give it a + second argument horflag. + (make_window): Don't set resize_proportionally any more. + (Fsplit_window): Remove. Windows are split in window.el. + (save_restore_action, save_restore_orig_size) + (shrink_window_lowest_first, save_restore_orig_size): Remove. + Resize mini windows in window.el. + (grow_mini_window, shrink_mini_window): Implement by calling + Qresize_root_window_vertically, resize_window_check and + resize_window_apply. + (saved_window, Fset_window_configuration, save_window_save): Do + not handle orig_top_line, orig_total_lines, and + resize_proportionally. + (window_min_height, window_min_width): Move to window.el. + (keys_of_window): Move bindings for delete-other-windows, + split-window, delete-window and enlarge-window to window.el. + + * buffer.c: Temporarily extern Qdelete_window. + (Fbury_buffer): Temporarily call Qdelete_window instead of + Fdelete_window (Fbury_buffer will move to window.el soon). + + * frame.c (set_menu_bar_lines_1): Remove code handling + orig_top_line and orig_total_lines. + + * dispnew.c (adjust_frame_glyphs_initially): Don't use + set_window_height but set heights directly. + (change_frame_size_1): Use resize_frame_windows. + + * xdisp.c (init_xdisp): Don't use set_window_height but set + heights directly. + + * xfns.c (x_set_menu_bar_lines, x_set_tool_bar_lines): Use + resize_frame_windows instead of change_window_heights and run + run_window_configuration_change_hook. + + * w32fns.c (x_set_tool_bar_lines): Use resize_frame_windows + instead of change_window_heights and run + run_window_configuration_change_hook. + +2011-06-09 Martin Rudalics + + * window.c (replace_window): Rename second argument REPLACEMENT to + NEW. New third argument SETFLAG. Rewrite. + (delete_window, make_dummy_parent): Call replace_window with + third argument 1. + (window_list_1): Move down in code. + (run_window_configuration_change_hook): Move set_buffer part + before select_frame_norecord part in order to unwind correctly. + Rename count1 to count. + (recombine_windows, delete_deletable_window, resize_root_window) + (Fdelete_other_windows_internal) + (Frun_window_configuration_change_hook, make_parent_window) + (resize_window_check, resize_window_apply, Fresize_window_apply) + (resize_frame_windows, Fsplit_window_internal) + (Fdelete_window_internal, Fresize_mini_window_internal): New + functions. + (syms_of_window): New variables Vwindow_splits and Vwindow_nest. + +2011-06-08 Martin Rudalics + + * window.h (window): Add some new members to window structure - + normal_lines, normal_cols, new_total, new_normal, clone_number, + splits, nest, prev_buffers, next_buffers. + (WINDOW_TOTAL_SIZE): Move here from window.c. + (MIN_SAFE_WINDOW_WIDTH, MIN_SAFE_WINDOW_HEIGHT): Define here. + + * window.c (Fwindow_height, Fwindow_width, Fwindow_full_width_p): + Remove. + (make_dummy_parent): Set new members of windows structure. + (make_window): Move down in code. Handle new members of window + structure. + (Fwindow_clone_number, Fwindow_splits, Fset_window_splits) + (Fwindow_nest, Fset_window_nest, Fwindow_new_total) + (Fwindow_normal_size, Fwindow_new_normal, Fwindow_prev_buffers) + (Fset_window_prev_buffers, Fwindow_next_buffers) + (Fset_window_next_buffers, Fset_window_clone_number): New + functions. + (Fwindow_hscroll, Fwindow_at, Fwindow_point, Fwindow_start) + (Fwindow_end, Fwindow_line_height, Fset_window_dedicated_p): + Doc-string fixes. + (Fwindow_parameters, Fwindow_parameter, Fset_window_parameter): + Argument WINDOW can be now internal window too. + (Fwindow_use_time): Move up in code. + (Fget_buffer_window): Rename argument FRAME to ALL-FRAMES. + Rewrite doc-string. + (Fset_window_configuration, saved_window) + (Fcurrent_window_configuration, save_window_save): Handle new + members of window structure. + (WINDOW_TOTAL_SIZE, MIN_SAFE_WINDOW_WIDTH) + (MIN_SAFE_WINDOW_HEIGHT): Move to window.h. + (syms_of_window): New Lisp objects Qrecord_window_buffer, + Qwindow_deletable_p, Qdelete_window, Qreplace_buffer_in_windows, + Qget_mru_window, Qresize_root_window, + Qresize_root_window_vertically, Qsafe, Qabove, Qbelow, + Qauto_buffer_name; staticpro them. + +2011-06-07 Martin Rudalics + + * window.c (Fwindow_total_size, Fwindow_left_column) + (Fwindow_top_line, window_body_lines, Fwindow_body_size) + (Fwindow_list_1): New functions. + (window_box_text_cols): Replace with window_body_cols. + (Fwindow_width, Fscroll_left, Fscroll_right): Use + window_body_cols instead of window_box_text_cols. + (delete_window, Fset_window_configuration): Call + delete_all_subwindows with window as argument. + (delete_all_subwindows): Take a window as argument and not a + structure. Rewrite. + (window_loop): Remove handling of GET_LRU_WINDOW and + GET_LARGEST_WINDOW. + (Fget_lru_window, Fget_largest_window): Move to window.el. + + * window.h: Extern window_body_cols instead of + window_box_text_cols. delete_all_subwindows now takes a + Lisp_Object as argument. + + * indent.c (compute_motion, Fcompute_motion): Use + window_body_cols instead of window_box_text_cols. + + * frame.c (delete_frame): Call delete_all_subwindows with root + window as argument. + +2011-06-07 Daniel Colascione + + * fns.c (Fputhash): Document return value. + +2011-06-06 Chong Yidong + + * image.c (gif_load): Implement gif89a spec "no disposal" method. + +2011-06-06 Paul Eggert + + Cons<->int and similar integer overflow fixes (Bug#8794). + + Check for overflow when converting integer to cons and back. + * charset.c (Fdefine_charset_internal, Fdecode_char): + Use cons_to_unsigned to catch overflow. + (Fencode_char): Use INTEGER_TO_CONS. + * composite.h (LGLYPH_CODE): Use cons_to_unsigned. + (LGLYPH_SET_CODE): Use INTEGER_TO_CONS. + * data.c (long_to_cons, cons_to_long): Remove. + (cons_to_unsigned, cons_to_signed): New functions. + These signal an error for invalid or out-of-range values. + * dired.c (Ffile_attributes): Use INTEGER_TO_CONS. + * fileio.c (Fset_visited_file_modtime): Use CONS_TO_INTEGER. + * font.c (Ffont_variation_glyphs): + * fontset.c (Finternal_char_font): Use INTEGER_TO_CONS. + * lisp.h: Include . + (INTEGER_TO_CONS, CONS_TO_INTEGER): New macros. + (cons_to_signed, cons_to_unsigned): New decls. + (long_to_cons, cons_to_long): Remove decls. + * undo.c (record_first_change): Use INTEGER_TO_CONS. + (Fprimitive_undo): Use CONS_TO_INTEGER. + * xfns.c (Fx_window_property): Likewise. + * xselect.c: Include . + (x_own_selection, selection_data_to_lisp_data): + Use INTEGER_TO_CONS. + (x_handle_selection_request, x_handle_selection_clear) + (x_get_foreign_selection, Fx_disown_selection_internal) + (Fx_get_atom_name, x_send_client_event): Use CONS_TO_INTEGER. + (lisp_data_to_selection_data): Use cons_to_unsigned. + (x_fill_property_data): Use cons_to_signed. + Report values out of range. + + Check for buffer and string overflow more precisely. + * buffer.h (BUF_BYTES_MAX): New macro. + * lisp.h (STRING_BYTES_MAX): New macro. + * alloc.c (Fmake_string): + * character.c (string_escape_byte8): + * coding.c (coding_alloc_by_realloc): + * doprnt.c (doprnt): + * editfns.c (Fformat): + * eval.c (verror): + Use STRING_BYTES_MAX, not MOST_POSITIVE_FIXNUM, + since they may not be the same number. + * editfns.c (Finsert_char): + * fileio.c (Finsert_file_contents): + Likewise for BUF_BYTES_MAX. + + * image.c: Use ptrdiff_t, not int, for sizes. + (slurp_file): Switch from int to ptrdiff_t. + All uses changed. + (slurp_file): Check that file size fits in both size_t (for + malloc) and ptrdiff_t (for sanity and safety). -2011-06-18 Eli Zaretskii + * fileio.c (Fverify_visited_file_modtime): Avoid time overflow + if b->modtime has its maximal value. - * xdisp.c (tool_bar_lines_needed, redisplay_tool_bar) - (display_menu_bar): Force left-to-right direction. Add a FIXME - comment for making that be controlled by a user option. + * dired.c (Ffile_attributes): Don't assume EMACS_INT has >32 bits. - * bidi.c (bidi_move_to_visually_next): GCPRO the Lisp string we - are iterating. + Don't assume time_t can fit into int. + * buffer.h (struct buffer.modtime): Now time_t, not int. + * fileio.c (Fvisited_file_modtime): No need for time_t cast now. + * undo.c (Fprimitive_undo): Use time_t, not int, for time_t value. - * term.c (produce_glyphs): Add IT_GLYPHLESS to the values of - it->what accepted by the xassert. Fixes a gratuitous crash in an - Emacs built with -DXASSERTS. + Minor fixes for signed vs unsigned integers. + * character.h (MAYBE_UNIFY_CHAR): + * charset.c (maybe_unify_char): + * keyboard.c (read_char, reorder_modifiers): + XINT -> XFASTINT, since the integer must be nonnegative. + * ftfont.c (ftfont_spec_pattern): + * keymap.c (access_keymap, silly_event_symbol_error): + XUINT -> XFASTINT, since the integer must be nonnegative. + (Fsingle_key_description, preferred_sequence_p): XUINT -> XINT, + since it makes no difference and we prefer signed. + * keyboard.c (record_char): Use XUINT when all the neighbors do. + (access_keymap): NATNUMP -> INTEGERP, since the integer must be + nonnegative. - * .gdbinit (xvectype, xvector, xcompiled, xchartable, xboolvector) - (xpr, xfont, xbacktrace): Use "header.size" when accessing vectors - and vector-like objects. +2011-06-06 Stefan Monnier - * xdisp.c (face_before_or_after_it_pos): Support bidi iteration. - (next_element_from_c_string): Handle the case of the first string - character that is not the first one in the visual order. - (get_visually_first_element): New function, refactored from common - parts of next_element_from_buffer, next_element_from_string, and - next_element_from_c_string. + * window.h (Fwindow_frame): Declare. -2011-06-16 Eli Zaretskii +2011-06-06 Paul Eggert - * xdisp.c (init_iterator): Don't initialize it->bidi_p for strings - here. - (reseat_to_string): Initialize it->bidi_p for strings here. - (next_element_from_string, next_element_from_c_string) - (next_element_from_buffer): Add xassert's for correspondence - between IT's object being iterated and it->bidi_it.string - structure. + * alloc.c: Simplify handling of large-request failures (Bug#8800). + (SPARE_MEMORY): Always define. + (LARGE_REQUEST): Remove. + (memory_full): Use SPARE_MEMORY rather than LARGE_REQUEST. - * bidi.c (bidi_level_of_next_char): Fix the logic for looking up - the sentinel state in the cache. +2011-06-06 Martin Rudalics -2011-06-13 Eli Zaretskii + * lisp.h: Move EXFUNS for Fframe_root_window, + Fframe_first_window and Fset_frame_selected_window to window.h. - * xdisp.c (compute_display_string_pos) - (compute_display_string_end, reseat_to_string): Don't assume - it->bidi_it.string.s always points to string.lstring's data. + * window.h: Move EXFUNS for Fframe_root_window, + Fframe_first_window and Fset_frame_selected_window here from + lisp.h. - * bidi.c (bidi_fetch_char, bidi_paragraph_init) - (bidi_resolve_explicit_1, bidi_resolve_explicit) - (bidi_resolve_weak, bidi_level_of_next_char): Don't assume - string.s always points to string.lstring's data. + * frame.c (Fwindow_frame, Fframe_first_window) + (Fframe_root_window, Fframe_selected_window) + (Fset_frame_selected_window): Move to window.c. + (Factive_minibuffer_window): Move to minibuf.c. + (Fother_visible_frames_p): New function. -2011-06-11 Eli Zaretskii + * minibuf.c (Factive_minibuffer_window): Move here from frame.c. - * xdisp.c (set_iterator_to_next): Advance string position - correctly when padding it with blanks. + * window.c (decode_window, decode_any_window): Move up in code. + (Fwindowp, Fwindow_live_p): Rewrite doc-strings. + (inhibit_frame_unsplittable): Remove unused variable. + (Fwindow_buffer): Move up and rewrite doc-string. + (Fwindow_parent, Fwindow_vchild, Fwindow_hchild, Fwindow_next) + (Fwindow_prev): New functions. + (Fwindow_frame): Move here from frame.c. Accept any window as + argument. + (Fframe_root_window, Fframe_first_window) + (Fframe_selected_window): Move here from frame.c. Accept frame + or arbitrary window as argument. Update doc-strings. + (Fminibuffer_window): Move up in code. + (Fwindow_minibuffer_p): Move up in code and simplify. + (Fset_frame_selected_window): Move here from frame.c. + Marginal rewrite. + (Fselected_window, select_window, Fselect_window): Move up in + code. Minor doc-string fixes. -2011-06-11 Eli Zaretskii +2011-06-06 Paul Eggert - * xdisp.c (next_element_from_buffer): Improve commentary for when - the iterator is before prev_stop. - (init_iterator): Initialize bidi_p from the default value of - bidi-display-reordering, not from buffer-local value. Use the - buffer-local value only if initializing for buffer iteration. - (handle_invisible_prop): Support invisible properties on strings - that are being bidi-reordered. - (reseat_to_string): Enable bidi-related code. - (set_iterator_to_next): Support bidi reordering of C strings and - Lisp strings. - (next_element_from_string): Support bidi reordering of Lisp - strings. - (handle_stop_backwards): Support Lisp strings as well. - (display_mode_line, display_mode_element): Temporarily force L2R - paragraph direction. - (display_string): Support display of R2L glyph rows. Use - IT_STRING_CHARPOS when displaying from a Lisp string. + * alloc.c (memory_full) [SYSTEM_MALLOC]: Port to MacOS (Bug#8800). + Do not assume that spare memory exists; that assumption is valid + only if SYSTEM_MALLOC. + (LARGE_REQUEST): New macro, so that the issue of large requests + is separated from the issue of spare memory. -2011-06-10 Eli Zaretskii +2011-06-05 Andreas Schwab - * xdisp.c (Fcurrent_bidi_paragraph_direction): Initialize - itb.string.lstring. - (compute_display_string_pos, compute_display_string_end): - Fix calculation of the object to scan. Fixes an error when using - arrow keys. - (next_element_from_buffer): Don't abort when IT_CHARPOS is before - base_level_stop; instead, set base_level_stop to BEGV. Fixes - crashes in vertical-motion. + * editfns.c (Fformat): Correctly handle zero flag with hexadecimal + format. (Bug#8806) -2011-06-09 Eli Zaretskii + * gtkutil.c (xg_get_default_scrollbar_width): Avoid warning. - * xdisp.c (compute_display_string_pos): First arg is now struct - `text_pos *'; all callers changed. Support display properties on - Lisp strings. - (compute_display_string_end): Support display properties on Lisp - strings. - (init_iterator, reseat_1, reseat_to_string): Initialize the - string.bufpos member to 0 (zero, for compatibility with IT_CHARPOS - when iterating on a string not from display properties). + * xfns.c (x_set_scroll_bar_default_width): Move declarations + before statements. - * bidi.c (bidi_fetch_char): Support strings with display - properties. +2011-06-05 Jan Djärv - * dispextern.h (struct bidi_string_data): New member bufpos. - (compute_display_string_pos): Update prototype. + * gtkutil.c (xg_get_default_scrollbar_width): New function. -2011-06-09 Eli Zaretskii + * gtkutil.h: Declare xg_get_default_scrollbar_width. - * bidi.c (bidi_level_of_next_char): Allow the sentinel "position" - to pass the test for valid cached positions. + * xfns.c (x_set_scroll_bar_default_width): If USE_GTK, get + min width by calling x_set_scroll_bar_default_width (Bug#8505). - * xdisp.c (init_iterator): Call bidi_init_it only of a valid - buffer position was specified. Initialize paragraph_embedding to - L2R. - (reseat_to_string): Initialize the bidi iterator (for now ifdef'ed - out). - (display_string): If we need to ignore text properties of - LISP_STRING, set IT->stop_charpos to IT->end_charpos. (The - original value of -1 will not work with bidi.) +2011-06-05 Juanma Barranquero - * dispextern.h (struct bidi_string_data): New member lstring. + * xdisp.c (single_display_spec_intangible_p): Remove declaration. -2011-06-09 Eli Zaretskii +2011-06-04 Chong Yidong - * xdisp.c (Fcurrent_bidi_paragraph_direction): Initialize - itb.string.s to NULL (avoids a crash in bidi_paragraph_init). + * xselect.c (x_clipboard_manager_save): Remove redundant arg. + (x_clipboard_manager_save): Add return value. + (x_clipboard_manager_error_1, x_clipboard_manager_error_2): + New error handlers. + (x_clipboard_manager_save_frame, x_clipboard_manager_save_all): + Obey Vx_select_enable_clipboard_manager. Catch errors in + x_clipboard_manager_save (Bug#8779). + (Vx_select_enable_clipboard_manager): New variable. + (x_get_foreign_selection): Reduce scope of x_catch_errors (Bug#8790). -2011-06-08 Eli Zaretskii +2011-06-04 Dan Nicolaescu - * bidi.c (bidi_paragraph_info): Delete unused struct. - (bidi_cache_idx, bidi_cache_last_idx): Declare EMACS_INT. - (bidi_cache_start): New variable. - (bidi_cache_reset): Reset bidi_cache_idx to bidi_cache_start, not - to zero. - (bidi_cache_fetch_state, bidi_cache_search) - (bidi_cache_find_level_change, bidi_cache_iterator_state) - (bidi_cache_find, bidi_peek_at_next_level) - (bidi_level_of_next_char, bidi_find_other_level_edge) - (bidi_move_to_visually_next): Compare cache index with - bidi_cache_start rather than with zero. - (bidi_fetch_char): Accept new argument STRING; all callers - changed. Support iteration over a string. - (bidi_paragraph_init, bidi_resolve_explicit_1) - (bidi_resolve_explicit, bidi_resolve_weak) - (bidi_level_of_next_char, bidi_move_to_visually_next): Support - iteration over a string. - (bidi_set_sor_type, bidi_resolve_explicit_1) - (bidi_resolve_explicit, bidi_type_of_next_char): ignore_bn_limit - can now be zero (for strings); special values 0 and -1 were - changed to -1 and -2, respectively. - (bidi_char_at_pos): New function. - (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak): - Call it instead of FETCH_MULTIBYTE_CHAR. - (bidi_move_to_visually_next): Abort if charpos or bytepos were not - initialized to valid values. - (bidi_init_it): Don't initialize charpos and bytepos with invalid - values. + * emacs.c (main): Warn when starting a GTK emacs in daemon mode. - * xdisp.c (compute_display_string_pos) - (compute_display_string_end): Accept additional argument STRING. - (init_iterator, reseat_1): Initialize bidi_it->string.s to NULL. - (reseat_to_string): Initialize bidi_it->string.s and - bidi_it->string.schars. +2011-06-04 YAMAMOTO Mitsuharu - * dispextern.h (struct bidi_string_data): New structure. - (struct bidi_it): New member `string'. Make flag members be 1-bit - fields, and put them last in the struct. - (compute_display_string_pos, compute_display_string_end): Update - prototypes. + * fringe.c (update_window_fringes): Don't update overlay arrow bitmap + in the current matrix if keep_current_p is non-zero. 2011-06-04 Eli Zaretskii - * bidi.c (bidi_level_of_next_char): clen should be EMACS_NT, not int. + * bidi.c (bidi_level_of_next_char): Fix last change. 2011-06-03 Eli Zaretskii - * bidi.c (bidi_fetch_char_advance): Remove unused and - unimplemented function. + Support bidi reordering of text covered by display properties. -2011-05-28 Eli Zaretskii + * bidi.c (bidi_copy_it): Use offsetof instead of emulating it. + (bidi_fetch_char, bidi_fetch_char_advance): New functions. + (bidi_cache_search, bidi_cache_iterator_state) + (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak) + (bidi_level_of_next_char, bidi_move_to_visually_next): + Support character positions inside a run of characters covered by a + display string. + (bidi_paragraph_init, bidi_resolve_explicit_1) + (bidi_level_of_next_char): Call bidi_fetch_char and + bidi_fetch_char_advance instead of FETCH_CHAR and + FETCH_CHAR_ADVANCE. + (bidi_init_it): Initialize new members. + (LRE_CHAR, RLE_CHAR, PDF_CHAR, LRO_CHAR, RLO_CHAR): Remove macro + definitions. + (bidi_explicit_dir_char): Lookup character type in bidi_type_table, + instead of using explicit *_CHAR codes. + (bidi_resolve_explicit, bidi_resolve_weak): + Use FETCH_MULTIBYTE_CHAR instead of FETCH_CHAR, as reordering of + bidirectional text is supported only in multibyte buffers. + (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use + it to initialize the frame_window_p member of struct bidi_it. + (bidi_cache_iterator_state, bidi_resolve_explicit_1) + (bidi_resolve_explicit, bidi_resolve_weak) + (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if + bidi_it->nchars is non-positive. + (bidi_level_of_next_char): Don't try to lookup the cache for the + next/previous character if nothing is cached there yet, or if we + were just reseat()'ed to a new position. * xdisp.c (set_cursor_from_row): Set start and stop points according to the row's direction when priming the loop that looks @@ -311,22 +2647,14 @@ (single_display_spec_intangible_p): Function deleted. (display_prop_intangible_p): Reimplement to call handle_display_spec instead of single_display_spec_intangible_p. - Accept 3 additional arguments needed by handle_display_spec. This - fixes incorrect cursor motion across display property with complex + Accept 3 additional arguments needed by handle_display_spec. + This fixes incorrect cursor motion across display property with complex values: lists, `(when COND...)' forms, etc. (single_display_spec_string_p): Support property values that are lists with the argument STRING its top-level element. (display_prop_string_p): Fix the condition for processing a property that is a list to be consistent with handle_display_spec. - - * keyboard.c (adjust_point_for_property): Adjust the call to - display_prop_intangible_p to its new signature. - - * dispextern.h (display_prop_intangible_p): Adjust prototype. - -2011-05-21 Eli Zaretskii - - * xdisp.c (handle_display_spec): New function, refactored from the + (handle_display_spec): New function, refactored from the last portion of handle_display_prop. (compute_display_string_pos): Accept additional argument FRAME_WINDOW_P. Call handle_display_spec to determine whether the @@ -337,71 +2665,589 @@ the display property will replace the characters it covers. (Fcurrent_bidi_paragraph_direction): Initialize the nchars and frame_window_p members of struct bidi_it. + (compute_display_string_pos, compute_display_string_end): + New functions. + (push_it): Accept second argument POSITION, where pop_it should + jump to continue iteration. + (reseat_1): Initialize bidi_it.disp_pos. - * bidi.c (bidi_fetch_char): Accept additional argument - FRAME_WINDOW_P and pass it to compute_display_string_pos. All - callers changed. - (bidi_init_it): Accept additional argument FRAME_WINDOW_P and use - it to initialize the frame_window_p member of struct bidi_it. + * keyboard.c (adjust_point_for_property): Adjust the call to + display_prop_intangible_p to its new signature. * dispextern.h (struct bidi_it): New member frame_window_p. - (bidi_init_it, compute_display_string_pos): Update prototypes. + (bidi_init_it): Update prototypes. + (display_prop_intangible_p): Update prototype. + (compute_display_string_pos, compute_display_string_end): + Declare prototypes. + (struct bidi_it): New members nchars and disp_pos. ch_len is now + EMACS_INT. -2011-05-14 Eli Zaretskii +2011-06-02 Paul Eggert + + Malloc failure behavior now depends on size of allocation. + * alloc.c (buffer_memory_full, memory_full): New arg NBYTES. + * lisp.h: Change signatures accordingly. + * alloc.c, buffer.c, editfns.c, menu.c, minibuf.c, xterm.c: + All callers changed. (Bug#8762) + + * gnutls.c: Use Emacs's memory allocators. + Without this change, the gnutls library would invoke malloc etc. + directly, which causes problems on non-SYNC_INPUT hosts, and which + runs afoul of improving memory_full behavior. (Bug#8761) + (fn_gnutls_global_set_mem_functions): New macro or function pointer. + (emacs_gnutls_global_init): Use it to specify xmalloc, xrealloc, + xfree instead of the default malloc, realloc, free. + (Fgnutls_boot): No need to check for memory allocation failure, + since xmalloc does that for us. + + Remove arbitrary limit of 2**31 entries in hash tables. (Bug#8771) + * category.c (hash_get_category_set): + * ccl.c (ccl_driver): + * charset.c (Fdefine_charset_internal): + * charset.h (struct charset.hash_index): + * composite.c (get_composition_id, gstring_lookup_cache) + (composition_gstring_put_cache): + * composite.h (struct composition.hash_index): + * dispextern.h (struct image.hash): + * fns.c (next_almost_prime, larger_vector, cmpfn_eql) + (cmpfn_equal, cmpfn_user_defined, hashfn_eq, hashfn_eql) + (hashfn_equal, hashfn_user_defined, make_hash_table) + (maybe_resize_hash_table, hash_lookup, hash_put) + (hash_remove_from_table, hash_clear, sweep_weak_table, SXHASH_COMBINE) + (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector) + (Fsxhash, Fgethash, Fputhash, Fmaphash): + * image.c (make_image, search_image_cache, lookup_image) + (xpm_put_color_table_h): + * lisp.h (struct Lisp_Hash_Table): + * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): + * print.c (print): Use 'EMACS_UINT' and 'EMACS_INT' + for hashes and hash indexes, instead of 'unsigned' and 'int'. + * alloc.c (allocate_vectorlike): + Check for overflow in vector size calculations. + * ccl.c (ccl_driver): + Check for overflow when converting EMACS_INT to int. + * fns.c, image.c: Remove unnecessary static decls that would otherwise + need to be updated by these changes. + * fns.c (make_hash_table, maybe_resize_hash_table): + Check for integer overflow with large hash tables. + (make_hash_table, maybe_resize_hash_table, Fmake_hash_table): + Prefer the faster XFLOAT_DATA to XFLOATINT where either will do. + (SXHASH_REDUCE): New macro. + (sxhash_string, sxhash_list, sxhash_vector, sxhash_bool_vector): + Use it instead of discarding useful hash info with large hash values. + (sxhash_float): New function. + (sxhash): Use it. No more need for "& INTMASK" due to above changes. + * lisp.h (FIXNUM_BITS): New macro, useful for SXHASH_REDUCE etc. + (MOST_NEGATIVE_FIXNUM, MOST_POSITIVE_FIXNUM, INTMASK): + Rewrite to use FIXNUM_BITS, as this simplifies things. + (next_almost_prime, larger_vector, sxhash, hash_lookup, hash_put): + Adjust signatures to match updated version of code. + (consing_since_gc): Now EMACS_INT, since a single hash table can + use more than INT_MAX bytes. + +2011-06-01 Dan Nicolaescu + + Make it possible to build with GCC-4.6+ -O2 -flto. + + * emacs.c (__malloc_initialize_hook): Mark as EXTERNALLY_VISIBLE. + +2011-06-01 Stefan Monnier + + * minibuf.c (get_minibuffer, read_minibuf_unwind): + Call minibuffer-inactive-mode. + +2011-05-31 Juanma Barranquero + + * makefile.w32-in ($(BLD)/data.$(O), $(BLD)/editfns.$(O)): + Update dependencies. - * xdisp.c (compute_display_string_pos): Non-trivial implementation. - (compute_display_string_end): New function. - (push_it): Accept second argument POSITION, where pop_it should - jump to continue iteration. +2011-05-31 Dan Nicolaescu - * dispextern.h (compute_display_string_end): Declare prototype. + * data.c (init_data): Remove code for UTS, this system is not + supported anymore. - * bidi.c (bidi_resolve_explicit_1): Use ZV for disp_pos. - (bidi_fetch_char): Implement support for runs of characters - covered by display strings. +2011-05-31 Dan Nicolaescu - * bidi.c (bidi_fetch_char): Accept also character position - corresponding to BYTEPOS. DISP_POS is now a character position, - not a byte position. All callers changed. - (bidi_cache_iterator_state, bidi_resolve_explicit_1) - (bidi_resolve_explicit, bidi_resolve_weak) - (bidi_level_of_next_char, bidi_move_to_visually_next): Abort if - bidi_it->nchars is non-positive. - (bidi_level_of_next_char): Don't try to lookup the cache for the - next/previous character if nothing is cached there yet, or if we - were just reseat()'ed to a new position. - (bidi_paragraph_init, bidi_resolve_explicit_1) - (bidi_level_of_next_char): Fix arguments in the calls to - bidi_fetch_char. + Don't force ./temacs to start in terminal mode. -2011-05-10 Eli Zaretskii + * frame.c (make_initial_frame): Initialize faces in all cases, not + only when CANNOT_DUMP is defined. + * dispnew.c (init_display): Remove CANNOT_DUMP condition. - * xdisp.c (compute_display_string_pos): New function. - (reseat_1): Initialize bidi_it.disp_pos. +2011-05-31 Dan Nicolaescu - * bidi.c (bidi_copy_it): Use offsetof. - (bidi_fetch_char, bidi_fetch_char_advance): New functions. - (bidi_cache_search, bidi_cache_iterator_state) - (bidi_paragraph_init, bidi_resolve_explicit, bidi_resolve_weak) - (bidi_level_of_next_char, bidi_move_to_visually_next): Support - character positions inside a run of characters covered by a - display string. - (bidi_paragraph_init, bidi_resolve_explicit_1) - (bidi_level_of_next_char): Call bidi_fetch_char and - bidi_fetch_char_advance instead of FETCH_CHAR and - FETCH_CHAR_ADVANCE. - (bidi_init_it): Initialize new members. - (LRE_CHAR, RLE_CHAR, PDF_CHAR, LRO_CHAR, RLO_CHAR): Remove macro - definitions. - (bidi_explicit_dir_char): Lookup character type in bidi_type_table, - instead of using explicit *_CHAR codes. - (bidi_resolve_explicit, bidi_resolve_weak): Use - FETCH_MULTIBYTE_CHAR instead of FETCH_CHAR, as reordering of - bidirectional text is supported only in multibyte buffers. + * dispnew.c (add_window_display_history): Use const for the string + pointer. Remove declaration, not needed. + +2011-05-31 Paul Eggert + + Use 'inline', not 'INLINE'. + + * alloc.c, fontset.c (INLINE): Remove. + * alloc.c, bidi.c, charset.c, coding.c, dispnew.c, fns.c, image.c: + * intervals.c, keyboard.c, process.c, syntax.c, textprop.c, w32term.c: + * xdisp.c, xfaces.c, xterm.c: Replace all uses of INLINE with inline. + * gmalloc.c (register_heapinfo): Use inline unconditionally. + * lisp.h (LISP_MAKE_RVALUE): Use inline, not __inline__. + +2011-05-31 Dan Nicolaescu + + Make it possible to run ./temacs. + + * callproc.c (set_initial_environment): Remove CANNOT_DUMP code, + syms_of_callproc does the same thing. Remove test for + "initialized", do it in the caller. + * emacs.c (main): Avoid calling set_initial_environment when dumping. + +2011-05-31 Stefan Monnier + + * minibuf.c (Finternal_complete_buffer): Return `category' metadata. + (read_minibuf): Use get_minibuffer. + (syms_of_minibuf): Use DEFSYM. + (Qmetadata): New var. + * data.c (Qbuffer): Don't make it static. + (syms_of_data): Use DEFSYM. + +2011-05-31 Paul Eggert + + * ccl.c (CCL_CODE_RANGE): Allow negative numbers. (Bug#8751) + (CCL_CODE_MIN): New macro. + +2011-05-30 Paul Eggert - * dispextern.h (struct bidi_it): New members nchars and disp_pos. - ch_len is now EMACS_INT. - (compute_display_string_pos): Declare prototype. + * alloc.c (lisp_align_malloc): Omit unnecessary val==NULL tests. + + * eval.c (Qdebug): Now static. + * lisp.h (Qdebug): Remove decl. This reverts a part of the + 2011-04-26T11:26:05Z!dan.colascione@gmail.com that inadvertently undid part of + 2011-04-14T06:48:41Z!eggert@cs.ucla.edu. + +2011-05-29 Chong Yidong + + * image.c: Various fixes to ImageMagick code comments. + (Fimagemagick_types): Doc fix. + +2011-05-29 Paul Eggert + + Minor fixes prompted by GCC 4.6.0 warnings. + + * xselect.c (converted_selections, conversion_fail_tag): Now static. + + * emacs.c [HAVE_X_WINDOWS]: Include "xterm.h". + (x_clipboard_manager_save_all): Move extern decl to ... + * xterm.h: ... here, so that it can be checked for consistency. + +2011-05-29 Chong Yidong + + * xselect.c (x_clipboard_manager_save_frame) + (x_clipboard_manager_save_all): New functions. + (Fx_clipboard_manager_save): Lisp function deleted. + + * emacs.c (Fkill_emacs): Call x_clipboard_manager_save_all. + * frame.c (delete_frame): Call x_clipboard_manager_save_frame. + + * xterm.h: Update prototype. + +2011-05-28 William Xu + + * nsterm.m (ns_term_shutdown): Synchronize user defaults before + exiting (Bug#8239). + +2011-05-28 Jim Meyering + + Avoid a sign-extension bug in crypto_hash_function. + * fns.c (to_uchar): Define. + (crypto_hash_function): Use it to convert some newly-signed + variables to unsigned, to avoid sign-extension bugs. For example, + without this change, (md5 "truc") would evaluate to + 45723a2aff78ff4fff7fff1114760e62 rather than the expected + 45723a2af3788c4ff17f8d1114760e62. Reported by Antoine Levitt in + https://lists.gnu.org/archive/html/emacs-devel/2011-05/msg00883.html. + +2011-05-27 Paul Eggert + + Integer overflow fixes. + + * dbusbind.c: Serial number integer overflow fixes. + (CHECK_DBUS_SERIAL_GET_SERIAL): New macro. + (Fdbus_call_method_asynchronously, xd_read_message_1): Use a float + to hold a serial number that is too large for a fixnum. + (Fdbus_method_return_internal, Fdbus_method_error_internal): + Check for serial numbers out of range. Decode any serial number + that was so large that it became a float. (Bug#8722) + + * dbusbind.c: Use XFASTINT rather than XUINT, and check for nonneg. + (Fdbus_call_method, Fdbus_call_method_asynchronously): + Use XFASTINT rather than XUINT when numbers are nonnegative. + (xd_append_arg, Fdbus_method_return_internal): + (Fdbus_method_error_internal): Likewise. Also, for unsigned + arguments, check that Lisp number is nonnegative, rather than + silently wrapping negative numbers around. (Bug#8722) + (xd_read_message_1): Don't assume dbus_uint32_t can fit in int. + (Bug#8722) + + * data.c (arith_driver, Flsh): Avoid unnecessary casts to EMACS_UINT. + + * ccl.c (ccl_driver): Redo slightly to avoid the need for 'unsigned'. + + ccl: add integer overflow checks + * ccl.c (CCL_CODE_MAX, GET_CCL_RANGE, GET_CCL_CODE, GET_CCL_INT): + (IN_INT_RANGE): New macros. + (ccl_driver): Use them to check for integer overflow when + decoding a CCL program. Many of the new checks are whether XINT (x) + fits in int; it doesn't always, on 64-bit hosts. The new version + doesn't catch all possible integer overflows, but it's an + improvement. (Bug#8719) + + * alloc.c (make_event_array): Use XINT, not XUINT. + There's no need for unsigned here. + + * mem-limits.h (EXCEEDS_LISP_PTR) [!USE_LSB_TAG]: EMACS_UINT -> uintptr_t + This follows up to the 2011-05-06 change that substituted uintptr_t + for EMACS_INT. This case wasn't caught back then. + + Rework Fformat to avoid integer overflow issues. + * editfns.c: Include unconditionally, as it's everywhere + now (part of C89). Include . + (MAX_10_EXP, CONVERTED_BYTE_SIZE): Remove; no longer needed. + (pWIDE, pWIDElen, signed_wide, unsigned_wide): New defns. + (Fformat): Avoid the prepass trying to compute sizes; it was only + approximate and thus did not catch overflow reliably. Instead, walk + through the format just once, formatting and computing sizes as we go, + checking for integer overflow at every step, and allocating a larger + buffer as needed. Keep track separately whether the format is + multibyte. Keep only the most-recently calculated precision, rather + than them all. Record whether each argument has been converted to + string. Use EMACS_INT, not int, for byte and char and arg counts. + Support field widths and precisions larger than INT_MAX. Avoid + sprintf's undefined behavior with conversion specifications such as %#d + and %.0c. Fix bug with strchr succeeding on '\0' when looking for + flags. Fix bug with (format "%c" 256.0). Avoid integer overflow when + formatting out-of-range floating point numbers with int + formats. (Bug#8668) + + * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN. + + * data.c: Avoid integer truncation in expressions involving floats. + * data.c: Include . + (arith_driver): When there's an integer overflow in an expression + involving floating point, convert the integers to floating point + so that the resulting value does not suffer from catastrophic + integer truncation. For example, on a 64-bit host (* 4 + most-negative-fixnum 0.5) should yield about -4.6e+18, not zero. + Do not rely on undefined behavior after integer overflow. + + merge count_size_as_multibyte, parse_str_to_multibyte + * character.c, character.h (count_size_as_multibyte): + Rename from parse_str_to_multibyte; all uses changed. + Check for integer overflow. + * insdel.c, lisp.h (count_size_as_multibyte): Remove, + since it's now a duplicate of the other. This is more of + a character than a buffer op, so better that it's in character.c. + * fns.c, print.c: Adjust to above changes. + +2011-05-27 Stefan Monnier + + * xselect.c (x_convert_selection): Yet another int/Lisp_Object mixup. + +2011-05-27 Paul Eggert + + * xselect.c: Fix minor problems prompted by GCC 4.6.0 warnings. + (x_handle_selection_request, frame_for_x_selection): Remove unused vars. + (x_clipboard_manager_save): Now static. + (Fx_clipboard_manager_save): Rename local to avoid shadowing. + + * fns.c: Fix minor problems prompted by GCC 4.6.0 warnings. + (crypto_hash_function): Now static. + Fix pointer signedness problems. Avoid unnecessary initializations. + +2011-05-27 Chong Yidong + + * termhooks.h (Vselection_alist): Make it terminal-local. + + * terminal.c (create_terminal): Initialize it. + + * xselect.c: Support for clipboard managers. + (Vselection_alist): Move to termhooks.h as terminal-local var. + (LOCAL_SELECTION): New macro. + (x_atom_to_symbol): Handle x_display_info_for_display fail case. + (symbol_to_x_atom): Remove gratuitous arg. + (x_handle_selection_request, lisp_data_to_selection_data) + (x_get_foreign_selection, Fx_register_dnd_atom): Callers changed. + (x_own_selection, x_get_local_selection, x_convert_selection): + New arg, specifying work frame. Use terminal-local Vselection_alist. + (some_frame_on_display): Delete unused function. + (Fx_own_selection_internal, Fx_get_selection_internal) + (Fx_disown_selection_internal, Fx_selection_owner_p) + (Fx_selection_exists_p): New optional frame arg. + (frame_for_x_selection, Fx_clipboard_manager_save): New functions. + (x_handle_selection_clear): Don't treat other terminals with the + same keyboard specially. Use the terminal-local Vselection_alist. + (x_clear_frame_selections): Use Frun_hook_with_args. + + * xterm.c (x_term_init): Intern ATOM and CLIPBOARD_MANAGER atoms. + + * xterm.h: Add support for those atoms. + +2011-05-26 Chong Yidong + + * xselect.c: ICCCM-compliant handling of MULTIPLE targets. + (converted_selections, conversion_fail_tag): New global variables. + (x_selection_request_lisp_error): Free the above. + (x_get_local_selection): Remove unnecessary code. + (x_reply_selection_request): Args changed; handle arbitrary array + of converted selections stored in converted_selections. + Separate the XChangeProperty and SelectionNotify steps. + (x_handle_selection_request): Rewrite to handle MULTIPLE target. + (x_convert_selection): New function. + (x_handle_selection_event): Simplify. + (x_get_foreign_selection): Don't ignore incoming requests while + waiting for an answer; this will fail when we implement + SAVE_TARGETS, and seems unnecessary anyway. + (selection_data_to_lisp_data): Recognize ATOM_PAIR type. + (Vx_sent_selection_functions): Doc fix. + +2011-05-26 Leo Liu + + * editfns.c (Ftranspose_regions): Allow empty regions. (Bug#8699) + +2011-05-25 YAMAMOTO Mitsuharu + + * dispextern.h (struct glyph_row): New member fringe_bitmap_periodic_p. + + * dispnew.c (shift_glyph_matrix, scrolling_window): Mark scrolled row + for fringe update if it has periodic bitmap. + (row_equal_p): Also compare left_fringe_offset, right_fringe_offset, + and fringe_bitmap_periodic_p. + + * fringe.c (get_fringe_bitmap_data): New function. + (draw_fringe_bitmap_1, update_window_fringes): Use it. + (update_window_fringes): Record periodicity of fringe bitmap in glyph + row. Mark glyph row for fringe update if periodicity changed. + + * xdisp.c (try_window_reusing_current_matrix): Don't mark scrolled row + for fringe update unless it has periodic bitmap. + +2011-05-25 Kenichi Handa + + * xdisp.c (get_next_display_element): Set correct it->face_id for + a static composition. + +2011-05-24 Leo Liu + + * deps.mk (fns.o): + * makefile.w32-in ($(BLD)/fns.$(O)): Include sha1.h. + + * fns.c (crypto_hash_function, Fsha1): New function. + (Fmd5): Use crypto_hash_function. + (syms_of_fns): Add Ssha1. + +2011-05-22 Paul Eggert + + * gnutls.c: Remove unused macros. + (fn_gnutls_transport_set_lowat, fn_gnutls_transport_set_pull_function): + (fn_gnutls_transport_set_push_function) [!WINDOWSNT]: + Remove macros that are defined and never used. + Caught by gcc -Wunused-macros (GCC 4.6.0, Fedora 14). + +2011-05-22 Chong Yidong + + * xselect.c (syms_of_xselect): Remove unused symbol SAVE_TARGETS. + (Fx_get_selection_internal): Minor cleanup. + (Fx_own_selection_internal): Rename arguments for consistency with + select.el. + +2011-05-22 Paul Eggert + + * xselect.c (QSAVE_TARGETS): New static var, to fix build failure. + +2011-05-22 Chong Yidong + + * xselect.c (syms_of_xselect): Include character.h; use DEFSYM. + +2011-05-21 YAMAMOTO Mitsuharu + + * dispnew.c (scrolling_window): Don't exclude the case that the + last enabled row in the desired matrix touches the bottom boundary. + +2011-05-21 Glenn Morris + + * Makefile.in ($(etc)/DOC): Make second command line even shorter. + (SOME_MACHINE_OBJECTS): Replace FONT_OBJ by its maximal expansion, + and add some more files. + +2011-05-20 Eli Zaretskii + + * callproc.c (Fcall_process) [MSDOS]: Fix arguments to + report_file_error introduced by the change from 2011-05-07. + +2011-05-20 Paul Eggert + + * systime.h (Time): Define only if emacs is defined. + This is to allow ../lib-src/profile.c to be compiled on FreeBSD, + where the include path doesn't have X11/X.h by default. See + . + +2011-05-20 Kenichi Handa + + * composite.c (find_automatic_composition): Fix previous change. + +2011-05-20 Glenn Morris + + * lisp.mk: New file, split from Makefile.in. + * Makefile.in (lisp): Move to separate file, inserted by @lisp_frag@. + (shortlisp): Remove. + ($(etc)/DOC): Edit lisp.mk rather than using $shortlisp. + +2011-05-19 Glenn Morris + + * Makefile.in (MSDOS_SUPPORT_REAL, MSDOS_SUPPORT, NS_SUPPORT) + (REAL_MOUSE_SUPPORT, GPM_MOUSE_SUPPORT, MOUSE_SUPPORT, TOOLTIP_SUPPORT) + (BASE_WINDOW_SUPPORT, X_WINDOW_SUPPORT, WINDOW_SUPPORT): Remove. + (lisp): Set the order to that of loadup.el. + (shortlisp): Make it a copy of $lisp. + (SOME_MACHINE_LISP): Remove. + ($(etc)/DOC): Depend just on $lisp, not $SOME_MACHINE_LISP too. + Use just $shortlisp, not $SOME_MACHINE_LISP too. + +2011-05-18 Kenichi Handa + + * composite.c (CHAR_COMPOSABLE_P): Add more check for efficiency. + (BACKWARD_CHAR): Wrap the arg STOP by parenthesis. + (find_automatic_composition): Mostly rewrite for efficiency. + +2011-05-18 Juanma Barranquero + + * makefile.w32-in: Update dependencies. + +2011-05-18 Christoph Scholtes + + * menu.c: Include limits.h (fixes the MS-Windows build broken by + 2011-06-18T18:49:19Z!cyd@stupidchicken.com). + +2011-05-18 Paul Eggert + + Fix some integer overflow issues, such as string length overflow. + + * insdel.c (count_size_as_multibyte): Check for string overflow. + + * character.c (lisp_string_width): Check for string overflow. + Use EMACS_INT, not int, for string indexes and lengths; in + particular, 2nd arg is now EMACS_INT, not int. Do not crash if + the resulting string length overflows an EMACS_INT; instead, + report a string overflow if no precision given. When checking for + precision exhaustion, use a check that cannot possibly have + integer overflow. (Bug#8675) + * character.h (lisp_string_width): Adjust to new signature. + + * alloc.c (string_overflow): New function. + (Fmake_string): Use it. This doesn't change behavior, but saves + a few bytes and will simplify future changes. + * character.c (string_escape_byte8): Likewise. + * lisp.h (string_overflow): New decl. + + Fixups, following up to the user-interface timestamp change. + * nsterm.m (last_mouse_movement_time, ns_mouse_position): Use Time + for UI timestamps, instead of unsigned long. + * msdos.c (mouse_get_pos): Likewise. + * w32inevt.c (movement_time, w32_console_mouse_position): Likewise. + * w32gui.h (Time): Define by including "systime.h" rather than by + declaring it ourselves. (Bug#8664) + + * dispextern.h (struct image): Don't assume time_t <= unsigned long. + * image.c (clear_image_cache): Likewise. + + * term.c (term_mouse_position): Don't assume time_t wraparound. + + Be more systematic about user-interface timestamps. + Before, the code sometimes used 'Time', sometimes 'unsigned long', + and sometimes 'EMACS_UINT', to represent these timestamps. + This change causes it to use 'Time' uniformly, as that's what X uses. + This makes the code easier to follow, and makes it easier to catch + integer overflow bugs such as Bug#8664. + * frame.c (Fmouse_position, Fmouse_pixel_position): + Use Time, not unsigned long, for user-interface timestamps. + * keyboard.c (last_event_timestamp, kbd_buffer_get_event): Likewise. + (button_down_time, make_lispy_position, make_lispy_movement): Likewise. + * keyboard.h (last_event_timestamp): Likewise. + * menu.c (Fx_popup_menu) [!HAVE_X_WINDOWS]: Likewise. + * menu.h (xmenu_show): Likewise. + * term.c (term_mouse_position): Likewise. + * termhooks.h (struct input_event.timestamp): Likewise. + (struct terminal.mouse_position_hook): Likewise. + * xmenu.c (create_and_show_popup_menu, xmenu_show): Likewise. + * xterm.c (XTmouse_position, x_scroll_bar_report_motion): Likewise. + * systime.h (Time): New decl. Pull it in from if + HAVE_X_WINDOWS, otherwise define it as unsigned long, which is + what it was before. + * menu.h, termhooks.h: Include "systime.h", for Time. + + * keyboard.c (make_lispy_event): Fix problem in integer overflow. + Don't assume that the difference between two unsigned long values + can fit into an integer. At this point, we know button_down_time + <= event->timestamp, so the difference must be nonnegative, so + there's no need to cast the result if double-click-time is + nonnegative, as it should be; check that it's nonnegative, just in + case. This bug is triggered when events are more than 2**31 ms + apart (about 25 days). (Bug#8664) + + * xselect.c (last_event_timestamp): Remove duplicate decl. + (x_own_selection): Remove needless cast to unsigned long. + + * xmenu.c (set_frame_menubar): Use int, not EMACS_UINT, for indexes + that always fit in int. Use a sentinel instead of a counter, to + avoid a temp and to allay GCC's concerns about possible int overflow. + * frame.h (struct frame): Use int for menu_bar_items_used + instead of EMACS_INT, since it always fits in int. + + * menu.c (grow_menu_items): Check for int overflow. + + * xmenu.c (set_frame_menubar): Don't mishandle vectors with no nils. + + * xterm.c: Use EMACS_INT for Emacs modifiers, and int for X modifiers. + Before, the code was not consistent. These values cannot exceed + 2**31 - 1 so there's no need to make them unsigned. + (x_x_to_emacs_modifiers): Accept int and return EMACS_INT. + (x_emacs_to_x_modifiers): Accept EMACS_INT and return int. + (x_x_to_emacs_modifiers, x_emacs_to_x_modifiers): Reject non-integers + as modifiers. + * xterm.h (x_x_to_emacs_modifiers): Adjust to signature change. + + * lisp.h (XINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_INT. + (XUINT) [USE_LISP_UNION_TYPE]: Cast to EMACS_UINT. + Otherwise, GCC 4.6.0 warns about printf (pI, XINT (...)), + presumably because the widths might not match. + + * window.c (size_window): Avoid needless test at loop start. + +2011-05-18 Courtney Bane (tiny change) + + * term.c (Fresume_tty): Restore hooks before reinitializing (bug#8687). + +2011-05-12 Drew Adams + + * textprop.c (Fprevious_single_char_property_change): Doc fix (bug#8655). + +2011-05-12 YAMAMOTO Mitsuharu + + * w32term.c (w32_draw_fringe_bitmap): Rename local vars `left' and + `width' to `bar_area_x' and `bar_area_width', respectively. + (x_scroll_run): Take account of fringe background extension. + + * xterm.c (x_draw_fringe_bitmap) [USE_TOOLKIT_SCROLL_BARS]: + Rename local vars `left' and `width' to `bar_area_x' and + `bar_area_width', respectively. + (x_scroll_run) [USE_TOOLKIT_SCROLL_BARS]: Take account of fringe + background extension. + +2011-05-10 Jim Meyering + + * xdisp.c (x_intersect_rectangles): Fix typo "the the -> the". + +2011-05-10 Juanma Barranquero + + * image.c (Finit_image_library): Return t for built-in image types, + like pbm and xbm. (Bug#8640) 2011-05-09 Andreas Schwab @@ -413,11 +3259,11 @@ (Fget_screen_color): New function. (syms_of_ntterm): Defsubr it. - * callproc.c (call_process_cleanup): Don't close and unlink the - temporary file if Fcall_process didn't create it in the first - place. - (Fcall_process): Don't create tempfile if stdout of the child - process will be redirected to a file specified with `:file'. + * callproc.c (call_process_cleanup) [MSDOS]: Don't close and + unlink the temporary file if Fcall_process didn't create it in the + first place. + (Fcall_process) [MSDOS]: Don't create tempfile if stdout of the + child process will be redirected to a file specified with `:file'. Don't try to re-open tempfile in that case, and set fd[0] to -1 as cue to call_process_cleanup not to close that handle. @@ -506,8 +3352,8 @@ * dbusbind.c: Do not use XPNTR on a value that may be an integer. Reported by Stefan Monnier in . - (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): Use - SYMBOLP-guarded XSYMBOL, not XPNTR. + (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): + Use SYMBOLP-guarded XSYMBOL, not XPNTR. * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t. (EMACS_UINTPTR): Likewise, with uintptr_t. @@ -693,8 +3539,8 @@ * callproc.c: Indentation fixup. * sysdep.c (wait_for_termination_1): Make static. - (wait_for_termination, interruptible_wait_for_termination): Move - after wait_for_termination_1. + (wait_for_termination, interruptible_wait_for_termination): + Move after wait_for_termination_1. 2011-05-01 Lars Magne Ingebrigtsen @@ -810,8 +3656,8 @@ (emacs_gnutls_write): Don't use uninitialized rtnval if nbyte <= 0. * lisp.h: Fix a problem with aliasing and vector headers. (Bug#8546) - GCC 4.6.0 optimizes based on type-based alias analysis. For - example, if b is of type struct buffer * and v of type struct + GCC 4.6.0 optimizes based on type-based alias analysis. + For example, if b is of type struct buffer * and v of type struct Lisp_Vector *, then gcc -O2 was incorrectly assuming that &b->size != &v->size, and therefore "v->size = 1; b->size = 2; return v->size;" must therefore return 1. This assumption is incorrect @@ -831,8 +3677,8 @@ (XSETPSEUDOVECTOR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR. (XSETSUBR): Rewrite in terms of XSETTYPED_PSEUDOVECTOR and XSIZE, since Lisp_Subr is a special case (no "next" field). - (ASIZE): Now uses header.size rather than size. All - previous uses of XVECTOR (foo)->size replaced to use this macro, + (ASIZE): Now uses header.size rather than size. + All previous uses of XVECTOR (foo)->size replaced to use this macro, to avoid the hassle of writing XVECTOR (foo)->header.size. (struct vectorlike_header): New type. (TYPED_PSEUDOVECTORP): New macro, also specifying the C type of the @@ -881,7 +3727,7 @@ Break out the floating-point parsing into a new function string_to_number, so that Fstring_to_number parses floating point numbers consistently with the Lisp reader. - (digit_to_number): Moved here from data.c. Make it static inline. + (digit_to_number): Move here from data.c. Make it static inline. (E_CHAR, EXP_INT): Remove, replacing with ... (E_EXP): New macro, to solve the "1.0e+" problem mentioned below. (string_to_number): New function, replacing isfloat_string. @@ -1042,9 +3888,9 @@ :verify-hostname-error, :verify-error, and :verify-flags parameters of `gnutls-boot' and documented those parameters in the docstring. Start callback support. - (emacs_gnutls_handshake): Add Woe32 support. Retry handshake - unless a fatal error occured. Call gnutls_alert_send_appropriate - on error. Return error code. + (emacs_gnutls_handshake): Add Woe32 support. Retry handshake + unless a fatal error occurred. Call gnutls_alert_send_appropriate + on error. Return error code. (emacs_gnutls_write): Call emacs_gnutls_handle_error. (emacs_gnutls_read): Likewise. (Fgnutls_boot): Return handshake error code. @@ -1118,8 +3964,8 @@ Fix doprnt so it could be used again safely in `verror'. (Bug#8435) * doprnt.c: Include limits.h. (SIZE_MAX): New macro. - (doprnt): Return a size_t value. 2nd arg is now size_t. Many - local variables are now size_t instead of int or unsigned. + (doprnt): Return a size_t value. 2nd arg is now size_t. + Many local variables are now size_t instead of int or unsigned. Improve overflow protection. Support `l' modifier for integer conversions. Support %l conversion. Don't assume an EMACS_INT argument for integer conversions and for %c. @@ -1320,8 +4166,8 @@ * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT. - * textprop.c (verify_interval_modification, interval_of): Declare - arguments EMACS_INT. + * textprop.c (verify_interval_modification, interval_of): + Declare arguments EMACS_INT. * intervals.c (adjust_intervals_for_insertion): Declare arguments EMACS_INT. @@ -1572,8 +4418,8 @@ (free_realized_fontset) #if-0 the body, which does nothing. (face_suitable_for_char_p): #if-0, as it's never called. * fontset.h (face_suitable_for_char_p): Remove decl. - * xfaces.c (face_at_string_position): Use - FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P, + * xfaces.c (face_at_string_position): + Use FACE_SUITABLE_FOR_ASCII_CHAR_P, not FACE_SUITABLE_FOR_CHAR_P, since 0 is always ASCII. * fns.c (weak_hash_tables): Now static. @@ -1682,8 +4528,8 @@ (last_point_position_window): Remove decls. * keyboard.c: Make these variables static. - * coding.h (coding, code_convert_region, encode_coding_gap): Remove - decls. + * coding.h (coding, code_convert_region, encode_coding_gap): + Remove decls. * coding.c (Vsjis_coding_system, Vbig5_coding_system): (iso_code_class, detect_coding, code_convert_region): Now static. (encode_coding_gap): Remove; unused. @@ -1714,7 +4560,7 @@ exported only to the debugger. * atimer.c (alarm_signal_handler, run_all_atimers): Now static. - * atimer.h (run_all_atimers): Removed; not exported. + * atimer.h (run_all_atimers): Remove; not exported. font.c: Make copy_font_spec and merge_font_spec ordinary C functions. * font.c (copy_font_spec): Rename from Fcopy_font_spec, since it @@ -1969,8 +4815,8 @@ 2011-04-09 Chong Yidong - * ftfont.c (get_adstyle_property, ftfont_pattern_entity): Use - unsigned char, to match FcChar8 type definition. + * ftfont.c (get_adstyle_property, ftfont_pattern_entity): + Use unsigned char, to match FcChar8 type definition. * xterm.c (handle_one_xevent): * xmenu.c (create_and_show_popup_menu): @@ -2043,8 +4889,8 @@ 2011-04-06 Chong Yidong - * process.c (Flist_processes): Removed to Lisp. - (list_processes_1): Deleted. + * process.c (Flist_processes): Remove to Lisp. + (list_processes_1): Delete. 2011-04-06 Eli Zaretskii @@ -2302,8 +5148,8 @@ * callint.c (Fcall_interactively): Preserve lexical-binding mode for interactive spec. - * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN): New - byte-codes. + * bytecode.c (Bstack_ref, Bstack_set, Bstack_set2, BdiscardN): + New byte-codes. (exec_byte_code): New function extracted from Fbyte_code to handle new calling convention for byte-code-functions. Add new byte-codes. @@ -2318,8 +5164,8 @@ 2011-03-31 Eli Zaretskii * xdisp.c (SCROLL_LIMIT): New macro. - (try_scrolling): Use it when setting scroll_limit. Limit - scrolling to 100 screen lines. + (try_scrolling): Use it when setting scroll_limit. + Limit scrolling to 100 screen lines. (redisplay_window): Even when falling back on "recentering", position point in the window according to scroll-conservatively, scroll-margin, and scroll-*-aggressively variables. (Bug#6671)