0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 7.4.2097

Problem:    Warning from 64 bit compiler.
Solution:   use size_t instead of int. (Mike Williams)
This commit is contained in:
Bram Moolenaar
2016-07-23 17:28:22 +02:00
parent b49edc11a1
commit d4f31dc454
2 changed files with 11 additions and 8 deletions

View File

@@ -237,18 +237,19 @@ msg_strtrunc(
trunc_string( trunc_string(
char_u *s, char_u *s,
char_u *buf, char_u *buf,
int room, int room_in,
int buflen) int buflen)
{ {
int half; size_t room = room_in - 3; /* "..." takes 3 chars */
int len; size_t half;
size_t len = 0;
int e; int e;
int i; int i;
int n; int n;
room -= 3; if (room_in < 3)
room = 0;
half = room / 2; half = room / 2;
len = 0;
/* First part: Start of the string. */ /* First part: Start of the string. */
for (e = 0; len < half && e < buflen; ++e) for (e = 0; len < half && e < buflen; ++e)
@@ -320,7 +321,7 @@ trunc_string(
if (s != buf) if (s != buf)
{ {
len = STRLEN(s); len = STRLEN(s);
if (len >= buflen) if (len >= (size_t)buflen)
len = buflen - 1; len = buflen - 1;
len = len - e + 1; len = len - e + 1;
if (len < 1) if (len < 1)
@@ -333,8 +334,8 @@ trunc_string(
{ {
/* set the middle and copy the last part */ /* set the middle and copy the last part */
mch_memmove(buf + e, "...", (size_t)3); mch_memmove(buf + e, "...", (size_t)3);
len = (int)STRLEN(s + i) + 1; len = STRLEN(s + i) + 1;
if (len >= buflen - e - 3) if (len >= (size_t)buflen - e - 3)
len = buflen - e - 3 - 1; len = buflen - e - 3 - 1;
mch_memmove(buf + e + 3, s + i, len); mch_memmove(buf + e + 3, s + i, len);
buf[e + 3 + len - 1] = NUL; buf[e + 3 + len - 1] = NUL;

View File

@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2097,
/**/ /**/
2096, 2096,
/**/ /**/