1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-17 00:30:37 -08:00
Commit graph

101020 commits

Author SHA1 Message Date
Paul Eggert
e6966cd635 * fns.c: Don't overflow int when computing a list length.
(Fsafe_length): Return a float if the value is not representable
as a fixnum.  This shouldn't happen except in contrived situations.
Use same QUIT_COUNT_HEURISTIC as Flength now does.
2011-06-14 15:32:12 -07:00
Paul Eggert
00c604f263 * fns.c (Flength): Don't overflow int when computing a list length.
Use EMACS_INT, not int, to avoid unwanted truncation on 64-bit hosts.
Check for QUIT every 1024 entries rather than every other entry;
that's faster and is responsive enough.  Report an error instead of
overflowing an integer.
2011-06-14 15:01:32 -07:00
Paul Eggert
dd0b0efbab * 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.
2011-06-14 14:30:16 -07:00
Paul Eggert
86fe5cfe4d * 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?
2011-06-14 13:57:33 -07:00
Paul Eggert
80e88859ec * bytecode.c (exec_byte_code): Use ptrdiff_t, not int, for vector length. 2011-06-14 13:12:13 -07:00
Paul Eggert
4a2f0ad6c1 * eval.c, doprnt.c (SIZE_MAX): Remove; inttypes.h defines this now. 2011-06-14 13:09:52 -07:00
Paul Eggert
e8f2a94471 Merge from trunk. 2011-06-14 11:58:22 -07:00
Paul Eggert
f66c7cf8f7 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.
2011-06-14 11:57:19 -07:00
Paul Eggert
a1759b7624 * callint.c (Fcall_interactively): Don't use index var as event count. 2011-06-13 22:51:17 -07:00
Chong Yidong
c5dd5a516c Print theme summaries in *Custom Themes* buffer.
* lisp/cus-theme.el (describe-theme-1): Use custom-theme-p.
(custom-theme-summary): New function.
(customize-themes): Use it.

* etc/themes/light-blue-theme.el:
* etc/themes/misterioso-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/tango-theme.el:
* etc/themes/tsdh-dark-theme.el:
* etc/themes/tsdh-light-theme.el:
* etc/themes/wheatgrass-theme.el:
* etc/themes/wombat-theme.el: Tweak summaries for better listability.
2011-06-14 01:06:26 -04:00
Chong Yidong
b9958282dc * etc/themes/dichromacy-theme.el: New theme. 2011-06-14 01:00:35 -04:00
Paul Eggert
d96be9fc87 * vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
* mem-limits.h (SIZE): Remove; no longer used.
2011-06-13 21:49:24 -07:00
Paul Eggert
3c3a05dfb7 Merge from trunk. 2011-06-13 17:58:31 -07:00
Glenn Morris
d647b7c44e cus-dep fix for build failure first occurring with 2011-06-13T08:21:09Z!rudalics@gmx.at
The symptom was `make custom-dep' failing with "Unknown terminal type".
This is caused by `display-buffer' trying to pop-up a frame in batch mode.
I think this cus-dep change may be just papering over the immediate
manifestation of the underlying problem.

* lisp/cus-dep.el (custom-make-dependencies): Use up command-line-args-left.
2011-06-13 17:42:40 -04:00
Paul Eggert
a690a978ec * xterm.c (x_alloc_nearest_color_1): Go back to original algorithm. 2011-06-13 09:08:46 -07:00
Martin Rudalics
357f93d245 Make help and view-mode work with new buffer display facilities.
* help.el (help-window): Remove variable.
(help-window-point-marker, temp-buffer-max-height)
(temp-buffer-resize-mode, help-window-select): Rewrite doc-strings.
(help-print-return-message): Don't set help-window.
(resize-temp-buffer-window): Rewrite cod eand doc-string.
(help-window-setup-finish): Remove.
(help-window-display-message, help-window-setup)
(with-help-window): Major rewrite based on new
display-buffer-window variable.

* help-mode.el (help-mode-finish): Remove help-window related
code.

* view.el (view-exits-all-viewing-windows): Remove reference to
view-return-to-alist in doc-string.
(view-return-to-alist): Make obsolete.
(view-buffer): Call pop-to-buffer-same-window and remove
undo-window code.
(view-buffer-other-window): Call pop-to-buffer-other-window and
simplify code.  Ignore second argument.
(view-buffer-other-frame): Call pop-to-buffer-other-frame and
simplify code.  Ignore second argument.
(view-return-to-alist-update): Make obsolete.
(view-mode-enter): Rename second argument to QUIT-RESTORE.
Rewrite using quit-restore window parameters.
(view-mode-exit): Rename second argument to EXIT-ONLY.  Rewrite
using quit-restore-window.
(View-exit, View-exit-and-edit, View-leave, View-quit)
(View-quit-all, View-kill-and-leave): Call view-mode-exit with
appropriate arguments.
(view-end-message): Use quit-restore window parameter.
2011-06-13 15:14:42 +02:00
Martin Rudalics
9481c00201 Install new buffer display functions and variables.
* window.el (display-buffer-function): Rewrite doc-string.
(display-buffer-window, display-buffer-alist): New variables.
(display-buffer-split-specifiers)
(display-buffer-side-specifiers)
(display-buffer-macro-specifiers): New constants.
(display-buffer-even-window-sizes, display-buffer-set-height)
(display-buffer-set-width, display-buffer-select-window)
(display-buffer-in-window, display-buffer-reuse-window)
(display-buffer-split-window-1, display-buffer-split-window)
(display-buffer-split-atom-window, display-buffer-pop-up-window)
(display-buffer-pop-up-frame, display-buffer-pop-up-side-window)
(display-buffer-in-side-window, normalize-buffer-to-display)
(display-buffer-normalize-specifiers-1)
(display-buffer-normalize-specifiers-2)
(display-buffer-normalize-specifiers, display-buffer-frame): New
functions.
(display-buffer): Major rewrite.
(display-buffer-other-window, display-buffer-other-frame)
(pop-to-buffer, switch-to-buffer-other-window)
(switch-to-buffer-other-frame): Rewrite.
(display-buffer-same-window, display-buffer-same-frame)
(display-buffer-same-frame-other-window)
(pop-to-buffer-same-window, pop-to-buffer-same-frame)
(pop-to-buffer-other-window)
(pop-to-buffer-same-frame-other-window)
(pop-to-buffer-other-frame, switch-to-buffer-same-frame)
(switch-to-buffer-other-window-same-frame): New functions.
(same-window-p, special-display-p): Rewrite disabling warnings.
Make obsolete.
(pop-up-frames, display-buffer-reuse-frames, pop-up-windows)
(display-buffer-mark-dedicated): Initialize to symbol 'unset.
Make obsolete
(same-window-buffer-names, same-window-regexps)
(special-display-frame-alist, special-display-popup-frame)
(special-display-function, special-display-buffer-names)
(special-display-regexps, pop-up-frame-alist)
(pop-up-frame-function, split-window-preferred-function)
(split-height-threshold, split-width-threshold)
(even-window-heights): Make obsolete.
2011-06-13 10:21:09 +02:00
Paul Eggert
01103c441a Merge from trunk. 2011-06-13 01:00:15 -07:00
Paul Eggert
5efd304be9 * xterm.c (x_alloc_nearest_color_1): Use a more-precise algorithm
for nearest color, one that neither overflows nor relies on unsigned
arithmetic.
2011-06-13 00:53:14 -07:00
Paul Eggert
578c21e6cb 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.
2011-06-12 23:53:31 -07:00
Paul Eggert
96f53c6c3d * 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.
2011-06-12 23:49:00 -07:00
Paul Eggert
83c77d31ac * dired.c (Ffile_attributes): Don't use 32-bit hack on 64-bit hosts. 2011-06-12 23:34:04 -07:00
Paul Eggert
ee2079f16e * unexelf.c (unexec): Don't assume BSS addr fits in unsigned. 2011-06-12 22:55:57 -07:00
Paul Eggert
6da655361c * xterm.c (handle_one_xevent): Omit unnecessary casts to unsigned. 2011-06-12 22:49:35 -07:00
Paul Eggert
7147c4a44b * keyboard.c (modify_event_symbol): Don't limit alist len to UINT_MAX. 2011-06-12 22:43:30 -07:00
Paul Eggert
193e32d9a8 * lisp.h (CHAR_TABLE_SET): Omit now-redundant test. 2011-06-12 22:24:58 -07:00
Paul Eggert
e5533da60e * lread.c (Fload): Don't compare a possibly-garbage time_t value. 2011-06-12 22:18:27 -07:00
Paul Eggert
9910e595e7 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.
2011-06-12 22:15:27 -07:00
Paul Eggert
2638320e07 * character.h (CHAR_VALID_P): Remove unused parameter.
* fontset.c, lisp.h, xdisp.c: All uses changed.
2011-06-12 21:55:03 -07:00
Paul Eggert
045eb8d982 * editfns.c (Ftranslate_region_internal): Omit redundant test. 2011-06-12 21:27:45 -07:00
Paul Eggert
c1f134b59b * 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.
2011-06-12 19:41:13 -07:00
Paul Eggert
395fcb936e * floatfns.c (Fexpt): Omit unnecessary cast to unsigned. 2011-06-12 19:27:16 -07:00
Paul Eggert
327eeec881 * fileio.c (make_temp_name): Omit unnecessary cast to unsigned. 2011-06-12 19:23:58 -07:00
Paul Eggert
abbd3d23f4 * editfns.c (Ftranslate_region_internal): Use int, not EMACS_INT
for characters.
2011-06-12 19:21:14 -07:00
Paul Eggert
684a03ef99 * doc.c (get_doc_string): Omit (unsigned)c that mishandled negatives. 2011-06-12 19:09:34 -07:00
Paul Eggert
0fed43f396 * 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.
2011-06-12 19:02:16 -07:00
Paul Eggert
8fd02eb7d3 * 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.
2011-06-12 18:38:25 -07:00
Paul Eggert
f8c86b69a8 * 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.
2011-06-12 18:35:47 -07:00
Paul Eggert
34206dd201 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.
2011-06-12 18:07:35 -07:00
Paul Eggert
c5958d4cf3 * character.c (char_string): Remove unnecessary casts. 2011-06-12 17:36:44 -07:00
Paul Eggert
13bdea5923 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 <verify.h>.
(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.
2011-06-12 17:36:03 -07:00
Paul Eggert
d37ca62316 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.
2011-06-12 16:28:37 -07:00
Paul Eggert
ea204efb8a * 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.
2011-06-12 16:25:12 -07:00
Glenn Morris
873e858a93 * term/xterm.el (terminal-init-xterm): Still more simplifications. 2011-06-12 13:18:04 -07:00
Glenn Morris
422e69f6b6 * term/xterm.el (terminal-init-xterm): More simplifications. 2011-06-12 13:15:02 -07:00
Glenn Morris
7cb363eba0 * term/xterm.el (terminal-init-xterm): Misc simplifications. 2011-06-12 12:58:32 -07:00
Glenn Morris
9db51acaf1 * term/xterm.el (terminal-init-xterm): `version' may be nil. (Bug#8838) 2011-06-12 12:56:41 -07:00
Michael Albinus
ea3596a2f3 * tramp.texi (Customizing Completion): Mention authinfo-style files.
(Password handling): `auth-source-debug' is good for debug messages.
2011-06-12 21:23:29 +02:00
Andreas Schwab
2920829f7b * leim/SKK-DIC/SKK-JISYO.L: Add proper coding tag.
* leim/CXTERM-DIC/4Corner.tit, leim/CXTERM-DIC/ARRAY30.tit,
* leim/CXTERM-DIC/CCDOSPY.tit, leim/CXTERM-DIC/ECDICT.tit,
* leim/CXTERM-DIC/ETZY.tit, leim/CXTERM-DIC/PY-b5.tit,
* leim/CXTERM-DIC/Punct-b5.tit, leim/CXTERM-DIC/Punct.tit,
* leim/CXTERM-DIC/QJ-b5.tit, leim/CXTERM-DIC/QJ.tit, leim/CXTERM-DIC/SW.tit,
* leim/CXTERM-DIC/TONEPY.tit, leim/CXTERM-DIC/ZOZY.tit: Likewise.
* leim/MISC-DIC/cangjie-table.b5, leim/MISC-DIC/cangjie-table.cns,
* leim/MISC-DIC/pinyin.map, leim/MISC-DIC/ziranma.cin: Likewise.
2011-06-12 12:37:40 +02:00
Martin Rudalics
e10ac9f13a Fix make_frame, introduce Vtemp_buffer_show_specifiers, cleanup doc-strings.
* 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 12:16:46 +02:00