1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-03 08:30:09 +00:00

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

This commit is contained in:
Paul Eggert 2011-04-09 16:11:48 -07:00
parent 1e69125eae
commit 7d66342ce2
2 changed files with 9 additions and 6 deletions

View File

@ -1,5 +1,7 @@
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.

View File

@ -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)