aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/api/private')
-rw-r--r--src/nvim/api/private/converter.c3
-rw-r--r--src/nvim/api/private/helpers.c8
2 files changed, 5 insertions, 6 deletions
diff --git a/src/nvim/api/private/converter.c b/src/nvim/api/private/converter.c
index a70ef1e50b..a78d78c057 100644
--- a/src/nvim/api/private/converter.c
+++ b/src/nvim/api/private/converter.c
@@ -76,8 +76,7 @@ static Object typval_cbuf_to_obj(EncodedData *edata, const char *data, size_t le
do { \
ufunc_T *fp = find_func(fun); \
if (fp != NULL && (fp->uf_flags & FC_LUAREF)) { \
- LuaRef ref = api_new_luaref(fp->uf_luaref); \
- kvi_push(edata->stack, LUAREF_OBJ(ref)); \
+ kvi_push(edata->stack, LUAREF_OBJ(api_new_luaref(fp->uf_luaref))); \
} else { \
TYPVAL_ENCODE_CONV_NIL(tv); \
} \
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 1cd98aa0c4..a17e78cc31 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -524,10 +524,10 @@ String buf_get_text(buf_T *buf, int64_t lnum, int64_t start_col, int64_t end_col
}
char *bufstr = ml_get_buf(buf, (linenr_T)lnum);
- size_t line_length = strlen(bufstr);
+ colnr_T line_length = ml_get_buf_len(buf, (linenr_T)lnum);
- start_col = start_col < 0 ? (int64_t)line_length + start_col + 1 : start_col;
- end_col = end_col < 0 ? (int64_t)line_length + end_col + 1 : end_col;
+ start_col = start_col < 0 ? line_length + start_col + 1 : start_col;
+ end_col = end_col < 0 ? line_length + end_col + 1 : end_col;
if (start_col >= MAXCOL || end_col >= MAXCOL) {
api_set_error(err, kErrorTypeValidation, "Column index is too high");
@@ -539,7 +539,7 @@ String buf_get_text(buf_T *buf, int64_t lnum, int64_t start_col, int64_t end_col
return rv;
}
- if ((size_t)start_col >= line_length) {
+ if (start_col >= line_length) {
return rv;
}