diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-04-08 13:07:22 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-04-08 13:07:22 +0200 |
commit | ea39176baab52b646d1e2676e662def718ddd365 (patch) | |
tree | b7efd5049894e2dd699222f9614ffcf01e892480 /src/ops.c | |
parent | 4ac2e8d8e60dcc7dbff662e177b86ccfbda7cd9e (diff) | |
download | vim-git-ea39176baab52b646d1e2676e662def718ddd365.tar.gz |
patch 8.0.1677: no compiler warning for wrong format in vim_snprintf()v8.0.1677
Problem: No compiler warning for wrong format in vim_snprintf().
Solution: Add printf attribute for gcc. Fix reported problems.
Diffstat (limited to 'src/ops.c')
-rw-r--r-- | src/ops.c | 37 |
1 files changed, 23 insertions, 14 deletions
@@ -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); } } |