aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/indent.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2015-02-18 20:54:15 -0500
committerJustin M. Keyes <justinkz@gmail.com>2015-02-18 20:54:15 -0500
commitb1d079c83b3dd459114d1ba7c2ff1b07a9ee3e9e (patch)
treee80358ae4795597680b45fe984dc5f2e9ce20237 /src/nvim/indent.c
parent366662d932551e558d10f09887ddf144ed5db34b (diff)
parent36340803afe1504f15468a715172c25cfef6974c (diff)
downloadrneovim-b1d079c83b3dd459114d1ba7c2ff1b07a9ee3e9e.tar.gz
rneovim-b1d079c83b3dd459114d1ba7c2ff1b07a9ee3e9e.tar.bz2
rneovim-b1d079c83b3dd459114d1ba7c2ff1b07a9ee3e9e.zip
Merge #1979 'Enable -Wconversion'
Diffstat (limited to 'src/nvim/indent.c')
-rw-r--r--src/nvim/indent.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index 075acc6c13..5711207933 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -1,3 +1,4 @@
+#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
@@ -198,7 +199,8 @@ int set_indent(int size, int flags)
// characters and allocate accordingly. We will fill the rest with spaces
// after the if (!curbuf->b_p_et) below.
if (orig_char_len != -1) {
- newline = xmalloc(orig_char_len + size - ind_done + line_len);
+ assert(orig_char_len + size - ind_done + line_len >= 0);
+ newline = xmalloc((size_t)(orig_char_len + size - ind_done + line_len));
todo = size - ind_done;
// Set total length of indent in characters, which may have been
@@ -219,7 +221,8 @@ int set_indent(int size, int flags)
}
} else {
todo = size;
- newline = xmalloc(ind_len + line_len);
+ assert(ind_len + line_len >= 0);
+ newline = xmalloc((size_t)(ind_len + line_len));
s = newline;
}
@@ -384,7 +387,8 @@ int copy_indent(int size, char_u *src)
// Allocate memory for the result: the copied indent, new indent
// and the rest of the line.
line_len = (int)STRLEN(get_cursor_line_ptr()) + 1;
- line = xmalloc(ind_len + line_len);
+ assert(ind_len + line_len >= 0);
+ line = xmalloc((size_t)(ind_len + line_len));
p = line;
}
}
@@ -449,7 +453,7 @@ int get_number_indent(linenr_T lnum)
*/
int get_breakindent_win(win_T *wp, char_u *line) {
static int prev_indent = 0; /* cached indent value */
- static int prev_ts = 0L; /* cached tabstop value */
+ static long prev_ts = 0; /* cached tabstop value */
static char_u *prev_line = NULL; /* cached pointer to line */
static int prev_tick = 0; // changedtick of cached value
int bri = 0;