mirror of
https://github.com/neovim/neovim.git
synced 2024-12-21 11:45:01 -07:00
build: fix gcc warnings #10568
gcc version 8.3.0 (Debian 8.3.0-6) ../src/nvim/ex_docmd.c: In function ‘commands_array’: ../src/nvim/ex_docmd.c:10192:36: warning: ‘%ld’ directive output may be truncated writing between 1 and 19 bytes into a region of size 10 [-Wformat-truncation=] snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ^~~ ../src/nvim/ex_docmd.c:10192:37: note: format string is defined here snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ../src/nvim/ex_docmd.c:10192:36: note: directive argument in the range [0, 9223372036854775807] snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ^~~ ../src/nvim/ex_docmd.c:10192:9: note: ‘snprintf’ output between 2 and 20 bytes into a destination of size 10 snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/nvim/ex_docmd.c:10205:36: warning: ‘%ld’ directive output may be truncated writing between 1 and 19 bytes into a region of size 10 [-Wformat-truncation=] snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ^~~ ../src/nvim/ex_docmd.c:10205:37: note: format string is defined here snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ../src/nvim/ex_docmd.c:10205:36: note: directive argument in the range [0, 9223372036854775807] snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ^~~ ../src/nvim/ex_docmd.c:10205:9: note: ‘snprintf’ output between 2 and 20 bytes into a destination of size 10 snprintf(str, sizeof(str), "%" PRId64, (int64_t)cmd->uc_def); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/nvim/spell.c: In function ‘did_set_spelllang’: ../src/nvim/spell.c:1631:61: warning: ‘%s’ directive output may be truncated writing up to 254 bytes into a region of size 84 [-Wformat-truncation=] "autocmd VimEnter * call spellfile#LoadFile('%s')|set spell", ^~ ../src/nvim/spell.c:2063:25: spell_load_lang(lang); ~~~~ ../src/nvim/spell.c:1630:7: note: ‘snprintf’ output between 57 and 311 bytes into a destination of size 128 snprintf(autocmd_buf, sizeof(autocmd_buf), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ "autocmd VimEnter * call spellfile#LoadFile('%s')|set spell", ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ lang); ~~~~~ ../src/nvim/window.c: In function ‘win_rotate’: ../src/nvim/window.c:1780:22: warning: ‘wp2’ may be used uninitialized in this function [-Wmaybe-uninitialized] wp2->w_pos_changed = true; ^ ../src/nvim/window.c:1779:22: warning: ‘wp1’ may be used uninitialized in this function [-Wmaybe-uninitialized] wp1->w_pos_changed = true;
This commit is contained in:
parent
39549159fe
commit
184b87ee31
@ -10172,7 +10172,7 @@ Dictionary commands_array(buf_T *buf)
|
||||
Dictionary rv = ARRAY_DICT_INIT;
|
||||
Object obj = NIL;
|
||||
(void)obj; // Avoid "dead assignment" warning.
|
||||
char str[10];
|
||||
char str[20];
|
||||
garray_T *gap = (buf == NULL) ? &ucmds : &buf->b_ucmds;
|
||||
|
||||
for (int i = 0; i < gap->ga_len; i++) {
|
||||
|
@ -1626,7 +1626,7 @@ static void spell_load_lang(char_u *lang)
|
||||
if (starting) {
|
||||
// Prompt the user at VimEnter if spell files are missing. #3027
|
||||
// Plugins aren't loaded yet, so spellfile.vim cannot handle this case.
|
||||
char autocmd_buf[128] = { 0 };
|
||||
char autocmd_buf[512] = { 0 };
|
||||
snprintf(autocmd_buf, sizeof(autocmd_buf),
|
||||
"autocmd VimEnter * call spellfile#LoadFile('%s')|set spell",
|
||||
lang);
|
||||
|
@ -1713,7 +1713,7 @@ static void win_rotate(bool upwards, int count)
|
||||
return;
|
||||
}
|
||||
|
||||
if (firstwin == curwin && lastwin_nofloating() == curwin) {
|
||||
if (count <= 0 || (firstwin == curwin && lastwin_nofloating() == curwin)) {
|
||||
// nothing to do
|
||||
beep_flush();
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user