aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/buffer.c
diff options
context:
space:
mode:
authorAdam-K-P <akpinarb@ucsc.edu>2015-11-24 17:23:38 -0800
committerJustin M. Keyes <justinkz@gmail.com>2017-03-02 22:46:11 +0100
commit165d525abd734402c56a40f0e9fcfede8ff2c828 (patch)
treec1363bcb2576419f4a93d47e66f0b04b3ab4b72d /src/nvim/buffer.c
parentb62f837395932c95585ea353b027935347b332b2 (diff)
downloadrneovim-165d525abd734402c56a40f0e9fcfede8ff2c828.tar.gz
rneovim-165d525abd734402c56a40f0e9fcfede8ff2c828.tar.bz2
rneovim-165d525abd734402c56a40f0e9fcfede8ff2c828.zip
buffer.c: enable -Wconversion #3744
Closes #3744
Diffstat (limited to 'src/nvim/buffer.c')
-rw-r--r--src/nvim/buffer.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 083ed43047..d6f35bd6c2 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -1380,7 +1380,9 @@ void enter_buffer(buf_T *buf)
curwin->w_valid = 0;
if (buf->terminal) {
- terminal_resize(buf->terminal, curwin->w_width, curwin->w_height);
+ terminal_resize(buf->terminal,
+ (uint16_t)curwin->w_width,
+ (uint16_t)curwin->w_height);
}
/* Make sure the buffer is loaded. */
@@ -2079,7 +2081,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
if (count == 0) /* no match found, break here */
break;
if (round == 1) {
- *file = xmalloc(count * sizeof(**file));
+ *file = xmalloc((size_t)count * sizeof(**file));
}
}
vim_regfree(regmatch.regprog);
@@ -2822,9 +2824,10 @@ void maketitle(void)
if (p_title) {
if (p_titlelen > 0) {
- maxlen = p_titlelen * Columns / 100;
- if (maxlen < 10)
+ maxlen = (int)(p_titlelen * Columns / 100);
+ if (maxlen < 10) {
maxlen = 10;
+ }
}
t_str = buf;
@@ -3041,7 +3044,7 @@ int build_stl_str_hl(
size_t outlen,
char_u *fmt,
int use_sandbox,
- int fillchar,
+ char_u fillchar,
int maxwidth,
struct stl_hlrec *hltab,
StlClickRecord *tabtab
@@ -3643,7 +3646,7 @@ int build_stl_str_hl(
wp->w_buffer->b_p_ft);
// Uppercase the file extension
for (char_u *t = tmp; *t != 0; t++) {
- *t = TOUPPER_LOC(*t);
+ *t = (char_u)TOUPPER_LOC(*t);
}
str = tmp;
}
@@ -3820,7 +3823,8 @@ int build_stl_str_hl(
}
// }
- size_t remaining_buf_len = (out_end_p - out_p) + 1;
+ assert(out_end_p >= out_p);
+ size_t remaining_buf_len = (size_t)(out_end_p - out_p) + 1;
// If the number is going to take up too much room
// Figure out the approximate number in "scientific" type notation.
@@ -4011,7 +4015,7 @@ int build_stl_str_hl(
// add characters at the separate marker (if there is one) to
// fill up the available space.
} else if (width < maxwidth
- && STRLEN(out) + maxwidth - width + 1 < outlen) {
+ && STRLEN(out) + (size_t)(maxwidth - width) + 1 < outlen) {
// Find how many separators there are, which we will use when
// figuring out how many groups there are.
int num_separators = 0;
@@ -4257,7 +4261,7 @@ do_arg_all (
setpcmark();
opened_len = ARGCOUNT;
- opened = xcalloc(opened_len, 1);
+ opened = xcalloc((size_t)opened_len, 1);
/* Autocommands may do anything to the argument list. Make sure it's not
* freed while we are working here by "locking" it. We still have to
@@ -4473,8 +4477,8 @@ void ex_buffer_all(exarg_T *eap)
bool p_ea_save;
int open_wins = 0;
int r;
- int count; /* Maximum number of windows to open. */
- int all; /* When TRUE also load inactive buffers. */
+ long count; // Maximum number of windows to open.
+ int all; // When TRUE also load inactive buffers.
int had_tab = cmdmod.tab;
tabpage_T *tpnext;
@@ -4998,7 +5002,7 @@ int buf_findsign(
for (sign = buf->b_signlist; sign != NULL; sign = sign->next) {
if (sign->id == id) {
- return sign->lnum;
+ return (int)sign->lnum;
}
}
@@ -5212,8 +5216,10 @@ void bufhl_clear_line_range(buf_T *buf,
/// @param bufhl_info The highlight info for the buffer
/// @param src_id Highlight source group to clear, or -1 to clear all groups.
/// @param lnum Linenr where the highlight should be cleared
-static bool bufhl_clear_line(bufhl_info_T *bufhl_info, int src_id, int lnum) {
- bufhl_vec_T* lineinfo = map_ref(linenr_T, bufhl_vec_T)(bufhl_info,
+static bool bufhl_clear_line(bufhl_info_T *bufhl_info, int src_id,
+ linenr_T lnum)
+{
+ bufhl_vec_T *lineinfo = map_ref(linenr_T, bufhl_vec_T)(bufhl_info,
lnum, false);
size_t oldsize = kv_size(*lineinfo);
if (src_id < 0) {