Fix doprnt so it could be used safely in `verror'. (Bug#8435)
[bpt/emacs.git] / src / ChangeLog
index fb97a49..831fb6a 100644 (file)
@@ -1,4 +1,306 @@
- 2011-04-14  Paul Eggert  <eggert@cs.ucla.edu>
+2011-04-23  Eli Zaretskii  <eliz@gnu.org>
+
+       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.
+       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.
+
+       * lisp.h (doprnt): Restore prototype.
+
+       * makefile.w32-in ($(BLD)/callint.$(O)): Depend on
+       $(SRC)/character.h.
+
+       * Makefile.in (base_obj): Add back doprnt.o.
+
+       * deps.mk (doprnt.o): Add back prerequisites.
+       (callint.o): Depend on character.h.
+
+       * eval.c (internal_lisp_condition_case): Include the handler
+       representation in the error message.
+       (verror): Call doprnt instead of vsnprintf.  Fix an off-by-one bug
+       when breaking from the loop.
+
+       * xdisp.c (vmessage): Call doprnt instead of vsnprintf.
+
+       * callint.c (Fcall_interactively): When displaying error message
+       about invalid control letter, pass the character's codepoint, not
+       a pointer to its multibyte form.  Improve display of the character
+       in octal and display also its hex code.
+
+       * character.c (char_string): Use %x to display the (unsigned)
+       codepoint of an invalid character, to avoid displaying a bogus
+       negative value.
+
+       * font.c (check_otf_features): Pass SDATA of SYMBOL_NAME to
+       `error', not SYMBOL_NAME itself.
+
+       * coding.c (Fencode_sjis_char, Fencode_big5_char): Use %c for
+       character arguments to `error'.
+
+       * charset.c (check_iso_charset_parameter): Fix incorrect argument
+       to `error' in error message about FINAL_CHAR argument.  Make sure
+       FINAL_CHAR is a character, and use %c when it is passed as
+       argument to `error'.
+
+2011-04-23  Eli Zaretskii  <eliz@gnu.org>
+
+       * s/ms-w32.h (localtime): Redirect to sys_localtime.
+
+       * w32.c: Include <time.h>.
+       (sys_localtime): New function.
+
+2011-04-23  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xdisp.c (init_xdisp): Initialize echo_area_window (Bug#6451).
+
+       * buffer.c (syms_of_buffer): Doc fix (Bug#6902).
+
+2011-04-23  Samuel Thibault  <sthibault@debian.org>  (tiny change)
+
+       * sysdep.c (wait_for_termination): On GNU Hurd, kill returns -1 on
+       zombies (Bug#8467).
+
+2011-04-19  Eli Zaretskii  <eliz@gnu.org>
+
+       * syntax.h (SETUP_SYNTAX_TABLE_FOR_OBJECT): Fix setting of
+       gl_state.e_property when gl_state.object is Qt.
+
+       * insdel.c (make_gap_larger): Remove limitation of buffer size
+       to <= INT_MAX.
+
+2011-04-18  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xdisp.c (lookup_glyphless_char_display)
+       (produce_glyphless_glyph): Handle cons cell entry in
+       glyphless-char-display.
+       (Vglyphless_char_display): Document it.
+
+       * term.c (produce_glyphless_glyph): Handle cons cell entry in
+       glyphless-char-display.
+
+2011-04-17  Chong Yidong  <cyd@stupidchicken.com>
+
+       * xdisp.c (get_next_display_element): Remove unnecessary ifdefs.
+
+       * termhooks.h (FRAME_WINDOW_P): Remove duplicated definitions.
+
+       * dispextern.h (FACE_SUITABLE_FOR_ASCII_CHAR_P): Add missing
+       definition for no-X builds.
+
+2011-04-16  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Static checks with GCC 4.6.0 and non-default toolkits.
+
+       * s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF): Protoize decl.
+
+       * process.c (keyboard_bit_set): Define only if SIGIO.
+       (send_process_trap): Mark it with NO_RETURN if it doesn't return.
+       (send_process): Repair possible setjmp clobbering.
+
+       * s/usg5-4-common.h (SETUP_SLAVE_PTY): Don't pass extra arg to 'fatal'.
+
+       * eval.c: Include <stdio.h>, for vsnprintf on non-GNU/Linux hosts.
+
+       * data.c (arith_error): Mark with NO_RETURN if it doesn't return.
+
+       * alloc.c (bytes_used_when_full, SPARE_MEMORY, BYTES_USED):
+       Define only if needed.
+
+       * sysdep.c (_FILE_OFFSET_BITS): Make this hack even uglier
+       by pacifying GCC about it.  Maybe it's time to retire it?
+       * xfaces.c (USG, __TIMEVAL__): Likewise.
+
+       * dispextern.h (struct redisplay_interface): Rename param
+       to avoid shadowing.
+       * termhooks.h (struct terminal): Likewise.
+       * xterm.c (xembed_send_message): Likewise.
+
+       * insdel.c (make_gap_smaller): Define only if
+       USE_MMAP_FOR_BUFFERS || REL_ALLOC || DOUG_LEA_MALLOC.
+
+       * keyboard.c (read_char): Make a var volatile so longjmp won't clobber
+       it.
+
+       * emacs.c (MAX_HEAP_BSS_DIFF, my_edata): Move to where they're used,
+       so that we aren't warned about unused symbols.
+
+       * xfns.c (Fx_file_dialog): Rename local to avoid shadowing.
+
+       * xdisp.c (x_produce_glyphs): Mark var as initialized (Bug#8512).
+
+       * xfns.c (x_real_positions): Mark locals as initialized.
+
+       * xmenu.c (xmenu_show): Don't use uninitialized vars.
+
+       * xterm.c: Fix problems found by static analysis with other toolkits.
+       (toolkit_scroll_bar_interaction): Define and use only if USE_X_TOOLKIT.
+       (x_dispatch_event): Declare static if USE_GTK, and
+       define if USE_GTK || USE_X_TOOLKIT.
+       (SET_SAVED_BUTTON_EVENT): Define only if USE_X_TOOLKIT || USE_GTK.
+       * xterm.h (x_dispatch_event): Extern only if USE_X_TOOLKIT.
+       * xterm.c, xterm.h (x_mouse_leave): Bring this function back, but only if
+       defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK.
+
+       * xmenu.c (menu_help_callback): Pointer type fixes.
+       Use const pointers when pointing at readonly data.  Avoid pointer
+       signedness clashes.
+       (FALSE): Remove unused macro.
+       (update_frame_menubar): Remove unused decl.
+
+       * xfns.c (Fx_hide_tip): Move locals to avoid shadowing.
+
+       * menu.c (push_submenu_start, push_submenu_end): Do not define unless
+       USE_X_TOOLKIT || USE_GTK || HAVE_NS || defined HAVE_NTGUI.
+       (single_menu_item): Rename local to avoid shadowing.
+
+       * keyboard.c (make_lispy_event): Remove unused local var.
+
+       * frame.c, frame.h (x_get_resource_string): Bring this back, but
+       only if HAVE_X_WINDOWS && !USE_X_TOOLKIT.
+
+       * bitmaps: Change bitmaps from unsigned char back to the X11
+       compatible char.  Avoid the old compiler warnings about
+       out-of-range initializers by using, for example, '\xab' rather
+       than 0xab.
+
+       * xgselect.c (xgselect_initialize): Check vs interface
+       even if ! (defined (USE_GTK) || defined (HAVE_GCONF)).
+
+       * xmenu.c (xmenu_show): Rename parm to avoid shadowing.
+
+       * xterm.c (x_create_toolkit_scroll_bar): Use const * for pointers
+       to read-only memory.
+
+       * fns.c (vector): Remove; this old hack is no longer needed.
+
+       * xsmfns.c (create_client_leader_window): Rename shadowing arg.
+       Remove unused var.
+       (gdk_x11_set_sm_client_id) [!USE_GTK]: Don't define.
+
+       * xrdb.c (x_load_resources): Omit unused local.
+
+       * xfns.c (free_frame_menubar, atof): Remove duplicate decls.
+       (x_window): Rename locals to avoid shadowing.
+       (USG): Use the kludged USG macro, to pacify gcc.
+
+       * xterm.c (x_alloc_nearest_color_for_widget): Remove; unused.
+       (x_term_init): Remove local to avoid shadowing.
+
+       * xfns.c, xterm.c (_XEditResCheckMessages): Protoize decl.
+
+       * xdisp.c, dispextern.h (set_vertical_scroll_bar): Now extern if
+       USE_TOOLKIT_SCROLL_BARS && !USE_GTK, as xterm.c needs it then.
+
+2011-04-16  Eli Zaretskii  <eliz@gnu.org>
+
+       * gnutls.c (Fgnutls_boot): Don't pass Lisp_Object to `error'.
+
+       Fix regex.c, syntax.c and friends for buffers > 2GB.
+       * syntax.h (struct gl_state_s): Declare character position members
+       EMACS_INT.
+
+       * syntax.c (update_syntax_table): Declare 2nd argument EMACS_INT.
+
+       * textprop.c (verify_interval_modification, interval_of): Declare
+       arguments EMACS_INT.
+
+       * intervals.c (adjust_intervals_for_insertion): Declare arguments
+       EMACS_INT.
+
+       * intervals.h (CHECK_TOTAL_LENGTH): Cast to EMACS_INT, not `int'.
+
+       * indent.c (Fvertical_motion): Local variable it_start is now
+       EMACS_INT.
+
+       * regex.c (re_match, re_match_2, re_match_2_internal)
+       (bcmp_translate, regcomp, regexec, print_double_string)
+       (group_in_compile_stack, re_search, re_search_2, regex_compile)
+       (re_compile_pattern, re_exec): Declare arguments and local
+       variables `size_t' and `ssize_t' and return values `regoff_t', as
+       appropriate.
+       (POP_FAILURE_REG_OR_COUNT) <pfreg>: Declare `long'.
+       (CHECK_INFINITE_LOOP) <failure>: Declare `ssize_t'.
+       <compile_stack_type>: `size' and `avail' are now `size_t'.
+
+       * regex.h <regoff_t>: Use ssize_t, not int.
+       (re_search, re_search_2, re_match, re_match_2): Arguments that
+       specify buffer/string position and length are now ssize_t and
+       size_t.  Return type is regoff_t.
+
+2011-04-16  Ben Key  <bkey76@gmail.com>
+
+       * nsfont.m: Fixed bugs in ns_get_family and
+       ns_descriptor_to_entity that were caused by using free to
+       deallocate memory blocks that were allocated by xmalloc (via
+       xstrdup).  This caused Emacs to crash when compiled with
+       XMALLOC_OVERRUN_CHECK defined (when Emacs was configured with
+       --enable-checking=xmallocoverrun).  xfree is now used to
+       deallocate these memory blocks.
+
+2011-04-15  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c (emacs_read): Remove unnecessary check vs MAX_RW_COUNT.
+
+       emacs_write: Accept and return EMACS_INT for sizes.
+       See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00514.html
+       et seq.
+       * gnutls.c, gnutls.h (emacs_gnutls_read, emacs_gnutls_write):
+       Accept and return EMACS_INT.
+       (emacs_gnutls_write): Return the number of bytes written on
+       partial writes.
+       * sysdep.c, lisp.h (emacs_read, emacs_write): Likewise.
+       (emacs_read, emacs_write): Remove check for negative size, as the
+       Emacs source code has been audited now.
+       * sysdep.c (MAX_RW_COUNT): New macro, to work around kernel bugs.
+       (emacs_read, emacs_write): Use it.
+       * process.c (send_process): Adjust to the new signatures of
+       emacs_write and emacs_gnutls_write.  Do not attempt to store
+       a byte offset into an 'int'; it might overflow.
+       See http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00483.html
+
+       * sound.c: Don't assume sizes fit in 'int'.
+       (struct sound_device.period_size, alsa_period_size):
+       Return EMACS_INT, not int.
+       (struct sound_device.write, vox_write, alsa_write):
+       Accept EMACS_INT, not int.
+       (wav_play, au_play): Use EMACS_INT to store sizes and to
+       record read return values.
+
+2011-04-15  Ben Key  <bkey76@gmail.com>
+
+       * keyboard.c (Qundefined): Don't declare static since it is used
+       in nsfns.m.
+       * xfaces.c (Qbold, Qexpanded, Qitalic, Qcondensed): Don't declare
+       static since they are used in nsfont.m.
+
+2011-04-15  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * process.c (Qprocessp): Don't declare static.
+       * lisp.h (Qprocessp): Declare again.
+
+2011-04-15  Juanma Barranquero  <lekktu@gmail.com>
+
+       * font.c (Qopentype): Don't make static (used from w32uniscribe.c).
+
+2011-04-14  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Improve C-level modularity by making more things 'static'.
+
+       Don't publish debugger-only interfaces to other modules.
+       * lisp.h (safe_debug_print, debug_output_compilation_hack):
+       (verify_bytepos, count_markers): Move decls to the only modules
+       that need them.
+       * region-cache.h (pp_cache): Likewise.
+       * window.h (check_all_windows): Likewise.
+       * marker.c, print.c, region-cache.c, window.c: Decls moved here.
+
+       * sysdep.c (croak): Now static, if
+       defined TIOCNOTTY || defined USG5 || defined CYGWIN.
+       * syssignal.h (croak): Declare only if not static.
 
        * alloc.c (refill_memory_reserve): Now static if
        !defined REL_ALLOC || defined SYSTEM_MALLOC.
        (get_tty_terminal): Now static.
        (term_mouse_moveto): Do not define if HAVE_WINDOW_SYSTEM.
        * termhooks.h (term_mouse_moveto): Do not declare if
-       HAVE_WINDOW_SYSTEMM.
+       HAVE_WINDOW_SYSTEM.
        * dispextern.h (tty_set_terminal_modes, tty_reset_terminal_modes):
        (tty_turn_off_highlight, get_tty_terminal): Remove decls.
 
        Now static.
        * intervals.h (merge_interval_right, delete_interval): Remove decls.
 
-2011-04-13  Paul Eggert  <eggert@cs.ucla.edu>
-
        * insdel.c: Make symbols static if they're not exported.
        However, leave prepare_to_modify_buffer alone.  It's never
        called from outside this function, but that appears to be a bug.
        (xic_create_fontsetname): Declare only if HAVE_X_WINDOWS &&
        USE_X_TOOLKIT.
 
-2011-04-12  Paul Eggert  <eggert@cs.ucla.edu>
-
        * ftxfont.c: Make symbols static if they're not exported.
        (ftxfont_driver): Export only if !defined HAVE_XFT && def8ined
        HAVE_FREETYPE.
        * lisp.h (circular_list_error, FOREACH): Remove; unused.
        * data.c (circular_list_error): Remove.
 
-2011-04-11  Paul Eggert  <eggert@cs.ucla.edu>
-
        * commands.h (last_point_position, last_point_position_buffer):
        (last_point_position_window): Remove decls.
        * keyboard.c: Make these variables static.
        (mark_backtrace): Define only if BYTE_MARK_STACK.
        * xdisp.c (message_enable_multibyte): Now static.
 
-       Declare Lisp_Object Q* variables to be 'static' if not exproted.
+       Declare Lisp_Object Q* variables to be 'static' if not exported.
        This makes it easier for human readers (and static analyzers)
        to see whether these variables are used from other modules.
        * alloc.c, buffer.c, bytecode.c, callint.c, casetab.c, category.c:
        to see whether these functions can be called from other modules.
        DEFUN now defines a static function.  To make the function external
        so that it can be used in other C modules, use the new macro DEFUE.
-       * lisp.h (DEFINE_FUNC): New macro, with the old contents of DEFUN.
-       (DEFUN): Rewrite in terms of DEFINE_FUNC.  It now generates a
-       static function definition.  Use DEFUE if you want an extern one.
-       (DEFUE, INFUN): New macros.
-       (Funibyte_char_to_multibyte, Fsyntax_table_p, Finit_image_library):
+       * lisp.h (Funibyte_char_to_multibyte, Fsyntax_table_p):
+       (Finit_image_library):
        (Feval_region, Fbacktrace, Ffetch_bytecode, Fswitch_to_buffer):
        (Ffile_executable_p, Fmake_symbolic_link, Fcommand_execute):
        (Fget_process, Fdocumentation_property, Fbyte_code, Ffile_attributes):
        (Fset_window_margins, Fset_window_vscroll): New forward static decls.
        * window.h (Fset_window_vscroll, Fset_window_margins): Remove decls.
 
-2011-04-10  Paul Eggert  <eggert@cs.ucla.edu>
-
        * editfns.c (Fformat): Remove unreachable code.
 
+2011-04-14  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * fileio.c (Finsert_file_contents): Fix typo in 2005-05-13
+       change.  (Bug#8496)
+
+2011-04-13  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (handle_invisible_prop): Don't call bidi_paragraph_init
+       when at ZV.  (Bug#8487)
+
+2011-04-12  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * charset.c (Fclear_charset_maps): Use xfree instead of free.
+       (Bug#8437)
+       * keyboard.c (parse_tool_bar_item): Likewise.
+       * sound.c (sound_cleanup, alsa_close): Likewise.
+       * termcap.c (tgetent): Likewise.
+       * xfns.c (x_default_font_parameter): Likewise.
+       * xsettings.c (read_and_apply_settings): Likewise.
+
+       * alloc.c (overrun_check_malloc, overrun_check_realloc)
+       (overrun_check_free): Protoize.
+
+2011-04-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * sysdep.c (emacs_read, emacs_write): Check for negative sizes
+       since callers should never pass a negative size.
+       Change the signature to match that of plain 'read' and 'write'; see
+       <http://lists.gnu.org/archive/html/emacs-devel/2011-04/msg00397.html>.
+       * lisp.h: Update prototypes of emacs_write and emacs_read.
+
+2011-04-11  Eli Zaretskii  <eliz@gnu.org>
+
+       * xdisp.c (redisplay_window): Don't try to determine the character
+       position of the scroll margin if the window start point w->startp
+       is outside the buffer's accessible region.  (Bug#8468)
+
+2011-04-10  Eli Zaretskii  <eliz@gnu.org>
+
+       Fix write-region and its subroutines for buffers > 2GB.
+       * fileio.c (a_write, e_write): Modify declaration of arguments and
+       local variables to support buffers larger than 2GB.
+       (Fcopy_file): Use EMACS_INT for return value of emacs_read.
+
+       * sysdep.c (emacs_write, emacs_read): Use ssize_t for last
+       argument, local variables, and return value.
+
+       * lisp.h: Update prototypes of emacs_write and emacs_read.
+
+       * sound.c (vox_write): Use ssize_t for return value of emacs_write.
+
 2011-04-10  Paul Eggert  <eggert@cs.ucla.edu>
 
+       * xdisp.c (vmessage): Use memchr, not strnlen, which some hosts lack.
+
        Fix more problems found by GCC 4.6.0's static checks.
 
        * xdisp.c (vmessage): Use a better test for character truncation.
        * xselect.c (x_decline_selection_request)
        (x_reply_selection_request): Avoid type-punned deref of X events.
 
-2011-04-09  Eli Zaretskii  <eliz@emacstest.gnu.org>
+2011-04-09  Eli Zaretskii  <eliz@gnu.org>
 
        Fix some uses of `int' instead of EMACS_INT.
        * search.c (string_match_1, fast_string_match)