Skip to content

Commit d4f31dc

Browse files
committed
patch 7.4.2097
Problem: Warning from 64 bit compiler. Solution: use size_t instead of int. (Mike Williams)
1 parent b49edc1 commit d4f31dc

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/message.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,18 +237,19 @@ msg_strtrunc(
237237
trunc_string(
238238
char_u *s,
239239
char_u *buf,
240-
int room,
240+
int room_in,
241241
int buflen)
242242
{
243-
int half;
244-
int len;
243+
size_t room = room_in - 3; /* "..." takes 3 chars */
244+
size_t half;
245+
size_t len = 0;
245246
int e;
246247
int i;
247248
int n;
248249

249-
room -= 3;
250+
if (room_in < 3)
251+
room = 0;
250252
half = room / 2;
251-
len = 0;
252253

253254
/* First part: Start of the string. */
254255
for (e = 0; len < half && e < buflen; ++e)
@@ -320,7 +321,7 @@ trunc_string(
320321
if (s != buf)
321322
{
322323
len = STRLEN(s);
323-
if (len >= buflen)
324+
if (len >= (size_t)buflen)
324325
len = buflen - 1;
325326
len = len - e + 1;
326327
if (len < 1)
@@ -333,8 +334,8 @@ trunc_string(
333334
{
334335
/* set the middle and copy the last part */
335336
mch_memmove(buf + e, "...", (size_t)3);
336-
len = (int)STRLEN(s + i) + 1;
337-
if (len >= buflen - e - 3)
337+
len = STRLEN(s + i) + 1;
338+
if (len >= (size_t)buflen - e - 3)
338339
len = buflen - e - 3 - 1;
339340
mch_memmove(buf + e + 3, s + i, len);
340341
buf[e + 3 + len - 1] = NUL;

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,8 @@ static char *(features[]) =
758758

759759
static int included_patches[] =
760760
{ /* Add new patch number below this line */
761+
/**/
762+
2097,
761763
/**/
762764
2096,
763765
/**/

0 commit comments

Comments
 (0)