mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 13:38:34 +00:00
vim-patch:7.4.2097
Problem: Warning from 64 bit compiler.
Solution: use size_t instead of int. (Mike Williams)
d4f31dc454
This commit is contained in:
@@ -237,17 +237,19 @@ msg_strtrunc (
|
|||||||
* Truncate a string "s" to "buf" with cell width "room".
|
* Truncate a string "s" to "buf" with cell width "room".
|
||||||
* "s" and "buf" may be equal.
|
* "s" and "buf" may be equal.
|
||||||
*/
|
*/
|
||||||
void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
void trunc_string(char_u *s, char_u *buf, int room_in, 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) {
|
||||||
@@ -287,7 +289,7 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
|||||||
// text fits without truncating
|
// text fits without truncating
|
||||||
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;
|
||||||
@@ -300,8 +302,8 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
|
|||||||
} else if (e + 3 < buflen) {
|
} else if (e + 3 < buflen) {
|
||||||
// set the middle and copy the last part
|
// set the middle and copy the last part
|
||||||
memmove(buf + e, "...", (size_t)3);
|
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;
|
||||||
memmove(buf + e + 3, s + i, len);
|
memmove(buf + e + 3, s + i, len);
|
||||||
buf[e + 3 + len - 1] = NUL;
|
buf[e + 3 + len - 1] = NUL;
|
||||||
|
@@ -343,7 +343,7 @@ static int included_patches[] = {
|
|||||||
2100,
|
2100,
|
||||||
2099,
|
2099,
|
||||||
2098,
|
2098,
|
||||||
// 2097,
|
2097,
|
||||||
2096,
|
2096,
|
||||||
2095,
|
2095,
|
||||||
// 2094 NA
|
// 2094 NA
|
||||||
|
Reference in New Issue
Block a user