mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +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:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
abort();
|
||||
}
|
||||
|
||||
char *aucmd_exec_to_string(AutoCmd *ac, AucmdExecutable acc)
|
||||
{
|
||||
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) {
|
||||
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.
|
||||
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;
|
||||
|
||||
int l_p_siso = (int)get_sidescrolloff_value(curwin);
|
||||
assert(l_p_siso <= INT_MAX);
|
||||
|
||||
if (ascii_isdigit(nchar)) {
|
||||
/*
|
||||
|
@@ -5664,12 +5664,10 @@ void comp_col(void)
|
||||
}
|
||||
}
|
||||
assert(sc_col >= 0
|
||||
&& INT_MIN + sc_col <= Columns
|
||||
&& Columns - sc_col <= INT_MAX);
|
||||
&& INT_MIN + sc_col <= Columns);
|
||||
sc_col = Columns - sc_col;
|
||||
assert(ru_col >= 0
|
||||
&& INT_MIN + ru_col <= Columns
|
||||
&& Columns - ru_col <= INT_MAX);
|
||||
&& INT_MIN + ru_col <= Columns);
|
||||
ru_col = Columns - ru_col;
|
||||
if (sc_col <= 0) { // screen too narrow, will become a mess
|
||||
sc_col = 1;
|
||||
|
@@ -289,8 +289,7 @@ void pum_display(pumitem_T *array, int size, int selected, bool array_changed, i
|
||||
if (pum_rl) {
|
||||
pum_width = pum_col - pum_scrollbar + 1;
|
||||
} else {
|
||||
assert(Columns - pum_col - pum_scrollbar >= INT_MIN
|
||||
&& Columns - pum_col - pum_scrollbar <= INT_MAX);
|
||||
assert(Columns - pum_col - pum_scrollbar >= 0);
|
||||
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 {
|
||||
pum_col = 0;
|
||||
}
|
||||
assert(Columns - 1 >= INT_MIN);
|
||||
pum_width = Columns - 1;
|
||||
} else {
|
||||
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) {
|
||||
pum_col = max_width - 1;
|
||||
} else {
|
||||
assert(Columns - max_width >= INT_MIN
|
||||
&& Columns - max_width <= INT_MAX);
|
||||
assert(Columns - max_width >= 0);
|
||||
pum_col = Columns - max_width;
|
||||
}
|
||||
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
|
||||
if (data->is_starting && (Columns != DFLT_COLS || Rows != DFLT_ROWS)) {
|
||||
did_user_set_dimensions = true;
|
||||
assert(Columns >= INT_MIN && Columns <= INT_MAX);
|
||||
assert(Rows >= INT_MIN && Rows <= INT_MAX);
|
||||
assert(Columns >= 0);
|
||||
assert(Rows >= 0);
|
||||
width = Columns;
|
||||
height = Rows;
|
||||
goto end;
|
||||
|
Reference in New Issue
Block a user