mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #14273 from janlazo/clang-warnings
clang: resolve logic error and dead store warnings
This commit is contained in:
commit
cf6c23fb0f
@ -2960,7 +2960,7 @@ void nvim_set_decoration_provider(Integer ns_id, DictionaryOf(LuaRef) opts,
|
|||||||
String k = opts.items[i].key;
|
String k = opts.items[i].key;
|
||||||
Object *v = &opts.items[i].value;
|
Object *v = &opts.items[i].value;
|
||||||
size_t j;
|
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 (strequal(cbs[j].name, k.data)) {
|
||||||
if (v->type != kObjectTypeLuaRef) {
|
if (v->type != kObjectTypeLuaRef) {
|
||||||
api_set_error(err, kErrorTypeValidation,
|
api_set_error(err, kErrorTypeValidation,
|
||||||
|
@ -2535,7 +2535,7 @@ void ex_source(exarg_T *eap)
|
|||||||
|
|
||||||
static void cmd_source(char_u *fname, 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);
|
cmd_source_buffer(eap);
|
||||||
} else if (eap != NULL && eap->forceit) {
|
} else if (eap != NULL && eap->forceit) {
|
||||||
// ":source!": read Normal mode commands
|
// ":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);
|
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 = {
|
GetBufferLineCookie cookie = {
|
||||||
.curr_lnum = eap->line1,
|
.curr_lnum = eap->line1,
|
||||||
|
@ -4093,9 +4093,10 @@ ExpandOne (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mode == WILD_CANCEL) {
|
if (mode == WILD_CANCEL) {
|
||||||
ss = vim_strsave(orig_save);
|
ss = vim_strsave(orig_save ? orig_save : (char_u *)"");
|
||||||
} else if (mode == WILD_APPLY) {
|
} 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 */
|
/* free old names */
|
||||||
|
@ -4280,7 +4280,7 @@ char *modname(const char *fname, const char *ext, bool prepend_dot)
|
|||||||
if (fname == NULL || *fname == NUL) {
|
if (fname == NULL || *fname == NUL) {
|
||||||
retval = xmalloc(MAXPATHL + extlen + 3); // +3 for PATHSEP, "_" (Win), NUL
|
retval = xmalloc(MAXPATHL + extlen + 3); // +3 for PATHSEP, "_" (Win), NUL
|
||||||
if (os_dirname((char_u *)retval, MAXPATHL) == FAIL
|
if (os_dirname((char_u *)retval, MAXPATHL) == FAIL
|
||||||
|| (fnamelen = strlen(retval)) == 0) {
|
|| strlen(retval) == 0) {
|
||||||
xfree(retval);
|
xfree(retval);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -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)
|
char_u *msg_may_trunc(int force, char_u *s)
|
||||||
{
|
{
|
||||||
int n;
|
|
||||||
int room;
|
int room;
|
||||||
|
|
||||||
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
|
room = (int)(Rows - cmdline_row - 1) * Columns + sc_col - 1;
|
||||||
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
|
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
|
||||||
&& (n = (int)STRLEN(s) - room) > 0) {
|
&& (int)STRLEN(s) - room > 0) {
|
||||||
int size = vim_strsize(s);
|
int size = vim_strsize(s);
|
||||||
|
|
||||||
// There may be room anyway when there are multibyte chars.
|
// There may be room anyway when there are multibyte chars.
|
||||||
if (size <= room) {
|
if (size <= room) {
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
int n;
|
||||||
for (n = 0; size >= room; ) {
|
for (n = 0; size >= room; ) {
|
||||||
size -= utf_ptr2cells(s + n);
|
size -= utf_ptr2cells(s + n);
|
||||||
n += utfc_ptr2len(s + n);
|
n += utfc_ptr2len(s + n);
|
||||||
|
@ -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;
|
return MOUSE_FOLD_OPEN;
|
||||||
} else if (mouse_char != ' ') {
|
} else if (mouse_char != ' ') {
|
||||||
return MOUSE_FOLD_CLOSE;
|
return MOUSE_FOLD_CLOSE;
|
||||||
|
@ -2807,7 +2807,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
|
|||||||
size_t y_size;
|
size_t y_size;
|
||||||
size_t oldlen;
|
size_t oldlen;
|
||||||
int y_width = 0;
|
int y_width = 0;
|
||||||
colnr_T vcol;
|
colnr_T vcol = 0;
|
||||||
int delcount;
|
int delcount;
|
||||||
int incr = 0;
|
int incr = 0;
|
||||||
struct block_def bd;
|
struct block_def bd;
|
||||||
|
@ -3154,6 +3154,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow,
|
|||||||
mb_utf8 = false;
|
mb_utf8 = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
assert(p_extra != NULL);
|
||||||
c = *p_extra;
|
c = *p_extra;
|
||||||
mb_c = c;
|
mb_c = c;
|
||||||
// If the UTF-8 character is more than one byte:
|
// If the UTF-8 character is more than one byte:
|
||||||
|
Loading…
Reference in New Issue
Block a user