refactor: replace char_u with char 23 (#21798)

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
dundargoc
2023-01-18 11:52:19 +01:00
committed by GitHub
parent 7f7b83baef
commit 2c1e7242f9
22 changed files with 524 additions and 546 deletions

View File

@@ -2271,7 +2271,7 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
if (sp->userhl == 0) { if (sp->userhl == 0) {
grpname = get_default_stl_hl(wp, use_winbar); grpname = get_default_stl_hl(wp, use_winbar);
} else if (sp->userhl < 0) { } else if (sp->userhl < 0) {
grpname = (char *)syn_id2name(-sp->userhl); grpname = syn_id2name(-sp->userhl);
} else { } else {
snprintf(user_group, sizeof(user_group), "User%d", sp->userhl); snprintf(user_group, sizeof(user_group), "User%d", sp->userhl);
grpname = user_group; grpname = user_group;

View File

@@ -278,7 +278,7 @@ Dictionary nvim_win_get_config(Window window, Error *err)
String s = cstrn_to_string((const char *)config->border_chars[i], sizeof(schar_T)); String s = cstrn_to_string((const char *)config->border_chars[i], sizeof(schar_T));
int hi_id = config->border_hl_ids[i]; int hi_id = config->border_hl_ids[i];
char *hi_name = (char *)syn_id2name(hi_id); char *hi_name = syn_id2name(hi_id);
if (hi_name[0]) { if (hi_name[0]) {
ADD(tuple, STRING_OBJ(s)); ADD(tuple, STRING_OBJ(s));
ADD(tuple, STRING_OBJ(cstr_to_string((const char *)hi_name))); ADD(tuple, STRING_OBJ(cstr_to_string((const char *)hi_name)));

View File

@@ -2349,7 +2349,7 @@ void set_cmd_context(expand_T *xp, char *str, int len, int col, int use_ccline)
} else if (use_ccline && ccline->input_fn) { } else if (use_ccline && ccline->input_fn) {
xp->xp_context = ccline->xp_context; xp->xp_context = ccline->xp_context;
xp->xp_pattern = ccline->cmdbuff; xp->xp_pattern = ccline->cmdbuff;
xp->xp_arg = (char *)ccline->xp_arg; xp->xp_arg = ccline->xp_arg;
} else { } else {
while (nextcomm != NULL) { while (nextcomm != NULL) {
nextcomm = set_one_cmd_context(xp, nextcomm); nextcomm = set_one_cmd_context(xp, nextcomm);

View File

@@ -107,8 +107,7 @@ static colnr_T Insstart_textlen; // length of line when insert started
static colnr_T Insstart_blank_vcol; // vcol for first inserted blank static colnr_T Insstart_blank_vcol; // vcol for first inserted blank
static bool update_Insstart_orig = true; // set Insstart_orig to Insstart static bool update_Insstart_orig = true; // set Insstart_orig to Insstart
static char_u *last_insert = NULL; // the text of the previous insert, static char *last_insert = NULL; // the text of the previous insert, K_SPECIAL is escaped
// K_SPECIAL is escaped
static int last_insert_skip; // nr of chars in front of previous insert static int last_insert_skip; // nr of chars in front of previous insert
static int new_insert_skip; // nr of chars in front of current insert static int new_insert_skip; // nr of chars in front of current insert
static int did_restart_edit; // "restart_edit" when calling edit() static int did_restart_edit; // "restart_edit" when calling edit()
@@ -558,12 +557,12 @@ static int insert_execute(VimState *state, int key)
// completion: Add to "compl_leader". // completion: Add to "compl_leader".
if (ins_compl_accept_char(s->c)) { if (ins_compl_accept_char(s->c)) {
// Trigger InsertCharPre. // Trigger InsertCharPre.
char_u *str = do_insert_char_pre(s->c); char *str = do_insert_char_pre(s->c);
char_u *p; char *p;
if (str != NULL) { if (str != NULL) {
for (p = str; *p != NUL; MB_PTR_ADV(p)) { for (p = str; *p != NUL; MB_PTR_ADV(p)) {
ins_compl_addleader(utf_ptr2char((char *)p)); ins_compl_addleader(utf_ptr2char(p));
} }
xfree(str); xfree(str);
} else { } else {
@@ -1122,7 +1121,7 @@ normalchar:
if (!p_paste) { if (!p_paste) {
// Trigger InsertCharPre. // Trigger InsertCharPre.
char *str = (char *)do_insert_char_pre(s->c); char *str = do_insert_char_pre(s->c);
char *p; char *p;
if (str != NULL) { if (str != NULL) {
@@ -1544,8 +1543,8 @@ void display_dollar(colnr_T col)
curwin->w_cursor.col = col; curwin->w_cursor.col = col;
// If on the last byte of a multi-byte move to the first byte. // If on the last byte of a multi-byte move to the first byte.
char_u *p = (char_u *)get_cursor_line_ptr(); char *p = get_cursor_line_ptr();
curwin->w_cursor.col -= utf_head_off((char *)p, (char *)p + col); curwin->w_cursor.col -= utf_head_off(p, p + col);
curs_columns(curwin, false); // Recompute w_wrow and w_wcol curs_columns(curwin, false); // Recompute w_wrow and w_wcol
if (curwin->w_wcol < curwin->w_grid.cols) { if (curwin->w_wcol < curwin->w_grid.cols) {
edit_putchar('$', false); edit_putchar('$', false);
@@ -1579,7 +1578,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
int last_vcol; int last_vcol;
int insstart_less; // reduction for Insstart.col int insstart_less; // reduction for Insstart.col
int new_cursor_col; int new_cursor_col;
char_u *ptr; char *ptr;
int save_p_list; int save_p_list;
int start_col; int start_col;
colnr_T vc; colnr_T vc;
@@ -1658,9 +1657,9 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
// Advance the cursor until we reach the right screen column. // Advance the cursor until we reach the right screen column.
last_vcol = 0; last_vcol = 0;
ptr = (char_u *)get_cursor_line_ptr(); ptr = get_cursor_line_ptr();
chartabsize_T cts; chartabsize_T cts;
init_chartabsize_arg(&cts, curwin, 0, 0, (char *)ptr, (char *)ptr); init_chartabsize_arg(&cts, curwin, 0, 0, ptr, ptr);
while (cts.cts_vcol <= (int)curwin->w_virtcol) { while (cts.cts_vcol <= (int)curwin->w_virtcol) {
last_vcol = cts.cts_vcol; last_vcol = cts.cts_vcol;
if (cts.cts_vcol > 0) { if (cts.cts_vcol > 0) {
@@ -1683,7 +1682,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
ptr = xmallocz(i); ptr = xmallocz(i);
memset(ptr, ' ', i); memset(ptr, ' ', i);
new_cursor_col += (int)i; new_cursor_col += (int)i;
ins_str((char *)ptr); ins_str(ptr);
xfree(ptr); xfree(ptr);
} }
@@ -2062,8 +2061,8 @@ void insertchar(int c, int flags, int second_indent)
// Need to remove existing (middle) comment leader and insert end // Need to remove existing (middle) comment leader and insert end
// comment leader. First, check what comment leader we can find. // comment leader. First, check what comment leader we can find.
char_u *line = (char_u *)get_cursor_line_ptr(); char *line = get_cursor_line_ptr();
int i = get_leader_len((char *)line, &p, false, true); int i = get_leader_len(line, &p, false, true);
if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) { // Just checking if (i > 0 && vim_strchr(p, COM_MIDDLE) != NULL) { // Just checking
// Skip middle-comment string // Skip middle-comment string
while (*p && p[-1] != ':') { // find end of middle flags while (*p && p[-1] != ':') { // find end of middle flags
@@ -2308,7 +2307,7 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
if (did_restart_edit == 0 || (ptr != NULL if (did_restart_edit == 0 || (ptr != NULL
&& (int)strlen(ptr) > new_insert_skip)) { && (int)strlen(ptr) > new_insert_skip)) {
xfree(last_insert); xfree(last_insert);
last_insert = (char_u *)ptr; last_insert = ptr;
last_insert_skip = new_insert_skip; last_insert_skip = new_insert_skip;
} else { } else {
xfree(ptr); xfree(ptr);
@@ -2414,7 +2413,7 @@ static void stop_insert(pos_T *end_insert_pos, int esc, int nomove)
// Used for the replace command. // Used for the replace command.
void set_last_insert(int c) void set_last_insert(int c)
{ {
char_u *s; char *s;
xfree(last_insert); xfree(last_insert);
last_insert = xmalloc(MB_MAXBYTES * 3 + 5); last_insert = xmalloc(MB_MAXBYTES * 3 + 5);
@@ -2423,7 +2422,7 @@ void set_last_insert(int c)
if (c < ' ' || c == DEL) { if (c < ' ' || c == DEL) {
*s++ = Ctrl_V; *s++ = Ctrl_V;
} }
s = add_char2buf(c, s); s = (char *)add_char2buf(c, (char_u *)s);
*s++ = ESC; *s++ = ESC;
*s++ = NUL; *s++ = NUL;
last_insert_skip = 0; last_insert_skip = 0;
@@ -2738,12 +2737,12 @@ char_u *get_last_insert(void)
if (last_insert == NULL) { if (last_insert == NULL) {
return NULL; return NULL;
} }
return last_insert + last_insert_skip; return (char_u *)last_insert + last_insert_skip;
} }
// Get last inserted string, and remove trailing <Esc>. // Get last inserted string, and remove trailing <Esc>.
// Returns pointer to allocated memory (must be freed) or NULL. // Returns pointer to allocated memory (must be freed) or NULL.
char_u *get_last_insert_save(void) char *get_last_insert_save(void)
{ {
char *s; char *s;
int len; int len;
@@ -2751,13 +2750,13 @@ char_u *get_last_insert_save(void)
if (last_insert == NULL) { if (last_insert == NULL) {
return NULL; return NULL;
} }
s = xstrdup((char *)last_insert + last_insert_skip); s = xstrdup(last_insert + last_insert_skip);
len = (int)strlen(s); len = (int)strlen(s);
if (len > 0 && s[len - 1] == ESC) { // remove trailing ESC if (len > 0 && s[len - 1] == ESC) { // remove trailing ESC
s[len - 1] = NUL; s[len - 1] = NUL;
} }
return (char_u *)s; return s;
} }
/// Check the word in front of the cursor for an abbreviation. /// Check the word in front of the cursor for an abbreviation.
@@ -4502,7 +4501,7 @@ static bool ins_tab(void)
if (!curbuf->b_p_et && (tabstop_count(curbuf->b_p_vsts_array) > 0 if (!curbuf->b_p_et && (tabstop_count(curbuf->b_p_vsts_array) > 0
|| get_sts_value() > 0 || get_sts_value() > 0
|| (p_sta && ind))) { || (p_sta && ind))) {
char_u *ptr; char *ptr;
char *saved_line = NULL; // init for GCC char *saved_line = NULL; // init for GCC
pos_T pos; pos_T pos;
pos_T fpos; pos_T fpos;
@@ -4517,9 +4516,9 @@ static bool ins_tab(void)
pos = curwin->w_cursor; pos = curwin->w_cursor;
cursor = &pos; cursor = &pos;
saved_line = xstrdup(get_cursor_line_ptr()); saved_line = xstrdup(get_cursor_line_ptr());
ptr = (char_u *)saved_line + pos.col; ptr = saved_line + pos.col;
} else { } else {
ptr = (char_u *)get_cursor_pos_ptr(); ptr = get_cursor_pos_ptr();
cursor = &curwin->w_cursor; cursor = &curwin->w_cursor;
} }
@@ -4547,9 +4546,9 @@ static bool ins_tab(void)
getvcol(curwin, &fpos, &vcol, NULL, NULL); getvcol(curwin, &fpos, &vcol, NULL, NULL);
getvcol(curwin, cursor, &want_vcol, NULL, NULL); getvcol(curwin, cursor, &want_vcol, NULL, NULL);
char_u *tab = (char_u *)"\t"; char *tab = "\t";
chartabsize_T cts; chartabsize_T cts;
init_chartabsize_arg(&cts, curwin, 0, vcol, (char *)tab, (char *)tab); init_chartabsize_arg(&cts, curwin, 0, vcol, tab, tab);
// Use as many TABs as possible. Beware of 'breakindent', 'showbreak' // Use as many TABs as possible. Beware of 'breakindent', 'showbreak'
// and 'linebreak' adding extra virtual columns. // and 'linebreak' adding extra virtual columns.
@@ -4578,13 +4577,13 @@ static bool ins_tab(void)
if (change_col >= 0) { if (change_col >= 0) {
int repl_off = 0; int repl_off = 0;
// Skip over the spaces we need. // Skip over the spaces we need.
init_chartabsize_arg(&cts, curwin, 0, vcol, (char *)ptr, (char *)ptr); init_chartabsize_arg(&cts, curwin, 0, vcol, ptr, ptr);
while (cts.cts_vcol < want_vcol && *cts.cts_ptr == ' ') { while (cts.cts_vcol < want_vcol && *cts.cts_ptr == ' ') {
cts.cts_vcol += lbr_chartabsize(&cts); cts.cts_vcol += lbr_chartabsize(&cts);
cts.cts_ptr++; cts.cts_ptr++;
repl_off++; repl_off++;
} }
ptr = (char_u *)cts.cts_ptr; ptr = cts.cts_ptr;
vcol = cts.cts_vcol; vcol = cts.cts_vcol;
clear_chartabsize_arg(&cts); clear_chartabsize_arg(&cts);
@@ -4761,8 +4760,8 @@ static int ins_digraph(void)
int ins_copychar(linenr_T lnum) int ins_copychar(linenr_T lnum)
{ {
int c; int c;
char_u *ptr, *prev_ptr; char *ptr, *prev_ptr;
char_u *line; char *line;
if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) { if (lnum < 1 || lnum > curbuf->b_ml.ml_line_count) {
vim_beep(BO_COPY); vim_beep(BO_COPY);
@@ -4770,25 +4769,25 @@ int ins_copychar(linenr_T lnum)
} }
// try to advance to the cursor column // try to advance to the cursor column
line = (char_u *)ml_get(lnum); line = ml_get(lnum);
prev_ptr = line; prev_ptr = line;
validate_virtcol(); validate_virtcol();
chartabsize_T cts; chartabsize_T cts;
init_chartabsize_arg(&cts, curwin, lnum, 0, (char *)line, (char *)line); init_chartabsize_arg(&cts, curwin, lnum, 0, line, line);
while (cts.cts_vcol < curwin->w_virtcol && *cts.cts_ptr != NUL) { while (cts.cts_vcol < curwin->w_virtcol && *cts.cts_ptr != NUL) {
prev_ptr = (char_u *)cts.cts_ptr; prev_ptr = cts.cts_ptr;
cts.cts_vcol += lbr_chartabsize_adv(&cts); cts.cts_vcol += lbr_chartabsize_adv(&cts);
} }
if (cts.cts_vcol > curwin->w_virtcol) { if (cts.cts_vcol > curwin->w_virtcol) {
ptr = prev_ptr; ptr = prev_ptr;
} else { } else {
ptr = (char_u *)cts.cts_ptr; ptr = cts.cts_ptr;
} }
clear_chartabsize_arg(&cts); clear_chartabsize_arg(&cts);
c = utf_ptr2char((char *)ptr); c = utf_ptr2char(ptr);
if (c == NUL) { if (c == NUL) {
vim_beep(BO_COPY); vim_beep(BO_COPY);
} }
@@ -4837,7 +4836,7 @@ static int ins_ctrl_ey(int tc)
static void ins_try_si(int c) static void ins_try_si(int c)
{ {
pos_T *pos, old_pos; pos_T *pos, old_pos;
char_u *ptr; char *ptr;
int i; int i;
bool temp; bool temp;
@@ -4851,7 +4850,7 @@ static void ins_try_si(int c)
// containing the matching '(' if there is one. This handles the // containing the matching '(' if there is one. This handles the
// case where an "if (..\n..) {" statement continues over multiple // case where an "if (..\n..) {" statement continues over multiple
// lines -- webb // lines -- webb
ptr = (char_u *)ml_get(pos->lnum); ptr = ml_get(pos->lnum);
i = pos->col; i = pos->col;
if (i > 0) { // skip blanks before '{' if (i > 0) { // skip blanks before '{'
while (--i > 0 && ascii_iswhite(ptr[i])) {} while (--i > 0 && ascii_iswhite(ptr[i])) {}
@@ -4876,7 +4875,7 @@ static void ins_try_si(int c)
old_pos = curwin->w_cursor; old_pos = curwin->w_cursor;
i = get_indent(); i = get_indent();
while (curwin->w_cursor.lnum > 1) { while (curwin->w_cursor.lnum > 1) {
ptr = (char_u *)skipwhite(ml_get(--(curwin->w_cursor.lnum))); ptr = skipwhite(ml_get(--(curwin->w_cursor.lnum)));
// ignore empty lines and lines starting with '#'. // ignore empty lines and lines starting with '#'.
if (*ptr != '#' && *ptr != NUL) { if (*ptr != '#' && *ptr != NUL) {
@@ -4927,7 +4926,7 @@ colnr_T get_nolist_virtcol(void)
// "c" is the character that was typed. // "c" is the character that was typed.
// Return a pointer to allocated memory with the replacement string. // Return a pointer to allocated memory with the replacement string.
// Return NULL to continue inserting "c". // Return NULL to continue inserting "c".
static char_u *do_insert_char_pre(int c) static char *do_insert_char_pre(int c)
{ {
char buf[MB_MAXBYTES + 1]; char buf[MB_MAXBYTES + 1];
const int save_State = State; const int save_State = State;
@@ -4958,7 +4957,7 @@ static char_u *do_insert_char_pre(int c)
// Restore the State, it may have been changed. // Restore the State, it may have been changed.
State = save_State; State = save_State;
return (char_u *)res; return res;
} }
bool get_can_cindent(void) bool get_can_cindent(void)

View File

@@ -7408,7 +7408,7 @@ void ex_echo(exarg_T *eap)
/// ":echohl {name}". /// ":echohl {name}".
void ex_echohl(exarg_T *eap) void ex_echohl(exarg_T *eap)
{ {
echo_attr = syn_name2attr((char_u *)eap->arg); echo_attr = syn_name2attr(eap->arg);
} }
/// ":execute expr1 ..." execute the result of an expression. /// ":execute expr1 ..." execute the result of an expression.

View File

@@ -7612,7 +7612,7 @@ static void f_spellsuggest(typval_T *argvars, typval_T *rettv, EvalFuncData fptr
maxcount = 25; maxcount = 25;
} }
spell_suggest_list(&ga, (char_u *)str, maxcount, need_capital, false); spell_suggest_list(&ga, (char *)str, maxcount, need_capital, false);
f_spellsuggest_return: f_spellsuggest_return:
tv_list_alloc_ret(rettv, (ptrdiff_t)ga.ga_len); tv_list_alloc_ret(rettv, (ptrdiff_t)ga.ga_len);

View File

@@ -337,7 +337,7 @@ struct ufunc {
///< used for s: variables ///< used for s: variables
int uf_refcount; ///< reference count, see func_name_refcount() int uf_refcount; ///< reference count, see func_name_refcount()
funccall_T *uf_scoped; ///< l: local variables for closure funccall_T *uf_scoped; ///< l: local variables for closure
char_u *uf_name_exp; ///< if "uf_name[]" starts with SNR the name with char *uf_name_exp; ///< if "uf_name[]" starts with SNR the name with
///< "<SNR>" as a string, otherwise NULL ///< "<SNR>" as a string, otherwise NULL
char uf_name[]; ///< Name of function (actual size equals name); char uf_name[]; ///< Name of function (actual size equals name);
///< can start with <SNR>123_ ///< can start with <SNR>123_

View File

@@ -1652,7 +1652,7 @@ theend:
char *printable_func_name(ufunc_T *fp) char *printable_func_name(ufunc_T *fp)
{ {
return fp->uf_name_exp != NULL ? (char *)fp->uf_name_exp : fp->uf_name; return fp->uf_name_exp != NULL ? fp->uf_name_exp : fp->uf_name;
} }
/// List the head of the function: "name(arg1, arg2)". /// List the head of the function: "name(arg1, arg2)".
@@ -2296,7 +2296,7 @@ void ex_function(exarg_T *eap)
} else { } else {
xfree(line_to_free); xfree(line_to_free);
if (eap->getline == NULL) { if (eap->getline == NULL) {
theline = (char *)getcmdline(':', 0L, indent, do_concat); theline = getcmdline(':', 0L, indent, do_concat);
} else { } else {
theline = eap->getline(':', eap->cookie, indent, do_concat); theline = eap->getline(':', eap->cookie, indent, do_concat);
} }
@@ -2532,7 +2532,7 @@ void ex_function(exarg_T *eap)
fp = NULL; fp = NULL;
overwrite = true; overwrite = true;
} else { } else {
char_u *exp_name = fp->uf_name_exp; char *exp_name = fp->uf_name_exp;
// redefine existing function, keep the expanded name // redefine existing function, keep the expanded name
XFREE_CLEAR(name); XFREE_CLEAR(name);
fp->uf_name_exp = NULL; fp->uf_name_exp = NULL;

View File

@@ -919,7 +919,7 @@ static char *get_loop_line(int c, void *cookie, int indent, bool do_concat)
char *line; char *line;
// First time inside the ":while"/":for": get line normally. // First time inside the ":while"/":for": get line normally.
if (cp->getline == NULL) { if (cp->getline == NULL) {
line = (char *)getcmdline(c, 0L, indent, do_concat); line = getcmdline(c, 0L, indent, do_concat);
} else { } else {
line = cp->getline(c, cp->cookie, indent, do_concat); line = cp->getline(c, cp->cookie, indent, do_concat);
} }

View File

@@ -381,7 +381,7 @@ static void may_do_incsearch_highlighting(int firstc, long count, incsearch_stat
proftime_T tm; proftime_T tm;
int skiplen, patlen; int skiplen, patlen;
char next_char; char next_char;
char_u use_last_pat; bool use_last_pat;
int search_delim; int search_delim;
// Parsing range may already set the last search pattern. // Parsing range may already set the last search pattern.
@@ -725,7 +725,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool clea
if (ccline.input_fn) { if (ccline.input_fn) {
s->xpc.xp_context = ccline.xp_context; s->xpc.xp_context = ccline.xp_context;
s->xpc.xp_pattern = ccline.cmdbuff; s->xpc.xp_pattern = ccline.cmdbuff;
s->xpc.xp_arg = (char *)ccline.xp_arg; s->xpc.xp_arg = ccline.xp_arg;
} }
// Avoid scrolling when called by a recursive do_cmdline(), e.g. when // Avoid scrolling when called by a recursive do_cmdline(), e.g. when
@@ -908,7 +908,7 @@ theend:
xfree(ccline.last_colors.cmdbuff); xfree(ccline.last_colors.cmdbuff);
kv_destroy(ccline.last_colors.colors); kv_destroy(ccline.last_colors.colors);
char_u *p = (char_u *)ccline.cmdbuff; char *p = ccline.cmdbuff;
if (ui_has(kUICmdline)) { if (ui_has(kUICmdline)) {
ui_call_cmdline_hide(ccline.level); ui_call_cmdline_hide(ccline.level);
@@ -923,7 +923,7 @@ theend:
ccline.cmdbuff = NULL; ccline.cmdbuff = NULL;
} }
return p; return (uint8_t *)p;
} }
static int command_line_check(VimState *state) static int command_line_check(VimState *state)
@@ -2625,9 +2625,9 @@ static void abandon_cmdline(void)
/// ///
/// @param count only used for incremental search /// @param count only used for incremental search
/// @param indent indent for inside conditionals /// @param indent indent for inside conditionals
char_u *getcmdline(int firstc, long count, int indent, bool do_concat FUNC_ATTR_UNUSED) char *getcmdline(int firstc, long count, int indent, bool do_concat FUNC_ATTR_UNUSED)
{ {
return command_line_enter(firstc, count, indent, true); return (char *)command_line_enter(firstc, count, indent, true);
} }
/// Get a command line with a prompt /// Get a command line with a prompt
@@ -2660,10 +2660,10 @@ char *getcmdline_prompt(const int firstc, const char *const prompt, const int at
CLEAR_FIELD(ccline); CLEAR_FIELD(ccline);
} }
ccline.prompt_id = last_prompt_id++; ccline.prompt_id = last_prompt_id++;
ccline.cmdprompt = (char_u *)prompt; ccline.cmdprompt = (char *)prompt;
ccline.cmdattr = attr; ccline.cmdattr = attr;
ccline.xp_context = xp_context; ccline.xp_context = xp_context;
ccline.xp_arg = (char_u *)xp_arg; ccline.xp_arg = (char *)xp_arg;
ccline.input_fn = (firstc == '@'); ccline.input_fn = (firstc == '@');
ccline.highlight_callback = highlight_callback; ccline.highlight_callback = highlight_callback;
@@ -2687,12 +2687,6 @@ char *getcmdline_prompt(const int firstc, const char *const prompt, const int at
return ret; return ret;
} }
// Return current cmdline prompt
char_u *get_cmdprompt(void)
{
return ccline.cmdprompt;
}
/// Read the 'wildmode' option, fill wim_flags[]. /// Read the 'wildmode' option, fill wim_flags[].
int check_opt_wim(void) int check_opt_wim(void)
{ {
@@ -2872,7 +2866,7 @@ char *getexline(int c, void *cookie, int indent, bool do_concat)
(void)vgetc(); (void)vgetc();
} }
return (char *)getcmdline(c, 1L, indent, do_concat); return getcmdline(c, 1L, indent, do_concat);
} }
bool cmdline_overstrike(void) bool cmdline_overstrike(void)
@@ -2910,7 +2904,7 @@ void realloc_cmdbuff(int len)
return; // no need to resize return; // no need to resize
} }
char_u *p = (char_u *)ccline.cmdbuff; char *p = ccline.cmdbuff;
alloc_cmdbuff(len); // will get some more alloc_cmdbuff(len); // will get some more
// There isn't always a NUL after the command, but it may need to be // There isn't always a NUL after the command, but it may need to be
// there, thus copy up to the NUL and add a NUL. // there, thus copy up to the NUL and add a NUL.
@@ -2922,7 +2916,7 @@ void realloc_cmdbuff(int len)
&& ccline.xpc->xp_pattern != NULL && ccline.xpc->xp_pattern != NULL
&& ccline.xpc->xp_context != EXPAND_NOTHING && ccline.xpc->xp_context != EXPAND_NOTHING
&& ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) { && ccline.xpc->xp_context != EXPAND_UNSUCCESSFUL) {
int i = (int)((char_u *)ccline.xpc->xp_pattern - p); int i = (int)(ccline.xpc->xp_pattern - p);
// If xp_pattern points inside the old cmdbuff it needs to be adjusted // If xp_pattern points inside the old cmdbuff it needs to be adjusted
// to point into the newly allocated memory. // to point into the newly allocated memory.
@@ -3257,10 +3251,10 @@ static void draw_cmdline(int start, int len)
bool do_arabicshape = false; bool do_arabicshape = false;
int mb_l; int mb_l;
for (int i = start; i < start + len; i += mb_l) { for (int i = start; i < start + len; i += mb_l) {
char_u *p = (char_u *)ccline.cmdbuff + i; char *p = ccline.cmdbuff + i;
int u8cc[MAX_MCO]; int u8cc[MAX_MCO];
int u8c = utfc_ptr2char_len((char *)p, u8cc, start + len - i); int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
mb_l = utfc_ptr2len_len((char *)p, start + len - i); mb_l = utfc_ptr2len_len(p, start + len - i);
if (ARABIC_CHAR(u8c)) { if (ARABIC_CHAR(u8c)) {
do_arabicshape = true; do_arabicshape = true;
break; break;
@@ -3293,10 +3287,10 @@ static void draw_cmdline(int start, int len)
int prev_c = 0; int prev_c = 0;
int prev_c1 = 0; int prev_c1 = 0;
for (int i = start; i < start + len; i += mb_l) { for (int i = start; i < start + len; i += mb_l) {
char_u *p = (char_u *)ccline.cmdbuff + i; char *p = ccline.cmdbuff + i;
int u8cc[MAX_MCO]; int u8cc[MAX_MCO];
int u8c = utfc_ptr2char_len((char *)p, u8cc, start + len - i); int u8c = utfc_ptr2char_len(p, u8cc, start + len - i);
mb_l = utfc_ptr2len_len((char *)p, start + len - i); mb_l = utfc_ptr2len_len(p, start + len - i);
if (ARABIC_CHAR(u8c)) { if (ARABIC_CHAR(u8c)) {
int pc; int pc;
int pc1 = 0; int pc1 = 0;
@@ -3310,7 +3304,7 @@ static void draw_cmdline(int start, int len)
if (i + mb_l >= start + len) { if (i + mb_l >= start + len) {
nc = NUL; nc = NUL;
} else { } else {
nc = utf_ptr2char((char *)p + mb_l); nc = utf_ptr2char(p + mb_l);
} }
} else { } else {
// Displaying from left to right. // Displaying from left to right.
@@ -3319,7 +3313,7 @@ static void draw_cmdline(int start, int len)
} else { } else {
int pcc[MAX_MCO]; int pcc[MAX_MCO];
pc = utfc_ptr2char_len((char *)p + mb_l, pcc, start + len - i - mb_l); pc = utfc_ptr2char_len(p + mb_l, pcc, start + len - i - mb_l);
pc1 = pcc[0]; pc1 = pcc[0];
} }
nc = prev_c; nc = prev_c;
@@ -3369,7 +3363,7 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
if (cmdline_star) { if (cmdline_star) {
content = arena_array(&arena, 1); content = arena_array(&arena, 1);
size_t len = 0; size_t len = 0;
for (char_u *p = (char_u *)ccline.cmdbuff; *p; MB_PTR_ADV(p)) { for (char *p = ccline.cmdbuff; *p; MB_PTR_ADV(p)) {
len++; len++;
} }
char *buf = arena_alloc(&arena, len, false); char *buf = arena_alloc(&arena, len, false);
@@ -3400,7 +3394,7 @@ static void ui_ext_cmdline_show(CmdlineInfo *line)
char charbuf[2] = { (char)line->cmdfirstc, 0 }; char charbuf[2] = { (char)line->cmdfirstc, 0 };
ui_call_cmdline_show(content, line->cmdpos, ui_call_cmdline_show(content, line->cmdpos,
cstr_as_string(charbuf), cstr_as_string(charbuf),
cstr_as_string((char *)(line->cmdprompt)), cstr_as_string((line->cmdprompt)),
line->cmdindent, line->cmdindent,
line->level); line->level);
if (line->special_char) { if (line->special_char) {
@@ -3682,7 +3676,7 @@ static void restore_cmdline(CmdlineInfo *ccp)
static bool cmdline_paste(int regname, bool literally, bool remcr) static bool cmdline_paste(int regname, bool literally, bool remcr)
{ {
char *arg; char *arg;
char_u *p; char *p;
bool allocated; bool allocated;
// check for valid regname; also accept special characters for CTRL-R in // check for valid regname; also accept special characters for CTRL-R in
@@ -3714,7 +3708,7 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
// When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate // When 'incsearch' is set and CTRL-R CTRL-W used: skip the duplicate
// part of the word. // part of the word.
p = (char_u *)arg; p = arg;
if (p_is && regname == Ctrl_W) { if (p_is && regname == Ctrl_W) {
char *w; char *w;
int len; int len;
@@ -3733,7 +3727,7 @@ static bool cmdline_paste(int regname, bool literally, bool remcr)
} }
} }
cmdline_paste_str((char *)p, literally); cmdline_paste_str(p, literally);
if (allocated) { if (allocated) {
xfree(arg); xfree(arg);
} }
@@ -3800,7 +3794,7 @@ static void redrawcmdprompt(void)
msg_putchar(ccline.cmdfirstc); msg_putchar(ccline.cmdfirstc);
} }
if (ccline.cmdprompt != NULL) { if (ccline.cmdprompt != NULL) {
msg_puts_attr((const char *)ccline.cmdprompt, ccline.cmdattr); msg_puts_attr(ccline.cmdprompt, ccline.cmdattr);
ccline.cmdindent = msg_col + (msg_row - cmdline_row) * Columns; ccline.cmdindent = msg_col + (msg_row - cmdline_row) * Columns;
// do the reverse of cmd_startcol() // do the reverse of cmd_startcol()
if (ccline.cmdfirstc != NUL) { if (ccline.cmdfirstc != NUL) {
@@ -4018,11 +4012,11 @@ char *vim_strsave_fnameescape(const char *const fname, const int what)
/// Put a backslash before the file name in "pp", which is in allocated memory. /// Put a backslash before the file name in "pp", which is in allocated memory.
void escape_fname(char **pp) void escape_fname(char **pp)
{ {
char_u *p = xmalloc(strlen(*pp) + 2); char *p = xmalloc(strlen(*pp) + 2);
p[0] = '\\'; p[0] = '\\';
STRCPY(p + 1, *pp); STRCPY(p + 1, *pp);
xfree(*pp); xfree(*pp);
*pp = (char *)p; *pp = p;
} }
/// For each file name in files[num_files]: /// For each file name in files[num_files]:

View File

@@ -54,14 +54,14 @@ struct cmdline_info {
int cmdspos; ///< cursor column on screen int cmdspos; ///< cursor column on screen
int cmdfirstc; ///< ':', '/', '?', '=', '>' or NUL int cmdfirstc; ///< ':', '/', '?', '=', '>' or NUL
int cmdindent; ///< number of spaces before cmdline int cmdindent; ///< number of spaces before cmdline
char_u *cmdprompt; ///< message in front of cmdline char *cmdprompt; ///< message in front of cmdline
int cmdattr; ///< attributes for prompt int cmdattr; ///< attributes for prompt
int overstrike; ///< Typing mode on the command line. Shared by int overstrike; ///< Typing mode on the command line. Shared by
///< getcmdline() and put_on_cmdline(). ///< getcmdline() and put_on_cmdline().
expand_T *xpc; ///< struct being used for expansion, xp_pattern expand_T *xpc; ///< struct being used for expansion, xp_pattern
///< may point into cmdbuff ///< may point into cmdbuff
int xp_context; ///< type of expansion int xp_context; ///< type of expansion
char_u *xp_arg; ///< user-defined expansion arg char *xp_arg; ///< user-defined expansion arg
int input_fn; ///< when true Invoked for input() function int input_fn; ///< when true Invoked for input() function
unsigned prompt_id; ///< Prompt number, used to disable coloring on errors. unsigned prompt_id; ///< Prompt number, used to disable coloring on errors.
Callback highlight_callback; ///< Callback used for coloring user input. Callback highlight_callback; ///< Callback used for coloring user input.

View File

@@ -77,7 +77,7 @@ static int hl_attr_table[] =
/// The ID of a highlight group is also called group ID. It is the index in /// The ID of a highlight group is also called group ID. It is the index in
/// the highlight_ga array PLUS ONE. /// the highlight_ga array PLUS ONE.
typedef struct { typedef struct {
char_u *sg_name; ///< highlight group name char *sg_name; ///< highlight group name
char *sg_name_u; ///< uppercase of sg_name char *sg_name_u; ///< uppercase of sg_name
bool sg_cleared; ///< "hi clear" was used bool sg_cleared; ///< "hi clear" was used
int sg_attr; ///< Screen attr @see ATTR_ENTRY int sg_attr; ///< Screen attr @see ATTR_ENTRY
@@ -85,14 +85,12 @@ typedef struct {
int sg_deflink; ///< default link; restored in highlight_clear() int sg_deflink; ///< default link; restored in highlight_clear()
int sg_set; ///< combination of flags in \ref SG_SET int sg_set; ///< combination of flags in \ref SG_SET
sctx_T sg_deflink_sctx; ///< script where the default link was set sctx_T sg_deflink_sctx; ///< script where the default link was set
sctx_T sg_script_ctx; ///< script in which the group was last set sctx_T sg_script_ctx; ///< script in which the group was last set for terminal UIs
// for terminal UIs
int sg_cterm; ///< "cterm=" highlighting attr int sg_cterm; ///< "cterm=" highlighting attr
///< (combination of \ref HlAttrFlags) ///< (combination of \ref HlAttrFlags)
int sg_cterm_fg; ///< terminal fg color number + 1 int sg_cterm_fg; ///< terminal fg color number + 1
int sg_cterm_bg; ///< terminal bg color number + 1 int sg_cterm_bg; ///< terminal bg color number + 1
bool sg_cterm_bold; ///< bold attr was set for light color bool sg_cterm_bold; ///< bold attr was set for light color for RGB UIs
// for RGB UIs
int sg_gui; ///< "gui=" highlighting attributes int sg_gui; ///< "gui=" highlighting attributes
///< (combination of \ref HlAttrFlags) ///< (combination of \ref HlAttrFlags)
RgbValue sg_rgb_fg; ///< RGB foreground color RgbValue sg_rgb_fg; ///< RGB foreground color
@@ -571,7 +569,7 @@ int highlight_num_groups(void)
} }
/// Returns the name of a highlight group. /// Returns the name of a highlight group.
char_u *highlight_group_name(int id) char *highlight_group_name(int id)
{ {
return hl_table[id].sg_name; return hl_table[id].sg_name;
} }
@@ -658,7 +656,7 @@ void init_highlight(bool both, bool reset)
/// @return OK for success, FAIL for failure. /// @return OK for success, FAIL for failure.
int load_colors(char *name) int load_colors(char *name)
{ {
char_u *buf; char *buf;
int retval = FAIL; int retval = FAIL;
static bool recursive = false; static bool recursive = false;
@@ -673,11 +671,11 @@ int load_colors(char *name)
size_t buflen = strlen(name) + 12; size_t buflen = strlen(name) + 12;
buf = xmalloc(buflen); buf = xmalloc(buflen);
apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, false, curbuf); apply_autocmds(EVENT_COLORSCHEMEPRE, name, curbuf->b_fname, false, curbuf);
snprintf((char *)buf, buflen, "colors/%s.vim", name); snprintf(buf, buflen, "colors/%s.vim", name);
retval = source_runtime((char *)buf, DIP_START + DIP_OPT); retval = source_runtime(buf, DIP_START + DIP_OPT);
if (retval == FAIL) { if (retval == FAIL) {
snprintf((char *)buf, buflen, "colors/%s.lua", name); snprintf(buf, buflen, "colors/%s.lua", name);
retval = source_runtime((char *)buf, DIP_START + DIP_OPT); retval = source_runtime(buf, DIP_START + DIP_OPT);
} }
xfree(buf); xfree(buf);
if (retval == OK) { if (retval == OK) {
@@ -1471,7 +1469,7 @@ static void highlight_list_one(const int id)
const HlGroup *sgp = &hl_table[id - 1]; // index is ID minus one const HlGroup *sgp = &hl_table[id - 1]; // index is ID minus one
bool didh = false; bool didh = false;
if (message_filtered((char *)sgp->sg_name)) { if (message_filtered(sgp->sg_name)) {
return; return;
} }
@@ -1505,7 +1503,7 @@ static void highlight_list_one(const int id)
didh = true; didh = true;
msg_puts_attr("links to", HL_ATTR(HLF_D)); msg_puts_attr("links to", HL_ATTR(HLF_D));
msg_putchar(' '); msg_putchar(' ');
msg_outtrans((char *)hl_table[hl_table[id - 1].sg_link - 1].sg_name); msg_outtrans(hl_table[hl_table[id - 1].sg_link - 1].sg_name);
} }
if (!didh) { if (!didh) {
@@ -1527,7 +1525,7 @@ Dictionary get_global_hl_defs(Arena *arena)
hlattrs2dict(&attrs, syn_attr2entry(h->sg_attr), true); hlattrs2dict(&attrs, syn_attr2entry(h->sg_attr), true);
} else if (h->sg_link > 0) { } else if (h->sg_link > 0) {
attrs = arena_dict(arena, 1); attrs = arena_dict(arena, 1);
char *link = (char *)hl_table[h->sg_link - 1].sg_name; char *link = hl_table[h->sg_link - 1].sg_name;
PUT_C(attrs, "link", STRING_OBJ(cstr_as_string(link))); PUT_C(attrs, "link", STRING_OBJ(cstr_as_string(link)));
} }
PUT_C(rv, (char *)h->sg_name, DICTIONARY_OBJ(attrs)); PUT_C(rv, (char *)h->sg_name, DICTIONARY_OBJ(attrs));
@@ -1702,7 +1700,7 @@ bool syn_list_header(const bool did_header, const int outlen, const int id, bool
if (got_int) { if (got_int) {
return true; return true;
} }
msg_outtrans((char *)hl_table[id - 1].sg_name); msg_outtrans(hl_table[id - 1].sg_name);
name_col = msg_col; name_col = msg_col;
endcol = 15; endcol = 15;
} else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) { } else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) {
@@ -1804,10 +1802,10 @@ int syn_name2id_len(const char *name, size_t len)
/// Lookup a highlight group name and return its attributes. /// Lookup a highlight group name and return its attributes.
/// Return zero if not found. /// Return zero if not found.
int syn_name2attr(const char_u *name) int syn_name2attr(const char *name)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
int id = syn_name2id((char *)name); int id = syn_name2id(name);
if (id != 0) { if (id != 0) {
return syn_id2attr(id); return syn_id2attr(id);
@@ -1823,10 +1821,10 @@ int highlight_exists(const char *name)
/// Return the name of highlight group "id". /// Return the name of highlight group "id".
/// When not a valid ID return an empty string. /// When not a valid ID return an empty string.
char_u *syn_id2name(int id) char *syn_id2name(int id)
{ {
if (id <= 0 || id > highlight_ga.ga_len) { if (id <= 0 || id > highlight_ga.ga_len) {
return (char_u *)""; return "";
} }
return hl_table[id - 1].sg_name; return hl_table[id - 1].sg_name;
} }
@@ -1896,7 +1894,7 @@ static int syn_add_group(const char *name, size_t len)
// Append another syntax_highlight entry. // Append another syntax_highlight entry.
HlGroup *hlgp = GA_APPEND_VIA_PTR(HlGroup, &highlight_ga); HlGroup *hlgp = GA_APPEND_VIA_PTR(HlGroup, &highlight_ga);
CLEAR_POINTER(hlgp); CLEAR_POINTER(hlgp);
hlgp->sg_name = (char_u *)arena_memdupz(&highlight_arena, name, len); hlgp->sg_name = arena_memdupz(&highlight_arena, name, len);
hlgp->sg_rgb_bg = -1; hlgp->sg_rgb_bg = -1;
hlgp->sg_rgb_fg = -1; hlgp->sg_rgb_fg = -1;
hlgp->sg_rgb_sp = -1; hlgp->sg_rgb_sp = -1;

View File

@@ -757,7 +757,7 @@ void ml_recover(bool checkext)
directly = false; directly = false;
// count the number of matching swap files // count the number of matching swap files
len = recover_names((char_u *)fname, false, 0, NULL); len = recover_names(fname, false, 0, NULL);
if (len == 0) { // no swap files found if (len == 0) { // no swap files found
semsg(_("E305: No swap file found for %s"), fname); semsg(_("E305: No swap file found for %s"), fname);
goto theend; goto theend;
@@ -767,7 +767,7 @@ void ml_recover(bool checkext)
i = 1; i = 1;
} else { // several swap files found, choose } else { // several swap files found, choose
// list the names of the swap files // list the names of the swap files
(void)recover_names((char_u *)fname, true, 0, NULL); (void)recover_names(fname, true, 0, NULL);
msg_putchar('\n'); msg_putchar('\n');
msg_puts(_("Enter number of swap file to use (0 to quit): ")); msg_puts(_("Enter number of swap file to use (0 to quit): "));
i = get_number(false, NULL); i = get_number(false, NULL);
@@ -776,7 +776,7 @@ void ml_recover(bool checkext)
} }
} }
// get the swap file name that will be used // get the swap file name that will be used
(void)recover_names((char_u *)fname, false, i, &fname_used); (void)recover_names(fname, false, i, &fname_used);
} }
if (fname_used == NULL) { if (fname_used == NULL) {
goto theend; // user chose invalid number. goto theend; // user chose invalid number.
@@ -1201,24 +1201,24 @@ theend:
/// @param list when true, list the swap file names /// @param list when true, list the swap file names
/// @param nr when non-zero, return nr'th swap file name /// @param nr when non-zero, return nr'th swap file name
/// @param fname_out result when "nr" > 0 /// @param fname_out result when "nr" > 0
int recover_names(char_u *fname, int list, int nr, char **fname_out) int recover_names(char *fname, int list, int nr, char **fname_out)
{ {
int num_names; int num_names;
char *(names[6]); char *(names[6]);
char_u *tail; char *tail;
char *p; char *p;
int file_count = 0; int file_count = 0;
char **files; char **files;
char_u *fname_res = NULL; char *fname_res = NULL;
#ifdef HAVE_READLINK #ifdef HAVE_READLINK
char_u fname_buf[MAXPATHL]; char fname_buf[MAXPATHL];
#endif #endif
if (fname != NULL) { if (fname != NULL) {
#ifdef HAVE_READLINK #ifdef HAVE_READLINK
// Expand symlink in the file name, because the swap file is created // Expand symlink in the file name, because the swap file is created
// with the actual file instead of with the symlink. // with the actual file instead of with the symlink.
if (resolve_symlink((char *)fname, (char *)fname_buf) == OK) { if (resolve_symlink(fname, fname_buf) == OK) {
fname_res = fname_buf; fname_res = fname_buf;
} else } else
#endif #endif
@@ -1250,7 +1250,7 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
names[2] = xstrdup(".sw?"); names[2] = xstrdup(".sw?");
num_names = 3; num_names = 3;
} else { } else {
num_names = recov_file_names(names, (char *)fname_res, true); num_names = recov_file_names(names, fname_res, true);
} }
} else { // check directory dir_name } else { // check directory dir_name
if (fname == NULL) { if (fname == NULL) {
@@ -1267,13 +1267,12 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
&& len > 1 && len > 1
&& p[-1] == p[-2]) { && p[-1] == p[-2]) {
// Ends with '//', Use Full path for swap name // Ends with '//', Use Full path for swap name
tail = (char_u *)make_percent_swname(dir_name, tail = make_percent_swname(dir_name, fname_res);
(char *)fname_res);
} else { } else {
tail = (char_u *)path_tail((char *)fname_res); tail = path_tail(fname_res);
tail = (char_u *)concat_fnames(dir_name, (char *)tail, true); tail = concat_fnames(dir_name, tail, true);
} }
num_names = recov_file_names(names, (char *)tail, false); num_names = recov_file_names(names, tail, false);
xfree(tail); xfree(tail);
} }
} }
@@ -1290,11 +1289,11 @@ int recover_names(char_u *fname, int list, int nr, char **fname_out)
// not able to execute the shell). // not able to execute the shell).
// Try finding a swap file by simply adding ".swp" to the file name. // Try finding a swap file by simply adding ".swp" to the file name.
if (*dirp == NUL && file_count + num_files == 0 && fname != NULL) { if (*dirp == NUL && file_count + num_files == 0 && fname != NULL) {
char_u *swapname = (char_u *)modname((char *)fname_res, ".swp", true); char *swapname = modname(fname_res, ".swp", true);
if (swapname != NULL) { if (swapname != NULL) {
if (os_path_exists((char *)swapname)) { if (os_path_exists(swapname)) {
files = xmalloc(sizeof(char_u *)); files = xmalloc(sizeof(char *));
files[0] = (char *)swapname; files[0] = swapname;
swapname = NULL; swapname = NULL;
num_files = 1; num_files = 1;
} }
@@ -1877,7 +1876,7 @@ int ml_append(linenr_T lnum, char *line, colnr_T len, bool newfile)
/// @param line text of the new line /// @param line text of the new line
/// @param len length of new line, including NUL, or 0 /// @param len length of new line, including NUL, or 0
/// @param newfile flag, see above /// @param newfile flag, see above
int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, bool newfile) int ml_append_buf(buf_T *buf, linenr_T lnum, char *line, colnr_T len, bool newfile)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
if (buf->b_ml.ml_mfp == NULL) { if (buf->b_ml.ml_mfp == NULL) {
@@ -1887,7 +1886,7 @@ int ml_append_buf(buf_T *buf, linenr_T lnum, char_u *line, colnr_T len, bool new
if (buf->b_ml.ml_line_lnum != 0) { if (buf->b_ml.ml_line_lnum != 0) {
ml_flush_line(buf); ml_flush_line(buf);
} }
return ml_append_int(buf, lnum, (char *)line, len, newfile, false); return ml_append_int(buf, lnum, line, len, newfile, false);
} }
/// @param lnum append after this line (can be 0) /// @param lnum append after this line (can be 0)

View File

@@ -3998,7 +3998,7 @@ static void nv_search(cmdarg_T *cap)
// When using 'incsearch' the cursor may be moved to set a different search // When using 'incsearch' the cursor may be moved to set a different search
// start position. // start position.
cap->searchbuf = (char *)getcmdline(cap->cmdchar, cap->count1, 0, true); cap->searchbuf = getcmdline(cap->cmdchar, cap->count1, 0, true);
if (cap->searchbuf == NULL) { if (cap->searchbuf == NULL) {
clearop(oap); clearop(oap);

View File

@@ -723,7 +723,7 @@ int get_expr_register(void)
{ {
char *new_line; char *new_line;
new_line = (char *)getcmdline('=', 0L, 0, true); new_line = getcmdline('=', 0L, 0, true);
if (new_line == NULL) { if (new_line == NULL) {
return NUL; return NUL;
} }
@@ -1131,7 +1131,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
retval = put_in_typebuf(p, true, colon, silent); retval = put_in_typebuf(p, true, colon, silent);
xfree(p); xfree(p);
} else if (regname == '.') { // use last inserted text } else if (regname == '.') { // use last inserted text
p = (char *)get_last_insert_save(); p = get_last_insert_save();
if (p == NULL) { if (p == NULL) {
emsg(_(e_noinstext)); emsg(_(e_noinstext));
return FAIL; return FAIL;
@@ -1351,7 +1351,7 @@ bool get_spec_reg(int regname, char **argp, bool *allocated, bool errmsg)
return true; return true;
case '.': // last inserted text case '.': // last inserted text
*argp = (char *)get_last_insert_save(); *argp = get_last_insert_save();
*allocated = true; *allocated = true;
if (*argp == NULL && errmsg) { if (*argp == NULL && errmsg) {
emsg(_(e_noinstext)); emsg(_(e_noinstext));

View File

@@ -3168,15 +3168,15 @@ void qf_list(exarg_T *eap)
// Get the attributes for the different quickfix highlight items. Note // Get the attributes for the different quickfix highlight items. Note
// that this depends on syntax items defined in the qf.vim syntax file // that this depends on syntax items defined in the qf.vim syntax file
qfFileAttr = syn_name2attr((char_u *)"qfFileName"); qfFileAttr = syn_name2attr("qfFileName");
if (qfFileAttr == 0) { if (qfFileAttr == 0) {
qfFileAttr = HL_ATTR(HLF_D); qfFileAttr = HL_ATTR(HLF_D);
} }
qfSepAttr = syn_name2attr((char_u *)"qfSeparator"); qfSepAttr = syn_name2attr("qfSeparator");
if (qfSepAttr == 0) { if (qfSepAttr == 0) {
qfSepAttr = HL_ATTR(HLF_D); qfSepAttr = HL_ATTR(HLF_D);
} }
qfLineAttr = syn_name2attr((char_u *)"qfLineNr"); qfLineAttr = syn_name2attr("qfLineNr");
if (qfLineAttr == 0) { if (qfLineAttr == 0) {
qfLineAttr = HL_ATTR(HLF_N); qfLineAttr = HL_ATTR(HLF_N);
} }
@@ -3997,7 +3997,7 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
IObuff + len, IOSIZE - len); IObuff + len, IOSIZE - len);
} }
if (ml_append_buf(buf, lnum, (char_u *)IObuff, if (ml_append_buf(buf, lnum, IObuff,
(colnr_T)strlen(IObuff) + 1, false) == FAIL) { (colnr_T)strlen(IObuff) + 1, false) == FAIL) {
return FAIL; return FAIL;
} }

View File

@@ -104,7 +104,7 @@ estack_T *estack_push(etype_T type, char *name, linenr_T lnum)
void estack_push_ufunc(ufunc_T *ufunc, linenr_T lnum) void estack_push_ufunc(ufunc_T *ufunc, linenr_T lnum)
{ {
estack_T *entry = estack_push(ETYPE_UFUNC, estack_T *entry = estack_push(ETYPE_UFUNC,
ufunc->uf_name_exp != NULL ? (char *)ufunc->uf_name_exp : ufunc->uf_name, ufunc->uf_name_exp != NULL ? ufunc->uf_name_exp : ufunc->uf_name,
lnum); lnum);
if (entry != NULL) { if (entry != NULL) {
entry->es_info.ufunc = ufunc; entry->es_info.ufunc = ufunc;

File diff suppressed because it is too large Load Diff

View File

@@ -80,11 +80,11 @@ typedef struct fromto_S {
// The info is split for quick processing by spell_soundfold(). // The info is split for quick processing by spell_soundfold().
// Note that "sm_oneof" and "sm_rules" point into sm_lead. // Note that "sm_oneof" and "sm_rules" point into sm_lead.
typedef struct salitem_S { typedef struct salitem_S {
char_u *sm_lead; // leading letters char *sm_lead; // leading letters
int sm_leadlen; // length of "sm_lead" int sm_leadlen; // length of "sm_lead"
char_u *sm_oneof; // letters from () or NULL char_u *sm_oneof; // letters from () or NULL
char_u *sm_rules; // rules like ^, $, priority char *sm_rules; // rules like ^, $, priority
char_u *sm_to; // replacement. char *sm_to; // replacement.
int *sm_lead_w; // wide character copy of "sm_lead" int *sm_lead_w; // wide character copy of "sm_lead"
int *sm_oneof_w; // wide character copy of "sm_oneof" int *sm_oneof_w; // wide character copy of "sm_oneof"
int *sm_to_w; // wide character copy of "sm_to" int *sm_to_w; // wide character copy of "sm_to"
@@ -119,17 +119,17 @@ struct slang_S {
char *sl_fname; // name of .spl file char *sl_fname; // name of .spl file
bool sl_add; // true if it's a .add file. bool sl_add; // true if it's a .add file.
char_u *sl_fbyts; // case-folded word bytes char *sl_fbyts; // case-folded word bytes
long sl_fbyts_len; // length of sl_fbyts long sl_fbyts_len; // length of sl_fbyts
idx_T *sl_fidxs; // case-folded word indexes idx_T *sl_fidxs; // case-folded word indexes
char_u *sl_kbyts; // keep-case word bytes char *sl_kbyts; // keep-case word bytes
idx_T *sl_kidxs; // keep-case word indexes idx_T *sl_kidxs; // keep-case word indexes
char_u *sl_pbyts; // prefix tree word bytes char *sl_pbyts; // prefix tree word bytes
idx_T *sl_pidxs; // prefix tree word indexes idx_T *sl_pidxs; // prefix tree word indexes
char_u *sl_info; // infotext string or NULL char_u *sl_info; // infotext string or NULL
char_u sl_regions[MAXREGIONS * 2 + 1]; char sl_regions[MAXREGIONS * 2 + 1];
// table with up to 8 region names plus NUL // table with up to 8 region names plus NUL
char_u *sl_midword; // MIDWORD string or NULL char_u *sl_midword; // MIDWORD string or NULL
@@ -143,9 +143,9 @@ struct slang_S {
garray_T sl_comppat; // CHECKCOMPOUNDPATTERN items garray_T sl_comppat; // CHECKCOMPOUNDPATTERN items
regprog_T *sl_compprog; // COMPOUNDRULE turned into a regexp progrm regprog_T *sl_compprog; // COMPOUNDRULE turned into a regexp progrm
// (NULL when no compounding) // (NULL when no compounding)
char_u *sl_comprules; // all COMPOUNDRULE concatenated (or NULL) uint8_t *sl_comprules; // all COMPOUNDRULE concatenated (or NULL)
char_u *sl_compstartflags; // flags for first compound word uint8_t *sl_compstartflags; // flags for first compound word
char_u *sl_compallflags; // all flags for compound words uint8_t *sl_compallflags; // all flags for compound words
bool sl_nobreak; // When true: no spaces between words bool sl_nobreak; // When true: no spaces between words
char_u *sl_syllable; // SYLLABLE repeatable chars or NULL char_u *sl_syllable; // SYLLABLE repeatable chars or NULL
garray_T sl_syl_items; // syllable items garray_T sl_syl_items; // syllable items
@@ -172,7 +172,7 @@ struct slang_S {
// Info from the .sug file. Loaded on demand. // Info from the .sug file. Loaded on demand.
time_t sl_sugtime; // timestamp for .sug file time_t sl_sugtime; // timestamp for .sug file
char_u *sl_sbyts; // soundfolded word bytes char *sl_sbyts; // soundfolded word bytes
idx_T *sl_sidxs; // soundfolded word indexes idx_T *sl_sidxs; // soundfolded word indexes
buf_T *sl_sugbuf; // buffer with word number table buf_T *sl_sugbuf; // buffer with word number table
bool sl_sugloaded; // true when .sug file was loaded or failed to bool sl_sugloaded; // true when .sug file was loaded or failed to
@@ -227,7 +227,7 @@ typedef struct {
extern slang_T *first_lang; extern slang_T *first_lang;
// file used for "zG" and "zW" // file used for "zG" and "zW"
extern char_u *int_wordlist; extern char *int_wordlist;
extern spelltab_T spelltab; extern spelltab_T spelltab;
extern int did_set_spelltab; extern int did_set_spelltab;

File diff suppressed because it is too large Load Diff

View File

@@ -304,7 +304,7 @@ static int score_wordcount_adj(slang_T *slang, int score, char_u *word, bool spl
static int badword_captype(char_u *word, char_u *end) static int badword_captype(char_u *word, char_u *end)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_ALL
{ {
int flags = captype(word, end); int flags = captype((char *)word, (char *)end);
int c; int c;
int l, u; int l, u;
bool first; bool first;
@@ -497,15 +497,15 @@ void spell_suggest(int count)
line = get_cursor_line_ptr(); line = get_cursor_line_ptr();
p = (char_u *)line + curwin->w_cursor.col; p = (char_u *)line + curwin->w_cursor.col;
// Backup to before start of word. // Backup to before start of word.
while (p > (char_u *)line && spell_iswordp_nmw(p, curwin)) { while (p > (char_u *)line && spell_iswordp_nmw((char *)p, curwin)) {
MB_PTR_BACK(line, p); MB_PTR_BACK(line, p);
} }
// Forward to start of word. // Forward to start of word.
while (*p != NUL && !spell_iswordp_nmw(p, curwin)) { while (*p != NUL && !spell_iswordp_nmw((char *)p, curwin)) {
MB_PTR_ADV(p); MB_PTR_ADV(p);
} }
if (!spell_iswordp_nmw(p, curwin)) { // No word found. if (!spell_iswordp_nmw((char *)p, curwin)) { // No word found.
beep_flush(); beep_flush();
return; return;
} }
@@ -678,13 +678,13 @@ void spell_suggest(int count)
/// ///
/// @param maxcount maximum nr of suggestions /// @param maxcount maximum nr of suggestions
/// @param need_cap 'spellcapcheck' matched /// @param need_cap 'spellcapcheck' matched
void spell_suggest_list(garray_T *gap, char_u *word, int maxcount, bool need_cap, bool interactive) void spell_suggest_list(garray_T *gap, char *word, int maxcount, bool need_cap, bool interactive)
{ {
suginfo_T sug; suginfo_T sug;
suggest_T *stp; suggest_T *stp;
char_u *wcopy; char_u *wcopy;
spell_find_suggest(word, 0, &sug, maxcount, false, need_cap, interactive); spell_find_suggest((char_u *)word, 0, &sug, maxcount, false, need_cap, interactive);
// Make room in "gap". // Make room in "gap".
ga_init(gap, sizeof(char_u *), sug.su_ga.ga_len + 1); ga_init(gap, sizeof(char_u *), sug.su_ga.ga_len + 1);
@@ -749,7 +749,7 @@ static void spell_find_suggest(char_u *badptr, int badlen, suginfo_T *su, int ma
su->su_badlen = MAXWLEN - 1; // just in case su->su_badlen = MAXWLEN - 1; // just in case
} }
xstrlcpy((char *)su->su_badword, su->su_badptr, (size_t)su->su_badlen + 1); xstrlcpy((char *)su->su_badword, su->su_badptr, (size_t)su->su_badlen + 1);
(void)spell_casefold(curwin, (char_u *)su->su_badptr, su->su_badlen, (char_u *)su->su_fbadword, (void)spell_casefold(curwin, su->su_badptr, su->su_badlen, su->su_fbadword,
MAXWLEN); MAXWLEN);
// TODO(vim): make this work if the case-folded text is longer than the // TODO(vim): make this work if the case-folded text is longer than the
@@ -788,7 +788,7 @@ static void spell_find_suggest(char_u *badptr, int badlen, suginfo_T *su, int ma
// for that. // for that.
c = utf_ptr2char(su->su_badptr); c = utf_ptr2char(su->su_badptr);
if (!SPELL_ISUPPER(c) && attr == HLF_COUNT) { if (!SPELL_ISUPPER(c) && attr == HLF_COUNT) {
make_case_word((char_u *)su->su_badword, (char_u *)buf, WF_ONECAP); make_case_word((char *)su->su_badword, buf, WF_ONECAP);
add_suggestion(su, &su->su_ga, (char *)buf, su->su_badlen, SCORE_ICASE, add_suggestion(su, &su->su_ga, (char *)buf, su->su_badlen, SCORE_ICASE,
0, true, su->su_sallang, false); 0, true, su->su_sallang, false);
} }
@@ -900,8 +900,8 @@ static void spell_suggest_file(suginfo_T *su, char_u *fname)
// If the suggestion doesn't have specific case duplicate the case // If the suggestion doesn't have specific case duplicate the case
// of the bad word. // of the bad word.
if (captype(p, NULL) == 0) { if (captype((char *)p, NULL) == 0) {
make_case_word(p, cword, su->su_badflags); make_case_word((char *)p, (char *)cword, su->su_badflags);
p = cword; p = cword;
} }
@@ -1021,7 +1021,7 @@ static void suggest_try_special(suginfo_T *su)
// use that for the goodword too: "The the" -> "The". // use that for the goodword too: "The the" -> "The".
c = su->su_fbadword[len]; c = su->su_fbadword[len];
su->su_fbadword[len] = NUL; su->su_fbadword[len] = NUL;
make_case_word((char_u *)su->su_fbadword, word, su->su_badflags); make_case_word(su->su_fbadword, (char *)word, su->su_badflags);
su->su_fbadword[len] = c; su->su_fbadword[len] = c;
// Give a soundalike score of 0, compute the score as if deleting one // Give a soundalike score of 0, compute the score as if deleting one
@@ -1090,7 +1090,7 @@ static void suggest_try_change(suginfo_T *su)
STRCPY(fword, su->su_fbadword); STRCPY(fword, su->su_fbadword);
n = (int)strlen(fword); n = (int)strlen(fword);
p = su->su_badptr + su->su_badlen; p = su->su_badptr + su->su_badlen;
(void)spell_casefold(curwin, (char_u *)p, (int)strlen(p), (char_u *)fword + n, MAXWLEN - n); (void)spell_casefold(curwin, p, (int)strlen(p), fword + n, MAXWLEN - n);
// Make sure the resulting text is not longer than the original text. // Make sure the resulting text is not longer than the original text.
n = (int)strlen(su->su_badptr); n = (int)strlen(su->su_badptr);
@@ -1198,7 +1198,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
if (soundfold) { if (soundfold) {
// Going through the soundfold tree. // Going through the soundfold tree.
byts = fbyts = slang->sl_sbyts; byts = fbyts = (char_u *)slang->sl_sbyts;
idxs = fidxs = slang->sl_sidxs; idxs = fidxs = slang->sl_sidxs;
pbyts = NULL; pbyts = NULL;
pidxs = NULL; pidxs = NULL;
@@ -1207,9 +1207,9 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
} else { } else {
// When there are postponed prefixes we need to use these first. At // When there are postponed prefixes we need to use these first. At
// the end of the prefix we continue in the case-fold tree. // the end of the prefix we continue in the case-fold tree.
fbyts = slang->sl_fbyts; fbyts = (char_u *)slang->sl_fbyts;
fidxs = slang->sl_fidxs; fidxs = slang->sl_fidxs;
pbyts = slang->sl_pbyts; pbyts = (char_u *)slang->sl_pbyts;
pidxs = slang->sl_pidxs; pidxs = slang->sl_pidxs;
if (pbyts != NULL) { if (pbyts != NULL) {
byts = pbyts; byts = pbyts;
@@ -1263,7 +1263,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
if (depth < MAXWLEN - 1 && (byts[arridx] == 0 || n == STATE_NOPREFIX)) { if (depth < MAXWLEN - 1 && (byts[arridx] == 0 || n == STATE_NOPREFIX)) {
// Set su->su_badflags to the caps type at this position. // Set su->su_badflags to the caps type at this position.
// Use the caps type until here for the prefix itself. // Use the caps type until here for the prefix itself.
n = nofold_len((char_u *)fword, sp->ts_fidx, (char_u *)su->su_badptr); n = nofold_len(fword, sp->ts_fidx, su->su_badptr);
flags = badword_captype((char_u *)su->su_badptr, (char_u *)su->su_badptr + n); flags = badword_captype((char_u *)su->su_badptr, (char_u *)su->su_badptr + n);
su->su_badflags = badword_captype((char_u *)su->su_badptr + n, su->su_badflags = badword_captype((char_u *)su->su_badptr + n,
(char_u *)su->su_badptr + su->su_badlen); (char_u *)su->su_badptr + su->su_badlen);
@@ -1281,8 +1281,8 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// Move the prefix to preword[] with the right case // Move the prefix to preword[] with the right case
// and make find_keepcap_word() works. // and make find_keepcap_word() works.
tword[sp->ts_twordlen] = NUL; tword[sp->ts_twordlen] = NUL;
make_case_word((char_u *)tword + sp->ts_splitoff, make_case_word(tword + sp->ts_splitoff,
(char_u *)preword + sp->ts_prewordlen, flags); preword + sp->ts_prewordlen, flags);
sp->ts_prewordlen = (char_u)strlen(preword); sp->ts_prewordlen = (char_u)strlen(preword);
sp->ts_splitoff = sp->ts_twordlen; sp->ts_splitoff = sp->ts_twordlen;
} }
@@ -1310,7 +1310,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
fword_ends = (fword[sp->ts_fidx] == NUL fword_ends = (fword[sp->ts_fidx] == NUL
|| (soundfold || (soundfold
? ascii_iswhite(fword[sp->ts_fidx]) ? ascii_iswhite(fword[sp->ts_fidx])
: !spell_iswordp((char_u *)fword + sp->ts_fidx, curwin))); : !spell_iswordp(fword + sp->ts_fidx, curwin)));
tword[sp->ts_twordlen] = NUL; tword[sp->ts_twordlen] = NUL;
if (sp->ts_prefixdepth <= PFD_NOTSPECIAL if (sp->ts_prefixdepth <= PFD_NOTSPECIAL
@@ -1325,7 +1325,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
for (c = 0; c < len && pbyts[n + c] == 0; c++) {} for (c = 0; c < len && pbyts[n + c] == 0; c++) {}
if (c > 0) { if (c > 0) {
c = valid_word_prefix(c, n, flags, c = valid_word_prefix(c, n, flags,
(char_u *)tword + sp->ts_splitoff, slang, false); tword + sp->ts_splitoff, slang, false);
if (c == 0) { if (c == 0) {
break; break;
} }
@@ -1446,11 +1446,11 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// When appending a compound word after a word character don't // When appending a compound word after a word character don't
// use Onecap. // use Onecap.
if (p != NULL && spell_iswordp_nmw((char_u *)p, curwin)) { if (p != NULL && spell_iswordp_nmw(p, curwin)) {
c &= ~WF_ONECAP; c &= ~WF_ONECAP;
} }
make_case_word((char_u *)tword + sp->ts_splitoff, make_case_word(tword + sp->ts_splitoff,
(char_u *)preword + sp->ts_prewordlen, c); preword + sp->ts_prewordlen, c);
} }
if (!soundfold) { if (!soundfold) {
@@ -1482,7 +1482,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
} }
if (!spell_valid_case(su->su_badflags, if (!spell_valid_case(su->su_badflags,
captype((char_u *)preword + sp->ts_prewordlen, NULL))) { captype(preword + sp->ts_prewordlen, NULL))) {
newscore += SCORE_ICASE; newscore += SCORE_ICASE;
} }
} }
@@ -1513,10 +1513,10 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// char, e.g., "thes," -> "these". // char, e.g., "thes," -> "these".
p = fword + sp->ts_fidx; p = fword + sp->ts_fidx;
MB_PTR_BACK(fword, p); MB_PTR_BACK(fword, p);
if (!spell_iswordp((char_u *)p, curwin) && *preword != NUL) { if (!spell_iswordp(p, curwin) && *preword != NUL) {
p = preword + strlen(preword); p = preword + strlen(preword);
MB_PTR_BACK(preword, p); MB_PTR_BACK(preword, p);
if (spell_iswordp((char_u *)p, curwin)) { if (spell_iswordp(p, curwin)) {
newscore += SCORE_NONWORD; newscore += SCORE_NONWORD;
} }
} }
@@ -1536,10 +1536,10 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
if (su->su_badflags & WF_MIXCAP) { if (su->su_badflags & WF_MIXCAP) {
// We really don't know if the word should be // We really don't know if the word should be
// upper or lower case, add both. // upper or lower case, add both.
c = captype((char_u *)preword, NULL); c = captype(preword, NULL);
if (c == 0 || c == WF_ALLCAP) { if (c == 0 || c == WF_ALLCAP) {
make_case_word((char_u *)tword + sp->ts_splitoff, make_case_word(tword + sp->ts_splitoff,
(char_u *)preword + sp->ts_prewordlen, preword + sp->ts_prewordlen,
c == 0 ? WF_ALLCAP : 0); c == 0 ? WF_ALLCAP : 0);
add_suggestion(su, &su->su_ga, (char *)preword, add_suggestion(su, &su->su_ga, (char *)preword,
@@ -1678,7 +1678,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// non-word character with a space. Always skip a // non-word character with a space. Always skip a
// character when the word ends. But only when the // character when the word ends. But only when the
// good word can end. // good word can end.
if (((!try_compound && !spell_iswordp_nmw((char_u *)fword if (((!try_compound && !spell_iswordp_nmw(fword
+ sp->ts_fidx, + sp->ts_fidx,
curwin)) curwin))
|| fword_ends) || fword_ends)
@@ -1710,7 +1710,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// set su->su_badflags to the caps type at this // set su->su_badflags to the caps type at this
// position // position
n = nofold_len((char_u *)fword, sp->ts_fidx, (char_u *)su->su_badptr); n = nofold_len(fword, sp->ts_fidx, su->su_badptr);
su->su_badflags = badword_captype((char_u *)su->su_badptr + n, su->su_badflags = badword_captype((char_u *)su->su_badptr + n,
(char_u *)su->su_badptr + su->su_badlen); (char_u *)su->su_badptr + su->su_badlen);
@@ -2034,7 +2034,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
// Don't swap if the first character is not a word character. // Don't swap if the first character is not a word character.
// SWAP3 etc. also don't make sense then. // SWAP3 etc. also don't make sense then.
if (!soundfold && !spell_iswordp((char_u *)p, curwin)) { if (!soundfold && !spell_iswordp(p, curwin)) {
PROF_STORE(sp->ts_state) PROF_STORE(sp->ts_state)
sp->ts_state = STATE_REP_INI; sp->ts_state = STATE_REP_INI;
break; break;
@@ -2044,7 +2044,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
c = utf_ptr2char(p); c = utf_ptr2char(p);
if (p[n] == NUL) { if (p[n] == NUL) {
c2 = NUL; c2 = NUL;
} else if (!soundfold && !spell_iswordp((char_u *)p + n, curwin)) { } else if (!soundfold && !spell_iswordp(p + n, curwin)) {
c2 = c; // don't swap non-word char c2 = c; // don't swap non-word char
} else { } else {
c2 = utf_ptr2char(p + n); c2 = utf_ptr2char(p + n);
@@ -2104,7 +2104,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
c = utf_ptr2char(p); c = utf_ptr2char(p);
fl = utf_ptr2len(p + n); fl = utf_ptr2len(p + n);
c2 = utf_ptr2char(p + n); c2 = utf_ptr2char(p + n);
if (!soundfold && !spell_iswordp((char_u *)p + n + fl, curwin)) { if (!soundfold && !spell_iswordp(p + n + fl, curwin)) {
c3 = c; // don't swap non-word char c3 = c; // don't swap non-word char
} else { } else {
c3 = utf_ptr2char(p + n + fl); c3 = utf_ptr2char(p + n + fl);
@@ -2155,7 +2155,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
utf_char2bytes(c2, p + tl); utf_char2bytes(c2, p + tl);
p = p + tl; p = p + tl;
if (!soundfold && !spell_iswordp((char_u *)p, curwin)) { if (!soundfold && !spell_iswordp(p, curwin)) {
// Middle char is not a word char, skip the rotate. First and // Middle char is not a word char, skip the rotate. First and
// third char were already checked at swap and swap3. // third char were already checked at swap and swap3.
PROF_STORE(sp->ts_state) PROF_STORE(sp->ts_state)
@@ -2399,7 +2399,7 @@ static void find_keepcap_word(slang_T *slang, char *fword, char *kword)
int c; int c;
idx_T lo, hi, m; idx_T lo, hi, m;
char_u *p; char_u *p;
char_u *byts = slang->sl_kbyts; // array with bytes of the words char_u *byts = (char_u *)slang->sl_kbyts; // array with bytes of the words
idx_T *idxs = slang->sl_kidxs; // array with indexes idx_T *idxs = slang->sl_kidxs; // array with indexes
if (byts == NULL) { if (byts == NULL) {
@@ -2409,7 +2409,7 @@ static void find_keepcap_word(slang_T *slang, char *fword, char *kword)
} }
// Make an all-cap version of "fword". // Make an all-cap version of "fword".
allcap_copy((char_u *)fword, (char_u *)uword); allcap_copy(fword, uword);
// Each character needs to be tried both case-folded and upper-case. // Each character needs to be tried both case-folded and upper-case.
// All this gets very complicated if we keep in mind that changing case // All this gets very complicated if we keep in mind that changing case
@@ -2666,7 +2666,7 @@ static int stp_sal_score(suggest_T *stp, suginfo_T *su, slang_T *slang, char_u *
pbad = badsound; pbad = badsound;
} else { } else {
// soundfold the bad word with more characters following // soundfold the bad word with more characters following
(void)spell_casefold(curwin, (char_u *)su->su_badptr, stp->st_orglen, fword, MAXWLEN); (void)spell_casefold(curwin, su->su_badptr, stp->st_orglen, (char *)fword, MAXWLEN);
// When joining two words the sound often changes a lot. E.g., "t he" // When joining two words the sound often changes a lot. E.g., "t he"
// sounds like "t h" while "the" sounds like "@". Avoid that by // sounds like "t h" while "the" sounds like "@". Avoid that by
@@ -2851,7 +2851,7 @@ static void add_sound_suggest(suginfo_T *su, char *goodword, int score, langp_T
// previous wordnr. // previous wordnr.
orgnr += bytes2offset(&nrline); orgnr += bytes2offset(&nrline);
byts = slang->sl_fbyts; byts = (char_u *)slang->sl_fbyts;
idxs = slang->sl_fidxs; idxs = slang->sl_fidxs;
// Lookup the word "orgnr" one of the two tries. // Lookup the word "orgnr" one of the two tries.
@@ -2909,7 +2909,7 @@ badword:
flags |= su->su_badflags; flags |= su->su_badflags;
if ((flags & WF_CAPMASK) != 0) { if ((flags & WF_CAPMASK) != 0) {
// Need to fix case according to "flags". // Need to fix case according to "flags".
make_case_word(theword, cword, flags); make_case_word((char *)theword, (char *)cword, flags);
p = cword; p = cword;
} else { } else {
p = theword; p = theword;
@@ -2989,7 +2989,7 @@ static int soundfold_find(slang_T *slang, char_u *word)
idx_T *idxs; idx_T *idxs;
int wordnr = 0; int wordnr = 0;
byts = slang->sl_sbyts; byts = (char_u *)slang->sl_sbyts;
idxs = slang->sl_sidxs; idxs = slang->sl_sidxs;
for (;;) { for (;;) {

View File

@@ -3416,7 +3416,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
} }
msg_putchar(' '); msg_putchar(' ');
if (spp->sp_sync_idx >= 0) { if (spp->sp_sync_idx >= 0) {
msg_outtrans((char *)highlight_group_name(SYN_ITEMS(curwin->w_s) msg_outtrans(highlight_group_name(SYN_ITEMS(curwin->w_s)
[spp->sp_sync_idx].sp_syn.id - 1)); [spp->sp_sync_idx].sp_syn.id - 1));
} else { } else {
msg_puts("NONE"); msg_puts("NONE");
@@ -3430,7 +3430,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
(void)syn_list_header(did_header, 0, id, true); (void)syn_list_header(did_header, 0, id, true);
msg_puts_attr("links to", attr); msg_puts_attr("links to", attr);
msg_putchar(' '); msg_putchar(' ');
msg_outtrans((char *)highlight_group_name(highlight_link_id(id - 1) - 1)); msg_outtrans(highlight_group_name(highlight_link_id(id - 1) - 1));
} }
} }
@@ -3492,7 +3492,7 @@ static void put_id_list(const char *const name, const int16_t *const list, const
msg_putchar('@'); msg_putchar('@');
msg_outtrans((char *)SYN_CLSTR(curwin->w_s)[scl_id].scl_name); msg_outtrans((char *)SYN_CLSTR(curwin->w_s)[scl_id].scl_name);
} else { } else {
msg_outtrans((char *)highlight_group_name(*p - 1)); msg_outtrans(highlight_group_name(*p - 1));
} }
if (p[1]) { if (p[1]) {
msg_putchar(','); msg_putchar(',');
@@ -3514,7 +3514,7 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const
if (last_matchgroup == 0) { if (last_matchgroup == 0) {
msg_outtrans("NONE"); msg_outtrans("NONE");
} else { } else {
msg_outtrans((char *)highlight_group_name(last_matchgroup - 1)); msg_outtrans(highlight_group_name(last_matchgroup - 1));
} }
msg_putchar(' '); msg_putchar(' ');
} }
@@ -5042,7 +5042,7 @@ static int get_id_list(char **const arg, const int keylen, int16_t **const list,
regmatch.rm_ic = true; regmatch.rm_ic = true;
id = 0; id = 0;
for (int i = highlight_num_groups(); --i >= 0;) { for (int i = highlight_num_groups(); --i >= 0;) {
if (vim_regexec(&regmatch, (char *)highlight_group_name(i), (colnr_T)0)) { if (vim_regexec(&regmatch, highlight_group_name(i), (colnr_T)0)) {
if (round == 2) { if (round == 2) {
// Got more items than expected; can happen // Got more items than expected; can happen
// when adding items that match: // when adding items that match:
@@ -5677,7 +5677,7 @@ static void syntime_report(void)
msg_puts(profile_msg(p->average)); msg_puts(profile_msg(p->average));
msg_puts(" "); msg_puts(" ");
msg_advance(50); msg_advance(50);
msg_outtrans((char *)highlight_group_name(p->id - 1)); msg_outtrans(highlight_group_name(p->id - 1));
msg_puts(" "); msg_puts(" ");
msg_advance(69); msg_advance(69);