diff options
author | Florian Walch <florian@fwalch.com> | 2014-11-18 16:02:42 +0100 |
---|---|---|
committer | Florian Walch <florian@fwalch.com> | 2014-11-19 17:21:21 +0100 |
commit | 2b0d9bdeac987e8b25a69e762c8ae94092d87a34 (patch) | |
tree | e7fe7ee0b8d590ca442cd0bd6bd44ff2fc7f9e91 | |
parent | d2338ce397c3a8eb83875c589e952280c1bd57bc (diff) | |
download | rneovim-2b0d9bdeac987e8b25a69e762c8ae94092d87a34.tar.gz rneovim-2b0d9bdeac987e8b25a69e762c8ae94092d87a34.tar.bz2 rneovim-2b0d9bdeac987e8b25a69e762c8ae94092d87a34.zip |
Wconversion: Fix warnings in digraph.c.
-rw-r--r-- | src/nvim/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/nvim/digraph.c | 11 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index c8eab4629a..a2d052c4ec 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -43,7 +43,6 @@ set(CONV_SOURCES buffer.c charset.c diff.c - digraph.c edit.c eval.c ex_cmds2.c diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c index f41a16bc1b..ffba7d4276 100644 --- a/src/nvim/digraph.c +++ b/src/nvim/digraph.c @@ -2,7 +2,9 @@ /// /// code for digraphs +#include <assert.h> #include <stdbool.h> +#include <stdint.h> #include <inttypes.h> #include "nvim/vim.h" @@ -1582,7 +1584,7 @@ int getdigraph(int char1, int char2, int meta_char) /// @param str void putdigraph(char_u *str) { - int char1, char2, n; + char_u char1, char2; digr_T *dp; while (*str != NUL) { @@ -1609,7 +1611,9 @@ void putdigraph(char_u *str) EMSG(_(e_number_exp)); return; } - n = getdigits(&str); + long digits = getdigits(&str); + assert(digits <= INT_MAX); + int n = (int)digits; // If the digraph already exists, replace the result. dp = (digr_T *)user_digraphs.ga_data; @@ -1711,7 +1715,8 @@ static void printdigraph(digr_T *dp) if (char2cells(dp->result) == 1) { *p++ = ' '; } - vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result); + assert(p >= buf); + vim_snprintf((char *)p, sizeof(buf) - (size_t)(p - buf), " %3d", dp->result); msg_outtrans(buf); } } |