1
0
forked from aniani/vim

patch 8.2.0296: mixing up "long long" and __int64 may cause problems

Problem:    Mixing up "long long" and __int64 may cause problems. (John
            Marriott)
Solution:   Pass varnumber_T to vim_snprintf().  Add v:numbersize.
This commit is contained in:
Bram Moolenaar
2020-02-22 14:27:04 +01:00
parent c036e87bd7
commit f9706e9df0
12 changed files with 108 additions and 96 deletions

View File

@@ -3364,17 +3364,13 @@ do_addsub(
buf2[i] = '\0';
}
else if (pre == 0)
vim_snprintf((char *)buf2, NUMBUFLEN, "%llu",
(long_long_u_T)n);
vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", (uvarnumber_T)n);
else if (pre == '0')
vim_snprintf((char *)buf2, NUMBUFLEN, "%llo",
(long_long_u_T)n);
vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", (uvarnumber_T)n);
else if (pre && hexupper)
vim_snprintf((char *)buf2, NUMBUFLEN, "%llX",
(long_long_u_T)n);
vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", (uvarnumber_T)n);
else
vim_snprintf((char *)buf2, NUMBUFLEN, "%llx",
(long_long_u_T)n);
vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", (uvarnumber_T)n);
length -= (int)STRLEN(buf2);
/*
@@ -3773,21 +3769,21 @@ cursor_pos_info(dict_T *dict)
_("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Bytes"),
buf1, line_count_selected,
(long)curbuf->b_ml.ml_line_count,
(long_long_T)word_count_cursor,
(long_long_T)word_count,
(long_long_T)byte_count_cursor,
(long_long_T)byte_count);
(varnumber_T)word_count_cursor,
(varnumber_T)word_count,
(varnumber_T)byte_count_cursor,
(varnumber_T)byte_count);
else
vim_snprintf((char *)IObuff, IOSIZE,
_("Selected %s%ld of %ld Lines; %lld of %lld Words; %lld of %lld Chars; %lld of %lld Bytes"),
buf1, line_count_selected,
(long)curbuf->b_ml.ml_line_count,
(long_long_T)word_count_cursor,
(long_long_T)word_count,
(long_long_T)char_count_cursor,
(long_long_T)char_count,
(long_long_T)byte_count_cursor,
(long_long_T)byte_count);
(varnumber_T)word_count_cursor,
(varnumber_T)word_count,
(varnumber_T)char_count_cursor,
(varnumber_T)char_count,
(varnumber_T)byte_count_cursor,
(varnumber_T)byte_count);
}
else
{
@@ -3805,17 +3801,17 @@ cursor_pos_info(dict_T *dict)
(char *)buf1, (char *)buf2,
(long)curwin->w_cursor.lnum,
(long)curbuf->b_ml.ml_line_count,
(long_long_T)word_count_cursor, (long_long_T)word_count,
(long_long_T)byte_count_cursor, (long_long_T)byte_count);
(varnumber_T)word_count_cursor, (varnumber_T)word_count,
(varnumber_T)byte_count_cursor, (varnumber_T)byte_count);
else
vim_snprintf((char *)IObuff, IOSIZE,
_("Col %s of %s; Line %ld of %ld; Word %lld of %lld; Char %lld of %lld; Byte %lld of %lld"),
(char *)buf1, (char *)buf2,
(long)curwin->w_cursor.lnum,
(long)curbuf->b_ml.ml_line_count,
(long_long_T)word_count_cursor, (long_long_T)word_count,
(long_long_T)char_count_cursor, (long_long_T)char_count,
(long_long_T)byte_count_cursor, (long_long_T)byte_count);
(varnumber_T)word_count_cursor, (varnumber_T)word_count,
(varnumber_T)char_count_cursor, (varnumber_T)char_count,
(varnumber_T)byte_count_cursor, (varnumber_T)byte_count);
}
}
@@ -3825,7 +3821,7 @@ cursor_pos_info(dict_T *dict)
size_t len = STRLEN(IObuff);
vim_snprintf((char *)IObuff + len, IOSIZE - len,
_("(+%lld for BOM)"), (long_long_T)bom_count);
_("(+%lld for BOM)"), (varnumber_T)bom_count);
}
if (dict == NULL)
{