aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api')
-rw-r--r--src/nvim/api/buffer.c17
-rw-r--r--src/nvim/api/private/helpers.c7
-rw-r--r--src/nvim/api/vimscript.c4
-rw-r--r--src/nvim/api/win_config.c2
4 files changed, 15 insertions, 15 deletions
diff --git a/src/nvim/api/buffer.c b/src/nvim/api/buffer.c
index 4fa8b13c54..536be1d832 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -420,7 +420,7 @@ void nvim_buf_set_lines(uint64_t channel_id, Buffer buffer, Integer start, Integ
goto end;
}
- bcount_t deleted_bytes = get_region_bytecount(curbuf, start, end, 0, 0);
+ bcount_t deleted_bytes = get_region_bytecount(curbuf, (linenr_T)start, (linenr_T)end, 0, 0);
// If the size of the range is reducing (ie, new_len < old_len) we
// need to delete some old_len. We do this at the start, by
@@ -490,14 +490,14 @@ void nvim_buf_set_lines(uint64_t channel_id, Buffer buffer, Integer start, Integ
mark_adjust((linenr_T)start,
(linenr_T)(end - 1),
MAXLNUM,
- (long)extra,
+ (linenr_T)extra,
kExtmarkNOOP);
extmark_splice(curbuf, (int)start - 1, 0, (int)(end - start), 0,
deleted_bytes, (int)new_len, 0, inserted_bytes,
kExtmarkUndo);
- changed_lines((linenr_T)start, 0, (linenr_T)end, (long)extra, true);
+ changed_lines((linenr_T)start, 0, (linenr_T)end, (linenr_T)extra, true);
fix_cursor((linenr_T)start, (linenr_T)end, (linenr_T)extra);
end:
@@ -564,13 +564,13 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
return;
}
- char *str_at_start = (char *)ml_get_buf(buf, start_row, false);
+ char *str_at_start = (char *)ml_get_buf(buf, (linenr_T)start_row, false);
if (start_col < 0 || (size_t)start_col > strlen(str_at_start)) {
api_set_error(err, kErrorTypeValidation, "start_col out of bounds");
return;
}
- char *str_at_end = (char *)ml_get_buf(buf, end_row, false);
+ char *str_at_end = (char *)ml_get_buf(buf, (linenr_T)end_row, false);
size_t len_at_end = strlen(str_at_end);
if (end_col < 0 || (size_t)end_col > len_at_end) {
api_set_error(err, kErrorTypeValidation, "end_col out of bounds");
@@ -600,7 +600,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
for (int64_t i = 1; i < end_row - start_row; i++) {
int64_t lnum = start_row + i;
- const char *bufline = (char *)ml_get_buf(buf, lnum, false);
+ const char *bufline = (char *)ml_get_buf(buf, (linenr_T)lnum, false);
old_byte += (bcount_t)(strlen(bufline)) + 1;
}
old_byte += (bcount_t)end_col + 1;
@@ -725,7 +725,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
mark_adjust((linenr_T)start_row,
(linenr_T)end_row,
MAXLNUM,
- (long)extra,
+ (linenr_T)extra,
kExtmarkNOOP);
colnr_T col_extent = (colnr_T)(end_col
@@ -735,8 +735,7 @@ void nvim_buf_set_text(uint64_t channel_id, Buffer buffer, Integer start_row, In
(int)new_len - 1, (colnr_T)last_item.size, new_byte,
kExtmarkUndo);
- changed_lines((linenr_T)start_row, 0, (linenr_T)end_row + 1,
- (long)extra, true);
+ changed_lines((linenr_T)start_row, 0, (linenr_T)end_row + 1, (linenr_T)extra, true);
// adjust cursor like an extmark ( i e it was inside last_part_len)
if (curwin->w_cursor.lnum == end_row && curwin->w_cursor.col > end_col) {
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index af4aaf01aa..1ddaf63743 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -1397,7 +1397,8 @@ bool set_mark(buf_T *buf, String name, Integer line, Integer col, Error *err)
return res;
}
}
- pos_T pos = { line, (int)col, (int)col };
+ assert(INT32_MIN <= line && line <= INT32_MAX);
+ pos_T pos = { (linenr_T)line, (int)col, (int)col };
res = setmark_pos(*name.data, &pos, buf->handle);
if (!res) {
if (deleting) {
@@ -1773,9 +1774,9 @@ void build_cmdline_str(char **cmdlinep, exarg_T *eap, CmdParseInfo *cmdinfo, cha
// Command range / count.
if (eap->argt & EX_RANGE) {
if (eap->addr_count == 1) {
- kv_printf(cmdline, "%ld", eap->line2);
+ kv_printf(cmdline, "%" PRIdLINENR, eap->line2);
} else if (eap->addr_count > 1) {
- kv_printf(cmdline, "%ld,%ld", eap->line1, eap->line2);
+ kv_printf(cmdline, "%" PRIdLINENR ",%" PRIdLINENR, eap->line1, eap->line2);
eap->addr_count = 2; // Make sure address count is not greater than 2
}
}
diff --git a/src/nvim/api/vimscript.c b/src/nvim/api/vimscript.c
index 4b4404ea09..6d0b9c7d99 100644
--- a/src/nvim/api/vimscript.c
+++ b/src/nvim/api/vimscript.c
@@ -1155,8 +1155,8 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error
}
if (range.size > 0) {
- ea.line1 = range.items[0].data.integer;
- ea.line2 = range.items[range.size - 1].data.integer;
+ ea.line1 = (linenr_T)range.items[0].data.integer;
+ ea.line2 = (linenr_T)range.items[range.size - 1].data.integer;
}
if (invalid_range(&ea) != NULL) {
diff --git a/src/nvim/api/win_config.c b/src/nvim/api/win_config.c
index 898d95f49a..969643eeef 100644
--- a/src/nvim/api/win_config.c
+++ b/src/nvim/api/win_config.c
@@ -325,7 +325,7 @@ static bool parse_float_bufpos(Array bufpos, lpos_T *out)
|| bufpos.items[1].type != kObjectTypeInteger) {
return false;
}
- out->lnum = bufpos.items[0].data.integer;
+ out->lnum = (linenr_T)bufpos.items[0].data.integer;
out->col = (colnr_T)bufpos.items[1].data.integer;
return true;
}