mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
*: Fix linter errors
This commit is contained in:
parent
efa2682e3b
commit
095e6cc2e0
105
src/nvim/eval.c
105
src/nvim/eval.c
@ -1755,7 +1755,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
|
||||
// get_name_len() takes care of expanding curly braces
|
||||
name_start = name = arg;
|
||||
char *tofree;
|
||||
len = get_name_len(&arg, &tofree, TRUE, TRUE);
|
||||
len = get_name_len(&arg, &tofree, true, true);
|
||||
if (len <= 0) {
|
||||
/* This is mainly to keep test 49 working: when expanding
|
||||
* curly braces fails overrule the exception error message. */
|
||||
@ -1775,7 +1775,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
|
||||
} else {
|
||||
// handle d.key, l[idx], f(expr)
|
||||
const char *const arg_subsc = arg;
|
||||
if (handle_subscript(&arg, &tv, TRUE, TRUE) == FAIL) {
|
||||
if (handle_subscript(&arg, &tv, true, true) == FAIL) {
|
||||
error = true;
|
||||
} else {
|
||||
if (arg == arg_subsc && len == 2 && name[1] == ':') {
|
||||
@ -1844,15 +1844,15 @@ ex_let_one (
|
||||
++arg;
|
||||
name = arg;
|
||||
len = get_env_len(&arg);
|
||||
if (len == 0)
|
||||
if (len == 0) {
|
||||
EMSG2(_(e_invarg2), name - 1);
|
||||
else {
|
||||
if (op != NULL && (*op == '+' || *op == '-'))
|
||||
} else {
|
||||
if (op != NULL && (*op == '+' || *op == '-')) {
|
||||
EMSG2(_(e_letwrong), op);
|
||||
else if (endchars != NULL
|
||||
&& vim_strchr(endchars, *skipwhite(arg)) == NULL)
|
||||
} else if (endchars != NULL
|
||||
&& vim_strchr(endchars, *skipwhite(arg)) == NULL) {
|
||||
EMSG(_(e_letunexp));
|
||||
else if (!check_secure()) {
|
||||
} else if (!check_secure()) {
|
||||
const char_u c1 = name[len];
|
||||
name[len] = NUL;
|
||||
char_u *p = get_tv_string_chk(tv);
|
||||
@ -1904,15 +1904,16 @@ ex_let_one (
|
||||
if (s != NULL && op != NULL && *op != '=') {
|
||||
opt_type = get_option_value(arg, &numval, &stringval, opt_flags);
|
||||
if ((opt_type == 1 && *op == '.')
|
||||
|| (opt_type == 0 && *op != '.'))
|
||||
|| (opt_type == 0 && *op != '.')) {
|
||||
EMSG2(_(e_letwrong), op);
|
||||
else {
|
||||
if (opt_type == 1) { /* number */
|
||||
if (*op == '+')
|
||||
} else {
|
||||
if (opt_type == 1) { // number
|
||||
if (*op == '+') {
|
||||
n = numval + n;
|
||||
else
|
||||
} else {
|
||||
n = numval - n;
|
||||
} else if (opt_type == 0 && stringval != NULL) { /* string */
|
||||
}
|
||||
} else if (opt_type == 0 && stringval != NULL) { // string
|
||||
s = concat_str(stringval, s);
|
||||
xfree(stringval);
|
||||
stringval = s;
|
||||
@ -1963,7 +1964,7 @@ ex_let_one (
|
||||
else if (eval_isnamec1(*arg) || *arg == '{') {
|
||||
lval_T lv;
|
||||
|
||||
char_u *const p = get_lval(arg, tv, &lv, FALSE, FALSE, 0, FNE_CHECK_START);
|
||||
char_u *const p = get_lval(arg, tv, &lv, false, false, 0, FNE_CHECK_START);
|
||||
if (p != NULL && lv.ll_name != NULL) {
|
||||
if (endchars != NULL && vim_strchr(endchars, *skipwhite(p)) == NULL)
|
||||
EMSG(_(e_letunexp));
|
||||
@ -2075,8 +2076,9 @@ get_lval (
|
||||
*p = NUL;
|
||||
v = find_var((const char *)lp->ll_name, STRLEN(lp->ll_name), &ht,
|
||||
flags & GLV_NO_AUTOLOAD);
|
||||
if (v == NULL && !quiet)
|
||||
if (v == NULL && !quiet) {
|
||||
EMSG2(_(e_undefvar), lp->ll_name);
|
||||
}
|
||||
*p = cc;
|
||||
if (v == NULL)
|
||||
return NULL;
|
||||
@ -2850,9 +2852,10 @@ void ex_call(exarg_T *eap)
|
||||
break;
|
||||
}
|
||||
|
||||
/* Handle a function returning a Funcref, Dictionary or List. */
|
||||
if (handle_subscript((const char **)&arg, &rettv, !eap->skip, TRUE) == FAIL) {
|
||||
failed = TRUE;
|
||||
// Handle a function returning a Funcref, Dictionary or List.
|
||||
if (handle_subscript((const char **)&arg, &rettv, !eap->skip, true)
|
||||
== FAIL) {
|
||||
failed = true;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3113,18 +3116,19 @@ static int do_lock_var(lval_T *lp, char_u *name_end, int deep, int lock)
|
||||
cc = *name_end;
|
||||
*name_end = NUL;
|
||||
|
||||
/* Normal name or expanded name. */
|
||||
if (check_changedtick(lp->ll_name))
|
||||
// Normal name or expanded name.
|
||||
if (check_changedtick(lp->ll_name)) {
|
||||
ret = FAIL;
|
||||
else {
|
||||
} else {
|
||||
di = find_var((const char *)lp->ll_name, STRLEN(lp->ll_name), NULL, true);
|
||||
if (di == NULL)
|
||||
if (di == NULL) {
|
||||
ret = FAIL;
|
||||
else {
|
||||
if (lock)
|
||||
} else {
|
||||
if (lock) {
|
||||
di->di_flags |= DI_FLAGS_LOCK;
|
||||
else
|
||||
} else {
|
||||
di->di_flags &= ~DI_FLAGS_LOCK;
|
||||
}
|
||||
item_lock(&di->di_tv, deep, lock);
|
||||
}
|
||||
}
|
||||
@ -4727,7 +4731,7 @@ static int get_option_tv(const char **const arg, typval_T *const rettv,
|
||||
|
||||
c = *option_end;
|
||||
*option_end = NUL;
|
||||
opt_type = get_option_value((char_u *)*arg, &numval,
|
||||
opt_type = get_option_value((char_u *)(*arg), &numval,
|
||||
rettv == NULL ? NULL : &stringval, opt_flags);
|
||||
|
||||
if (opt_type == -3) { /* invalid name */
|
||||
@ -7011,7 +7015,7 @@ static char_u *deref_func_name(const char *name, int *lenp,
|
||||
*partialp = NULL;
|
||||
}
|
||||
|
||||
dictitem_T *const v = find_var(name, (size_t)*lenp, NULL, no_autoload);
|
||||
dictitem_T *const v = find_var(name, (size_t)(*lenp), NULL, no_autoload);
|
||||
if (v != NULL && v->di_tv.v_type == VAR_FUNC) {
|
||||
if (v->di_tv.vval.v_string == NULL) { // just in case
|
||||
*lenp = 0;
|
||||
@ -7250,9 +7254,7 @@ call_func(
|
||||
error = ERROR_UNKNOWN;
|
||||
|
||||
if (!builtin_function((const char *)rfname, -1)) {
|
||||
/*
|
||||
* User defined function.
|
||||
*/
|
||||
// User defined function.
|
||||
fp = find_func(rfname);
|
||||
|
||||
/* Trigger FuncUndefined event, may load the function. */
|
||||
@ -7265,7 +7267,7 @@ call_func(
|
||||
// Try loading a package.
|
||||
if (fp == NULL && script_autoload((const char *)rfname, STRLEN(rfname),
|
||||
true) && !aborting()) {
|
||||
/* loaded a package, search for the function again */
|
||||
// Loaded a package, search for the function again.
|
||||
fp = find_func(rfname);
|
||||
}
|
||||
|
||||
@ -8965,7 +8967,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
// get_name_len() takes care of expanding curly braces
|
||||
const char *name = p;
|
||||
char *tofree;
|
||||
len = get_name_len((const char **)&p, &tofree, TRUE, FALSE);
|
||||
len = get_name_len((const char **)&p, &tofree, true, false);
|
||||
if (len > 0) {
|
||||
if (tofree != NULL) {
|
||||
name = tofree;
|
||||
@ -11837,7 +11839,7 @@ static void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog)
|
||||
msg_start();
|
||||
msg_clr_eos();
|
||||
msg_puts_attr((const char *)prompt, echo_attr);
|
||||
msg_didout = FALSE;
|
||||
msg_didout = false;
|
||||
msg_starthere();
|
||||
*p = c;
|
||||
}
|
||||
@ -12899,9 +12901,9 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
rettv_dict_alloc(rettv);
|
||||
if (rhs != NULL) {
|
||||
// Return a dictionary.
|
||||
char_u *lhs = str2special_save(mp->m_keys, TRUE);
|
||||
char_u *lhs = str2special_save(mp->m_keys, true);
|
||||
char *const mapmode = map_mode_to_chars(mp->m_mode);
|
||||
dict_T *dict = rettv->vval.v_dict;
|
||||
dict_T *dict = rettv->vval.v_dict;
|
||||
|
||||
dict_add_nr_str(dict, "lhs", 0L, lhs);
|
||||
dict_add_nr_str(dict, "rhs", 0L, mp->m_orig_str);
|
||||
@ -16841,7 +16843,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
p = highlight_has_attr(id, HL_ITALIC, modec);
|
||||
break;
|
||||
|
||||
case 'n': /* name */
|
||||
case 'n': // name
|
||||
p = (char_u *)get_highlight_name(NULL, id - 1);
|
||||
break;
|
||||
|
||||
@ -18423,7 +18425,7 @@ static int get_name_len(const char **const arg,
|
||||
|
||||
if ((*arg)[0] == (char)K_SPECIAL && (*arg)[1] == (char)KS_EXTRA
|
||||
&& (*arg)[2] == (char)KE_SNR) {
|
||||
/* hard coded <SNR>, already translated */
|
||||
// Hard coded <SNR>, already translated.
|
||||
*arg += 3;
|
||||
return get_id_len(arg) + 3;
|
||||
}
|
||||
@ -18436,7 +18438,7 @@ static int get_name_len(const char **const arg,
|
||||
/*
|
||||
* Find the end of the name; check for {} construction.
|
||||
*/
|
||||
const char *p = (const char *)find_name_end((char_u *)*arg,
|
||||
const char *p = (const char *)find_name_end((char_u *)(*arg),
|
||||
&expr_start,
|
||||
&expr_end,
|
||||
len > 0 ? 0 : FNE_CHECK_START);
|
||||
@ -18451,7 +18453,7 @@ static int get_name_len(const char **const arg,
|
||||
* Include any <SID> etc in the expanded string:
|
||||
* Thus the -len here.
|
||||
*/
|
||||
char_u *temp_string = make_expanded_name((char_u *)*arg - len, expr_start,
|
||||
char_u *temp_string = make_expanded_name((char_u *)(*arg) - len, expr_start,
|
||||
expr_end, (char_u *)p);
|
||||
if (temp_string == NULL) {
|
||||
return -1;
|
||||
@ -18919,8 +18921,8 @@ static int get_var_tv(
|
||||
* Also handle function call with Funcref variable: func(expr)
|
||||
* Can all be combined: dict.func(expr)[idx]['func'](expr)
|
||||
*/
|
||||
static int
|
||||
handle_subscript (
|
||||
static int
|
||||
handle_subscript(
|
||||
const char **const arg,
|
||||
typval_T *rettv,
|
||||
int evaluate, /* do more than finding the end */
|
||||
@ -19786,7 +19788,7 @@ char_u *get_var_value(const char *const name)
|
||||
{
|
||||
dictitem_T *v;
|
||||
|
||||
v = find_var(name, strlen(name), NULL, FALSE);
|
||||
v = find_var(name, strlen(name), NULL, false);
|
||||
if (v == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
@ -20341,7 +20343,7 @@ void ex_echo(exarg_T *eap)
|
||||
if (!aborting()) {
|
||||
EMSG2(_(e_invexpr2), p);
|
||||
}
|
||||
need_clr_eos = FALSE;
|
||||
need_clr_eos = false;
|
||||
break;
|
||||
}
|
||||
need_clr_eos = false;
|
||||
@ -20372,15 +20374,16 @@ void ex_echo(exarg_T *eap)
|
||||
msg_clr_eos();
|
||||
needclr = false;
|
||||
}
|
||||
msg_putchar_attr((uint8_t)*p, echo_attr);
|
||||
msg_putchar_attr((uint8_t)(*p), echo_attr);
|
||||
} else {
|
||||
if (has_mbyte) {
|
||||
int i = (*mb_ptr2len)((const char_u *)p);
|
||||
|
||||
(void)msg_outtrans_len_attr((char_u *)p, i, echo_attr);
|
||||
p += i - 1;
|
||||
} else
|
||||
} else {
|
||||
(void)msg_outtrans_len_attr((char_u *)p, 1, echo_attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -20961,7 +20964,7 @@ void ex_function(exarg_T *eap)
|
||||
* If there are no errors, add the function
|
||||
*/
|
||||
if (fudi.fd_dict == NULL) {
|
||||
v = find_var((const char *)name, STRLEN(name), &ht, FALSE);
|
||||
v = find_var((const char *)name, STRLEN(name), &ht, false);
|
||||
if (v != NULL && v->di_tv.v_type == VAR_FUNC) {
|
||||
emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
|
||||
name);
|
||||
@ -21205,7 +21208,7 @@ trans_function_name (
|
||||
}
|
||||
} else {
|
||||
len = (int)(end - *pp);
|
||||
name = deref_func_name((const char *)*pp, &len, partial,
|
||||
name = deref_func_name((const char *)(*pp), &len, partial,
|
||||
flags & TFN_NO_AUTOLOAD);
|
||||
if (name == *pp) {
|
||||
name = NULL;
|
||||
@ -21252,7 +21255,7 @@ trans_function_name (
|
||||
else if (lead > 0) {
|
||||
lead = 3;
|
||||
if ((lv.ll_exp_name != NULL && eval_fname_sid((const char *)lv.ll_exp_name))
|
||||
|| eval_fname_sid((const char *)*pp)) {
|
||||
|| eval_fname_sid((const char *)(*pp))) {
|
||||
// It's "s:" or "<SID>".
|
||||
if (current_SID <= 0) {
|
||||
EMSG(_(e_usingsid));
|
||||
@ -21346,7 +21349,7 @@ static void list_func_head(ufunc_T *fp, int indent)
|
||||
}
|
||||
msg_putchar('(');
|
||||
int j;
|
||||
for (j = 0; j < fp->uf_args.ga_len; ++j) {
|
||||
for (j = 0; j < fp->uf_args.ga_len; j++) {
|
||||
if (j) {
|
||||
msg_puts(", ");
|
||||
}
|
||||
@ -22059,7 +22062,7 @@ call_user_func (
|
||||
smsg(_("calling %s"), sourcing_name);
|
||||
if (p_verbose >= 14) {
|
||||
msg_puts("(");
|
||||
for (int i = 0; i < argcount; ++i) {
|
||||
for (int i = 0; i < argcount; i++) {
|
||||
if (i > 0) {
|
||||
msg_puts(", ");
|
||||
}
|
||||
|
@ -583,8 +583,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
|
||||
++no_wait_return;
|
||||
verbose_enter_scroll();
|
||||
|
||||
smsg(_("line %" PRId64 ": %s"),
|
||||
(int64_t)sourcing_lnum, cmdline_copy);
|
||||
smsg(_("line %" PRIdLINENR ": %s"), sourcing_lnum, cmdline_copy);
|
||||
if (msg_silent == 0) {
|
||||
msg_puts("\n"); // don't overwrite this either
|
||||
}
|
||||
@ -1816,9 +1815,9 @@ static char_u * do_one_cmd(char_u **cmdlinep,
|
||||
errormsg = (char_u *)_("E493: Backwards range given");
|
||||
goto doend;
|
||||
}
|
||||
if (ask_yesno((char_u *)
|
||||
_("Backwards range given, OK to swap"), FALSE) != 'y')
|
||||
if (ask_yesno(_("Backwards range given, OK to swap"), false) != 'y') {
|
||||
goto doend;
|
||||
}
|
||||
}
|
||||
lnum = ea.line1;
|
||||
ea.line1 = ea.line2;
|
||||
@ -2586,13 +2585,11 @@ int modifier_len(char_u *cmd)
|
||||
int cmd_exists(const char *const name)
|
||||
{
|
||||
exarg_T ea;
|
||||
int full = FALSE;
|
||||
int i;
|
||||
int j;
|
||||
char_u *p;
|
||||
|
||||
/* Check command modifiers. */
|
||||
for (i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) {
|
||||
// Check command modifiers.
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) {
|
||||
int j;
|
||||
for (j = 0; name[j] != NUL; j++) {
|
||||
if (name[j] != (char)cmdmods[i].name[j]) {
|
||||
break;
|
||||
@ -2607,6 +2604,7 @@ int cmd_exists(const char *const name)
|
||||
* For ":2match" and ":3match" we need to skip the number. */
|
||||
ea.cmd = (char_u *)((*name == '2' || *name == '3') ? name + 1 : name);
|
||||
ea.cmdidx = (cmdidx_T)0;
|
||||
int full = false;
|
||||
p = find_command(&ea, &full);
|
||||
if (p == NULL)
|
||||
return 3;
|
||||
@ -8250,9 +8248,9 @@ eval_vars (
|
||||
char_u *resultbuf = NULL;
|
||||
size_t resultlen;
|
||||
buf_T *buf;
|
||||
int valid = VALID_HEAD + VALID_PATH; /* assume valid result */
|
||||
int skip_mod = FALSE;
|
||||
char_u strbuf[30];
|
||||
int valid = VALID_HEAD | VALID_PATH; // Assume valid result.
|
||||
int skip_mod = false;
|
||||
char strbuf[30];
|
||||
|
||||
*errormsg = NULL;
|
||||
if (escaped != NULL)
|
||||
@ -8384,8 +8382,8 @@ eval_vars (
|
||||
"E496: no autocommand buffer number to substitute for \"<abuf>\"");
|
||||
return NULL;
|
||||
}
|
||||
sprintf((char *)strbuf, "%d", autocmd_bufnr);
|
||||
result = strbuf;
|
||||
snprintf(strbuf, sizeof(strbuf), "%d", autocmd_bufnr);
|
||||
result = (char_u *)strbuf;
|
||||
break;
|
||||
|
||||
case SPEC_AMATCH: /* match name for autocommand */
|
||||
@ -8410,8 +8408,8 @@ eval_vars (
|
||||
*errormsg = (char_u *)_("E842: no line number to use for \"<slnum>\"");
|
||||
return NULL;
|
||||
}
|
||||
sprintf((char *)strbuf, "%" PRId64, (int64_t)sourcing_lnum);
|
||||
result = strbuf;
|
||||
snprintf(strbuf, sizeof(strbuf), "%" PRIdLINENR, sourcing_lnum);
|
||||
result = (char_u *)strbuf;
|
||||
break;
|
||||
default:
|
||||
// should not happen
|
||||
|
@ -542,7 +542,7 @@ static void discard_exception(except_T *excp, int was_finished)
|
||||
} else {
|
||||
verbose_leave();
|
||||
}
|
||||
STRNCPY(IObuff, saved_IObuff, IOSIZE);
|
||||
xstrlcpy((char *)IObuff, (const char *)saved_IObuff, IOSIZE);
|
||||
xfree(saved_IObuff);
|
||||
}
|
||||
if (excp->type != ET_INTERRUPT)
|
||||
|
@ -3903,36 +3903,35 @@ ExpandFromContext (
|
||||
ExpandFunc func;
|
||||
int ic;
|
||||
int escaped;
|
||||
} tab[] =
|
||||
{
|
||||
{EXPAND_COMMANDS, get_command_name, FALSE, TRUE},
|
||||
{EXPAND_BEHAVE, get_behave_arg, TRUE, TRUE},
|
||||
{EXPAND_HISTORY, get_history_arg, TRUE, TRUE},
|
||||
{EXPAND_USER_COMMANDS, get_user_commands, FALSE, TRUE},
|
||||
{EXPAND_USER_ADDR_TYPE, get_user_cmd_addr_type, FALSE, TRUE},
|
||||
{EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, FALSE, TRUE},
|
||||
{EXPAND_USER_NARGS, get_user_cmd_nargs, FALSE, TRUE},
|
||||
{EXPAND_USER_COMPLETE, get_user_cmd_complete, FALSE, TRUE},
|
||||
{EXPAND_USER_VARS, get_user_var_name, FALSE, TRUE},
|
||||
{EXPAND_FUNCTIONS, get_function_name, FALSE, TRUE},
|
||||
{EXPAND_USER_FUNC, get_user_func_name, FALSE, TRUE},
|
||||
{EXPAND_EXPRESSION, get_expr_name, FALSE, TRUE},
|
||||
{EXPAND_MENUS, get_menu_name, FALSE, TRUE},
|
||||
{EXPAND_MENUNAMES, get_menu_names, FALSE, TRUE},
|
||||
{EXPAND_SYNTAX, get_syntax_name, TRUE, TRUE},
|
||||
{EXPAND_SYNTIME, get_syntime_arg, TRUE, TRUE},
|
||||
{EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, TRUE, TRUE},
|
||||
{EXPAND_EVENTS, get_event_name, TRUE, TRUE},
|
||||
{EXPAND_AUGROUP, get_augroup_name, TRUE, TRUE},
|
||||
{EXPAND_CSCOPE, get_cscope_name, TRUE, TRUE},
|
||||
{EXPAND_SIGN, get_sign_name, TRUE, TRUE},
|
||||
{EXPAND_PROFILE, get_profile_name, TRUE, TRUE},
|
||||
} tab[] = {
|
||||
{ EXPAND_COMMANDS, get_command_name, false, true },
|
||||
{ EXPAND_BEHAVE, get_behave_arg, true, true },
|
||||
{ EXPAND_HISTORY, get_history_arg, true, true },
|
||||
{ EXPAND_USER_COMMANDS, get_user_commands, false, true },
|
||||
{ EXPAND_USER_ADDR_TYPE, get_user_cmd_addr_type, false, true },
|
||||
{ EXPAND_USER_CMD_FLAGS, get_user_cmd_flags, false, true },
|
||||
{ EXPAND_USER_NARGS, get_user_cmd_nargs, false, true },
|
||||
{ EXPAND_USER_COMPLETE, get_user_cmd_complete, false, true },
|
||||
{ EXPAND_USER_VARS, get_user_var_name, false, true },
|
||||
{ EXPAND_FUNCTIONS, get_function_name, false, true },
|
||||
{ EXPAND_USER_FUNC, get_user_func_name, false, true },
|
||||
{ EXPAND_EXPRESSION, get_expr_name, false, true },
|
||||
{ EXPAND_MENUS, get_menu_name, false, true },
|
||||
{ EXPAND_MENUNAMES, get_menu_names, false, true },
|
||||
{ EXPAND_SYNTAX, get_syntax_name, true, true },
|
||||
{ EXPAND_SYNTIME, get_syntime_arg, true, true },
|
||||
{ EXPAND_HIGHLIGHT, (ExpandFunc)get_highlight_name, true, true },
|
||||
{ EXPAND_EVENTS, get_event_name, true, true },
|
||||
{ EXPAND_AUGROUP, get_augroup_name, true, true },
|
||||
{ EXPAND_CSCOPE, get_cscope_name, true, true },
|
||||
{ EXPAND_SIGN, get_sign_name, true, true },
|
||||
{ EXPAND_PROFILE, get_profile_name, true, true },
|
||||
#ifdef HAVE_WORKING_LIBINTL
|
||||
{EXPAND_LANGUAGE, get_lang_arg, TRUE, FALSE},
|
||||
{EXPAND_LOCALES, get_locales, TRUE, FALSE},
|
||||
{ EXPAND_LANGUAGE, get_lang_arg, true, false },
|
||||
{ EXPAND_LOCALES, get_locales, true, false },
|
||||
#endif
|
||||
{EXPAND_ENV_VARS, get_env_name, TRUE, TRUE},
|
||||
{EXPAND_USER, get_users, TRUE, FALSE},
|
||||
{ EXPAND_ENV_VARS, get_env_name, true, true },
|
||||
{ EXPAND_USER, get_users, true, false },
|
||||
};
|
||||
int i;
|
||||
|
||||
|
@ -3895,15 +3895,15 @@ static int check_mtime(buf_T *buf, FileInfo *file_info)
|
||||
if (buf->b_mtime_read != 0
|
||||
&& time_differs(file_info->stat.st_mtim.tv_sec,
|
||||
buf->b_mtime_read)) {
|
||||
msg_scroll = TRUE; /* don't overwrite messages here */
|
||||
msg_silent = 0; /* must give this prompt */
|
||||
msg_scroll = true; // Don't overwrite messages here.
|
||||
msg_silent = 0; // Must give this prompt.
|
||||
// Don't use emsg() here, don't want to flush the buffers.
|
||||
msg_attr(_("WARNING: The file has been changed since reading it!!!"),
|
||||
hl_attr(HLF_E));
|
||||
if (ask_yesno((char_u *)_("Do you really want to write to it"),
|
||||
TRUE) == 'n')
|
||||
hl_attr(HLF_E));
|
||||
if (ask_yesno(_("Do you really want to write to it"), true) == 'n') {
|
||||
return FAIL;
|
||||
msg_scroll = FALSE; /* always overwrite the file message now */
|
||||
}
|
||||
msg_scroll = false; // Always overwrite the file message now.
|
||||
}
|
||||
return OK;
|
||||
}
|
||||
@ -5384,10 +5384,8 @@ char_u *vim_tempname(void)
|
||||
|
||||
static AutoPatCmd *active_apc_list = NULL; /* stack of active autocommands */
|
||||
|
||||
/*
|
||||
* augroups stores a list of autocmd group names.
|
||||
*/
|
||||
static garray_T augroups = {0, 0, sizeof(char_u *), 10, NULL};
|
||||
/// List of autocmd group names
|
||||
static garray_T augroups = { 0, 0, sizeof(char_u *), 10, NULL };
|
||||
#define AUGROUP_NAME(i) (((char **)augroups.ga_data)[i])
|
||||
|
||||
/*
|
||||
@ -5592,8 +5590,9 @@ static int au_new_group(char_u *name)
|
||||
}
|
||||
|
||||
AUGROUP_NAME(i) = xstrdup((char *)name);
|
||||
if (i == augroups.ga_len)
|
||||
++augroups.ga_len;
|
||||
if (i == augroups.ga_len) {
|
||||
augroups.ga_len++;
|
||||
}
|
||||
}
|
||||
|
||||
return i;
|
||||
|
@ -3227,7 +3227,7 @@ showmap (
|
||||
while (++len <= 3)
|
||||
msg_putchar(' ');
|
||||
|
||||
/* Display the LHS. Get length of what we write. */
|
||||
// Display the LHS. Get length of what we write.
|
||||
len = (size_t)msg_outtrans_special(mp->m_keys, true);
|
||||
do {
|
||||
msg_putchar(' '); /* padd with blanks */
|
||||
@ -3252,8 +3252,8 @@ showmap (
|
||||
if (*mp->m_str == NUL) {
|
||||
msg_puts_attr("<Nop>", hl_attr(HLF_8));
|
||||
} else {
|
||||
/* Remove escaping of CSI, because "m_str" is in a format to be used
|
||||
* as typeahead. */
|
||||
// Remove escaping of CSI, because "m_str" is in a format to be used
|
||||
// as typeahead.
|
||||
char_u *s = vim_strsave(mp->m_str);
|
||||
vim_unescape_csi(s);
|
||||
msg_outtrans_special(s, FALSE);
|
||||
|
@ -758,7 +758,7 @@ static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
|
||||
if (*menu->strings[bit] == NUL) {
|
||||
msg_puts_attr("<Nop>", hl_attr(HLF_8));
|
||||
} else {
|
||||
msg_outtrans_special(menu->strings[bit], FALSE);
|
||||
msg_outtrans_special(menu->strings[bit], false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -1177,13 +1177,14 @@ int msg_outtrans_len_attr(char_u *msgstr, int len, int attr)
|
||||
* Normal characters are printed several at a time.
|
||||
*/
|
||||
while (--len >= 0) {
|
||||
if (enc_utf8)
|
||||
/* Don't include composing chars after the end. */
|
||||
if (enc_utf8) {
|
||||
// Don't include composing chars after the end.
|
||||
mb_l = utfc_ptr2len_len((char_u *)str, len + 1);
|
||||
else if (has_mbyte)
|
||||
} else if (has_mbyte) {
|
||||
mb_l = (*mb_ptr2len)((char_u *)str);
|
||||
else
|
||||
} else {
|
||||
mb_l = 1;
|
||||
}
|
||||
if (has_mbyte && mb_l > 1) {
|
||||
c = (*mb_ptr2char)((char_u *)str);
|
||||
if (vim_isprintc(c)) {
|
||||
@ -1680,9 +1681,10 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
|
||||
} else {
|
||||
msg_screen_putchar(*s++, attr);
|
||||
}
|
||||
did_last_char = TRUE;
|
||||
} else
|
||||
did_last_char = FALSE;
|
||||
did_last_char = true;
|
||||
} else {
|
||||
did_last_char = false;
|
||||
}
|
||||
|
||||
if (p_more) {
|
||||
// Store text for scrolling back.
|
||||
@ -1784,7 +1786,7 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr,
|
||||
++s;
|
||||
}
|
||||
|
||||
/* output any postponed text */
|
||||
// Output any postponed text.
|
||||
if (t_col > 0) {
|
||||
t_puts(&t_col, t_s, s, attr);
|
||||
}
|
||||
@ -1968,8 +1970,8 @@ static msgchunk_T *disp_sb_line(int row, msgchunk_T *smp)
|
||||
*/
|
||||
static void t_puts(int *t_col, const char_u *t_s, const char_u *s, int attr)
|
||||
{
|
||||
/* output postponed text */
|
||||
msg_didout = TRUE; /* remember that line is not empty */
|
||||
// Output postponed text.
|
||||
msg_didout = true; // Remember that line is not empty.
|
||||
screen_puts_len((char_u *)t_s, (int)(s - t_s), msg_row, msg_col, attr);
|
||||
msg_col += *t_col;
|
||||
*t_col = 0;
|
||||
|
@ -2223,7 +2223,7 @@ change_warning (
|
||||
*
|
||||
* return the 'y' or 'n'
|
||||
*/
|
||||
int ask_yesno(char_u *str, int direct)
|
||||
int ask_yesno(const char *str, bool direct)
|
||||
{
|
||||
int r = ' ';
|
||||
int save_State = State;
|
||||
|
@ -2570,10 +2570,10 @@ did_set_string_option (
|
||||
init_highlight(FALSE, FALSE);
|
||||
|
||||
if (dark != (*p_bg == 'd') && get_var_value("g:colors_name") != NULL) {
|
||||
/* The color scheme must have set 'background' back to another
|
||||
* value, that's not what we want here. Disable the color
|
||||
* scheme and set the colors again. */
|
||||
do_unlet((char_u *)"g:colors_name", TRUE);
|
||||
// The color scheme must have set 'background' back to another
|
||||
// value, that's not what we want here. Disable the color
|
||||
// scheme and set the colors again.
|
||||
do_unlet((char_u *)"g:colors_name", true);
|
||||
free_string_option(p_bg);
|
||||
p_bg = vim_strsave((char_u *)(dark ? "dark" : "light"));
|
||||
check_string_option(&p_bg);
|
||||
|
@ -2078,7 +2078,7 @@ void qf_list(exarg_T *eap)
|
||||
msg_puts_attr((const char *)IObuff, hl_attr(HLF_N));
|
||||
if (qfp->qf_pattern != NULL) {
|
||||
qf_fmt_text(qfp->qf_pattern, IObuff, IOSIZE);
|
||||
STRNCAT(IObuff, ":", IOSIZE);
|
||||
xstrlcat((char *)IObuff, ":", IOSIZE);
|
||||
msg_puts((const char *)IObuff);
|
||||
}
|
||||
msg_puts(" ");
|
||||
|
@ -6725,7 +6725,7 @@ int showmode(void)
|
||||
msg_puts_attr((const char *)edit_submode, attr);
|
||||
}
|
||||
if (edit_submode_extra != NULL) {
|
||||
MSG_PUTS_ATTR(" ", attr); /* add a space in between */
|
||||
MSG_PUTS_ATTR(" ", attr); // Add a space in between.
|
||||
if ((int)edit_submode_highl < (int)HLF_COUNT) {
|
||||
sub_attr = hl_attr(edit_submode_highl);
|
||||
} else {
|
||||
|
@ -13006,7 +13006,7 @@ void ex_spellinfo(exarg_T *eap)
|
||||
}
|
||||
|
||||
msg_start();
|
||||
for (int lpi = 0; lpi < curwin->w_s->b_langp.ga_len && !got_int; ++lpi) {
|
||||
for (int lpi = 0; lpi < curwin->w_s->b_langp.ga_len && !got_int; lpi++) {
|
||||
langp_T *const lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||
msg_puts("file: ");
|
||||
msg_puts((const char *)lp->lp_slang->sl_fname);
|
||||
|
@ -3649,7 +3649,9 @@ static void syn_list_cluster(int id)
|
||||
}
|
||||
}
|
||||
|
||||
static void put_id_list(const char *name, short *list, int attr)
|
||||
static void put_id_list(const char *name,
|
||||
short *list, // NOLINT(runtime/int)
|
||||
int attr)
|
||||
{
|
||||
short *p;
|
||||
|
||||
@ -5519,19 +5521,21 @@ void ex_ownsyntax(exarg_T *eap)
|
||||
clear_string_option(&curwin->w_s->b_syn_isk);
|
||||
}
|
||||
|
||||
/* save value of b:current_syntax */
|
||||
// Save value of b:current_syntax.
|
||||
old_value = get_var_value("b:current_syntax");
|
||||
if (old_value != NULL)
|
||||
if (old_value != NULL) {
|
||||
old_value = vim_strsave(old_value);
|
||||
}
|
||||
|
||||
/* Apply the "syntax" autocommand event, this finds and loads the syntax
|
||||
* file. */
|
||||
apply_autocmds(EVENT_SYNTAX, eap->arg, curbuf->b_fname, TRUE, curbuf);
|
||||
|
||||
/* move value of b:current_syntax to w:current_syntax */
|
||||
// Move value of b:current_syntax to w:current_syntax.
|
||||
new_value = get_var_value("b:current_syntax");
|
||||
if (new_value != NULL)
|
||||
if (new_value != NULL) {
|
||||
set_internal_string_var((char_u *)"w:current_syntax", new_value);
|
||||
}
|
||||
|
||||
/* restore value of b:current_syntax */
|
||||
if (old_value == NULL)
|
||||
@ -7534,11 +7538,11 @@ static void highlight_list_two(int cnt, int attr)
|
||||
const char *get_highlight_name(expand_T *const xp, const int idx)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
// TODO: 'xp' is unused
|
||||
// TODO(justinmk): 'xp' is unused
|
||||
if (idx == highlight_ga.ga_len && include_none != 0) {
|
||||
return "none";
|
||||
} else if (idx == highlight_ga.ga_len + include_none
|
||||
&& include_default != 0) {
|
||||
&& include_default != 0) {
|
||||
return "default";
|
||||
} else if (idx == highlight_ga.ga_len + include_none + include_default
|
||||
&& include_link != 0) {
|
||||
|
@ -541,9 +541,10 @@ do_tag (
|
||||
vim_snprintf((char *)IObuff + 1, IOSIZE - 1, "%2d %s ", i + 1,
|
||||
mt_names[matches[i][0] & MT_MASK]);
|
||||
msg_puts((const char *)IObuff);
|
||||
if (tagp.tagkind != NULL)
|
||||
if (tagp.tagkind != NULL) {
|
||||
msg_outtrans_len(tagp.tagkind,
|
||||
(int)(tagp.tagkind_end - tagp.tagkind));
|
||||
(int)(tagp.tagkind_end - tagp.tagkind));
|
||||
}
|
||||
msg_advance(13);
|
||||
msg_outtrans_len_attr(tagp.tagname,
|
||||
(int)(tagp.tagname_end - tagp.tagname),
|
||||
@ -864,8 +865,9 @@ do_tag (
|
||||
msg(IObuff);
|
||||
}
|
||||
msg_scroll = true; // Don't overwrite this message.
|
||||
} else
|
||||
} else {
|
||||
give_warning(IObuff, ic);
|
||||
}
|
||||
if (ic && !msg_scrolled && msg_silent == 0) {
|
||||
ui_flush();
|
||||
os_delay(1000L, true);
|
||||
|
@ -2514,7 +2514,7 @@ void ex_undolist(exarg_T *eap)
|
||||
msg_start();
|
||||
msg_puts_attr(_("number changes when saved"),
|
||||
hl_attr(HLF_T));
|
||||
for (int i = 0; i < ga.ga_len && !got_int; ++i) {
|
||||
for (int i = 0; i < ga.ga_len && !got_int; i++) {
|
||||
msg_putchar('\n');
|
||||
if (got_int) {
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user