Merge pull request #19973 from dundargoc/refactor/char_u/3

refactor: replace char_u with char 3: revenge of the unsigned
This commit is contained in:
bfredl 2022-08-29 18:46:38 +02:00 committed by GitHub
commit 68efac3683
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
61 changed files with 479 additions and 499 deletions

View File

@ -202,7 +202,7 @@ static char *do_one_arg(char *str)
for (p = str; *str; str++) {
// When the backslash is used for escaping the special meaning of a
// character we need to keep it until wildcard expansion.
if (rem_backslash((char_u *)str)) {
if (rem_backslash(str)) {
*p++ = *str++;
*p++ = *str;
} else {

View File

@ -2701,7 +2701,7 @@ void buflist_list(exarg_T *eap)
home_replace(buf, buf->b_fname, (char *)NameBuff, MAXPATHL, true);
}
if (message_filtered((char_u *)NameBuff)) {
if (message_filtered(NameBuff)) {
continue;
}

View File

@ -325,7 +325,7 @@ typedef struct argentry {
* Used for the typeahead buffer: typebuf.
*/
typedef struct {
char_u *tb_buf; // buffer for typed characters
uint8_t *tb_buf; // buffer for typed characters
uint8_t *tb_noremap; // mapping flags for characters in tb_buf[]
int tb_buflen; // size of tb_buf[]
int tb_off; // current position in tb_buf[]
@ -353,7 +353,7 @@ typedef struct {
typedef struct mapblock mapblock_T;
struct mapblock {
mapblock_T *m_next; // next mapblock in list
char_u *m_keys; // mapped from, lhs
uint8_t *m_keys; // mapped from, lhs
char *m_str; // mapped to, rhs
char *m_orig_str; // rhs as entered by the user
LuaRef m_luaref; // lua function reference as rhs
@ -703,7 +703,7 @@ struct file_buffer {
char *b_p_cms; ///< 'commentstring'
char *b_p_cpt; ///< 'complete'
#ifdef BACKSLASH_IN_FILENAME
char_u *b_p_csl; ///< 'completeslash'
char *b_p_csl; ///< 'completeslash'
#endif
char *b_p_cfu; ///< 'completefunc'
char *b_p_ofu; ///< 'omnifunc'

View File

@ -589,17 +589,17 @@ bool file_ff_differs(buf_T *buf, bool ignore_empty)
/// Handles Replace mode and multi-byte characters.
void ins_bytes(char *p)
{
ins_bytes_len((char_u *)p, STRLEN(p));
ins_bytes_len(p, STRLEN(p));
}
/// Insert string "p" with length "len" at the cursor position.
/// Handles Replace mode and multi-byte characters.
void ins_bytes_len(char_u *p, size_t len)
void ins_bytes_len(char *p, size_t len)
{
size_t n;
for (size_t i = 0; i < len; i += n) {
// avoid reading past p[len]
n = (size_t)utfc_ptr2len_len(p + i, (int)(len - i));
n = (size_t)utfc_ptr2len_len((char_u *)p + i, (int)(len - i));
ins_char_bytes(p + i, n);
}
}
@ -611,18 +611,18 @@ void ins_bytes_len(char_u *p, size_t len)
/// convert bytes to a character.
void ins_char(int c)
{
char_u buf[MB_MAXBYTES + 1];
size_t n = (size_t)utf_char2bytes(c, (char *)buf);
char buf[MB_MAXBYTES + 1];
size_t n = (size_t)utf_char2bytes(c, buf);
// When "c" is 0x100, 0x200, etc. we don't want to insert a NUL byte.
// Happens for CTRL-Vu9900.
if (buf[0] == 0) {
buf[0] = '\n';
}
ins_char_bytes((char_u *)buf, n);
ins_char_bytes(buf, n);
}
void ins_char_bytes(char_u *buf, size_t charlen)
void ins_char_bytes(char *buf, size_t charlen)
{
// Break tabs if needed.
if (virtual_active() && curwin->w_cursor.coladd > 0) {
@ -631,7 +631,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
size_t col = (size_t)curwin->w_cursor.col;
linenr_T lnum = curwin->w_cursor.lnum;
char_u *oldp = ml_get(lnum);
char *oldp = (char *)ml_get(lnum);
size_t linelen = STRLEN(oldp) + 1; // length of old line including NUL
// The lengths default to the values for when not replacing.
@ -661,7 +661,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
if (vcol > new_vcol && oldp[col + oldlen] == TAB) {
break;
}
oldlen += (size_t)utfc_ptr2len((char *)oldp + col + oldlen);
oldlen += (size_t)utfc_ptr2len(oldp + col + oldlen);
// Deleted a bit too much, insert spaces.
if (vcol > new_vcol) {
newlen += (size_t)(vcol - new_vcol);
@ -670,7 +670,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
curwin->w_p_list = old_list;
} else if (oldp[col] != NUL) {
// normal replace
oldlen = (size_t)utfc_ptr2len((char *)oldp + col);
oldlen = (size_t)utfc_ptr2len(oldp + col);
}
// Push the replaced bytes onto the replace stack, so that they can be
@ -683,7 +683,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
}
}
char_u *newp = xmalloc(linelen + newlen - oldlen);
char *newp = xmalloc(linelen + newlen - oldlen);
// Copy bytes before the cursor.
if (col > 0) {
@ -691,7 +691,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
}
// Copy bytes after the changed character(s).
char_u *p = newp + col;
char *p = newp + col;
if (linelen > col + oldlen) {
memmove(p + newlen, oldp + col + oldlen,
(size_t)(linelen - col - oldlen));
@ -706,7 +706,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
}
// Replace the line in the buffer.
ml_replace(lnum, (char *)newp, false);
ml_replace(lnum, newp, false);
// mark the buffer as changed and prepare for displaying
inserted_bytes(lnum, (colnr_T)col, (int)oldlen, (int)newlen);
@ -716,7 +716,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
if (p_sm && (State & MODE_INSERT)
&& msg_silent == 0
&& !ins_compl_active()) {
showmatch(utf_ptr2char((char *)buf));
showmatch(utf_ptr2char(buf));
}
if (!p_ri || (State & REPLACE_FLAG)) {
@ -729,7 +729,7 @@ void ins_char_bytes(char_u *buf, size_t charlen)
/// Insert a string at the cursor position.
/// Note: Does NOT handle Replace mode.
/// Caller must have prepared for undo.
void ins_str(char_u *s)
void ins_str(char *s)
{
int newlen = (int)STRLEN(s);
linenr_T lnum = curwin->w_cursor.lnum;
@ -739,10 +739,10 @@ void ins_str(char_u *s)
}
colnr_T col = curwin->w_cursor.col;
char_u *oldp = ml_get(lnum);
char *oldp = (char *)ml_get(lnum);
int oldlen = (int)STRLEN(oldp);
char_u *newp = (char_u *)xmalloc((size_t)oldlen + (size_t)newlen + 1);
char *newp = xmalloc((size_t)oldlen + (size_t)newlen + 1);
if (col > 0) {
memmove(newp, oldp, (size_t)col);
}
@ -750,7 +750,7 @@ void ins_str(char_u *s)
int bytes = oldlen - col + 1;
assert(bytes >= 0);
memmove(newp + col + newlen, oldp + col, (size_t)bytes);
ml_replace(lnum, (char *)newp, false);
ml_replace(lnum, newp, false);
inserted_bytes(lnum, col, 0, newlen);
curwin->w_cursor.col += newlen;
}
@ -774,9 +774,9 @@ int del_char(bool fixpos)
int del_chars(long count, int fixpos)
{
int bytes = 0;
char_u *p = get_cursor_pos_ptr();
char *p = (char *)get_cursor_pos_ptr();
for (long i = 0; i < count && *p != NUL; i++) {
int l = utfc_ptr2len((char *)p);
int l = utfc_ptr2len(p);
bytes += l;
p += l;
}
@ -797,7 +797,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
linenr_T lnum = curwin->w_cursor.lnum;
colnr_T col = curwin->w_cursor.col;
bool fixpos = fixpos_arg;
char_u *oldp = ml_get(lnum);
char *oldp = (char *)ml_get(lnum);
colnr_T oldlen = (colnr_T)STRLEN(oldp);
// Can't do anything when the cursor is on the NUL after the line.
@ -817,7 +817,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
// If 'delcombine' is set and deleting (less than) one character, only
// delete the last combining character.
if (p_deco && use_delcombine
&& utfc_ptr2len((char *)oldp + col) >= count) {
&& utfc_ptr2len(oldp + col) >= count) {
int cc[MAX_MCO];
(void)utfc_ptr2char(oldp + col, cc);
@ -826,9 +826,9 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
int n = col;
do {
col = n;
count = utf_ptr2len((char *)oldp + n);
count = utf_ptr2len(oldp + n);
n += count;
} while (utf_composinglike(oldp + col, oldp + n));
} while (utf_composinglike((char_u *)oldp + col, (char_u *)oldp + n));
fixpos = false;
}
}
@ -843,7 +843,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
&& (get_ve_flags() & VE_ONEMORE) == 0) {
curwin->w_cursor.col--;
curwin->w_cursor.coladd = 0;
curwin->w_cursor.col -= utf_head_off(oldp, oldp + curwin->w_cursor.col);
curwin->w_cursor.col -= utf_head_off((char_u *)oldp, (char_u *)oldp + curwin->w_cursor.col);
}
count = oldlen - col;
movelen = 1;
@ -852,7 +852,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
// If the old line has been allocated the deletion can be done in the
// existing line. Otherwise a new line has to be allocated.
bool was_alloced = ml_line_alloced(); // check if oldp was allocated
char_u *newp;
char *newp;
if (was_alloced) {
ml_add_deleted_len(curbuf->b_ml.ml_line_ptr, oldlen);
newp = oldp; // use same allocated memory
@ -862,7 +862,7 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
}
memmove(newp + col, oldp + col + count, (size_t)movelen);
if (!was_alloced) {
ml_replace(lnum, (char *)newp, false);
ml_replace(lnum, newp, false);
}
// mark the buffer as changed and prepare for displaying
@ -874,10 +874,10 @@ int del_bytes(colnr_T count, bool fixpos_arg, bool use_delcombine)
/// Copy the indent from ptr to the current line (and fill to size).
/// Leaves the cursor on the first non-blank in the line.
/// @return true if the line was changed.
int copy_indent(int size, char_u *src)
int copy_indent(int size, char *src)
{
char_u *p = NULL;
char_u *line = NULL;
char *p = NULL;
char *line = NULL;
int ind_len;
int line_len = 0;
int tab_pad;
@ -889,7 +889,7 @@ int copy_indent(int size, char_u *src)
ind_len = 0;
int ind_done = 0;
int ind_col = 0;
char_u *s = src;
char *s = src;
// Count/copy the usable portion of the source line.
while (todo > 0 && ascii_iswhite(*s)) {
@ -975,7 +975,7 @@ int copy_indent(int size, char_u *src)
memmove(p, get_cursor_line_ptr(), (size_t)line_len);
// Replace the line
ml_replace(curwin->w_cursor.lnum, (char *)line, false);
ml_replace(curwin->w_cursor.lnum, line, false);
// Put the cursor after the indent.
curwin->w_cursor.col = ind_len;
@ -1006,8 +1006,8 @@ int copy_indent(int size, char_u *src)
/// @return true on success, false on failure
int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
{
char_u *next_line = NULL; // copy of the next line
char_u *p_extra = NULL; // what goes to next line
char *next_line = NULL; // copy of the next line
char *p_extra = NULL; // what goes to next line
colnr_T less_cols = 0; // less columns for mark in new line
colnr_T less_cols_off = 0; // columns to skip for mark adjust
pos_T old_cursor; // old cursor position
@ -1020,9 +1020,9 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
int comment_start = 0; // start index of the comment leader
char *lead_flags; // position in 'comments' for comment leader
char *leader = NULL; // copy of comment leader
char_u *allocated = NULL; // allocated memory
char *allocated = NULL; // allocated memory
char *p;
char_u saved_char = NUL; // init for GCC
char saved_char = NUL; // init for GCC
pos_T *pos;
bool do_si = may_do_si();
bool do_cindent;
@ -1036,7 +1036,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
colnr_T mincol = curwin->w_cursor.col + 1;
// make a copy of the current line so we can mess with it
char_u *saved_line = vim_strsave(get_cursor_line_ptr());
char *saved_line = (char *)vim_strsave(get_cursor_line_ptr());
if (State & VREPLACE_FLAG) {
// With MODE_VREPLACE we make a copy of the next line, which we will be
@ -1047,9 +1047,9 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// the line, replacing what was there before and pushing the right
// stuff onto the replace stack. -- webb.
if (curwin->w_cursor.lnum < orig_line_count) {
next_line = vim_strsave(ml_get(curwin->w_cursor.lnum + 1));
next_line = (char *)vim_strsave(ml_get(curwin->w_cursor.lnum + 1));
} else {
next_line = vim_strsave((char_u *)"");
next_line = xstrdup("");
}
// In MODE_VREPLACE state, a NL replaces the rest of the line, and
@ -1059,9 +1059,9 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// autoindent etc) a bit later.
replace_push(NUL); // Call twice because BS over NL expects it
replace_push(NUL);
p = (char *)saved_line + curwin->w_cursor.col;
p = saved_line + curwin->w_cursor.col;
while (*p != NUL) {
p += replace_push_mb((char_u *)p);
p += replace_push_mb(p);
}
saved_line[curwin->w_cursor.col] = NUL;
}
@ -1069,7 +1069,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if ((State & MODE_INSERT) && (State & VREPLACE_FLAG) == 0) {
p_extra = saved_line + curwin->w_cursor.col;
if (do_si) { // need first char after new line break
p = skipwhite((char *)p_extra);
p = skipwhite(p_extra);
first_char = (unsigned char)(*p);
}
extra_len = (int)STRLEN(p_extra);
@ -1109,7 +1109,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
char *ptr;
old_cursor = curwin->w_cursor;
ptr = (char *)saved_line;
ptr = saved_line;
if (flags & OPENLINE_DO_COM) {
lead_len = get_leader_len(ptr, NULL, false, true);
} else {
@ -1193,7 +1193,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Don't do this if the previous line ended in ';' or
// '}'.
} else if (last_char != ';' && last_char != '}'
&& cin_is_cinword((char_u *)ptr)) {
&& cin_is_cinword(ptr)) {
did_si = true;
}
}
@ -1243,13 +1243,13 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// This may then be inserted in front of the new line.
end_comment_pending = NUL;
if (flags & OPENLINE_DO_COM) {
lead_len = get_leader_len((char *)saved_line, &lead_flags, dir == BACKWARD, true);
lead_len = get_leader_len(saved_line, &lead_flags, dir == BACKWARD, true);
if (lead_len == 0 && curbuf->b_p_cin && do_cindent && dir == FORWARD
&& (!has_format_option(FO_NO_OPEN_COMS) || (flags & OPENLINE_FORMAT))) {
// Check for a line comment after code.
comment_start = check_linecomment(saved_line);
if (comment_start != MAXCOL) {
lead_len = get_leader_len((char *)saved_line + comment_start, &lead_flags, false, true);
lead_len = get_leader_len(saved_line + comment_start, &lead_flags, false, true);
if (lead_len != 0) {
lead_len += comment_start;
if (did_do_comment != NULL) {
@ -1264,13 +1264,13 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (lead_len > 0) {
char *lead_repl = NULL; // replaces comment leader
int lead_repl_len = 0; // length of *lead_repl
char_u lead_middle[COM_MAX_LEN]; // middle-comment string
char_u lead_end[COM_MAX_LEN]; // end-comment string
char_u *comment_end = NULL; // where lead_end has been found
char lead_middle[COM_MAX_LEN]; // middle-comment string
char lead_end[COM_MAX_LEN]; // end-comment string
char *comment_end = NULL; // where lead_end has been found
int extra_space = false; // append extra space
int current_flag;
int require_blank = false; // requires blank after middle
char_u *p2;
char *p2;
// If the comment leader has the start, middle or end flag, it may not
// be used or may be replaced with the middle leader.
@ -1312,15 +1312,15 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
size_t n = copy_option_part(&p, (char *)lead_end, COM_MAX_LEN, ",");
if (end_comment_pending == -1) { // we can set it now
end_comment_pending = lead_end[n - 1];
end_comment_pending = (unsigned char)lead_end[n - 1];
}
// If the end of the comment is in the same line, don't use
// the comment leader.
if (dir == FORWARD) {
for (p = (char *)saved_line + lead_len; *p; p++) {
for (p = saved_line + lead_len; *p; p++) {
if (STRNCMP(p, lead_end, n) == 0) {
comment_end = (char_u *)p;
comment_end = p;
lead_len = 0;
break;
}
@ -1353,7 +1353,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 = (char_u *)skipwhite((char *)saved_line);
comment_end = skipwhite(saved_line);
lead_len = 0;
break;
}
@ -1372,7 +1372,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
extra_space = true;
// Check whether we allow automatic ending of comments
for (p2 = (char_u *)p; *p2 && *p2 != ':'; p2++) {
for (p2 = p; *p2 && *p2 != ':'; p2++) {
if (*p2 == COM_AUTO_END) {
end_comment_pending = -1; // means we want to set it
}
@ -1382,7 +1382,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while (*p2 && *p2 != ',') {
p2++;
}
end_comment_pending = p2[-1];
end_comment_pending = (unsigned char)p2[-1];
}
break;
}
@ -1408,7 +1408,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
+ 1;
assert(bytes >= 0);
leader = xmalloc((size_t)bytes);
allocated = (char_u *)leader; // remember to free it later
allocated = leader; // remember to free it later
STRLCPY(leader, saved_line, lead_len + 1);
@ -1442,7 +1442,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Compute the length of the replaced characters in
// screen characters, not bytes.
{
int repl_size = vim_strnsize((char_u *)lead_repl, lead_repl_len);
int repl_size = vim_strnsize(lead_repl, lead_repl_len);
int old_size = 0;
char *endp = p;
int l;
@ -1487,13 +1487,13 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// screen characters, not bytes. Move the part that is
// not to be overwritten.
{
int repl_size = vim_strnsize((char_u *)lead_repl, lead_repl_len);
int repl_size = vim_strnsize(lead_repl, lead_repl_len);
int i;
int l;
for (i = 0; i < lead_len && p[i] != NUL; i += l) {
l = utfc_ptr2len(p + i);
if (vim_strnsize((char_u *)p, i + l) > repl_size) {
if (vim_strnsize(p, i + l) > repl_size) {
break;
}
}
@ -1536,7 +1536,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// Recompute the indent, it may have changed.
if (curbuf->b_p_ai || do_si) {
newindent = get_indent_str_vtab((char_u *)leader,
newindent = get_indent_str_vtab(leader,
curbuf->b_p_ts,
curbuf->b_p_vts_array, false);
}
@ -1619,7 +1619,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
if (curbuf->b_p_ai || (flags & OPENLINE_DELSPACES)) {
while ((*p_extra == ' ' || *p_extra == '\t')
&& !utf_iscomposing(utf_ptr2char((char *)p_extra + 1))) {
&& !utf_iscomposing(utf_ptr2char(p_extra + 1))) {
if (REPLACE_NORMAL(State)) {
replace_push(*p_extra);
}
@ -1633,7 +1633,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
if (p_extra == NULL) {
p_extra = (char_u *)""; // append empty line
p_extra = ""; // append empty line
}
// concatenate leader and p_extra, if there is a leader
@ -1653,7 +1653,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
}
}
STRCAT(leader, p_extra);
p_extra = (char_u *)leader;
p_extra = leader;
did_ai = true; // So truncating blanks works with comments
less_cols -= lead_len;
} else {
@ -1666,7 +1666,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
curwin->w_cursor.lnum--;
}
if ((State & VREPLACE_FLAG) == 0 || old_cursor.lnum >= orig_line_count) {
if (ml_append(curwin->w_cursor.lnum, (char *)p_extra, (colnr_T)0, false) == FAIL) {
if (ml_append(curwin->w_cursor.lnum, p_extra, (colnr_T)0, false) == FAIL) {
goto theend;
}
// Postpone calling changed_lines(), because it would mess up folding
@ -1688,7 +1688,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
(void)u_save_cursor(); // errors are ignored!
vr_lines_changed++;
}
ml_replace(curwin->w_cursor.lnum, (char *)p_extra, true);
ml_replace(curwin->w_cursor.lnum, p_extra, true);
changed_bytes(curwin->w_cursor.lnum, 0);
// TODO(vigoux): extmark_splice_cols here??
curwin->w_cursor.lnum--;
@ -1753,7 +1753,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (trunc_line && !(flags & OPENLINE_KEEPTRAIL)) {
truncate_spaces(saved_line);
}
ml_replace(curwin->w_cursor.lnum, (char *)saved_line, false);
ml_replace(curwin->w_cursor.lnum, saved_line, false);
int new_len = (int)STRLEN(saved_line);
@ -1838,15 +1838,15 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
// stuff onto the replace stack (via ins_char()).
if (State & VREPLACE_FLAG) {
// Put new line in p_extra
p_extra = vim_strsave(get_cursor_line_ptr());
p_extra = (char *)vim_strsave(get_cursor_line_ptr());
// Put back original line
ml_replace(curwin->w_cursor.lnum, (char *)next_line, false);
ml_replace(curwin->w_cursor.lnum, next_line, false);
// Insert new stuff into line again
curwin->w_cursor.col = 0;
curwin->w_cursor.coladd = 0;
ins_bytes((char *)p_extra); // will call changed_bytes()
ins_bytes(p_extra); // will call changed_bytes()
xfree(p_extra);
next_line = NULL;
}

View File

@ -313,7 +313,7 @@ size_t transstr_len(const char *const s, bool untab)
const size_t l = (size_t)utfc_ptr2len(p);
if (l > 1) {
int pcc[MAX_MCO + 1];
pcc[0] = utfc_ptr2char((const char_u *)p, &pcc[1]);
pcc[0] = utfc_ptr2char(p, &pcc[1]);
if (vim_isprintc(pcc[0])) {
len += l;
@ -359,7 +359,7 @@ size_t transstr_buf(const char *const s, char *const buf, const size_t len, bool
break; // Exceeded `buf` size.
}
int pcc[MAX_MCO + 1];
pcc[0] = utfc_ptr2char((const char_u *)p, &pcc[1]);
pcc[0] = utfc_ptr2char(p, &pcc[1]);
if (vim_isprintc(pcc[0])) {
memmove(buf_p, p, l);
@ -709,7 +709,7 @@ int ptr2cells(const char *p_in)
/// @return number of character cells.
int vim_strsize(char *s)
{
return vim_strnsize((char_u *)s, MAXCOL);
return vim_strnsize(s, MAXCOL);
}
/// Return the number of character cells string "s[len]" will take on the
@ -721,13 +721,13 @@ int vim_strsize(char *s)
/// @param len
///
/// @return Number of character cells.
int vim_strnsize(char_u *s, int len)
int vim_strnsize(char *s, int len)
{
assert(s != NULL);
int size = 0;
while (*s != NUL && --len >= 0) {
int l = utfc_ptr2len((char *)s);
size += ptr2cells((char *)s);
int l = utfc_ptr2len(s);
size += ptr2cells(s);
s += l;
len -= l - 1;
}
@ -1687,12 +1687,12 @@ int hexhex2nr(const char_u *p)
/// characters.
///
/// @param str file path string to check
bool rem_backslash(const char_u *str)
bool rem_backslash(const char *str)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
#ifdef BACKSLASH_IN_FILENAME
return str[0] == '\\'
&& str[1] < 0x80
&& (uint8_t)str[1] < 0x80
&& (str[1] == ' '
|| (str[1] != NUL
&& str[1] != '*'
@ -1710,7 +1710,7 @@ bool rem_backslash(const char_u *str)
void backslash_halve(char_u *p)
{
for (; *p; p++) {
if (rem_backslash(p)) {
if (rem_backslash((char *)p)) {
STRMOVE(p, p + 1);
}
}

View File

@ -787,7 +787,7 @@ static bool expand_showtail(expand_T *xp)
for (s = (char_u *)xp->xp_pattern; s < end; s++) {
// Skip escaped wildcards. Only when the backslash is not a path
// separator, on DOS the '*' "path\*\file" must not be skipped.
if (rem_backslash(s)) {
if (rem_backslash((char *)s)) {
s++;
} else if (vim_strchr("*?[", *s) != NULL) {
return false;
@ -1242,11 +1242,10 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
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),
p_magic, NULL);
arg = (const char *)skip_regexp((char *)arg + 1, (uint8_t)(*arg), p_magic, NULL);
}
}
return (const char *)find_nextcmd((char_u *)arg);
return (const char *)find_nextcmd(arg);
// All completion for the +cmdline_compl feature goes here.
@ -1282,7 +1281,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, cons
if (delim) {
// Skip "from" part.
arg++;
arg = (const char *)skip_regexp((char_u *)arg, delim, p_magic, NULL);
arg = (const char *)skip_regexp((char *)arg, delim, p_magic, NULL);
}
// Skip "to" part.
while (arg[0] != NUL && (uint8_t)arg[0] != delim) {

View File

@ -47,7 +47,7 @@ struct debuggy {
/// Debug mode. Repeatedly get Ex commands, until told to continue normal
/// execution.
void do_debug(char_u *cmd)
void do_debug(char *cmd)
{
int save_msg_scroll = msg_scroll;
int save_State = State;
@ -239,11 +239,11 @@ void do_debug(char_u *cmd)
last_cmd = CMD_STEP;
break;
case CMD_BACKTRACE:
do_showbacktrace(cmd);
do_showbacktrace((char_u *)cmd);
continue;
case CMD_FRAME:
if (*p == NUL) {
do_showbacktrace(cmd);
do_showbacktrace((char_u *)cmd);
} else {
p = skipwhite(p);
do_setdebugtracelevel((char_u *)p);
@ -414,7 +414,7 @@ void dbg_check_breakpoint(exarg_T *eap)
debug_breakpoint_name + (*p == NUL ? 0 : 3),
(int64_t)debug_breakpoint_lnum);
debug_breakpoint_name = NULL;
do_debug((char_u *)eap->cmd);
do_debug(eap->cmd);
} else {
debug_skipped = true;
debug_skipped_name = debug_breakpoint_name;
@ -422,7 +422,7 @@ void dbg_check_breakpoint(exarg_T *eap)
}
} else if (ex_nesting_level <= debug_break_level) {
if (!eap->skip) {
do_debug((char_u *)eap->cmd);
do_debug(eap->cmd);
} else {
debug_skipped = true;
debug_skipped_name = NULL;

View File

@ -573,9 +573,9 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
if (dir == BACKWARD) {
off_org = dp->df_count[i_org] - 1;
}
char_u *line_org = vim_strsave(ml_get_buf(tp->tp_diffbuf[i_org],
dp->df_lnum[i_org] + off_org,
false));
char *line_org = (char *)vim_strsave(ml_get_buf(tp->tp_diffbuf[i_org],
dp->df_lnum[i_org] + off_org,
false));
int i_new;
for (i_new = i_org + 1; i_new < DB_COUNT; i_new++) {
@ -592,9 +592,9 @@ static void diff_check_unchanged(tabpage_T *tp, diff_T *dp)
break;
}
if (diff_cmp(line_org, ml_get_buf(tp->tp_diffbuf[i_new],
dp->df_lnum[i_new] + off_new,
false)) != 0) {
if (diff_cmp((char_u *)line_org, ml_get_buf(tp->tp_diffbuf[i_new],
dp->df_lnum[i_new] + off_new,
false)) != 0) {
break;
}
}
@ -1539,8 +1539,8 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
diff_T *dp = curtab->tp_first_diff;
diff_T *dn, *dpl;
diffout_T *dout = &dio->dio_diff;
char_u linebuf[LBUFLEN]; // only need to hold the diff line
char_u *line;
char linebuf[LBUFLEN]; // only need to hold the diff line
char *line;
linenr_T off;
int i;
int notset = true; // block "*dp" not set yet
@ -1576,9 +1576,9 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
if (line_idx >= dout->dout_ga.ga_len) {
break; // did last line
}
line = ((char_u **)dout->dout_ga.ga_data)[line_idx++];
line = ((char **)dout->dout_ga.ga_data)[line_idx++];
} else {
if (vim_fgets(linebuf, LBUFLEN, fd)) {
if (vim_fgets((char_u *)linebuf, LBUFLEN, fd)) {
break; // end of file
}
line = linebuf;
@ -1600,9 +1600,9 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
} else if ((STRNCMP(line, "@@ ", 3) == 0)) {
diffstyle = DIFF_UNIFIED;
} else if ((STRNCMP(line, "--- ", 4) == 0) // -V501
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501
&& (vim_fgets((char_u *)linebuf, LBUFLEN, fd) == 0) // -V501
&& (STRNCMP(line, "+++ ", 4) == 0)
&& (vim_fgets(linebuf, LBUFLEN, fd) == 0) // -V501
&& (vim_fgets((char_u *)linebuf, LBUFLEN, fd) == 0) // -V501
&& (STRNCMP(line, "@@ ", 3) == 0)) {
diffstyle = DIFF_UNIFIED;
} else {
@ -1616,7 +1616,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
if (!isdigit(*line)) {
continue; // not the start of a diff block
}
if (parse_diff_ed(line, hunk) == FAIL) {
if (parse_diff_ed((char_u *)line, hunk) == FAIL) {
continue;
}
} else {
@ -1624,7 +1624,7 @@ static void diff_read(int idx_orig, int idx_new, diffio_T *dio)
if (STRNCMP(line, "@@ ", 3) != 0) {
continue; // not the start of a diff block
}
if (parse_diff_unified(line, hunk) == FAIL) {
if (parse_diff_unified((char_u *)line, hunk) == FAIL) {
continue;
}
}
@ -1920,11 +1920,11 @@ static bool diff_equal_entry(diff_T *dp, int idx1, int idx2)
}
for (int i = 0; i < dp->df_count[idx1]; i++) {
char_u *line = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx1],
dp->df_lnum[idx1] + i, false));
char *line = (char *)vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx1],
dp->df_lnum[idx1] + i, false));
int cmp = diff_cmp(line, ml_get_buf(curtab->tp_diffbuf[idx2],
dp->df_lnum[idx2] + i, false));
int cmp = diff_cmp((char_u *)line, ml_get_buf(curtab->tp_diffbuf[idx2],
dp->df_lnum[idx2] + i, false));
xfree(line);
if (cmp != 0) {
@ -2281,7 +2281,7 @@ bool diffopt_filler(void)
bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
char_u *line_new;
char *line_new;
int si_org;
int si_new;
int ei_org;
@ -2290,7 +2290,7 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
int l;
// Make a copy of the line, the next ml_get() will invalidate it.
char_u *line_org = vim_strsave(ml_get_buf(wp->w_buffer, lnum, false));
char *line_org = (char *)vim_strsave(ml_get_buf(wp->w_buffer, lnum, false));
int idx = diff_buf_idx(wp->w_buffer);
if (idx == DB_COUNT) {
@ -2322,8 +2322,8 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
continue;
}
added = false;
line_new = ml_get_buf(curtab->tp_diffbuf[i],
dp->df_lnum[i] + off, false);
line_new = (char *)ml_get_buf(curtab->tp_diffbuf[i],
dp->df_lnum[i] + off, false);
// Search for start of difference
si_org = si_new = 0;
@ -2335,10 +2335,10 @@ 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)((char_u *)skipwhite((char *)line_org + si_org) - line_org);
si_new = (int)((char_u *)skipwhite((char *)line_new + si_new) - line_new);
si_org = (int)(skipwhite(line_org + si_org) - line_org);
si_new = (int)(skipwhite(line_new + si_new) - line_new);
} else {
if (!diff_equal_char(line_org + si_org, line_new + si_new, &l)) {
if (!diff_equal_char((char_u *)line_org + si_org, (char_u *)line_new + si_new, &l)) {
break;
}
si_org += l;
@ -2348,8 +2348,8 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
// Move back to first byte of character in both lines (may
// have "nn^" in line_org and "n^ in line_new).
si_org -= utf_head_off(line_org, line_org + si_org);
si_new -= utf_head_off(line_new, line_new + si_new);
si_org -= utf_head_off((char_u *)line_org, (char_u *)line_org + si_org);
si_new -= utf_head_off((char_u *)line_new, (char_u *)line_new + si_new);
if (*startp > si_org) {
*startp = si_org;
@ -2378,11 +2378,11 @@ bool diff_find_change(win_T *wp, linenr_T lnum, int *startp, int *endp)
ei_new--;
}
} else {
const char_u *p1 = line_org + ei_org;
const char_u *p2 = line_new + ei_new;
const char_u *p1 = (char_u *)line_org + ei_org;
const char_u *p2 = (char_u *)line_new + ei_new;
p1 -= utf_head_off(line_org, p1);
p2 -= utf_head_off(line_new, p2);
p1 -= utf_head_off((char_u *)line_org, p1);
p2 -= utf_head_off((char_u *)line_new, p2);
if (!diff_equal_char(p1, p2, &l)) {
break;
@ -2511,7 +2511,7 @@ void ex_diffgetput(exarg_T *eap)
diff_T *dfree;
int i;
int added;
char_u *p;
char *p;
aco_save_T aco;
buf_T *buf;
linenr_T start_skip;
@ -2565,18 +2565,18 @@ void ex_diffgetput(exarg_T *eap)
}
} else {
// Buffer number or pattern given. Ignore trailing white space.
p = (char_u *)eap->arg + STRLEN(eap->arg);
while (p > (char_u *)eap->arg && ascii_iswhite(p[-1])) {
p = eap->arg + STRLEN(eap->arg);
while (p > eap->arg && ascii_iswhite(p[-1])) {
p--;
}
for (i = 0; ascii_isdigit(eap->arg[i]) && (char_u *)eap->arg + i < p; i++) {}
for (i = 0; ascii_isdigit(eap->arg[i]) && eap->arg + i < p; i++) {}
if ((char_u *)eap->arg + i == p) {
if (eap->arg + i == p) {
// digits only
i = (int)atol(eap->arg);
} else {
i = buflist_findpat(eap->arg, (char *)p, false, true, false);
i = buflist_findpat(eap->arg, p, false, true, false);
if (i < 0) {
// error message already given
@ -2718,8 +2718,8 @@ void ex_diffgetput(exarg_T *eap)
if (nr > curtab->tp_diffbuf[idx_from]->b_ml.ml_line_count) {
break;
}
p = vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from], nr, false));
ml_append(lnum + i - 1, (char *)p, 0, false);
p = (char *)vim_strsave(ml_get_buf(curtab->tp_diffbuf[idx_from], nr, false));
ml_append(lnum + i - 1, p, 0, false);
xfree(p);
added++;
if (buf_empty && (curbuf->b_ml.ml_line_count == 2)) {

View File

@ -116,7 +116,7 @@ static int line_putchar(buf_T *buf, LineState *s, schar_T *dest, int maxcells, b
if (cells > maxcells) {
return -1;
}
u8c = utfc_ptr2char(p, u8cc);
u8c = utfc_ptr2char((char *)p, u8cc);
if (*p == TAB) {
cells = MIN(tabstop_padding(vcol, buf->b_p_ts, buf->b_p_vts_array), maxcells);
for (int c = 0; c < cells; c++) {
@ -141,7 +141,7 @@ static int line_putchar(buf_T *buf, LineState *s, schar_T *dest, int maxcells, b
nc = utf_ptr2char((char *)p + c_len);
s->prev_c1 = u8cc[0];
} else {
pc = utfc_ptr2char(p + c_len, pcc);
pc = utfc_ptr2char((char *)p + c_len, pcc);
nc = s->prev_c;
pc1 = pcc[0];
}
@ -1489,7 +1489,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
if (mb_l > n_extra) {
mb_l = 1;
} else if (mb_l > 1) {
mb_c = utfc_ptr2char(p_extra, u8cc);
mb_c = utfc_ptr2char((char *)p_extra, u8cc);
mb_utf8 = true;
c = 0xc0;
}
@ -1540,7 +1540,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
mb_l = utfc_ptr2len((char *)ptr);
mb_utf8 = false;
if (mb_l > 1) {
mb_c = utfc_ptr2char(ptr, u8cc);
mb_c = utfc_ptr2char((char *)ptr, u8cc);
// Overlong encoded ASCII or ASCII with composing char
// is displayed normally, except a NUL.
if (mb_c < 0x80) {
@ -1598,7 +1598,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, bool nochange,
nc = utf_ptr2char((char *)ptr + mb_l);
prev_c1 = u8cc[0];
} else {
pc = utfc_ptr2char(ptr + mb_l, pcc);
pc = utfc_ptr2char((char *)ptr + mb_l, pcc);
nc = prev_c;
pc1 = pcc[0];
}

View File

@ -1889,7 +1889,7 @@ win_update_start:
int scr_row = wp->w_grid.rows - 1;
// Last line isn't finished: Display "@@@" in the last screen line.
grid_puts_len(&wp->w_grid, (char_u *)"@@", MIN(wp->w_grid.cols, 2), scr_row, 0, at_attr);
grid_puts_len(&wp->w_grid, "@@", MIN(wp->w_grid.cols, 2), scr_row, 0, at_attr);
grid_fill(&wp->w_grid, scr_row, scr_row + 1, 2, wp->w_grid.cols,
'@', ' ', at_attr);

View File

@ -1523,8 +1523,7 @@ void edit_unputchar(void)
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) {
redrawWinline(curwin, curwin->w_cursor.lnum);
} else {
grid_puts(&curwin->w_grid, pc_bytes, pc_row - msg_scrolled, pc_col,
pc_attr);
grid_puts(&curwin->w_grid, (char *)pc_bytes, pc_row - msg_scrolled, pc_col, pc_attr);
}
}
}
@ -1698,7 +1697,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
ptr = xmallocz(i);
memset(ptr, ' ', i);
new_cursor_col += (int)i;
ins_str(ptr);
ins_str((char *)ptr);
xfree(ptr);
}
@ -1797,7 +1796,7 @@ void change_indent(int type, int amount, int round, int replaced, int call_chang
/// Truncate the space at the end of a line. This is to be used only in an
/// insert mode. It handles fixing the replace stack for MODE_REPLACE and
/// MODE_VREPLACE modes.
void truncate_spaces(char_u *line)
void truncate_spaces(char *line)
{
int i;
@ -1989,7 +1988,7 @@ static void insert_special(int c, int allow_modmask, int ctrlv)
return;
}
p[len - 1] = NUL;
ins_str(p);
ins_str((char *)p);
AppendToRedobuffLit((char *)p, -1);
ctrlv = false;
}
@ -2117,7 +2116,7 @@ void insertchar(int c, int flags, int second_indent)
// Insert the end-comment string, except for the last
// character, which will get inserted as normal later.
ins_bytes_len(lead_end, (size_t)(end_len - 1));
ins_bytes_len((char *)lead_end, (size_t)(end_len - 1));
}
}
}
@ -2177,7 +2176,7 @@ void insertchar(int c, int flags, int second_indent)
do_digraph(-1); // clear digraphs
do_digraph(buf[i - 1]); // may be the start of a digraph
buf[i] = NUL;
ins_str(buf);
ins_str((char *)buf);
if (flags & INSCHAR_CTRLV) {
redo_literal(*buf);
i = 1;
@ -2195,7 +2194,7 @@ void insertchar(int c, int flags, int second_indent)
utf_char2bytes(c, (char *)buf);
buf[cc] = NUL;
ins_char_bytes((char_u *)buf, (size_t)cc);
ins_char_bytes(buf, (size_t)cc);
AppendCharToRedobuff(c);
} else {
ins_char(c);
@ -2848,14 +2847,13 @@ void replace_push(int c)
replace_stack_nr++;
}
/*
* Push a character onto the replace stack. Handles a multi-byte character in
* reverse byte order, so that the first byte is popped off first.
* Return the number of bytes done (includes composing characters).
*/
int replace_push_mb(char_u *p)
/// Push a character onto the replace stack. Handles a multi-byte character in
/// reverse byte order, so that the first byte is popped off first.
///
/// @return the number of bytes done (includes composing characters).
int replace_push_mb(char *p)
{
int l = utfc_ptr2len((char *)p);
int l = utfc_ptr2len(p);
int j;
for (j = l - 1; j >= 0; j--) {
@ -2919,7 +2917,7 @@ static void mb_replace_pop_ins(int cc)
for (i = 1; i < n; i++) {
buf[i] = (char_u)replace_pop();
}
ins_bytes_len(buf, (size_t)n);
ins_bytes_len((char *)buf, (size_t)n);
} else {
ins_char(cc);
}
@ -2942,7 +2940,7 @@ static void mb_replace_pop_ins(int cc)
buf[i] = (char_u)replace_pop();
}
if (utf_iscomposing(utf_ptr2char((char *)buf))) {
ins_bytes_len(buf, (size_t)n);
ins_bytes_len((char *)buf, (size_t)n);
} else {
// Not a composing char, put it back.
for (i = n - 1; i >= 0; i--) {
@ -4078,7 +4076,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
if (State & VREPLACE_FLAG) {
ins_char(' ');
} else {
ins_str((char_u *)" ");
ins_str(" ");
if ((State & REPLACE_FLAG)) {
replace_push(NUL);
}
@ -4122,7 +4120,7 @@ static bool ins_bs(int c, int mode, int *inserted_space_p)
} else {
const int l_p_deco = p_deco;
if (l_p_deco) {
(void)utfc_ptr2char(get_cursor_pos_ptr(), cpc);
(void)utfc_ptr2char((char *)get_cursor_pos_ptr(), cpc);
}
(void)del_char(false);
// If there are combining characters and 'delcombine' is set
@ -4584,7 +4582,7 @@ static bool ins_tab(void)
if (State & VREPLACE_FLAG) {
ins_char(' ');
} else {
ins_str((char_u *)" ");
ins_str(" ");
if (State & REPLACE_FLAG) { // no char replaced
replace_push(NUL);
}
@ -4718,7 +4716,7 @@ static bool ins_tab(void)
// Insert each char in saved_line from changed_col to
// ptr-cursor
ins_bytes_len(saved_line + change_col, (size_t)(cursor->col - change_col));
ins_bytes_len((char *)saved_line + change_col, (size_t)(cursor->col - change_col));
}
}

View File

@ -8162,7 +8162,7 @@ repeat:
while (src[*usedlen] == ':' && src[*usedlen + 1] == 'h') {
valid |= VALID_HEAD;
*usedlen += 2;
s = (char *)get_past_head((char_u *)(*fnamep));
s = get_past_head(*fnamep);
while (tail > s && after_pathsep(s, tail)) {
MB_PTR_BACK(*fnamep, tail);
}

View File

@ -851,7 +851,8 @@ static void get_col(typval_T *argvars, typval_T *rettv, bool charcol)
if (virtual_active() && fp == &curwin->w_cursor) {
char *p = (char *)get_cursor_pos_ptr();
if (curwin->w_cursor.coladd >=
(colnr_T)win_chartabsize(curwin, p, curwin->w_virtcol - curwin->w_cursor.coladd)) {
(colnr_T)win_chartabsize(curwin, p,
curwin->w_virtcol - curwin->w_cursor.coladd)) {
int l;
if (*p != NUL && p[(l = utfc_ptr2len(p))] == NUL) {
col += l;
@ -3896,12 +3897,12 @@ static void f_iconv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
const char *const str = tv_get_string(&argvars[0]);
char buf1[NUMBUFLEN];
char_u *const from =
(char_u *)enc_canonize((char *)enc_skip((char_u *)tv_get_string_buf(&argvars[1], buf1)));
(char_u *)enc_canonize(enc_skip((char *)tv_get_string_buf(&argvars[1], buf1)));
char buf2[NUMBUFLEN];
char_u *const to =
(char_u *)enc_canonize((char *)enc_skip((char_u *)tv_get_string_buf(&argvars[2], buf2)));
(char_u *)enc_canonize(enc_skip((char *)tv_get_string_buf(&argvars[2], buf2)));
vimconv.vc_type = CONV_NONE;
convert_setup(&vimconv, from, to);
convert_setup(&vimconv, (char *)from, (char *)to);
// If the encodings are equal, no conversion needed.
if (vimconv.vc_type == CONV_NONE) {
@ -7072,7 +7073,7 @@ static void f_screenchars(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
return;
}
int pcc[MAX_MCO];
int c = utfc_ptr2char(grid->chars[grid->line_offset[row] + (size_t)col], pcc);
int c = utfc_ptr2char((char *)grid->chars[grid->line_offset[row] + (size_t)col], pcc);
int composing_len = 0;
while (pcc[composing_len] != 0) {
composing_len++;
@ -7605,7 +7606,7 @@ static void f_setcharsearch(typval_T *argvars, typval_T *rettv, EvalFuncData fpt
char_u *const csearch = (char_u *)tv_dict_get_string(d, "char", false);
if (csearch != NULL) {
int pcc[MAX_MCO];
const int c = utfc_ptr2char(csearch, pcc);
const int c = utfc_ptr2char((char *)csearch, pcc);
set_last_csearch(c, csearch, utfc_ptr2len((char *)csearch));
}
@ -8402,11 +8403,10 @@ static void f_strftime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
rettv->vval.v_string = xstrdup(_("(Invalid)"));
} else {
vimconv_T conv;
char_u *enc;
conv.vc_type = CONV_NONE;
enc = enc_locale();
convert_setup(&conv, (char_u *)p_enc, enc);
char *enc = (char *)enc_locale();
convert_setup(&conv, p_enc, enc);
if (conv.vc_type != CONV_NONE) {
p = (char *)string_convert(&conv, (char_u *)p, NULL);
}
@ -8420,7 +8420,7 @@ static void f_strftime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
if (conv.vc_type != CONV_NONE) {
xfree(p);
}
convert_setup(&conv, enc, (char_u *)p_enc);
convert_setup(&conv, enc, p_enc);
if (conv.vc_type != CONV_NONE) {
rettv->vval.v_string = (char *)string_convert(&conv, (char_u *)result_buf, NULL);
} else {
@ -8665,8 +8665,8 @@ static void f_strptime(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
vimconv_T conv = {
.vc_type = CONV_NONE,
};
char_u *enc = enc_locale();
convert_setup(&conv, (char_u *)p_enc, enc);
char *enc = (char *)enc_locale();
convert_setup(&conv, p_enc, enc);
if (conv.vc_type != CONV_NONE) {
fmt = (char *)string_convert(&conv, (char_u *)fmt, NULL);
}

View File

@ -1933,7 +1933,7 @@ void ex_function(exarg_T *eap)
if (!HASHITEM_EMPTY(hi)) {
todo--;
fp = HI2UF(hi);
if (message_filtered(fp->uf_name)) {
if (message_filtered((char *)fp->uf_name)) {
continue;
}
if (!func_name_refcount(fp->uf_name)) {
@ -1950,7 +1950,7 @@ void ex_function(exarg_T *eap)
* ":function /pat": list functions matching pattern.
*/
if (*eap->arg == '/') {
p = skip_regexp((char_u *)eap->arg + 1, '/', true, NULL);
p = (char_u *)skip_regexp(eap->arg + 1, '/', true, NULL);
if (!eap->skip) {
regmatch_T regmatch;

View File

@ -413,7 +413,7 @@ void list_hashtable_vars(hashtab_T *ht, const char *prefix, int empty, int *firs
// apply :filter /pat/ to variable name
xstrlcpy(buf, prefix, IOSIZE);
xstrlcat(buf, (char *)di->di_key, IOSIZE);
if (message_filtered((char_u *)buf)) {
if (message_filtered(buf)) {
continue;
}

View File

@ -120,7 +120,7 @@ void do_ascii(const exarg_T *const eap)
{
char *dig;
int cc[MAX_MCO];
int c = utfc_ptr2char(get_cursor_pos_ptr(), cc);
int c = utfc_ptr2char((char *)get_cursor_pos_ptr(), cc);
if (c == NUL) {
msg("NUL");
return;
@ -513,7 +513,7 @@ void ex_sort(exarg_T *eap)
eap->nextcmd = (char *)check_nextcmd((char_u *)p);
break;
} else if (!ASCII_ISALPHA(*p) && regmatch.regprog == NULL) {
s = (char *)skip_regexp((char_u *)p + 1, *p, true, NULL);
s = skip_regexp(p + 1, *p, true, NULL);
if (*s != *p) {
emsg(_(e_invalpat));
goto sortend;
@ -1709,7 +1709,7 @@ void print_line(linenr_T lnum, int use_number, int list)
int save_silent = silent_mode;
// apply :filter /pat/
if (message_filtered(ml_get(lnum))) {
if (message_filtered((char *)ml_get(lnum))) {
return;
}
@ -3546,7 +3546,7 @@ static int do_sub(exarg_T *eap, proftime_T timeout, long cmdpreview_ns, handle_T
which_pat = RE_LAST; // use last used regexp
delimiter = (char_u)(*cmd++); // remember delimiter character
pat = cmd; // remember start of search pat
cmd = (char *)skip_regexp((char_u *)cmd, delimiter, p_magic, &eap->arg);
cmd = skip_regexp(cmd, delimiter, p_magic, &eap->arg);
if (cmd[0] == delimiter) { // end delimiter found
*cmd++ = NUL; // replace it with a NUL
has_second_delim = true;
@ -4631,7 +4631,7 @@ void ex_global(exarg_T *eap)
delim = *cmd; // get the delimiter
cmd++; // skip delimiter if there is one
pat = cmd; // remember start of pattern
cmd = (char *)skip_regexp((char_u *)cmd, delim, p_magic, &eap->arg);
cmd = skip_regexp(cmd, delim, p_magic, &eap->arg);
if (cmd[0] == delim) { // end delimiter found
*cmd++ = NUL; // replace it with a NUL
}
@ -4948,7 +4948,7 @@ char *skip_vimgrep_pat(char *p, char **s, int *flags)
*s = p + 1;
}
c = (char_u)(*p);
p = (char *)skip_regexp((char_u *)p + 1, c, true, NULL);
p = skip_regexp(p + 1, c, true, NULL);
if (*p != c) {
return NULL;
}
@ -4993,7 +4993,7 @@ void ex_oldfiles(exarg_T *eap)
}
nr++;
const char *fname = tv_get_string(TV_LIST_ITEM_TV(li));
if (!message_filtered((char_u *)fname)) {
if (!message_filtered((char *)fname)) {
msg_outnum(nr);
msg_puts(": ");
msg_outtrans((char *)tv_get_string(TV_LIST_ITEM_TV(li)));

View File

@ -851,8 +851,8 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|| getline_equal(fgetline, cookie, get_func_line))
&& ex_nesting_level + 1 <= debug_break_level) {
do_debug(getline_equal(fgetline, cookie, getsourceline)
? (char_u *)_("End of sourced file")
: (char_u *)_("End of function"));
? _("End of sourced file")
: _("End of function"));
}
}
@ -3310,7 +3310,7 @@ static linenr_T get_address(exarg_T *eap, char **ptr, cmd_addr_T addr_type, int
goto error;
}
if (skip) { // skip "/pat/"
cmd = (char *)skip_regexp((char_u *)cmd, c, p_magic, NULL);
cmd = skip_regexp(cmd, c, p_magic, NULL);
if (*cmd == c) {
cmd++;
}
@ -4295,7 +4295,7 @@ int ends_excmd(int c) FUNC_ATTR_CONST
/// @return the next command, after the first '|' or '\n' or,
/// NULL if not found.
char_u *find_nextcmd(const char_u *p)
char *find_nextcmd(const char *p)
{
while (*p != '|' && *p != '\n') {
if (*p == NUL) {
@ -4303,7 +4303,7 @@ char_u *find_nextcmd(const char_u *p)
}
p++;
}
return (char_u *)p + 1;
return (char *)p + 1;
}
/// Check if *p is a separator between Ex commands, skipping over white space.
@ -5499,7 +5499,7 @@ bool changedir_func(char *new_dir, CdScope scope)
if (*new_dir == NUL && p_cdh) {
#endif
// Use NameBuff for home directory name.
expand_env((char_u *)"$HOME", (char_u *)NameBuff, MAXPATHL);
expand_env("$HOME", NameBuff, MAXPATHL);
new_dir = (char *)NameBuff;
}
@ -6454,7 +6454,7 @@ static void ex_findpat(exarg_T *eap)
if (*eap->arg == '/') { // Match regexp, not just whole words
whole = false;
eap->arg++;
char *p = (char *)skip_regexp((char_u *)eap->arg, '/', p_magic, NULL);
char *p = skip_regexp(eap->arg, '/', p_magic, NULL);
if (*p) {
*p++ = NUL;
p = skipwhite(p);

View File

@ -1333,10 +1333,10 @@ void ex_catch(exarg_T *eap)
if (ends_excmd(*eap->arg)) { // no argument, catch all errors
pat = ".*";
end = NULL;
eap->nextcmd = (char *)find_nextcmd((char_u *)eap->arg);
eap->nextcmd = find_nextcmd(eap->arg);
} else {
pat = eap->arg + 1;
end = (char *)skip_regexp((char_u *)pat, *eap->arg, true, NULL);
end = skip_regexp(pat, *eap->arg, true, NULL);
}
if (!give_up) {
@ -1439,7 +1439,7 @@ void ex_catch(exarg_T *eap)
}
if (end != NULL) {
eap->nextcmd = (char *)find_nextcmd((char_u *)end);
eap->nextcmd = find_nextcmd(end);
}
}

View File

@ -315,7 +315,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
p = skipwhite(p);
delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++;
*search_delim = delim;
end = (char *)skip_regexp((char_u *)p, delim, p_magic, NULL);
end = skip_regexp(p, delim, p_magic, NULL);
use_last_pat = end == p && *end == delim;
if (end == p && !use_last_pat) {

View File

@ -2024,7 +2024,7 @@ void prep_exarg(exarg_T *eap, const buf_T *buf)
snprintf(eap->cmd, cmd_len, "e ++enc=%s", buf->b_p_fenc);
eap->force_enc = 8;
eap->bad_char = buf->b_bad_char;
eap->force_ff = *buf->b_p_ff;
eap->force_ff = (unsigned char)(*buf->b_p_ff);
eap->force_bin = buf->b_p_bin ? FORCE_BIN : FORCE_NOBIN;
eap->read_edit = false;
@ -5317,7 +5317,7 @@ static void vim_mktempdir(void)
mode_t umask_save = umask(0077);
for (size_t i = 0; i < ARRAY_SIZE(temp_dirs); i++) {
// Expand environment variables, leave room for "/tmp/nvim.<user>/XXXXXX/999999999".
expand_env((char_u *)temp_dirs[i], (char_u *)tmp, TEMP_FILE_PATH_MAXLEN - 64);
expand_env((char *)temp_dirs[i], tmp, TEMP_FILE_PATH_MAXLEN - 64);
if (!os_isdir((char_u *)tmp)) {
continue;
}

View File

@ -1302,7 +1302,7 @@ void openscript(char_u *name, bool directly)
curscript++;
}
// use NameBuff for expanded name
expand_env(name, (char_u *)NameBuff, MAXPATHL);
expand_env((char *)name, NameBuff, MAXPATHL);
int error;
if ((scriptin[curscript] = file_open_new(&error, (char *)NameBuff,
kFileReadOnly, 0)) == NULL) {

View File

@ -125,7 +125,7 @@ void grid_putchar(ScreenGrid *grid, int c, int row, int col, int attr)
char buf[MB_MAXBYTES + 1];
buf[utf_char2bytes(c, buf)] = NUL;
grid_puts(grid, (char_u *)buf, row, col, attr);
grid_puts(grid, buf, row, col, attr);
}
/// get a single character directly from grid.chars into "bytes[]".
@ -148,7 +148,7 @@ void grid_getbytes(ScreenGrid *grid, int row, int col, char_u *bytes, int *attrp
/// attributes 'attr', and update chars[] and attrs[].
/// Note: only outputs within one row, message is truncated at grid boundary!
/// Note: if grid, row and/or col is invalid, nothing is done.
void grid_puts(ScreenGrid *grid, char_u *text, int row, int col, int attr)
void grid_puts(ScreenGrid *grid, char *text, int row, int col, int attr)
{
grid_puts_len(grid, text, -1, row, col, attr);
}
@ -187,10 +187,10 @@ void grid_put_schar(ScreenGrid *grid, int row, int col, char_u *schar, int attr)
/// like grid_puts(), but output "text[len]". When "len" is -1 output up to
/// a NUL.
void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col, int attr)
void grid_puts_len(ScreenGrid *grid, char *text, int textlen, int row, int col, int attr)
{
size_t off;
char_u *ptr = text;
char *ptr = text;
int len = textlen;
int c;
size_t max_off;
@ -237,13 +237,13 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
while (col < grid->cols
&& (len < 0 || (int)(ptr - text) < len)
&& *ptr != NUL) {
c = *ptr;
c = (unsigned char)(*ptr);
// check if this is the first byte of a multibyte
mbyte_blen = len > 0
? utfc_ptr2len_len(ptr, (int)((text + len) - ptr))
: utfc_ptr2len((char *)ptr);
? utfc_ptr2len_len((char_u *)ptr, (int)((text + len) - ptr))
: utfc_ptr2len(ptr);
u8c = len >= 0
? utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr))
? utfc_ptr2char_len((char_u *)ptr, u8cc, (int)((text + len) - ptr))
: utfc_ptr2char(ptr, u8cc);
mbyte_cells = utf_char2cells(u8c);
if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) {
@ -254,7 +254,8 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
nc1 = NUL;
} else {
nc = len >= 0
? utfc_ptr2char_len(ptr + mbyte_blen, pcc, (int)((text + len) - ptr - mbyte_blen))
? utfc_ptr2char_len((char_u *)ptr + mbyte_blen, pcc,
(int)((text + len) - ptr - mbyte_blen))
: utfc_ptr2char(ptr + mbyte_blen, pcc);
nc1 = pcc[0];
}
@ -320,7 +321,7 @@ void grid_puts_len(ScreenGrid *grid, char_u *text, int textlen, int row, int col
ptr += mbyte_blen;
if (clear_next_cell) {
// This only happens at the end, display one space next.
ptr = (char_u *)" ";
ptr = " ";
len = -1;
}
}
@ -393,11 +394,11 @@ void grid_fill(ScreenGrid *grid, int start_row, int end_row, int start_col, int
// double wide-char clear out the right half. Only needed in a
// terminal.
if (start_col > 0 && grid_fix_col(grid, start_col, row) != start_col) {
grid_puts_len(grid, (char_u *)" ", 1, row, start_col - 1, 0);
grid_puts_len(grid, " ", 1, row, start_col - 1, 0);
}
if (end_col < grid->cols
&& grid_fix_col(grid, end_col, row) != end_col) {
grid_puts_len(grid, (char_u *)" ", 1, row, end_col, 0);
grid_puts_len(grid, " ", 1, row, end_col, 0);
}
// if grid was resized (in ext_multigrid mode), the UI has no redraw updates

View File

@ -613,7 +613,7 @@ static void prt_message(char_u *s)
{
// TODO(bfredl): delete this
grid_fill(&default_grid, Rows - 1, Rows, 0, Columns, ' ', ' ', 0);
grid_puts(&default_grid, s, Rows - 1, 0, HL_ATTR(HLF_R));
grid_puts(&default_grid, (char *)s, Rows - 1, 0, HL_ATTR(HLF_R));
ui_flush();
}
@ -2147,17 +2147,14 @@ int mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
char_u *p;
int props;
int cmap = 0;
char_u *p_encoding;
struct prt_ps_encoding_S *p_mbenc;
struct prt_ps_encoding_S *p_mbenc_first;
struct prt_ps_charset_S *p_mbchar = NULL;
/*
* Set up font and encoding.
*/
p_encoding = enc_skip((char_u *)p_penc);
// Set up font and encoding.
char_u *p_encoding = (char_u *)enc_skip(p_penc);
if (*p_encoding == NUL) {
p_encoding = enc_skip((char_u *)p_enc);
p_encoding = (char_u *)enc_skip(p_enc);
}
// Look for a multi-byte font that matches the encoding and character set.
@ -2591,13 +2588,13 @@ bool mch_print_begin(prt_settings_T *psettings)
// that cannot be found then default to "latin1".
// Note: VIM specific encoding header is always skipped.
if (!prt_out_mbyte) {
p_encoding = (char *)enc_skip((char_u *)p_penc);
p_encoding = enc_skip(p_penc);
if (*p_encoding == NUL
|| !prt_find_resource(p_encoding, &res_encoding)) {
// 'printencoding' not set or not supported - find alternate
int props;
p_encoding = (char *)enc_skip((char_u *)p_enc);
p_encoding = enc_skip(p_enc);
props = enc_canon_props((char_u *)p_encoding);
if (!(props & ENC_8BIT)
|| !prt_find_resource(p_encoding, &res_encoding)) {
@ -2617,9 +2614,9 @@ bool mch_print_begin(prt_settings_T *psettings)
// For the moment there are no checks on encoding resource files to
// perform
} else {
p_encoding = (char *)enc_skip((char_u *)p_penc);
p_encoding = enc_skip(p_penc);
if (*p_encoding == NUL) {
p_encoding = (char *)enc_skip((char_u *)p_enc);
p_encoding = enc_skip(p_enc);
}
if (prt_use_courier) {
// Include ASCII range encoding vector
@ -2639,7 +2636,7 @@ bool mch_print_begin(prt_settings_T *psettings)
prt_conv.vc_type = CONV_NONE;
if (!(enc_canon_props((char_u *)p_enc) & enc_canon_props((char_u *)p_encoding) & ENC_8BIT)) {
// Set up encoding conversion if required
if (convert_setup(&prt_conv, (char_u *)p_enc, (char_u *)p_encoding) == FAIL) {
if (convert_setup(&prt_conv, p_enc, p_encoding) == FAIL) {
semsg(_("E620: Unable to convert to print encoding \"%s\""),
p_encoding);
return false;

View File

@ -803,8 +803,8 @@ void fix_help_buffer(void)
// 'encoding' may be required.
vc.vc_type = CONV_NONE;
convert_setup(&vc,
(char_u *)(this_utf == kTrue ? "utf-8" : "latin1"),
(char_u *)p_enc);
(this_utf == kTrue ? "utf-8" : "latin1"),
p_enc);
if (vc.vc_type == CONV_NONE) {
// No conversion needed.
cp = (char *)IObuff;

View File

@ -1421,7 +1421,7 @@ static void highlight_list_one(const int id)
const HlGroup *sgp = &hl_table[id - 1]; // index is ID minus one
bool didh = false;
if (message_filtered(sgp->sg_name)) {
if (message_filtered((char *)sgp->sg_name)) {
return;
}

View File

@ -423,7 +423,7 @@ static int cs_add_common(char *arg1, char *arg2, char *flags)
// get the filename (arg1), expand it, and try to stat it
fname = xmalloc(MAXPATHL + 1);
expand_env((char_u *)arg1, (char_u *)fname, MAXPATHL);
expand_env(arg1, fname, MAXPATHL);
size_t len = STRLEN(fname);
fbuf = fname;
(void)modify_fname(":p", false, &usedlen, &fname, &fbuf, &len);
@ -445,7 +445,7 @@ staterr:
// get the prepend path (arg2), expand it, and see if it exists
if (arg2 != NULL) {
ppath = xmalloc(MAXPATHL + 1);
expand_env((char_u *)arg2, (char_u *)ppath, MAXPATHL);
expand_env(arg2, ppath, MAXPATHL);
if (!os_path_exists((char_u *)ppath)) {
goto staterr;
}
@ -757,14 +757,14 @@ err_closing:
#endif
// expand the cscope exec for env var's
prog = xmalloc(MAXPATHL + 1);
expand_env((char_u *)p_csprg, (char_u *)prog, MAXPATHL);
expand_env(p_csprg, prog, MAXPATHL);
// alloc space to hold the cscope command
size_t len = strlen(prog) + strlen(csinfo[i].fname) + 32;
if (csinfo[i].ppath) {
// expand the prepend path for env var's
ppath = xmalloc(MAXPATHL + 1);
expand_env((char_u *)csinfo[i].ppath, (char_u *)ppath, MAXPATHL);
expand_env(csinfo[i].ppath, ppath, MAXPATHL);
len += strlen(ppath);
}

View File

@ -343,7 +343,7 @@ int get_sts_value(void)
// Count the size (in window cells) of the indent in the current line.
int get_indent(void)
{
return get_indent_str_vtab(get_cursor_line_ptr(),
return get_indent_str_vtab((char *)get_cursor_line_ptr(),
curbuf->b_p_ts,
curbuf->b_p_vts_array,
false);
@ -352,7 +352,7 @@ int get_indent(void)
// Count the size (in window cells) of the indent in line "lnum".
int get_indent_lnum(linenr_T lnum)
{
return get_indent_str_vtab(ml_get(lnum),
return get_indent_str_vtab((char *)ml_get(lnum),
curbuf->b_p_ts,
curbuf->b_p_vts_array,
false);
@ -362,7 +362,7 @@ int get_indent_lnum(linenr_T lnum)
// "buf".
int get_indent_buf(buf_T *buf, linenr_T lnum)
{
return get_indent_str_vtab(ml_get_buf(buf, lnum, false),
return get_indent_str_vtab((char *)ml_get_buf(buf, lnum, false),
curbuf->b_p_ts,
buf->b_p_vts_array,
false);
@ -400,7 +400,7 @@ int get_indent_str(const char_u *ptr, int ts, bool list)
/// Count the size (in window cells) of the indent in line "ptr", using
/// variable tabstops.
/// if "list" is true, count only screen size for tabs.
int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list)
int get_indent_str_vtab(const char *ptr, long ts, long *vts, bool list)
{
int count = 0;
@ -800,7 +800,7 @@ int get_breakindent_win(win_T *wp, char_u *line)
prev_ts = wp->w_buffer->b_p_ts;
prev_tick = buf_get_changedtick(wp->w_buffer);
prev_vts = wp->w_buffer->b_p_vts_array;
prev_indent = get_indent_str_vtab(line,
prev_indent = get_indent_str_vtab((char *)line,
wp->w_buffer->b_p_ts,
wp->w_buffer->b_p_vts_array,
wp->w_p_list);

View File

@ -212,16 +212,14 @@ int is_pos_in_string(const char_u *line, colnr_T col)
* Below "XXX" means that this function may unlock the current line.
*/
/*
* Return true if the string "line" starts with a word from 'cinwords'.
*/
bool cin_is_cinword(const char_u *line)
/// @return true if the string "line" starts with a word from 'cinwords'.
bool cin_is_cinword(const char *line)
{
bool retval = false;
size_t cinw_len = STRLEN(curbuf->b_p_cinw) + 1;
char_u *cinw_buf = xmalloc(cinw_len);
line = (char_u *)skipwhite((char *)line);
line = skipwhite((char *)line);
for (char *cinw = curbuf->b_p_cinw; *cinw;) {
size_t len = copy_option_part(&cinw, (char *)cinw_buf, cinw_len, ",");
@ -2021,7 +2019,7 @@ int get_c_indent(void)
if (trypos == NULL && curwin->w_cursor.lnum > 1) {
// There may be a statement before the comment, search from the end
// of the line for a comment start.
linecomment_pos.col = check_linecomment(ml_get(curwin->w_cursor.lnum - 1));
linecomment_pos.col = check_linecomment((char *)ml_get(curwin->w_cursor.lnum - 1));
if (linecomment_pos.col != MAXCOL) {
trypos = &linecomment_pos;
trypos->lnum = curwin->w_cursor.lnum - 1;
@ -2854,7 +2852,7 @@ int get_c_indent(void)
if (n) {
amount = n;
l = after_label(get_cursor_line_ptr());
if (l != NULL && cin_is_cinword(l)) {
if (l != NULL && cin_is_cinword((char *)l)) {
if (theline[0] == '{') {
amount += curbuf->b_ind_open_extra;
} else {
@ -3108,7 +3106,7 @@ int get_c_indent(void)
* Check if we are after an "if", "while", etc.
* Also allow " } else".
*/
if (cin_is_cinword(l) || cin_iselse((char_u *)skipwhite((char *)l))) {
if (cin_is_cinword((char *)l) || cin_iselse((char_u *)skipwhite((char *)l))) {
// Found an unterminated line after an if (), line up
// with the last one.
// if (cond)

View File

@ -1732,7 +1732,7 @@ void ins_compl_addleader(int c)
utf_char2bytes(c, (char *)buf);
buf[cc] = NUL;
ins_char_bytes((char_u *)buf, (size_t)cc);
ins_char_bytes(buf, (size_t)cc);
} else {
ins_char(c);
}
@ -2014,7 +2014,7 @@ static bool ins_compl_stop(const int c, const int prev_mode, bool retval)
const int compl_len = get_compl_len();
const int len = (int)STRLEN(p);
if (len > compl_len) {
ins_bytes_len(p + compl_len, (size_t)(len - compl_len));
ins_bytes_len((char *)p + compl_len, (size_t)(len - compl_len));
}
}
retval = true;

View File

@ -60,7 +60,7 @@ static bool log_try_create(char *fname)
static void log_path_init(void)
{
size_t size = sizeof(log_file_path);
expand_env((char_u *)"$" ENV_LOGFILE, (char_u *)log_file_path, (int)size - 1);
expand_env("$" ENV_LOGFILE, log_file_path, (int)size - 1);
if (strequal("$" ENV_LOGFILE, log_file_path)
|| log_file_path[0] == '\0'
|| os_isdir((char_u *)log_file_path)

View File

@ -494,8 +494,8 @@ static int nlua_iconv(lua_State *lstate)
size_t str_len = 0;
const char *str = lua_tolstring(lstate, 1, &str_len);
char_u *from = (char_u *)enc_canonize((char *)enc_skip((char_u *)lua_tolstring(lstate, 2, NULL)));
char_u *to = (char_u *)enc_canonize((char *)enc_skip((char_u *)lua_tolstring(lstate, 3, NULL)));
char_u *from = (char_u *)enc_canonize(enc_skip((char *)lua_tolstring(lstate, 2, NULL)));
char_u *to = (char_u *)enc_canonize(enc_skip((char *)lua_tolstring(lstate, 3, NULL)));
vimconv_T vimconv;
vimconv.vc_type = CONV_NONE;

View File

@ -150,8 +150,8 @@ static void showmap(mapblock_T *mp, bool local)
{
size_t len = 1;
if (message_filtered(mp->m_keys) && message_filtered((char_u *)mp->m_str)
&& (mp->m_desc == NULL || message_filtered((char_u *)mp->m_desc))) {
if (message_filtered((char *)mp->m_keys) && message_filtered(mp->m_str)
&& (mp->m_desc == NULL || message_filtered(mp->m_desc))) {
return;
}

View File

@ -674,7 +674,7 @@ static void fname2fnum(xfmark_T *fm)
)) {
int len;
expand_env((char_u *)"~/", (char_u *)NameBuff, MAXPATHL);
expand_env("~/", NameBuff, MAXPATHL);
len = (int)STRLEN(NameBuff);
STRLCPY(NameBuff + len, fm->fname + 2, MAXPATHL - len);
} else {
@ -911,7 +911,7 @@ static void show_one_mark(int c, char_u *arg, pos_T *p, char_u *name_arg, int cu
name = mark_line(p, 15);
mustfree = true;
}
if (!message_filtered(name)) {
if (!message_filtered((char *)name)) {
if (!did_title) {
// Highlight title
msg_puts_title(_("\nmark line col file/text"));
@ -1037,7 +1037,7 @@ void ex_jumps(exarg_T *eap)
name = vim_strsave((char_u *)"-invalid-");
}
// apply :filter /pat/ or file name not available
if (name == NULL || message_filtered(name)) {
if (name == NULL || message_filtered((char *)name)) {
xfree(name);
continue;
}

View File

@ -1194,7 +1194,7 @@ void ex_match(exarg_T *eap)
semsg(_(e_invarg2), eap->arg);
return;
}
end = skip_regexp(p + 1, *p, true, NULL);
end = (char_u *)skip_regexp((char *)p + 1, *p, true, NULL);
if (!eap->skip) {
if (*end != NUL && !ends_excmd(*skipwhite((char *)end + 1))) {
xfree(g);
@ -1215,5 +1215,5 @@ void ex_match(exarg_T *eap)
*end = (char_u)c;
}
}
eap->nextcmd = (char *)find_nextcmd(end);
eap->nextcmd = find_nextcmd((char *)end);
}

View File

@ -754,21 +754,19 @@ bool utf_composinglike(const char_u *p1, const char_u *p2)
/// space at least for #MAX_MCO + 1 elements.
///
/// @return leading character.
int utfc_ptr2char(const char_u *p, int *pcc)
int utfc_ptr2char(const char *p_in, int *pcc)
{
int len;
int c;
int cc;
uint8_t *p = (uint8_t *)p_in;
int i = 0;
c = utf_ptr2char((char *)p);
len = utf_ptr2len((char *)p);
int c = utf_ptr2char((char *)p);
int len = utf_ptr2len((char *)p);
// Only accept a composing char when the first char isn't illegal.
if ((len > 1 || *p < 0x80)
&& p[len] >= 0x80
&& utf_composinglike(p, p + len)) {
cc = utf_ptr2char((char *)p + len);
int cc = utf_ptr2char((char *)p + len);
for (;;) {
pcc[i++] = cc;
if (i == MAX_MCO) {
@ -1936,7 +1934,7 @@ void utf_find_illegal(void)
// 'encoding' is "utf-8" but we are editing a 8-bit encoded file,
// possibly a utf-8 file with illegal bytes. Setup for conversion
// from utf-8 to 'fileencoding'.
convert_setup(&vimconv, (char_u *)p_enc, (char_u *)curbuf->b_p_fenc);
convert_setup(&vimconv, p_enc, curbuf->b_p_fenc);
}
curwin->w_cursor.coladd = 0;
@ -2146,10 +2144,8 @@ const char *mb_unescape(const char **const pp)
return NULL;
}
/*
* Skip the Vim specific head of a 'encoding' name.
*/
char_u *enc_skip(char_u *p)
/// Skip the Vim specific head of a 'encoding' name.
char *enc_skip(char *p)
{
if (STRNCMP(p, "2byte-", 6) == 0) {
return p + 6;
@ -2169,8 +2165,6 @@ char *enc_canonize(char *enc)
FUNC_ATTR_NONNULL_RET
{
char_u *p, *s;
int i;
if (STRCMP(enc, "default") == 0) {
// Use the default encoding as found by set_init_1().
return (char *)vim_strsave(fenc_default);
@ -2190,7 +2184,7 @@ char *enc_canonize(char *enc)
*p = NUL;
// Skip "2byte-" and "8bit-".
p = enc_skip(r);
p = (char_u *)enc_skip((char *)r);
// Change "microsoft-cp" to "cp". Used in some spell files.
if (STRNCMP(p, "microsoft-cp", 12) == 0) {
@ -2214,6 +2208,7 @@ char *enc_canonize(char *enc)
STRMOVE(p + 5, p + 6);
}
int i;
if (enc_canon_search(p) >= 0) {
// canonical name can be used unmodified
if (p != r) {
@ -2332,7 +2327,7 @@ void *my_iconv_open(char_u *to, char_u *from)
if (iconv_working == kBroken) {
return (void *)-1; // detected a broken iconv() previously
}
fd = iconv_open((char *)enc_skip(to), (char *)enc_skip(from));
fd = iconv_open(enc_skip((char *)to), enc_skip((char *)from));
if (fd != (iconv_t)-1 && iconv_working == kUnknown) {
/*
@ -2443,18 +2438,17 @@ static char_u *iconv_string(const vimconv_T *const vcp, char_u *str, size_t slen
#endif // HAVE_ICONV
/*
* Setup "vcp" for conversion from "from" to "to".
* The names must have been made canonical with enc_canonize().
* vcp->vc_type must have been initialized to CONV_NONE.
* Note: cannot be used for conversion from/to ucs-2 and ucs-4 (will use utf-8
* instead).
* Afterwards invoke with "from" and "to" equal to NULL to cleanup.
* Return FAIL when conversion is not supported, OK otherwise.
*/
int convert_setup(vimconv_T *vcp, char_u *from, char_u *to)
/// Setup "vcp" for conversion from "from" to "to".
/// The names must have been made canonical with enc_canonize().
/// vcp->vc_type must have been initialized to CONV_NONE.
/// Note: cannot be used for conversion from/to ucs-2 and ucs-4 (will use utf-8
/// instead).
/// Afterwards invoke with "from" and "to" equal to NULL to cleanup.
///
/// @return FAIL when conversion is not supported, OK otherwise.
int convert_setup(vimconv_T *vcp, char *from, char *to)
{
return convert_setup_ext(vcp, from, true, to, true);
return convert_setup_ext(vcp, (char_u *)from, true, (char_u *)to, true);
}
/// As convert_setup(), but only when from_unicode_is_utf8 is true will all

View File

@ -922,11 +922,9 @@ void ml_recover(bool checkext)
b0p = hp->bh_data;
}
/*
* If .swp file name given directly, use name from swap file for buffer.
*/
// If .swp file name given directly, use name from swap file for buffer.
if (directly) {
expand_env(b0p->b0_fname, (char_u *)NameBuff, MAXPATHL);
expand_env((char *)b0p->b0_fname, NameBuff, MAXPATHL);
if (setfname(curbuf, (char *)NameBuff, NULL, true) == FAIL) {
goto theend;
}
@ -1873,7 +1871,7 @@ errorret:
// when the GUI redraws part of the text.
recursive++;
get_trans_bufname(buf);
shorten_dir((char_u *)NameBuff);
shorten_dir(NameBuff);
siemsg(_("E316: ml_get: cannot find line %" PRId64 " in buffer %d %s"),
(int64_t)lnum, buf->b_fnum, NameBuff);
recursive--;
@ -3472,7 +3470,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
// Symlinks may point to the same file even
// when the name differs, need to check the
// inode too.
expand_env(b0.b0_fname, (char_u *)NameBuff, MAXPATHL);
expand_env((char *)b0.b0_fname, NameBuff, MAXPATHL);
if (fnamecmp_ino((char_u *)buf->b_ffname, (char_u *)NameBuff,
char_to_long(b0.b0_ino))) {
differ = true;
@ -3481,7 +3479,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
} else {
// The name in the swap file may be
// "~user/path/file". Expand it first.
expand_env(b0.b0_fname, (char_u *)NameBuff, MAXPATHL);
expand_env((char *)b0.b0_fname, NameBuff, MAXPATHL);
if (fnamecmp_ino((char_u *)buf->b_ffname, (char_u *)NameBuff,
char_to_long(b0.b0_ino))) {
differ = true;

View File

@ -305,7 +305,7 @@ bool msg_attr_keep(const char *s, int attr, bool keep, bool multiline)
// Skip messages not match ":filter pattern".
// Don't filter when there is an error.
if (!emsg_on_display && message_filtered((char_u *)s)) {
if (!emsg_on_display && message_filtered((char *)s)) {
return true;
}
@ -1990,7 +1990,7 @@ static char_u *screen_puts_mbyte(char_u *s, int l, int attr)
return s;
}
grid_puts_len(&msg_grid_adj, s, l, msg_row, msg_col, attr);
grid_puts_len(&msg_grid_adj, (char *)s, l, msg_row, msg_col, attr);
if (cmdmsg_rl) {
msg_col -= cw;
if (msg_col == 0) {
@ -2353,13 +2353,13 @@ static void msg_puts_display(const char_u *str, int maxlen, int attr, int recurs
/// @return true when ":filter pattern" was used and "msg" does not match
/// "pattern".
bool message_filtered(char_u *msg)
bool message_filtered(char *msg)
{
if (cmdmod.cmod_filter_regmatch.regprog == NULL) {
return false;
}
bool match = vim_regexec(&cmdmod.cmod_filter_regmatch, (char *)msg, (colnr_T)0);
bool match = vim_regexec(&cmdmod.cmod_filter_regmatch, msg, (colnr_T)0);
return cmdmod.cmod_filter_force ? match : !match;
}
@ -2703,8 +2703,7 @@ static void t_puts(int *t_col, const char_u *t_s, const char_u *s, int attr)
attr = hl_combine_attr(HL_ATTR(HLF_MSG), attr);
// Output postponed text.
msg_didout = true; // Remember that line is not empty.
grid_puts_len(&msg_grid_adj, (char_u *)t_s, (int)(s - t_s), msg_row, msg_col,
attr);
grid_puts_len(&msg_grid_adj, (char *)t_s, (int)(s - t_s), msg_row, msg_col, attr);
msg_col += *t_col;
*t_col = 0;
// If the string starts with a composing character don't increment the
@ -3083,10 +3082,9 @@ void msg_moremsg(int full)
char_u *s = (char_u *)_("-- More --");
attr = hl_combine_attr(HL_ATTR(HLF_MSG), HL_ATTR(HLF_M));
grid_puts(&msg_grid_adj, s, Rows - 1, 0, attr);
grid_puts(&msg_grid_adj, (char *)s, Rows - 1, 0, attr);
if (full) {
grid_puts(&msg_grid_adj, (char_u *)
_(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "),
grid_puts(&msg_grid_adj, _(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "),
Rows - 1, vim_strsize((char *)s), attr);
}
}

View File

@ -2718,8 +2718,6 @@ void clear_showcmd(void)
/// @return true if output has been written (and setcursor() has been called).
bool add_to_showcmd(int c)
{
char_u *p;
int i;
static int ignore[] = {
K_IGNORE,
K_LEFTMOUSE, K_LEFTDRAG, K_LEFTRELEASE, K_MOUSEMOVE,
@ -2742,14 +2740,14 @@ bool add_to_showcmd(int c)
// Ignore keys that are scrollbar updates and mouse clicks
if (IS_SPECIAL(c)) {
for (i = 0; ignore[i] != 0; i++) {
for (int i = 0; ignore[i] != 0; i++) {
if (ignore[i] == c) {
return false;
}
}
}
p = transchar(c);
char *p = (char *)transchar(c);
if (*p == ' ') {
STRCPY(p, "<20>");
}
@ -2845,12 +2843,12 @@ static void display_showcmd(void)
grid_puts_line_start(&msg_grid_adj, showcmd_row);
if (!showcmd_is_clear) {
grid_puts(&msg_grid_adj, showcmd_buf, showcmd_row, sc_col,
grid_puts(&msg_grid_adj, (char *)showcmd_buf, showcmd_row, sc_col,
HL_ATTR(HLF_MSG));
}
// clear the rest of an old message by outputting up to SHOWCMD_COLS spaces
grid_puts(&msg_grid_adj, (char_u *)" " + len, showcmd_row,
grid_puts(&msg_grid_adj, (char *)" " + len, showcmd_row,
sc_col + len, HL_ATTR(HLF_MSG));
grid_puts_line_flush(false);
@ -4392,8 +4390,7 @@ static void nv_ident(cmdarg_T *cap)
init_history();
add_to_history(HIST_SEARCH, (char_u *)buf, true, NUL);
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', (char_u *)buf, 0,
NULL);
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0, NULL);
} else {
g_tag_at_cursor = true;
do_cmdline_cmd(buf);
@ -4813,7 +4810,7 @@ static void nv_search(cmdarg_T *cap)
return;
}
(void)normal_search(cap, cap->cmdchar, (char_u *)cap->searchbuf,
(void)normal_search(cap, cap->cmdchar, cap->searchbuf,
(cap->arg || !equalpos(save_cursor, curwin->w_cursor))
? 0 : SEARCH_MARK, NULL);
}
@ -4842,9 +4839,8 @@ static void nv_next(cmdarg_T *cap)
/// @param opt extra flags for do_search()
///
/// @return 0 for failure, 1 for found, 2 for found and line offset added.
static int normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt, int *wrapped)
static int normal_search(cmdarg_T *cap, int dir, char *pat, int opt, int *wrapped)
{
int i;
searchit_arg_T sia;
cap->oap->motion_type = kMTCharWise;
@ -4853,8 +4849,8 @@ static int normal_search(cmdarg_T *cap, int dir, char_u *pat, int opt, int *wrap
curwin->w_set_curswant = true;
CLEAR_FIELD(sia);
i = do_search(cap->oap, dir, dir, pat, cap->count1,
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
int i = do_search(cap->oap, dir, dir, (char_u *)pat, cap->count1,
opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, &sia);
if (wrapped != NULL) {
*wrapped = sia.sa_wrapped;
}
@ -5625,7 +5621,7 @@ static MarkMoveRes nv_mark_move_to(cmdarg_T *cap, MarkMove flags, fmark_T *fm)
/// Handle commands that are operators in Visual mode.
static void v_visop(cmdarg_T *cap)
{
static char_u trans[] = "YyDdCcxdXdAAIIrr";
static char trans[] = "YyDdCcxdXdAAIIrr";
// Uppercase means linewise, except in block mode, then "D" deletes till
// the end of the line, and "C" replaces till EOL
@ -5637,7 +5633,7 @@ static void v_visop(cmdarg_T *cap)
curwin->w_curswant = MAXCOL;
}
}
cap->cmdchar = (uint8_t)(*(vim_strchr((char *)trans, cap->cmdchar) + 1));
cap->cmdchar = (uint8_t)(*(vim_strchr(trans, cap->cmdchar) + 1));
nv_operator(cap);
}

View File

@ -3839,7 +3839,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((char_u *)yb->y_array[j]);
do_show = !message_filtered(yb->y_array[j]);
}
if (do_show || yb->y_size == 0) {
@ -3876,14 +3876,14 @@ void ex_display(exarg_T *eap)
// display last inserted text
if ((p = get_last_insert()) != NULL
&& (arg == NULL || vim_strchr((char *)arg, '.') != NULL) && !got_int
&& !message_filtered(p)) {
&& !message_filtered((char *)p)) {
msg_puts("\n c \". ");
dis_msg(p, true);
}
// display last command line
if (last_cmdline != NULL && (arg == NULL || vim_strchr((char *)arg, ':') != NULL)
&& !got_int && !message_filtered((char_u *)last_cmdline)) {
&& !got_int && !message_filtered(last_cmdline)) {
msg_puts("\n c \": ");
dis_msg((char_u *)last_cmdline, false);
}
@ -3891,7 +3891,7 @@ void ex_display(exarg_T *eap)
// display current file name
if (curbuf->b_fname != NULL
&& (arg == NULL || vim_strchr((char *)arg, '%') != NULL) && !got_int
&& !message_filtered((char_u *)curbuf->b_fname)) {
&& !message_filtered(curbuf->b_fname)) {
msg_puts("\n c \"% ");
dis_msg((char_u *)curbuf->b_fname, false);
}
@ -3901,7 +3901,7 @@ void ex_display(exarg_T *eap)
char *fname;
linenr_T dummy;
if (buflist_name_nr(0, &fname, &dummy) != FAIL && !message_filtered((char_u *)fname)) {
if (buflist_name_nr(0, &fname, &dummy) != FAIL && !message_filtered(fname)) {
msg_puts("\n c \"# ");
dis_msg((char_u *)fname, false);
}
@ -3910,14 +3910,14 @@ void ex_display(exarg_T *eap)
// display last search pattern
if (last_search_pat() != NULL
&& (arg == NULL || vim_strchr((char *)arg, '/') != NULL) && !got_int
&& !message_filtered(last_search_pat())) {
&& !message_filtered((char *)last_search_pat())) {
msg_puts("\n c \"/ ");
dis_msg(last_search_pat(), false);
}
// display last used expression
if (expr_line != NULL && (arg == NULL || vim_strchr((char *)arg, '=') != NULL)
&& !got_int && !message_filtered(expr_line)) {
&& !got_int && !message_filtered((char *)expr_line)) {
msg_puts("\n c \"= ");
dis_msg(expr_line, false);
}
@ -4802,7 +4802,7 @@ int do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
}
*ptr = NUL;
STRCAT(buf1, buf2);
ins_str(buf1); // insert the new number
ins_str((char *)buf1); // insert the new number
endpos = curwin->w_cursor;
if (curwin->w_cursor.col) {
curwin->w_cursor.col--;

View File

@ -3299,7 +3299,7 @@ static void showoptions(int all, int opt_flags)
item_count = 0;
for (p = &options[0]; p->fullname != NULL; p++) {
// apply :filter /pat/
if (message_filtered((char_u *)p->fullname)) {
if (message_filtered(p->fullname)) {
continue;
}

View File

@ -553,9 +553,9 @@ char_u *expand_env_save_opt(char_u *src, bool one)
/// @param src Input string e.g. "$HOME/vim.hlp"
/// @param dst[out] Where to put the result
/// @param dstlen Maximum length of the result
void expand_env(char_u *src, char_u *dst, int dstlen)
void expand_env(char *src, char *dst, int dstlen)
{
expand_env_esc(src, dst, dstlen, false, false, NULL);
expand_env_esc((char_u *)src, (char_u *)dst, dstlen, false, false, NULL);
}
/// Expand environment variable with path name and escaping.

View File

@ -911,7 +911,7 @@ int os_mkdir_recurse(const char *const dir, int32_t mode, char **const failed_di
// We're done when it's "/" or "c:/".
const size_t dirlen = strlen(dir);
char *const curdir = xmemdupz(dir, dirlen);
char *const past_head = (char *)get_past_head((char_u *)curdir);
char *const past_head = get_past_head(curdir);
char *e = curdir + dirlen;
const char *const real_end = e;
const char past_head_save = *past_head;

View File

@ -62,7 +62,7 @@ FileComparison path_full_compare(char *const s1, char *const s2, const bool chec
FileID file_id_1, file_id_2;
if (expandenv) {
expand_env((char_u *)s1, (char_u *)exp1, MAXPATHL);
expand_env(s1, exp1, MAXPATHL);
} else {
STRLCPY(exp1, s1, MAXPATHL);
}
@ -104,7 +104,7 @@ char *path_tail(const char *fname)
return "";
}
const char *tail = (char *)get_past_head((char_u *)fname);
const char *tail = get_past_head(fname);
const char *p = tail;
// Find last part of path.
while (*p != NUL) {
@ -130,7 +130,7 @@ char *path_tail_with_sep(char *fname)
assert(fname != NULL);
// Don't remove the '/' from "c:/file".
char *past_head = (char *)get_past_head((char_u *)fname);
char *past_head = get_past_head(fname);
char *tail = path_tail(fname);
while (tail > past_head && after_pathsep(fname, tail)) {
tail--;
@ -150,7 +150,7 @@ char *path_tail_with_sep(char *fname)
const char_u *invocation_path_tail(const char_u *invocation, size_t *len)
FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ARG(1)
{
const char_u *tail = get_past_head((char_u *)invocation);
const char_u *tail = (char_u *)get_past_head((char *)invocation);
const char_u *p = tail;
while (*p != NUL && *p != ' ') {
bool was_sep = vim_ispathsep_nocolon(*p);
@ -215,13 +215,13 @@ bool is_path_head(const char_u *path)
/// Get a pointer to one character past the head of a path name.
/// Unix: after "/"; Win: after "c:\"
/// If there is no head, path is returned.
char_u *get_past_head(const char_u *path)
char *get_past_head(const char *path)
{
const char_u *retval = path;
const char *retval = path;
#ifdef WIN32
// May skip "c:"
if (is_path_head(path)) {
if (is_path_head((char_u *)path)) {
retval = path + 2;
}
#endif
@ -230,7 +230,7 @@ char_u *get_past_head(const char_u *path)
retval++;
}
return (char_u *)retval;
return (char *)retval;
}
/// Return true if 'c' is a path separator.
@ -310,9 +310,9 @@ void shorten_dir_len(char_u *str, int trim_len)
/// Shorten the path of a file from "~/foo/../.bar/fname" to "~/f/../.b/fname"
/// It's done in-place.
void shorten_dir(char_u *str)
void shorten_dir(char *str)
{
shorten_dir_len(str, 1);
shorten_dir_len((char_u *)str, 1);
}
/// Return true if the directory of "fname" exists, false otherwise.
@ -631,7 +631,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
while (*path_end != NUL) {
/* May ignore a wildcard that has a backslash before it; it will
* be removed by rem_backslash() or file_pat_to_reg_pat() below. */
if (path_end >= path + wildoff && rem_backslash(path_end)) {
if (path_end >= path + wildoff && rem_backslash((char *)path_end)) {
*p++ = *path_end++;
} else if (vim_ispathsep_nocolon(*path_end)) {
if (e != NULL) {
@ -658,7 +658,7 @@ static size_t do_path_expand(garray_T *gap, const char_u *path, size_t wildoff,
/* Remove backslashes between "wildoff" and the start of the wildcard
* component. */
for (p = buf + wildoff; p < s; p++) {
if (rem_backslash(p)) {
if (rem_backslash((char *)p)) {
STRMOVE(p, p + 1);
e--;
s--;

View File

@ -233,7 +233,7 @@ int win_chartabsize(win_T *wp, char *p, colnr_T col)
if (*p == TAB && (!wp->w_p_list || wp->w_p_lcs_chars.tab1)) {
return tabstop_padding(col, buf->b_p_ts, buf->b_p_vts_array);
} else {
return ptr2cells((char *)p);
return ptr2cells(p);
}
}

View File

@ -542,14 +542,13 @@ void pum_redraw(void)
size++;
}
}
grid_puts_len(&pum_grid, (char_u *)rt, (int)STRLEN(rt), row,
grid_col - size + 1, attr);
grid_puts_len(&pum_grid, rt, (int)STRLEN(rt), row, grid_col - size + 1, attr);
xfree(rt_start);
xfree(st);
grid_col -= width;
} else {
// use grid_puts_len() to truncate the text
grid_puts(&pum_grid, st, row, grid_col, attr);
grid_puts(&pum_grid, (char *)st, row, grid_col, attr);
xfree(st);
grid_col += width;
}
@ -560,11 +559,11 @@ void pum_redraw(void)
// Display two spaces for a Tab.
if (pum_rl) {
grid_puts_len(&pum_grid, (char_u *)" ", 2, row, grid_col - 1,
grid_puts_len(&pum_grid, " ", 2, row, grid_col - 1,
attr);
grid_col -= 2;
} else {
grid_puts_len(&pum_grid, (char_u *)" ", 2, row, grid_col, attr);
grid_puts_len(&pum_grid, " ", 2, row, grid_col, attr);
grid_col += 2;
}
totwidth += 2;

View File

@ -1000,7 +1000,7 @@ static int qf_setup_state(qfstate_T *pstate, char *restrict enc, const char *res
{
pstate->vc.vc_type = CONV_NONE;
if (enc != NULL && *enc != NUL) {
convert_setup(&pstate->vc, (char_u *)enc, (char_u *)p_enc);
convert_setup(&pstate->vc, enc, p_enc);
}
if (efile != NULL
@ -1244,7 +1244,7 @@ static int qf_parse_fmt_f(regmatch_T *rmp, int midx, qffields_T *fields, int pre
// Expand ~/file and $HOME/file to full path.
char c = (char)(*rmp->endp[midx]);
*rmp->endp[midx] = NUL;
expand_env(rmp->startp[midx], (char_u *)fields->namebuf, CMDBUFFSIZE);
expand_env((char *)rmp->startp[midx], fields->namebuf, CMDBUFFSIZE);
*rmp->endp[midx] = (char_u)c;
// For separate filename patterns (%O, %P and %Q), the specified file
@ -3038,16 +3038,16 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
// text of the entry.
bool filter_entry = true;
if (qfp->qf_module != NULL && *qfp->qf_module != NUL) {
filter_entry &= message_filtered((char_u *)qfp->qf_module);
filter_entry &= message_filtered(qfp->qf_module);
}
if (filter_entry && fname != NULL) {
filter_entry &= message_filtered((char_u *)fname);
filter_entry &= message_filtered(fname);
}
if (filter_entry && qfp->qf_pattern != NULL) {
filter_entry &= message_filtered((char_u *)qfp->qf_pattern);
filter_entry &= message_filtered(qfp->qf_pattern);
}
if (filter_entry) {
filter_entry &= message_filtered((char_u *)qfp->qf_text);
filter_entry &= message_filtered(qfp->qf_text);
}
if (filter_entry) {
return;

View File

@ -488,10 +488,10 @@ static char_u *skip_anyof(char *p)
/// When "newp" is not NULL and "dirc" is '?', make an allocated copy of the
/// expression and change "\?" to "?". If "*newp" is not NULL the expression
/// is changed in-place.
char_u *skip_regexp(char_u *startp, int dirc, int magic, char **newp)
char *skip_regexp(char *startp, int dirc, int magic, char **newp)
{
int mymagic;
char_u *p = startp;
char *p = startp;
if (magic) {
mymagic = MAGIC_ON;
@ -506,7 +506,7 @@ char_u *skip_regexp(char_u *startp, int dirc, int magic, char **newp)
}
if ((p[0] == '[' && mymagic >= MAGIC_ON)
|| (p[0] == '\\' && p[1] == '[' && mymagic <= MAGIC_OFF)) {
p = skip_anyof((char *)p + 1);
p = (char *)skip_anyof(p + 1);
if (p[0] == NUL) {
break;
}
@ -514,8 +514,8 @@ char_u *skip_regexp(char_u *startp, int dirc, int magic, char **newp)
if (dirc == '?' && newp != NULL && p[1] == '?') {
// change "\?" to "?", make a copy first.
if (*newp == NULL) {
*newp = (char *)vim_strsave(startp);
p = (char_u *)(*newp) + (p - startp);
*newp = xstrdup(startp);
p = *newp + (p - startp);
}
STRMOVE(p, p + 1);
} else {

View File

@ -815,15 +815,21 @@ static void source_all_matches(char *pat)
/// @param is_pack whether the added dir is a "pack/*/start/*/" style package
static int add_pack_dir_to_rtp(char_u *fname, bool is_pack)
{
char_u *p4, *p3, *p2, *p1, *p;
char_u *buf = NULL;
char *p;
char *buf = NULL;
char *afterdir = NULL;
int retval = FAIL;
p4 = p3 = p2 = p1 = get_past_head(fname);
char *p1 = get_past_head((char *)fname);
char *p2 = p1;
char *p3 = p1;
char *p4 = p1;
for (p = p1; *p; MB_PTR_ADV(p)) {
if (vim_ispathsep_nocolon(*p)) {
p4 = p3; p3 = p2; p2 = p1; p1 = p;
p4 = p3;
p3 = p2;
p2 = p1;
p1 = p;
}
}
@ -833,7 +839,7 @@ static int add_pack_dir_to_rtp(char_u *fname, bool is_pack)
//
// find the part up to "pack" in 'runtimepath'
p4++; // append pathsep in order to expand symlink
char_u c = *p4;
char c = *p4;
*p4 = NUL;
char *const ffname = fix_fname((char *)fname);
*p4 = c;
@ -854,10 +860,10 @@ static int add_pack_dir_to_rtp(char_u *fname, bool is_pack)
for (const char *entry = (const char *)p_rtp; *entry != NUL;) {
const char *cur_entry = entry;
copy_option_part((char **)&entry, (char *)buf, MAXPATHL, ",");
copy_option_part((char **)&entry, buf, MAXPATHL, ",");
if (insp == NULL) {
add_pathsep((char *)buf);
char *const rtp_ffname = fix_fname((char *)buf);
add_pathsep(buf);
char *const rtp_ffname = fix_fname(buf);
if (rtp_ffname == NULL) {
goto theend;
}
@ -869,7 +875,7 @@ static int add_pack_dir_to_rtp(char_u *fname, bool is_pack)
}
}
if ((p = (char_u *)strstr((char *)buf, "after")) != NULL
if ((p = strstr(buf, "after")) != NULL
&& p > buf
&& vim_ispathsep(p[-1])
&& (vim_ispathsep(p[5]) || p[5] == NUL || p[5] == ',')) {
@ -2018,7 +2024,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
&& firstline[1] == 0xbb && firstline[2] == 0xbf) {
// Found BOM; setup conversion, skip over BOM and recode the line.
convert_setup(&cookie.conv, (char_u *)"utf-8", (char_u *)p_enc);
convert_setup(&cookie.conv, "utf-8", p_enc);
p = (char *)string_convert(&cookie.conv, (char_u *)firstline + 3, NULL);
if (p == NULL) {
p = xstrdup((char *)firstline + 3);
@ -2149,7 +2155,7 @@ void ex_scriptnames(exarg_T *eap)
if (SCRIPT_ITEM(i).sn_name != NULL) {
home_replace(NULL, (char *)SCRIPT_ITEM(i).sn_name, (char *)NameBuff, MAXPATHL, true);
vim_snprintf((char *)IObuff, IOSIZE, "%3d: %s", i, NameBuff);
if (!message_filtered(IObuff)) {
if (!message_filtered((char *)IObuff)) {
msg_putchar('\n');
msg_outtrans((char *)IObuff);
line_breakcheck();
@ -2439,7 +2445,7 @@ void ex_scriptencoding(exarg_T *eap)
// Setup for conversion from the specified encoding to 'encoding'.
sp = (struct source_cookie *)getline_cookie(eap->getline, eap->cookie);
convert_setup(&sp->conv, (char_u *)name, (char_u *)p_enc);
convert_setup(&sp->conv, name, p_enc);
if (name != eap->arg) {
xfree(name);

View File

@ -277,7 +277,7 @@ static int wildmenu_match_len(expand_T *xp, char_u *s)
/// These are backslashes used for escaping. Do show backslashes in help tags.
static int skip_wildmenu_char(expand_T *xp, char_u *s)
{
if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
if ((rem_backslash((char *)s) && xp->xp_context != EXPAND_HELP)
|| ((xp->xp_context == EXPAND_MENUS
|| xp->xp_context == EXPAND_MENUNAMES)
&& (s[0] == '\t'
@ -469,10 +469,10 @@ void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int match, i
ScreenGrid *grid = (wild_menu_showing == WM_SCROLLED)
? &msg_grid_adj : &default_grid;
grid_puts(grid, buf, row, 0, attr);
grid_puts(grid, (char *)buf, row, 0, attr);
if (selstart != NULL && highlight) {
*selend = NUL;
grid_puts(grid, selstart, row, selstart_col, HL_ATTR(HLF_WM));
grid_puts(grid, (char *)selstart, row, selstart_col, HL_ATTR(HLF_WM));
}
grid_fill(grid, row, row + 1, clen, Columns,
@ -1026,12 +1026,12 @@ void draw_tabline(void)
if (col + len >= Columns - 3) {
break;
}
grid_puts_len(&default_grid, (char_u *)NameBuff, len, 0, col,
grid_puts_len(&default_grid, NameBuff, len, 0, col,
hl_combine_attr(attr, win_hl_attr(cwp, HLF_T)));
col += len;
}
if (modified) {
grid_puts_len(&default_grid, (char_u *)"+", 1, 0, col++, attr);
grid_puts_len(&default_grid, "+", 1, 0, col++, attr);
}
grid_putchar(&default_grid, ' ', 0, col++, attr);
}
@ -1040,7 +1040,7 @@ void draw_tabline(void)
if (room > 0) {
// Get buffer name in NameBuff[]
get_trans_bufname(cwp->w_buffer);
shorten_dir((char_u *)NameBuff);
shorten_dir(NameBuff);
len = vim_strsize((char *)NameBuff);
p = (char_u *)NameBuff;
while (len > room) {
@ -1051,7 +1051,7 @@ void draw_tabline(void)
len = Columns - col - 1;
}
grid_puts_len(&default_grid, p, (int)STRLEN(p), 0, col, attr);
grid_puts_len(&default_grid, (char *)p, (int)STRLEN(p), 0, col, attr);
col += len;
}
grid_putchar(&default_grid, ' ', 0, col++, attr);

View File

@ -1124,7 +1124,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char_u *pat, long count,
* If there is a matching '/' or '?', toss it.
*/
ps = (char_u *)strcopy;
p = skip_regexp(pat, search_delim, p_magic, &strcopy);
p = (char_u *)skip_regexp((char *)pat, search_delim, p_magic, &strcopy);
if (strcopy != (char *)ps) {
// made a copy of "pat" to change "\?" to "?"
searchcmdlen += (int)(STRLEN(pat) - STRLEN(strcopy));
@ -1977,7 +1977,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
// backward search: Check if this line contains a single-line comment
if ((backwards && comment_dir) || lisp) {
comment_col = check_linecomment(linep);
comment_col = check_linecomment((char *)linep);
}
if (lisp && comment_col != MAXCOL && pos.col > (colnr_T)comment_col) {
lispcomm = true; // find match inside this comment
@ -2010,7 +2010,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
// Check if this line contains a single-line comment
if (comment_dir || lisp) {
comment_col = check_linecomment(linep);
comment_col = check_linecomment((char *)linep);
}
// skip comment
if (lisp && comment_col != MAXCOL) {
@ -2043,7 +2043,7 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
do_quotes = -1;
line_breakcheck();
if (lisp) { // find comment pos in new line
comment_col = check_linecomment(linep);
comment_col = check_linecomment((char *)linep);
}
} else {
pos.col += utfc_ptr2len((char *)linep + pos.col);
@ -2301,15 +2301,15 @@ pos_T *findmatchlimit(oparg_T *oap, int initc, int flags, int64_t maxtravel)
/// Check if line[] contains a / / comment.
/// @returns MAXCOL if not, otherwise return the column.
int check_linecomment(const char_u *line)
int check_linecomment(const char *line)
{
const char_u *p = line; // scan from start
const char *p = line; // scan from start
// skip Lispish one-line comments
if (curbuf->b_p_lisp) {
if (vim_strchr((char *)p, ';') != NULL) { // there may be comments
bool in_str = false; // inside of string
while ((p = (char_u *)strpbrk((char *)p, "\";")) != NULL) {
while ((p = strpbrk((char *)p, "\";")) != NULL) {
if (*p == '"') {
if (in_str) {
if (*(p - 1) != '\\') { // skip escaped quote
@ -2322,7 +2322,7 @@ int check_linecomment(const char_u *line)
}
} else if (!in_str && ((p - line) < 2
|| (*(p - 1) != '\\' && *(p - 2) != '#'))
&& !is_pos_in_string(line, (colnr_T)(p - line))) {
&& !is_pos_in_string((char_u *)line, (colnr_T)(p - line))) {
break; // found!
}
p++;
@ -2331,12 +2331,12 @@ int check_linecomment(const char_u *line)
p = NULL;
}
} else {
while ((p = (char_u *)vim_strchr((char *)p, '/')) != NULL) {
while ((p = vim_strchr((char *)p, '/')) != NULL) {
// Accept a double /, unless it's preceded with * and followed by *,
// because * / / * is an end and start of a C comment. Only
// accept the position if it is not inside a string.
if (p[1] == '/' && (p == line || p[-1] != '*' || p[2] != '*')
&& !is_pos_in_string(line, (colnr_T)(p - line))) {
&& !is_pos_in_string((char_u *)line, (colnr_T)(p - line))) {
break;
}
p++;
@ -3536,7 +3536,6 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
int i;
char_u *already = NULL;
char_u *startp = NULL;
char_u *inc_opt = NULL;
win_T *curwin_save = NULL;
const int l_g_do_tagpreview = g_do_tagpreview;
@ -3561,9 +3560,9 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
goto fpip_end;
}
}
inc_opt = (*curbuf->b_p_inc == NUL) ? (char_u *)p_inc : (char_u *)curbuf->b_p_inc;
char *inc_opt = (*curbuf->b_p_inc == NUL) ? p_inc : curbuf->b_p_inc;
if (*inc_opt != NUL) {
incl_regmatch.regprog = vim_regcomp((char *)inc_opt, p_magic ? RE_MAGIC : 0);
incl_regmatch.regprog = vim_regcomp(inc_opt, p_magic ? RE_MAGIC : 0);
if (incl_regmatch.regprog == NULL) {
goto fpip_end;
}
@ -3597,7 +3596,7 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
char_u *p_fname = (curr_fname == (char_u *)curbuf->b_fname)
? (char_u *)curbuf->b_ffname : curr_fname;
if (inc_opt != NULL && strstr((char *)inc_opt, "\\zs") != NULL) {
if (inc_opt != NULL && strstr(inc_opt, "\\zs") != NULL) {
// Use text from '\zs' to '\ze' (or end) of 'include'.
new_fname = find_file_name_in_path(incl_regmatch.startp[0],
(size_t)(incl_regmatch.endp[0]
@ -3674,7 +3673,7 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
* Include the surrounding "" or <> if present.
*/
if (inc_opt != NULL
&& strstr((char *)inc_opt, "\\zs") != NULL) {
&& strstr(inc_opt, "\\zs") != NULL) {
// pattern contains \zs, use the match
p = incl_regmatch.startp[0];
i = (int)(incl_regmatch.endp[0]

View File

@ -1477,7 +1477,7 @@ static char *shada_filename(const char *file)
// because various expansions must have already be done by the shell.
// If shell is not performing them then they should be done in main.c
// where arguments are parsed, *not here*.
expand_env((char_u *)file, (char_u *)&(NameBuff[0]), MAXPATHL);
expand_env((char *)file, &(NameBuff[0]), MAXPATHL);
file = (const char *)&(NameBuff[0]);
}
}

View File

@ -2042,7 +2042,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
}
vim_snprintf((char *)IObuff, IOSIZE, _("Reading affix file %s..."), fname);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
// Only do REP lines when not done in another .aff file already.
do_rep = GA_EMPTY(&spin->si_rep);
@ -2123,7 +2123,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// Setup for conversion from "ENC" to 'encoding'.
aff->af_enc = (char_u *)enc_canonize((char *)items[1]);
if (!spin->si_ascii
&& convert_setup(&spin->si_conv, aff->af_enc, (char_u *)p_enc) == FAIL) {
&& convert_setup(&spin->si_conv, (char *)aff->af_enc, p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"),
fname, aff->af_enc, p_enc);
}
@ -3123,7 +3123,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
vim_snprintf((char *)IObuff, IOSIZE,
_("Reading dictionary file %s..."), fname);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
// start with a message for the first line
spin->si_msg_count = 999999;
@ -3676,7 +3676,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
}
vim_snprintf((char *)IObuff, IOSIZE, _("Reading word file %s..."), fname);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
// Read all the lines in the file one by one.
while (!vim_fgets(rline, MAXLINELEN, fd) && !got_int) {
@ -3723,13 +3723,13 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
smsg(_("/encoding= line after word ignored in %s line %ld: %s"),
fname, lnum, line - 1);
} else {
char_u *enc;
char *enc;
// Setup for conversion to 'encoding'.
line += 9;
enc = (char_u *)enc_canonize((char *)line);
enc = enc_canonize((char *)line);
if (!spin->si_ascii
&& convert_setup(&spin->si_conv, enc, (char_u *)p_enc) == FAIL) {
&& convert_setup(&spin->si_conv, enc, p_enc) == FAIL) {
smsg(_("Conversion in %s not supported: from %s to %s"),
fname, line, p_enc);
}
@ -3820,7 +3820,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
if (spin->si_ascii && non_ascii > 0) {
vim_snprintf((char *)IObuff, IOSIZE,
_("Ignored %d words with non-ASCII characters"), non_ascii);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
}
return retval;
@ -3894,13 +3894,13 @@ static wordnode_T *wordtree_alloc(spellinfo_T *spin)
/// Return true if "word" contains valid word characters.
/// Control characters and trailing '/' are invalid. Space is OK.
static bool valid_spell_word(const char_u *word, const char_u *end)
static bool valid_spell_word(const char *word, const char *end)
{
if (!utf_valid_string(word, end)) {
if (!utf_valid_string((char_u *)word, (char_u *)end)) {
return false;
}
for (const char_u *p = word; *p != NUL && p < end; p += utfc_ptr2len((const char *)p)) {
if (*p < ' ' || (p[0] == '/' && p[1] == NUL)) {
for (const char *p = word; *p != NUL && p < end; p += utfc_ptr2len(p)) {
if ((uint8_t)(*p) < ' ' || (p[0] == '/' && p[1] == NUL)) {
return false;
}
}
@ -3928,7 +3928,7 @@ static int store_word(spellinfo_T *spin, char_u *word, int flags, int region, co
int res = OK;
// Avoid adding illegal bytes to the word tree.
if (!valid_spell_word(word, word + len)) {
if (!valid_spell_word((char *)word, (char *)word + len)) {
return FAIL;
}
@ -4213,7 +4213,7 @@ static void wordtree_compress(spellinfo_T *spin, wordnode_T *root, const char *n
vim_snprintf((char *)IObuff, IOSIZE,
_("Compressed %s of %ld nodes; %ld (%ld%%) remaining"),
name, tot, tot - n, perc);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
}
#ifdef SPELL_PRINTTREE
spell_print_tree(root->wn_sibling);
@ -4347,14 +4347,15 @@ static int rep_compare(const void *s1, const void *s2)
return STRCMP(p1->ft_from, p2->ft_from);
}
// Write the Vim .spl file "fname".
// Return OK/FAIL.
static int write_vim_spell(spellinfo_T *spin, char_u *fname)
/// Write the Vim .spl file "fname".
///
/// @return OK/FAIL.
static int write_vim_spell(spellinfo_T *spin, char *fname)
{
int retval = OK;
int regionmask;
FILE *fd = os_fopen((char *)fname, "w");
FILE *fd = os_fopen(fname, "w");
if (fd == NULL) {
semsg(_(e_notopen), fname);
return FAIL;
@ -4893,7 +4894,7 @@ void ex_mkspell(exarg_T *eap)
// Create the .sug file.
// Uses the soundfold info in "spin".
// Writes the file with the name "wfname", with ".spl" changed to ".sug".
static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
static void spell_make_sugfile(spellinfo_T *spin, char *wfname)
{
char_u *fname = NULL;
int len;
@ -4906,14 +4907,14 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
// of the code for the soundfolding stuff.
// It might have been done already by spell_reload_one().
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
if (path_full_compare((char *)wfname, (char *)slang->sl_fname, false, true)
if (path_full_compare(wfname, (char *)slang->sl_fname, false, true)
== kEqualFiles) {
break;
}
}
if (slang == NULL) {
spell_message(spin, (char_u *)_("Reading back spell file..."));
slang = spell_load_file(wfname, NULL, NULL, false);
spell_message(spin, _("Reading back spell file..."));
slang = spell_load_file((char_u *)wfname, NULL, NULL, false);
if (slang == NULL) {
return;
}
@ -4930,7 +4931,7 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
// Go through the trie of good words, soundfold each word and add it to
// the soundfold trie.
spell_message(spin, (char_u *)_("Performing soundfolding..."));
spell_message(spin, _("Performing soundfolding..."));
if (sug_filltree(spin, slang) == FAIL) {
goto theend;
}
@ -4947,7 +4948,7 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
(int64_t)spin->si_spellbuf->b_ml.ml_line_count);
// Compress the soundfold trie.
spell_message(spin, (char_u *)_(msg_compressing));
spell_message(spin, _(msg_compressing));
wordtree_compress(spin, spin->si_foldroot, "case-folded");
// Write the .sug file.
@ -5193,7 +5194,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
vim_snprintf((char *)IObuff, IOSIZE,
_("Writing suggestion file %s..."), fname);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
// <SUGHEADER>: <fileID> <versionnr> <timestamp>
if (fwrite(VIMSUGMAGIC, VIMSUGMAGICL, (size_t)1, fd) != 1) { // <fileID>
@ -5249,7 +5250,7 @@ static void sug_write(spellinfo_T *spin, char_u *fname)
vim_snprintf((char *)IObuff, IOSIZE,
_("Estimated runtime memory use: %d bytes"), spin->si_memtot);
spell_message(spin, IObuff);
spell_message(spin, (char *)IObuff);
theend:
// close the file
@ -5268,7 +5269,6 @@ theend:
static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool added_word)
{
char_u *fname = NULL;
char_u *wfname;
char **innames;
int incount;
afffile_T *(afile[MAXREGIONS]);
@ -5296,7 +5296,7 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool
innames = &fnames[fcount == 1 ? 0 : 1];
incount = fcount - 1;
wfname = xmalloc(MAXPATHL);
char *wfname = xmalloc(MAXPATHL);
if (fcount >= 1) {
len = (int)STRLEN(fnames[0]);
@ -5304,46 +5304,46 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool
// For ":mkspell path/en.latin1.add" output file is
// "path/en.latin1.add.spl".
incount = 1;
vim_snprintf((char *)wfname, MAXPATHL, "%s.spl", fnames[0]);
vim_snprintf(wfname, MAXPATHL, "%s.spl", fnames[0]);
} else if (fcount == 1) {
// For ":mkspell path/vim" output file is "path/vim.latin1.spl".
incount = 1;
vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
vim_snprintf(wfname, MAXPATHL, SPL_FNAME_TMPL,
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
} else if (len > 4 && STRCMP(fnames[0] + len - 4, ".spl") == 0) {
// Name ends in ".spl", use as the file name.
STRLCPY(wfname, fnames[0], MAXPATHL);
} else {
// Name should be language, make the file name from it.
vim_snprintf((char *)wfname, MAXPATHL, SPL_FNAME_TMPL,
vim_snprintf(wfname, MAXPATHL, SPL_FNAME_TMPL,
fnames[0], spin.si_ascii ? (char_u *)"ascii" : spell_enc());
}
// Check for .ascii.spl.
if (strstr(path_tail((char *)wfname), SPL_FNAME_ASCII) != NULL) {
if (strstr(path_tail(wfname), SPL_FNAME_ASCII) != NULL) {
spin.si_ascii = true;
}
// Check for .add.spl.
if (strstr(path_tail((char *)wfname), SPL_FNAME_ADD) != NULL) {
if (strstr(path_tail(wfname), SPL_FNAME_ADD) != NULL) {
spin.si_add = true;
}
}
if (incount <= 0) {
emsg(_(e_invarg)); // need at least output and input names
} else if (vim_strchr(path_tail((char *)wfname), '_') != NULL) {
} else if (vim_strchr(path_tail(wfname), '_') != NULL) {
emsg(_("E751: Output file name must not have region name"));
} else if (incount > MAXREGIONS) {
semsg(_("E754: Only up to %d regions supported"), MAXREGIONS);
} else {
// Check for overwriting before doing things that may take a lot of
// time.
if (!over_write && os_path_exists(wfname)) {
if (!over_write && os_path_exists((char_u *)wfname)) {
emsg(_(e_exists));
goto theend;
}
if (os_isdir(wfname)) {
if (os_isdir((char_u *)wfname)) {
semsg(_(e_isadir2), wfname);
goto theend;
}
@ -5421,7 +5421,7 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool
if (!error && !got_int) {
// Combine tails in the tree.
spell_message(&spin, (char_u *)_(msg_compressing));
spell_message(&spin, _(msg_compressing));
wordtree_compress(&spin, spin.si_foldroot, "case-folded");
wordtree_compress(&spin, spin.si_keeproot, "keep-case");
wordtree_compress(&spin, spin.si_prefroot, "prefixes");
@ -5431,18 +5431,18 @@ static void mkspell(int fcount, char **fnames, bool ascii, bool over_write, bool
// Write the info in the spell file.
vim_snprintf((char *)IObuff, IOSIZE,
_("Writing spell file %s..."), wfname);
spell_message(&spin, IObuff);
spell_message(&spin, (char *)IObuff);
error = write_vim_spell(&spin, wfname) == FAIL;
spell_message(&spin, (char_u *)_("Done!"));
spell_message(&spin, _("Done!"));
vim_snprintf((char *)IObuff, IOSIZE,
_("Estimated runtime memory use: %d bytes"), spin.si_memtot);
spell_message(&spin, IObuff);
spell_message(&spin, (char *)IObuff);
// If the file is loaded need to reload it.
if (!error) {
spell_reload_one(wfname, added_word);
spell_reload_one((char_u *)wfname, added_word);
}
}
@ -5479,14 +5479,14 @@ theend:
// Display a message for spell file processing when 'verbose' is set or using
// ":mkspell". "str" can be IObuff.
static void spell_message(const spellinfo_T *spin, char_u *str)
static void spell_message(const spellinfo_T *spin, char *str)
FUNC_ATTR_NONNULL_ALL
{
if (spin->si_verbose || p_verbose > 2) {
if (!spin->si_verbose) {
verbose_enter();
}
msg((char *)str);
msg(str);
ui_flush();
if (!spin->si_verbose) {
verbose_leave();
@ -5524,7 +5524,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
int i;
char_u *spf;
if (!valid_spell_word(word, word + len)) {
if (!valid_spell_word((char *)word, (char *)word + len)) {
emsg(_(e_illegal_character_in_word));
return;
}

View File

@ -132,13 +132,13 @@ void win_redr_status(win_T *wp)
row = is_stl_global ? (Rows - (int)p_ch - 1) : W_ENDROW(wp);
col = is_stl_global ? 0 : wp->w_wincol;
grid_puts(&default_grid, p, row, col, attr);
grid_puts(&default_grid, (char *)p, row, col, attr);
grid_fill(&default_grid, row, row + 1, len + col,
this_ru_col + col, fillchar, fillchar, attr);
if (get_keymap_str(wp, "<%s>", (char *)NameBuff, MAXPATHL)
&& this_ru_col - len > (int)(STRLEN(NameBuff) + 1)) {
grid_puts(&default_grid, (char_u *)NameBuff, row,
grid_puts(&default_grid, NameBuff, row,
(int)((size_t)this_ru_col - STRLEN(NameBuff) - 1), attr);
}
@ -342,7 +342,7 @@ void win_redr_ruler(win_T *wp, bool always)
}
ScreenGrid *grid = part_of_status ? &default_grid : &msg_grid_adj;
grid_puts(grid, (char_u *)buffer, row, this_ru_col + off, attr);
grid_puts(grid, buffer, row, this_ru_col + off, attr);
grid_fill(grid, row, row + 1,
this_ru_col + off + (int)STRLEN(buffer), off + width, fillchar,
fillchar, attr);
@ -571,8 +571,8 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
p = buf;
for (n = 0; hltab[n].start != NULL; n++) {
int textlen = (int)(hltab[n].start - p);
grid_puts_len(grid, (char_u *)p, textlen, row, col, curattr);
col += vim_strnsize((char_u *)p, textlen);
grid_puts_len(grid, p, textlen, row, col, curattr);
col += vim_strnsize(p, textlen);
p = hltab[n].start;
if (hltab[n].userhl == 0) {
@ -586,8 +586,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
}
}
// Make sure to use an empty string instead of p, if p is beyond buf + len.
grid_puts(grid, p >= buf + len ? (char_u *)"" : (char_u *)p, row, col,
curattr);
grid_puts(grid, p >= buf + len ? "" : p, row, col, curattr);
grid_puts_line_flush(false);
@ -608,7 +607,7 @@ void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
.type = kStlClickDisabled,
};
for (n = 0; tabtab[n].start != NULL; n++) {
len += vim_strnsize((char_u *)p, (int)(tabtab[n].start - p));
len += vim_strnsize(p, (int)(tabtab[n].start - p));
while (col < len) {
click_defs[col++] = cur_click_def;
}

View File

@ -104,7 +104,7 @@ char_u *vim_strsave_escaped_ext(const char_u *string, const char_u *esc_chars, c
p += l - 1;
continue;
}
if (vim_strchr((char *)esc_chars, *p) != NULL || (bsl && rem_backslash(p))) {
if (vim_strchr((char *)esc_chars, *p) != NULL || (bsl && rem_backslash((char *)p))) {
length++; // count a backslash
}
length++; // count an ordinary char
@ -120,7 +120,7 @@ char_u *vim_strsave_escaped_ext(const char_u *string, const char_u *esc_chars, c
p += l - 1; // skip multibyte char
continue;
}
if (vim_strchr((char *)esc_chars, *p) != NULL || (bsl && rem_backslash(p))) {
if (vim_strchr((char *)esc_chars, *p) != NULL || (bsl && rem_backslash((char *)p))) {
*p2++ = cc;
}
*p2++ = *p;

View File

@ -3008,7 +3008,7 @@ static void syn_cmd_conceal(exarg_T *eap, int syncing)
char_u *arg = (char_u *)eap->arg;
char_u *next;
eap->nextcmd = (char *)find_nextcmd(arg);
eap->nextcmd = find_nextcmd((char *)arg);
if (eap->skip) {
return;
}
@ -3037,7 +3037,7 @@ static void syn_cmd_case(exarg_T *eap, int syncing)
char_u *arg = (char_u *)eap->arg;
char_u *next;
eap->nextcmd = (char *)find_nextcmd(arg);
eap->nextcmd = find_nextcmd((char *)arg);
if (eap->skip) {
return;
}
@ -3064,7 +3064,7 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
char_u *arg = (char_u *)eap->arg;
char_u *arg_end;
eap->nextcmd = (char *)find_nextcmd(arg);
eap->nextcmd = find_nextcmd((char *)arg);
if (eap->skip) {
return;
}
@ -3105,7 +3105,7 @@ static void syn_cmd_spell(exarg_T *eap, int syncing)
char_u *arg = (char_u *)eap->arg;
char_u *next;
eap->nextcmd = (char *)find_nextcmd(arg);
eap->nextcmd = find_nextcmd((char *)arg);
if (eap->skip) {
return;
}
@ -3312,7 +3312,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
char_u *arg_end;
int id;
eap->nextcmd = (char *)find_nextcmd(arg);
eap->nextcmd = find_nextcmd((char *)arg);
if (eap->skip) {
return;
}
@ -3465,7 +3465,7 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
char_u *arg = (char_u *)eap->arg;
char_u *arg_end;
eap->nextcmd = (char *)find_nextcmd(arg);
eap->nextcmd = find_nextcmd((char *)arg);
if (eap->skip) {
return;
}
@ -4237,7 +4237,7 @@ static void syn_cmd_include(exarg_T *eap, int syncing)
int prev_syn_inc_tag;
bool source = false;
eap->nextcmd = (char *)find_nextcmd((char_u *)arg);
eap->nextcmd = find_nextcmd(arg);
if (eap->skip) {
return;
}
@ -4958,7 +4958,7 @@ static void syn_cmd_cluster(exarg_T *eap, int syncing)
int opt_len;
int list_op;
eap->nextcmd = (char *)find_nextcmd((char_u *)arg);
eap->nextcmd = find_nextcmd(arg);
if (eap->skip) {
return;
}
@ -5042,7 +5042,7 @@ static char *get_syn_pattern(char_u *arg, synpat_T *ci)
return NULL;
}
end = (char *)skip_regexp(arg + 1, *arg, true, NULL);
end = skip_regexp((char *)arg + 1, *arg, true, NULL);
if (*end != (char)(*arg)) { // end delimiter not found
semsg(_("E401: Pattern delimiter not found: %s"), arg);
return NULL;
@ -5199,7 +5199,7 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
finished = true;
break;
}
arg_end = (char *)skip_regexp(next_arg + 1, *next_arg, true, NULL);
arg_end = skip_regexp((char *)next_arg + 1, *next_arg, true, NULL);
if (*arg_end != (char)(*next_arg)) { // end delimiter not found
illegal = true;
break;

View File

@ -1781,7 +1781,7 @@ line_read_in:
// encoding to 'encoding'.
for (p = lbuf + 20; *p > ' ' && *p < 127; p++) {}
*p = NUL;
convert_setup(&vimconv, lbuf + 20, (char_u *)p_enc);
convert_setup(&vimconv, (char *)lbuf + 20, p_enc);
}
// Read the next line. Unrecognized flags are ignored.
@ -2055,8 +2055,9 @@ parse_line:
mtt = MT_GL_OTH;
} else {
// Decide in which array to store this match.
is_current = test_for_current(tagp.fname, tagp.fname_end, tag_fname,
(char_u *)buf_ffname);
is_current = test_for_current((char *)tagp.fname, (char *)tagp.fname_end,
(char *)tag_fname,
buf_ffname);
is_static = test_for_static(&tagp);
// Decide in which of the sixteen tables to store this match.
@ -2826,7 +2827,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
*/
str = pbuf;
if (pbuf[0] == '/' || pbuf[0] == '?') {
str = skip_regexp(pbuf + 1, pbuf[0], false, NULL) + 1;
str = (char_u *)skip_regexp((char *)pbuf + 1, pbuf[0], false, NULL) + 1;
}
if (str > pbuf_end - 1) { // search command with nothing following
save_p_ws = p_ws;
@ -3012,27 +3013,25 @@ static char_u *expand_tag_fname(char_u *fname, char_u *const tag_fname, const bo
return retval;
}
/*
* Check if we have a tag for the buffer with name "buf_ffname".
* This is a bit slow, because of the full path compare in path_full_compare().
* Return true if tag for file "fname" if tag file "tag_fname" is for current
* file.
*/
static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname, char_u *buf_ffname)
/// Check if we have a tag for the buffer with name "buf_ffname".
/// This is a bit slow, because of the full path compare in path_full_compare().
///
/// @return true if tag for file "fname" if tag file "tag_fname" is for current
/// file.
static int test_for_current(char *fname, char *fname_end, char *tag_fname, char *buf_ffname)
{
int c;
int retval = false;
char_u *fullname;
if (buf_ffname != NULL) { // if the buffer has a name
{
c = *fname_end;
c = (unsigned char)(*fname_end);
*fname_end = NUL;
}
fullname = expand_tag_fname(fname, tag_fname, true);
retval = (path_full_compare((char *)fullname, (char *)buf_ffname, true, true) & kEqualFiles);
char *fullname = (char *)expand_tag_fname((char_u *)fname, (char_u *)tag_fname, true);
retval = (path_full_compare(fullname, buf_ffname, true, true) & kEqualFiles);
xfree(fullname);
*fname_end = (char_u)c;
*fname_end = (char)c;
}
return retval;
@ -3052,7 +3051,7 @@ static int find_extra(char_u **pp)
if (ascii_isdigit(*str)) {
str = (char_u *)skipdigits((char *)str + 1);
} else if (*str == '/' || *str == '?') {
str = skip_regexp(str + 1, *str, false, NULL);
str = (char_u *)skip_regexp((char *)str + 1, *str, false, NULL);
if (*str != first_char) {
str = NULL;
} else {

View File

@ -121,7 +121,7 @@ void internal_format(int textwidth, int second_indent, int flags, bool format_on
leader_len = get_leader_len((char *)line, NULL, false, true);
if (leader_len == 0 && curbuf->b_p_cin) {
// Check for a line comment after code.
int comment_start = check_linecomment(line);
int comment_start = check_linecomment((char *)line);
if (comment_start != MAXCOL) {
leader_len = get_leader_len((char *)line + comment_start, NULL, false, true);
if (leader_len != 0) {
@ -411,7 +411,7 @@ void internal_format(int textwidth, int second_indent, int flags, bool format_on
// add the additional whitespace needed after the
// comment leader for the numbered list.
for (int i = 0; i < padding; i++) {
ins_str((char_u *)" ");
ins_str(" ");
}
changed_bytes(curwin->w_cursor.lnum, leader_len);
} else {
@ -1026,7 +1026,7 @@ void format_lines(linenr_T line_count, bool avoid_fex)
// paragraph doesn't really end.
if (next_leader_flags == NULL
|| STRNCMP(next_leader_flags, "://", 3) != 0
|| check_linecomment(get_cursor_line_ptr()) == MAXCOL) {
|| check_linecomment((char *)get_cursor_line_ptr()) == MAXCOL) {
is_end_par = true;
}
}

View File

@ -127,7 +127,7 @@ char *find_ucmd(exarg_T *eap, char *p, int *full, expand_T *xp, int *complp)
for (j = 0; j < gap->ga_len; j++) {
uc = USER_CMD_GA(gap, j);
cp = eap->cmd;
np = (char *)uc->uc_name;
np = uc->uc_name;
k = 0;
while (k < len && *np != NUL && *cp++ == *np++) {
k++;
@ -167,7 +167,7 @@ char *find_ucmd(exarg_T *eap, char *p, int *full, expand_T *xp, int *complp)
}
if (xp != NULL) {
xp->xp_luaref = uc->uc_compl_luaref;
xp->xp_arg = (char *)uc->uc_compl_arg;
xp->xp_arg = uc->uc_compl_arg;
xp->xp_script_ctx = uc->uc_script_ctx;
xp->xp_script_ctx.sc_lnum += SOURCING_LNUM;
}
@ -272,12 +272,12 @@ char *get_user_commands(expand_T *xp FUNC_ATTR_UNUSED, int idx)
const buf_T *const buf = prevwin_curwin()->w_buffer;
if (idx < buf->b_ucmds.ga_len) {
return (char *)USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
}
idx -= buf->b_ucmds.ga_len;
if (idx < ucmds.ga_len) {
char *name = (char *)USER_CMD(idx)->uc_name;
char *name = USER_CMD(idx)->uc_name;
for (int i = 0; i < buf->b_ucmds.ga_len; i++) {
if (STRCMP(name, USER_CMD_GA(&buf->b_ucmds, i)->uc_name) == 0) {
@ -297,14 +297,14 @@ char *get_user_commands(expand_T *xp FUNC_ATTR_UNUSED, int idx)
char *get_user_command_name(int idx, int cmdidx)
{
if (cmdidx == CMD_USER && idx < ucmds.ga_len) {
return (char *)USER_CMD(idx)->uc_name;
return USER_CMD(idx)->uc_name;
}
if (cmdidx == CMD_USER_BUF) {
// In cmdwin, the alternative buffer should be used.
const buf_T *const buf = prevwin_curwin()->w_buffer;
if (idx < buf->b_ucmds.ga_len) {
return (char *)USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
}
}
return NULL;
@ -434,7 +434,7 @@ static void uc_list(char *name, size_t name_len)
msg_putchar(' ');
}
msg_outtrans_attr(cmd->uc_name, HL_ATTR(HLF_D));
msg_outtrans_attr((char_u *)cmd->uc_name, HL_ATTR(HLF_D));
len = (int)STRLEN(cmd->uc_name) + 4;
do {
@ -531,7 +531,7 @@ static void uc_list(char *name, size_t name_len)
}
}
msg_outtrans_special(cmd->uc_rep, false,
msg_outtrans_special((char_u *)cmd->uc_rep, false,
name_len == 0 ? Columns - 47 : 0);
if (p_verbose > 0) {
last_set_msg(cmd->uc_script_ctx);
@ -883,17 +883,17 @@ int uc_add_command(char *name, size_t name_len, const char *rep, uint32_t argt,
gap->ga_len++;
cmd->uc_name = (char_u *)p;
cmd->uc_name = p;
}
cmd->uc_rep = (char_u *)rep_buf;
cmd->uc_rep = rep_buf;
cmd->uc_argt = argt;
cmd->uc_def = def;
cmd->uc_compl = compl;
cmd->uc_script_ctx = current_sctx;
cmd->uc_script_ctx.sc_lnum += SOURCING_LNUM;
nlua_set_sctx(&cmd->uc_script_ctx);
cmd->uc_compl_arg = (char_u *)compl_arg;
cmd->uc_compl_arg = compl_arg;
cmd->uc_compl_luaref = compl_luaref;
cmd->uc_preview_luaref = preview_luaref;
cmd->uc_addr_type = addr_type;
@ -1569,7 +1569,7 @@ int do_ucmd(exarg_T *eap, bool preview)
// Second round: copy result into "buf".
buf = NULL;
for (;;) {
p = (char *)cmd->uc_rep; // source
p = cmd->uc_rep; // source
q = buf; // destination
totlen = 0;

View File

@ -4,14 +4,14 @@
#include "nvim/ex_cmds_defs.h"
typedef struct ucmd {
char_u *uc_name; // The command name
char *uc_name; // The command name
uint32_t uc_argt; // The argument type
char_u *uc_rep; // The command's replacement string
char *uc_rep; // The command's replacement string
long uc_def; // The default value for a range/count
int uc_compl; // completion type
cmd_addr_T uc_addr_type; // The command's address type
sctx_T uc_script_ctx; // SCTX where the command was defined
char_u *uc_compl_arg; // completion argument if any
char *uc_compl_arg; // completion argument if any
LuaRef uc_compl_luaref; // Reference to Lua completion function
LuaRef uc_preview_luaref; // Reference to Lua preview function
LuaRef uc_luaref; // Reference to Lua function

View File

@ -2274,7 +2274,7 @@ void intro_message(int colon)
}
if (*p != NUL) {
do_intro_line(row, (char_u *)_(p), 0);
do_intro_line(row, _(p), 0);
}
row++;
}
@ -2287,15 +2287,14 @@ void intro_message(int colon)
}
}
static void do_intro_line(long row, char_u *mesg, int attr)
static void do_intro_line(long row, char *mesg, int attr)
{
long col;
char_u *p;
char *p;
int l;
int clen;
// Center the message horizontally.
col = vim_strsize((char *)mesg);
long col = vim_strsize(mesg);
col = (Columns - col) / 2;
@ -2310,8 +2309,8 @@ static void do_intro_line(long row, char_u *mesg, int attr)
for (l = 0;
p[l] != NUL && (l == 0 || (p[l] != '<' && p[l - 1] != '>'));
l++) {
clen += ptr2cells((char *)p + l);
l += utfc_ptr2len((char *)p + l) - 1;
clen += ptr2cells(p + l);
l += utfc_ptr2len(p + l) - 1;
}
assert(row <= INT_MAX && col <= INT_MAX);
grid_puts_len(&default_grid, p, l, (int)row, (int)col,

View File

@ -215,7 +215,7 @@ newwindow:
case Ctrl_Q:
case 'q':
reset_VIsual_and_resel(); // stop Visual mode
cmd_with_count("quit", (char_u *)cbuf, sizeof(cbuf), Prenum);
cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
break;
@ -223,7 +223,7 @@ newwindow:
case Ctrl_C:
case 'c':
reset_VIsual_and_resel(); // stop Visual mode
cmd_with_count("close", (char_u *)cbuf, sizeof(cbuf), Prenum);
cmd_with_count("close", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
break;
@ -256,7 +256,7 @@ newwindow:
case 'o':
CHECK_CMDWIN;
reset_VIsual_and_resel(); // stop Visual mode
cmd_with_count("only", (char_u *)cbuf, sizeof(cbuf), Prenum);
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf);
break;
@ -622,12 +622,12 @@ wingotofile:
}
}
static void cmd_with_count(char *cmd, char_u *bufp, size_t bufsize, int64_t Prenum)
static void cmd_with_count(char *cmd, char *bufp, size_t bufsize, int64_t Prenum)
{
size_t len = STRLCPY(bufp, cmd, bufsize);
if (Prenum > 0 && len < bufsize) {
vim_snprintf((char *)bufp + len, bufsize - len, "%" PRId64, Prenum);
vim_snprintf(bufp + len, bufsize - len, "%" PRId64, Prenum);
}
}
@ -2082,7 +2082,7 @@ static int get_maximum_wincount(frame_T *fr, int height)
void win_equal(win_T *next_curwin, bool current, int dir)
{
if (dir == 0) {
dir = *p_ead;
dir = (unsigned char)(*p_ead);
}
win_equal_rec(next_curwin == NULL ? curwin : next_curwin, current,
topframe, dir, 0, tabline_height(),