mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 22:18:33 +00:00
fix(coverity): dead code and operands don't affect result #17662
* fix(coverity/349942): structurally dead code * fix(coverity/331396): operands don't affect result * fix(coverity/331393): operands don't affect result * fix(coverity/331392): operands don't affect result * fix(coverity/331384): operands don't affect result * fix(coverity/331374): operands don't affect result * fix(coverity/331372): operands don't affect result * fix(coverity/331371): operands don't affect result * fix(coverity/331364): operands don't affect result * fix(coverity/105585): operands don't affect result
This commit is contained in:
@@ -2428,9 +2428,8 @@ char *aucmd_exec_default_desc(AucmdExecutable acc)
|
|||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
abort();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *aucmd_exec_to_string(AutoCmd *ac, AucmdExecutable acc)
|
char *aucmd_exec_to_string(AutoCmd *ac, AucmdExecutable acc)
|
||||||
{
|
{
|
||||||
switch (acc.type) {
|
switch (acc.type) {
|
||||||
|
@@ -630,7 +630,7 @@ static char_u *mark_line(pos_T *mp, int lead_len)
|
|||||||
if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count) {
|
if (mp->lnum == 0 || mp->lnum > curbuf->b_ml.ml_line_count) {
|
||||||
return vim_strsave((char_u *)"-invalid-");
|
return vim_strsave((char_u *)"-invalid-");
|
||||||
}
|
}
|
||||||
assert(Columns >= 0 && (size_t)Columns <= SIZE_MAX);
|
assert(Columns >= 0);
|
||||||
// Allow for up to 5 bytes per character.
|
// Allow for up to 5 bytes per character.
|
||||||
s = vim_strnsave(skipwhite(ml_get(mp->lnum)), (size_t)Columns * 5);
|
s = vim_strnsave(skipwhite(ml_get(mp->lnum)), (size_t)Columns * 5);
|
||||||
|
|
||||||
|
@@ -3568,7 +3568,6 @@ static void nv_zet(cmdarg_T *cap)
|
|||||||
bool undo = false;
|
bool undo = false;
|
||||||
|
|
||||||
int l_p_siso = (int)get_sidescrolloff_value(curwin);
|
int l_p_siso = (int)get_sidescrolloff_value(curwin);
|
||||||
assert(l_p_siso <= INT_MAX);
|
|
||||||
|
|
||||||
if (ascii_isdigit(nchar)) {
|
if (ascii_isdigit(nchar)) {
|
||||||
/*
|
/*
|
||||||
|
@@ -5664,12 +5664,10 @@ void comp_col(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(sc_col >= 0
|
assert(sc_col >= 0
|
||||||
&& INT_MIN + sc_col <= Columns
|
&& INT_MIN + sc_col <= Columns);
|
||||||
&& Columns - sc_col <= INT_MAX);
|
|
||||||
sc_col = Columns - sc_col;
|
sc_col = Columns - sc_col;
|
||||||
assert(ru_col >= 0
|
assert(ru_col >= 0
|
||||||
&& INT_MIN + ru_col <= Columns
|
&& INT_MIN + ru_col <= Columns);
|
||||||
&& Columns - ru_col <= INT_MAX);
|
|
||||||
ru_col = Columns - ru_col;
|
ru_col = Columns - ru_col;
|
||||||
if (sc_col <= 0) { // screen too narrow, will become a mess
|
if (sc_col <= 0) { // screen too narrow, will become a mess
|
||||||
sc_col = 1;
|
sc_col = 1;
|
||||||
|
@@ -289,8 +289,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
|||||||
if (pum_rl) {
|
if (pum_rl) {
|
||||||
pum_width = pum_col - pum_scrollbar + 1;
|
pum_width = pum_col - pum_scrollbar + 1;
|
||||||
} else {
|
} else {
|
||||||
assert(Columns - pum_col - pum_scrollbar >= INT_MIN
|
assert(Columns - pum_col - pum_scrollbar >= 0);
|
||||||
&& Columns - pum_col - pum_scrollbar <= INT_MAX);
|
|
||||||
pum_width = Columns - pum_col - pum_scrollbar;
|
pum_width = Columns - pum_col - pum_scrollbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +355,6 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
|||||||
} else {
|
} else {
|
||||||
pum_col = 0;
|
pum_col = 0;
|
||||||
}
|
}
|
||||||
assert(Columns - 1 >= INT_MIN);
|
|
||||||
pum_width = Columns - 1;
|
pum_width = Columns - 1;
|
||||||
} else {
|
} else {
|
||||||
if (max_width > p_pw) {
|
if (max_width > p_pw) {
|
||||||
@@ -367,8 +365,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
|||||||
if (pum_rl) {
|
if (pum_rl) {
|
||||||
pum_col = max_width - 1;
|
pum_col = max_width - 1;
|
||||||
} else {
|
} else {
|
||||||
assert(Columns - max_width >= INT_MIN
|
assert(Columns - max_width >= 0);
|
||||||
&& Columns - max_width <= INT_MAX);
|
|
||||||
pum_col = Columns - max_width;
|
pum_col = Columns - max_width;
|
||||||
}
|
}
|
||||||
pum_width = max_width - pum_scrollbar;
|
pum_width = max_width - pum_scrollbar;
|
||||||
|
@@ -1475,8 +1475,8 @@ static void tui_guess_size(UI *ui)
|
|||||||
// 1 - look for non-default 'columns' and 'lines' options during startup
|
// 1 - look for non-default 'columns' and 'lines' options during startup
|
||||||
if (data->is_starting && (Columns != DFLT_COLS || Rows != DFLT_ROWS)) {
|
if (data->is_starting && (Columns != DFLT_COLS || Rows != DFLT_ROWS)) {
|
||||||
did_user_set_dimensions = true;
|
did_user_set_dimensions = true;
|
||||||
assert(Columns >= INT_MIN && Columns <= INT_MAX);
|
assert(Columns >= 0);
|
||||||
assert(Rows >= INT_MIN && Rows <= INT_MAX);
|
assert(Rows >= 0);
|
||||||
width = Columns;
|
width = Columns;
|
||||||
height = Rows;
|
height = Rows;
|
||||||
goto end;
|
goto end;
|
||||||
|
Reference in New Issue
Block a user