refactor: replace char_u variables and functions with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
Dundar Goc 2022-05-05 13:36:14 +02:00
parent dbdd58e548
commit e31b32a293
65 changed files with 758 additions and 756 deletions

View File

@ -245,11 +245,11 @@ void nvim_feedkeys(String keys, String mode, Boolean escape_ks)
if (escape_ks) {
// Need to escape K_SPECIAL before putting the string in the
// typeahead buffer.
keys_esc = (char *)vim_strsave_escape_ks((char_u *)keys.data);
keys_esc = vim_strsave_escape_ks(keys.data);
} else {
keys_esc = keys.data;
}
ins_typebuf((char_u *)keys_esc, (remap ? REMAP_YES : REMAP_NONE),
ins_typebuf(keys_esc, (remap ? REMAP_YES : REMAP_NONE),
insert ? 0 : typebuf.tb_len, !typed, false);
if (vgetc_busy) {
typebuf_was_filled = true;
@ -416,7 +416,7 @@ String nvim_replace_termcodes(String str, Boolean from_part, Boolean do_lt, Bool
}
char *ptr = NULL;
replace_termcodes((char_u *)str.data, str.size, (char_u **)&ptr, flags, NULL, CPO_TO_CPO_FLAGS);
replace_termcodes(str.data, str.size, &ptr, flags, NULL, CPO_TO_CPO_FLAGS);
return cstr_as_string(ptr);
}
@ -513,14 +513,13 @@ ArrayOf(String) nvim_get_runtime_file(String name, Boolean all, Error *err)
TRY_WRAP({
try_start();
do_in_runtimepath((char_u *)(name.size ? name.data : ""),
flags, find_runtime_cb, &rv);
do_in_runtimepath((name.size ? name.data : ""), flags, find_runtime_cb, &rv);
try_end(err);
});
return rv;
}
static void find_runtime_cb(char_u *fname, void *cookie)
static void find_runtime_cb(char *fname, void *cookie)
{
Array *rv = (Array *)cookie;
if (fname != NULL) {
@ -563,13 +562,13 @@ void nvim_set_current_dir(String dir, Error *err)
return;
}
char_u string[MAXPATHL];
char string[MAXPATHL];
memcpy(string, dir.data, dir.size);
string[dir.size] = NUL;
try_start();
if (!changedir_func((char *)string, kCdScopeGlobal)) {
if (!changedir_func(string, kCdScopeGlobal)) {
if (!try_end(err)) {
api_set_error(err, kErrorTypeException, "Failed to change directory");
}
@ -722,7 +721,7 @@ Object nvim_get_option_value(String name, Dict(option) *opts, Error *err)
long numval = 0;
char *stringval = NULL;
switch (get_option_value(name.data, &numval, (char_u **)&stringval, scope)) {
switch (get_option_value(name.data, &numval, &stringval, scope)) {
case 0:
rv = STRING_OBJ(cstr_as_string(stringval));
break;
@ -1339,7 +1338,7 @@ Boolean nvim_paste(String data, Boolean crlf, Integer phase, Error *err)
for (size_t i = 0; i < lines.size; i++) {
String s = lines.items[i].data.string;
assert(s.size <= INT_MAX);
AppendToRedobuffLit((char_u *)s.data, (int)s.size);
AppendToRedobuffLit(s.data, (int)s.size);
// readfile()-style: "\n" is indicated by presence of N+1 item.
if (i + 1 < lines.size) {
AppendCharToRedobuff(NL);
@ -1392,7 +1391,7 @@ void nvim_put(ArrayOf(String) lines, String type, Boolean after, Boolean follow,
goto cleanup;
}
String line = lines.items[i].data.string;
reg->y_array[i] = (char_u *)xmemdupz(line.data, line.size);
reg->y_array[i] = xmemdupz(line.data, line.size);
memchrsub(reg->y_array[i], NUL, NL, line.size);
}
@ -2352,9 +2351,9 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
ewp->w_p_crb = false;
int width = build_stl_str_hl(ewp,
(char_u *)buf,
buf,
sizeof(buf),
(char_u *)str.data,
str.data,
false,
fillchar,
maxwidth,

View File

@ -197,7 +197,7 @@ static Object _call_function(String fn, Array args, dict_T *self, Error *err)
funcexe.selfdict = self;
// call_func() retval is deceptive, ignore it. Instead we set `msg_list`
// (see above) to capture abort-causing non-exception errors.
(void)call_func((char_u *)fn.data, (int)fn.size, &rettv, (int)args.size,
(void)call_func(fn.data, (int)fn.size, &rettv, (int)args.size,
vim_args, &funcexe);
if (!try_end(err)) {
rv = vim_to_object(&rettv);
@ -290,7 +290,7 @@ Object nvim_call_dict_function(Object dict, String fn, Array args, Error *err)
goto end;
}
fn = (String) {
.data = (char *)di->di_tv.vval.v_string,
.data = di->di_tv.vval.v_string,
.size = STRLEN(di->di_tv.vval.v_string),
};
}
@ -831,7 +831,7 @@ Dictionary nvim_parse_cmd(String str, Dictionary opts, Error *err)
bool done = false;
while (!done) {
done = uc_split_args_iter((char_u *)ea.arg, length, &end, buf, &len);
done = uc_split_args_iter(ea.arg, length, &end, buf, &len);
if (len > 0) {
ADD(args, STRING_OBJ(cstrn_to_string(buf, len)));
}

View File

@ -264,7 +264,7 @@ Dictionary nvim_win_get_config(Window window, Error *err)
String s = cstrn_to_string((const char *)config->border_chars[i], sizeof(schar_T));
int hi_id = config->border_hl_ids[i];
char_u *hi_name = syn_id2name(hi_id);
char *hi_name = (char *)syn_id2name(hi_id);
if (hi_name[0]) {
ADD(tuple, STRING_OBJ(s));
ADD(tuple, STRING_OBJ(cstr_to_string((const char *)hi_name)));
@ -387,7 +387,7 @@ static void parse_border_style(Object style, FloatConfig *fconfig, Error *err)
return;
}
if (string.size
&& mb_string2cells_len((char_u *)string.data, string.size) > 1) {
&& mb_string2cells_len(string.data, string.size) > 1) {
api_set_error(err, kErrorTypeValidation,
"border chars must be one cell");
return;

View File

@ -957,11 +957,11 @@ int arabic_shape(int c, int *ccp, int *c1p, int prev_c, int prev_c1, int next_c)
}
if ((curr_c != c) && (ccp != NULL)) {
char_u buf[MB_MAXBYTES + 1];
char buf[MB_MAXBYTES + 1];
// Update the first byte of the character
utf_char2bytes(curr_c, buf);
*ccp = buf[0];
*ccp = (uint8_t)buf[0];
}
// Return the shaped character

View File

@ -780,7 +780,7 @@ void do_autocmd(char *arg_in, int forceit)
return;
}
pat = (char *)skipwhite((char_u *)pat);
pat = skipwhite(pat);
if (*pat == '|') {
pat = "";
cmd = "";
@ -811,7 +811,7 @@ void do_autocmd(char *arg_in, int forceit)
}
}
cmd = (char *)skipwhite((char_u *)cmd);
cmd = skipwhite(cmd);
bool invalid_flags = false;
for (size_t i = 0; i < 2; i++) {
@ -1216,7 +1216,7 @@ int do_doautocmd(char *arg_start, bool do_msg, bool *did_something)
return FAIL;
}
fname = (char *)skipwhite((char_u *)fname);
fname = skipwhite(fname);
// Loop over the events.
while (*arg && !ends_excmd(*arg) && !ascii_iswhite(*arg)) {
@ -1298,7 +1298,7 @@ bool check_nomodeline(char **argp)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
if (STRNCMP(*argp, "<nomodeline>", 12) == 0) {
*argp = (char *)skipwhite((char_u *)(*argp) + 12);
*argp = skipwhite(*argp + 12);
return false;
}
return true;
@ -2246,7 +2246,7 @@ char *set_context_in_autocmd(expand_T *xp, char *arg, int doautocmd)
}
// skip over pattern
arg = (char *)skipwhite((char_u *)p);
arg = skipwhite(p);
while (*arg && (!ascii_iswhite(*arg) || arg[-1] == '\\')) {
arg++;
}
@ -2615,7 +2615,7 @@ static int arg_augroup_get(char **argp)
if (group == AUGROUP_ERROR) {
group = AUGROUP_ALL; // no match, use all groups
} else {
*argp = (char *)skipwhite((char_u *)p); // match, skip over group name
*argp = skipwhite(p); // match, skip over group name
}
xfree(group_name);
}
@ -2632,7 +2632,7 @@ static bool arg_autocmd_flag_get(bool *flag, char **cmd_ptr, char *pattern, int
}
*flag = true;
*cmd_ptr = (char *)skipwhite((char_u *)(*cmd_ptr) + len);
*cmd_ptr = skipwhite(*cmd_ptr + len);
}
return false;

View File

@ -979,7 +979,7 @@ char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end
break;
}
} else { // addr_count == 1
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
if (*arg == NUL) {
break;
}
@ -3151,8 +3151,8 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "titlestring", 0);
called_emsg = false;
build_stl_str_hl(curwin, (char_u *)buf, sizeof(buf),
p_titlestring, use_sandbox,
build_stl_str_hl(curwin, buf, sizeof(buf),
(char *)p_titlestring, use_sandbox,
0, maxlen, NULL, NULL);
title_str = (char_u *)buf;
if (called_emsg) {
@ -3269,8 +3269,8 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "iconstring", 0);
called_emsg = false;
build_stl_str_hl(curwin, icon_str, sizeof(buf),
p_iconstring, use_sandbox,
build_stl_str_hl(curwin, (char *)icon_str, sizeof(buf),
(char *)p_iconstring, use_sandbox,
0, 0, NULL, NULL);
if (called_emsg) {
set_string_option_direct("iconstring", -1,
@ -3383,8 +3383,8 @@ typedef enum {
/// @param tabtab Tab clicks definition (can be NULL).
///
/// @return The final width of the statusline
int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use_sandbox,
int fillchar, int maxwidth, stl_hlrec_t **hltab, StlClickRecord **tabtab)
int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_sandbox, int fillchar,
int maxwidth, stl_hlrec_t **hltab, StlClickRecord **tabtab)
{
static size_t stl_items_len = 20; // Initial value, grows as needed.
static stl_item_t *stl_items = NULL;
@ -3395,8 +3395,8 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
#define TMPLEN 70
char buf_tmp[TMPLEN];
char_u win_tmp[TMPLEN];
char_u *usefmt = fmt;
char win_tmp[TMPLEN];
char *usefmt = fmt;
const int save_must_redraw = must_redraw;
const int save_redr_type = curwin->w_redr_type;
@ -3421,7 +3421,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
};
set_var(S_LEN("g:statusline_winid"), &tv, false);
usefmt = (char_u *)eval_to_string_safe((char *)fmt + 2, NULL, use_sandbox);
usefmt = eval_to_string_safe(fmt + 2, NULL, use_sandbox);
if (usefmt == NULL) {
usefmt = fmt;
}
@ -3467,17 +3467,17 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
bool prevchar_isitem = false;
// out_p is the current position in the output buffer
char_u *out_p = out;
char *out_p = out;
// out_end_p is the last valid character in the output buffer
// Note: The null termination character must occur here or earlier,
// so any user-visible characters must occur before here.
char_u *out_end_p = (out + outlen) - 1;
char *out_end_p = (out + outlen) - 1;
// Proceed character by character through the statusline format string
// fmt_p is the current position in the input buffer
for (char_u *fmt_p = usefmt; *fmt_p;) {
for (char *fmt_p = usefmt; *fmt_p;) {
if (curitem == (int)stl_items_len) {
size_t new_len = stl_items_len * 3 / 2;
@ -3534,7 +3534,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
continue;
}
stl_items[curitem].type = Separate;
stl_items[curitem++].start = out_p;
stl_items[curitem++].start = (char_u *)out_p;
continue;
}
@ -3542,7 +3542,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (*fmt_p == STL_TRUNCMARK) {
fmt_p++;
stl_items[curitem].type = Trunc;
stl_items[curitem++].start = out_p;
stl_items[curitem++].start = (char_u *)out_p;
continue;
}
@ -3591,7 +3591,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
}
if (n == curitem && group_start_userhl == group_end_userhl) {
// empty group
out_p = t;
out_p = (char *)t;
group_len = 0;
for (n = stl_groupitems[groupdepth] + 1; n < curitem; n++) {
// do not use the highlighting from the removed group
@ -3601,7 +3601,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// adjust the start position of TabPage to the next
// item position
if (stl_items[n].type == TabPage) {
stl_items[n].start = out_p;
stl_items[n].start = (char_u *)out_p;
}
}
}
@ -3624,7 +3624,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
*t = '<';
// { Move the truncated output
memmove(t + 1, t + n, (size_t)(out_p - (t + n)));
memmove(t + 1, t + n, (size_t)((char_u *)out_p - (t + n)));
out_p = out_p - n + 1;
// Fill up space left over by half a double-wide char.
while (++group_len < stl_items[stl_groupitems[groupdepth]].minwid) {
@ -3657,7 +3657,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
} else {
// { Move the group to the right
group_len = (min_group_width - group_len) * utf_char2len(fillchar);
memmove(t + group_len, t, (size_t)(out_p - t));
memmove(t + group_len, t, (size_t)((char_u *)out_p - t));
if (out_p + group_len >= (out_end_p + 1)) {
group_len = (long)(out_end_p - out_p);
}
@ -3696,14 +3696,14 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// The first digit group is the item's min width
if (ascii_isdigit(*fmt_p)) {
minwid = getdigits_int(&fmt_p, false, 0);
minwid = getdigits_int((char_u **)&fmt_p, false, 0);
}
// User highlight groups override the min width field
// to denote the styling to use.
if (*fmt_p == STL_USER_HL) {
stl_items[curitem].type = Highlight;
stl_items[curitem].start = out_p;
stl_items[curitem].start = (char_u *)out_p;
stl_items[curitem].minwid = minwid > 9 ? 1 : minwid;
fmt_p++;
curitem++;
@ -3749,7 +3749,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
}
}
stl_items[curitem].type = TabPage;
stl_items[curitem].start = out_p;
stl_items[curitem].start = (char_u *)out_p;
stl_items[curitem].minwid = minwid;
fmt_p++;
curitem++;
@ -3758,7 +3758,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (*fmt_p == STL_CLICK_FUNC) {
fmt_p++;
char *t = (char *)fmt_p;
char *t = fmt_p;
while (*fmt_p != STL_CLICK_FUNC && *fmt_p) {
fmt_p++;
}
@ -3766,8 +3766,8 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
break;
}
stl_items[curitem].type = ClickFunc;
stl_items[curitem].start = out_p;
stl_items[curitem].cmd = xmemdupz(t, (size_t)(((char *)fmt_p - t)));
stl_items[curitem].start = (char_u *)out_p;
stl_items[curitem].cmd = xmemdupz(t, (size_t)(fmt_p - t));
stl_items[curitem].minwid = minwid;
fmt_p++;
curitem++;
@ -3779,7 +3779,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (*fmt_p == '.') {
fmt_p++;
if (ascii_isdigit(*fmt_p)) {
maxwid = getdigits_int(&fmt_p, false, 50);
maxwid = getdigits_int((char_u **)&fmt_p, false, 50);
}
}
@ -3791,7 +3791,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (*fmt_p == '(') {
stl_groupitems[groupdepth++] = curitem;
stl_items[curitem].type = Group;
stl_items[curitem].start = out_p;
stl_items[curitem].start = (char_u *)out_p;
stl_items[curitem].minwid = minwid;
stl_items[curitem].maxwid = maxwid;
fmt_p++;
@ -3814,7 +3814,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
}
// The status line item type
char_u opt = *fmt_p++;
char opt = *fmt_p++;
// OK - now for the real work
NumberBase base = kNumBaseDecimal;
@ -3845,7 +3845,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
break;
case STL_VIM_EXPR: // '{'
{
char_u *block_start = fmt_p - 1;
char *block_start = fmt_p - 1;
int reevaluate = (*fmt_p == '%');
itemisflag = true;
@ -3855,7 +3855,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// Attempt to copy the expression to evaluate into
// the output buffer as a null-terminated string.
char_u *t = out_p;
char *t = out_p;
while ((*fmt_p != '}' || (reevaluate && fmt_p[-1] != '%'))
&& *fmt_p != NUL && out_p < out_end_p) {
*out_p++ = *fmt_p++;
@ -3893,7 +3893,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
}
// Note: The result stored in `t` is unused.
str = eval_to_string_safe((char *)out_p, (char **)&t, use_sandbox);
str = eval_to_string_safe(out_p, &t, use_sandbox);
curwin = save_curwin;
curbuf = save_curbuf;
@ -3943,7 +3943,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
xfree(usefmt);
}
XFREE_CLEAR(str);
usefmt = new_fmt;
usefmt = (char *)new_fmt;
fmt_p = usefmt + parsed_usefmt;
evaldepth++;
continue;
@ -4125,7 +4125,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
case STL_HIGHLIGHT: {
// { The name of the highlight is surrounded by `#`
char_u *t = fmt_p;
char *t = fmt_p;
while (*fmt_p != '#' && *fmt_p != NUL) {
fmt_p++;
}
@ -4134,8 +4134,8 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// Create a highlight item based on the name
if (*fmt_p == '#') {
stl_items[curitem].type = Highlight;
stl_items[curitem].start = out_p;
stl_items[curitem].minwid = -syn_name2id_len(t, (size_t)(fmt_p - t));
stl_items[curitem].start = (char_u *)out_p;
stl_items[curitem].minwid = -syn_name2id_len((char_u *)t, (size_t)(fmt_p - t));
curitem++;
fmt_p++;
}
@ -4146,14 +4146,14 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// If we made it this far, the item is normal and starts at
// our current position in the output buffer.
// Non-normal items would have `continued`.
stl_items[curitem].start = out_p;
stl_items[curitem].start = (char_u *)out_p;
stl_items[curitem].type = Normal;
// Copy the item string into the output buffer
if (str != NULL && *str) {
// { Skip the leading `,` or ` ` if the item is a flag
// and the proper conditions are met
char_u *t = (char_u *)str;
char *t = str;
if (itemisflag) {
if ((t[0] && t[1])
&& ((!prevchar_isitem && *t == ',')
@ -4164,7 +4164,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
}
// }
long l = vim_strsize(t);
long l = vim_strsize((char_u *)t);
// If this item is non-empty, record that the last thing
// we put in the output buffer was an item
@ -4175,8 +4175,8 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// If the item is too wide, truncate it from the beginning
if (l > maxwid) {
while (l >= maxwid) {
l -= ptr2cells(t);
t += utfc_ptr2len((char *)t);
l -= ptr2cells((char_u *)t);
t += utfc_ptr2len(t);
}
// Early out if there isn't enough room for the truncation marker
@ -4292,11 +4292,9 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
*++t = 0;
// }
vim_snprintf((char *)out_p, remaining_buf_len, (char *)nstr,
0, num, n);
vim_snprintf(out_p, remaining_buf_len, (char *)nstr, 0, num, n);
} else {
vim_snprintf((char *)out_p, remaining_buf_len, (char *)nstr,
minwid, num);
vim_snprintf(out_p, remaining_buf_len, (char *)nstr, minwid, num);
}
// Advance the output buffer position to the end of the
@ -4333,7 +4331,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// We have now processed the entire statusline format string.
// What follows is post-processing to handle alignment and highlighting.
int width = vim_strsize(out);
int width = vim_strsize((char_u *)out);
if (maxwidth > 0 && width > maxwidth) {
// Result is too long, must truncate somewhere.
int item_idx = 0;
@ -4341,7 +4339,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
// If there are no items, truncate from beginning
if (itemcnt == 0) {
trunc_p = out;
trunc_p = (char_u *)out;
// Otherwise, look for the truncation item
} else {
@ -4364,7 +4362,7 @@ int build_stl_str_hl(win_T *wp, char_u *out, size_t outlen, char_u *fmt, int use
if (width - vim_strsize(trunc_p) >= maxwidth) {
// Walk from the beginning of the
// string to find the last character that will fit.
trunc_p = out;
trunc_p = (char_u *)out;
width = 0;
for (;;) {
width += ptr2cells(trunc_p);
@ -5179,7 +5177,7 @@ static int chk_modeline(linenr_T lnum, int flags)
if (*e == ':'
&& (s[0] != 'V'
|| STRNCMP(skipwhite(e + 1), "set", 3) == 0)
|| STRNCMP(skipwhite((char *)e + 1), "set", 3) == 0)
&& (s[3] == ':'
|| (VIM_VERSION_100 >= vers && isdigit(s[3]))
|| (VIM_VERSION_100 < vers && s[3] == '<')
@ -5209,7 +5207,7 @@ static int chk_modeline(linenr_T lnum, int flags)
end = false;
while (end == false) {
s = skipwhite(s);
s = (char_u *)skipwhite((char *)s);
if (*s == NUL) {
break;
}

View File

@ -550,7 +550,7 @@ void ins_bytes_len(char_u *p, size_t len)
void ins_char(int c)
{
char_u buf[MB_MAXBYTES + 1];
size_t n = (size_t)utf_char2bytes(c, buf);
size_t n = (size_t)utf_char2bytes(c, (char *)buf);
// When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte.
// Happens for CTRL-Vu9900.
@ -1010,7 +1010,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
&& !(State & VREPLACE_FLAG)) {
p_extra = saved_line + curwin->w_cursor.col;
if (do_si) { // need first char after new line break
p = skipwhite(p_extra);
p = (char_u *)skipwhite((char *)p_extra);
first_char = *p;
}
extra_len = (int)STRLEN(p_extra);
@ -1077,7 +1077,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// */
// #define IN_THE_WAY
// This should line up here;
p = skipwhite(ptr);
p = (char_u *)skipwhite((char *)ptr);
if (p[0] == '/' && p[1] == '*') {
p++;
}
@ -1160,7 +1160,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
newindent = get_indent();
}
}
p = skipwhite(ptr);
p = (char_u *)skipwhite((char *)ptr);
if (*p == '}') { // if line starts with '}': do indent
did_si = true;
} else { // can delete indent when '{' typed
@ -1296,7 +1296,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Remember where the end is, might want to use it to find the
// start (for C-comments).
if (dir == FORWARD) {
comment_end = skipwhite(saved_line);
comment_end = (char_u *)skipwhite((char *)saved_line);
lead_len = 0;
break;
}
@ -1426,7 +1426,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
}
} else { // left adjusted leader
p = skipwhite(leader);
p = (char_u *)skipwhite((char *)leader);
// Compute the length of the replaced characters in
// screen characters, not bytes. Move the part that is
// not to be overwritten.
@ -1500,7 +1500,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while (off > 0 && lead_len > 0
&& leader[lead_len - 1] == ' ') {
// Don't do it when there is a tab before the space
if (vim_strchr(skipwhite(leader), '\t') != NULL) {
if (vim_strchr((char_u *)skipwhite((char *)leader), '\t') != NULL) {
break;
}
lead_len--;

View File

@ -488,7 +488,7 @@ char_u *str_foldcase(char_u *str, int orglen, char_u *buf, int buflen)
}
}
}
(void)utf_char2bytes(lc, STR_PTR(i));
(void)utf_char2bytes(lc, (char *)STR_PTR(i));
}
// skip to next multi-byte char
@ -1144,11 +1144,11 @@ void getvcols(win_T *wp, pos_T *pos1, pos_T *pos2, colnr_T *left, colnr_T *right
/// @param[in] p String to skip in.
///
/// @return Pointer to character after the skipped whitespace.
char_u *skipwhite(const char_u *const p)
char *skipwhite(const char *const p)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
FUNC_ATTR_NONNULL_RET
{
return skipwhite_len(p, STRLEN(p));
return (char *)skipwhite_len((char_u *)p, STRLEN(p));
}
/// Like `skipwhite`, but skip up to `len` characters.
@ -1179,7 +1179,7 @@ intptr_t getwhitecols_curline(void)
intptr_t getwhitecols(const char_u *p)
FUNC_ATTR_PURE
{
return skipwhite(p) - p;
return (char_u *)skipwhite((char *)p) - p;
}
/// Skip over digits
@ -1400,7 +1400,7 @@ long getdigits_long(char_u **pp, bool strict, long def)
bool vim_isblankline(char_u *lbuf)
FUNC_ATTR_PURE
{
char_u *p = skipwhite(lbuf);
char_u *p = (char_u *)skipwhite((char *)lbuf);
return *p == NUL || *p == '\r' || *p == '\n';
}

View File

@ -130,7 +130,7 @@ bool ctx_restore(Context *ctx, const int flags)
}
char_u *op_shada;
get_option_value("shada", NULL, &op_shada, OPT_GLOBAL);
get_option_value("shada", NULL, (char **)&op_shada, OPT_GLOBAL);
set_option_value("shada", 0L, "!,'100,%", OPT_GLOBAL);
if (flags & kCtxRegs) {

View File

@ -141,7 +141,7 @@ void do_debug(char_u *cmd)
// If this is a debug command, set "last_cmd".
// If not, reset "last_cmd".
// For a blank line use previous command.
p = skipwhite(cmdline);
p = (char_u *)skipwhite((char *)cmdline);
if (*p != NUL) {
switch (*p) {
case 'c':
@ -242,7 +242,7 @@ void do_debug(char_u *cmd)
if (*p == NUL) {
do_showbacktrace(cmd);
} else {
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
do_setdebugtracelevel(p);
}
continue;
@ -501,14 +501,14 @@ static int dbg_parsearg(char_u *arg, garray_T *gap)
semsg(_(e_invarg2), p);
return FAIL;
}
p = skipwhite(p + 4);
p = (char_u *)skipwhite((char *)p + 4);
// Find optional line number.
if (here) {
bp->dbg_lnum = curwin->w_cursor.lnum;
} else if (gap != &prof_ga && ascii_isdigit(*p)) {
bp->dbg_lnum = getdigits_long(&p, true, 0);
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
} else {
bp->dbg_lnum = 0;
}

View File

@ -754,7 +754,7 @@ static int diff_write_buffer(buf_T *buf, diffin_T *din)
c = utf_fold(c);
}
const int orig_len = utfc_ptr2len((char *)s);
if (utf_char2bytes(c, cbuf) != orig_len) {
if (utf_char2bytes(c, (char *)cbuf) != orig_len) {
// TODO(Bram): handle byte length difference
memmove(ptr + len, s, (size_t)orig_len);
} else {
@ -1970,7 +1970,7 @@ static bool diff_equal_char(const char_u *const p1, const char_u *const p2, int
static int diff_cmp(char_u *s1, char_u *s2)
{
if ((diff_flags & DIFF_IBLANK)
&& (*skipwhite(s1) == NUL || *skipwhite(s2) == NUL)) {
&& (*(char_u *)skipwhite((char *)s1) == NUL || *skipwhite((char *)s2) == NUL)) {
return 0;
}
@ -1991,8 +1991,8 @@ static int diff_cmp(char_u *s1, char_u *s2)
&& ascii_iswhite(*p1) && ascii_iswhite(*p2))
|| ((diff_flags & DIFF_IWHITEALL)
&& (ascii_iswhite(*p1) || ascii_iswhite(*p2)))) {
p1 = skipwhite(p1);
p2 = skipwhite(p2);
p1 = (char_u *)skipwhite((char *)p1);
p2 = (char_u *)skipwhite((char *)p2);
} else {
int l;
if (!diff_equal_char(p1, p2, &l)) {
@ -2004,8 +2004,8 @@ static int diff_cmp(char_u *s1, char_u *s2)
}
// Ignore trailing white space.
p1 = skipwhite(p1);
p2 = skipwhite(p2);
p1 = (char_u *)skipwhite((char *)p1);
p2 = (char_u *)skipwhite((char *)p2);
if ((*p1 != NUL) || (*p2 != NUL)) {
return 1;
@ -2334,8 +2334,8 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
|| ((diff_flags & DIFF_IWHITEALL)
&& (ascii_iswhite(line_org[si_org])
|| ascii_iswhite(line_new[si_new])))) {
si_org = (int)(skipwhite(line_org + si_org) - line_org);
si_new = (int)(skipwhite(line_new + si_new) - line_new);
si_org = (int)((char_u *)skipwhite((char *)line_org + si_org) - line_org);
si_new = (int)((char_u *)skipwhite((char *)line_new + si_new) - line_new);
} else {
if (!diff_equal_char(line_org + si_org, line_new + si_new, &l)) {
break;

View File

@ -1646,7 +1646,7 @@ bool check_digraph_chars_valid(int char1, int char2)
{
if (char2 == 0) {
char_u msg[MB_MAXBYTES + 1];
msg[utf_char2bytes(char1, msg)] = NUL;
msg[utf_char2bytes(char1, (char *)msg)] = NUL;
semsg(_(e_digraph_must_be_just_two_characters_str), msg);
return false;
}
@ -1664,7 +1664,7 @@ bool check_digraph_chars_valid(int char1, int char2)
void putdigraph(char_u *str)
{
while (*str != NUL) {
str = skipwhite(str);
str = (char_u *)skipwhite((char *)str);
if (*str == NUL) {
return;
@ -1676,7 +1676,7 @@ void putdigraph(char_u *str)
return;
}
str = skipwhite(str);
str = (char_u *)skipwhite((char *)str);
if (!ascii_isdigit(*str)) {
emsg(_(e_number_exp));
@ -1745,7 +1745,7 @@ static void digraph_getlist_appendpair(const digr_T *dp, list_T *l)
tv_list_append_string(l2, (char *)buf, -1);
char_u *p = buf;
p += utf_char2bytes(dp->result, p);
p += utf_char2bytes(dp->result, (char *)p);
*p = NUL;
tv_list_append_string(l2, (char *)buf, -1);
}
@ -1853,7 +1853,7 @@ static void printdigraph(const digr_T *dp, result_T *previous)
if (utf_iscomposing(dp->result)) {
*p++ = ' ';
}
p += utf_char2bytes(dp->result, p);
p += utf_char2bytes(dp->result, (char *)p);
*p = NUL;
msg_outtrans_attr(buf, HL_ATTR(HLF_8));
@ -1933,7 +1933,7 @@ void f_digraph_get(typval_T *argvars, typval_T *rettv, FunPtr fptr)
int code = digraph_get(digraphs[0], digraphs[1], false);
char_u buf[NUMBUFLEN];
buf[utf_char2bytes(code, buf)] = NUL;
buf[utf_char2bytes(code, (char *)buf)] = NUL;
rettv->vval.v_string = (char *)vim_strsave(buf);
}
@ -2093,13 +2093,13 @@ void ex_loadkeymap(exarg_T *eap)
break;
}
char_u *p = skipwhite(line);
char_u *p = (char_u *)skipwhite((char *)line);
if ((*p != '"') && (*p != NUL)) {
kmap_T *kp = GA_APPEND_VIA_PTR(kmap_T, &curbuf->b_kmap_ga);
s = skiptowhite(p);
kp->from = vim_strnsave(p, (size_t)(s - p));
p = skipwhite(s);
p = (char_u *)skipwhite((char *)s);
s = skiptowhite(p);
kp->to = vim_strnsave(p, (size_t)(s - p));

View File

@ -1339,7 +1339,7 @@ normalchar:
ins_char(s->c);
}
}
AppendToRedobuffLit(str, -1);
AppendToRedobuffLit((char *)str, -1);
}
xfree(str);
s->c = NUL;
@ -2354,7 +2354,7 @@ int ins_compl_add_infercase(char_u *str_arg, int len, bool icase, char_u *fname,
char_u *p = IObuff;
i = 0;
while (i < actual_len && (p - IObuff + 6) < IOSIZE) {
p += utf_char2bytes(wca[i++], p);
p += utf_char2bytes(wca[i++], (char *)p);
}
*p = NUL;
}
@ -3515,7 +3515,7 @@ static void ins_compl_addleader(int c)
if ((cc = utf_char2len(c)) > 1) {
char_u buf[MB_MAXBYTES + 1];
utf_char2bytes(c, buf);
utf_char2bytes(c, (char *)buf);
buf[cc] = NUL;
ins_char_bytes(buf, (size_t)cc);
} else {
@ -3939,7 +3939,7 @@ static void ins_compl_fixRedoBufForLeader(char_u *ptr_arg)
} else {
len = 0;
}
AppendToRedobuffLit(ptr + len, -1);
AppendToRedobuffLit((char *)ptr + len, -1);
}
/*
@ -4513,7 +4513,7 @@ static int ins_compl_get_exp(pos_T *ini)
}
ptr = ml_get_buf(ins_buf, pos->lnum + 1, false);
if (!p_paste) {
ptr = skipwhite(ptr);
ptr = (char_u *)skipwhite((char *)ptr);
}
}
len = (int)STRLEN(ptr);
@ -4541,7 +4541,7 @@ static int ins_compl_get_exp(pos_T *ini)
// compl_length, so the next STRNCPY always works -- Acevedo
STRNCPY(IObuff, ptr, len);
ptr = ml_get_buf(ins_buf, pos->lnum + 1, false);
tmp_ptr = ptr = skipwhite(ptr);
tmp_ptr = ptr = (char_u *)skipwhite((char *)ptr);
// Find start of next word.
tmp_ptr = find_word_start(tmp_ptr);
// Find end of next word.
@ -5126,8 +5126,9 @@ static int ins_complete(int c, bool enable_pum)
* mode but first we need to redefine compl_startpos */
if (compl_cont_status & CONT_S_IPOS) {
compl_cont_status |= CONT_SOL;
compl_startpos.col = (colnr_T)(skipwhite(line + compl_length
+ compl_startpos.col) - line);
compl_startpos.col = (colnr_T)((char_u *)skipwhite((char *)line
+ compl_length
+ compl_startpos.col) - line);
}
compl_col = compl_startpos.col;
}
@ -5739,8 +5740,8 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
}
p[len - 1] = NUL;
ins_str(p);
AppendToRedobuffLit(p, -1);
ctrlv = FALSE;
AppendToRedobuffLit((char *)p, -1);
ctrlv = false;
}
}
if (stop_arrow() == OK) {
@ -5942,7 +5943,7 @@ void insertchar(int c, int flags, int second_indent)
i = 0;
}
if (buf[i] != NUL) {
AppendToRedobuffLit(buf + i, -1);
AppendToRedobuffLit((char *)buf + i, -1);
}
} else {
int cc;
@ -5950,7 +5951,7 @@ void insertchar(int c, int flags, int second_indent)
if ((cc = utf_char2len(c)) > 1) {
char_u buf[MB_MAXBYTES + 1];
utf_char2bytes(c, buf);
utf_char2bytes(c, (char *)buf);
buf[cc] = NUL;
ins_char_bytes(buf, (size_t)cc);
AppendCharToRedobuff(c);
@ -6853,7 +6854,7 @@ char_u *add_char2buf(int c, char_u *s)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{
char_u temp[MB_MAXBYTES + 1];
const int len = utf_char2bytes(c, temp);
const int len = utf_char2bytes(c, (char *)temp);
for (int i = 0; i < len; i++) {
c = temp[i];
// Need to escape K_SPECIAL like in the typeahead buffer.
@ -7557,7 +7558,7 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
} else if (*look == 'e') {
if (try_match && keytyped == 'e' && curwin->w_cursor.col >= 4) {
p = get_cursor_line_ptr();
if (skipwhite(p) == p + curwin->w_cursor.col - 4
if ((char_u *)skipwhite((char *)p) == p + curwin->w_cursor.col - 4
&& STRNCMP(p + curwin->w_cursor.col - 4, "else", 4) == 0) {
return true;
}
@ -8226,7 +8227,7 @@ static void ins_shift(int c, int lastc)
change_indent(c == Ctrl_D ? INDENT_DEC : INDENT_INC, 0, TRUE, 0, TRUE);
}
if (did_ai && *skipwhite(get_cursor_line_ptr()) != NUL) {
if (did_ai && *skipwhite((char *)get_cursor_line_ptr()) != NUL) {
did_ai = false;
}
did_si = false;
@ -9413,7 +9414,7 @@ static void ins_try_si(int c)
old_pos = curwin->w_cursor;
i = get_indent();
while (curwin->w_cursor.lnum > 1) {
ptr = skipwhite(ml_get(--(curwin->w_cursor.lnum)));
ptr = (char_u *)skipwhite((char *)ml_get(--(curwin->w_cursor.lnum)));
// ignore empty lines and lines starting with '#'.
if (*ptr != '#' && *ptr != NUL) {
@ -9479,7 +9480,7 @@ static char_u *do_insert_char_pre(int c)
if (!has_event(EVENT_INSERTCHARPRE)) {
return NULL;
}
buf[utf_char2bytes(c, (char_u *)buf)] = NUL;
buf[utf_char2bytes(c, buf)] = NUL;
// Lock the text to avoid weird things from happening.
textlock++;

View File

@ -778,7 +778,7 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r
return FAIL;
}
funcexe.evaluate = true;
if (call_func((char_u *)s, -1, rettv, argc, argv, &funcexe) == FAIL) {
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) {
return FAIL;
}
} else if (expr->v_type == VAR_PARTIAL) {
@ -789,7 +789,7 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r
}
funcexe.evaluate = true;
funcexe.partial = partial;
if (call_func((char_u *)s, -1, rettv, argc, argv, &funcexe) == FAIL) {
if (call_func(s, -1, rettv, argc, argv, &funcexe) == FAIL) {
return FAIL;
}
} else {
@ -798,11 +798,11 @@ int eval_expr_typval(const typval_T *expr, typval_T *argv, int argc, typval_T *r
if (s == NULL) {
return FAIL;
}
s = (char *)skipwhite((char_u *)s);
s = skipwhite(s);
if (eval1_emsg(&s, rettv, true) == FAIL) {
return FAIL;
}
if (*skipwhite((char_u *)s) != NUL) { // check for trailing chars after expr
if (*skipwhite(s) != NUL) { // check for trailing chars after expr
tv_clear(rettv);
semsg(_(e_invexpr2), s);
return FAIL;
@ -865,7 +865,7 @@ int skip_expr(char **pp)
{
typval_T rettv;
*pp = (char *)skipwhite((char_u *)(*pp));
*pp = skipwhite(*pp);
return eval1(pp, &rettv, false);
}
@ -938,7 +938,7 @@ varnumber_T eval_to_number(char *expr)
{
typval_T rettv;
varnumber_T retval;
char *p = (char *)skipwhite((char_u *)expr);
char *p = skipwhite(expr);
++emsg_off;
@ -1014,7 +1014,7 @@ list_T *eval_spell_expr(char *badword, char *expr)
typval_T save_val;
typval_T rettv;
list_T *list = NULL;
char *p = (char *)skipwhite((char_u *)expr);
char *p = skipwhite(expr);
// Set "v:val" to the bad word.
prepare_vimvar(VV_VAL, &save_val);
@ -1096,7 +1096,7 @@ int call_vim_function(const char *func, int argc, typval_T *argv, typval_T *rett
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = true;
funcexe.partial = pt;
ret = call_func((char_u *)func, len, rettv, argc, argv, &funcexe);
ret = call_func(func, len, rettv, argc, argv, &funcexe);
fail:
if (ret == FAIL) {
@ -1287,10 +1287,10 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
}
// Check for the optional 'trim' word before the marker
cmd = (char *)skipwhite((char_u *)cmd);
cmd = skipwhite(cmd);
if (STRNCMP(cmd, "trim", 4) == 0
&& (cmd[4] == NUL || ascii_iswhite(cmd[4]))) {
cmd = (char *)skipwhite((char_u *)cmd + 4);
cmd = skipwhite(cmd + 4);
// Trim the indentation from all the lines in the here document.
// The amount of indentation trimmed is the same as the indentation of
@ -1306,9 +1306,9 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
// The marker is the next word.
if (*cmd != NUL && *cmd != '"') {
marker = (char *)skipwhite((char_u *)cmd);
marker = skipwhite(cmd);
p = (char *)skiptowhite((char_u *)marker);
if (*skipwhite((char_u *)p) != NUL && *skipwhite((char_u *)p) != '"') {
if (*skipwhite(p) != NUL && *skipwhite(p) != '"') {
emsg(_(e_trailing));
return NULL;
}
@ -1406,7 +1406,7 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
if (argend > arg && argend[-1] == '.') { // For var.='str'.
argend--;
}
expr = (char *)skipwhite((char_u *)argend);
expr = skipwhite(argend);
if (*expr != '=' && !((vim_strchr((char_u *)"+-*/%.", *expr) != NULL
&& expr[1] == '=') || STRNCMP(expr, "..=", 3) == 0)) {
// ":let" without "=": list variables
@ -1449,9 +1449,9 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
expr++;
}
}
expr = (char *)skipwhite((char_u *)expr + 2);
expr = skipwhite(expr + 2);
} else {
expr = (char *)skipwhite((char_u *)expr + 1);
expr = skipwhite(expr + 1);
}
if (eap->skip) {
@ -1522,7 +1522,7 @@ static int ex_let_vars(char *arg_start, typval_T *tv, int copy, int semicolon, i
listitem_T *item = tv_list_first(l);
size_t rest_len = tv_list_len(l);
while (*arg != ']') {
arg = (char *)skipwhite((char_u *)arg + 1);
arg = skipwhite(arg + 1);
arg = ex_let_one(arg, TV_LIST_ITEM_TV(item), true, is_const, ",;]", op);
if (arg == NULL) {
return FAIL;
@ -1530,7 +1530,7 @@ static int ex_let_vars(char *arg_start, typval_T *tv, int copy, int semicolon, i
rest_len--;
item = TV_LIST_ITEM_NEXT(l, item);
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
if (*arg == ';') {
/* Put the rest of the list (may be empty) in the var after ';'.
* Create a new list for this. */
@ -1545,7 +1545,7 @@ static int ex_let_vars(char *arg_start, typval_T *tv, int copy, int semicolon, i
ltv.vval.v_list = rest_list;
tv_list_ref(rest_list);
arg = ex_let_one((char *)skipwhite((char_u *)arg + 1), &ltv, false, is_const, "]", op);
arg = ex_let_one(skipwhite(arg + 1), &ltv, false, is_const, "]", op);
tv_clear(&ltv);
if (arg == NULL) {
return FAIL;
@ -1575,7 +1575,7 @@ static const char *skip_var_list(const char *arg, int *var_count, int *semicolon
// "[var, var]": find the matching ']'.
p = arg;
for (;;) {
p = (char *)skipwhite((char_u *)p + 1); // skip whites after '[', ';' or ','
p = skipwhite(p + 1); // skip whites after '[', ';' or ','
s = skip_var_one((char *)p);
if (s == p) {
semsg(_(e_invarg2), p);
@ -1583,7 +1583,7 @@ static const char *skip_var_list(const char *arg, int *var_count, int *semicolon
}
++*var_count;
p = (char *)skipwhite((char_u *)s);
p = skipwhite(s);
if (*p == ']') {
break;
} else if (*p == ';') {
@ -1766,7 +1766,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
xfree(tofree);
}
arg = (const char *)skipwhite((const char_u *)arg);
arg = (const char *)skipwhite(arg);
}
return arg;
@ -1812,7 +1812,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL) {
semsg(_(e_letwrong), op);
} else if (endchars != NULL
&& vim_strchr((char_u *)endchars, *skipwhite((char_u *)arg)) == NULL) {
&& vim_strchr((char_u *)endchars, *skipwhite(arg)) == NULL) {
emsg(_(e_letunexp));
} else if (!check_secure()) {
const char c1 = name[len];
@ -1855,7 +1855,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
char *const p = (char *)find_option_end((const char **)&arg, &opt_flags);
if (p == NULL
|| (endchars != NULL
&& vim_strchr((char_u *)endchars, *skipwhite((const char_u *)p)) == NULL)) {
&& vim_strchr((char_u *)endchars, *skipwhite(p)) == NULL)) {
emsg(_(e_letunexp));
} else {
int opt_type;
@ -1871,8 +1871,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
s = tv_get_string_chk(tv); // != NULL if number or string.
}
if (s != NULL && op != NULL && *op != '=') {
opt_type = get_option_value(arg, &numval, (char_u **)&stringval,
opt_flags);
opt_type = get_option_value(arg, &numval, &stringval, opt_flags);
if ((opt_type == 1 && *op == '.')
|| (opt_type == 0 && *op != '.')) {
semsg(_(e_letwrong), op);
@ -1918,7 +1917,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
if (op != NULL && vim_strchr((char_u *)"+-*/%", *op) != NULL) {
semsg(_(e_letwrong), op);
} else if (endchars != NULL
&& vim_strchr((char_u *)endchars, *skipwhite((char_u *)arg + 1)) == NULL) {
&& vim_strchr((char_u *)endchars, *skipwhite(arg + 1)) == NULL) {
emsg(_(e_letunexp));
} else {
char *s;
@ -1950,7 +1949,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
char *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((char_u *)endchars, *skipwhite((char_u *)p)) == NULL) {
if (endchars != NULL && vim_strchr((char_u *)endchars, *skipwhite(p)) == NULL) {
emsg(_(e_letunexp));
} else {
set_var_lval(&lv, p, tv, copy, is_const, op);
@ -2098,7 +2097,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
p = key + len;
} else {
// Get the index [expr] or the first index [expr: ].
p = (char *)skipwhite((char_u *)p + 1);
p = skipwhite(p + 1);
if (*p == ':') {
empty1 = true;
} else {
@ -2111,7 +2110,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
tv_clear(&var1);
return NULL;
}
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
}
// Optionally get the second index [ :expr].
@ -2132,7 +2131,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
tv_clear(&var1);
return NULL;
}
p = (char *)skipwhite((char_u *)p + 1);
p = skipwhite(p + 1);
if (*p == ']') {
lp->ll_empty2 = true;
} else {
@ -2577,7 +2576,7 @@ void *eval_for_line(const char *arg, bool *errp, char **nextcmdp, int skip)
return fi;
}
expr = (char *)skipwhite((char_u *)expr);
expr = skipwhite(expr);
if (expr[0] != 'i' || expr[1] != 'n' || !ascii_iswhite(expr[2])) {
emsg(_("E690: Missing \"in\" after :for"));
return fi;
@ -2586,7 +2585,7 @@ void *eval_for_line(const char *arg, bool *errp, char **nextcmdp, int skip)
if (skip) {
++emsg_skip;
}
if (eval0((char *)skipwhite((char_u *)expr + 2), &tv, nextcmdp, !skip) == OK) {
if (eval0(skipwhite(expr + 2), &tv, nextcmdp, !skip) == OK) {
*errp = false;
if (!skip) {
if (tv.v_type == VAR_LIST) {
@ -2798,10 +2797,10 @@ void set_context_for_expression(expand_T *xp, char *arg, cmdidx_T cmdidx)
for (;;) {
char *const n = (char *)skiptowhite((char_u *)arg);
if (n == arg || ascii_iswhite_or_nul(*skipwhite((char_u *)n))) {
if (n == arg || ascii_iswhite_or_nul(*skipwhite(n))) {
break;
}
arg = (char *)skipwhite((char_u *)n);
arg = skipwhite(n);
}
}
@ -2826,7 +2825,7 @@ void ex_lockvar(exarg_T *eap)
deep = -1;
} else if (ascii_isdigit(*arg)) {
deep = getdigits_int((char_u **)&arg, false, -1);
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
}
ex_unletlock(eap, arg, deep, do_lock_var);
@ -2891,7 +2890,7 @@ static void ex_unletlock(exarg_T *eap, char *argstart, int deep, ex_unletlock_ca
clear_lval(&lv);
}
}
arg = (char *)skipwhite((char_u *)name_end);
arg = skipwhite(name_end);
} while (!ends_excmd(*arg));
eap->nextcmd = (char *)check_nextcmd((char_u *)arg);
@ -3355,7 +3354,7 @@ int eval0(char *arg, typval_T *rettv, char **nextcmd, int evaluate)
const int did_emsg_before = did_emsg;
const int called_emsg_before = called_emsg;
p = (char *)skipwhite((char_u *)arg);
p = skipwhite(arg);
ret = eval1(&p, rettv, evaluate);
if (ret == FAIL || !ends_excmd(*p)) {
if (ret != FAIL) {
@ -3418,7 +3417,7 @@ int eval1(char **arg, typval_T *rettv, int evaluate)
/*
* Get the second variable.
*/
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (eval1(arg, rettv, evaluate && result) == FAIL) { // recursive!
return FAIL;
}
@ -3437,7 +3436,7 @@ int eval1(char **arg, typval_T *rettv, int evaluate)
/*
* Get the third variable.
*/
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (eval1(arg, &var2, evaluate && !result) == FAIL) { // Recursive!
if (evaluate && result) {
tv_clear(rettv);
@ -3495,7 +3494,7 @@ static int eval2(char **arg, typval_T *rettv, int evaluate)
/*
* Get the second variable.
*/
*arg = (char *)skipwhite((char_u *)(*arg) + 2);
*arg = skipwhite(*arg + 2);
if (eval3(arg, &var2, evaluate && !result) == FAIL) {
return FAIL;
}
@ -3564,7 +3563,7 @@ static int eval3(char **arg, typval_T *rettv, int evaluate)
/*
* Get the second variable.
*/
*arg = (char *)skipwhite((char_u *)(*arg) + 2);
*arg = skipwhite(*arg + 2);
if (eval4(arg, &var2, evaluate && result) == FAIL) {
return FAIL;
}
@ -3683,7 +3682,7 @@ static int eval4(char **arg, typval_T *rettv, int evaluate)
}
// Get the second variable.
*arg = (char *)skipwhite((char_u *)p + len);
*arg = skipwhite(p + len);
if (eval5(arg, &var2, evaluate) == FAIL) {
tv_clear(rettv);
return FAIL;
@ -3757,7 +3756,7 @@ static int eval5(char **arg, typval_T *rettv, int evaluate)
if (op == '.' && *(*arg + 1) == '.') { // ..string concatenation
(*arg)++;
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (eval6(arg, &var2, evaluate, op == '.') == FAIL) {
tv_clear(rettv);
return FAIL;
@ -3930,7 +3929,7 @@ static int eval6(char **arg, typval_T *rettv, int evaluate, int want_string)
/*
* Get the second variable.
*/
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (eval7(arg, &var2, evaluate, false) == FAIL) {
return FAIL;
}
@ -4042,7 +4041,7 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
// Skip '!', '-' and '+' characters. They are handled later.
start_leader = *arg;
while (**arg == '!' || **arg == '-' || **arg == '+') {
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
}
end_leader = *arg;
@ -4195,7 +4194,7 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
// nested expression: (expression).
case '(':
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
ret = eval1(arg, rettv, evaluate); // recursive!
if (**arg == ')') {
++*arg;
@ -4235,7 +4234,7 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
xfree(alias);
}
*arg = (char *)skipwhite((char_u *)(*arg));
*arg = skipwhite(*arg);
// Handle following '[', '(' and '.' for expr[expr], expr.name,
// expr(expr), expr->name(expr)
@ -4377,7 +4376,7 @@ static int eval_lambda(char **const arg, typval_T *const rettv, const bool evalu
return FAIL;
} else if (**arg != '(') {
if (verbose) {
if (*skipwhite((char_u *)(*arg)) == '(') {
if (*skipwhite(*arg) == '(') {
emsg(_(e_nowhitespace));
} else {
semsg(_(e_missingparen), "lambda");
@ -4419,7 +4418,7 @@ static int eval_method(char **const arg, typval_T *const rettv, const bool evalu
if (STRNCMP(name, "v:lua.", 6) == 0) {
lua_funcname = name + 6;
*arg = (char *)skip_luafunc_name((const char *)lua_funcname);
*arg = (char *)skipwhite((char_u *)(*arg)); // to detect trailing whitespace later
*arg = skipwhite(*arg); // to detect trailing whitespace later
len = *arg - lua_funcname;
} else {
char *alias;
@ -4530,14 +4529,14 @@ static int eval_index(char **arg, typval_T *rettv, int evaluate, int verbose)
if (len == 0) {
return FAIL;
}
*arg = (char *)skipwhite((char_u *)key + len);
*arg = skipwhite(key + len);
} else {
/*
* something[idx]
*
* Get the (first) variable from inside the [].
*/
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (**arg == ':') {
empty1 = true;
} else if (eval1(arg, &var1, evaluate) == FAIL) { // Recursive!
@ -4553,7 +4552,7 @@ static int eval_index(char **arg, typval_T *rettv, int evaluate, int verbose)
*/
if (**arg == ':') {
range = true;
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (**arg == ']') {
empty2 = true;
} else if (eval1(arg, &var2, evaluate) == FAIL) { // Recursive!
@ -4582,7 +4581,7 @@ static int eval_index(char **arg, typval_T *rettv, int evaluate, int verbose)
}
return FAIL;
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1); // skip the ']'
*arg = skipwhite(*arg + 1); // skip the ']'
}
if (evaluate) {
@ -4815,7 +4814,7 @@ int get_option_tv(const char **const arg, typval_T *const rettv, const bool eval
char c = *option_end;
*option_end = NUL;
opt_type = get_option_value(*arg, &numval,
rettv == NULL ? NULL : (char_u **)&stringval, opt_flags);
rettv == NULL ? NULL : &stringval, opt_flags);
if (opt_type == -3) { // invalid name
if (rettv != NULL) {
@ -4929,7 +4928,7 @@ static int get_string_tv(char **arg, typval_T *rettv, int evaluate)
// For "\u" store the number according to
// 'encoding'.
if (c != 'X') {
name += utf_char2bytes(nr, (char_u *)name);
name += utf_char2bytes(nr, name);
} else {
*name++ = nr;
}
@ -5095,7 +5094,7 @@ static int get_list_tv(char **arg, typval_T *rettv, int evaluate)
l = tv_list_alloc(kListLenShouldKnow);
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
while (**arg != ']' && **arg != NUL) {
typval_T tv;
if (eval1(arg, &tv, evaluate) == FAIL) { // Recursive!
@ -5113,7 +5112,7 @@ static int get_list_tv(char **arg, typval_T *rettv, int evaluate)
semsg(_("E696: Missing comma in List: %s"), *arg);
goto failret;
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
}
if (**arg != ']') {
@ -5125,7 +5124,7 @@ failret:
return FAIL;
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (evaluate) {
tv_list_set_ret(rettv, l);
}
@ -5700,7 +5699,7 @@ static int get_literal_key(char **arg, typval_T *tv)
tv->v_type = VAR_STRING;
tv->vval.v_string = xstrnsave(*arg, p - *arg);
*arg = (char *)skipwhite((char_u *)p);
*arg = skipwhite(p);
return OK;
}
@ -5715,7 +5714,7 @@ static int dict_get_tv(char **arg, typval_T *rettv, int evaluate, bool literal)
typval_T tv;
char *key = NULL;
dictitem_T *item;
char *start = (char *)skipwhite((char_u *)(*arg) + 1);
char *start = skipwhite(*arg + 1);
char buf[NUMBUFLEN];
/*
@ -5729,7 +5728,7 @@ static int dict_get_tv(char **arg, typval_T *rettv, int evaluate, bool literal)
if (eval1(&start, &tv, false) == FAIL) { // recursive!
return FAIL;
}
if (*skipwhite((char_u *)start) == '}') {
if (*skipwhite(start) == '}') {
return NOTDONE;
}
}
@ -5740,7 +5739,7 @@ static int dict_get_tv(char **arg, typval_T *rettv, int evaluate, bool literal)
tvkey.v_type = VAR_UNKNOWN;
tv.v_type = VAR_UNKNOWN;
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
while (**arg != '}' && **arg != NUL) {
if ((literal
? get_literal_key(arg, &tvkey)
@ -5761,7 +5760,7 @@ static int dict_get_tv(char **arg, typval_T *rettv, int evaluate, bool literal)
}
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (eval1(arg, &tv, evaluate) == FAIL) { // Recursive!
if (evaluate) {
tv_clear(&tvkey);
@ -5792,7 +5791,7 @@ static int dict_get_tv(char **arg, typval_T *rettv, int evaluate, bool literal)
semsg(_("E722: Missing comma in Dictionary: %s"), *arg);
goto failret;
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
}
if (**arg != '}') {
@ -5804,7 +5803,7 @@ failret:
return FAIL;
}
*arg = (char *)skipwhite((char_u *)(*arg) + 1);
*arg = skipwhite(*arg + 1);
if (evaluate) {
tv_dict_set_ret(rettv, d);
}
@ -7267,7 +7266,7 @@ bool callback_call(Callback *const callback, const int argcount_in, typval_T *co
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = true;
funcexe.partial = partial;
return call_func((char_u *)name, -1, rettv, argcount_in, argvars_in, &funcexe);
return call_func(name, -1, rettv, argcount_in, argvars_in, &funcexe);
}
static bool set_ref_in_callback(Callback *callback, int copyID, ht_stack_T **ht_stack,
@ -7969,7 +7968,7 @@ int get_id_len(const char **const arg)
}
len = (int)(p - *arg);
*arg = (const char *)skipwhite((const char_u *)p);
*arg = (const char *)skipwhite(p);
return len;
}
@ -8009,7 +8008,7 @@ int get_name_len(const char **const arg, char **alias, bool evaluate, bool verbo
if (expr_start != NULL) {
if (!evaluate) {
len += (int)(p - *arg);
*arg = (const char *)skipwhite((const char_u *)p);
*arg = (const char *)skipwhite(p);
return len;
}
@ -8022,7 +8021,7 @@ int get_name_len(const char **const arg, char **alias, bool evaluate, bool verbo
return -1;
}
*alias = temp_string;
*arg = (const char *)skipwhite((const char_u *)p);
*arg = (const char *)skipwhite(p);
return (int)STRLEN(temp_string);
}
@ -8231,7 +8230,7 @@ void set_vim_var_char(int c)
{
char buf[MB_MAXBYTES + 1];
buf[utf_char2bytes(c, (char_u *)buf)] = NUL;
buf[utf_char2bytes(c, buf)] = NUL;
set_vim_var_string(VV_CHAR, buf, -1);
}
@ -9473,7 +9472,7 @@ void ex_echo(exarg_T *eap)
xfree(tofree);
}
tv_clear(&rettv);
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
}
eap->nextcmd = (char *)check_nextcmd((char_u *)arg);
@ -9539,7 +9538,7 @@ void ex_execute(exarg_T *eap)
}
tv_clear(&rettv);
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
}
if (ret != FAIL && ga.ga_data != NULL) {
@ -10569,7 +10568,7 @@ typval_T eval_call_provider(char *provider, char *method, list_T *arguments, boo
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = true;
(void)call_func((const char_u *)func, name_len, &rettv, 2, argvars, &funcexe);
(void)call_func(func, name_len, &rettv, 2, argvars, &funcexe);
tv_list_unref(arguments);
// Restore caller scope information

View File

@ -415,7 +415,7 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
#define PUT_FST_IN_PAIR(fst_in_pair, str_end) \
do { \
if (fst_in_pair != 0) { \
str_end += utf_char2bytes(fst_in_pair, (char_u *)str_end); \
str_end += utf_char2bytes(fst_in_pair, str_end); \
fst_in_pair = 0; \
} \
} while (0)
@ -440,15 +440,14 @@ static inline int parse_json_string(const char *const buf, const size_t buf_len,
fst_in_pair = (int)ch;
} else if (SURROGATE_LO_START <= ch && ch <= SURROGATE_LO_END
&& fst_in_pair != 0) {
const int full_char = (
(int)(ch - SURROGATE_LO_START)
const int full_char = ((int)(ch - SURROGATE_LO_START)
+ ((fst_in_pair - SURROGATE_HI_START) << 10)
+ SURROGATE_FIRST_CHAR);
str_end += utf_char2bytes(full_char, (char_u *)str_end);
str_end += utf_char2bytes(full_char, str_end);
fst_in_pair = 0;
} else {
PUT_FST_IN_PAIR(fst_in_pair, str_end);
str_end += utf_char2bytes((int)ch, (char_u *)str_end);
str_end += utf_char2bytes((int)ch, str_end);
}
break;
}

View File

@ -1893,7 +1893,7 @@ static void f_eval(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
const char *s = tv_get_string_chk(&argvars[0]);
if (s != NULL) {
s = (const char *)skipwhite((const char_u *)s);
s = (const char *)skipwhite(s);
}
const char *const expr_start = s;
@ -2079,7 +2079,7 @@ static void f_exists(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
} else if (*p == '&' || *p == '+') { // Option.
n = (get_option_tv(&p, NULL, true) == OK);
if (*skipwhite((const char_u *)p) != NUL) {
if (*skipwhite(p) != NUL) {
n = false; // Trailing garbage.
}
} else if (*p == '*') { // Internal or user defined function.
@ -2572,14 +2572,14 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
// Find interesting text in this line.
s = skipwhite(ml_get(lnum));
s = (char_u *)skipwhite((char *)ml_get(lnum));
// skip C comment-start
if (s[0] == '/' && (s[1] == '*' || s[1] == '/')) {
s = skipwhite(s + 2);
if (*skipwhite(s) == NUL && lnum + 1 < foldend) {
s = skipwhite(ml_get(lnum + 1));
s = (char_u *)skipwhite((char *)s + 2);
if (*skipwhite((char *)s) == NUL && lnum + 1 < foldend) {
s = (char_u *)skipwhite((char *)ml_get(lnum + 1));
if (*s == '*') {
s = skipwhite(s + 1);
s = (char_u *)skipwhite((char *)s + 1);
}
}
}
@ -3035,7 +3035,7 @@ static void getchar_common(typval_T *argvars, typval_T *rettv)
temp[i++] = K_SECOND(n);
temp[i++] = K_THIRD(n);
} else {
i += utf_char2bytes(n, temp + i);
i += utf_char2bytes(n, (char *)temp + i);
}
assert(i < 10);
temp[i++] = NUL;
@ -3087,7 +3087,7 @@ static void f_getcharstr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
int i = 0;
if (n != 0) {
i += utf_char2bytes(n, temp);
i += utf_char2bytes(n, (char *)temp);
}
assert(i < 7);
temp[i++] = NUL;
@ -5649,7 +5649,7 @@ static void f_list2str(typval_T *argvars, typval_T *rettv, FunPtr fptr)
char_u buf[MB_MAXBYTES + 1];
TV_LIST_ITER_CONST(l, li, {
buf[utf_char2bytes(tv_get_number(TV_LIST_ITEM_TV(li)), buf)] = NUL;
buf[utf_char2bytes(tv_get_number(TV_LIST_ITEM_TV(li)), (char *)buf)] = NUL;
ga_concat(&ga, (char *)buf);
});
ga_append(&ga, NUL);
@ -5707,12 +5707,16 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
mode = get_map_mode((char **)&which, 0);
char_u *keys_simplified
= replace_termcodes(keys, STRLEN(keys), &keys_buf, flags, &did_simplify, CPO_TO_CPO_FLAGS);
= (char_u *)replace_termcodes((char *)keys,
STRLEN(keys), (char **)&keys_buf, flags, &did_simplify,
CPO_TO_CPO_FLAGS);
rhs = check_map(keys_simplified, mode, exact, false, abbr, &mp, &buffer_local, &rhs_lua);
if (did_simplify) {
// When the lhs is being simplified the not-simplified keys are
// preferred for printing, like in do_map().
(void)replace_termcodes(keys, STRLEN(keys), &alt_keys_buf, flags | REPTERM_NO_SIMPLIFY, NULL,
(void)replace_termcodes((char *)keys,
STRLEN(keys),
(char **)&alt_keys_buf, flags | REPTERM_NO_SIMPLIFY, NULL,
CPO_TO_CPO_FLAGS);
rhs = check_map(alt_keys_buf, mode, exact, false, abbr, &mp, &buffer_local, &rhs_lua);
}
@ -6307,7 +6311,7 @@ static void f_nextnonblank(typval_T *argvars, typval_T *rettv, FunPtr fptr)
lnum = 0;
break;
}
if (*skipwhite(ml_get(lnum)) != NUL) {
if (*skipwhite((char *)ml_get(lnum)) != NUL) {
break;
}
}
@ -6339,7 +6343,7 @@ static void f_nr2char(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
char buf[MB_MAXBYTES];
const int len = utf_char2bytes((int)num, (char_u *)buf);
const int len = utf_char2bytes((int)num, buf);
rettv->v_type = VAR_STRING;
rettv->vval.v_string = xmemdupz(buf, (size_t)len);
@ -6395,7 +6399,7 @@ static void f_prevnonblank(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) {
lnum = 0;
} else {
while (lnum >= 1 && *skipwhite(ml_get(lnum)) == NUL) {
while (lnum >= 1 && *skipwhite((char *)ml_get(lnum)) == NUL) {
lnum--;
}
}
@ -7568,7 +7572,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, FunPtr fptr)
argv[0] = *rettv;
argv[1] = *TV_LIST_ITEM_TV(li);
rettv->v_type = VAR_UNKNOWN;
const int r = call_func(func_name, -1, rettv, 2, argv, &funcexe);
const int r = call_func((char *)func_name, -1, rettv, 2, argv, &funcexe);
tv_clear(&argv[0]);
if (r == FAIL || called_emsg != called_emsg_start) {
break;
@ -7601,7 +7605,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, FunPtr fptr)
argv[0] = *rettv;
argv[1].v_type = VAR_NUMBER;
argv[1].vval.v_number = tv_blob_get(b, i);
if (call_func(func_name, -1, rettv, 2, argv, &funcexe) == FAIL) {
if (call_func((char *)func_name, -1, rettv, 2, argv, &funcexe) == FAIL) {
return;
}
}
@ -9379,7 +9383,7 @@ static int item_compare2(const void *s1, const void *s2, bool keep_zero)
funcexe.evaluate = true;
funcexe.partial = partial;
funcexe.selfdict = sortinfo->item_compare_selfdict;
res = call_func((const char_u *)func_name, -1, &rettv, 2, argv, &funcexe);
res = call_func(func_name, -1, &rettv, 2, argv, &funcexe);
tv_clear(&argv[0]);
tv_clear(&argv[1]);
@ -9850,11 +9854,11 @@ static void f_stdpath(typval_T *argvars, typval_T *rettv, FunPtr fptr)
/// "str2float()" function
static void f_str2float(typval_T *argvars, typval_T *rettv, FunPtr fptr)
{
char_u *p = skipwhite((const char_u *)tv_get_string(&argvars[0]));
char_u *p = (char_u *)skipwhite(tv_get_string(&argvars[0]));
bool isneg = (*p == '-');
if (*p == '+' || *p == '-') {
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
}
(void)string2float((char *)p, &rettv->vval.v_float);
if (isneg) {
@ -9892,10 +9896,10 @@ static void f_str2nr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
}
}
char_u *p = skipwhite((const char_u *)tv_get_string(&argvars[0]));
char_u *p = (char_u *)skipwhite(tv_get_string(&argvars[0]));
bool isneg = (*p == '-');
if (*p == '+' || *p == '-') {
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
}
switch (base) {
case 2:
@ -10488,7 +10492,7 @@ static void f_synconcealed(typval_T *argvars, typval_T *rettv, FunPtr fptr)
: curwin->w_p_lcs_chars.conceal;
}
if (cchar != NUL) {
utf_char2bytes(cchar, str);
utf_char2bytes(cchar, (char *)str);
}
}
}

View File

@ -125,12 +125,12 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
*p = c;
}
if (*skipwhite(p) == '=' && default_args != NULL) {
if (*skipwhite((char *)p) == '=' && default_args != NULL) {
typval_T rettv;
any_default = true;
p = skipwhite(p) + 1;
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p) + 1;
p = (char_u *)skipwhite((char *)p);
char_u *expr = p;
if (eval1((char **)&p, &rettv, false) != FAIL) {
ga_grow(default_args, 1);
@ -159,7 +159,7 @@ static int get_function_args(char_u **argp, char_u endchar, garray_T *newargs, i
mustend = true;
}
}
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (mustend && *p != endchar) {
if (!skip) {
semsg(_(e_invarg2), *argp);
@ -222,7 +222,7 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate)
partial_T *pt = NULL;
int varargs;
int ret;
char_u *start = skipwhite(*arg + 1);
char_u *start = (char_u *)skipwhite((char *)(*arg) + 1);
char_u *s, *e;
bool *old_eval_lavars = eval_lavars_used;
bool eval_lavars = false;
@ -239,7 +239,7 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate)
} else {
pnewargs = NULL;
}
*arg = skipwhite(*arg + 1);
*arg = (char_u *)skipwhite((char *)(*arg) + 1);
ret = get_function_args(arg, '-', pnewargs, &varargs, NULL, false);
if (ret == FAIL || **arg != '>') {
goto errret;
@ -251,14 +251,14 @@ int get_lambda_tv(char_u **arg, typval_T *rettv, bool evaluate)
}
// Get the start and the end of the expression.
*arg = skipwhite(*arg + 1);
*arg = (char_u *)skipwhite((char *)(*arg) + 1);
s = *arg;
ret = skip_expr((char **)arg);
if (ret == FAIL) {
goto errret;
}
e = *arg;
*arg = skipwhite(*arg);
*arg = (char_u *)skipwhite((char *)(*arg));
if (**arg != '}') {
goto errret;
}
@ -422,7 +422,7 @@ int get_func_tv(const char_u *name, int len, typval_T *rettv, char_u **arg, func
argp = *arg;
while (argcount < MAX_FUNC_ARGS
- (funcexe->partial == NULL ? 0 : funcexe->partial->pt_argc)) {
argp = skipwhite(argp + 1); // skip the '(' or ','
argp = (char_u *)skipwhite((char *)argp + 1); // skip the '(' or ','
if (*argp == ')' || *argp == ',' || *argp == NUL) {
break;
}
@ -455,7 +455,7 @@ int get_func_tv(const char_u *name, int len, typval_T *rettv, char_u **arg, func
((typval_T **)funcargs.ga_data)[funcargs.ga_len++] = &argvars[i];
}
}
ret = call_func(name, len, rettv, argcount, argvars, funcexe);
ret = call_func((char *)name, len, rettv, argcount, argvars, funcexe);
funcargs.ga_len -= i;
} else if (!aborting()) {
@ -470,7 +470,7 @@ int get_func_tv(const char_u *name, int len, typval_T *rettv, char_u **arg, func
tv_clear(&argvars[argcount]);
}
*arg = skipwhite(argp);
*arg = (char_u *)skipwhite((char *)argp);
return ret;
}
@ -1370,7 +1370,7 @@ int func_call(char_u *name, typval_T *args, partial_T *partial, dict_T *selfdict
funcexe.evaluate = true;
funcexe.partial = partial;
funcexe.selfdict = selfdict;
r = call_func(name, -1, rettv, argc, argv, &funcexe);
r = call_func((char *)name, -1, rettv, argc, argv, &funcexe);
func_call_skip_call:
// Free the arguments.
@ -1442,8 +1442,8 @@ static void argv_add_base(typval_T *const basetv, typval_T **const argvars, int
/// @return FAIL if function cannot be called, else OK (even if an error
/// occurred while executing the function! Set `msg_list` to capture
/// the error, see do_cmdline()).
int call_func(const char_u *funcname, int len, typval_T *rettv, int argcount_in,
typval_T *argvars_in, funcexe_T *funcexe)
int call_func(const char *funcname, int len, typval_T *rettv, int argcount_in, typval_T *argvars_in,
funcexe_T *funcexe)
FUNC_ATTR_NONNULL_ARG(1, 3, 5, 6)
{
int ret = FAIL;
@ -1475,7 +1475,7 @@ int call_func(const char_u *funcname, int len, typval_T *rettv, int argcount_in,
if (fp == NULL) {
// Make a copy of the name, if it comes from a funcref variable it could
// be changed or deleted in the called function.
name = vim_strnsave(funcname, (size_t)len);
name = vim_strnsave((char_u *)funcname, (size_t)len);
fname = fname_trans_sid(name, fname_buf, &tofree, &error);
}
@ -1522,11 +1522,11 @@ int call_func(const char_u *funcname, int len, typval_T *rettv, int argcount_in,
if (len > 0) {
error = ERROR_NONE;
argv_add_base(funcexe->basetv, &argvars, &argcount, argv, &argv_base);
nlua_typval_call((const char *)funcname, (size_t)len, argvars, argcount, rettv);
nlua_typval_call(funcname, (size_t)len, argvars, argcount, rettv);
} else {
// v:lua was called directly; show its name in the emsg
XFREE_CLEAR(name);
funcname = (const char_u *)"v:lua";
funcname = "v:lua";
}
} else if (fp != NULL || !builtin_function((const char *)rfname, -1)) {
// User defined function.
@ -1608,7 +1608,7 @@ theend:
// Report an error unless the argument evaluation or function call has been
// cancelled due to an aborting error, an interrupt, or an exception.
if (!aborting()) {
user_func_error(error, (name != NULL) ? name : funcname);
user_func_error(error, (name != NULL) ? name : (char_u *)funcname);
}
// clear the copies made from the partial
@ -2039,7 +2039,7 @@ void ex_function(exarg_T *eap)
// - exclude line numbers from function body
//
if (!paren) {
if (!ends_excmd(*skipwhite(p))) {
if (!ends_excmd(*skipwhite((char *)p))) {
emsg(_(e_trailing));
goto ret_free;
}
@ -2083,7 +2083,7 @@ void ex_function(exarg_T *eap)
/*
* ":function name(arg1, arg2)" Define function.
*/
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (*p != '(') {
if (!eap->skip) {
semsg(_("E124: Missing '(': %s"), eap->arg);
@ -2094,7 +2094,7 @@ void ex_function(exarg_T *eap)
p = vim_strchr(p, '(');
}
}
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
ga_init(&newargs, (int)sizeof(char_u *), 3);
ga_init(&newlines, (int)sizeof(char_u *), 3);
@ -2135,7 +2135,7 @@ void ex_function(exarg_T *eap)
// find extra arguments "range", "dict", "abort" and "closure"
for (;;) {
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (STRNCMP(p, "range", 5) == 0) {
flags |= FC_RANGE;
p += 5;
@ -2249,13 +2249,13 @@ void ex_function(exarg_T *eap)
// * ":python <<EOF" and "EOF"
// * ":let {var-name} =<< [trim] {marker}" and "{marker}"
if (heredoc_trimmed == NULL
|| (is_heredoc && skipwhite(theline) == theline)
|| (is_heredoc && (char_u *)skipwhite((char *)theline) == theline)
|| STRNCMP(theline, heredoc_trimmed,
STRLEN(heredoc_trimmed)) == 0) {
if (heredoc_trimmed == NULL) {
p = theline;
} else if (is_heredoc) {
p = skipwhite(theline) == theline
p = (char_u *)skipwhite((char *)theline) == theline
? theline : theline + STRLEN(heredoc_trimmed);
} else {
p = theline + STRLEN(heredoc_trimmed);
@ -2279,7 +2279,7 @@ void ex_function(exarg_T *eap)
char_u *nextcmd = NULL;
if (*p == '|') {
nextcmd = p + 1;
} else if (line_arg != NULL && *skipwhite(line_arg) != NUL) {
} else if (line_arg != NULL && *skipwhite((char *)line_arg) != NUL) {
nextcmd = line_arg;
} else if (*p != NUL && *p != '"' && p_verbose > 0) {
give_warning2((char_u *)_("W22: Text found after :endfunction: %s"),
@ -2313,11 +2313,11 @@ void ex_function(exarg_T *eap)
// Check for defining a function inside this function.
if (checkforcmd((char **)&p, "function", 2)) {
if (*p == '!') {
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
}
p += eval_fname_script((const char *)p);
xfree(trans_function_name(&p, true, 0, NULL, NULL));
if (*skipwhite(p) == '(') {
if (*skipwhite((char *)p) == '(') {
nesting++;
indent += 2;
}
@ -2340,7 +2340,7 @@ void ex_function(exarg_T *eap)
}
// heredoc: Check for ":python <<EOF", ":lua <<EOF", etc.
arg = skipwhite(skiptowhite(p));
arg = (char_u *)skipwhite((char *)skiptowhite(p));
if (arg[0] == '<' && arg[1] == '<'
&& ((p[0] == 'p' && p[1] == 'y'
&& (!ASCII_ISALNUM(p[2]) || p[2] == 't'
@ -2357,7 +2357,7 @@ void ex_function(exarg_T *eap)
|| (p[0] == 'm' && p[1] == 'z'
&& (!ASCII_ISALPHA(p[2]) || p[2] == 's')))) {
// ":python <<" continues until a dot, like ":append"
p = skipwhite(arg + 2);
p = (char_u *)skipwhite((char *)arg + 2);
if (*p == NUL) {
skip_until = vim_strsave((char_u *)".");
} else {
@ -2367,12 +2367,12 @@ void ex_function(exarg_T *eap)
// Check for ":let v =<< [trim] EOF"
// and ":let [a, b] =<< [trim] EOF"
arg = skipwhite(skiptowhite(p));
arg = (char_u *)skipwhite((char *)skiptowhite(p));
if (*arg == '[') {
arg = vim_strchr(arg, ']');
}
if (arg != NULL) {
arg = skipwhite(skiptowhite(arg));
arg = (char_u *)skipwhite((char *)skiptowhite(arg));
if (arg[0] == '='
&& arg[1] == '<'
&& arg[2] == '<'
@ -2380,12 +2380,12 @@ void ex_function(exarg_T *eap)
&& p[1] == 'e'
&& (!ASCII_ISALNUM(p[2])
|| (p[2] == 't' && !ASCII_ISALNUM(p[3]))))) {
p = skipwhite(arg + 3);
p = (char_u *)skipwhite((char *)arg + 3);
if (STRNCMP(p, "trim", 4) == 0) {
// Ignore leading white space.
p = skipwhite(p + 4);
p = (char_u *)skipwhite((char *)p + 4);
heredoc_trimmed =
vim_strnsave(theline, (size_t)(skipwhite(theline) - theline));
vim_strnsave(theline, (size_t)((char_u *)skipwhite((char *)theline) - theline));
}
skip_until = vim_strnsave(p, (size_t)(skiptowhite(p) - p));
do_concat = false;
@ -2631,7 +2631,7 @@ bool function_exists(const char *const name, bool no_deref)
}
char *const p = (char *)trans_function_name((char_u **)&nm, false, flag, NULL,
NULL);
nm = skipwhite(nm);
nm = (char_u *)skipwhite((char *)nm);
// Only accept "funcname", "funcname ", "funcname (..." and
// "funcname(...", not "funcname!...".
@ -2702,7 +2702,7 @@ void ex_delfunction(exarg_T *eap)
}
return;
}
if (!ends_excmd(*skipwhite(p))) {
if (!ends_excmd(*skipwhite((char *)p))) {
xfree(name);
emsg(_(e_trailing));
return;
@ -2958,7 +2958,7 @@ void ex_call(exarg_T *eap)
// Skip white space to allow ":call func ()". Not good, but required for
// backward compatibility.
startarg = skipwhite(arg);
startarg = (char_u *)skipwhite((char *)arg);
rettv.v_type = VAR_UNKNOWN; // tv_clear() uses this.
if (*startarg != '(') {

View File

@ -194,7 +194,7 @@ void do_ascii(const exarg_T *const eap)
if (utf_iscomposing(c)) {
IObuff[iobuff_len++] = ' '; // Draw composing char on top of a space.
}
iobuff_len += utf_char2bytes(c, IObuff + iobuff_len);
iobuff_len += utf_char2bytes(c, (char *)IObuff + iobuff_len);
dig = (char *)get_digraph_for_char(c);
if (dig != NULL) {
@ -339,7 +339,7 @@ static int linelen(int *has_tab)
return 0;
}
// find the first non-blank character
first = (char *)skipwhite((char_u *)line);
first = skipwhite(line);
// find the character after the last non-blank character
for (last = first + STRLEN(first);
@ -609,9 +609,9 @@ void ex_sort(exarg_T *eap)
&nrs[lnum - eap->line1].st_u.num.value, NULL, 0, false);
}
} else {
s = (char *)skipwhite((char_u *)p);
s = skipwhite(p);
if (*s == '+') {
s = (char *)skipwhite((char_u *)s + 1);
s = skipwhite(s + 1);
}
if (*s == NUL) {
@ -1215,7 +1215,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
// buffername.
char *cmd = (char *)vim_strsave_escaped((char_u *)prevcmd, (char_u *)"%#");
AppendToRedobuffLit((char_u *)cmd, -1);
AppendToRedobuffLit(cmd, -1);
xfree(cmd);
AppendToRedobuff("\n");
bangredo = false;
@ -2768,7 +2768,7 @@ int do_ecmd(int fnum, char *ffname, char *sfname, exarg_T *eap, linenr_T newlnum
const char *text = (char *)get_cursor_line_ptr();
if (curwin->w_cursor.lnum != orig_pos.lnum
|| curwin->w_cursor.col != (int)(skipwhite((char_u *)text) - (char_u *)text)) {
|| curwin->w_cursor.col != (int)(skipwhite(text) - text)) {
newlnum = curwin->w_cursor.lnum;
newcol = curwin->w_cursor.col;
}
@ -3573,7 +3573,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
bool save_do_ask = subflags.do_ask; // remember user specified 'c' flag
// check for a trailing count
cmd = (char *)skipwhite((char_u *)cmd);
cmd = skipwhite(cmd);
if (ascii_isdigit(*cmd)) {
i = getdigits_long((char_u **)&cmd, true, 0);
if (i <= 0 && !eap->skip && subflags.do_error) {
@ -3590,7 +3590,7 @@ static buf_T *do_sub(exarg_T *eap, proftime_T timeout, bool do_buf_event, handle
/*
* check for trailing command or garbage
*/
cmd = (char *)skipwhite((char_u *)cmd);
cmd = skipwhite(cmd);
if (*cmd && *cmd != '"') { // if not end-of-line or comment
eap->nextcmd = (char *)check_nextcmd((char_u *)cmd);
if (eap->nextcmd == NULL) {
@ -5819,10 +5819,10 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
FreeWild(filecount, (char_u **)files);
}
static void helptags_cb(char_u *fname, void *cookie)
static void helptags_cb(char *fname, void *cookie)
FUNC_ATTR_NONNULL_ALL
{
do_helptags((char *)fname, *(bool *)cookie, true);
do_helptags(fname, *(bool *)cookie, true);
}
/// ":helptags"
@ -5835,7 +5835,7 @@ void ex_helptags(exarg_T *eap)
// Check for ":helptags ++t {dir}".
if (STRNCMP(eap->arg, "++t", 3) == 0 && ascii_iswhite(eap->arg[3])) {
add_help_tags = true;
eap->arg = (char *)skipwhite((char_u *)eap->arg + 3);
eap->arg = skipwhite(eap->arg + 3);
}
if (STRCMP(eap->arg, "ALL") == 0) {

View File

@ -102,7 +102,7 @@ void ex_profile(exarg_T *eap)
e = (char *)skiptowhite((char_u *)eap->arg);
len = (int)(e - eap->arg);
e = (char *)skipwhite((char_u *)e);
e = skipwhite(e);
if (len == 5 && STRNCMP(eap->arg, "start", 5) == 0 && *e != NUL) {
xfree(profile_fname);
@ -227,7 +227,7 @@ void set_context_in_profile_cmd(expand_T *xp, const char *arg)
if ((const char *)end_subcmd - arg == 5 && strncmp(arg, "start", 5) == 0) {
xp->xp_context = EXPAND_FILES;
xp->xp_pattern = (char *)skipwhite((const char_u *)end_subcmd);
xp->xp_pattern = skipwhite((char *)end_subcmd);
return;
}
@ -835,7 +835,7 @@ static char *do_one_arg(char *str)
*p++ = *str;
}
}
str = (char *)skipwhite((char_u *)str);
str = skipwhite(str);
*p = NUL;
return str;
@ -2345,7 +2345,7 @@ char_u *getsourceline(int c, void *cookie, int indent, bool do_concat)
// Also check for a comment in between continuation lines: "\ .
sp->nextline = get_one_sourceline(sp);
if (sp->nextline != NULL
&& (*(p = (char *)skipwhite((char_u *)sp->nextline)) == '\\'
&& (*(p = skipwhite(sp->nextline)) == '\\'
|| (p[0] == '"' && p[1] == '\\' && p[2] == ' '))) {
garray_T ga;
@ -2794,19 +2794,19 @@ void ex_language(exarg_T *eap)
if ((*p == NUL || ascii_iswhite(*p)) && p - eap->arg >= 3) {
if (STRNICMP(eap->arg, "messages", p - eap->arg) == 0) {
what = VIM_LC_MESSAGES;
name = (char *)skipwhite((char_u *)p);
name = skipwhite(p);
whatstr = "messages ";
} else if (STRNICMP(eap->arg, "ctype", p - eap->arg) == 0) {
what = LC_CTYPE;
name = (char *)skipwhite((char_u *)p);
name = skipwhite(p);
whatstr = "ctype ";
} else if (STRNICMP(eap->arg, "time", p - eap->arg) == 0) {
what = LC_TIME;
name = (char *)skipwhite((char_u *)p);
name = skipwhite(p);
whatstr = "time ";
} else if (STRNICMP(eap->arg, "collate", p - eap->arg) == 0) {
what = LC_COLLATE;
name = (char *)skipwhite((char_u *)p);
name = skipwhite(p);
whatstr = "collate ";
}
}

View File

@ -1205,11 +1205,11 @@ static void get_wincmd_addr_type(char *arg, exarg_T *eap)
static char *skip_colon_white(const char *p, bool skipleadingwhite)
{
if (skipleadingwhite) {
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
}
while (*p == ':') {
p = (char *)skipwhite((char_u *)p + 1);
p = skipwhite(p + 1);
}
return (char *)p;
@ -1231,7 +1231,7 @@ static void set_cmd_addr_type(exarg_T *eap, char_u *p)
}
// :wincmd range depends on the argument
if (eap->cmdidx == CMD_wincmd && p != NULL) {
get_wincmd_addr_type((char *)skipwhite(p), eap);
get_wincmd_addr_type(skipwhite((char *)p), eap);
}
// :.cc in quickfix window uses line number
if ((eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) && bt_quickfix(curbuf)) {
@ -1315,7 +1315,7 @@ static void parse_register(exarg_T *eap)
}
eap->arg += STRLEN(eap->arg);
}
eap->arg = (char *)skipwhite((char_u *)eap->arg);
eap->arg = skipwhite(eap->arg);
}
}
}
@ -1331,7 +1331,7 @@ static int parse_count(exarg_T *eap, char **errormsg, bool validate)
&& (!(eap->argt & EX_BUFNAME) || *(p = (char *)skipdigits((char_u *)eap->arg + 1)) == NUL
|| ascii_iswhite(*p))) {
n = getdigits_long((char_u **)&eap->arg, false, -1);
eap->arg = (char *)skipwhite((char_u *)eap->arg);
eap->arg = skipwhite(eap->arg);
if (n <= 0 && (eap->argt & EX_ZEROR) == 0) {
if (errormsg != NULL) {
*errormsg = _(e_zerocount);
@ -1422,7 +1422,7 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **er
// Skip ranges to find command name since we need the command to know what kind of range it uses
eap->cmd = skip_range(eap->cmd, NULL);
if (*eap->cmd == '*') {
eap->cmd = (char *)skipwhite((char_u *)eap->cmd + 1);
eap->cmd = skipwhite(eap->cmd + 1);
}
p = find_command(eap, NULL);
@ -1467,7 +1467,7 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **er
if (eap->cmdidx == CMD_bang) {
eap->arg = p;
} else {
eap->arg = (char *)skipwhite((char_u *)p);
eap->arg = skipwhite(p);
}
// Don't treat ":r! filter" like a bang
@ -1604,7 +1604,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
cmd = ea.cmd;
ea.cmd = skip_range(ea.cmd, NULL);
if (*ea.cmd == '*') {
ea.cmd = (char *)skipwhite((char_u *)ea.cmd + 1);
ea.cmd = skipwhite(ea.cmd + 1);
}
p = find_command(&ea, NULL);
@ -1882,7 +1882,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
if (ea.cmdidx == CMD_bang) {
ea.arg = p;
} else {
ea.arg = (char *)skipwhite((char_u *)p);
ea.arg = skipwhite(p);
}
// ":file" cannot be run with an argument when "curbuf->b_ro_locked" is set
@ -1909,7 +1909,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
errormsg = _("E494: Use w or w>>");
goto doend;
}
ea.arg = (char *)skipwhite((char_u *)ea.arg + 1);
ea.arg = skipwhite(ea.arg + 1);
ea.append = true;
} else if (*ea.arg == '!' && ea.cmdidx == CMD_write) { // :w !filter
++ea.arg;
@ -1933,7 +1933,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
ea.arg++;
ea.amount++;
}
ea.arg = (char *)skipwhite((char_u *)ea.arg);
ea.arg = skipwhite(ea.arg);
}
/*
@ -2133,7 +2133,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
goto doend;
}
ea.addr_count = 1;
ea.arg = (char *)skipwhite((char_u *)p);
ea.arg = skipwhite(p);
}
// The :try command saves the emsg_silent flag, reset it here when
@ -2343,7 +2343,7 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
}
if (*p == '!') {
cmdmod.filter_force = true;
p = (char *)skipwhite((char_u *)p + 1);
p = skipwhite(p + 1);
if (*p == NUL || ends_excmd(*p)) {
break;
}
@ -2433,7 +2433,7 @@ int parse_command_modifiers(exarg_T *eap, char **errormsg, bool skip_only)
}
if (*eap->cmd == '!' && !ascii_iswhite(eap->cmd[-1])) {
// ":silent!", but not "silent !cmd"
eap->cmd = (char *)skipwhite((char_u *)eap->cmd + 1);
eap->cmd = skipwhite(eap->cmd + 1);
if (!skip_only) {
emsg_silent++;
eap->did_esilent++;
@ -2598,7 +2598,7 @@ int parse_cmd_address(exarg_T *eap, char **errormsg, bool silent)
// Will give an error later if a range is found.
break;
}
eap->cmd = (char *)skipwhite((char_u *)eap->cmd);
eap->cmd = skipwhite(eap->cmd);
lnum = get_address(eap, &eap->cmd, eap->addr_type, eap->skip, silent,
eap->addr_count == 0, address_count++);
if (eap->cmd == NULL) { // error detected
@ -2738,7 +2738,7 @@ int checkforcmd(char **pp, char *cmd, int len)
}
}
if (i >= len && !isalpha((*pp)[i])) {
*pp = (char *)skipwhite((char_u *)(*pp) + i);
*pp = skipwhite(*pp + i);
return true;
}
return FALSE;
@ -3032,7 +3032,7 @@ int modifier_len(char *cmd)
char *p = cmd;
if (ascii_isdigit(*cmd)) {
p = (char *)skipwhite(skipdigits((char_u *)cmd + 1));
p = skipwhite((char *)skipdigits((char_u *)cmd + 1));
}
for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) {
int j;
@ -3083,7 +3083,7 @@ int cmd_exists(const char *const name)
if (ascii_isdigit(*name) && ea.cmdidx != CMD_match) {
return 0;
}
if (*skipwhite((char_u *)p) != NUL) {
if (*skipwhite(p) != NUL) {
return 0; // trailing garbage
}
return ea.cmdidx == CMD_SIZE ? 0 : (full ? 2 : 1);
@ -3266,7 +3266,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
ea.argt = cmdnames[(int)ea.cmdidx].cmd_argt;
}
const char *arg = (const char *)skipwhite((const char_u *)p);
const char *arg = (const char *)skipwhite(p);
// Skip over ++argopt argument
if ((ea.argt & EX_ARGOPT) && *arg != NUL && strncmp(arg, "++", 2) == 0) {
@ -3274,7 +3274,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
while (*p && !ascii_isspace(*p)) {
MB_PTR_ADV(p);
}
arg = (const char *)skipwhite((const char_u *)p);
arg = (const char *)skipwhite(p);
}
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) {
@ -3282,7 +3282,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
if (*++arg == '>') {
arg++;
}
arg = (const char *)skipwhite((const char_u *)arg);
arg = (const char *)skipwhite(arg);
} else if (*arg == '!' && ea.cmdidx == CMD_write) { // :w !filter
arg++;
usefilter = true;
@ -3301,7 +3301,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
while (*arg == *cmd) { // allow any number of '>' or '<'
arg++;
}
arg = (const char *)skipwhite((const char_u *)arg);
arg = (const char *)skipwhite(arg);
}
// Does command allow "+command"?
@ -3316,7 +3316,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
}
// Skip space(s) after +command to get to the real argument.
arg = (const char *)skipwhite((const char_u *)arg);
arg = (const char *)skipwhite(arg);
}
/*
@ -3378,7 +3378,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
* Allow spaces within back-quotes to count as part of the argument
* being expanded.
*/
xp->xp_pattern = (char *)skipwhite((const char_u *)arg);
xp->xp_pattern = skipwhite(arg);
p = (const char *)xp->xp_pattern;
while (*p != NUL) {
c = utf_ptr2char(p);
@ -3431,7 +3431,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
xp->xp_shell = TRUE;
#endif
// When still after the command name expand executables.
if ((char_u *)xp->xp_pattern == skipwhite((const char_u *)arg)) {
if ((char_u *)xp->xp_pattern == (char_u *)skipwhite(arg)) {
xp->xp_context = EXPAND_SHELLCMD;
}
}
@ -3536,13 +3536,13 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
xp->xp_context = EXPAND_NOTHING;
return NULL;
}
return (const char *)skipwhite((const char_u *)arg);
return (const char *)skipwhite(arg);
case CMD_match:
if (*arg == NUL || !ends_excmd(*arg)) {
// also complete "None"
set_context_in_echohl_cmd(xp, arg);
arg = (const char *)skipwhite(skiptowhite((const char_u *)arg));
arg = (const char *)skipwhite((char *)skiptowhite((const char_u *)arg));
if (*arg != NUL) {
xp->xp_context = EXPAND_NOTHING;
arg = (const char *)skip_regexp((char_u *)arg + 1, (uint8_t)(*arg),
@ -3587,7 +3587,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
}
return NULL;
}
arg = (const char *)skipwhite((char_u *)p);
arg = (const char *)skipwhite(p);
}
// After the attributes comes the new command name.
@ -3599,7 +3599,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
}
// And finally comes a normal command.
return (const char *)skipwhite((const char_u *)p);
return (const char *)skipwhite(p);
case CMD_delcommand:
xp->xp_context = EXPAND_USER_COMMANDS;
@ -3660,7 +3660,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
case CMD_isplit:
case CMD_dsplit:
// Skip count.
arg = (const char *)skipwhite(skipdigits((const char_u *)arg));
arg = (const char *)skipwhite((char *)skipdigits((const char_u *)arg));
if (*arg == '/') { // Match regexp, not just whole words.
for (++arg; *arg && *arg != '/'; arg++) {
if (*arg == '\\' && arg[1] != NUL) {
@ -3668,7 +3668,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
}
}
if (*arg) {
arg = (const char *)skipwhite((const char_u *)arg + 1);
arg = (const char *)skipwhite(arg + 1);
// Check for trailing illegal characters.
if (*arg && strchr("|\"\n", *arg) == NULL) {
@ -3946,7 +3946,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
|| strncmp(arg, "time", (size_t)(p - arg)) == 0
|| strncmp(arg, "collate", (size_t)(p - arg)) == 0) {
xp->xp_context = EXPAND_LOCALES;
xp->xp_pattern = (char *)skipwhite((const char_u *)p);
xp->xp_pattern = skipwhite(p);
} else {
xp->xp_context = EXPAND_NOTHING;
}
@ -4078,7 +4078,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
linenr_T lnum;
buf_T *buf;
cmd = (char *)skipwhite((char_u *)(*ptr));
cmd = skipwhite(*ptr);
lnum = MAXLNUM;
do {
switch (*cmd) {
@ -4291,7 +4291,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
}
for (;;) {
cmd = (char *)skipwhite((char_u *)cmd);
cmd = skipwhite(cmd);
if (*cmd != '-' && *cmd != '+' && !ascii_isdigit(*cmd)) {
break;
}
@ -4389,7 +4389,7 @@ static void get_flags(exarg_T *eap)
} else {
eap->flags |= EXFLAG_NR;
}
eap->arg = (char *)skipwhite((char_u *)eap->arg + 1);
eap->arg = skipwhite(eap->arg + 1);
}
}
@ -4567,7 +4567,7 @@ static char *replace_makeprg(exarg_T *eap, char *p, char **cmdlinep)
}
}
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
if ((pos = strstr(program, "$*")) != NULL) {
// replace $* by given arguments
@ -4892,7 +4892,7 @@ static char *getargcmd(char **argp)
}
}
arg = (char *)skipwhite((char_u *)arg); // skip over spaces
arg = skipwhite(arg); // skip over spaces
*argp = arg;
}
return command;
@ -4952,14 +4952,14 @@ static int getargopt(exarg_T *eap)
if (!checkforcmd(&arg, "binary", 3)) {
return FAIL;
}
eap->arg = (char *)skipwhite((char_u *)arg);
eap->arg = skipwhite(arg);
return OK;
}
// ":read ++edit file"
if (STRNCMP(arg, "edit", 4) == 0) {
eap->read_edit = true;
eap->arg = (char *)skipwhite((char_u *)arg + 4);
eap->arg = skipwhite(arg + 4);
return OK;
}
@ -4988,7 +4988,7 @@ static int getargopt(exarg_T *eap)
arg++;
*pp = (int)(arg - eap->cmd);
arg = skip_cmd_arg(arg, false);
eap->arg = (char *)skipwhite((char_u *)arg);
eap->arg = skipwhite(arg);
*arg = NUL;
if (pp == &eap->force_ff) {
@ -5077,7 +5077,7 @@ static int get_tabpage_arg(exarg_T *eap)
tab_number = 0;
} else {
tab_number = (int)eap->line2;
if (!unaccept_arg0 && *skipwhite((char_u *)(*eap->cmdlinep)) == '-') {
if (!unaccept_arg0 && *skipwhite(*eap->cmdlinep) == '-') {
tab_number--;
if (tab_number < unaccept_arg0) {
eap->errmsg = e_invarg;
@ -5280,7 +5280,7 @@ char_u *find_nextcmd(const char_u *p)
/// @return NULL if it isn't, the following character if it is.
char_u *check_nextcmd(char_u *p)
{
char *s = (char *)skipwhite(p);
char *s = skipwhite((char *)p);
if (*s == '|' || *s == '\n') {
return (char_u *)(s + 1);
@ -5362,7 +5362,7 @@ int uc_add_command(char *name, size_t name_len, char *rep, uint32_t argt, long d
char *rep_buf = NULL;
garray_T *gap;
replace_termcodes((char_u *)rep, STRLEN(rep), (char_u **)&rep_buf, 0, NULL, CPO_TO_CPO_FLAGS);
replace_termcodes(rep, STRLEN(rep), &rep_buf, 0, NULL, CPO_TO_CPO_FLAGS);
if (rep_buf == NULL) {
// Can't replace termcodes - try using the string as is
rep_buf = xstrdup(rep);
@ -5859,7 +5859,7 @@ static void ex_command(exarg_T *eap)
&addr_type_arg) == FAIL) {
return;
}
p = (char *)skipwhite((char_u *)end);
p = skipwhite(end);
}
// Get the name (if any) and skip to the following argument.
@ -5873,7 +5873,7 @@ static void ex_command(exarg_T *eap)
// If there is nothing after the name, and no attributes were specified,
// we are listing commands
p = (char *)skipwhite((char_u *)end);
p = skipwhite(end);
if (!has_attr && ends_excmd(*p)) {
uc_list(name, name_len);
} else if (!ASCII_ISUPPER(*name)) {
@ -5923,7 +5923,7 @@ static void ex_delcommand(exarg_T *eap)
if (STRNCMP(arg, "-buffer", 7) == 0 && ascii_iswhite(arg[7])) {
buffer_only = true;
arg = (char *)skipwhite((char_u *)arg + 7);
arg = skipwhite(arg + 7);
}
gap = &curbuf->b_ucmds;
@ -5968,7 +5968,7 @@ static void ex_delcommand(exarg_T *eap)
/// @param[out] len Length of string in {buf}
///
/// @return true if iteration is complete, else false
bool uc_split_args_iter(const char_u *arg, size_t arglen, size_t *end, char *buf, size_t *len)
bool uc_split_args_iter(const char *arg, size_t arglen, size_t *end, char *buf, size_t *len)
{
if (!arglen) {
return true;
@ -5982,9 +5982,9 @@ bool uc_split_args_iter(const char_u *arg, size_t arglen, size_t *end, char *buf
size_t l = 0;
for (; pos < arglen - 1; pos++) {
if (arg[pos] == '\\' && (arg[pos + 1] == '\\' || ascii_iswhite(arg[pos + 1]))) {
buf[l++] = (char)arg[++pos];
buf[l++] = arg[++pos];
} else {
buf[l++] = (char)arg[pos];
buf[l++] = arg[pos];
if (ascii_iswhite(arg[pos + 1])) {
*end = pos + 1;
*len = l;
@ -5994,7 +5994,7 @@ bool uc_split_args_iter(const char_u *arg, size_t arglen, size_t *end, char *buf
}
if (pos < arglen && !ascii_iswhite(arg[pos])) {
buf[l++] = (char)arg[pos];
buf[l++] = arg[pos];
}
*len = l;
@ -6024,7 +6024,7 @@ static char *uc_split_args(char *arg, size_t *lenp)
len += 2;
p += 1;
} else if (ascii_iswhite(*p)) {
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
if (*p == NUL) {
break;
}
@ -6054,7 +6054,7 @@ static char *uc_split_args(char *arg, size_t *lenp)
*q++ = '\\';
*q++ = *p++;
} else if (ascii_iswhite(*p)) {
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
if (*p == NUL) {
break;
}
@ -7856,7 +7856,7 @@ static void ex_syncbind(exarg_T *eap)
ctrl_o[0] = Ctrl_O;
ctrl_o[1] = 0;
ins_typebuf((char_u *)ctrl_o, REMAP_NONE, 0, true, false);
ins_typebuf(ctrl_o, REMAP_NONE, 0, true, false);
}
}
}
@ -8190,7 +8190,7 @@ static void ex_winsize(exarg_T *eap)
return;
}
int w = getdigits_int((char_u **)&arg, false, 10);
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
char *p = arg;
int h = getdigits_int((char_u **)&arg, false, 10);
if (*p != NUL && *arg == NUL) {
@ -8218,7 +8218,7 @@ static void ex_wincmd(exarg_T *eap)
}
eap->nextcmd = (char *)check_nextcmd((char_u *)p);
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
if (*p != NUL && *p != '"' && eap->nextcmd == NULL) {
emsg(_(e_invarg));
} else if (!eap->skip) {
@ -8515,7 +8515,7 @@ static void ex_redir(exarg_T *eap)
} else {
mode = "w";
}
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
close_redir();
@ -8565,7 +8565,7 @@ static void ex_redir(exarg_T *eap)
append = FALSE;
}
if (var_redir_start((char *)skipwhite((char_u *)arg), append) == OK) {
if (var_redir_start(skipwhite(arg), append) == OK) {
redir_vname = 1;
}
} else { // TODO(vim): redirect to a buffer
@ -8930,7 +8930,7 @@ static void ex_stopinsert(exarg_T *eap)
void exec_normal_cmd(char_u *cmd, int remap, bool silent)
{
// Stuff the argument into the typeahead buffer.
ins_typebuf(cmd, remap, 0, true, silent);
ins_typebuf((char *)cmd, remap, 0, true, silent);
exec_normal(false);
}
@ -8996,7 +8996,7 @@ static void ex_findpat(exarg_T *eap)
n = 1;
if (ascii_isdigit(*eap->arg)) { // get count
n = getdigits_long((char_u **)&eap->arg, false, 0);
eap->arg = (char *)skipwhite((char_u *)eap->arg);
eap->arg = skipwhite(eap->arg);
}
if (*eap->arg == '/') { // Match regexp, not just whole words
whole = false;
@ -9004,7 +9004,7 @@ static void ex_findpat(exarg_T *eap)
p = (char *)skip_regexp((char_u *)eap->arg, '/', p_magic, NULL);
if (*p) {
*p++ = NUL;
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
// Check for trailing illegal characters.
if (!ends_excmd(*p)) {
@ -9660,12 +9660,12 @@ static void ex_filetype(exarg_T *eap)
for (;;) {
if (STRNCMP(arg, "plugin", 6) == 0) {
plugin = true;
arg = (char *)skipwhite((char_u *)arg + 6);
arg = skipwhite(arg + 6);
continue;
}
if (STRNCMP(arg, "indent", 6) == 0) {
indent = true;
arg = (char *)skipwhite((char_u *)arg + 6);
arg = skipwhite(arg + 6);
continue;
}
break;
@ -9885,7 +9885,7 @@ bool cmd_can_preview(char *cmd)
// parse the command line
ea.cmd = skip_range(cmd, NULL);
if (*ea.cmd == '*') {
ea.cmd = (char *)skipwhite((char_u *)ea.cmd + 1);
ea.cmd = skipwhite(ea.cmd + 1);
}
char *end = find_command(&ea, NULL);

View File

@ -1342,7 +1342,7 @@ void ex_catch(exarg_T *eap)
*/
if (!skip && (cstack->cs_flags[idx] & CSF_THROWN)
&& !(cstack->cs_flags[idx] & CSF_CAUGHT)) {
if (end != NULL && *end != NUL && !ends_excmd(*skipwhite((char_u *)end + 1))) {
if (end != NULL && *end != NUL && !ends_excmd(*skipwhite(end + 1))) {
emsg(_(e_trailing));
return;
}

View File

@ -301,7 +301,7 @@ static char_u *get_healthcheck_names(expand_T *xp, int idx)
"lua/**/**/health.lua" }; // NOLINT
for (int i = 0; i < 3; i++) {
struct healthchecks_cookie hcookie = { .names = &healthchecks.names, .is_lua = i != 0 };
do_in_runtimepath((char_u *)patterns[i], DIP_ALL, get_healthcheck_cb, &hcookie);
do_in_runtimepath(patterns[i], DIP_ALL, get_healthcheck_cb, &hcookie);
if (healthchecks.names.ga_len > 0) {
ga_remove_duplicate_strings(&healthchecks.names);
@ -319,7 +319,7 @@ static char_u *get_healthcheck_names(expand_T *xp, int idx)
/// Used as a callback for do_in_runtimepath
/// @param[in] path Expanded path to a possible healthcheck.
/// @param[out] cookie Array where names will be inserted.
static void get_healthcheck_cb(char_u *path, void *cookie)
static void get_healthcheck_cb(char *path, void *cookie)
{
if (path != NULL) {
struct healthchecks_cookie *hcookie = (struct healthchecks_cookie *)cookie;
@ -335,7 +335,7 @@ static void get_healthcheck_cb(char_u *path, void *cookie)
pattern = ".*[\\/]\\([^\\/]*\\)\\.vim$";
}
res = (char_u *)do_string_sub((char *)path, pattern, sub, NULL, "g");
res = (char_u *)do_string_sub(path, pattern, sub, NULL, "g");
if (hcookie->is_lua && res != NULL) {
// Replace slashes with dots as represented by the healthcheck plugin.
char_u *ares = (char_u *)do_string_sub((char *)res, "[\\/]", ".", NULL, "g");
@ -403,7 +403,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
// Skip over "substitute" to find the pattern separator.
for (p = cmd; ASCII_ISALPHA(*p); p++) {}
if (*skipwhite(p) == NUL) {
if (*skipwhite((char *)p) == NUL) {
goto theend;
}
@ -419,9 +419,9 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
} else if (STRNCMP(cmd, "sort", MAX(p - cmd, 3)) == 0) {
// skip over ! and flags
if (*p == '!') {
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
}
while (ASCII_ISALPHA(*(p = skipwhite(p)))) {
while (ASCII_ISALPHA(*(p = (char_u *)skipwhite((char *)p)))) {
p++;
}
if (*p == NUL) {
@ -435,7 +435,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
// skip over "!/".
if (*p == '!') {
p++;
if (*skipwhite(p) == NUL) {
if (*skipwhite((char *)p) == NUL) {
goto theend;
}
}
@ -446,7 +446,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
goto theend;
}
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++;
*search_delim = delim;
end = skip_regexp(p, delim, p_magic, NULL);
@ -2276,7 +2276,7 @@ static int command_line_handle_key(CommandLineState *s)
if (IS_SPECIAL(s->c) || mod_mask != 0) {
put_on_cmdline(get_special_key_name(s->c, mod_mask), -1, true);
} else {
int j = utf_char2bytes(s->c, IObuff);
int j = utf_char2bytes(s->c, (char *)IObuff);
IObuff[j] = NUL; // exclude composing chars
put_on_cmdline(IObuff, j, true);
}
@ -3073,11 +3073,11 @@ static void draw_cmdline(int start, int len)
u8c = arabic_shape(u8c, NULL, &u8cc[0], pc, pc1, nc);
newlen += utf_char2bytes(u8c, arshape_buf + newlen);
newlen += utf_char2bytes(u8c, (char *)arshape_buf + newlen);
if (u8cc[0] != 0) {
newlen += utf_char2bytes(u8cc[0], arshape_buf + newlen);
newlen += utf_char2bytes(u8cc[0], (char *)arshape_buf + newlen);
if (u8cc[1] != 0) {
newlen += utf_char2bytes(u8cc[1], arshape_buf + newlen);
newlen += utf_char2bytes(u8cc[1], (char *)arshape_buf + newlen);
}
}
} else {
@ -6233,20 +6233,20 @@ int get_list_range(char_u **str, int *num1, int *num2)
int first = false;
varnumber_T num;
*str = skipwhite(*str);
*str = (char_u *)skipwhite((char *)(*str));
if (**str == '-' || ascii_isdigit(**str)) { // parse "from" part of range
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, false);
*str += len;
*num1 = (int)num;
first = true;
}
*str = skipwhite(*str);
*str = (char_u *)skipwhite((char *)(*str));
if (**str == ',') { // parse "to" part of range
*str = skipwhite(*str + 1);
*str = (char_u *)skipwhite((char *)(*str) + 1);
vim_str2nr(*str, NULL, &len, 0, &num, NULL, 0, false);
if (len > 0) {
*num2 = (int)num;
*str = skipwhite(*str + len);
*str = (char_u *)skipwhite((char *)(*str) + len);
} else if (!first) { // no number given at all
return FAIL;
}
@ -6639,10 +6639,7 @@ char *script_get(exarg_T *const eap, size_t *const lenp)
ga_init(&ga, 1, 0x400);
}
const char *const end_pattern = (
cmd[2] != NUL
? (const char *)skipwhite((const char_u *)cmd + 2)
: ".");
const char *const end_pattern = (cmd[2] != NUL ? (const char *)skipwhite(cmd + 2) : ".");
for (;;) {
char *const theline = (char *)eap->getline(eap->cstack->cs_looplevel > 0 ? -1 :
NUL, eap->cookie, 0, true);

View File

@ -1401,7 +1401,7 @@ retry:
assert(u8c <= INT_MAX);
// produce UTF-8
dest -= utf_char2len((int)u8c);
(void)utf_char2bytes((int)u8c, dest);
(void)utf_char2bytes((int)u8c, (char *)dest);
}
// move the linerest to before the converted characters
@ -3943,8 +3943,8 @@ static int buf_write_bytes(struct bw_info *ip)
* Convert latin1 in the buffer to UTF-8 in the file.
*/
p = ip->bw_conv_buf; // translate to buffer
for (wlen = 0; wlen < len; ++wlen) {
p += utf_char2bytes(buf[wlen], p);
for (wlen = 0; wlen < len; wlen++) {
p += utf_char2bytes(buf[wlen], (char *)p);
}
buf = ip->bw_conv_buf;
len = (int)(p - ip->bw_conv_buf);

View File

@ -1840,7 +1840,7 @@ void foldtext_cleanup(char_u *str)
bool did2 = false;
// Ignore leading and trailing white space in 'commentstring'.
char_u *cms_start = skipwhite(curbuf->b_p_cms);
char_u *cms_start = (char_u *)skipwhite((char *)curbuf->b_p_cms);
size_t cms_slen = STRLEN(cms_start);
while (cms_slen > 0 && ascii_iswhite(cms_start[cms_slen - 1])) {
--cms_slen;
@ -1859,7 +1859,7 @@ void foldtext_cleanup(char_u *str)
}
// skip "%s" and white space after it
s = skipwhite(cms_end + 2);
s = (char_u *)skipwhite((char *)cms_end + 2);
cms_elen -= (size_t)(s - cms_end);
cms_end = s;
}
@ -2907,7 +2907,7 @@ static void foldlevelIndent(fline_T *flp)
linenr_T lnum = flp->lnum + flp->off;
buf = flp->wp->w_buffer;
s = skipwhite(ml_get_buf(buf, lnum, false));
s = (char_u *)skipwhite((char *)ml_get_buf(buf, lnum, false));
// empty line or lines starting with a character in 'foldignore': level
// depends on surrounding lines

View File

@ -319,7 +319,7 @@ static void add_char_buff(buffheader_T *buf, int c)
if (IS_SPECIAL(c)) {
len = 1;
} else {
len = utf_char2bytes(c, bytes);
len = utf_char2bytes(c, (char *)bytes);
}
for (int i = 0; i < len; i++) {
@ -537,18 +537,18 @@ void AppendToRedobuff(const char *s)
///
/// @param str String to append
/// @param len Length of `str` or -1 for up to the NUL.
void AppendToRedobuffLit(const char_u *str, int len)
void AppendToRedobuffLit(const char *str, int len)
{
if (block_redo) {
return;
}
const char *s = (const char *)str;
while (len < 0 ? *s != NUL : s - (const char *)str < len) {
const char *s = str;
while (len < 0 ? *s != NUL : s - str < len) {
// Put a string of normal characters in the redo buffer (that's
// faster).
const char *start = s;
while (*s >= ' ' && *s < DEL && (len < 0 || s - (const char *)str < len)) {
while (*s >= ' ' && *s < DEL && (len < 0 || s - str < len)) {
s++;
}
@ -561,7 +561,7 @@ void AppendToRedobuffLit(const char_u *str, int len)
add_buff(&redobuff, start, (long)(s - start));
}
if (*s == NUL || (len >= 0 && s - (const char *)str >= len)) {
if (*s == NUL || (len >= 0 && s - str >= len)) {
break;
}
@ -866,7 +866,7 @@ void init_default_mappings(void)
// If silent is true, cmd_silent is set when the characters are obtained.
//
// return FAIL for failure, OK otherwise
int ins_typebuf(char_u *str, int noremap, int offset, bool nottyped, bool silent)
int ins_typebuf(char *str, int noremap, int offset, bool nottyped, bool silent)
{
char_u *s1, *s2;
int addlen;
@ -1010,7 +1010,7 @@ int ins_char_typebuf(int c, int modifier)
*end = NUL;
len = (int)(end - buf);
}
(void)ins_typebuf(buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
(void)ins_typebuf((char *)buf, KeyNoremap, 0, !KeyTyped, cmd_silent);
return len;
}
@ -1758,7 +1758,7 @@ static int put_string_in_typebuf(int offset, int slen, char_u *string, int new_s
del_typebuf(-extra, offset);
} else if (extra > 0) {
// insert the extra space we need
if (ins_typebuf(string + slen, REMAP_YES, offset, false, false) == FAIL) {
if (ins_typebuf((char *)string + slen, REMAP_YES, offset, false, false) == FAIL) {
return FAIL;
}
}
@ -1816,7 +1816,7 @@ static int check_simplify_modifier(int max_offset)
new_string[2] = (char_u)K_THIRD(new_c);
len = 3;
} else {
len = utf_char2bytes(new_c, new_string);
len = utf_char2bytes(new_c, (char *)new_string);
}
if (modifier == 0) {
if (put_string_in_typebuf(offset, 4, new_string, len) == FAIL) {
@ -2116,7 +2116,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
// mode temporarily. Append K_SELECT to switch back to Select mode.
if (VIsual_active && VIsual_select && (mp->m_mode & VISUAL)) {
VIsual_select = false;
(void)ins_typebuf(K_SELECT_STRING, REMAP_NONE, 0, true, false);
(void)ins_typebuf((char *)K_SELECT_STRING, REMAP_NONE, 0, true, false);
}
// Copy the values from *mp that are used, because evaluating the
@ -2202,7 +2202,7 @@ static int handle_mapping(int *keylenp, bool *timedout, int *mapdepth)
} else {
noremap = REMAP_SKIP;
}
i = ins_typebuf(map_str, noremap, 0, true, cmd_silent || save_m_silent);
i = ins_typebuf((char *)map_str, noremap, 0, true, cmd_silent || save_m_silent);
if (save_m_expr) {
xfree(map_str);
}
@ -2874,15 +2874,13 @@ void set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs_len,
// If something like <C-H> is simplified to 0x08 then mark it as simplified.
bool did_simplify = false;
const int flags = REPTERM_FROM_PART | REPTERM_DO_LT;
char *replaced = (char *)replace_termcodes((char_u *)orig_lhs, orig_lhs_len, (char_u **)&lhs_buf,
flags, &did_simplify,
cpo_flags);
char *replaced = replace_termcodes(orig_lhs, orig_lhs_len, &lhs_buf, flags, &did_simplify,
cpo_flags);
mapargs->lhs_len = STRLEN(replaced);
STRLCPY(mapargs->lhs, replaced, sizeof(mapargs->lhs));
if (did_simplify) {
replaced = (char *)replace_termcodes((char_u *)orig_lhs, orig_lhs_len, (char_u **)&alt_lhs_buf,
flags | REPTERM_NO_SIMPLIFY,
NULL, cpo_flags);
replaced = replace_termcodes(orig_lhs, orig_lhs_len, &alt_lhs_buf, flags | REPTERM_NO_SIMPLIFY,
NULL, cpo_flags);
mapargs->alt_lhs_len = STRLEN(replaced);
STRLCPY(mapargs->alt_lhs, replaced, sizeof(mapargs->alt_lhs));
} else {
@ -2901,8 +2899,8 @@ void set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs_len,
mapargs->rhs_len = 0;
mapargs->rhs_is_noop = true;
} else {
replaced = (char *)replace_termcodes((char_u *)orig_rhs, orig_rhs_len, (char_u **)&rhs_buf,
REPTERM_DO_LT | REPTERM_NO_SIMPLIFY, NULL, cpo_flags);
replaced = replace_termcodes(orig_rhs, orig_rhs_len, &rhs_buf,
REPTERM_DO_LT | REPTERM_NO_SIMPLIFY, NULL, cpo_flags);
mapargs->rhs_len = STRLEN(replaced);
// XXX: even when orig_rhs is non-empty, replace_termcodes may produce an empty string.
mapargs->rhs_is_noop = orig_rhs[0] != NUL && mapargs->rhs_len == 0;
@ -2947,7 +2945,7 @@ void set_maparg_lhs_rhs(const char *const orig_lhs, const size_t orig_lhs_len,
int str_to_mapargs(const char_u *strargs, bool is_unmap, MapArguments *mapargs)
{
const char_u *to_parse = strargs;
to_parse = skipwhite(to_parse);
to_parse = (char_u *)skipwhite((char *)to_parse);
MapArguments parsed_args; // copy these into mapargs "all at once" when done
memset(&parsed_args, 0, sizeof(parsed_args));
@ -2955,43 +2953,43 @@ int str_to_mapargs(const char_u *strargs, bool is_unmap, MapArguments *mapargs)
// any order.
while (true) {
if (STRNCMP(to_parse, "<buffer>", 8) == 0) {
to_parse = skipwhite(to_parse + 8);
to_parse = (char_u *)skipwhite((char *)to_parse + 8);
parsed_args.buffer = true;
continue;
}
if (STRNCMP(to_parse, "<nowait>", 8) == 0) {
to_parse = skipwhite(to_parse + 8);
to_parse = (char_u *)skipwhite((char *)to_parse + 8);
parsed_args.nowait = true;
continue;
}
if (STRNCMP(to_parse, "<silent>", 8) == 0) {
to_parse = skipwhite(to_parse + 8);
to_parse = (char_u *)skipwhite((char *)to_parse + 8);
parsed_args.silent = true;
continue;
}
// Ignore obsolete "<special>" modifier.
if (STRNCMP(to_parse, "<special>", 9) == 0) {
to_parse = skipwhite(to_parse + 9);
to_parse = (char_u *)skipwhite((char *)to_parse + 9);
continue;
}
if (STRNCMP(to_parse, "<script>", 8) == 0) {
to_parse = skipwhite(to_parse + 8);
to_parse = (char_u *)skipwhite((char *)to_parse + 8);
parsed_args.script = true;
continue;
}
if (STRNCMP(to_parse, "<expr>", 6) == 0) {
to_parse = skipwhite(to_parse + 6);
to_parse = (char_u *)skipwhite((char *)to_parse + 6);
parsed_args.expr = true;
continue;
}
if (STRNCMP(to_parse, "<unique>", 8) == 0) {
to_parse = skipwhite(to_parse + 8);
to_parse = (char_u *)skipwhite((char *)to_parse + 8);
parsed_args.unique = true;
continue;
}
@ -3020,7 +3018,7 @@ int str_to_mapargs(const char_u *strargs, bool is_unmap, MapArguments *mapargs)
// {lhs_end} is a pointer to the "terminating whitespace" after {lhs}.
// Use that to initialize {rhs_start}.
const char_u *rhs_start = skipwhite(lhs_end);
const char_u *rhs_start = (char_u *)skipwhite((char *)lhs_end);
// Given {lhs} might be larger than MAXMAPLEN before replace_termcodes
// (e.g. "<Space>" is longer than ' '), so first copy into a buffer.
@ -3275,7 +3273,7 @@ int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev, buf_T
// the "lhs", since an abbreviation can't have
// trailing space.
if (n != len && (!is_abbrev || round || n > len
|| *skipwhite(lhs + n) != NUL)) {
|| *skipwhite((char *)lhs + n) != NUL)) {
mpp = &(mp->m_next);
continue;
}
@ -3799,8 +3797,9 @@ bool map_to_exists(const char *const str, const char *const modechars, const boo
int retval;
char_u *buf;
const char_u *const rhs = replace_termcodes((const char_u *)str, strlen(str), &buf, REPTERM_DO_LT,
NULL, CPO_TO_CPO_FLAGS);
const char_u *const rhs = (char_u *)replace_termcodes(str, strlen(str),
(char **)&buf, REPTERM_DO_LT,
NULL, CPO_TO_CPO_FLAGS);
#define MAPMODE(mode, modechars, chr, modeflags) \
do { \
@ -3907,31 +3906,31 @@ char_u *set_context_in_map_cmd(expand_T *xp, char_u *cmd, char_u *arg, bool forc
for (;;) {
if (STRNCMP(arg, "<buffer>", 8) == 0) {
expand_buffer = true;
arg = skipwhite(arg + 8);
arg = (char_u *)skipwhite((char *)arg + 8);
continue;
}
if (STRNCMP(arg, "<unique>", 8) == 0) {
arg = skipwhite(arg + 8);
arg = (char_u *)skipwhite((char *)arg + 8);
continue;
}
if (STRNCMP(arg, "<nowait>", 8) == 0) {
arg = skipwhite(arg + 8);
arg = (char_u *)skipwhite((char *)arg + 8);
continue;
}
if (STRNCMP(arg, "<silent>", 8) == 0) {
arg = skipwhite(arg + 8);
arg = (char_u *)skipwhite((char *)arg + 8);
continue;
}
if (STRNCMP(arg, "<special>", 9) == 0) {
arg = skipwhite(arg + 9);
arg = (char_u *)skipwhite((char *)arg + 9);
continue;
}
if (STRNCMP(arg, "<script>", 8) == 0) {
arg = skipwhite(arg + 8);
arg = (char_u *)skipwhite((char *)arg + 8);
continue;
}
if (STRNCMP(arg, "<expr>", 6) == 0) {
arg = skipwhite(arg + 6);
arg = (char_u *)skipwhite((char *)arg + 6);
continue;
}
break;
@ -4190,10 +4189,10 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
if (c >= ABBR_OFF) {
c -= ABBR_OFF;
}
int newlen = utf_char2bytes(c, tb + j);
int newlen = utf_char2bytes(c, (char *)tb + j);
tb[j + newlen] = NUL;
// Need to escape K_SPECIAL.
char_u *escaped = vim_strsave_escape_ks(tb + j);
char_u *escaped = (char_u *)vim_strsave_escape_ks((char *)tb + j);
if (escaped != NULL) {
newlen = (int)STRLEN(escaped);
memmove(tb + j, escaped, (size_t)newlen);
@ -4203,7 +4202,7 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
}
tb[j] = NUL;
// insert the last typed char
(void)ins_typebuf(tb, 1, 0, true, mp->m_silent);
(void)ins_typebuf((char *)tb, 1, 0, true, mp->m_silent);
}
if (mp->m_expr) {
s = eval_map_expr(mp, c);
@ -4212,7 +4211,7 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
}
if (s != NULL) {
// insert the to string
(void)ins_typebuf(s, mp->m_noremap, 0, true, mp->m_silent);
(void)ins_typebuf((char *)s, mp->m_noremap, 0, true, mp->m_silent);
// no abbrev. for these chars
typebuf.tb_no_abbr_cnt += (int)STRLEN(s) + j + 1;
if (mp->m_expr) {
@ -4224,7 +4223,7 @@ bool check_abbr(int c, char_u *ptr, int col, int mincol)
tb[1] = NUL;
len = clen; // Delete characters instead of bytes
while (len-- > 0) { // delete the from string
(void)ins_typebuf(tb, 1, 0, true, mp->m_silent);
(void)ins_typebuf((char *)tb, 1, 0, true, mp->m_silent);
}
return true;
}
@ -4286,7 +4285,7 @@ static char_u *eval_map_expr(mapblock_T *mp, int c)
return NULL;
}
// Escape K_SPECIAL in the result to be able to use the string as typeahead.
res = vim_strsave_escape_ks(p);
res = (char_u *)vim_strsave_escape_ks((char *)p);
xfree(p);
return res;
@ -4294,14 +4293,14 @@ static char_u *eval_map_expr(mapblock_T *mp, int c)
/// Copy "p" to allocated memory, escaping K_SPECIAL so that the result
/// can be put in the typeahead buffer.
char_u *vim_strsave_escape_ks(char_u *p)
char *vim_strsave_escape_ks(char *p)
{
// Need a buffer to hold up to three times as much. Four in case of an
// illegal utf-8 byte:
// 0xc0 -> 0xc3 - 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER
char_u *res = xmalloc(STRLEN(p) * 4 + 1);
char_u *d = res;
for (char_u *s = p; *s != NUL;) {
for (char_u *s = (char_u *)p; *s != NUL;) {
if (s[0] == K_SPECIAL && s[1] != NUL && s[2] != NUL) {
// Copy special key unmodified.
*d++ = *s++;
@ -4316,7 +4315,7 @@ char_u *vim_strsave_escape_ks(char_u *p)
}
*d = NUL;
return res;
return (char *)res;
}
/// Remove escaping from K_SPECIAL characters. Reverse of

View File

@ -2,10 +2,10 @@
// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include "nvim/arabic.h"
#include "nvim/highlight.h"
#include "nvim/vim.h"
#include "nvim/grid.h"
#include "nvim/highlight.h"
#include "nvim/ui.h"
#include "nvim/vim.h"
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "grid.c.generated.h"
@ -39,12 +39,12 @@ void grid_adjust(ScreenGrid **grid, int *row_off, int *col_off)
/// Put a unicode char, and up to MAX_MCO composing chars, in a screen cell.
int schar_from_cc(char_u *p, int c, int u8cc[MAX_MCO])
{
int len = utf_char2bytes(c, p);
int len = utf_char2bytes(c, (char *)p);
for (int i = 0; i < MAX_MCO; i++) {
if (u8cc[i] == 0) {
break;
}
len += utf_char2bytes(u8cc[i], p + len);
len += utf_char2bytes(u8cc[i], (char *)p + len);
}
p[len] = 0;
return len;
@ -113,10 +113,10 @@ int grid_fix_col(ScreenGrid *grid, int col, int row)
/// output a single character directly to the grid
void grid_putchar(ScreenGrid *grid, int c, int row, int col, int attr)
{
char_u buf[MB_MAXBYTES + 1];
char buf[MB_MAXBYTES + 1];
buf[utf_char2bytes(c, buf)] = NUL;
grid_puts(grid, buf, row, col, attr);
grid_puts(grid, (char_u *)buf, row, col, attr);
}
/// get a single character directly from grid.chars into "bytes[]".
@ -705,4 +705,3 @@ void grid_free_all_mem(void)
xfree(linebuf_char);
xfree(linebuf_attr);
}

View File

@ -4,8 +4,8 @@
#include <stdbool.h>
#include "nvim/ascii.h"
#include "nvim/grid_defs.h"
#include "nvim/buffer_defs.h"
#include "nvim/grid_defs.h"
/// By default, all windows are drawn on a single rectangular grid, represented by
/// this ScreenGrid instance. In multigrid mode each window will have its own
@ -34,7 +34,7 @@ static inline void schar_from_ascii(char_u *p, const char c)
/// Put a unicode character in a screen cell.
static inline int schar_from_char(char_u *p, int c)
{
int len = utf_char2bytes(c, p);
int len = utf_char2bytes(c, (char *)p);
p[len] = NUL;
return len;
}

View File

@ -569,8 +569,8 @@ static void prt_header(prt_settings_T *const psettings, const int pagenum, const
printer_page_num = pagenum;
use_sandbox = was_set_insecurely(curwin, "printheader", 0);
build_stl_str_hl(curwin, tbuf, (size_t)width + IOSIZE,
p_header, use_sandbox,
build_stl_str_hl(curwin, (char *)tbuf, (size_t)width + IOSIZE,
(char *)p_header, use_sandbox,
' ', width, NULL, NULL);
// Reset line numbers
@ -647,7 +647,7 @@ void ex_hardcopy(exarg_T *eap)
}
return;
}
settings.outfile = skipwhite((char_u *)eap->arg + 1);
settings.outfile = (char_u *)skipwhite(eap->arg + 1);
} else if (*eap->arg != NUL) {
settings.arguments = (char_u *)eap->arg;
}
@ -698,7 +698,7 @@ void ex_hardcopy(exarg_T *eap)
* Estimate the total lines to be printed
*/
for (lnum = eap->line1; lnum <= eap->line2; lnum++) {
bytes_to_print += STRLEN(skipwhite(ml_get(lnum)));
bytes_to_print += STRLEN(skipwhite((char *)ml_get(lnum)));
}
if (bytes_to_print == 0) {
msg(_("No text to be printed"));
@ -806,7 +806,7 @@ void ex_hardcopy(exarg_T *eap)
if (prtpos.column == 0) {
// finished a file line
prtpos.bytes_printed +=
STRLEN(skipwhite(ml_get(prtpos.file_line)));
STRLEN(skipwhite((char *)ml_get(prtpos.file_line)));
if (++prtpos.file_line > eap->line2) {
break; // reached the end
}
@ -1563,7 +1563,7 @@ static void prt_flush_buffer(void)
}
}
static void prt_resource_name(char_u *filename, void *cookie)
static void prt_resource_name(char *filename, void *cookie)
{
char_u *resource_filename = cookie;
@ -1588,7 +1588,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
STRLCAT(buffer, name, MAXPATHL);
STRLCAT(buffer, ".ps", MAXPATHL);
resource->filename[0] = NUL;
retval = (do_in_runtimepath(buffer, 0, prt_resource_name, resource->filename)
retval = (do_in_runtimepath((char *)buffer, 0, prt_resource_name, resource->filename)
&& resource->filename[0] != NUL);
xfree(buffer);
return retval;

View File

@ -796,14 +796,14 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// Isolate the name.
name_end = (const char *)skiptowhite((const char_u *)line);
linep = (const char *)skipwhite((const char_u *)name_end);
linep = (const char *)skipwhite(name_end);
// Check for "default" argument.
if (strncmp(line, "default", (size_t)(name_end - line)) == 0) {
dodefault = true;
line = linep;
name_end = (const char *)skiptowhite((const char_u *)line);
linep = (const char *)skipwhite((const char_u *)name_end);
linep = (const char *)skipwhite(name_end);
}
// Check for "clear" or "link" argument.
@ -835,7 +835,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
HlGroup *hlgroup = NULL;
from_end = (const char *)skiptowhite((const char_u *)from_start);
to_start = (const char *)skipwhite((const char_u *)from_end);
to_start = (const char *)skipwhite(from_end);
to_end = (const char *)skiptowhite((const char_u *)to_start);
if (ends_excmd((uint8_t)(*from_start))
@ -845,7 +845,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
return;
}
if (!ends_excmd(*skipwhite((const char_u *)to_end))) {
if (!ends_excmd(*skipwhite(to_end))) {
semsg(_("E413: Too many arguments: \":highlight link %s\""), from_start);
return;
}
@ -913,7 +913,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
return;
}
name_end = (const char *)skiptowhite((const char_u *)line);
linep = (const char *)skipwhite((const char_u *)name_end);
linep = (const char *)skipwhite(name_end);
}
// Find the group name in the table. If it does not exist yet, add it.
@ -959,7 +959,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
xfree(key);
key = (char *)vim_strnsave_up((const char_u *)key_start,
(size_t)(linep - key_start));
linep = (const char *)skipwhite((const char_u *)linep);
linep = (const char *)skipwhite(linep);
if (strcmp(key, "NONE") == 0) {
if (!init || HL_TABLE()[idx].sg_set == 0) {
@ -980,7 +980,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
linep++;
// Isolate the argument.
linep = (const char *)skipwhite((const char_u *)linep);
linep = (const char *)skipwhite(linep);
if (*linep == '\'') { // guifg='color name'
arg_start = ++linep;
linep = strchr(linep, '\'');
@ -1238,7 +1238,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
}
// Continue with next argument.
linep = (const char *)skipwhite((const char_u *)linep);
linep = (const char *)skipwhite(linep);
}
}
@ -1982,7 +1982,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
if (*p != NUL) { // Past "default" or group name.
include_default = 0;
if (strncmp("default", arg, (unsigned)(p - arg)) == 0) {
arg = (const char *)skipwhite((const char_u *)p);
arg = (const char *)skipwhite(p);
xp->xp_pattern = (char *)arg;
p = (const char *)skiptowhite((const char_u *)arg);
}
@ -1993,10 +1993,10 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
}
if (strncmp("link", arg, (unsigned)(p - arg)) == 0
|| strncmp("clear", arg, (unsigned)(p - arg)) == 0) {
xp->xp_pattern = (char *)skipwhite((const char_u *)p);
xp->xp_pattern = skipwhite(p);
p = (const char *)skiptowhite((char_u *)xp->xp_pattern);
if (*p != NUL) { // Past first group name.
xp->xp_pattern = (char *)skipwhite((const char_u *)p);
xp->xp_pattern = skipwhite(p);
p = (const char *)skiptowhite((char_u *)xp->xp_pattern);
}
}

View File

@ -153,7 +153,7 @@ void set_context_in_cscope_cmd(expand_T *xp, const char *arg, cmdidx_T cmdidx)
if (*arg != NUL) {
const char *p = (const char *)skiptowhite((const char_u *)arg);
if (*p != NUL) { // Past first word.
xp->xp_pattern = (char *)skipwhite((const char_u *)p);
xp->xp_pattern = skipwhite(p);
if (*skiptowhite((char_u *)xp->xp_pattern) != NUL) {
xp->xp_context = EXPAND_NOTHING;
} else if (STRNICMP(arg, "add", p - arg) == 0) {

View File

@ -243,7 +243,7 @@ int set_indent(int size, int flags)
if (flags & SIN_INSERT) {
p = oldline;
} else {
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
}
line_len = (int)STRLEN(p) + 1;
@ -325,7 +325,7 @@ int set_indent(int size, int flags)
todo -= tab_pad;
ind_done += tab_pad;
}
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
}
for (;;) {

View File

@ -226,7 +226,7 @@ bool cin_is_cinword(const char_u *line)
size_t cinw_len = STRLEN(curbuf->b_p_cinw) + 1;
char_u *cinw_buf = xmalloc(cinw_len);
line = skipwhite(line);
line = (char_u *)skipwhite((char *)line);
for (char_u *cinw = curbuf->b_p_cinw; *cinw; ) {
size_t len = copy_option_part(&cinw, cinw_buf, cinw_len, ",");
@ -253,7 +253,7 @@ static const char_u *cin_skipcomment(const char_u *s)
while (*s) {
const char_u *prev_s = s;
s = skipwhite(s);
s = (char_u *)skipwhite((char *)s);
/* Perl/shell # comment comment continues until eol. Require a space
* before # to avoid recognizing $#array. */
@ -302,7 +302,7 @@ static pos_T *find_line_comment(void) // XXX
pos = curwin->w_cursor;
while (--pos.lnum > 0) {
line = ml_get(pos.lnum);
p = skipwhite(line);
p = (char_u *)skipwhite((char *)line);
if (cin_islinecomment(p)) {
pos.col = (int)(p - line);
return &pos;
@ -316,7 +316,7 @@ static pos_T *find_line_comment(void) // XXX
/// Checks if `text` starts with "key:".
static bool cin_has_js_key(const char_u *text)
{
const char_u *s = skipwhite(text);
const char_u *s = (char_u *)skipwhite((char *)text);
char_u quote = 0;
if (*s == '\'' || *s == '"') {
@ -551,15 +551,15 @@ static bool cin_is_cpp_namespace(const char_u *s)
s = cin_skipcomment(s);
if (STRNCMP(s, "inline", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6]))) {
s = cin_skipcomment(skipwhite(s + 6));
s = cin_skipcomment((char_u *)skipwhite((char *)s + 6));
}
if (STRNCMP(s, "namespace", 9) == 0 && (s[9] == NUL || !vim_iswordc(s[9]))) {
p = cin_skipcomment(skipwhite(s + 9));
p = cin_skipcomment((char_u *)skipwhite((char *)s + 9));
while (*p != NUL) {
if (ascii_iswhite(*p)) {
has_name = true; // found end of a name
p = cin_skipcomment(skipwhite(p));
p = cin_skipcomment((char_u *)skipwhite((char *)p));
} else if (*p == '{') {
break;
} else if (vim_iswordc(*p)) {
@ -679,31 +679,32 @@ static int cin_first_id_amount(void)
colnr_T col;
line = get_cursor_line_ptr();
p = skipwhite(line);
p = (char_u *)skipwhite((char *)line);
len = (int)(skiptowhite(p) - p);
if (len == 6 && STRNCMP(p, "static", 6) == 0) {
p = skipwhite(p + 6);
p = (char_u *)skipwhite((char *)p + 6);
len = (int)(skiptowhite(p) - p);
}
if (len == 6 && STRNCMP(p, "struct", 6) == 0)
p = skipwhite(p + 6);
else if (len == 4 && STRNCMP(p, "enum", 4) == 0)
p = skipwhite(p + 4);
else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0)
|| (len == 6 && STRNCMP(p, "signed", 6) == 0)) {
s = skipwhite(p + len);
if (len == 6 && STRNCMP(p, "struct", 6) == 0) {
p = (char_u *)skipwhite((char *)p + 6);
} else if (len == 4 && STRNCMP(p, "enum", 4) == 0) {
p = (char_u *)skipwhite((char *)p + 4);
} else if ((len == 8 && STRNCMP(p, "unsigned", 8) == 0)
|| (len == 6 && STRNCMP(p, "signed", 6) == 0)) {
s = (char_u *)skipwhite((char *)p + len);
if ((STRNCMP(s, "int", 3) == 0 && ascii_iswhite(s[3]))
|| (STRNCMP(s, "long", 4) == 0 && ascii_iswhite(s[4]))
|| (STRNCMP(s, "short", 5) == 0 && ascii_iswhite(s[5]))
|| (STRNCMP(s, "char", 4) == 0 && ascii_iswhite(s[4])))
|| (STRNCMP(s, "char", 4) == 0 && ascii_iswhite(s[4]))) {
p = s;
}
}
for (len = 0; vim_isIDc(p[len]); ++len)
;
if (len == 0 || !ascii_iswhite(p[len]) || cin_nocode(p))
return 0;
p = skipwhite(p + len);
p = (char_u *)skipwhite((char *)p + len);
fp.lnum = curwin->w_cursor.lnum;
fp.col = (colnr_T)(p - line);
getvcol(curwin, &fp, &col, NULL, NULL);
@ -743,9 +744,10 @@ static int cin_get_equal_amount(linenr_T lnum)
if (*s != '=')
return 0;
s = skipwhite(s + 1);
if (cin_nocode(s))
s = (char_u *)skipwhite((char *)s + 1);
if (cin_nocode(s)) {
return 0;
}
if (*s == '"') { // nice alignment for continued strings
s++;
@ -762,8 +764,9 @@ static int cin_get_equal_amount(linenr_T lnum)
*/
static int cin_ispreproc(const char_u *s)
{
if (*skipwhite(s) == '#')
return TRUE;
if (*skipwhite((char *)s) == '#') {
return true;
}
return FALSE;
}
@ -964,9 +967,10 @@ static int cin_isfuncdecl(const char_u **sp, linenr_T first_lnum, linenr_T min_l
break;
/* Require a comma at end of the line or a comma or ')' at the
* start of next line. */
s = skipwhite(s);
if (!just_started && (!comma && *s != ',' && *s != ')'))
s = (char_u *)skipwhite((char *)s);
if (!just_started && (!comma && *s != ',' && *s != ')')) {
break;
}
just_started = false;
} else if (cin_iscomment(s)) { // ignore comments
s = cin_skipcomment(s);
@ -1098,7 +1102,7 @@ static int cin_iswhileofdo_end(int terminated)
while (*p != NUL) {
p = cin_skipcomment(p);
if (*p == ')') {
s = skipwhite(p + 1);
s = (char_u *)skipwhite((char *)p + 1);
if (*s == ';' && cin_nocode(s + 1)) {
/* Found ");" at end of the line, now check there is "while"
* before the matching '('. XXX */
@ -1158,7 +1162,7 @@ static int cin_is_cpp_baseclass(cpp_baseclass_cache_T *cached) {
pos->col = 0;
s = skipwhite(line);
s = (char_u *)skipwhite((char *)line);
if (*s == '#') { // skip #define FOO x ? (x) : x
return false;
}
@ -1183,9 +1187,10 @@ static int cin_is_cpp_baseclass(cpp_baseclass_cache_T *cached) {
*/
while (lnum > 1) {
line = ml_get(lnum - 1);
s = skipwhite(line);
if (*s == '#' || *s == NUL)
s = (char_u *)skipwhite((char *)line);
if (*s == '#' || *s == NUL) {
break;
}
while (*s != NUL) {
s = cin_skipcomment(s);
if (*s == '{' || *s == '}'
@ -1327,11 +1332,13 @@ static int cin_ends_in(const char_u *s, const char_u *find, const char_u *ignore
while (*p != NUL) {
p = cin_skipcomment(p);
if (STRNCMP(p, find, len) == 0) {
r = skipwhite(p + len);
if (ignore != NULL && STRNCMP(r, ignore, STRLEN(ignore)) == 0)
r = skipwhite(r + STRLEN(ignore));
if (cin_nocode(r))
return TRUE;
r = (char_u *)skipwhite((char *)p + len);
if (ignore != NULL && STRNCMP(r, ignore, STRLEN(ignore)) == 0) {
r = (char_u *)skipwhite((char *)r + STRLEN(ignore));
}
if (cin_nocode(r)) {
return true;
}
}
if (*p != NUL)
++p;
@ -1357,10 +1364,10 @@ static int cin_is_cpp_extern_c(const char_u *s)
s = cin_skipcomment(s);
if (STRNCMP(s, "extern", 6) == 0 && (s[6] == NUL || !vim_iswordc(s[6]))) {
p = cin_skipcomment(skipwhite(s + 6));
p = cin_skipcomment((char_u *)skipwhite((char *)s + 6));
while (*p != NUL) {
if (ascii_iswhite(*p)) {
p = cin_skipcomment(skipwhite(p));
p = cin_skipcomment((char_u *)skipwhite((char *)p));
} else if (*p == '{') {
break;
} else if (p[0] == '"' && p[1] == 'C' && p[2] == '"') {
@ -1866,7 +1873,7 @@ int get_c_indent(void)
&& linecopy[curwin->w_cursor.col] == ')')
linecopy[curwin->w_cursor.col] = NUL;
theline = skipwhite(linecopy);
theline = (char_u *)skipwhite((char *)linecopy);
// move the cursor to the start of the line
@ -1893,7 +1900,7 @@ int get_c_indent(void)
// #defines and so on go at the left when included in 'cinkeys',
// exluding pragmas when customized in 'cinoptions'
if (*theline == '#' && (*linecopy == '#' || in_cinkeys('#', ' ', true))) {
const char_u *const directive = skipwhite(theline + 1);
const char_u *const directive = (char_u *)skipwhite((char *)theline + 1);
if (curbuf->b_ind_pragma == 0 || STRNCMP(directive, "pragma", 6) != 0) {
amount = curbuf->b_ind_hash_comment;
goto theend;
@ -1995,11 +2002,10 @@ int get_c_indent(void)
* line, use the indent of that line plus offset. If
* the middle comment string matches in the previous
* line, use the indent of that line. XXX */
look = skipwhite(ml_get(curwin->w_cursor.lnum - 1));
if (STRNCMP(look, lead_start, lead_start_len) == 0)
look = (char_u *)skipwhite((char *)ml_get(curwin->w_cursor.lnum - 1));
if (STRNCMP(look, lead_start, lead_start_len) == 0) {
amount = get_indent_lnum(curwin->w_cursor.lnum - 1);
else if (STRNCMP(look, lead_middle,
lead_middle_len) == 0) {
} else if (STRNCMP(look, lead_middle, lead_middle_len) == 0) {
amount = get_indent_lnum(curwin->w_cursor.lnum - 1);
break;
} else if (STRNCMP(ml_get(comment_pos->lnum) + comment_pos->col,
@ -2063,7 +2069,7 @@ int get_c_indent(void)
start = ml_get(comment_pos->lnum);
look = start + comment_pos->col + 2; // skip / and *
if (*look != NUL) { // if something after it
comment_pos->col = (colnr_T)(skipwhite(look) - start);
comment_pos->col = (colnr_T)((char_u *)skipwhite((char *)look) - start);
}
}
getvcol(curwin, comment_pos, &col, NULL, NULL);
@ -2075,8 +2081,8 @@ int get_c_indent(void)
goto theend;
}
// Are we looking at a ']' that has a match?
if (*skipwhite(theline) == ']'
&& (trypos = find_match_char('[', curbuf->b_ind_maxparen)) != NULL) {
if (*skipwhite((char *)theline) == ']'
&& (trypos = find_match_char('[', curbuf->b_ind_maxparen)) != NULL) {
// align with the line containing the '['.
amount = get_indent_lnum(trypos->lnum);
goto theend;
@ -2109,8 +2115,8 @@ int get_c_indent(void)
amount = get_indent_lnum(curwin->w_cursor.lnum - 1); // XXX
} else {
amount = -1;
for (lnum = cur_curpos.lnum - 1; lnum > our_paren_pos.lnum; --lnum) {
l = skipwhite(ml_get(lnum));
for (lnum = cur_curpos.lnum - 1; lnum > our_paren_pos.lnum; lnum--) {
l = (char_u *)skipwhite((char *)ml_get(lnum));
if (cin_nocode(l)) { // skip comment lines
continue;
}
@ -2178,7 +2184,7 @@ int get_c_indent(void)
}
amount = skip_label(our_paren_pos.lnum, &look);
look = skipwhite(look);
look = (char_u *)skipwhite((char *)look);
if (*look == '(') {
linenr_T save_lnum = curwin->w_cursor.lnum;
char_u *line;
@ -2335,7 +2341,7 @@ int get_c_indent(void)
* otherwise, check out the indentation of the line as
* a whole and then add the "imaginary indent" to that.
*/
look = skipwhite(start);
look = (char_u *)skipwhite((char *)start);
if (*look == '{') {
getvcol(curwin, trypos, &col, NULL, NULL);
amount = col;
@ -2361,7 +2367,7 @@ int get_c_indent(void)
// ldfd) {
// }
if ((curbuf->b_ind_js || curbuf->b_ind_keep_case_label)
&& cin_iscase(skipwhite(get_cursor_line_ptr()), false)) {
&& cin_iscase((char_u *)skipwhite((char *)get_cursor_line_ptr()), false)) {
amount = get_indent();
} else if (curbuf->b_ind_js) {
amount = get_indent_lnum(lnum);
@ -2428,7 +2434,7 @@ int get_c_indent(void)
if (start_brace == BRACE_AT_END) { // '{' is at end of line
amount += curbuf->b_ind_open_imag;
l = skipwhite(get_cursor_line_ptr());
l = (char_u *)skipwhite((char *)get_cursor_line_ptr());
if (cin_is_cpp_namespace(l)) {
amount += curbuf->b_ind_cpp_namespace;
} else if (cin_is_cpp_extern_c(l)) {
@ -2881,7 +2887,7 @@ int get_c_indent(void)
if (terminated == 0 || (lookfor != LOOKFOR_UNTERM
&& terminated == ',')) {
if (lookfor != LOOKFOR_ENUM_OR_INIT
&& (*skipwhite(l) == '[' || l[STRLEN(l) - 1] == '[')) {
&& (*skipwhite((char *)l) == '[' || l[STRLEN(l) - 1] == '[')) {
amount += ind_continuation;
}
// If we're in the middle of a paren thing, Go back to the line
@ -2965,8 +2971,9 @@ int get_c_indent(void)
* { 1, 2 },
* -> { 3, 4 }
*/
if (*skipwhite(l) != '{')
if (*skipwhite((char *)l) != '{') {
amount += curbuf->b_ind_open_extra;
}
if (curbuf->b_ind_cpp_baseclass && !curbuf->b_ind_js) {
/* have to look back, whether it is a cpp base
@ -2981,14 +2988,12 @@ int get_c_indent(void)
* Check if we are after an "if", "while", etc.
* Also allow " } else".
*/
if (cin_is_cinword(l) || cin_iselse(skipwhite(l))) {
/*
* Found an unterminated line after an if (), line up
* with the last one.
* if (cond)
* 100 +
* -> here;
*/
if (cin_is_cinword(l) || cin_iselse((char_u *)skipwhite((char *)l))) {
// Found an unterminated line after an if (), line up
// with the last one.
// if (cond)
// 100 +
// -> here;
if (lookfor == LOOKFOR_UNTERM
|| lookfor == LOOKFOR_ENUM_OR_INIT) {
if (cont_amount > 0)
@ -3027,7 +3032,7 @@ int get_c_indent(void)
* x = 1;
* -> here
*/
l = skipwhite(get_cursor_line_ptr());
l = (char_u *)skipwhite((char *)get_cursor_line_ptr());
if (cin_isdo(l)) {
if (whilelevel == 0)
break;
@ -3105,7 +3110,7 @@ int get_c_indent(void)
n = (int)STRLEN(l);
if (terminated == ','
&& (*skipwhite(l) == ']'
&& (*skipwhite((char *)l) == ']'
|| (n >=2 && l[n - 2] == ']'))) {
break;
}
@ -3132,7 +3137,7 @@ int get_c_indent(void)
// 4 *
// 5,
// 6,
if (cin_iscomment(skipwhite(l))) {
if (cin_iscomment((char_u *)skipwhite((char *)l))) {
break;
}
lookfor = LOOKFOR_COMMA;
@ -3209,7 +3214,7 @@ int get_c_indent(void)
* may be lined up with the case label.
*/
if (lookfor == LOOKFOR_NOBREAK
&& cin_isbreak(skipwhite(get_cursor_line_ptr()))) {
&& cin_isbreak((char_u *)skipwhite((char *)get_cursor_line_ptr()))) {
lookfor = LOOKFOR_ANY;
continue;
}
@ -3313,9 +3318,10 @@ term_again:
if (theline[0] == '{')
amount += curbuf->b_ind_open_extra;
// See remark above: "Only add b_ind_open_extra.."
l = skipwhite(l);
if (*l == '{')
l = (char_u *)skipwhite((char *)l);
if (*l == '{') {
amount -= curbuf->b_ind_open_extra;
}
lookfor = iscase ? LOOKFOR_ANY : LOOKFOR_TERM;
/*
@ -3503,8 +3509,9 @@ term_again:
* Finding the closing '}' of a previous function. Put
* current line at the left margin. For when 'cino' has "fs".
*/
if (*skipwhite(l) == '}')
if (*skipwhite((char *)l) == '}') {
break;
}
/* (matching {)
* If the previous line ends on '};' (maybe followed by
@ -3529,7 +3536,7 @@ term_again:
* line ending in '}', e.g. before an #endif. Don't increase
* indent then.
*/
if (*(look = skipwhite(l)) == ';' && cin_nocode(look + 1)) {
if (*(look = (char_u *)skipwhite((char *)l)) == ';' && cin_nocode(look + 1)) {
pos_T curpos_save = curwin->w_cursor;
while (curwin->w_cursor.lnum > 1) {

View File

@ -538,7 +538,7 @@ char_u *get_special_key_name(int c, int modifiers)
} else {
// Not a special key, only modifiers, output directly.
if (utf_char2len(c) > 1) {
idx += utf_char2bytes(c, string + idx);
idx += utf_char2bytes(c, (char *)string + idx);
} else if (vim_isprintc(c)) {
string[idx++] = (char_u)c;
} else {
@ -611,7 +611,7 @@ unsigned int special_to_buf(int key, int modifiers, bool escape_ks, char_u *dst)
assert(after >= dst && (uintmax_t)(after - dst) <= UINT_MAX);
dlen = (unsigned int)(after - dst);
} else {
dlen += (unsigned int)utf_char2bytes(key, dst + dlen);
dlen += (unsigned int)utf_char2bytes(key, (char *)dst + dlen);
}
return dlen;
@ -884,8 +884,8 @@ int get_mouse_button(int code, bool *is_click, bool *is_drag)
/// @param[in] cpo_flags Relevant flags derived from p_cpo, see CPO_TO_CPO_FLAGS.
///
/// @return Pointer to an allocated memory, which is also saved to "bufp".
char_u *replace_termcodes(const char_u *const from, const size_t from_len, char_u **const bufp,
const int flags, bool *const did_simplify, const int cpo_flags)
char *replace_termcodes(const char *const from, const size_t from_len, char **const bufp,
const int flags, bool *const did_simplify, const int cpo_flags)
FUNC_ATTR_NONNULL_ARG(1, 3)
{
ssize_t i;
@ -893,7 +893,7 @@ char_u *replace_termcodes(const char_u *const from, const size_t from_len, char_
char_u key;
size_t dlen = 0;
const char_u *src;
const char_u *const end = from + from_len - 1;
const char_u *const end = (char_u *)from + from_len - 1;
char_u *result; // buffer for resulting string
const bool do_backslash = !(cpo_flags & FLAG_CPO_BSLASH); // backslash is a special character
@ -904,7 +904,7 @@ char_u *replace_termcodes(const char_u *const from, const size_t from_len, char_
const size_t buf_len = from_len * 6 + 1;
result = xmalloc(buf_len);
src = from;
src = (char_u *)from;
// Check for #n at start only: function key n
if ((flags & REPTERM_FROM_PART) && from_len > 1 && src[0] == '#'

View File

@ -956,7 +956,7 @@ int nlua_call(lua_State *lstate)
funcexe.evaluate = true;
// call_func() retval is deceptive, ignore it. Instead we set `msg_list`
// (TRY_WRAP) to capture abort-causing non-exception errors.
(void)call_func(name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
(void)call_func((char *)name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
if (!try_end(&err)) {
nlua_push_typval(lstate, &rettv, false);
}
@ -1873,7 +1873,7 @@ void nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap)
char *buf = xcalloc(length, sizeof(char));
bool done = false;
while (!done) {
done = uc_split_args_iter((char_u *)eap->arg, length, &end, buf, &len);
done = uc_split_args_iter(eap->arg, length, &end, buf, &len);
if (len > 0) {
lua_pushlstring(lstate, buf, len);
lua_rawseti(lstate, -2, i);

View File

@ -106,7 +106,7 @@
(p -= utf_head_off((char_u *)(s), (char_u *)(p) - 1) + 1)
// MB_CHAR2BYTES(): convert character to bytes and advance pointer to bytes
#define MB_CHAR2BYTES(c, b) ((b) += utf_char2bytes((c), (b)))
#define MB_CHAR2BYTES(c, b) ((b) += utf_char2bytes((c), ((char *)b)))
#define RESET_BINDING(wp) \
do { \

View File

@ -632,7 +632,7 @@ static char_u *mark_line(pos_T *mp, int lead_len)
}
assert(Columns >= 0);
// Allow for up to 5 bytes per character.
s = vim_strnsave(skipwhite(ml_get(mp->lnum)), (size_t)Columns * 5);
s = vim_strnsave((char_u *)skipwhite((char *)ml_get(mp->lnum)), (size_t)Columns * 5);
// Truncate the line to fit it in the window
len = 0;

View File

@ -912,7 +912,7 @@ void f_getmatches(typval_T *argvars, typval_T *rettv, FunPtr fptr)
if (cur->conceal_char) {
char buf[MB_MAXBYTES + 1];
buf[utf_char2bytes(cur->conceal_char, (char_u *)buf)] = NUL;
buf[utf_char2bytes(cur->conceal_char, buf)] = NUL;
tv_dict_add_str(dict, S_LEN("conceal"), buf);
}
@ -1185,7 +1185,7 @@ void ex_match(exarg_T *eap)
if (!eap->skip) {
g = vim_strnsave((char_u *)eap->arg, (size_t)(p - (char_u *)eap->arg));
}
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (*p == NUL) {
// There must be two arguments.
xfree(g);
@ -1194,7 +1194,7 @@ void ex_match(exarg_T *eap)
}
end = skip_regexp(p + 1, *p, true, NULL);
if (!eap->skip) {
if (*end != NUL && !ends_excmd(*skipwhite(end + 1))) {
if (*end != NUL && !ends_excmd(*skipwhite((char *)end + 1))) {
xfree(g);
eap->errmsg = e_trailing;
return;

View File

@ -579,13 +579,13 @@ size_t mb_string2cells(const char *str)
/// string.
/// @param size maximum length of string. It will terminate on earlier NUL.
/// @return The number of cells occupied by string `str`
size_t mb_string2cells_len(const char_u *str, size_t size)
size_t mb_string2cells_len(const char *str, size_t size)
FUNC_ATTR_NONNULL_ARG(1)
{
size_t clen = 0;
for (const char_u *p = str; *p != NUL && p < str + size;
p += utfc_ptr2len_len(p, size + (p - str))) {
for (const char_u *p = (char_u *)str; *p != NUL && p < (char_u *)str + size;
p += utfc_ptr2len_len(p, size + (p - (char_u *)str))) {
clen += utf_ptr2cells((char *)p);
}
@ -1007,7 +1007,7 @@ int utf_char2len(const int c)
/// @param c character to convert to \p buf
/// @param[out] buf UTF-8 string generated from \p c, does not add \0
/// @return Number of bytes (1-6).
int utf_char2bytes(const int c, char_u *const buf)
int utf_char2bytes(const int c, char *const buf)
{
if (c < 0x80) { // 7 bits
buf[0] = c;
@ -1370,10 +1370,10 @@ static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2
// to fold just one character to determine the result of comparison.
if (c1 != -1 && c2 == -1) {
n1 = utf_char2bytes(utf_fold(c1), buffer);
n1 = utf_char2bytes(utf_fold(c1), (char *)buffer);
s1 = buffer;
} else if (c2 != -1 && c1 == -1) {
n2 = utf_char2bytes(utf_fold(c2), buffer);
n2 = utf_char2bytes(utf_fold(c2), (char *)buffer);
s2 = buffer;
}
@ -2588,7 +2588,7 @@ char_u *string_convert_ext(const vimconv_T *const vcp, char_u *ptr, size_t *lenp
case 0xbe:
c = 0x0178; break; // Y
}
d += utf_char2bytes(c, d);
d += utf_char2bytes(c, (char *)d);
}
*d = NUL;
if (lenp != NULL) {

View File

@ -82,17 +82,17 @@ void ex_menu(exarg_T *eap)
for (;;) {
if (STRNCMP(arg, "<script>", 8) == 0) {
noremap = REMAP_SCRIPT;
arg = (char *)skipwhite((char_u *)arg + 8);
arg = skipwhite(arg + 8);
continue;
}
if (STRNCMP(arg, "<silent>", 8) == 0) {
silent = true;
arg = (char *)skipwhite((char_u *)arg + 8);
arg = skipwhite(arg + 8);
continue;
}
if (STRNCMP(arg, "<special>", 9) == 0) {
// Ignore obsolete "<special>" modifier.
arg = (char *)skipwhite((char_u *)arg + 9);
arg = skipwhite(arg + 9);
continue;
}
break;
@ -111,7 +111,7 @@ void ex_menu(exarg_T *eap)
}
if (*arg != NUL) {
*arg++ = NUL;
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
}
}
@ -131,7 +131,7 @@ void ex_menu(exarg_T *eap)
arg++;
}
}
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
} else if (eap->addr_count && eap->line2 != 0) {
pri_tab[0] = eap->line2;
i = 1;
@ -148,10 +148,10 @@ void ex_menu(exarg_T *eap)
*/
if (STRNCMP(arg, "enable", 6) == 0 && ascii_iswhite(arg[6])) {
enable = kTrue;
arg = (char *)skipwhite((char_u *)arg + 6);
arg = skipwhite(arg + 6);
} else if (STRNCMP(arg, "disable", 7) == 0 && ascii_iswhite(arg[7])) {
enable = kFalse;
arg = (char *)skipwhite((char_u *)arg + 7);
arg = skipwhite(arg + 7);
}
/*
@ -236,8 +236,8 @@ void ex_menu(exarg_T *eap)
} else if (modes & MENU_TIP_MODE) {
map_buf = NULL; // Menu tips are plain text.
} else {
map_to = (char *)replace_termcodes((char_u *)map_to, STRLEN(map_to), (char_u **)&map_buf,
REPTERM_DO_LT, NULL, CPO_TO_CPO_FLAGS);
map_to = replace_termcodes(map_to, STRLEN(map_to), &map_buf,
REPTERM_DO_LT, NULL, CPO_TO_CPO_FLAGS);
}
menuarg.modes = modes;
menuarg.noremap[0] = noremap;
@ -701,7 +701,7 @@ static dict_T *menu_get_recursive(const vimmenu_T *menu, int modes)
if (menu->mnemonic) {
char buf[MB_MAXCHAR + 1] = { 0 }; // > max value of utf8_char2bytes
utf_char2bytes(menu->mnemonic, (char_u *)buf);
utf_char2bytes(menu->mnemonic, buf);
tv_dict_add_str(dict, S_LEN("shortcut"), buf);
}
@ -1458,7 +1458,7 @@ static void execute_menu(const exarg_T *eap, vimmenu_T *menu)
restore_current_state(&save_state);
ex_normal_busy--;
} else {
ins_typebuf((char_u *)menu->strings[idx], menu->noremap[idx], 0, true,
ins_typebuf(menu->strings[idx], menu->noremap[idx], 0, true,
menu->silent[idx]);
}
} else if (eap != NULL) {
@ -1541,7 +1541,7 @@ void ex_menutranslate(exarg_T *eap)
/*
* ":menutrans clear": clear all translations.
*/
if (STRNCMP(arg, "clear", 5) == 0 && ends_excmd(*skipwhite((char_u *)arg + 5))) {
if (STRNCMP(arg, "clear", 5) == 0 && ends_excmd(*skipwhite(arg + 5))) {
GA_DEEP_CLEAR(&menutrans_ga, menutrans_T, FREE_MENUTRANS);
// Delete all "menutrans_" global variables.
@ -1550,7 +1550,7 @@ void ex_menutranslate(exarg_T *eap)
// ":menutrans from to": add translation
from = arg;
arg = menu_skip_part(arg);
to = (char *)skipwhite((char_u *)arg);
to = skipwhite(arg);
*arg = NUL;
arg = menu_skip_part(to);
if (arg == to) {
@ -1651,7 +1651,7 @@ static char *menu_translate_tab_and_shift(char *arg_start)
if (*arg != NUL) {
*arg++ = NUL;
}
arg = (char *)skipwhite((char_u *)arg);
arg = skipwhite(arg);
return arg;
}

View File

@ -134,7 +134,7 @@ static int msg_grid_scroll_discount = 0;
static void ui_ext_msg_set_pos(int row, bool scrolled)
{
char buf[MAX_MCO + 1];
size_t size = utf_char2bytes(curwin->w_p_fcs_chars.msgsep, (char_u *)buf);
size_t size = utf_char2bytes(curwin->w_p_fcs_chars.msgsep, buf);
buf[size] = '\0';
ui_call_msg_set_pos(msg_grid.handle, row, scrolled,
(String){ .data = buf, .size = size });
@ -1420,7 +1420,7 @@ void msg_putchar_attr(int c, int attr)
buf[2] = (char)K_THIRD(c);
buf[3] = NUL;
} else {
buf[utf_char2bytes(c, buf)] = NUL;
buf[utf_char2bytes(c, (char *)buf)] = NUL;
}
msg_puts_attr((const char *)buf, attr);
}
@ -1571,8 +1571,8 @@ void msg_make(char_u *arg)
int i;
static char_u *str = (char_u *)"eeffoc", *rs = (char_u *)"Plon#dqg#vxjduB";
arg = skipwhite(arg);
for (i = 5; *arg && i >= 0; --i) {
arg = (char_u *)skipwhite((char *)arg);
for (i = 5; *arg && i >= 0; i--) {
if (*arg++ != str[i]) {
break;
}
@ -1821,7 +1821,7 @@ void msg_prt_line(char_u *s, int list)
} else if (curwin->w_p_lcs_chars.nbsp != NUL && list
&& (utf_ptr2char((char *)s) == 160
|| utf_ptr2char((char *)s) == 0x202f)) {
utf_char2bytes(curwin->w_p_lcs_chars.nbsp, (char_u *)buf);
utf_char2bytes(curwin->w_p_lcs_chars.nbsp, buf);
buf[utfc_ptr2len(buf)] = NUL;
} else {
memmove(buf, s, (size_t)l);
@ -3509,7 +3509,7 @@ static int copy_char(const char_u *from, char_u *to, bool lowercase)
{
if (lowercase) {
int c = mb_tolower(utf_ptr2char((char *)from));
return utf_char2bytes(c, to);
return utf_char2bytes(c, (char *)to);
}
int len = utfc_ptr2len((char *)from);
memmove(to, from, (size_t)len);

View File

@ -1775,7 +1775,7 @@ bool do_mouse(oparg_T *oap, int c, int dir, long count, bool fixindent)
funcexe.firstline = curwin->w_cursor.lnum;
funcexe.lastline = curwin->w_cursor.lnum;
funcexe.evaluate = true;
(void)call_func((char_u *)tab_page_click_defs[mouse_col].func, -1,
(void)call_func(tab_page_click_defs[mouse_col].func, -1,
&rettv, ARRAY_SIZE(argv), argv, &funcexe);
tv_clear(&rettv);
break;
@ -3035,7 +3035,7 @@ bool find_decl(char_u *ptr, size_t len, bool locally, bool thisblock, int flags_
} else {
par_pos = curwin->w_cursor;
while (curwin->w_cursor.lnum > 1
&& *skipwhite(get_cursor_line_ptr()) != NUL) {
&& *skipwhite((char *)get_cursor_line_ptr()) != NUL) {
curwin->w_cursor.lnum--;
}
}
@ -4108,7 +4108,7 @@ static void nv_ident(cmdarg_T *cap)
assert(*kp != NUL); // option.c:do_set() should default to ":help" if empty.
bool kp_ex = (*kp == ':'); // 'keywordprg' is an ex command
bool kp_help = (STRCMP(kp, ":he") == 0 || STRCMP(kp, ":help") == 0);
if (kp_help && *skipwhite(ptr) == NUL) {
if (kp_help && *skipwhite((char *)ptr) == NUL) {
emsg(_(e_noident)); // found white space only
return;
}

View File

@ -667,7 +667,7 @@ void op_reindent(oparg_T *oap, Indenter how)
// indented, unless there is only one line.
if (i != oap->line_count - 1 || oap->line_count == 1
|| how != get_lisp_indent) {
l = skipwhite(get_cursor_line_ptr());
l = (char_u *)skipwhite((char *)get_cursor_line_ptr());
if (*l == NUL) { // empty or blank line
amount = 0;
} else {
@ -886,7 +886,7 @@ yankreg_T *copy_register(int name)
} else {
copy->y_array = xcalloc(copy->y_size, sizeof(char_u *));
for (size_t i = 0; i < copy->y_size; i++) {
copy->y_array[i] = vim_strsave(reg->y_array[i]);
copy->y_array[i] = xstrdup(reg->y_array[i]);
}
}
return copy;
@ -1005,7 +1005,7 @@ static int stuff_yank(int regname, char_u *p)
}
yankreg_T *reg = get_yank_register(regname, YREG_YANK);
if (is_append_register(regname) && reg->y_array != NULL) {
char_u **pp = &(reg->y_array[reg->y_size - 1]);
char_u **pp = (char_u **)&(reg->y_array[reg->y_size - 1]);
char_u *lp = xmalloc(STRLEN(*pp) + STRLEN(p) + 1);
STRCPY(lp, *pp);
// TODO(philix): use xstpcpy() in stuff_yank()
@ -1016,8 +1016,8 @@ static int stuff_yank(int regname, char_u *p)
} else {
free_register(reg);
set_yreg_additional_data(reg, NULL);
reg->y_array = (char_u **)xmalloc(sizeof(char_u *));
reg->y_array[0] = p;
reg->y_array = xmalloc(sizeof(char_u *));
reg->y_array[0] = (char *)p;
reg->y_size = 1;
reg->y_type = kMTCharWise;
}
@ -1053,7 +1053,7 @@ static char_u *execreg_line_continuation(char_u **lines, size_t *idx)
// Any line not starting with \ or "\ is the start of the
// command.
while (--i > 0) {
p = skipwhite(lines[i]);
p = (char_u *)skipwhite((char *)lines[i]);
if (*p != '\\' && (p[0] != '"' || p[1] != '\\' || p[2] != ' ')) {
break;
}
@ -1063,7 +1063,7 @@ static char_u *execreg_line_continuation(char_u **lines, size_t *idx)
// join all the lines
ga_concat(&ga, (char *)lines[cmd_start]);
for (size_t j = cmd_start + 1; j <= cmd_end; j++) {
p = skipwhite(lines[j]);
p = (char_u *)skipwhite((char *)lines[j]);
if (*p == '\\') {
// Adjust the growsize to the current length to
// speed up concatenating many lines.
@ -1165,32 +1165,32 @@ int do_execreg(int regname, int colon, int addcr, int silent)
for (size_t i = reg->y_size; i-- > 0;) { // from y_size - 1 to 0 included
// insert NL between lines and after last line if type is kMTLineWise
if (reg->y_type == kMTLineWise || i < reg->y_size - 1 || addcr) {
if (ins_typebuf((char_u *)"\n", remap, 0, true, silent) == FAIL) {
if (ins_typebuf("\n", remap, 0, true, silent) == FAIL) {
return FAIL;
}
}
// Handle line-continuation for :@<register>
char_u *str = reg->y_array[i];
char_u *str = (char_u *)reg->y_array[i];
bool free_str = false;
if (colon && i > 0) {
p = skipwhite(str);
p = (char_u *)skipwhite((char *)str);
if (*p == '\\' || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')) {
str = execreg_line_continuation(reg->y_array, &i);
str = execreg_line_continuation((char_u **)reg->y_array, &i);
free_str = true;
}
}
escaped = vim_strsave_escape_ks(str);
escaped = (char_u *)vim_strsave_escape_ks((char *)str);
if (free_str) {
xfree(str);
}
retval = ins_typebuf(escaped, remap, 0, true, silent);
retval = ins_typebuf((char *)escaped, remap, 0, true, silent);
xfree(escaped);
if (retval == FAIL) {
return FAIL;
}
if (colon
&& ins_typebuf((char_u *)":", remap, 0, true, silent) == FAIL) {
&& ins_typebuf(":", remap, 0, true, silent) == FAIL) {
return FAIL;
}
}
@ -1216,7 +1216,7 @@ static void put_reedit_in_typebuf(int silent)
buf[0] = (char_u)(restart_edit == 'I' ? 'i' : restart_edit);
buf[1] = NUL;
}
if (ins_typebuf(buf, REMAP_NONE, 0, true, silent) == OK) {
if (ins_typebuf((char *)buf, REMAP_NONE, 0, true, silent) == OK) {
restart_edit = NUL;
}
}
@ -1234,27 +1234,27 @@ static int put_in_typebuf(char_u *s, bool esc, bool colon, int silent)
put_reedit_in_typebuf(silent);
if (colon) {
retval = ins_typebuf((char_u *)"\n", REMAP_NONE, 0, true, silent);
retval = ins_typebuf("\n", REMAP_NONE, 0, true, silent);
}
if (retval == OK) {
char_u *p;
if (esc) {
p = vim_strsave_escape_ks(s);
p = (char_u *)vim_strsave_escape_ks((char *)s);
} else {
p = s;
}
if (p == NULL) {
retval = FAIL;
} else {
retval = ins_typebuf(p, esc ? REMAP_NONE : REMAP_YES, 0, true, silent);
retval = ins_typebuf((char *)p, esc ? REMAP_NONE : REMAP_YES, 0, true, silent);
}
if (esc) {
xfree(p);
}
}
if (colon && retval == OK) {
retval = ins_typebuf((char_u *)":", REMAP_NONE, 0, true, silent);
retval = ins_typebuf(":", REMAP_NONE, 0, true, silent);
}
return retval;
}
@ -1461,7 +1461,7 @@ bool cmdline_paste_reg(int regname, bool literally_arg, bool remcr)
}
for (size_t i = 0; i < reg->y_size; i++) {
cmdline_paste_str(reg->y_array[i], literally);
cmdline_paste_str((char_u *)reg->y_array[i], literally);
// Insert ^M between lines, unless `remcr` is true.
if (i < reg->y_size - 1 && !remcr) {
@ -1540,7 +1540,7 @@ int op_delete(oparg_T *oap)
if (*ptr != NUL) {
ptr += oap->inclusive;
}
ptr = skipwhite(ptr);
ptr = (char_u *)skipwhite((char *)ptr);
if (*ptr == NUL && inindent(0)) {
oap->motion_type = kMTLineWise;
}
@ -1983,7 +1983,7 @@ static int op_replace(oparg_T *oap, int c)
// strlen(newp) at this point
int newp_len = bd.textcol + bd.startspaces;
while (--num_chars >= 0) {
newp_len += utf_char2bytes(c, newp + newp_len);
newp_len += utf_char2bytes(c, (char *)newp + newp_len);
}
if (!bd.is_short) {
// insert post-spaces
@ -2737,7 +2737,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
break;
case kMTLineWise:
reg->y_array[y_idx] = vim_strsave(ml_get(lnum));
reg->y_array[y_idx] = (char *)vim_strsave(ml_get(lnum));
break;
case kMTCharWise: {
@ -2807,11 +2807,11 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
if (curr != reg) { // append the new block to the old block
new_ptr = xmalloc(sizeof(char_u *) * (curr->y_size + reg->y_size));
for (j = 0; j < curr->y_size; ++j) {
new_ptr[j] = curr->y_array[j];
for (j = 0; j < curr->y_size; j++) {
new_ptr[j] = (char_u *)curr->y_array[j];
}
xfree(curr->y_array);
curr->y_array = new_ptr;
curr->y_array = (char **)new_ptr;
if (yank_type == kMTLineWise) {
// kMTLineWise overrides kMTCharWise and kMTBlockWise
@ -2828,7 +2828,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
STRCAT(pnew, reg->y_array[0]);
xfree(curr->y_array[j]);
xfree(reg->y_array[0]);
curr->y_array[j++] = pnew;
curr->y_array[j++] = (char *)pnew;
y_idx = 1;
} else {
y_idx = 0;
@ -2891,7 +2891,7 @@ static void yank_copy_line(yankreg_T *reg, struct block_def *bd, size_t y_idx,
int size = bd->startspaces + bd->endspaces + bd->textlen;
assert(size >= 0);
char_u *pnew = xmallocz((size_t)size);
reg->y_array[y_idx] = pnew;
reg->y_array[y_idx] = (char *)pnew;
memset(pnew, ' ', (size_t)bd->startspaces);
pnew += bd->startspaces;
memmove(pnew, bd->textstart, (size_t)bd->textlen);
@ -3165,7 +3165,7 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
y_type = reg->y_type;
y_width = reg->y_width;
y_size = reg->y_size;
y_array = reg->y_array;
y_array = (char_u **)reg->y_array;
}
if (curbuf->terminal) {
@ -3879,7 +3879,7 @@ void ex_display(exarg_T *eap)
bool do_show = false;
for (size_t j = 0; !do_show && j < yb->y_size; j++) {
do_show = !message_filtered(yb->y_array[j]);
do_show = !message_filtered((char_u *)yb->y_array[j]);
}
if (do_show || yb->y_size == 0) {
@ -3897,7 +3897,8 @@ void ex_display(exarg_T *eap)
msg_puts_attr("^J", attr);
n -= 2;
}
for (p = yb->y_array[j]; *p != NUL && (n -= ptr2cells(p)) >= 0; p++) { // -V1019
for (p = (char_u *)yb->y_array[j];
*p != NUL && (n -= ptr2cells(p)) >= 0; p++) { // -V1019
clen = utfc_ptr2len((char *)p);
msg_outtrans_len(p, clen);
p += clen - 1;
@ -4114,7 +4115,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
}
if (insert_space && t > 0) {
curr = skipwhite(curr);
curr = (char_u *)skipwhite((char *)curr);
if (*curr != NUL
&& *curr != ')'
&& sumsize != 0
@ -4209,7 +4210,7 @@ int do_join(size_t count, int insert_space, int save_undo, int use_formatoptions
curr += comments[t - 1];
}
if (insert_space && t > 1) {
curr = skipwhite(curr);
curr = (char_u *)skipwhite((char *)curr);
}
currsize = (int)STRLEN(curr);
}
@ -4725,7 +4726,7 @@ static int fmt_check_par(linenr_T lnum, int *leader_len, char_u **leader_flags,
}
}
return *skipwhite(ptr + *leader_len) == NUL
return *skipwhite((char *)ptr + *leader_len) == NUL
|| (*leader_len > 0 && *flags == COM_END)
|| startPS(lnum, NUL, FALSE);
}
@ -5746,7 +5747,7 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char_u *str
// Grow the register array to hold the pointers to the new lines.
char_u **pp = xrealloc(y_ptr->y_array,
(y_ptr->y_size + newlines) * sizeof(char_u *));
y_ptr->y_array = pp;
y_ptr->y_array = (char **)pp;
size_t lnum = y_ptr->y_size; // The current line number.
@ -6348,7 +6349,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
// If 'cpoptions' does not contain 'r', insert the search
// pattern to really repeat the same command.
if (vim_strchr(p_cpo, CPO_REDO) == NULL) {
AppendToRedobuffLit(cap->searchbuf, -1);
AppendToRedobuffLit((char *)cap->searchbuf, -1);
}
AppendToRedobuff(NL_STR);
} else if (cap->cmdchar == ':' || cap->cmdchar == K_COMMAND) {
@ -6358,7 +6359,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
if (repeat_cmdline == NULL) {
ResetRedobuff();
} else {
AppendToRedobuffLit(repeat_cmdline, -1);
AppendToRedobuffLit((char *)repeat_cmdline, -1);
AppendToRedobuff(NL_STR);
XFREE_CLEAR(repeat_cmdline);
}
@ -7131,7 +7132,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
if (TV_LIST_ITEM_TV(li)->v_type != VAR_STRING) {
goto err;
}
reg->y_array[tv_idx++] = (char_u *)xstrdupnul((const char *)TV_LIST_ITEM_TV(li)->vval.v_string);
reg->y_array[tv_idx++] = xstrdupnul((const char *)TV_LIST_ITEM_TV(li)->vval.v_string);
});
if (reg->y_size > 0 && STRLEN(reg->y_array[reg->y_size - 1]) == 0) {

View File

@ -82,11 +82,11 @@ enum GRegFlags {
/// Definition of one register
typedef struct yankreg {
char_u **y_array; ///< Pointer to an array of line pointers.
size_t y_size; ///< Number of lines in y_array.
MotionType y_type; ///< Register type
colnr_T y_width; ///< Register width (only valid for y_type == kBlockWise).
Timestamp timestamp; ///< Time when register was last modified.
char **y_array; ///< Pointer to an array of line pointers.
size_t y_size; ///< Number of lines in y_array.
MotionType y_type; ///< Register type
colnr_T y_width; ///< Register width (only valid for y_type == kBlockWise).
Timestamp timestamp; ///< Time when register was last modified.
dict_T *additional_data; ///< Additional data from ShaDa file.
} yankreg_T;

View File

@ -1714,7 +1714,7 @@ skip:
arg++;
}
}
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
if (*arg != '=') {
break;
}
@ -1741,7 +1741,7 @@ skip:
return FAIL;
}
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
}
theend:
@ -3015,7 +3015,9 @@ ambw_end:
} else if (varp == &p_pt) {
// 'pastetoggle': translate key codes like in a mapping
if (*p_pt) {
(void)replace_termcodes(p_pt, STRLEN(p_pt), &p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
(void)replace_termcodes((char *)p_pt,
STRLEN(p_pt),
(char **)&p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
CPO_TO_CPO_FLAGS);
if (p != NULL) {
if (new_value_alloced) {
@ -4960,9 +4962,9 @@ static int findoption(const char *const arg)
/// Hidden Number or Toggle option: -1.
/// hidden String option: -2.
/// unknown option: -3.
int get_option_value(const char *name, long *numval, char_u **stringval, int opt_flags)
int get_option_value(const char *name, long *numval, char **stringval, int opt_flags)
{
if (get_tty_option(name, (char **)stringval)) {
if (get_tty_option(name, stringval)) {
return 0;
}
@ -4978,7 +4980,7 @@ int get_option_value(const char *name, long *numval, char_u **stringval, int opt
return -2;
}
if (stringval != NULL) {
*stringval = vim_strsave(*(char_u **)(varp));
*stringval = xstrdup(*(char **)varp);
}
return 0;
}
@ -5193,7 +5195,7 @@ char *set_option_value(const char *const name, const long number, const char *co
numval = -1;
} else {
char *s = NULL;
(void)get_option_value(name, &numval, (char_u **)&s, OPT_GLOBAL);
(void)get_option_value(name, &numval, &s, OPT_GLOBAL);
}
}
if (flags & P_NUM) {

View File

@ -580,7 +580,7 @@ void expand_env_esc(char_u *restrict srcp, char_u *restrict dst, int dstlen, boo
int prefix_len = (prefix == NULL) ? 0 : (int)STRLEN(prefix);
char_u *src = skipwhite(srcp);
char_u *src = (char_u *)skipwhite((char *)srcp);
dstlen--; // leave one char space for "\,"
while (*src && dstlen > 0) {
// Skip over `=expr`.
@ -1087,7 +1087,7 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
}
if (!one) {
src = skipwhite(src);
src = (char_u *)skipwhite((char *)src);
}
char *dst_p = (char *)dst;
while (*src && dstlen > 0) {

View File

@ -405,7 +405,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
while (*p != ' ' && *p != '\n') {
p++;
}
p = skipwhite(p); // skip to next entry
p = (char_u *)skipwhite((char *)p); // skip to next entry
}
// file names are separated with NL
} else if (shell_style == STYLE_BT || shell_style == STYLE_VIMGLOB) {
@ -418,7 +418,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
if (*p != NUL) {
p++;
}
p = skipwhite(p); // skip leading white space
p = (char_u *)skipwhite((char *)p); // skip leading white space
}
// file names are separated with NUL
} else {
@ -483,7 +483,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
*p = NUL;
} else {
*p++ = NUL;
p = skipwhite(p); // skip to next entry
p = (char_u *)skipwhite((char *)p); // skip to next entry
}
} else { // NUL separates
while (*p && p < buffer + len) { // skip entry
@ -1158,7 +1158,7 @@ static size_t tokenize(const char_u *const str, char **const argv)
}
argc++;
p = (const char *)skipwhite((char_u *)(p + len));
p = (const char *)skipwhite((p + len));
}
return argc;

View File

@ -1394,7 +1394,7 @@ static int expand_backtick(garray_T *gap, char_u *pat, int flags)
cmd = buffer;
while (*cmd != NUL) {
cmd = skipwhite(cmd); // skip over white space
cmd = (char_u *)skipwhite((char *)cmd); // skip over white space
p = cmd;
while (*p != NUL && *p != '\r' && *p != '\n') { // skip over entry
++p;

View File

@ -1610,7 +1610,7 @@ static int qf_parse_file_pfx(int idx, qffields_T *fields, qf_list_T *qfl, char *
}
*fields->namebuf = NUL;
if (tail && *tail) {
STRMOVE(IObuff, skipwhite((char_u *)tail));
STRMOVE(IObuff, skipwhite(tail));
qfl->qf_multiscan = true;
return QF_MULTISCAN;
}
@ -2857,7 +2857,7 @@ static void qf_jump_print_msg(qf_info_T *qi, int qf_index, qfline_T *qf_ptr, buf
qf_types(qf_ptr->qf_type, qf_ptr->qf_nr));
// Add the message, skipping leading whitespace and newlines.
int len = (int)STRLEN(IObuff);
qf_fmt_text((char *)skipwhite((char_u *)qf_ptr->qf_text), (char *)IObuff + len, IOSIZE - len);
qf_fmt_text(skipwhite(qf_ptr->qf_text), (char *)IObuff + len, IOSIZE - len);
// Output the message. Overwrite to avoid scrolling when the 'O'
// flag is present in 'shortmess'; But when not jumping, print the
@ -3159,7 +3159,7 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
// unrecognized line keep the indent, the compiler may mark a word
// with ^^^^. */
qf_fmt_text((fname != NULL || qfp->qf_lnum != 0)
? (char *)skipwhite((char_u *)qfp->qf_text) : qfp->qf_text,
? skipwhite(qfp->qf_text) : qfp->qf_text,
(char *)IObuff, IOSIZE);
msg_prt_line(IObuff, false);
ui_flush(); // show one line at a time
@ -4079,7 +4079,7 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
// Remove newlines and leading whitespace from the text.
// For an unrecognized line keep the indent, the compiler may
// mark a word with ^^^^.
qf_fmt_text(len > 3 ? (char *)skipwhite((char_u *)qfp->qf_text) : qfp->qf_text,
qf_fmt_text(len > 3 ? skipwhite(qfp->qf_text) : qfp->qf_text,
(char *)IObuff + len, IOSIZE - len);
}
@ -5434,7 +5434,7 @@ static int vgr_process_args(exarg_T *eap, vgr_args_T *args)
return FAIL;
}
p = (char *)skipwhite((char_u *)p);
p = skipwhite(p);
if (*p == NUL) {
emsg(_("E683: File name missing or invalid pattern"));
return FAIL;
@ -6887,7 +6887,7 @@ static int cbuffer_process_args(exarg_T *eap, buf_T **bufp, linenr_T *line1, lin
if (*eap->arg == NUL) {
buf = curbuf;
} else if (*skipwhite(skipdigits((char_u *)eap->arg)) == NUL) {
} else if (*skipwhite((char *)skipdigits((char_u *)eap->arg)) == NUL) {
buf = buflist_findnr(atoi(eap->arg));
}

View File

@ -1786,13 +1786,13 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
funcexe.evaluate = true;
if (expr->v_type == VAR_FUNC) {
s = (char_u *)expr->vval.v_string;
call_func(s, -1, &rettv, 1, argv, &funcexe);
call_func((char *)s, -1, &rettv, 1, argv, &funcexe);
} else if (expr->v_type == VAR_PARTIAL) {
partial_T *partial = expr->vval.v_partial;
s = (char_u *)partial_name(partial);
funcexe.partial = partial;
call_func(s, -1, &rettv, 1, argv, &funcexe);
call_func((char *)s, -1, &rettv, 1, argv, &funcexe);
}
if (tv_list_len(&matchList.sl_list) > 0) {
// fill_submatch_list() was called.
@ -1929,7 +1929,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
int totlen = utfc_ptr2len((char *)src - 1);
if (copy) {
utf_char2bytes(cc, dst);
utf_char2bytes(cc, (char *)dst);
}
dst += utf_char2len(cc) - 1;
int clen = utf_ptr2len((char *)src - 1);
@ -2027,7 +2027,7 @@ static int vim_regsub_both(char_u *source, typval_T *expr, char_u *dest,
s += l;
len -= l;
if (copy) {
utf_char2bytes(cc, dst);
utf_char2bytes(cc, (char *)dst);
}
dst += utf_char2len(cc) - 1;
}

View File

@ -522,7 +522,7 @@ static void regmbc(int c)
if (regcode == JUST_CALC_SIZE) {
regsize += utf_char2len(c);
} else {
regcode += utf_char2bytes(c, regcode);
regcode += utf_char2bytes(c, (char *)regcode);
}
}

View File

@ -552,7 +552,7 @@ static char_u *nfa_get_match_text(nfa_state_T *start)
p = start->out->out; /* skip first char, it goes into regstart */
s = ret;
while (p->c > 0) {
s += utf_char2bytes(p->c, s);
s += utf_char2bytes(p->c, (char *)s);
p = p->out;
}
*s = NUL;

View File

@ -35,8 +35,8 @@ void runtime_init(void)
/// ":runtime [what] {name}"
void ex_runtime(exarg_T *eap)
{
char_u *arg = (char_u *)eap->arg;
char_u *p = skiptowhite(arg);
char *arg = eap->arg;
char *p = (char *)skiptowhite((char_u *)arg);
ptrdiff_t len = p - arg;
int flags = eap->forceit ? DIP_ALL : 0;
@ -54,13 +54,13 @@ void ex_runtime(exarg_T *eap)
arg = skipwhite(arg + len);
}
source_runtime((char *)arg, flags);
source_runtime(arg, flags);
}
static void source_callback(char_u *fname, void *cookie)
static void source_callback(char *fname, void *cookie)
{
(void)do_source((char *)fname, false, DOSO_NONE);
(void)do_source(fname, false, DOSO_NONE);
}
/// Find the file "name" in all directories in "path" and invoke
@ -108,7 +108,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
}
if (name == NULL) {
(*callback)(buf, cookie);
(*callback)((char *)buf, cookie);
did_one = true;
} else if (buflen + STRLEN(name) + 2 < MAXPATHL) {
add_pathsep((char *)buf);
@ -134,7 +134,7 @@ int do_in_path(char_u *path, char *name, int flags, DoInRuntimepathCB callback,
// Expand wildcards, invoke the callback for each match.
if (gen_expand_wildcards(1, &buf, &num_files, &files, ew_flags) == OK) {
for (i = 0; i < num_files; i++) {
(*callback)(files[i], cookie);
(*callback)((char *)files[i], cookie);
did_one = true;
if (!(flags & DIP_ALL)) {
break;
@ -244,7 +244,7 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void
}
if (name == NULL) {
(*callback)((char_u *)item.path, cookie);
(*callback)(item.path, cookie);
} else if (buflen + STRLEN(name) + 2 < MAXPATHL) {
STRCPY(buf, item.path);
add_pathsep((char *)buf);
@ -271,7 +271,7 @@ int do_in_cached_path(char_u *name, int flags, DoInRuntimepathCB callback, void
char_u *(pat[]) = { buf };
if (gen_expand_wildcards(1, pat, &num_files, &files, ew_flags) == OK) {
for (i = 0; i < num_files; i++) {
(*callback)(files[i], cookie);
(*callback)((char *)files[i], cookie);
did_one = true;
if (!(flags & DIP_ALL)) {
break;
@ -614,17 +614,17 @@ void runtime_search_path_validate(void)
/// Just like do_in_path_and_pp(), using 'runtimepath' for "path".
int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback, void *cookie)
int do_in_runtimepath(char *name, int flags, DoInRuntimepathCB callback, void *cookie)
{
int success = FAIL;
if (!(flags & DIP_NORTP)) {
success |= do_in_cached_path((name && !*name) ? NULL : name, flags, callback, cookie);
success |= do_in_cached_path((name && !*name) ? NULL : (char_u *)name, flags, callback, cookie);
flags = (flags & ~DIP_START) | DIP_NORTP;
}
// TODO(bfredl): we could integrate disabled OPT dirs into the cached path
// which would effectivize ":packadd myoptpack" as well
if ((flags & (DIP_START|DIP_OPT)) && (success == FAIL || (flags & DIP_ALL))) {
success |= do_in_path_and_pp(p_rtp, name, flags, callback, cookie);
success |= do_in_path_and_pp(p_rtp, (char_u *)name, flags, callback, cookie);
}
return success;
}
@ -636,7 +636,7 @@ int do_in_runtimepath(char_u *name, int flags, DoInRuntimepathCB callback, void
/// return FAIL when no file could be sourced, OK otherwise.
int source_runtime(char *name, int flags)
{
return do_in_runtimepath((char_u *)name, flags, source_callback, NULL);
return do_in_runtimepath(name, flags, source_callback, NULL);
}
/// Just like source_runtime(), but use "path" instead of 'runtimepath'.
@ -874,14 +874,14 @@ static void add_pack_plugin(bool opt, char_u *fname, void *cookie)
}
}
static void add_start_pack_plugin(char_u *fname, void *cookie)
static void add_start_pack_plugin(char *fname, void *cookie)
{
add_pack_plugin(false, fname, cookie);
add_pack_plugin(false, (char_u *)fname, cookie);
}
static void add_opt_pack_plugin(char_u *fname, void *cookie)
static void add_opt_pack_plugin(char *fname, void *cookie)
{
add_pack_plugin(true, fname, cookie);
add_pack_plugin(true, (char_u *)fname, cookie);
}
@ -902,7 +902,7 @@ static bool pack_has_entries(char_u *buf)
return num_files > 0;
}
static void add_pack_start_dir(char_u *fname, void *cookie)
static void add_pack_start_dir(char *fname, void *cookie)
{
static char_u buf[MAXPATHL];
char *(start_pat[]) = { "/start/*", "/pack/*/start/*" }; // NOLINT

View File

@ -5,7 +5,7 @@
#include "nvim/ex_docmd.h"
typedef void (*DoInRuntimepathCB)(char_u *, void *);
typedef void (*DoInRuntimepathCB)(char *, void *);
typedef struct {
char *path;

View File

@ -1946,7 +1946,7 @@ static size_t fill_foldcolumn(char_u *p, win_T *wp, foldinfo_T foldinfo, linenr_
symbol = '>';
}
len = utf_char2bytes(symbol, &p[char_counter]);
len = utf_char2bytes(symbol, (char *)&p[char_counter]);
char_counter += len;
if (first_level + i >= level) {
i++;
@ -1960,7 +1960,7 @@ static size_t fill_foldcolumn(char_u *p, win_T *wp, foldinfo_T foldinfo, linenr_
char_counter -= len;
memset(&p[char_counter], ' ', len);
}
len = utf_char2bytes(wp->w_p_fcs_chars.foldclosed, &p[char_counter]);
len = utf_char2bytes(wp->w_p_fcs_chars.foldclosed, (char *)&p[char_counter]);
char_counter += len;
}
@ -2727,9 +2727,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
}
if (wp->w_p_rl) { // reverse line numbers
// like rl_mirror(), but keep the space at the end
char_u *p2 = skipwhite(extra);
char_u *p2 = (char_u *)skipwhite((char *)extra);
p2 = skiptowhite(p2) - 1;
for (char_u *p1 = skipwhite(extra); p1 < p2; p1++, p2--) {
for (char_u *p1 = (char_u *)skipwhite((char *)extra); p1 < p2; p1++, p2--) {
const int t = *p1;
*p1 = *p2;
*p2 = t;
@ -3525,7 +3525,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
if (wp->w_p_lcs_chars.tab3 && i == tab_len - 1) {
lcs = wp->w_p_lcs_chars.tab3;
}
p += utf_char2bytes(lcs, p);
p += utf_char2bytes(lcs, (char *)p);
n_extra += utf_char2len(lcs) - (saved_nextra > 0 ? 1 : 0);
}
p_extra = p_extra_free;
@ -4275,7 +4275,7 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool noc
} // for every character in the line
// After an empty line check first word for capital.
if (*skipwhite(line) == NUL) {
if (*skipwhite((char *)line) == NUL) {
capcol_lnum = lnum + 1;
cap_col = 0;
}
@ -4509,7 +4509,6 @@ static void get_sign_display_info(bool nrcol, win_T *wp, linenr_T lnum, sign_att
}
/*
* Mirror text "str" for right-left displaying.
* Only works for single-byte characters (e.g., numbers).
@ -5328,7 +5327,7 @@ static void win_redr_custom(win_T *wp, bool draw_ruler)
* might change the option value and free the memory. */
stl = vim_strsave(stl);
width =
build_stl_str_hl(ewp, buf, sizeof(buf), stl, use_sandbox,
build_stl_str_hl(ewp, (char *)buf, sizeof(buf), (char *)stl, use_sandbox,
fillchar, maxwidth, &hltab, &tabtab);
xfree(stl);
ewp->w_p_crb = p_crb_save;
@ -5341,7 +5340,7 @@ static void win_redr_custom(win_T *wp, bool draw_ruler)
// fill up with "fillchar"
while (width < maxwidth && len < (int)sizeof(buf) - 1) {
len += utf_char2bytes(fillchar, buf + len);
len += utf_char2bytes(fillchar, (char *)buf + len);
width++;
}
buf[len] = NUL;
@ -5486,7 +5485,6 @@ static void end_search_hl(void)
}
/// Check if there should be a delay. Used before clearing or redrawing the
/// screen or the command line.
void check_for_delay(bool check_msg_scroll)
@ -6620,7 +6618,7 @@ static void win_redr_ruler(win_T *wp, bool always)
if (this_ru_col + o < width) {
// Need at least 3 chars left for get_rel_pos() + NUL.
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) {
i += utf_char2bytes(fillchar, buffer + i);
i += utf_char2bytes(fillchar, (char *)buffer + i);
o++;
}
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);

View File

@ -1501,7 +1501,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char_u *pat)
start = pos->lnum;
}
ptr = ml_get_buf(buf, pos->lnum, false);
p = skipwhite(ptr);
p = (char_u *)skipwhite((char *)ptr);
pos->col = (colnr_T)(p - ptr);
// when adding lines the matching line may be empty but it is not
@ -1549,13 +1549,13 @@ int searchc(cmdarg_T *cap, int t_cmd)
*lastc = c;
set_csearch_direction(dir);
set_csearch_until(t_cmd);
lastc_bytelen = utf_char2bytes(c, lastc_bytes);
lastc_bytelen = utf_char2bytes(c, (char *)lastc_bytes);
if (cap->ncharC1 != 0) {
lastc_bytelen += utf_char2bytes(cap->ncharC1,
lastc_bytes + lastc_bytelen);
(char *)lastc_bytes + lastc_bytelen);
if (cap->ncharC2 != 0) {
lastc_bytelen += utf_char2bytes(cap->ncharC2,
lastc_bytes + lastc_bytelen);
(char *)lastc_bytes + lastc_bytelen);
}
}
}
@ -1835,9 +1835,9 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
*/
if (!cpo_match) {
// Are we before or at #if, #else etc.?
ptr = skipwhite(linep);
ptr = (char_u *)skipwhite((char *)linep);
if (*ptr == '#' && pos.col <= (colnr_T)(ptr - linep)) {
ptr = skipwhite(ptr + 1);
ptr = (char_u *)skipwhite((char *)ptr + 1);
if (STRNCMP(ptr, "if", 2) == 0
|| STRNCMP(ptr, "endif", 5) == 0
|| STRNCMP(ptr, "el", 2) == 0) {
@ -1893,7 +1893,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
}
if (!findc) {
// no brace in the line, maybe use " #if" then
if (!cpo_match && *skipwhite(linep) == '#') {
if (!cpo_match && *skipwhite((char *)linep) == '#') {
hash_dir = 1;
} else {
return NULL;
@ -1918,7 +1918,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
oap->motion_type = kMTLineWise; // Linewise for this case only
}
if (initc != '#') {
ptr = skipwhite(skipwhite(linep) + 1);
ptr = (char_u *)skipwhite(skipwhite((char *)linep) + 1);
if (STRNCMP(ptr, "if", 2) == 0 || STRNCMP(ptr, "el", 2) == 0) {
hash_dir = 1;
} else if (STRNCMP(ptr, "endif", 5) == 0) {
@ -1939,12 +1939,12 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
pos.lnum += hash_dir;
linep = ml_get(pos.lnum);
line_breakcheck(); // check for CTRL-C typed
ptr = skipwhite(linep);
ptr = (char_u *)skipwhite((char *)linep);
if (*ptr != '#') {
continue;
}
pos.col = (colnr_T)(ptr - linep);
ptr = skipwhite(ptr + 1);
ptr = (char_u *)skipwhite((char *)ptr + 1);
if (hash_dir > 0) {
if (STRNCMP(ptr, "if", 2) == 0) {
count++;
@ -4476,7 +4476,7 @@ int linewhite(linenr_T lnum)
{
char_u *p;
p = skipwhite(ml_get(lnum));
p = (char_u *)skipwhite((char *)ml_get(lnum));
return *p == NUL;
}
@ -5029,7 +5029,7 @@ bool fuzzy_match(char_u *const str, const char_u *const pat_arg, const bool matc
complete = true;
} else {
// Extract one word from the pattern (separated by space)
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (*p == NUL) {
break;
}
@ -5607,7 +5607,7 @@ search_line:
if (define_matched
|| (compl_cont_status & CONT_SOL)) {
// compare the first "len" chars from "ptr"
startp = skipwhite(p);
startp = (char_u *)skipwhite((char *)p);
if (p_ic) {
matched = !mb_strnicmp(startp, ptr, len);
} else {
@ -5626,7 +5626,7 @@ search_line:
// is not considered to be a comment line.
if (skip_comments) {
if ((*line != '#'
|| STRNCMP(skipwhite(line + 1), "define", 6) != 0)
|| STRNCMP(skipwhite((char *)line + 1), "define", 6) != 0)
&& get_leader_len(line, NULL, false, true)) {
matched = false;
}
@ -5637,7 +5637,7 @@ search_line:
* * /" when looking for "normal".
* Note: Doesn't skip "/ *" in comments.
*/
p = skipwhite(line);
p = (char_u *)skipwhite((char *)line);
if (matched
|| (p[0] == '/' && p[1] == '*') || p[0] == '*') {
for (p = line; *p && p < startp; ++p) {
@ -5701,7 +5701,7 @@ search_line:
// we read a line, set "already" to check this "line" later
// if depth >= 0 we'll increase files[depth].lnum far
// below -- Acevedo
already = aux = p = skipwhite(line);
already = aux = p = (char_u *)skipwhite((char *)line);
p = find_word_start(p);
p = find_word_end(p);
if (p > aux) {

View File

@ -1265,7 +1265,7 @@ static void shada_read(ShaDaReadDef *const sd_reader, const int flags)
}
}
if (!op_reg_set(cur_entry.data.reg.name, (yankreg_T) {
.y_array = (char_u **)cur_entry.data.reg.contents,
.y_array = cur_entry.data.reg.contents,
.y_size = cur_entry.data.reg.contents_size,
.y_type = cur_entry.data.reg.type,
.y_width = (colnr_T)cur_entry.data.reg.width,
@ -2398,7 +2398,7 @@ static inline void shada_initialize_registers(WriteMergerState *const wms, int m
.timestamp = reg.timestamp,
.data = {
.reg = {
.contents = (char **)reg.y_array,
.contents = reg.y_array,
.contents_size = reg.y_size,
.type = reg.y_type,
.width = (size_t)(reg.y_type == kMTBlockWise ? reg.y_width : 0),

View File

@ -1172,7 +1172,7 @@ static void sign_define_cmd(char_u *sign_name, char_u *cmdline)
// set values for a defined sign.
for (;;) {
arg = skipwhite(p);
arg = (char_u *)skipwhite((char *)p);
if (*arg == NUL) {
break;
}
@ -1343,7 +1343,7 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si
*signid = -1;
arg = arg1;
} else {
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
}
}
@ -1391,7 +1391,7 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si
arg += 7;
filename = arg;
*buf = buflist_findnr(getdigits_int(&arg, true, 0));
if (*skipwhite(arg) != NUL) {
if (*skipwhite((char *)arg) != NUL) {
emsg(_(e_trailing));
}
break;
@ -1399,7 +1399,7 @@ static int parse_sign_cmd_args(int cmd, char_u *arg, char_u **sign_name, int *si
emsg(_(e_invarg));
return FAIL;
}
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
}
if (filename != NULL && *buf == NULL) {
@ -1431,7 +1431,7 @@ void ex_sign(exarg_T *eap)
semsg(_("E160: Unknown sign command: %s"), arg);
return;
}
arg = skipwhite(p);
arg = (char_u *)skipwhite((char *)p);
if (idx <= SIGNCMD_LIST) {
// Define, undefine or list signs.
@ -1799,7 +1799,7 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg)
// :sign {subcmd} {subcmd_args}
// |
// begin_subcmd_args
begin_subcmd_args = skipwhite(end_subcmd);
begin_subcmd_args = (char_u *)skipwhite((char *)end_subcmd);
// Expand last argument of subcmd.
//
@ -1810,7 +1810,7 @@ void set_context_in_sign_cmd(expand_T *xp, char_u *arg)
// Loop until reaching last argument.
char_u *p = begin_subcmd_args;
do {
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
last = p;
p = skiptowhite(p);
} while (*p != NUL);

View File

@ -1086,7 +1086,7 @@ static bool can_compound(slang_T *slang, const char_u *word, const char_u *flags
// Need to convert the single byte flags to utf8 characters.
char_u *p = uflags;
for (int i = 0; flags[i] != NUL; i++) {
p += utf_char2bytes(flags[i], p);
p += utf_char2bytes(flags[i], (char *)p);
}
*p = NUL;
p = uflags;
@ -1615,7 +1615,7 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
--capcol;
// But after empty line check first word in next line
if (*skipwhite(line) == NUL) {
if (*skipwhite((char *)line) == NUL) {
capcol = 0;
}
}
@ -1636,9 +1636,9 @@ void spell_cat_line(char_u *buf, char_u *line, int maxlen)
char_u *p;
int n;
p = skipwhite(line);
p = (char_u *)skipwhite((char *)line);
while (vim_strchr((char_u *)"*#/\"\t", *p) != NULL) {
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
}
if (*p != NUL) {
@ -1673,13 +1673,13 @@ static void spell_load_lang(char_u *lang)
// Find the first spell file for "lang" in 'runtimepath' and load it.
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
"spell/%s.%s.spl", lang, spell_enc());
r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
r = do_in_runtimepath((char *)fname_enc, 0, spell_load_cb, &sl);
if (r == FAIL && *sl.sl_lang != NUL) {
// Try loading the ASCII version.
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
"spell/%s.ascii.spl", lang);
r = do_in_runtimepath(fname_enc, 0, spell_load_cb, &sl);
r = do_in_runtimepath((char *)fname_enc, 0, spell_load_cb, &sl);
if (r == FAIL && *sl.sl_lang != NUL && round == 1
&& apply_autocmds(EVENT_SPELLFILEMISSING, lang,
@ -1707,7 +1707,7 @@ static void spell_load_lang(char_u *lang)
} else if (sl.sl_slang != NULL) {
// At least one file was loaded, now load ALL the additions.
STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
do_in_runtimepath(fname_enc, DIP_ALL, spell_load_cb, &sl);
do_in_runtimepath((char *)fname_enc, DIP_ALL, spell_load_cb, &sl);
}
}
@ -1846,12 +1846,12 @@ void slang_clear_sug(slang_T *lp)
// Load one spell file and store the info into a slang_T.
// Invoked through do_in_runtimepath().
static void spell_load_cb(char_u *fname, void *cookie)
static void spell_load_cb(char *fname, void *cookie)
{
spelload_T *slp = (spelload_T *)cookie;
slang_T *slang;
slang = spell_load_file(fname, slp->sl_lang, NULL, false);
slang = spell_load_file((char_u *)fname, slp->sl_lang, NULL, false);
if (slang != NULL) {
// When a previously loaded file has NOBREAK also use it for the
// ".add" files.
@ -2779,7 +2779,7 @@ int spell_casefold(const win_T *wp, char_u *str, int len, char_u *buf, int bufle
c = SPELL_TOFOLD(c);
}
outi += utf_char2bytes(c, buf + outi);
outi += utf_char2bytes(c, (char *)buf + outi);
}
buf[outi] = NUL;
@ -3058,7 +3058,7 @@ void spell_suggest(int count)
// For redo we use a change-word command.
ResetRedobuff();
AppendToRedobuff("ciw");
AppendToRedobuffLit(p + c,
AppendToRedobuffLit((char *)p + c,
stp->st_wordlen + sug.su_badlen - stp->st_orglen);
AppendCharToRedobuff(ESC);
@ -3100,7 +3100,7 @@ static bool check_need_cap(linenr_T lnum, colnr_T col)
need_cap = true;
} else {
line = ml_get(lnum - 1);
if (*skipwhite(line) == NUL) {
if (*skipwhite((char *)line) == NUL) {
need_cap = true;
} else {
// Append a space in place of the line break.
@ -3547,7 +3547,7 @@ void onecap_copy(char_u *word, char_u *wcopy, bool upper)
} else {
c = SPELL_TOFOLD(c);
}
int l = utf_char2bytes(c, wcopy);
int l = utf_char2bytes(c, (char *)wcopy);
STRLCPY(wcopy + l, p, MAXWLEN - l);
}
@ -3572,7 +3572,7 @@ static void allcap_copy(char_u *word, char_u *wcopy)
if (d - wcopy >= MAXWLEN - MB_MAXBYTES) {
break;
}
d += utf_char2bytes(c, d);
d += utf_char2bytes(c, (char *)d);
}
*d = NUL;
}
@ -3588,7 +3588,7 @@ static void suggest_try_special(suginfo_T *su)
// Recognize a word that is repeated: "the the".
p = skiptowhite(su->su_fbadword);
len = p - su->su_fbadword;
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (STRLEN(p) == len && STRNCMP(su->su_fbadword, p, len) == 0) {
// Include badflags: if the badword is onecap or allcap
// use that for the goodword too: "The the" -> "The".
@ -3977,7 +3977,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
if (compound_ok) {
p = preword;
while (*skiptowhite(p) != NUL) {
p = skipwhite(skiptowhite(p));
p = (char_u *)skipwhite((char *)skiptowhite(p));
}
if (fword_ends && !can_compound(slang, p,
compflags + sp->ts_compsplit)) {
@ -4199,7 +4199,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
}
p = preword;
while (*skiptowhite(p) != NUL) {
p = skipwhite(skiptowhite(p));
p = (char_u *)skipwhite((char *)skiptowhite(p));
}
if (sp->ts_complen > sp->ts_compsplit
&& !can_compound(slang, p,
@ -4647,7 +4647,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
depth++;
fl = utf_char2len(c2);
memmove(p, p + n, fl);
utf_char2bytes(c, p + fl);
utf_char2bytes(c, (char *)p + fl);
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
} else {
// If this swap doesn't work then SWAP3 won't either.
@ -4662,7 +4662,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
n = utfc_ptr2len((char *)p);
c = utf_ptr2char((char *)p + n);
memmove(p + utfc_ptr2len((char *)p + n), p, n);
utf_char2bytes(c, p);
utf_char2bytes(c, (char *)p);
FALLTHROUGH;
@ -4703,8 +4703,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
depth++;
tl = utf_char2len(c3);
memmove(p, p + n + fl, tl);
utf_char2bytes(c2, p + tl);
utf_char2bytes(c, p + fl + tl);
utf_char2bytes(c2, (char *)p + tl);
utf_char2bytes(c, (char *)p + fl + tl);
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl + tl;
} else {
PROF_STORE(sp->ts_state)
@ -4721,8 +4721,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
c = utf_ptr2char((char *)p + n + fl);
tl = utfc_ptr2len((char *)p + n + fl);
memmove(p + fl + tl, p, n);
utf_char2bytes(c, p);
utf_char2bytes(c2, p + tl);
utf_char2bytes(c, (char *)p);
utf_char2bytes(c2, (char *)p + tl);
p = p + tl;
if (!soundfold && !spell_iswordp(p, curwin)) {
@ -4752,7 +4752,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
fl = utf_ptr2len((char *)p + n);
fl += utf_ptr2len((char *)p + n + fl);
memmove(p, p + n, fl);
utf_char2bytes(c, p + fl);
utf_char2bytes(c, (char *)p + fl);
stack[depth].ts_fidxtry = sp->ts_fidx + n + fl;
} else {
PROF_STORE(sp->ts_state)
@ -4768,7 +4768,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
c = utf_ptr2char((char *)p + n);
tl = utfc_ptr2len((char *)p + n);
memmove(p + tl, p, n);
utf_char2bytes(c, p);
utf_char2bytes(c, (char *)p);
// Rotate three bytes right: "123" -> "312". We change "fword"
// here, it's changed back afterwards at STATE_UNROT3R.
@ -4789,7 +4789,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
c = utf_ptr2char((char *)p + n);
tl = utf_ptr2len((char *)p + n);
memmove(p + tl, p, n);
utf_char2bytes(c, p);
utf_char2bytes(c, (char *)p);
stack[depth].ts_fidxtry = sp->ts_fidx + n + tl;
} else {
PROF_STORE(sp->ts_state)
@ -4805,7 +4805,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char_u *fword, bool so
n = utfc_ptr2len((char *)p + tl);
n += utfc_ptr2len((char *)p + tl + n);
memmove(p, p + tl, n);
utf_char2bytes(c, p + n);
utf_char2bytes(c, (char *)p + n);
FALLTHROUGH;
@ -5656,7 +5656,7 @@ static bool similar_chars(slang_T *slang, int c1, int c2)
hashitem_T *hi;
if (c1 >= 256) {
buf[utf_char2bytes(c1, buf)] = 0;
buf[utf_char2bytes(c1, (char *)buf)] = 0;
hi = hash_find(&slang->sl_map_hash, buf);
if (HASHITEM_EMPTY(hi)) {
m1 = 0;
@ -5671,7 +5671,7 @@ static bool similar_chars(slang_T *slang, int c1, int c2)
}
if (c2 >= 256) {
buf[utf_char2bytes(c2, buf)] = 0;
buf[utf_char2bytes(c2, (char *)buf)] = 0;
hi = hash_find(&slang->sl_map_hash, buf);
if (HASHITEM_EMPTY(hi)) {
m2 = 0;
@ -6034,7 +6034,7 @@ static void spell_soundfold_sofo(slang_T *slang, char_u *inword, char_u *res)
}
if (c != NUL && c != prevc) {
ri += utf_char2bytes(c, res + ri);
ri += utf_char2bytes(c, (char *)res + ri);
if (ri + MB_MAXBYTES > MAXWLEN) {
break;
}
@ -6339,7 +6339,7 @@ static void spell_soundfold_wsal(slang_T *slang, char_u *inword, char_u *res)
// Convert wide characters in "wres" to a multi-byte string in "res".
l = 0;
for (n = 0; n < reslen; n++) {
l += utf_char2bytes(wres[n], res + l);
l += utf_char2bytes(wres[n], (char *)res + l);
if (l + MB_MAXBYTES > MAXWLEN) {
break;
}
@ -6877,7 +6877,7 @@ void ex_spelldump(exarg_T *eap)
if (no_spell_checking(curwin)) {
return;
}
get_option_value("spl", &dummy, &spl, OPT_LOCAL);
get_option_value("spl", &dummy, (char **)&spl, OPT_LOCAL);
// Create a new empty buffer in a new window.
do_cmdline_cmd("new");

View File

@ -1507,7 +1507,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
if (c == '?' || c == '+' || c == '~') {
*pp++ = '\\'; // "a?" becomes "a\?", "a+" becomes "a\+"
}
pp += utf_char2bytes(c, pp);
pp += utf_char2bytes(c, (char *)pp);
}
}
@ -3141,7 +3141,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
spin->si_msg_count = 999999;
// Read and ignore the first line: word count.
if (vim_fgets(line, MAXLINELEN, fd) || !ascii_isdigit(*skipwhite(line))) {
if (vim_fgets(line, MAXLINELEN, fd) || !ascii_isdigit(*skipwhite((char *)line))) {
semsg(_("E760: No word count in %s"), fname);
}
@ -4410,7 +4410,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
// Form the <folchars> string first, we need to know its length.
size_t l = 0;
for (size_t i = 128; i < 256; i++) {
l += (size_t)utf_char2bytes(spelltab.st_fold[i], folchars + l);
l += (size_t)utf_char2bytes(spelltab.st_fold[i], (char *)folchars + l);
}
put_bytes(fd, 1 + 128 + 2 + l, 4); // <sectionlen>
@ -4879,7 +4879,7 @@ void ex_mkspell(exarg_T *eap)
if (STRNCMP(arg, "-ascii", 6) == 0) {
ascii = true;
arg = skipwhite(arg + 6);
arg = (char_u *)skipwhite((char *)arg + 6);
}
// Expand all the remaining arguments (e.g., $VIMRUNTIME).
@ -5867,9 +5867,9 @@ static void set_map_str(slang_T *lp, char_u *map)
hashitem_T *hi;
b = xmalloc(cl + headcl + 2);
utf_char2bytes(c, b);
utf_char2bytes(c, (char *)b);
b[cl] = NUL;
utf_char2bytes(headc, b + cl + 1);
utf_char2bytes(headc, (char *)b + cl + 1);
b[cl + 1 + headcl] = NUL;
hash = hash_hash(b);
hi = hash_lookup(&lp->sl_map_hash, (const char *)b, STRLEN(b), hash);

View File

@ -379,7 +379,7 @@ char *strcase_save(const char *const orig, bool upper)
res = s;
}
utf_char2bytes(uc, (char_u *)p);
utf_char2bytes(uc, p);
p += newl;
}
@ -482,7 +482,7 @@ char_u *vim_strchr(const char_u *const string, const int c)
return (char_u *)strchr((const char *)string, c);
} else {
char u8char[MB_MAXBYTES + 1];
const int len = utf_char2bytes(c, (char_u *)u8char);
const int len = utf_char2bytes(c, u8char);
u8char[len] = NUL;
return (char_u *)strstr((const char *)string, u8char);
}

View File

@ -3118,7 +3118,7 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
return;
}
arg = skipwhite(arg_end);
arg = (char_u *)skipwhite((char *)arg_end);
if (*arg != NUL) {
semsg(_(e_illegal_arg), arg);
}
@ -3172,7 +3172,7 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
return;
}
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
if (*arg == NUL) {
msg_puts("\n");
if (curwin->w_s->b_syn_isk != empty_option) {
@ -3396,7 +3396,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
syn_clear_one(id, syncing);
}
}
arg = skipwhite(arg_end);
arg = (char_u *)skipwhite((char *)arg_end);
}
}
redraw_curbuf_later(SOME_VALID);
@ -3566,7 +3566,7 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
syn_list_one(id, syncing, true);
}
}
arg = skipwhite(arg_end);
arg = (char_u *)skipwhite((char *)arg_end);
}
}
eap->nextcmd = (char *)check_nextcmd(arg);
@ -4061,7 +4061,7 @@ static char_u *get_group_name(char_u *arg, char_u **name_end)
char_u *rest;
*name_end = skiptowhite(arg);
rest = skipwhite(*name_end);
rest = (char_u *)skipwhite((char *)(*name_end));
/*
* Check if there are enough arguments. The first argument may be a
@ -4184,10 +4184,10 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
emsg(_("E844: invalid cchar value"));
return NULL;
}
arg = skipwhite(arg + 7);
arg = (char_u *)skipwhite((char *)arg + 7);
} else {
opt->flags |= flagtab[fidx].flags;
arg = skipwhite(arg + len);
arg = (char_u *)skipwhite((char *)arg + len);
if (flagtab[fidx].flags == HL_SYNC_HERE
|| flagtab[fidx].flags == HL_SYNC_THERE) {
@ -4221,7 +4221,7 @@ static char_u *get_syn_options(char_u *arg, syn_opt_arg_T *opt, int *conceal_cha
}
xfree(gname);
arg = skipwhite(arg);
arg = (char_u *)skipwhite((char *)arg);
} else if (flagtab[fidx].flags == HL_FOLD
&& foldmethodIsSyntax(curwin)) {
// Need to update folds later.
@ -4371,7 +4371,7 @@ static void syn_cmd_keyword(exarg_T *eap, int syncing)
// 1: collect the options and copy the keywords to keyword_copy.
cnt = 0;
p = keyword_copy;
for (; rest != NULL && !ends_excmd(*rest); rest = skipwhite(rest)) {
for (; rest != NULL && !ends_excmd(*rest); rest = (char_u *)skipwhite((char *)rest)) {
rest = get_syn_options(rest, &syn_opt_arg, &conceal_char, eap->skip);
if (rest == NULL || ends_excmd(*rest)) {
break;
@ -4621,13 +4621,13 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
} else {
break;
}
rest = skipwhite(key_end);
rest = (char_u *)skipwhite((char *)key_end);
if (*rest != '=') {
rest = NULL;
semsg(_("E398: Missing '=': %s"), arg);
break;
}
rest = skipwhite(rest + 1);
rest = (char_u *)skipwhite((char *)rest + 1);
if (*rest == NUL) {
not_enough = true;
break;
@ -4644,7 +4644,7 @@ static void syn_cmd_region(exarg_T *eap, int syncing)
break;
}
}
rest = skipwhite(p);
rest = (char_u *)skipwhite((char *)p);
} else {
/*
* Allocate room for a syn_pattern, and link it in the list of
@ -5159,7 +5159,7 @@ static char_u *get_syn_pattern(char_u *arg, synpat_T *ci)
semsg(_("E402: Garbage after pattern: %s"), arg);
return NULL;
}
return skipwhite(end);
return (char_u *)skipwhite((char *)end);
}
/*
@ -5183,7 +5183,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
while (!ends_excmd(*arg_start)) {
arg_end = skiptowhite(arg_start);
next_arg = skipwhite(arg_end);
next_arg = (char_u *)skipwhite((char *)arg_end);
xfree(key);
key = vim_strnsave_up(arg_start, arg_end - arg_start);
if (STRCMP(key, "CCOMMENT") == 0) {
@ -5195,7 +5195,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
if (!eap->skip) {
curwin->w_s->b_syn_sync_id = syn_check_group((char *)next_arg, (int)(arg_end - next_arg));
}
next_arg = skipwhite(arg_end);
next_arg = (char_u *)skipwhite((char *)arg_end);
} else if (!eap->skip) {
curwin->w_s->b_syn_sync_id = syn_name2id("Comment");
}
@ -5265,7 +5265,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
break;
}
}
next_arg = skipwhite(arg_end + 1);
next_arg = (char_u *)skipwhite((char *)arg_end + 1);
} else {
eap->arg = (char *)next_arg;
if (STRCMP(key, "MATCH") == 0) {
@ -5318,12 +5318,12 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
// grow when a regexp is used. In that case round 1 is done once again.
for (int round = 1; round <= 2; round++) {
// skip "contains"
p = skipwhite(*arg + keylen);
p = (char_u *)skipwhite((char *)(*arg) + keylen);
if (*p != '=') {
semsg(_("E405: Missing equal sign: %s"), *arg);
break;
}
p = skipwhite(p + 1);
p = (char_u *)skipwhite((char *)p + 1);
if (ends_excmd(*p)) {
semsg(_("E406: Empty argument: %s"), *arg);
break;
@ -5427,11 +5427,11 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
}
++count;
}
p = skipwhite(end);
p = (char_u *)skipwhite((char *)end);
if (*p != ',') {
break;
}
p = skipwhite(p + 1); // skip comma in between arguments
p = (char_u *)skipwhite((char *)p + 1); // skip comma in between arguments
} while (!ends_excmd(*p));
if (failed) {
break;
@ -5631,7 +5631,7 @@ void ex_syntax(exarg_T *eap)
break;
}
if (STRCMP(subcmd_name, (char_u *)subcommands[i].name) == 0) {
eap->arg = (char *)skipwhite(subcmd_end);
eap->arg = skipwhite((char *)subcmd_end);
(subcommands[i].func)(eap, false);
break;
}
@ -5738,7 +5738,7 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
if (*arg != NUL) {
const char *p = (const char *)skiptowhite((const char_u *)arg);
if (*p != NUL) { // Past first word.
xp->xp_pattern = (char *)skipwhite((const char_u *)p);
xp->xp_pattern = skipwhite(p);
if (*skiptowhite((char_u *)xp->xp_pattern) != NUL) {
xp->xp_context = EXPAND_NOTHING;
} else if (STRNICMP(arg, "case", p - arg) == 0) {

View File

@ -2308,9 +2308,9 @@ static garray_T tag_fnames = GA_EMPTY_INIT_VALUE;
* Callback function for finding all "tags" and "tags-??" files in
* 'runtimepath' doc directories.
*/
static void found_tagfile_cb(char_u *fname, void *cookie)
static void found_tagfile_cb(char *fname, void *cookie)
{
char_u *const tag_fname = vim_strsave(fname);
char_u *const tag_fname = vim_strsave((char_u *)fname);
#ifdef BACKSLASH_IN_FILENAME
slash_adjust(tag_fname);
@ -2357,7 +2357,7 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
if (first) {
ga_clear_strings(&tag_fnames);
ga_init(&tag_fnames, (int)sizeof(char_u *), 10);
do_in_runtimepath((char_u *)"doc/tags doc/tags-??", DIP_ALL,
do_in_runtimepath("doc/tags doc/tags-??", DIP_ALL,
found_tagfile_cb, NULL);
}

View File

@ -1377,8 +1377,7 @@ static void fetch_row(Terminal *term, int row, int end_col)
int cell_len = 0;
if (cell.chars[0]) {
for (int i = 0; cell.chars[i]; i++) {
cell_len += utf_char2bytes((int)cell.chars[i],
(uint8_t *)ptr + cell_len);
cell_len += utf_char2bytes((int)cell.chars[i], ptr + cell_len);
}
} else {
*ptr = ' ';

View File

@ -1788,7 +1788,7 @@ static void parse_quoted_string(ParserState *const pstate, ExprASTNode *const no
if (is_hex) {
*v_p++ = (char)nr;
} else {
v_p += utf_char2bytes(nr, (char_u *)v_p);
v_p += utf_char2bytes(nr, v_p);
}
} else {
is_unknown = true;

View File

@ -6560,13 +6560,13 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
} else if (STRNCMP(p, line_transl, STRLEN(line_transl)) == 0) {
p += STRLEN(line_transl);
} else {
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
}
if (*p != NUL) {
if (!isdigit(*p)) {
p++; // skip the separator
}
p = skipwhite(p);
p = (char_u *)skipwhite((char *)p);
if (isdigit(*p)) {
*file_lnum = getdigits_long(&p, false, 0);
}