mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.0.1677: no compiler warning for wrong format in vim_snprintf()
Problem: No compiler warning for wrong format in vim_snprintf(). Solution: Add printf attribute for gcc. Fix reported problems.
This commit is contained in:
37
src/ops.c
37
src/ops.c
@@ -5976,13 +5976,17 @@ do_addsub(
|
||||
buf2[i] = '\0';
|
||||
}
|
||||
else if (pre == 0)
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llu", n);
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llu",
|
||||
(long long unsigned)n);
|
||||
else if (pre == '0')
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llo", n);
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llo",
|
||||
(long long unsigned)n);
|
||||
else if (pre && hexupper)
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llX", n);
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llX",
|
||||
(long long unsigned)n);
|
||||
else
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llx", n);
|
||||
vim_snprintf((char *)buf2, NUMBUFLEN, "%llx",
|
||||
(long long unsigned)n);
|
||||
length -= (int)STRLEN(buf2);
|
||||
|
||||
/*
|
||||
@@ -7501,16 +7505,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,
|
||||
word_count_cursor, word_count,
|
||||
byte_count_cursor, byte_count);
|
||||
(long long)word_count_cursor,
|
||||
(long long)word_count,
|
||||
(long long)byte_count_cursor,
|
||||
(long long)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,
|
||||
word_count_cursor, word_count,
|
||||
char_count_cursor, char_count,
|
||||
byte_count_cursor, byte_count);
|
||||
(long long)word_count_cursor,
|
||||
(long long)word_count,
|
||||
(long long)char_count_cursor,
|
||||
(long long)char_count,
|
||||
(long long)byte_count_cursor,
|
||||
(long long)byte_count);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -7528,17 +7537,17 @@ cursor_pos_info(dict_T *dict)
|
||||
(char *)buf1, (char *)buf2,
|
||||
(long)curwin->w_cursor.lnum,
|
||||
(long)curbuf->b_ml.ml_line_count,
|
||||
word_count_cursor, word_count,
|
||||
byte_count_cursor, byte_count);
|
||||
(long long)word_count_cursor, (long long)word_count,
|
||||
(long long)byte_count_cursor, (long long)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,
|
||||
word_count_cursor, word_count,
|
||||
char_count_cursor, char_count,
|
||||
byte_count_cursor, byte_count);
|
||||
(long long)word_count_cursor, (long long)word_count,
|
||||
(long long)char_count_cursor, (long long)char_count,
|
||||
(long long)byte_count_cursor, (long long)byte_count);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user