* bidi.c: Integer signedness and overflow fixes.
[bpt/emacs.git] / src / ChangeLog
index 8e20856..a6cafed 100644 (file)
@@ -1,3 +1,148 @@
+2011-07-07  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * bidi.c: Integer signedness and overflow fixes.
+       (bidi_cache_idx, bidi_cache_last_idx, bidi_cache_fetch_state)
+       (bidi_cache_search, bidi_cache_find_level_change)
+       (bidi_cache_iterator_state, bidi_cache_find, bidi_find_other_level_edge)
+       (bidi_dump_cached_states):
+       Don't arbitrarily limit cache indexes to int; use ptrdiff_t instead.
+       (bidi_cache_size): Use ptrdiff_t rather than size_t, as we prefer
+       signed integers.
+       (elsz): Make it a (signed) constant.
+       (bidi_cache_iterator_state): Check for size-calculation overflow.
+
+       * 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.
+
+2011-07-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       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  <jan.h.d@swipnet.se>
+
+       * 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  <eggert@cs.ucla.edu>
+
+       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  <monnier@iro.umontreal.ca>
+
+       * 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  <eggert@cs.ucla.edu>
 
        * fileio.c (barf_or_query_if_file_exists): Use S_ISDIR.
        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
+       Remove calls to g_settings_bind.  Connect something_changedCB to
        "changed".
 
        * xgselect.c: Add defined (HAVE_GSETTINGS).
        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.
+       (x_wm_set_size_hint): Remove call to emacs_fixed_set_min_size.
+       Fix indentation.
 
 2011-06-26  Eli Zaretskii  <eliz@gnu.org>
 
        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)
+       formats.  (Bug#8668)
 
        * lisp.h (FIXNUM_OVERFLOW_P): Work even if arg is a NaN.
 
        :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.