This commit is contained in:
James McCoy
2017-01-23 23:13:25 -05:00
parent 2fb0a62553
commit 43534cab02
7 changed files with 71 additions and 71 deletions

View File

@@ -970,7 +970,7 @@ eval_to_bool (
emsg_skip--; emsg_skip--;
} }
return (int)retval; return retval;
} }
/// Top level evaluation function, returning a string /// Top level evaluation function, returning a string
@@ -1262,7 +1262,7 @@ int call_vim_function(
* Uses argv[argc] for the function arguments. * Uses argv[argc] for the function arguments.
*/ */
varnumber_T varnumber_T
call_func_retnr ( call_func_retnr(
char_u *func, char_u *func,
int argc, int argc,
const char_u *const *const argv, const char_u *const *const argv,
@@ -3939,7 +3939,7 @@ eval6 (
typval_T var2; typval_T var2;
int op; int op;
varnumber_T n1, n2; varnumber_T n1, n2;
int use_float = FALSE; bool use_float = false;
float_T f1 = 0, f2; float_T f1 = 0, f2;
bool error = false; bool error = false;
@@ -3960,7 +3960,7 @@ eval6 (
if (evaluate) { if (evaluate) {
if (rettv->v_type == VAR_FLOAT) { if (rettv->v_type == VAR_FLOAT) {
f1 = rettv->vval.v_float; f1 = rettv->vval.v_float;
use_float = TRUE; use_float = true;
n1 = 0; n1 = 0;
} else { } else {
n1 = tv_get_number_chk(rettv, &error); n1 = tv_get_number_chk(rettv, &error);
@@ -3984,7 +3984,7 @@ eval6 (
if (var2.v_type == VAR_FLOAT) { if (var2.v_type == VAR_FLOAT) {
if (!use_float) { if (!use_float) {
f1 = n1; f1 = n1;
use_float = TRUE; use_float = true;
} }
f2 = var2.vval.v_float; f2 = var2.vval.v_float;
n2 = 0; n2 = 0;
@@ -4027,18 +4027,20 @@ eval6 (
rettv->v_type = VAR_FLOAT; rettv->v_type = VAR_FLOAT;
rettv->vval.v_float = f1; rettv->vval.v_float = f1;
} else { } else {
if (op == '*') if (op == '*') {
n1 = n1 * n2; n1 = n1 * n2;
else if (op == '/') { } else if (op == '/') {
if (n2 == 0) { /* give an error message? */ if (n2 == 0) { // give an error message?
if (n1 == 0) if (n1 == 0) {
n1 = VARNUMBER_MIN; /* similar to NaN */ n1 = VARNUMBER_MIN; // similar to NaN
else if (n1 < 0) } else if (n1 < 0) {
n1 = -VARNUMBER_MAX; n1 = -VARNUMBER_MAX;
else } else {
n1 = VARNUMBER_MAX; n1 = VARNUMBER_MAX;
} else }
} else {
n1 = n1 / n2; n1 = n1 / n2;
}
} else { } else {
if (n2 == 0) /* give an error message? */ if (n2 == 0) /* give an error message? */
n1 = 0; n1 = 0;

View File

@@ -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] }; const char ubuf[] = { t[1], t[2], t[3], t[4] };
t += 4; t += 4;
uvarnumber_T ch; uvarnumber_T ch;
vim_str2nr((char_u *) ubuf, NULL, NULL, vim_str2nr((char_u *)ubuf, NULL, NULL,
STR2NR_HEX | STR2NR_FORCE, NULL, &ch, 4); STR2NR_HEX | STR2NR_FORCE, NULL, &ch, 4);
if (ch == 0) { if (ch == 0) {
hasnul = true; hasnul = true;

View File

@@ -282,7 +282,7 @@ readfile (
long size = 0; long size = 0;
char_u *p = NULL; char_u *p = NULL;
off_T filesize = 0; off_T filesize = 0;
int skip_read = FALSE; int skip_read = false;
context_sha256_T sha_ctx; context_sha256_T sha_ctx;
int read_undo_file = FALSE; int read_undo_file = FALSE;
int split = 0; /* number of split lines */ int split = 0; /* number of split lines */
@@ -778,8 +778,8 @@ retry:
read_buf_lnum = 1; read_buf_lnum = 1;
read_buf_col = 0; read_buf_col = 0;
} else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) { } else if (read_stdin || vim_lseek(fd, (off_T)0L, SEEK_SET) != 0) {
/* Can't rewind the file, give up. */ // Can't rewind the file, give up.
error = TRUE; error = true;
goto failed; goto failed;
} }
/* Delete the previously read lines. */ /* Delete the previously read lines. */
@@ -1614,19 +1614,16 @@ rewind_retry:
if (fileformat == EOL_DOS) { if (fileformat == EOL_DOS) {
if (ptr[-1] == CAR) { /* remove CR */ if (ptr[-1] == CAR) { /* remove CR */
ptr[-1] = NUL; ptr[-1] = NUL;
--len; len--;
} } else if (ff_error != EOL_DOS) {
/* // Reading in Dos format, but no CR-LF found!
* Reading in Dos format, but no CR-LF found! // When 'fileformats' includes "unix", delete all
* When 'fileformats' includes "unix", delete all // the lines read so far and start all over again.
* the lines read so far and start all over again. // Otherwise give an error message later.
* Otherwise give an error message later. if (try_unix
*/ && !read_stdin
else if (ff_error != EOL_DOS) { && (read_buffer
if ( try_unix || vim_lseek(fd, (off_T)0L, SEEK_SET) == 0)) {
&& !read_stdin
&& (read_buffer
|| vim_lseek(fd, (off_T)0L, SEEK_SET) == 0)) {
fileformat = EOL_UNIX; fileformat = EOL_UNIX;
if (set_options) if (set_options)
set_fileformat(EOL_UNIX, OPT_LOCAL); 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; patcmd.next = active_apc_list;
active_apc_list = &patcmd; 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); save_cmdbang = (long)get_vim_var_nr(VV_CMDBANG);
if (eap != NULL) { if (eap != NULL) {
save_cmdarg = set_cmdarg(eap, NULL); save_cmdarg = set_cmdarg(eap, NULL);

View File

@@ -914,10 +914,11 @@ void ml_recover(void)
msg_end(); msg_end();
goto theend; goto theend;
} }
if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) if ((size = vim_lseek(mfp->mf_fd, (off_T)0L, SEEK_END)) <= 0) {
mfp->mf_blocknr_max = 0; /* no file or empty file */ mfp->mf_blocknr_max = 0; // no file or empty file
else } else {
mfp->mf_blocknr_max = size / mfp->mf_page_size; mfp->mf_blocknr_max = size / mfp->mf_page_size;
}
mfp->mf_infile_count = mfp->mf_blocknr_max; mfp->mf_infile_count = mfp->mf_blocknr_max;
/* need to reallocate the memory used to store the data */ /* need to reallocate the memory used to store the data */

View File

@@ -938,13 +938,11 @@ static int stuff_yank(int regname, char_u *p)
static int execreg_lastc = NUL; static int execreg_lastc = NUL;
/* /// Execute a yank register: copy it into the stuff buffer
* Execute a yank register: copy it into the stuff buffer ///
* /// Return FAIL for failure, OK otherwise
* Return FAIL for failure, OK otherwise int
*/ do_execreg(
int
do_execreg (
int regname, int regname,
int colon, /* insert ':' before each line */ int colon, /* insert ':' before each line */
int addcr, /* always add '\n' to end of 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; oldn = n;
n = subtract ? n - (uvarnumber_T) Prenum1 n = subtract ? n - (uvarnumber_T)Prenum1
: n + (uvarnumber_T) Prenum1; : n + (uvarnumber_T)Prenum1;
// handle wraparound for decimal numbers // handle wraparound for decimal numbers
if (!pre) { if (!pre) {
@@ -5397,15 +5395,16 @@ void cursor_pos_info(dict_T *dict)
if (lnum == curwin->w_cursor.lnum) { if (lnum == curwin->w_cursor.lnum) {
word_count_cursor += word_count; word_count_cursor += word_count;
char_count_cursor += char_count; char_count_cursor += char_count;
byte_count_cursor = byte_count + byte_count_cursor = byte_count
line_count_info(ml_get(lnum), + line_count_info(ml_get(lnum), &word_count_cursor,
&word_count_cursor, &char_count_cursor, &char_count_cursor,
(varnumber_T)(curwin->w_cursor.col + 1), eol_size); (varnumber_T)(curwin->w_cursor.col + 1),
eol_size);
} }
} }
/* Add to the running totals */ // Add to the running totals
byte_count += line_count_info(ml_get(lnum), &word_count, byte_count += line_count_info(ml_get(lnum), &word_count, &char_count,
&char_count, (varnumber_T)MAXCOL, eol_size); (varnumber_T)MAXCOL, eol_size);
} }
// Correction for when last line doesn't have an EOL. // Correction for when last line doesn't have an EOL.

View File

@@ -4630,7 +4630,7 @@ get_option_value (
if ((int *)varp == &curbuf->b_changed) { if ((int *)varp == &curbuf->b_changed) {
*numval = curbufIsChanged(); *numval = curbufIsChanged();
} else { } else {
*numval = (long) *(int *)varp; *numval = (long) *(int *)varp; // NOLINT(whitespace/cast)
} }
} }
return 1; return 1;

View File

@@ -1079,18 +1079,17 @@ find_tags (
char_u *p; char_u *p;
char_u *s; char_u *s;
int i; int i;
int tag_file_sorted = NUL; /* !_TAG_FILE_SORTED value */ int tag_file_sorted = NUL; // !_TAG_FILE_SORTED value
struct tag_search_info /* Binary search file offsets */ struct tag_search_info { // Binary search file offsets
{ off_T low_offset; // offset for first char of first line that
off_T low_offset; /* offset for first char of first line that // could match
could match */ off_T high_offset; // offset of char after last line that could
off_T high_offset; /* offset of char after last line that could // match
match */ off_T curr_offset; // Current file offset in search range
off_T curr_offset; /* Current file offset in search range */ off_T curr_offset_used; // curr_offset used when skipping back
off_T curr_offset_used; /* curr_offset used when skipping back */ off_T match_offset; // Where the binary search found a tag
off_T match_offset; /* Where the binary search found a tag */ int low_char; // first char at low_offset
int low_char; /* first char at low_offset */ int high_char; // first char at high_offset
int high_char; /* first char at high_offset */
} search_info; } search_info;
off_T filesize; off_T filesize;
int tagcmp; int tagcmp;
@@ -1376,7 +1375,7 @@ find_tags (
* (repeated below). */ * (repeated below). */
search_info.curr_offset = vim_ftell(fp); search_info.curr_offset = vim_ftell(fp);
if (search_info.curr_offset == search_info.high_offset) { 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); vim_fseek(fp, search_info.low_offset, SEEK_SET);
search_info.curr_offset = search_info.low_offset; search_info.curr_offset = search_info.low_offset;
} }
@@ -1662,10 +1661,11 @@ parse_line:
} else if (state == TS_STEP_FORWARD) { } else if (state == TS_STEP_FORWARD) {
assert(cmplen >= 0); assert(cmplen >= 0);
if (mb_strnicmp(tagp.tagname, orgpat.head, (size_t)cmplen) != 0) { if (mb_strnicmp(tagp.tagname, orgpat.head, (size_t)cmplen) != 0) {
if ((off_T)vim_ftell(fp) > search_info.match_offset) if ((off_T)vim_ftell(fp) > search_info.match_offset) {
break; /* past last match */ break; // past last match
else } else {
continue; /* before first match */ continue; // before first match
}
} }
} else } else
/* skip this match if it can't match */ /* skip this match if it can't match */
@@ -1886,10 +1886,11 @@ parse_line:
if (line_error) { if (line_error) {
EMSG2(_("E431: Format error in tags file \"%s\""), tag_fname); EMSG2(_("E431: Format error in tags file \"%s\""), tag_fname);
if (!use_cscope) if (!use_cscope) {
EMSGN(_("Before byte %" PRId64), vim_ftell(fp)); EMSGN(_("Before byte %" PRId64), vim_ftell(fp));
stop_searching = TRUE; }
line_error = FALSE; stop_searching = true;
line_error = false;
} }
if (!use_cscope) if (!use_cscope)