aboutsummaryrefslogtreecommitdiffstats
path: root/src/callint.c
diff options
context:
space:
mode:
authorEli Zaretskii2011-04-23 13:33:28 +0300
committerEli Zaretskii2011-04-23 13:33:28 +0300
commite6c3da2065ac72cc4e1a2bef22d367cd75401892 (patch)
tree1f6fcbee1e12f63096d2221a89f5436b831862a9 /src/callint.c
parent4ffd0d6b569d252e4e807d4e9c9d6a5bd5b08640 (diff)
downloademacs-e6c3da2065ac72cc4e1a2bef22d367cd75401892.tar.gz
emacs-e6c3da2065ac72cc4e1a2bef22d367cd75401892.zip
Fix doprnt so it could be used safely in `verror'. (Bug#8435)
src/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. src/lisp.h (doprnt): Restore prototype. src/makefile.w32-in ($(BLD)/callint.$(O)): Depend on $(SRC)/character.h. src/Makefile.in (base_obj): Add back doprnt.o. src/deps.mk (doprnt.o): Add back prerequisites. (callint.o): Depend on character.h. src/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. src/xdisp.c (vmessage): Call doprnt instead of vsnprintf. src/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. src/character.c (char_string): Use %x to display the (unsigned) codepoint of an invalid character, to avoid displaying a bogus negative value. src/font.c (check_otf_features): Pass SDATA of SYMBOL_NAME to `error', not SYMBOL_NAME itself. src/coding.c (Fencode_sjis_char, Fencode_big5_char): Use %c for character arguments to `error'. src/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'.
Diffstat (limited to 'src/callint.c')
-rw-r--r--src/callint.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/callint.c b/src/callint.c
index e5ec3d7d931..cddd92c8a94 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -27,6 +27,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include "keyboard.h" 27#include "keyboard.h"
28#include "window.h" 28#include "window.h"
29#include "keymap.h" 29#include "keymap.h"
30#include "character.h"
30 31
31Lisp_Object Qminus, Qplus; 32Lisp_Object Qminus, Qplus;
32Lisp_Object Qcall_interactively; 33Lisp_Object Qcall_interactively;
@@ -786,8 +787,10 @@ invoke it. If KEYS is omitted or nil, the return value of
786 if anyone tries to define one here. */ 787 if anyone tries to define one here. */
787 case '+': 788 case '+':
788 default: 789 default:
789 error ("Invalid control letter `%c' (%03o) in interactive calling string", 790 error ("Invalid control letter `%c' (#o%03o, #x%04x) in interactive calling string",
790 *tem, (unsigned char) *tem); 791 STRING_CHAR ((unsigned char *) tem),
792 (unsigned) STRING_CHAR ((unsigned char *) tem),
793 (unsigned) STRING_CHAR ((unsigned char *) tem));
791 } 794 }
792 795
793 if (varies[i] == 0) 796 if (varies[i] == 0)