diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-01-18 00:20:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-18 00:20:38 +0100 |
commit | 8f9fc1f692292efe63b9e71bb6f6340bccf2b37f (patch) | |
tree | caafab85917d2ce0de1289d67704648ee2345938 /src/nvim/normal.c | |
parent | 8093cbd8e8ca06ce5c9d8814fc6d94cb2304133a (diff) | |
parent | aa39fc56f68e2087a2327bcd03cc5f3d2dc9a696 (diff) | |
download | rneovim-8f9fc1f692292efe63b9e71bb6f6340bccf2b37f.tar.gz rneovim-8f9fc1f692292efe63b9e71bb6f6340bccf2b37f.tar.bz2 rneovim-8f9fc1f692292efe63b9e71bb6f6340bccf2b37f.zip |
Merge #9508 from justinmk/pvs-warnings
Diffstat (limited to 'src/nvim/normal.c')
-rw-r--r-- | src/nvim/normal.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 0e3946740a..0dc5f3175d 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -3284,11 +3284,11 @@ void clear_showcmd(void) p_sbr = empty_option; getvcols(curwin, &curwin->w_cursor, &VIsual, &leftcol, &rightcol); p_sbr = saved_sbr; - sprintf((char *)showcmd_buf, "%" PRId64 "x%" PRId64, - (int64_t)lines, (int64_t)(rightcol - leftcol + 1)); - } else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) - sprintf((char *)showcmd_buf, "%" PRId64, (int64_t)lines); - else { + snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64 "x%" PRId64, + (int64_t)lines, (int64_t)rightcol - leftcol + 1); + } else if (VIsual_mode == 'V' || VIsual.lnum != curwin->w_cursor.lnum) { + snprintf((char *)showcmd_buf, SHOWCMD_BUFLEN, "%" PRId64, (int64_t)lines); + } else { char_u *s, *e; int l; int bytes = 0; @@ -4930,10 +4930,10 @@ get_visual_text ( } else { if (lt(curwin->w_cursor, VIsual)) { *pp = ml_get_pos(&curwin->w_cursor); - *lenp = (size_t)(VIsual.col - curwin->w_cursor.col + 1); + *lenp = (size_t)VIsual.col - (size_t)curwin->w_cursor.col + 1; } else { *pp = ml_get_pos(&VIsual); - *lenp = (size_t)(curwin->w_cursor.col - VIsual.col + 1); + *lenp = (size_t)curwin->w_cursor.col - (size_t)VIsual.col + 1; } if (has_mbyte) /* Correct the length to include the whole last character. */ |