Commit 7d66342c authored by Paul Eggert's avatar Paul Eggert
Browse files

* xdisp.c (vmessage): Use a better test for character truncation.

parent 1e69125e
2011-04-09 Paul Eggert <eggert@cs.ucla.edu>
* xdisp.c (vmessage): Use a better test for character truncation.
* charset.c (load_charset_map): <, not <=, for optimization,
and to avoid potential problems with integer overflow.
* chartab.c (sub_char_table_set_range, char_table_set_range): Likewise.
......
......@@ -8410,13 +8410,14 @@ vmessage (const char *m, va_list ap)
{
char *buf = FRAME_MESSAGE_BUF (f);
size_t bufsize = FRAME_MESSAGE_BUF_SIZE (f);
int len = vsnprintf (buf, bufsize, m, ap);
if (len < 0)
len = 0;
int len;
memset (buf, 0, bufsize);
len = vsnprintf (buf, bufsize, m, ap);
/* Do any truncation at a character boundary. */
if (0 < bufsize && bufsize <= len)
for (len = bufsize - 1;
if (! (0 <= len && len < bufsize))
for (len = strnlen (buf, bufsize);
len && ! CHAR_HEAD_P (buf[len - 1]);
len--)
continue;
......@@ -19495,7 +19496,7 @@ decode_mode_spec (struct window *w, register int c, int field_width,
EMACS_INT limit = BUF_BEGV (b);
EMACS_INT limit_byte = BUF_BEGV_BYTE (b);
EMACS_INT position;
EMACS_INT distance =
EMACS_INT distance =
(height * 2 + 30) * line_number_display_limit_width;
if (startpos - distance > limit)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment