diff options
| author | Paul Eggert | 2011-06-23 00:37:31 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-23 00:37:31 -0700 |
| commit | 7efb4e0e62ed3e11e20d15821342c322b4101ae7 (patch) | |
| tree | 5959727f87d23f06389a138ed5dcb555d4eefbff /src | |
| parent | ff5844ad0bc84ea05e1f57827a040a31f54b8a9c (diff) | |
| parent | 4e3232657c0fe231e594fb75bea2daee2388b978 (diff) | |
| download | emacs-7efb4e0e62ed3e11e20d15821342c322b4101ae7.tar.gz emacs-7efb4e0e62ed3e11e20d15821342c322b4101ae7.zip | |
Merge from trunk.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/minibuf.c | 81 |
2 files changed, 10 insertions, 82 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 7948766690f..1a26efbd34f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,7 @@ | |||
| 1 | 2011-06-23 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2011-06-23 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Integer and buffer overflow fixes (Bug#8873). | ||
| 4 | |||
| 3 | * print.c (printchar, strout): Check for string overflow. | 5 | * print.c (printchar, strout): Check for string overflow. |
| 4 | (PRINTPREPARE, printchar, strout): | 6 | (PRINTPREPARE, printchar, strout): |
| 5 | Don't set size unless allocation succeeds. | 7 | Don't set size unless allocation succeeds. |
| @@ -33,8 +35,6 @@ | |||
| 33 | 35 | ||
| 34 | * image.c (cache_image): Check for size arithmetic overflow. | 36 | * image.c (cache_image): Check for size arithmetic overflow. |
| 35 | 37 | ||
| 36 | 2011-06-22 Paul Eggert <eggert@cs.ucla.edu> | ||
| 37 | |||
| 38 | * lread.c: Integer overflow issues. | 38 | * lread.c: Integer overflow issues. |
| 39 | (saved_doc_string_size, saved_doc_string_length) | 39 | (saved_doc_string_size, saved_doc_string_length) |
| 40 | (prev_saved_doc_string_size, prev_saved_doc_string_length): | 40 | (prev_saved_doc_string_size, prev_saved_doc_string_length): |
| @@ -44,6 +44,13 @@ | |||
| 44 | (read_list): Don't assume file position fits in int. | 44 | (read_list): Don't assume file position fits in int. |
| 45 | (read_escape): Check for hex character overflow. | 45 | (read_escape): Check for hex character overflow. |
| 46 | 46 | ||
| 47 | 2011-06-22 Leo Liu <sdl.web@gmail.com> | ||
| 48 | |||
| 49 | * minibuf.c (Fcompleting_read_default, Vcompleting_read_function): | ||
| 50 | Move to minibuffer.el. | ||
| 51 | |||
| 52 | 2011-06-22 Paul Eggert <eggert@cs.ucla.edu> | ||
| 53 | |||
| 47 | Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking. | 54 | Fixes for GLYPH_DEBUG found by GCC 4.6.0 static checking. |
| 48 | The following patches are for when GLYPH_DEBUG && !XASSERT. | 55 | The following patches are for when GLYPH_DEBUG && !XASSERT. |
| 49 | * dispextern.h (trace_redisplay_p, dump_glyph_string): | 56 | * dispextern.h (trace_redisplay_p, dump_glyph_string): |
diff --git a/src/minibuf.c b/src/minibuf.c index 2b5e94ad356..576bca43068 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -72,7 +72,6 @@ Lisp_Object Qcompletion_ignore_case; | |||
| 72 | static Lisp_Object Qminibuffer_completion_table; | 72 | static Lisp_Object Qminibuffer_completion_table; |
| 73 | static Lisp_Object Qminibuffer_completion_predicate; | 73 | static Lisp_Object Qminibuffer_completion_predicate; |
| 74 | static Lisp_Object Qminibuffer_completion_confirm; | 74 | static Lisp_Object Qminibuffer_completion_confirm; |
| 75 | static Lisp_Object Qcompleting_read_default; | ||
| 76 | static Lisp_Object Quser_variable_p; | 75 | static Lisp_Object Quser_variable_p; |
| 77 | 76 | ||
| 78 | static Lisp_Object Qminibuffer_default; | 77 | static Lisp_Object Qminibuffer_default; |
| @@ -1692,7 +1691,7 @@ See also `completing-read-function'. */) | |||
| 1692 | (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) | 1691 | (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) |
| 1693 | { | 1692 | { |
| 1694 | Lisp_Object args[9]; | 1693 | Lisp_Object args[9]; |
| 1695 | args[0] = Vcompleting_read_function; | 1694 | args[0] = Fsymbol_value (intern ("completing-read-function")); |
| 1696 | args[1] = prompt; | 1695 | args[1] = prompt; |
| 1697 | args[2] = collection; | 1696 | args[2] = collection; |
| 1698 | args[3] = predicate; | 1697 | args[3] = predicate; |
| @@ -1703,76 +1702,6 @@ See also `completing-read-function'. */) | |||
| 1703 | args[8] = inherit_input_method; | 1702 | args[8] = inherit_input_method; |
| 1704 | return Ffuncall (9, args); | 1703 | return Ffuncall (9, args); |
| 1705 | } | 1704 | } |
| 1706 | |||
| 1707 | DEFUN ("completing-read-default", Fcompleting_read_default, Scompleting_read_default, 2, 8, 0, | ||
| 1708 | doc: /* Default method for reading from the minibuffer with completion. | ||
| 1709 | See `completing-read' for the meaning of the arguments. */) | ||
| 1710 | (Lisp_Object prompt, Lisp_Object collection, Lisp_Object predicate, Lisp_Object require_match, Lisp_Object initial_input, Lisp_Object hist, Lisp_Object def, Lisp_Object inherit_input_method) | ||
| 1711 | { | ||
| 1712 | Lisp_Object val, histvar, histpos, position; | ||
| 1713 | Lisp_Object init; | ||
| 1714 | int pos = 0; | ||
| 1715 | int count = SPECPDL_INDEX (); | ||
| 1716 | struct gcpro gcpro1; | ||
| 1717 | |||
| 1718 | init = initial_input; | ||
| 1719 | GCPRO1 (def); | ||
| 1720 | |||
| 1721 | specbind (Qminibuffer_completion_table, collection); | ||
| 1722 | specbind (Qminibuffer_completion_predicate, predicate); | ||
| 1723 | specbind (Qminibuffer_completion_confirm, | ||
| 1724 | EQ (require_match, Qt) ? Qnil : require_match); | ||
| 1725 | |||
| 1726 | position = Qnil; | ||
| 1727 | if (!NILP (init)) | ||
| 1728 | { | ||
| 1729 | if (CONSP (init)) | ||
| 1730 | { | ||
| 1731 | position = Fcdr (init); | ||
| 1732 | init = Fcar (init); | ||
| 1733 | } | ||
| 1734 | CHECK_STRING (init); | ||
| 1735 | if (!NILP (position)) | ||
| 1736 | { | ||
| 1737 | CHECK_NUMBER (position); | ||
| 1738 | /* Convert to distance from end of input. */ | ||
| 1739 | pos = XINT (position) - SCHARS (init); | ||
| 1740 | } | ||
| 1741 | } | ||
| 1742 | |||
| 1743 | if (SYMBOLP (hist)) | ||
| 1744 | { | ||
| 1745 | histvar = hist; | ||
| 1746 | histpos = Qnil; | ||
| 1747 | } | ||
| 1748 | else | ||
| 1749 | { | ||
| 1750 | histvar = Fcar_safe (hist); | ||
| 1751 | histpos = Fcdr_safe (hist); | ||
| 1752 | } | ||
| 1753 | if (NILP (histvar)) | ||
| 1754 | histvar = Qminibuffer_history; | ||
| 1755 | if (NILP (histpos)) | ||
| 1756 | XSETFASTINT (histpos, 0); | ||
| 1757 | |||
| 1758 | val = read_minibuf (NILP (require_match) | ||
| 1759 | ? (NILP (Vminibuffer_completing_file_name) | ||
| 1760 | || EQ (Vminibuffer_completing_file_name, Qlambda) | ||
| 1761 | ? Vminibuffer_local_completion_map | ||
| 1762 | : Vminibuffer_local_filename_completion_map) | ||
| 1763 | : (NILP (Vminibuffer_completing_file_name) | ||
| 1764 | || EQ (Vminibuffer_completing_file_name, Qlambda) | ||
| 1765 | ? Vminibuffer_local_must_match_map | ||
| 1766 | : Vminibuffer_local_filename_must_match_map), | ||
| 1767 | init, prompt, make_number (pos), 0, | ||
| 1768 | histvar, histpos, def, 0, | ||
| 1769 | !NILP (inherit_input_method)); | ||
| 1770 | |||
| 1771 | if (STRINGP (val) && SCHARS (val) == 0 && ! NILP (def)) | ||
| 1772 | val = CONSP (def) ? XCAR (def) : def; | ||
| 1773 | |||
| 1774 | RETURN_UNGCPRO (unbind_to (count, val)); | ||
| 1775 | } | ||
| 1776 | 1705 | ||
| 1777 | Lisp_Object Fassoc_string (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold); | 1706 | Lisp_Object Fassoc_string (register Lisp_Object key, Lisp_Object list, Lisp_Object case_fold); |
| 1778 | 1707 | ||
| @@ -2011,7 +1940,6 @@ syms_of_minibuf (void) | |||
| 2011 | minibuf_save_list = Qnil; | 1940 | minibuf_save_list = Qnil; |
| 2012 | staticpro (&minibuf_save_list); | 1941 | staticpro (&minibuf_save_list); |
| 2013 | 1942 | ||
| 2014 | DEFSYM (Qcompleting_read_default, "completing-read-default"); | ||
| 2015 | DEFSYM (Qcompletion_ignore_case, "completion-ignore-case"); | 1943 | DEFSYM (Qcompletion_ignore_case, "completion-ignore-case"); |
| 2016 | DEFSYM (Qread_file_name_internal, "read-file-name-internal"); | 1944 | DEFSYM (Qread_file_name_internal, "read-file-name-internal"); |
| 2017 | DEFSYM (Qminibuffer_default, "minibuffer-default"); | 1945 | DEFSYM (Qminibuffer_default, "minibuffer-default"); |
| @@ -2130,12 +2058,6 @@ If the value is `confirm-after-completion', the user may exit with an | |||
| 2130 | doc: /* Non-nil means completing file names. */); | 2058 | doc: /* Non-nil means completing file names. */); |
| 2131 | Vminibuffer_completing_file_name = Qnil; | 2059 | Vminibuffer_completing_file_name = Qnil; |
| 2132 | 2060 | ||
| 2133 | DEFVAR_LISP ("completing-read-function", | ||
| 2134 | Vcompleting_read_function, | ||
| 2135 | doc: /* The function called by `completing-read' to do the work. | ||
| 2136 | It should accept the same arguments as `completing-read'. */); | ||
| 2137 | Vcompleting_read_function = Qcompleting_read_default; | ||
| 2138 | |||
| 2139 | DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form, | 2061 | DEFVAR_LISP ("minibuffer-help-form", Vminibuffer_help_form, |
| 2140 | doc: /* Value that `help-form' takes on inside the minibuffer. */); | 2062 | doc: /* Value that `help-form' takes on inside the minibuffer. */); |
| 2141 | Vminibuffer_help_form = Qnil; | 2063 | Vminibuffer_help_form = Qnil; |
| @@ -2212,5 +2134,4 @@ properties. */); | |||
| 2212 | defsubr (&Stest_completion); | 2134 | defsubr (&Stest_completion); |
| 2213 | defsubr (&Sassoc_string); | 2135 | defsubr (&Sassoc_string); |
| 2214 | defsubr (&Scompleting_read); | 2136 | defsubr (&Scompleting_read); |
| 2215 | defsubr (&Scompleting_read_default); | ||
| 2216 | } | 2137 | } |