diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/api/vim.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 5 | ||||
-rw-r--r-- | src/nvim/ex_getln.c | 5 | ||||
-rw-r--r-- | src/nvim/fileio.c | 2 | ||||
-rw-r--r-- | src/nvim/message.c | 4 | ||||
-rw-r--r-- | src/nvim/mouse.c | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 2 | ||||
-rw-r--r-- | src/nvim/screen.c | 1 |
8 files changed, 13 insertions, 10 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 9dde62f0ee..787b6addc9 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -2960,7 +2960,7 @@ void nvim_set_decoration_provider(Integer ns_id, DictionaryOf(LuaRef) opts, String k = opts.items[i].key; Object *v = &opts.items[i].value; size_t j; - for (j = 0; cbs[j].name; j++) { + for (j = 0; cbs[j].name && cbs[j].dest; j++) { if (strequal(cbs[j].name, k.data)) { if (v->type != kObjectTypeLuaRef) { api_set_error(err, kErrorTypeValidation, diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index c4c18c4324..cc0ec71627 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2535,7 +2535,7 @@ void ex_source(exarg_T *eap) static void cmd_source(char_u *fname, exarg_T *eap) { - if (*fname == NUL) { + if (eap != NULL && *fname == NUL) { cmd_source_buffer(eap); } else if (eap != NULL && eap->forceit) { // ":source!": read Normal mode commands @@ -2575,7 +2575,8 @@ static char_u *get_buffer_line(int c, void *cookie, int indent, bool do_concat) return (char_u *)xstrdup((const char *)curr_line); } -static void cmd_source_buffer(exarg_T *eap) +static void cmd_source_buffer(const exarg_T *eap) + FUNC_ATTR_NONNULL_ALL { GetBufferLineCookie cookie = { .curr_lnum = eap->line1, diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c index 76df01c205..38385d19b2 100644 --- a/src/nvim/ex_getln.c +++ b/src/nvim/ex_getln.c @@ -4093,9 +4093,10 @@ ExpandOne ( } if (mode == WILD_CANCEL) { - ss = vim_strsave(orig_save); + ss = vim_strsave(orig_save ? orig_save : (char_u *)""); } else if (mode == WILD_APPLY) { - ss = vim_strsave(findex == -1 ? orig_save : xp->xp_files[findex]); + ss = vim_strsave(findex == -1 ? (orig_save ? orig_save : (char_u *)"") : + xp->xp_files[findex]); } /* free old names */ diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 714bbb5780..65bd809436 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -4280,7 +4280,7 @@ char *modname(const char *fname, const char *ext, bool prepend_dot) if (fname == NULL || *fname == NUL) { retval = xmalloc(MAXPATHL + extlen + 3); // +3 for PATHSEP, "_" (Win), NUL if (os_dirname((char_u *)retval, MAXPATHL) == FAIL - || (fnamelen = strlen(retval)) == 0) { + || strlen(retval) == 0) { xfree(retval); return NULL; } diff --git a/src/nvim/message.c b/src/nvim/message.c index dea6696f55..7c98d3c6b5 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -869,18 +869,18 @@ char_u *msg_trunc_attr(char_u *s, int force, int attr) */ char_u *msg_may_trunc(int force, char_u *s) { - int n; int room; room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1; if ((force || (shortmess(SHM_TRUNC) && !exmode_active)) - && (n = (int)STRLEN(s) - room) > 0) { + && (int)STRLEN(s) - room > 0) { int size = vim_strsize(s); // There may be room anyway when there are multibyte chars. if (size <= room) { return s; } + int n; for (n = 0; size >= room; ) { size -= utf_ptr2cells(s + n); n += utfc_ptr2len(s + n); diff --git a/src/nvim/mouse.c b/src/nvim/mouse.c index fa9787a3ac..4c0339e5f4 100644 --- a/src/nvim/mouse.c +++ b/src/nvim/mouse.c @@ -748,7 +748,7 @@ int mouse_check_fold(void) } } - if (mouse_char == wp->w_p_fcs_chars.foldclosed) { + if (wp && mouse_char == wp->w_p_fcs_chars.foldclosed) { return MOUSE_FOLD_OPEN; } else if (mouse_char != ' ') { return MOUSE_FOLD_CLOSE; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 2d351f4dba..2cd71f2360 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -2807,7 +2807,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags) size_t y_size; size_t oldlen; int y_width = 0; - colnr_T vcol; + colnr_T vcol = 0; int delcount; int incr = 0; struct block_def bd; diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 760a54a316..5bf5a471c1 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -3154,6 +3154,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, mb_utf8 = false; } } else { + assert(p_extra != NULL); c = *p_extra; mb_c = c; // If the UTF-8 character is more than one byte: |