diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-06 20:34:05 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-04-06 20:34:05 -0700 |
commit | 5fdb398c4b75b0c834aff7132f90b0ce5317a25a (patch) | |
tree | 29ebb8fc5700fefdd867fa497eac27fb7d0bcfe0 /src/nsfns.m | |
parent | b189fa667ed7ac7b17f9665cd8a0c26316b3c521 (diff) | |
download | emacs-5fdb398c4b75b0c834aff7132f90b0ce5317a25a.tar.gz |
error: Print 32- and 64-bit integers portably (Bug#8435).
Without this change, on typical 64-bit hosts error ("...%d...", N)
was used to print both 32- and 64-bit integers N, which relied on
undefined behavior.
* lisp.h, src/m/amdx86-64.h, src/m/ia64.h, src/m/ibms390x.h (pEd):
New macro.
* lisp.h (error, verror): Mark as printf-like functions.
* eval.c (verror): Use vsnprintf, not doprnt, to do the real work.
Report overflow in size calculations when allocating printf buffer.
Do not truncate output string at its first null byte.
* xdisp.c (vmessage): Use vsnprintf, not doprnt, to do the real work.
Truncate the output at a character boundary, since vsnprintf does not
do that.
* charset.c (check_iso_charset_parameter): Convert internal
character to string before calling 'error', since %c now has the
printf meaning.
* coding.c (Fdecode_sjis_char, Fdecode_big5_char): Avoid int
overflow when computing char to be passed to 'error'. Do not
pass Lisp_Object to 'error'; pass the integer instead.
* nsfns.m (Fns_do_applescript): Use int, not long, since it's
formatted with plain %d.
Diffstat (limited to 'src/nsfns.m')
-rw-r--r-- | src/nsfns.m | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/nsfns.m b/src/nsfns.m index 6a5adbd7bf3..d4445d1d627 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -483,7 +483,7 @@ ns_set_name_internal (FRAME_PTR f, Lisp_Object name) if (!STRINGP (f->icon_name)) encoded_icon_name = encoded_name; else - encoded_icon_name = ENCODE_UTF_8 (f->icon_name); + encoded_icon_name = ENCODE_UTF_8 (f->icon_name); str = [NSString stringWithUTF8String: SDATA (encoded_icon_name)]; @@ -637,7 +637,7 @@ ns_set_name_as_filename (struct frame *f) if (FRAME_ICONIFIED_P (f)) [[view window] setMiniwindowTitle: str]; - else + else { NSString *fstr; @@ -1021,8 +1021,8 @@ frame_parm_handler ns_frame_parm_handlers[] = 0, /* x_set_fullscreen will ignore */ x_set_font_backend, /* generic OK */ x_set_alpha, - 0, /* x_set_sticky */ - 0, /* x_set_tool_bar_position */ + 0, /* x_set_sticky */ + 0, /* x_set_tool_bar_position */ }; @@ -2044,7 +2044,7 @@ In case the execution fails, an error is signaled. */) (Lisp_Object script) { Lisp_Object result; - long status; + int status; CHECK_STRING (script); check_ns (); @@ -2330,7 +2330,7 @@ If omitted or nil, that stands for the selected frame's display. */) { struct ns_display_info *dpyinfo; check_ns (); - + dpyinfo = check_ns_display_info (display); /* We force 24+ bit depths to 24-bit to prevent an overflow. */ return make_number (1 << min (dpyinfo->n_planes, 24)); @@ -2373,7 +2373,7 @@ compute_tip_xy (struct frame *f, pt.y = x_display_pixel_height (FRAME_NS_DISPLAY_INFO (f)) - XINT (top) - height; } - + /* Ensure in bounds. (Note, screen origin = lower left.) */ if (INTEGERP (left)) *root_x = pt.x; @@ -2655,4 +2655,3 @@ be used as the image of the icon representing the frame. */); check_window_system_func = check_ns; } - |