mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 11:15:14 -07:00
lint
This commit is contained in:
parent
2fb0a62553
commit
43534cab02
@ -970,7 +970,7 @@ eval_to_bool (
|
||||
emsg_skip--;
|
||||
}
|
||||
|
||||
return (int)retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/// Top level evaluation function, returning a string
|
||||
@ -1262,7 +1262,7 @@ int call_vim_function(
|
||||
* Uses argv[argc] for the function arguments.
|
||||
*/
|
||||
varnumber_T
|
||||
call_func_retnr (
|
||||
call_func_retnr(
|
||||
char_u *func,
|
||||
int argc,
|
||||
const char_u *const *const argv,
|
||||
@ -3939,7 +3939,7 @@ eval6 (
|
||||
typval_T var2;
|
||||
int op;
|
||||
varnumber_T n1, n2;
|
||||
int use_float = FALSE;
|
||||
bool use_float = false;
|
||||
float_T f1 = 0, f2;
|
||||
bool error = false;
|
||||
|
||||
@ -3960,7 +3960,7 @@ eval6 (
|
||||
if (evaluate) {
|
||||
if (rettv->v_type == VAR_FLOAT) {
|
||||
f1 = rettv->vval.v_float;
|
||||
use_float = TRUE;
|
||||
use_float = true;
|
||||
n1 = 0;
|
||||
} else {
|
||||
n1 = tv_get_number_chk(rettv, &error);
|
||||
@ -3984,7 +3984,7 @@ eval6 (
|
||||
if (var2.v_type == VAR_FLOAT) {
|
||||
if (!use_float) {
|
||||
f1 = n1;
|
||||
use_float = TRUE;
|
||||
use_float = true;
|
||||
}
|
||||
f2 = var2.vval.v_float;
|
||||
n2 = 0;
|
||||
@ -4027,18 +4027,20 @@ eval6 (
|
||||
rettv->v_type = VAR_FLOAT;
|
||||
rettv->vval.v_float = f1;
|
||||
} else {
|
||||
if (op == '*')
|
||||
if (op == '*') {
|
||||
n1 = n1 * n2;
|
||||
else if (op == '/') {
|
||||
if (n2 == 0) { /* give an error message? */
|
||||
if (n1 == 0)
|
||||
n1 = VARNUMBER_MIN; /* similar to NaN */
|
||||
else if (n1 < 0)
|
||||
} else if (op == '/') {
|
||||
if (n2 == 0) { // give an error message?
|
||||
if (n1 == 0) {
|
||||
n1 = VARNUMBER_MIN; // similar to NaN
|
||||
} else if (n1 < 0) {
|
||||
n1 = -VARNUMBER_MAX;
|
||||
else
|
||||
} else {
|
||||
n1 = VARNUMBER_MAX;
|
||||
} else
|
||||
}
|
||||
} else {
|
||||
n1 = n1 / n2;
|
||||
}
|
||||
} else {
|
||||
if (n2 == 0) /* give an error message? */
|
||||
n1 = 0;
|
||||
|
@ -436,7 +436,7 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
|
||||
const char ubuf[] = { t[1], t[2], t[3], t[4] };
|
||||
t += 4;
|
||||
uvarnumber_T ch;
|
||||
vim_str2nr((char_u *) ubuf, NULL, NULL,
|
||||
vim_str2nr((char_u *)ubuf, NULL, NULL,
|
||||
STR2NR_HEX | STR2NR_FORCE, NULL, &ch, 4);
|
||||
if (ch == 0) {
|
||||
hasnul = true;
|
||||
|
@ -282,7 +282,7 @@ readfile (
|
||||
long size = 0;
|
||||
char_u *p = NULL;
|
||||
off_T filesize = 0;
|
||||
int skip_read = FALSE;
|
||||
int skip_read = false;
|
||||
context_sha256_T sha_ctx;
|
||||
int read_undo_file = FALSE;
|
||||
int split = 0; /* number of split lines */
|
||||
@ -778,8 +778,8 @@ retry:
|
||||
read_buf_lnum = 1;
|
||||
read_buf_col = 0;
|
||||
} else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) {
|
||||
/* Can't rewind the file, give up. */
|
||||
error = TRUE;
|
||||
// Can't rewind the file, give up.
|
||||
error = true;
|
||||
goto failed;
|
||||
}
|
||||
/* Delete the previously read lines. */
|
||||
@ -1614,19 +1614,16 @@ rewind_retry:
|
||||
if (fileformat == EOL_DOS) {
|
||||
if (ptr[-1] == CAR) { /* remove CR */
|
||||
ptr[-1] = NUL;
|
||||
--len;
|
||||
}
|
||||
/*
|
||||
* Reading in Dos format, but no CR-LF found!
|
||||
* When 'fileformats' includes "unix", delete all
|
||||
* the lines read so far and start all over again.
|
||||
* Otherwise give an error message later.
|
||||
*/
|
||||
else if (ff_error != EOL_DOS) {
|
||||
if ( try_unix
|
||||
&& !read_stdin
|
||||
&& (read_buffer
|
||||
|| vim_lseek(fd, (off_T)0L, SEEK_SET) == 0)) {
|
||||
len--;
|
||||
} else if (ff_error != EOL_DOS) {
|
||||
// Reading in Dos format, but no CR-LF found!
|
||||
// When 'fileformats' includes "unix", delete all
|
||||
// the lines read so far and start all over again.
|
||||
// Otherwise give an error message later.
|
||||
if (try_unix
|
||||
&& !read_stdin
|
||||
&& (read_buffer
|
||||
|| vim_lseek(fd, (off_T)0L, SEEK_SET) == 0)) {
|
||||
fileformat = EOL_UNIX;
|
||||
if (set_options)
|
||||
set_fileformat(EOL_UNIX, OPT_LOCAL);
|
||||
@ -6870,7 +6867,7 @@ static bool apply_autocmds_group(event_T event, char_u *fname, char_u *fname_io,
|
||||
patcmd.next = active_apc_list;
|
||||
active_apc_list = &patcmd;
|
||||
|
||||
/* set v:cmdarg (only when there is a matching pattern) */
|
||||
// set v:cmdarg (only when there is a matching pattern)
|
||||
save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG);
|
||||
if (eap != NULL) {
|
||||
save_cmdarg = set_cmdarg(eap, NULL);
|
||||
|
@ -914,10 +914,11 @@ void ml_recover(void)
|
||||
msg_end();
|
||||
goto theend;
|
||||
}
|
||||
if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0)
|
||||
mfp->mf_blocknr_max = 0; /* no file or empty file */
|
||||
else
|
||||
if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) {
|
||||
mfp->mf_blocknr_max = 0; // no file or empty file
|
||||
} else {
|
||||
mfp->mf_blocknr_max = size / mfp->mf_page_size;
|
||||
}
|
||||
mfp->mf_infile_count = mfp->mf_blocknr_max;
|
||||
|
||||
/* need to reallocate the memory used to store the data */
|
||||
|
@ -938,13 +938,11 @@ static int stuff_yank(int regname, char_u *p)
|
||||
|
||||
static int execreg_lastc = NUL;
|
||||
|
||||
/*
|
||||
* Execute a yank register: copy it into the stuff buffer
|
||||
*
|
||||
* Return FAIL for failure, OK otherwise
|
||||
*/
|
||||
int
|
||||
do_execreg (
|
||||
/// Execute a yank register: copy it into the stuff buffer
|
||||
///
|
||||
/// Return FAIL for failure, OK otherwise
|
||||
int
|
||||
do_execreg(
|
||||
int regname,
|
||||
int colon, /* insert ':' before each line */
|
||||
int addcr, /* always add '\n' to end of line */
|
||||
@ -4635,8 +4633,8 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
||||
|
||||
oldn = n;
|
||||
|
||||
n = subtract ? n - (uvarnumber_T) Prenum1
|
||||
: n + (uvarnumber_T) Prenum1;
|
||||
n = subtract ? n - (uvarnumber_T)Prenum1
|
||||
: n + (uvarnumber_T)Prenum1;
|
||||
|
||||
// handle wraparound for decimal numbers
|
||||
if (!pre) {
|
||||
@ -5397,15 +5395,16 @@ void cursor_pos_info(dict_T *dict)
|
||||
if (lnum == curwin->w_cursor.lnum) {
|
||||
word_count_cursor += word_count;
|
||||
char_count_cursor += char_count;
|
||||
byte_count_cursor = byte_count +
|
||||
line_count_info(ml_get(lnum),
|
||||
&word_count_cursor, &char_count_cursor,
|
||||
(varnumber_T)(curwin->w_cursor.col + 1), eol_size);
|
||||
byte_count_cursor = byte_count
|
||||
+ line_count_info(ml_get(lnum), &word_count_cursor,
|
||||
&char_count_cursor,
|
||||
(varnumber_T)(curwin->w_cursor.col + 1),
|
||||
eol_size);
|
||||
}
|
||||
}
|
||||
/* Add to the running totals */
|
||||
byte_count += line_count_info(ml_get(lnum), &word_count,
|
||||
&char_count, (varnumber_T)MAXCOL, eol_size);
|
||||
// Add to the running totals
|
||||
byte_count += line_count_info(ml_get(lnum), &word_count, &char_count,
|
||||
(varnumber_T)MAXCOL, eol_size);
|
||||
}
|
||||
|
||||
// Correction for when last line doesn't have an EOL.
|
||||
|
@ -4630,7 +4630,7 @@ get_option_value (
|
||||
if ((int *)varp == &curbuf->b_changed) {
|
||||
*numval = curbufIsChanged();
|
||||
} else {
|
||||
*numval = (long) *(int *)varp;
|
||||
*numval = (long) *(int *)varp; // NOLINT(whitespace/cast)
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
|
@ -1079,18 +1079,17 @@ find_tags (
|
||||
char_u *p;
|
||||
char_u *s;
|
||||
int i;
|
||||
int tag_file_sorted = NUL; /* !_TAG_FILE_SORTED value */
|
||||
struct tag_search_info /* Binary search file offsets */
|
||||
{
|
||||
off_T low_offset; /* offset for first char of first line that
|
||||
could match */
|
||||
off_T high_offset; /* offset of char after last line that could
|
||||
match */
|
||||
off_T curr_offset; /* Current file offset in search range */
|
||||
off_T curr_offset_used; /* curr_offset used when skipping back */
|
||||
off_T match_offset; /* Where the binary search found a tag */
|
||||
int low_char; /* first char at low_offset */
|
||||
int high_char; /* first char at high_offset */
|
||||
int tag_file_sorted = NUL; // !_TAG_FILE_SORTED value
|
||||
struct tag_search_info { // Binary search file offsets
|
||||
off_T low_offset; // offset for first char of first line that
|
||||
// could match
|
||||
off_T high_offset; // offset of char after last line that could
|
||||
// match
|
||||
off_T curr_offset; // Current file offset in search range
|
||||
off_T curr_offset_used; // curr_offset used when skipping back
|
||||
off_T match_offset; // Where the binary search found a tag
|
||||
int low_char; // first char at low_offset
|
||||
int high_char; // first char at high_offset
|
||||
} search_info;
|
||||
off_T filesize;
|
||||
int tagcmp;
|
||||
@ -1376,7 +1375,7 @@ find_tags (
|
||||
* (repeated below). */
|
||||
search_info.curr_offset = vim_ftell(fp);
|
||||
if (search_info.curr_offset == search_info.high_offset) {
|
||||
/* oops, gone a bit too far; try from low offset */
|
||||
// oops, gone a bit too far; try from low offset
|
||||
vim_fseek(fp, search_info.low_offset, SEEK_SET);
|
||||
search_info.curr_offset = search_info.low_offset;
|
||||
}
|
||||
@ -1662,10 +1661,11 @@ parse_line:
|
||||
} else if (state == TS_STEP_FORWARD) {
|
||||
assert(cmplen >= 0);
|
||||
if (mb_strnicmp(tagp.tagname, orgpat.head, (size_t)cmplen) != 0) {
|
||||
if ((off_T)vim_ftell(fp) > search_info.match_offset)
|
||||
break; /* past last match */
|
||||
else
|
||||
continue; /* before first match */
|
||||
if ((off_T)vim_ftell(fp) > search_info.match_offset) {
|
||||
break; // past last match
|
||||
} else {
|
||||
continue; // before first match
|
||||
}
|
||||
}
|
||||
} else
|
||||
/* skip this match if it can't match */
|
||||
@ -1886,10 +1886,11 @@ parse_line:
|
||||
|
||||
if (line_error) {
|
||||
EMSG2(_("E431: Format error in tags file \"%s\""), tag_fname);
|
||||
if (!use_cscope)
|
||||
if (!use_cscope) {
|
||||
EMSGN(_("Before byte %" PRId64), vim_ftell(fp));
|
||||
stop_searching = TRUE;
|
||||
line_error = FALSE;
|
||||
}
|
||||
stop_searching = true;
|
||||
line_error = false;
|
||||
}
|
||||
|
||||
if (!use_cscope)
|
||||
|
Loading…
Reference in New Issue
Block a user