aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2022-06-28 11:31:54 +0200
committerGitHub <noreply@github.com>2022-06-28 02:31:54 -0700
commit014a88799a1d175ad121c520c9cc5bd0bb2d8813 (patch)
treedb5d1acdc8ea6fe58f78b1aabc62b3ee5fc7875a
parent7e1cf6b7642f0ab14656d853d44f4409b2987b9c (diff)
downloadrneovim-014a88799a1d175ad121c520c9cc5bd0bb2d8813.tar.gz
rneovim-014a88799a1d175ad121c520c9cc5bd0bb2d8813.tar.bz2
rneovim-014a88799a1d175ad121c520c9cc5bd0bb2d8813.zip
refactor: replace char_u #18429
Work on https://github.com/neovim/neovim/issues/459
-rw-r--r--src/nvim/api/command.c2
-rw-r--r--src/nvim/api/vim.c2
-rw-r--r--src/nvim/autocmd.c12
-rw-r--r--src/nvim/buffer.c369
-rw-r--r--src/nvim/buffer_defs.h4
-rw-r--r--src/nvim/change.c6
-rw-r--r--src/nvim/charset.c17
-rw-r--r--src/nvim/debugger.c2
-rw-r--r--src/nvim/diff.c3
-rw-r--r--src/nvim/digraph.c4
-rw-r--r--src/nvim/edit.c29
-rw-r--r--src/nvim/eval.c6
-rw-r--r--src/nvim/eval/funcs.c4
-rw-r--r--src/nvim/eval/userfunc.c7
-rw-r--r--src/nvim/event/socket.c2
-rw-r--r--src/nvim/ex_cmds.c34
-rw-r--r--src/nvim/ex_cmds2.c22
-rw-r--r--src/nvim/ex_cmds_defs.h2
-rw-r--r--src/nvim/ex_docmd.c24
-rw-r--r--src/nvim/ex_getln.c20
-rw-r--r--src/nvim/ex_session.c2
-rw-r--r--src/nvim/fileio.c9
-rw-r--r--src/nvim/fold.c2
-rw-r--r--src/nvim/getchar.c8
-rw-r--r--src/nvim/hardcopy.c2
-rw-r--r--src/nvim/highlight_group.c18
-rw-r--r--src/nvim/if_cscope.c2
-rw-r--r--src/nvim/indent.c6
-rw-r--r--src/nvim/indent_c.c11
-rw-r--r--src/nvim/main.c18
-rw-r--r--src/nvim/mapping.c2
-rw-r--r--src/nvim/mark.c10
-rw-r--r--src/nvim/mbyte.c6
-rw-r--r--src/nvim/memline.c31
-rw-r--r--src/nvim/message.c29
-rw-r--r--src/nvim/move.c2
-rw-r--r--src/nvim/normal.c2
-rw-r--r--src/nvim/ops.c4
-rw-r--r--src/nvim/option.c93
-rw-r--r--src/nvim/os/env.c18
-rw-r--r--src/nvim/os/shell.c4
-rw-r--r--src/nvim/path.c18
-rw-r--r--src/nvim/plines.c8
-rw-r--r--src/nvim/popupmnu.c16
-rw-r--r--src/nvim/quickfix.c10
-rw-r--r--src/nvim/screen.c80
-rw-r--r--src/nvim/search.c15
-rw-r--r--src/nvim/shada.c2
-rw-r--r--src/nvim/sign.c4
-rw-r--r--src/nvim/spell.c12
-rw-r--r--src/nvim/spellfile.c11
-rw-r--r--src/nvim/syntax.c30
-rw-r--r--src/nvim/tag.c11
-rw-r--r--src/nvim/undo.c3
-rw-r--r--src/nvim/version.c8
55 files changed, 519 insertions, 559 deletions
diff --git a/src/nvim/api/command.c b/src/nvim/api/command.c
index 2b2fb446a0..80a5449d29 100644
--- a/src/nvim/api/command.c
+++ b/src/nvim/api/command.c
@@ -413,7 +413,7 @@ String nvim_cmd(uint64_t channel_id, Dict(cmd) *cmd, Dict(cmd_opts) *opts, Error
// Simply pass the first argument (if it exists) as the arg pointer to `set_cmd_addr_type()`
// since it only ever checks the first argument.
- set_cmd_addr_type(&ea, argc > 0 ? (char_u *)args[0] : NULL);
+ set_cmd_addr_type(&ea, argc > 0 ? args[0] : NULL);
if (HAS_KEY(cmd->range)) {
if (!(ea.argt & EX_RANGE)) {
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c
index c5881dbc5f..bf3fb04a18 100644
--- a/src/nvim/api/vim.c
+++ b/src/nvim/api/vim.c
@@ -2109,7 +2109,7 @@ Dictionary nvim_eval_statusline(String str, Dict(eval_statusline) *opts, Error *
bool highlights = false;
if (str.size < 2 || memcmp(str.data, "%!", 2)) {
- const char *const errmsg = check_stl_option((char_u *)str.data);
+ const char *const errmsg = check_stl_option(str.data);
if (errmsg) {
api_set_error(err, kErrorTypeValidation, "%s", errmsg);
return result;
diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c
index 69f01afcb6..7301e07a06 100644
--- a/src/nvim/autocmd.c
+++ b/src/nvim/autocmd.c
@@ -174,7 +174,7 @@ static void aupat_show(AutoPat *ap, event_T event, int previous_group)
}
msg_col = 4;
- msg_outtrans((char_u *)ap->pat);
+ msg_outtrans(ap->pat);
for (AutoCmd *ac = ap->cmds; ac != NULL; ac = ac->next) {
// skip removed commands
@@ -195,10 +195,10 @@ static void aupat_show(AutoPat *ap, event_T event, int previous_group)
size_t msglen = 100;
char *msg = (char *)xmallocz(msglen);
snprintf(msg, msglen, "%s [%s]", exec_to_string, ac->desc);
- msg_outtrans((char_u *)msg);
+ msg_outtrans(msg);
XFREE_CLEAR(msg);
} else {
- msg_outtrans((char_u *)exec_to_string);
+ msg_outtrans(exec_to_string);
}
XFREE_CLEAR(exec_to_string);
if (p_verbose > 0) {
@@ -471,7 +471,7 @@ void augroup_del(char *name, bool stupid_legacy_mode)
FOR_ALL_AUEVENTS(event) {
FOR_ALL_AUPATS_IN_EVENT(event, ap) {
if (ap->group == i && ap->pat != NULL) {
- give_warning((char_u *)_("W19: Deleting augroup that is still in use"), true);
+ give_warning(_("W19: Deleting augroup that is still in use"), true);
map_put(String, int)(&map_augroup_name_to_id, cstr_as_string(name), AUGROUP_DELETED);
augroup_map_del(ap->group, NULL);
return;
@@ -717,7 +717,7 @@ char *au_event_disable(char *what)
} else {
STRCAT(new_ei, what);
}
- set_string_option_direct("ei", -1, (char_u *)new_ei, OPT_FREE, SID_NONE);
+ set_string_option_direct("ei", -1, new_ei, OPT_FREE, SID_NONE);
xfree(new_ei);
return save_ei;
@@ -726,7 +726,7 @@ char *au_event_disable(char *what)
void au_event_restore(char *old_ei)
{
if (old_ei != NULL) {
- set_string_option_direct("ei", -1, (char_u *)old_ei, OPT_FREE, SID_NONE);
+ set_string_option_direct("ei", -1, old_ei, OPT_FREE, SID_NONE);
xfree(old_ei);
}
}
diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c
index 85e34e910d..46adb55746 100644
--- a/src/nvim/buffer.c
+++ b/src/nvim/buffer.c
@@ -948,7 +948,7 @@ char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end
int deleted = 0; // number of buffers deleted
char *errormsg = NULL; // return value
int bnr; // buffer number
- char_u *p;
+ char *p;
if (addr_count == 0) {
(void)do_buffer(command, DOBUF_CURRENT, FORWARD, 0, forceit);
@@ -985,13 +985,12 @@ char *do_bufdel(int command, char_u *arg, int addr_count, int start_bnr, int end
break;
}
if (!ascii_isdigit(*arg)) {
- p = skiptowhite_esc(arg);
- bnr = buflist_findpat(arg, p, command == DOBUF_WIPE,
- false, false);
+ p = (char *)skiptowhite_esc(arg);
+ bnr = buflist_findpat(arg, (char_u *)p, command == DOBUF_WIPE, false, false);
if (bnr < 0) { // failed
break;
}
- arg = p;
+ arg = (char_u *)p;
} else {
bnr = getdigits_int(&arg, false, 0);
}
@@ -1679,8 +1678,8 @@ static inline void buf_init_changedtick(buf_T *const buf)
/// @return pointer to the buffer
buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int flags)
{
- char_u *ffname = ffname_arg;
- char_u *sfname = sfname_arg;
+ char *ffname = (char *)ffname_arg;
+ char *sfname = (char *)sfname_arg;
buf_T *buf;
fname_expand(curbuf, &ffname, &sfname); // will allocate ffname
@@ -1690,11 +1689,9 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
// We can use inode numbers when the file exists. Works better
// for hard links.
FileID file_id;
- bool file_id_valid = (sfname != NULL
- && os_fileid((char *)sfname, &file_id));
+ bool file_id_valid = (sfname != NULL && os_fileid(sfname, &file_id));
if (ffname != NULL && !(flags & (BLN_DUMMY | BLN_NEW))
- && (buf = buflist_findname_file_id(ffname, &file_id,
- file_id_valid)) != NULL) {
+ && (buf = buflist_findname_file_id(ffname, &file_id, file_id_valid)) != NULL) {
xfree(ffname);
if (lnum != 0) {
buflist_setfpos(buf, (flags & BLN_NOCURWIN) ? NULL : curwin,
@@ -1749,8 +1746,8 @@ buf_T *buflist_new(char_u *ffname_arg, char_u *sfname_arg, linenr_T lnum, int fl
}
if (ffname != NULL) {
- buf->b_ffname = ffname;
- buf->b_sfname = vim_strsave(sfname);
+ buf->b_ffname = (char_u *)ffname;
+ buf->b_sfname = vim_strsave((char_u *)sfname);
}
clear_wininfo(buf);
@@ -2045,20 +2042,20 @@ void buflist_getfpos(void)
/// @return buffer or NULL if not found
buf_T *buflist_findname_exp(char_u *fname)
{
- char_u *ffname;
+ char *ffname;
buf_T *buf = NULL;
// First make the name into a full path name
- ffname = (char_u *)FullName_save((char *)fname,
+ ffname = FullName_save((char *)fname,
#ifdef UNIX
- // force expansion, get rid of symbolic links
- true
+ // force expansion, get rid of symbolic links
+ true
#else
- false
+ false
#endif
- ); // NOLINT(whitespace/parens)
+ ); // NOLINT(whitespace/parens)
if (ffname != NULL) {
- buf = buflist_findname(ffname);
+ buf = buflist_findname((char_u *)ffname);
xfree(ffname);
}
return buf;
@@ -2073,14 +2070,14 @@ buf_T *buflist_findname(char_u *ffname)
{
FileID file_id;
bool file_id_valid = os_fileid((char *)ffname, &file_id);
- return buflist_findname_file_id(ffname, &file_id, file_id_valid);
+ return buflist_findname_file_id((char *)ffname, &file_id, file_id_valid);
}
/// Same as buflist_findname(), but pass the FileID structure to avoid
/// getting it twice for the same file.
///
/// @return buffer or NULL if not found
-static buf_T *buflist_findname_file_id(char_u *ffname, FileID *file_id, bool file_id_valid)
+static buf_T *buflist_findname_file_id(char *ffname, FileID *file_id, bool file_id_valid)
FUNC_ATTR_PURE
{
// Start at the last buffer, expect to find a match sooner.
@@ -2213,7 +2210,7 @@ int buflist_findpat(const char_u *pattern, const char_u *pattern_end, bool unlis
typedef struct {
buf_T *buf;
- char_u *match;
+ char *match;
} bufmatch_T;
/// Compare functions for qsort() below, that compares b_last_used.
@@ -2236,9 +2233,9 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
{
int count = 0;
int round;
- char_u *p;
+ char *p;
int attempt;
- char_u *patc;
+ char *patc;
bufmatch_T *matches = NULL;
*num_file = 0; // return values in case of FAIL
@@ -2254,20 +2251,20 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
STRCPY(patc, "\\(^\\|[\\/]\\)");
STRCPY(patc + 11, pat + 1);
} else {
- patc = pat;
+ patc = (char *)pat;
}
// attempt == 0: try match with '\<', match at start of word
// attempt == 1: try match without '\<', match anywhere
for (attempt = 0; attempt <= 1; attempt++) {
- if (attempt > 0 && patc == pat) {
+ if (attempt > 0 && (char_u *)patc == pat) {
break; // there was no anchor, no need to try again
}
regmatch_T regmatch;
- regmatch.regprog = vim_regcomp((char *)patc + attempt * 11, RE_MAGIC);
+ regmatch.regprog = vim_regcomp(patc + attempt * 11, RE_MAGIC);
if (regmatch.regprog == NULL) {
- if (patc != pat) {
+ if ((char_u *)patc != pat) {
xfree(patc);
}
return FAIL;
@@ -2294,16 +2291,16 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
count++;
} else {
if (options & WILD_HOME_REPLACE) {
- p = home_replace_save(buf, p);
+ p = (char *)home_replace_save(buf, (char_u *)p);
} else {
- p = vim_strsave(p);
+ p = xstrdup(p);
}
if (matches != NULL) {
matches[count].buf = buf;
matches[count].match = p;
count++;
} else {
- (*file)[count++] = p;
+ (*file)[count++] = (char_u *)p;
}
}
}
@@ -2325,7 +2322,7 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
}
}
- if (patc != pat) {
+ if ((char_u *)patc != pat) {
xfree(patc);
}
@@ -2337,12 +2334,12 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
// if the current buffer is first in the list, place it at the end
if (matches[0].buf == curbuf) {
for (int i = 1; i < count; i++) {
- (*file)[i - 1] = matches[i].match;
+ (*file)[i - 1] = (char_u *)matches[i].match;
}
- (*file)[count - 1] = matches[0].match;
+ (*file)[count - 1] = (char_u *)matches[0].match;
} else {
for (int i = 0; i < count; i++) {
- (*file)[i] = matches[i].match;
+ (*file)[i] = (char_u *)matches[i].match;
}
}
xfree(matches);
@@ -2355,12 +2352,12 @@ int ExpandBufnames(char_u *pat, int *num_file, char_u ***file, int options)
/// Check for a match on the file name for buffer "buf" with regprog "prog".
///
/// @param ignore_case When true, ignore case. Use 'fic' otherwise.
-static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, bool ignore_case)
+static char *buflist_match(regmatch_T *rmp, buf_T *buf, bool ignore_case)
{
// First try the short file name, then the long file name.
- char_u *match = fname_match(rmp, buf->b_sfname, ignore_case);
+ char *match = fname_match(rmp, (char *)buf->b_sfname, ignore_case);
if (match == NULL && rmp->regprog != NULL) {
- match = fname_match(rmp, buf->b_ffname, ignore_case);
+ match = fname_match(rmp, (char *)buf->b_ffname, ignore_case);
}
return match;
}
@@ -2370,20 +2367,20 @@ static char_u *buflist_match(regmatch_T *rmp, buf_T *buf, bool ignore_case)
/// @param ignore_case When true, ignore case. Use 'fileignorecase' otherwise.
///
/// @return "name" when there is a match, NULL when not.
-static char_u *fname_match(regmatch_T *rmp, char_u *name, bool ignore_case)
+static char *fname_match(regmatch_T *rmp, char *name, bool ignore_case)
{
- char_u *match = NULL;
- char_u *p;
+ char *match = NULL;
+ char *p;
if (name != NULL) {
// Ignore case when 'fileignorecase' or the argument is set.
rmp->rm_ic = p_fic || ignore_case;
- if (vim_regexec(rmp, name, (colnr_T)0)) {
+ if (vim_regexec(rmp, (char_u *)name, (colnr_T)0)) {
match = name;
} else if (rmp->regprog != NULL) {
// Replace $(HOME) with '~' and try matching again.
- p = home_replace_save(NULL, name);
- if (vim_regexec(rmp, p, (colnr_T)0)) {
+ p = (char *)home_replace_save(NULL, (char_u *)name);
+ if (vim_regexec(rmp, (char_u *)p, (colnr_T)0)) {
match = name;
}
xfree(p);
@@ -2658,7 +2655,7 @@ void buflist_list(exarg_T *eap)
if (buf_spname(buf) != NULL) {
STRLCPY(NameBuff, buf_spname(buf), MAXPATHL);
} else {
- home_replace(buf, (char_u *)buf->b_fname, NameBuff, MAXPATHL, true);
+ home_replace(buf, buf->b_fname, (char *)NameBuff, MAXPATHL, true);
}
if (message_filtered(NameBuff)) {
@@ -2688,7 +2685,7 @@ void buflist_list(exarg_T *eap)
}
// put "line 999" in column 40 or after the file name
- i = 40 - vim_strsize(IObuff);
+ i = 40 - vim_strsize((char *)IObuff);
do {
IObuff[len++] = ' ';
} while (--i > 0 && len < IOSIZE - 18);
@@ -2699,7 +2696,7 @@ void buflist_list(exarg_T *eap)
buf == curbuf ? (int64_t)curwin->w_cursor.lnum : (int64_t)buflist_findlnum(buf));
}
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
line_breakcheck();
}
@@ -2735,10 +2732,10 @@ int buflist_name_nr(int fnum, char_u **fname, linenr_T *lnum)
/// @param message give message when buffer already exists
///
/// @return FAIL for failure (file name already in use by other buffer) OK otherwise.
-int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
+int setfname(buf_T *buf, char *ffname_arg, char *sfname_arg, bool message)
{
- char_u *ffname = ffname_arg;
- char_u *sfname = sfname_arg;
+ char *ffname = ffname_arg;
+ char *sfname = sfname_arg;
buf_T *obuf = NULL;
FileID file_id;
bool file_id_valid = false;
@@ -2760,7 +2757,7 @@ int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
// If the file name is already used in another buffer:
// - if the buffer is loaded, fail
// - if the buffer is not loaded, delete it from the list
- file_id_valid = os_fileid((char *)ffname, &file_id);
+ file_id_valid = os_fileid(ffname, &file_id);
if (!(buf->b_flags & BF_DUMMY)) {
obuf = buflist_findname_file_id(ffname, &file_id, file_id_valid);
}
@@ -2775,16 +2772,16 @@ int setfname(buf_T *buf, char_u *ffname_arg, char_u *sfname_arg, bool message)
// delete from the list
close_buffer(NULL, obuf, DOBUF_WIPE, false, false);
}
- sfname = vim_strsave(sfname);
+ sfname = xstrdup(sfname);
#ifdef USE_FNAME_CASE
- path_fix_case(sfname); // set correct case for short file name
+ path_fix_case((char_u *)sfname); // set correct case for short file name
#endif
if (buf->b_sfname != buf->b_ffname) {
xfree(buf->b_sfname);
}
xfree(buf->b_ffname);
- buf->b_ffname = ffname;
- buf->b_sfname = sfname;
+ buf->b_ffname = (char_u *)ffname;
+ buf->b_sfname = (char_u *)sfname;
}
buf->b_fname = (char *)buf->b_sfname;
if (!file_id_valid) {
@@ -2814,7 +2811,7 @@ void buf_set_name(int fnum, char_u *name)
buf->b_sfname = NULL;
// Allocate ffname and expand into full path. Also resolves .lnk
// files on Win32.
- fname_expand(buf, &buf->b_ffname, &buf->b_sfname);
+ fname_expand(buf, (char **)&buf->b_ffname, (char **)&buf->b_sfname);
buf->b_fname = (char *)buf->b_sfname;
}
}
@@ -2859,16 +2856,16 @@ buf_T *setaltfname(char_u *ffname, char_u *sfname, linenr_T lnum)
/// @param errmsg give error message
char_u *getaltfname(bool errmsg)
{
- char_u *fname;
+ char *fname;
linenr_T dummy;
- if (buflist_name_nr(0, &fname, &dummy) == FAIL) {
+ if (buflist_name_nr(0, (char_u **)&fname, &dummy) == FAIL) {
if (errmsg) {
emsg(_(e_noalt));
}
return NULL;
}
- return fname;
+ return (char_u *)fname;
}
/// Add a file name to the buflist and return its number.
@@ -2916,7 +2913,7 @@ void buflist_altfpos(win_T *win)
bool otherfile(char_u *ffname)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
- return otherfile_buf(curbuf, ffname, NULL, false);
+ return otherfile_buf(curbuf, (char *)ffname, NULL, false);
}
/// Check that "ffname" is not the same file as the file loaded in "buf".
@@ -2926,7 +2923,7 @@ bool otherfile(char_u *ffname)
/// @param ffname full path name to check
/// @param file_id_p information about the file at "ffname".
/// @param file_id_valid whether a valid "file_id_p" was passed in.
-static bool otherfile_buf(buf_T *buf, char_u *ffname, FileID *file_id_p, bool file_id_valid)
+static bool otherfile_buf(buf_T *buf, char *ffname, FileID *file_id_p, bool file_id_valid)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
{
// no name is different
@@ -2941,7 +2938,7 @@ static bool otherfile_buf(buf_T *buf, char_u *ffname, FileID *file_id_p, bool fi
// If no struct stat given, get it now
if (file_id_p == NULL) {
file_id_p = &file_id;
- file_id_valid = os_fileid((char *)ffname, file_id_p);
+ file_id_valid = os_fileid(ffname, file_id_p);
}
if (!file_id_valid) {
// file_id not valid, assume files are different.
@@ -2995,7 +2992,7 @@ static bool buf_same_file_id(buf_T *buf, FileID *file_id)
/// @param fullname when non-zero print full path
void fileinfo(int fullname, int shorthelp, int dont_truncate)
{
- char_u *name;
+ char *name;
int n;
char *p;
char *buffer;
@@ -3015,11 +3012,11 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
STRLCPY(p, buf_spname(curbuf), IOSIZE - (p - buffer));
} else {
if (!fullname && curbuf->b_fname != NULL) {
- name = (char_u *)curbuf->b_fname;
+ name = curbuf->b_fname;
} else {
- name = curbuf->b_ffname;
+ name = (char *)curbuf->b_ffname;
}
- home_replace(shorthelp ? curbuf : NULL, name, (char_u *)p,
+ home_replace(shorthelp ? curbuf : NULL, name, p,
(size_t)(IOSIZE - (p - buffer)), true);
}
@@ -3069,7 +3066,7 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
}
- (void)append_arg_number(curwin, (char_u *)buffer, IOSIZE, !shortmess(SHM_FILE));
+ (void)append_arg_number(curwin, buffer, IOSIZE, !shortmess(SHM_FILE));
if (dont_truncate) {
// Temporarily set msg_scroll to avoid the message being truncated.
@@ -3103,14 +3100,14 @@ void col_print(char_u *buf, size_t buflen, int col, int vcol)
}
}
-static char_u *lasttitle = NULL;
-static char_u *lasticon = NULL;
+static char *lasttitle = NULL;
+static char *lasticon = NULL;
/// Put the title name in the title bar and icon of the window.
void maketitle(void)
{
- char_u *title_str = NULL;
- char_u *icon_str = NULL;
+ char *title_str = NULL;
+ char *icon_str = NULL;
int maxlen = 0;
int len;
int mustset;
@@ -3145,14 +3142,13 @@ void maketitle(void)
build_stl_str_hl(curwin, buf, sizeof(buf),
(char *)p_titlestring, use_sandbox,
0, maxlen, NULL, NULL);
- title_str = (char_u *)buf;
+ title_str = buf;
if (called_emsg) {
- set_string_option_direct("titlestring", -1, (char_u *)"",
- OPT_FREE, SID_ERROR);
+ set_string_option_direct("titlestring", -1, "", OPT_FREE, SID_ERROR);
}
called_emsg |= save_called_emsg;
} else {
- title_str = p_titlestring;
+ title_str = (char *)p_titlestring;
}
} else {
// Format: "fname + (path) (1 of 2) - VIM".
@@ -3195,7 +3191,7 @@ void maketitle(void)
// Get path of file, replace home dir with ~.
*buf_p++ = ' ';
*buf_p++ = '(';
- home_replace(curbuf, curbuf->b_ffname, (char_u *)buf_p,
+ home_replace(curbuf, (char *)curbuf->b_ffname, buf_p,
(SPACE_FOR_DIR - (size_t)(buf_p - buf)), true);
#ifdef BACKSLASH_IN_FILENAME
// Avoid "c:/name" to be reduced to "c".
@@ -3232,18 +3228,17 @@ void maketitle(void)
*buf_p = NUL;
}
- append_arg_number(curwin, (char_u *)buf_p,
- (int)(SPACE_FOR_ARGNR - (size_t)(buf_p - buf)), false);
+ append_arg_number(curwin, buf_p, (int)(SPACE_FOR_ARGNR - (size_t)(buf_p - buf)), false);
xstrlcat(buf_p, " - NVIM", (sizeof(buf) - (size_t)(buf_p - buf)));
if (maxlen > 0) {
// Make it shorter by removing a bit in the middle.
- if (vim_strsize((char_u *)buf) > maxlen) {
+ if (vim_strsize(buf) > maxlen) {
trunc_string((char_u *)buf, (char_u *)buf, maxlen, sizeof(buf));
}
}
- title_str = (char_u *)buf;
+ title_str = buf;
#undef SPACE_FOR_FNAME
#undef SPACE_FOR_DIR
#undef SPACE_FOR_ARGNR
@@ -3252,7 +3247,7 @@ void maketitle(void)
mustset = value_change(title_str, &lasttitle);
if (p_icon) {
- icon_str = (char_u *)buf;
+ icon_str = buf;
if (*p_iconstring != NUL) {
if (stl_syntax & STL_IN_ICON) {
int use_sandbox = false;
@@ -3260,34 +3255,33 @@ void maketitle(void)
use_sandbox = was_set_insecurely(curwin, "iconstring", 0);
called_emsg = false;
- build_stl_str_hl(curwin, (char *)icon_str, sizeof(buf),
+ build_stl_str_hl(curwin, icon_str, sizeof(buf),
(char *)p_iconstring, use_sandbox,
0, 0, NULL, NULL);
if (called_emsg) {
- set_string_option_direct("iconstring", -1,
- (char_u *)"", OPT_FREE, SID_ERROR);
+ set_string_option_direct("iconstring", -1, "", OPT_FREE, SID_ERROR);
}
called_emsg |= save_called_emsg;
} else {
- icon_str = p_iconstring;
+ icon_str = (char *)p_iconstring;
}
} else {
- char_u *buf_p;
+ char *buf_p;
if (buf_spname(curbuf) != NULL) {
buf_p = buf_spname(curbuf);
} else { // use file name only in icon
- buf_p = (char_u *)path_tail((char *)curbuf->b_ffname);
+ buf_p = path_tail((char *)curbuf->b_ffname);
}
*icon_str = NUL;
// Truncate name at 100 bytes.
len = (int)STRLEN(buf_p);
if (len > 100) {
len -= 100;
- len += mb_tail_off(buf_p, buf_p + len) + 1;
+ len += mb_tail_off((char_u *)buf_p, (char_u *)buf_p + len) + 1;
buf_p += len;
}
STRCPY(icon_str, buf_p);
- trans_characters(icon_str, IOSIZE);
+ trans_characters((char_u *)icon_str, IOSIZE);
}
}
@@ -3306,7 +3300,7 @@ void maketitle(void)
/// @param[in,out] last current title string
///
/// @return true if resettitle() is to be called.
-static bool value_change(char_u *str, char_u **last)
+static bool value_change(char *str, char **last)
FUNC_ATTR_WARN_UNUSED_RESULT
{
if ((str == NULL) != (*last == NULL)
@@ -3316,7 +3310,7 @@ static bool value_change(char_u *str, char_u **last)
*last = NULL;
resettitle();
} else {
- *last = vim_strsave(str);
+ *last = xstrdup(str);
return true;
}
}
@@ -3326,8 +3320,8 @@ static bool value_change(char_u *str, char_u **last)
/// Set current window title
void resettitle(void)
{
- ui_call_set_icon(cstr_as_string((char *)lasticon));
- ui_call_set_title(cstr_as_string((char *)lasttitle));
+ ui_call_set_icon(cstr_as_string(lasticon));
+ ui_call_set_title(cstr_as_string(lasttitle));
ui_flush();
}
@@ -3431,7 +3425,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
}
// Get line & check if empty (cursorpos will show "0-1").
- const char_u *line_ptr = ml_get_buf(wp->w_buffer, lnum, false);
+ const char *line_ptr = (char *)ml_get_buf(wp->w_buffer, lnum, false);
bool empty_line = (*line_ptr == NUL);
// Get the byte value now, in case we need it below. This is more
@@ -3445,7 +3439,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
wp->w_cursor.coladd = 0;
byteval = 0;
} else {
- byteval = utf_ptr2char((char *)line_ptr + wp->w_cursor.col);
+ byteval = utf_ptr2char(line_ptr + wp->w_cursor.col);
}
int groupdepth = 0;
@@ -3522,7 +3516,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
continue;
}
stl_items[curitem].type = Separate;
- stl_items[curitem++].start = (char_u *)out_p;
+ stl_items[curitem++].start = out_p;
continue;
}
@@ -3530,7 +3524,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
if (*fmt_p == STL_TRUNCMARK) {
fmt_p++;
stl_items[curitem].type = Trunc;
- stl_items[curitem++].start = (char_u *)out_p;
+ stl_items[curitem++].start = out_p;
continue;
}
@@ -3546,7 +3540,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Determine how long the group is.
// Note: We set the current output position to null
// so `vim_strsize` will work.
- char_u *t = stl_items[stl_groupitems[groupdepth]].start;
+ char *t = stl_items[stl_groupitems[groupdepth]].start;
*out_p = NUL;
long group_len = vim_strsize(t);
@@ -3579,7 +3573,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
}
if (n == curitem && group_start_userhl == group_end_userhl) {
// empty group
- out_p = (char *)t;
+ out_p = t;
group_len = 0;
for (n = stl_groupitems[groupdepth] + 1; n < curitem; n++) {
// do not use the highlighting from the removed group
@@ -3589,7 +3583,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// adjust the start position of TabPage to the next
// item position
if (stl_items[n].type == TabPage) {
- stl_items[n].start = (char_u *)out_p;
+ stl_items[n].start = out_p;
}
}
}
@@ -3604,7 +3598,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
long n = 0;
while (group_len >= stl_items[stl_groupitems[groupdepth]].maxwid) {
group_len -= ptr2cells(t + n);
- n += utfc_ptr2len((char *)t + n);
+ n += utfc_ptr2len(t + n);
}
// }
@@ -3612,7 +3606,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
*t = '<';
// { Move the truncated output
- memmove(t + 1, t + n, (size_t)((char_u *)out_p - (t + n)));
+ memmove(t + 1, t + n, (size_t)(out_p - (t + n)));
out_p = out_p - n + 1;
// Fill up space left over by half a double-wide char.
while (++group_len < stl_items[stl_groupitems[groupdepth]].minwid) {
@@ -3646,7 +3640,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
} else {
// { Move the group to the right
group_len = (min_group_width - group_len) * utf_char2len(fillchar);
- memmove(t + group_len, t, (size_t)((char_u *)out_p - t));
+ memmove(t + group_len, t, (size_t)(out_p - t));
if (out_p + group_len >= (out_end_p + 1)) {
group_len = (long)(out_end_p - out_p);
}
@@ -3692,7 +3686,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// to denote the styling to use.
if (*fmt_p == STL_USER_HL) {
stl_items[curitem].type = Highlight;
- stl_items[curitem].start = (char_u *)out_p;
+ stl_items[curitem].start = out_p;
stl_items[curitem].minwid = minwid > 9 ? 1 : minwid;
fmt_p++;
curitem++;
@@ -3738,7 +3732,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
}
}
stl_items[curitem].type = TabPage;
- stl_items[curitem].start = (char_u *)out_p;
+ stl_items[curitem].start = out_p;
stl_items[curitem].minwid = minwid;
fmt_p++;
curitem++;
@@ -3755,7 +3749,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
break;
}
stl_items[curitem].type = ClickFunc;
- stl_items[curitem].start = (char_u *)out_p;
+ stl_items[curitem].start = out_p;
stl_items[curitem].cmd = xmemdupz(t, (size_t)(fmt_p - t));
stl_items[curitem].minwid = minwid;
fmt_p++;
@@ -3780,7 +3774,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
if (*fmt_p == '(') {
stl_groupitems[groupdepth++] = curitem;
stl_items[curitem].type = Group;
- stl_items[curitem].start = (char_u *)out_p;
+ stl_items[curitem].start = out_p;
stl_items[curitem].minwid = minwid;
stl_items[curitem].maxwid = maxwid;
fmt_p++;
@@ -3821,9 +3815,9 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
if (buf_spname(wp->w_buffer) != NULL) {
STRLCPY(NameBuff, buf_spname(wp->w_buffer), MAXPATHL);
} else {
- char_u *t = (opt == STL_FULLPATH) ? wp->w_buffer->b_ffname
- : (char_u *)wp->w_buffer->b_fname;
- home_replace(wp->w_buffer, t, NameBuff, MAXPATHL, true);
+ char *t = (opt == STL_FULLPATH) ? (char *)wp->w_buffer->b_ffname
+ : wp->w_buffer->b_fname;
+ home_replace(wp->w_buffer, t, (char *)NameBuff, MAXPATHL, true);
}
trans_characters(NameBuff, MAXPATHL);
if (opt != STL_FILENAME) {
@@ -3912,18 +3906,14 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
size_t parsed_usefmt = (size_t)(block_start - usefmt);
size_t str_length = STRLEN(str);
size_t fmt_length = STRLEN(fmt_p);
- size_t new_fmt_len = parsed_usefmt
- + str_length + fmt_length + 3;
- char_u *new_fmt = (char_u *)xmalloc(new_fmt_len * sizeof(char_u));
- char_u *new_fmt_p = new_fmt;
-
- new_fmt_p = (char_u *)memcpy(new_fmt_p, usefmt, parsed_usefmt)
- + parsed_usefmt;
- new_fmt_p = (char_u *)memcpy(new_fmt_p, str, str_length)
- + str_length;
- new_fmt_p = (char_u *)memcpy(new_fmt_p, "%}", 2) + 2;
- new_fmt_p = (char_u *)memcpy(new_fmt_p, fmt_p, fmt_length)
- + fmt_length;
+ size_t new_fmt_len = parsed_usefmt + str_length + fmt_length + 3;
+ char *new_fmt = xmalloc(new_fmt_len * sizeof(char));
+ char *new_fmt_p = new_fmt;
+
+ new_fmt_p = (char *)memcpy(new_fmt_p, usefmt, parsed_usefmt) + parsed_usefmt;
+ new_fmt_p = (char *)memcpy(new_fmt_p, str, str_length) + str_length;
+ new_fmt_p = (char *)memcpy(new_fmt_p, "%}", 2) + 2;
+ new_fmt_p = (char *)memcpy(new_fmt_p, fmt_p, fmt_length) + fmt_length;
*new_fmt_p = 0;
new_fmt_p = NULL;
@@ -3931,7 +3921,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
xfree(usefmt);
}
XFREE_CLEAR(str);
- usefmt = (char *)new_fmt;
+ usefmt = new_fmt;
fmt_p = usefmt + parsed_usefmt;
evaldepth++;
continue;
@@ -3974,7 +3964,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Store the position percentage in our temporary buffer.
// Note: We cannot store the value in `num` because
// `get_rel_pos` can return a named position. Ex: "Top"
- get_rel_pos(wp, (char_u *)buf_tmp, TMPLEN);
+ get_rel_pos(wp, buf_tmp, TMPLEN);
str = buf_tmp;
break;
@@ -3989,14 +3979,14 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Note: The call will only return true if it actually
// appended data to the `buf_tmp` buffer.
- if (append_arg_number(wp, (char_u *)buf_tmp, (int)sizeof(buf_tmp), false)) {
+ if (append_arg_number(wp, buf_tmp, (int)sizeof(buf_tmp), false)) {
str = buf_tmp;
}
break;
case STL_KEYMAP:
fillable = false;
- if (get_keymap_str(wp, (char_u *)"<%s>", (char_u *)buf_tmp, TMPLEN)) {
+ if (get_keymap_str(wp, "<%s>", buf_tmp, TMPLEN)) {
str = buf_tmp;
}
break;
@@ -4066,11 +4056,10 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// (including the comma and null terminating character)
if (*wp->w_buffer->b_p_ft != NUL
&& STRLEN(wp->w_buffer->b_p_ft) < TMPLEN - 2) {
- vim_snprintf(buf_tmp, sizeof(buf_tmp), ",%s",
- wp->w_buffer->b_p_ft);
+ vim_snprintf(buf_tmp, sizeof(buf_tmp), ",%s", wp->w_buffer->b_p_ft);
// Uppercase the file extension
- for (char_u *t = (char_u *)buf_tmp; *t != 0; t++) {
- *t = (char_u)TOUPPER_LOC(*t);
+ for (char *t = buf_tmp; *t != 0; t++) {
+ *t = (char)TOUPPER_LOC(*t);
}
str = buf_tmp;
}
@@ -4121,8 +4110,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Create a highlight item based on the name
if (*fmt_p == '#') {
stl_items[curitem].type = Highlight;
- stl_items[curitem].start = (char_u *)out_p;
- stl_items[curitem].minwid = -syn_name2id_len((char_u *)t, (size_t)(fmt_p - t));
+ stl_items[curitem].start = out_p;
+ stl_items[curitem].minwid = -syn_name2id_len(t, (size_t)(fmt_p - t));
curitem++;
fmt_p++;
}
@@ -4133,7 +4122,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// If we made it this far, the item is normal and starts at
// our current position in the output buffer.
// Non-normal items would have `continued`.
- stl_items[curitem].start = (char_u *)out_p;
+ stl_items[curitem].start = out_p;
stl_items[curitem].type = Normal;
// Copy the item string into the output buffer
@@ -4151,7 +4140,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
}
// }
- long l = vim_strsize((char_u *)t);
+ long l = vim_strsize(t);
// If this item is non-empty, record that the last thing
// we put in the output buffer was an item
@@ -4162,7 +4151,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// If the item is too wide, truncate it from the beginning
if (l > maxwid) {
while (l >= maxwid) {
- l -= ptr2cells((char_u *)t);
+ l -= ptr2cells(t);
t += utfc_ptr2len(t);
}
@@ -4219,8 +4208,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
prevchar_isitem = true;
// { Build the formatting string
- char_u nstr[20];
- char_u *t = nstr;
+ char nstr[20];
+ char *t = nstr;
if (opt == STL_VIRTCOL_ALT) {
*t++ = '-';
minwid--;
@@ -4232,7 +4221,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Note: The `*` means we take the width as one of the arguments
*t++ = '*';
- *t++ = (char_u)(base == kNumBaseHexadecimal ? 'X' : 'd');
+ *t++ = base == kNumBaseHexadecimal ? 'X' : 'd';
*t = 0;
// }
@@ -4279,9 +4268,9 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
*++t = 0;
// }
- vim_snprintf(out_p, remaining_buf_len, (char *)nstr, 0, num, n);
+ vim_snprintf(out_p, remaining_buf_len, nstr, 0, num, n);
} else {
- vim_snprintf(out_p, remaining_buf_len, (char *)nstr, minwid, num);
+ vim_snprintf(out_p, remaining_buf_len, nstr, minwid, num);
}
// Advance the output buffer position to the end of the
@@ -4318,15 +4307,15 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// We have now processed the entire statusline format string.
// What follows is post-processing to handle alignment and highlighting.
- int width = vim_strsize((char_u *)out);
+ int width = vim_strsize(out);
if (maxwidth > 0 && width > maxwidth) {
// Result is too long, must truncate somewhere.
int item_idx = 0;
- char_u *trunc_p;
+ char *trunc_p;
// If there are no items, truncate from beginning
if (itemcnt == 0) {
- trunc_p = (char_u *)out;
+ trunc_p = out;
// Otherwise, look for the truncation item
} else {
@@ -4349,7 +4338,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
if (width - vim_strsize(trunc_p) >= maxwidth) {
// Walk from the beginning of the
// string to find the last character that will fit.
- trunc_p = (char_u *)out;
+ trunc_p = out;
width = 0;
for (;;) {
width += ptr2cells(trunc_p);
@@ -4359,7 +4348,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
// Note: Only advance the pointer if the next
// character will fit in the available output space
- trunc_p += utfc_ptr2len((char *)trunc_p);
+ trunc_p += utfc_ptr2len(trunc_p);
}
// Ignore any items in the statusline that occur after
@@ -4381,12 +4370,12 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
long trunc_len = 0;
while (width >= maxwidth) {
width -= ptr2cells(trunc_p + trunc_len);
- trunc_len += utfc_ptr2len((char *)trunc_p + trunc_len);
+ trunc_len += utfc_ptr2len(trunc_p + trunc_len);
}
// }
// { Truncate the string
- char_u *trunc_end_p = trunc_p + trunc_len;
+ char *trunc_end_p = trunc_p + trunc_len;
STRMOVE(trunc_p + 1, trunc_end_p);
// Put a `<` to mark where we truncated at
@@ -4452,10 +4441,10 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
for (int i = 0; i < num_separators; i++) {
int dislocation = (i == (num_separators - 1)) ? final_spaces : standard_spaces;
dislocation *= utf_char2len(fillchar);
- char_u *start = stl_items[stl_separator_locations[i]].start;
- char_u *seploc = start + dislocation;
+ char *start = stl_items[stl_separator_locations[i]].start;
+ char *seploc = start + dislocation;
STRMOVE(seploc, start);
- for (char_u *s = start; s < seploc;) {
+ for (char *s = start; s < seploc;) {
MB_CHAR2BYTES(fillchar, s);
}
@@ -4491,7 +4480,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
StlClickRecord *cur_tab_rec = stl_tabtab;
for (long l = 0; l < itemcnt; l++) {
if (stl_items[l].type == TabPage) {
- cur_tab_rec->start = (char *)stl_items[l].start;
+ cur_tab_rec->start = stl_items[l].start;
if (stl_items[l].minwid == 0) {
cur_tab_rec->def.type = kStlClickDisabled;
cur_tab_rec->def.tabnr = 0;
@@ -4508,7 +4497,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
cur_tab_rec->def.func = NULL;
cur_tab_rec++;
} else if (stl_items[l].type == ClickFunc) {
- cur_tab_rec->start = (char *)stl_items[l].start;
+ cur_tab_rec->start = stl_items[l].start;
cur_tab_rec->def.type = kStlClickFuncRun;
cur_tab_rec->def.tabnr = stl_items[l].minwid;
cur_tab_rec->def.func = stl_items[l].cmd;
@@ -4533,7 +4522,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
/// Get relative cursor position in window into "buf[buflen]", in the form 99%,
/// using "Top", "Bot" or "All" when appropriate.
-void get_rel_pos(win_T *wp, char_u *buf, int buflen)
+void get_rel_pos(win_T *wp, char *buf, int buflen)
{
// Need at least 3 chars for writing.
if (buflen < 3) {
@@ -4556,7 +4545,7 @@ void get_rel_pos(win_T *wp, char_u *buf, int buflen)
} else if (above <= 0) {
STRLCPY(buf, _("Top"), buflen);
} else {
- vim_snprintf((char *)buf, (size_t)buflen, "%2d%%", above > 1000000L
+ vim_snprintf(buf, (size_t)buflen, "%2d%%", above > 1000000L
? (int)(above / ((above + below) / 100L))
: (int)(above * 100L / (above + below)));
}
@@ -4570,7 +4559,7 @@ void get_rel_pos(win_T *wp, char_u *buf, int buflen)
/// @param add_file if true, add "file" before the arg number
///
/// @return true if it was appended.
-static bool append_arg_number(win_T *wp, char_u *buf, int buflen, bool add_file)
+static bool append_arg_number(win_T *wp, char *buf, int buflen, bool add_file)
FUNC_ATTR_NONNULL_ALL
{
// Nothing to do
@@ -4578,7 +4567,7 @@ static bool append_arg_number(win_T *wp, char_u *buf, int buflen, bool add_file)
return false;
}
- char_u *p = buf + STRLEN(buf); // go to the end of the buffer
+ char *p = buf + STRLEN(buf); // go to the end of the buffer
// Early out if the string is getting too long
if (p - buf + 35 >= buflen) {
@@ -4591,7 +4580,7 @@ static bool append_arg_number(win_T *wp, char_u *buf, int buflen, bool add_file)
STRCPY(p, "file ");
p += 5;
}
- vim_snprintf((char *)p, (size_t)(buflen - (p - buf)),
+ vim_snprintf(p, (size_t)(buflen - (p - buf)),
wp->w_arg_idx_invalid
? "(%d) of %d)"
: "%d of %d)", wp->w_arg_idx + 1, ARGCOUNT);
@@ -4604,7 +4593,7 @@ static bool append_arg_number(win_T *wp, char_u *buf, int buflen, bool add_file)
/// allocated memory.
/// The "*ffname" and "*sfname" pointer values on call will not be freed.
/// Note that the resulting "*ffname" pointer should be considered not allocated.
-void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
+void fname_expand(buf_T *buf, char **ffname, char **sfname)
{
if (*ffname == NULL) { // no file name given, nothing to do
return;
@@ -4612,7 +4601,7 @@ void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
if (*sfname == NULL) { // no short file name given, use ffname
*sfname = *ffname;
}
- *ffname = (char_u *)fix_fname((char *)(*ffname)); // expand to full path
+ *ffname = fix_fname((*ffname)); // expand to full path
#ifdef WIN32
if (!buf->b_p_bin) {
@@ -4620,24 +4609,24 @@ void fname_expand(buf_T *buf, char_u **ffname, char_u **sfname)
char *rfname = os_resolve_shortcut((const char *)(*ffname));
if (rfname != NULL) {
xfree(*ffname);
- *ffname = (char_u *)rfname;
- *sfname = (char_u *)rfname;
+ *ffname = rfname;
+ *sfname = rfname;
}
}
#endif
}
/// Get the file name for an argument list entry.
-char_u *alist_name(aentry_T *aep)
+char *alist_name(aentry_T *aep)
{
buf_T *bp;
// Use the name from the associated buffer if it exists.
bp = buflist_findnr(aep->ae_fnum);
if (bp == NULL || bp->b_fname == NULL) {
- return aep->ae_fname;
+ return (char *)aep->ae_fname;
}
- return (char_u *)bp->b_fname;
+ return bp->b_fname;
}
/// do_arg_all(): Open up to 'count' windows, one for each argument.
@@ -4646,7 +4635,7 @@ char_u *alist_name(aentry_T *aep)
/// @param keep_tabs keep current tabs, for ":tab drop file"
void do_arg_all(int count, int forceit, int keep_tabs)
{
- char_u *opened; // Array of weight for which args are open:
+ uint8_t *opened; // Array of weight for which args are open:
// 0: not opened
// 1: opened in other tab
// 2: opened in curtab
@@ -4710,7 +4699,7 @@ void do_arg_all(int count, int forceit, int keep_tabs)
if (i < alist->al_ga.ga_len
&& (AARGLIST(alist)[i].ae_fnum == buf->b_fnum
|| path_full_compare(alist_name(&AARGLIST(alist)[i]),
- buf->b_ffname,
+ (char *)buf->b_ffname,
true, true) & kEqualFiles)) {
int weight = 1;
@@ -4722,7 +4711,7 @@ void do_arg_all(int count, int forceit, int keep_tabs)
}
if (weight > (int)opened[i]) {
- opened[i] = (char_u)weight;
+ opened[i] = (uint8_t)weight;
if (i == 0) {
if (new_curwin != NULL) {
new_curwin->w_arg_idx = opened_len;
@@ -4854,7 +4843,7 @@ void do_arg_all(int count, int forceit, int keep_tabs)
new_curwin = curwin;
new_curtab = curtab;
}
- (void)do_ecmd(0, (char *)alist_name(&AARGLIST(alist)[i]), NULL, NULL, ECMD_ONE,
+ (void)do_ecmd(0, alist_name(&AARGLIST(alist)[i]), NULL, NULL, ECMD_ONE,
((buf_hide(curwin->w_buffer)
|| bufIsChanged(curwin->w_buffer))
? ECMD_HIDE : 0) + ECMD_OLDBUF,
@@ -5131,18 +5120,18 @@ void do_modelines(int flags)
/// @param flags Same as for do_modelines().
static int chk_modeline(linenr_T lnum, int flags)
{
- char_u *s;
- char_u *e;
- char_u *linecopy; // local copy of any modeline found
+ char *s;
+ char *e;
+ char *linecopy; // local copy of any modeline found
int prev;
intmax_t vers;
int end;
int retval = OK;
- char_u *save_sourcing_name;
+ char *save_sourcing_name;
linenr_T save_sourcing_lnum;
prev = -1;
- for (s = ml_get(lnum); *s != NUL; s++) {
+ for (s = (char *)ml_get(lnum); *s != NUL; s++) {
if (prev == -1 || ascii_isspace(prev)) {
if ((prev != -1 && STRNCMP(s, "ex:", (size_t)3) == 0)
|| STRNCMP(s, "vi:", (size_t)3) == 0) {
@@ -5171,7 +5160,7 @@ static int chk_modeline(linenr_T lnum, int flags)
}
}
}
- prev = *s;
+ prev = (uint8_t)(*s);
}
if (!*s) {
@@ -5182,16 +5171,16 @@ static int chk_modeline(linenr_T lnum, int flags)
s++;
} while (s[-1] != ':');
- s = linecopy = vim_strsave(s); // copy the line, it will change
+ s = linecopy = xstrdup(s); // copy the line, it will change
save_sourcing_lnum = sourcing_lnum;
- save_sourcing_name = (char_u *)sourcing_name;
+ save_sourcing_name = sourcing_name;
sourcing_lnum = lnum; // prepare for emsg()
sourcing_name = "modelines";
end = false;
while (end == false) {
- s = (char_u *)skipwhite((char *)s);
+ s = skipwhite(s);
if (*s == NUL) {
break;
}
@@ -5218,7 +5207,7 @@ static int chk_modeline(linenr_T lnum, int flags)
break;
}
end = true;
- s = (char_u *)vim_strchr((char *)s, ' ') + 1;
+ s = vim_strchr(s, ' ') + 1;
}
*e = NUL; // truncate the set command
@@ -5243,7 +5232,7 @@ static int chk_modeline(linenr_T lnum, int flags)
}
sourcing_lnum = save_sourcing_lnum;
- sourcing_name = (char *)save_sourcing_name;
+ sourcing_name = save_sourcing_name;
xfree(linecopy);
@@ -5328,26 +5317,26 @@ bool buf_hide(const buf_T *const buf)
/// @return special buffer name or
/// NULL when the buffer has a normal file name.
-char_u *buf_spname(buf_T *buf)
+char *buf_spname(buf_T *buf)
{
if (bt_quickfix(buf)) {
// Differentiate between the quickfix and location list buffers using
// the buffer number stored in the global quickfix stack.
if (buf->b_fnum == qf_stack_get_bufnr()) {
- return (char_u *)_(msg_qflist);
+ return _(msg_qflist);
}
- return (char_u *)_(msg_loclist);
+ return _(msg_loclist);
}
// There is no _file_ when 'buftype' is "nofile", b_sfname
// contains the name as specified by the user.
if (bt_nofile(buf)) {
if (buf->b_fname != NULL) {
- return (char_u *)buf->b_fname;
+ return buf->b_fname;
}
if (bt_prompt(buf)) {
- return (char_u *)_("[Prompt]");
+ return _("[Prompt]");
}
- return (char_u *)_("[Scratch]");
+ return _("[Scratch]");
}
if (buf->b_fname == NULL) {
return buf_get_fname(buf);
@@ -5530,13 +5519,13 @@ int buf_signcols(buf_T *buf, int maximum)
}
/// Get "buf->b_fname", use "[No Name]" if it is NULL.
-char_u *buf_get_fname(const buf_T *buf)
+char *buf_get_fname(const buf_T *buf)
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
{
if (buf->b_fname == NULL) {
- return (char_u *)_("[No Name]");
+ return _("[No Name]");
}
- return (char_u *)buf->b_fname;
+ return buf->b_fname;
}
/// Set 'buflisted' for curbuf to "on" and trigger autocommands if it changed.
@@ -5632,7 +5621,7 @@ void wipe_buffer(buf_T *buf, bool aucmd)
void buf_open_scratch(handle_T bufnr, char *bufname)
{
(void)do_ecmd((int)bufnr, NULL, NULL, NULL, ECMD_ONE, ECMD_HIDE, NULL);
- (void)setfname(curbuf, (char_u *)bufname, NULL, true);
+ (void)setfname(curbuf, bufname, NULL, true);
set_option_value("bh", 0L, "hide", OPT_LOCAL);
set_option_value("bt", 0L, "nofile", OPT_LOCAL);
set_option_value("swf", 0L, NULL, OPT_LOCAL);
diff --git a/src/nvim/buffer_defs.h b/src/nvim/buffer_defs.h
index f1dd8aadeb..5d1135f91c 100644
--- a/src/nvim/buffer_defs.h
+++ b/src/nvim/buffer_defs.h
@@ -373,7 +373,7 @@ struct mapblock {
/// Used for highlighting in the status line.
typedef struct stl_hlrec stl_hlrec_t;
struct stl_hlrec {
- char_u *start;
+ char *start;
int userhl; // 0: no HL, 1-9: User HL, < 0 for syn ID
};
@@ -381,7 +381,7 @@ struct stl_hlrec {
typedef struct stl_item stl_item_t;
struct stl_item {
// Where the item starts in the status line output buffer
- char_u *start;
+ char *start;
// Function to run for ClickFunc items.
char *cmd;
// The minimum width of the item
diff --git a/src/nvim/change.c b/src/nvim/change.c
index c0796386f1..a383fe6bb3 100644
--- a/src/nvim/change.c
+++ b/src/nvim/change.c
@@ -1393,7 +1393,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
while (old_size < repl_size && p > leader) {
MB_PTR_BACK(leader, p);
- old_size += ptr2cells(p);
+ old_size += ptr2cells((char *)p);
}
l = lead_repl_len - (int)(endp - p);
if (l != 0) {
@@ -1413,7 +1413,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
if (l > 1) {
p -= l;
- if (ptr2cells(p) > 1) {
+ if (ptr2cells((char *)p) > 1) {
p[1] = ' ';
l--;
}
@@ -1463,7 +1463,7 @@ int open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
int l = utfc_ptr2len((char *)p);
if (l > 1) {
- if (ptr2cells(p) > 1) {
+ if (ptr2cells((char *)p) > 1) {
// Replace a double-wide char with
// two spaces
l--;
diff --git a/src/nvim/charset.c b/src/nvim/charset.c
index 9bc0bef446..885ebca214 100644
--- a/src/nvim/charset.c
+++ b/src/nvim/charset.c
@@ -687,11 +687,12 @@ int char2cells(int c)
/// @param p
///
/// @return number of display cells.
-int ptr2cells(const char_u *p)
+int ptr2cells(const char *p_in)
{
+ uint8_t *p = (uint8_t *)p_in;
// For UTF-8 we need to look at more bytes if the first byte is >= 0x80.
if (*p >= 0x80) {
- return utf_ptr2cells((char *)p);
+ return utf_ptr2cells(p_in);
}
// For DBCS we can tell the cell count from the first byte.
@@ -706,9 +707,9 @@ int ptr2cells(const char_u *p)
/// @param s
///
/// @return number of character cells.
-int vim_strsize(char_u *s)
+int vim_strsize(char *s)
{
- return vim_strnsize(s, MAXCOL);
+ return vim_strnsize((char_u *)s, MAXCOL);
}
/// Return the number of character cells string "s[len]" will take on the
@@ -726,7 +727,7 @@ int vim_strnsize(char_u *s, int len)
int size = 0;
while (*s != NUL && --len >= 0) {
int l = utfc_ptr2len((char *)s);
- size += ptr2cells(s);
+ size += ptr2cells((char *)s);
s += l;
len -= l - 1;
}
@@ -1332,10 +1333,10 @@ char_u *skip_to_newline(const char_u *const p)
/// @param[out] nr Number read from the string.
///
/// @return true on success, false on error/overflow
-bool try_getdigits(char_u **pp, intmax_t *nr)
+bool try_getdigits(char **pp, intmax_t *nr)
{
errno = 0;
- *nr = strtoimax((char *)(*pp), (char **)pp, 10);
+ *nr = strtoimax(*pp, pp, 10);
if (errno == ERANGE && (*nr == INTMAX_MIN || *nr == INTMAX_MAX)) {
return false;
}
@@ -1353,7 +1354,7 @@ bool try_getdigits(char_u **pp, intmax_t *nr)
intmax_t getdigits(char_u **pp, bool strict, intmax_t def)
{
intmax_t number;
- int ok = try_getdigits(pp, &number);
+ int ok = try_getdigits((char **)pp, &number);
if (strict && !ok) {
abort();
}
diff --git a/src/nvim/debugger.c b/src/nvim/debugger.c
index 29dcddfc0d..803427dd17 100644
--- a/src/nvim/debugger.c
+++ b/src/nvim/debugger.c
@@ -687,7 +687,7 @@ void ex_breaklist(exarg_T *eap)
for (int i = 0; i < dbg_breakp.ga_len; i++) {
struct debuggy *bp = &BREAKP(i);
if (bp->dbg_type == DBG_FILE) {
- home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, true);
+ home_replace(NULL, (char *)bp->dbg_name, (char *)NameBuff, MAXPATHL, true);
}
if (bp->dbg_type != DBG_EXPR) {
smsg(_("%3d %s %s line %" PRId64),
diff --git a/src/nvim/diff.c b/src/nvim/diff.c
index 700e79ac75..f22933ec3c 100644
--- a/src/nvim/diff.c
+++ b/src/nvim/diff.c
@@ -1408,8 +1408,7 @@ void diff_win_options(win_T *wp, int addbuf)
}
wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm);
}
- set_string_option_direct("fdm", -1, (char_u *)"diff",
- OPT_LOCAL | OPT_FREE, 0);
+ set_string_option_direct("fdm", -1, "diff", OPT_LOCAL | OPT_FREE, 0);
curwin = old_curwin;
curbuf = curwin->w_buffer;
diff --git a/src/nvim/digraph.c b/src/nvim/digraph.c
index 99e99a8a9e..cbff15c84a 100644
--- a/src/nvim/digraph.c
+++ b/src/nvim/digraph.c
@@ -1846,7 +1846,7 @@ static void printdigraph(const digr_T *dp, result_T *previous)
*p++ = dp->char2;
*p++ = ' ';
*p = NUL;
- msg_outtrans(buf);
+ msg_outtrans((char *)buf);
p = buf;
// add a space to draw a composing char on
@@ -1863,7 +1863,7 @@ static void printdigraph(const digr_T *dp, result_T *previous)
}
assert(p >= buf);
vim_snprintf((char *)p, sizeof(buf) - (size_t)(p - buf), " %3d", dp->result);
- msg_outtrans(buf);
+ msg_outtrans((char *)buf);
}
}
diff --git a/src/nvim/edit.c b/src/nvim/edit.c
index 47d07e457f..1223d98fbf 100644
--- a/src/nvim/edit.c
+++ b/src/nvim/edit.c
@@ -4223,7 +4223,7 @@ static int ins_compl_get_exp(pos_T *ini)
msg_hist_off = true; // reset in msg_trunc_attr()
vim_snprintf((char *)IObuff, IOSIZE, _("Scanning: %s"),
ins_buf->b_fname == NULL
- ? buf_spname(ins_buf)
+ ? (char_u *)buf_spname(ins_buf)
: ins_buf->b_sfname == NULL
? (char_u *)ins_buf->b_fname
: ins_buf->b_sfname);
@@ -4831,15 +4831,15 @@ static int ins_compl_next(int allow_get_expansion, int count, int insert_match,
*/
if (compl_shown_match->cp_fname != NULL) {
char *lead = _("match in file");
- int space = sc_col - vim_strsize((char_u *)lead) - 2;
- char_u *s;
- char_u *e;
+ int space = sc_col - vim_strsize(lead) - 2;
+ char *s;
+ char *e;
if (space > 0) {
// We need the tail that fits. With double-byte encoding going
// back from the end is very slow, thus go from the start and keep
// the text that fits in "space" between "s" and "e".
- for (s = e = compl_shown_match->cp_fname; *e != NUL; MB_PTR_ADV(e)) {
+ for (s = e = (char *)compl_shown_match->cp_fname; *e != NUL; MB_PTR_ADV(e)) {
space -= ptr2cells(e);
while (space < 0) {
space += ptr2cells(s);
@@ -4848,7 +4848,7 @@ static int ins_compl_next(int allow_get_expansion, int count, int insert_match,
}
msg_hist_off = true;
vim_snprintf((char *)IObuff, IOSIZE, "%s %s%s", lead,
- s > compl_shown_match->cp_fname ? "<" : "", s);
+ (char_u *)s > compl_shown_match->cp_fname ? "<" : "", s);
msg((char *)IObuff);
msg_hist_off = false;
redraw_cmdline = false; // don't overwrite!
@@ -6807,15 +6807,15 @@ void beginline(int flags)
int oneright(void)
{
- char_u *ptr;
+ char *ptr;
int l;
if (virtual_active()) {
pos_T prevpos = curwin->w_cursor;
// Adjust for multi-wide char (excluding TAB)
- ptr = get_cursor_pos_ptr();
- coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(utf_ptr2char((char *)ptr))) ?
+ ptr = (char *)get_cursor_pos_ptr();
+ coladvance(getviscol() + ((*ptr != TAB && vim_isprintc(utf_ptr2char(ptr))) ?
ptr2cells(ptr) : 1));
curwin->w_set_curswant = true;
// Return OK if the cursor moved, FAIL otherwise (at window edge).
@@ -6823,12 +6823,12 @@ int oneright(void)
|| prevpos.coladd != curwin->w_cursor.coladd) ? OK : FAIL;
}
- ptr = get_cursor_pos_ptr();
+ ptr = (char *)get_cursor_pos_ptr();
if (*ptr == NUL) {
return FAIL; // already at the very end
}
- l = utfc_ptr2len((char *)ptr);
+ l = utfc_ptr2len(ptr);
// move "l" bytes right, but don't end up on the NUL, unless 'virtualedit'
// contains "onemore".
@@ -6865,12 +6865,9 @@ int oneleft(void)
}
if (curwin->w_cursor.coladd == 1) {
- char_u *ptr;
-
// Adjust for multi-wide char (not a TAB)
- ptr = get_cursor_pos_ptr();
- if (*ptr != TAB && vim_isprintc(utf_ptr2char((char *)ptr))
- && ptr2cells(ptr) > 1) {
+ char *ptr = (char *)get_cursor_pos_ptr();
+ if (*ptr != TAB && vim_isprintc(utf_ptr2char(ptr)) && ptr2cells(ptr) > 1) {
curwin->w_cursor.coladd = 0;
}
}
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 7b6e954b3a..bb2404750b 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -8968,7 +8968,7 @@ static void list_one_var_a(const char *prefix, const char *name, const ptrdiff_t
msg_putchar(' ');
}
- msg_outtrans((char_u *)string);
+ msg_outtrans((char *)string);
if (type == VAR_FUNC || type == VAR_PARTIAL) {
msg_puts("()");
@@ -10124,7 +10124,7 @@ repeat:
os_dirname((char_u *)dirname, MAXPATHL);
if (has_homerelative) {
s = xstrdup(dirname);
- home_replace(NULL, (char_u *)s, (char_u *)dirname, MAXPATHL, true);
+ home_replace(NULL, s, dirname, MAXPATHL, true);
xfree(s);
}
size_t namelen = STRLEN(dirname);
@@ -10147,7 +10147,7 @@ repeat:
}
}
} else {
- home_replace(NULL, (char_u *)p, (char_u *)dirname, MAXPATHL, true);
+ home_replace(NULL, p, dirname, MAXPATHL, true);
// Only replace it when it starts with '~'
if (*dirname == '~') {
s = xstrdup(dirname);
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index f7d6b016fd..b383a20af4 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -10688,7 +10688,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// "./…" => "/home/foo/…"
vim_FullName(cwd, (char *)NameBuff, sizeof(NameBuff), false);
// "/home/foo/…" => "~/…"
- size_t len = home_replace(NULL, NameBuff, IObuff, sizeof(IObuff), true);
+ size_t len = home_replace(NULL, (char *)NameBuff, (char *)IObuff, sizeof(IObuff), true);
// Trim slash.
if (len != 1 && (IObuff[len - 1] == '\\' || IObuff[len - 1] == '/')) {
IObuff[len - 1] = '\0';
@@ -10706,7 +10706,7 @@ static void f_termopen(typval_T *argvars, typval_T *rettv, FunPtr fptr)
// at this point the buffer has no terminal instance associated yet, so unset
// the 'swapfile' option to ensure no swap file will be created
curbuf->b_p_swf = false;
- (void)setfname(curbuf, NameBuff, NULL, true);
+ (void)setfname(curbuf, (char *)NameBuff, NULL, true);
// Save the job id and pid in b:terminal_job_{id,pid}
Error err = ERROR_INIT;
// deprecated: use 'channel' buffer option
diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c
index 9938dc5012..8646520ec3 100644
--- a/src/nvim/eval/userfunc.c
+++ b/src/nvim/eval/userfunc.c
@@ -1044,9 +1044,8 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
if (tofree != NULL) {
char *s = tofree;
char buf[MSG_BUF_LEN];
- if (vim_strsize((char_u *)s) > MSG_BUF_CLEN) {
- trunc_string((char_u *)s, (char_u *)buf, MSG_BUF_CLEN,
- sizeof(buf));
+ if (vim_strsize(s) > MSG_BUF_CLEN) {
+ trunc_string((char_u *)s, (char_u *)buf, MSG_BUF_CLEN, sizeof(buf));
s = buf;
}
msg_puts(s);
@@ -1159,7 +1158,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
char *tofree = s;
emsg_off--;
if (s != NULL) {
- if (vim_strsize((char_u *)s) > MSG_BUF_CLEN) {
+ if (vim_strsize(s) > MSG_BUF_CLEN) {
trunc_string((char_u *)s, (char_u *)buf, MSG_BUF_CLEN, MSG_BUF_LEN);
s = buf;
}
diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c
index 1722f0ee1f..9496a568b9 100644
--- a/src/nvim/event/socket.c
+++ b/src/nvim/event/socket.c
@@ -38,7 +38,7 @@ int socket_watcher_init(Loop *loop, SocketWatcher *watcher, const char *endpoint
char *port = host_end + 1;
intmax_t iport;
- int ok = try_getdigits(&(char_u *){ (char_u *)port }, &iport);
+ int ok = try_getdigits(&(char *){ port }, &iport);
if (!ok || iport < 0 || iport > UINT16_MAX) {
ELOG("Invalid port: %s", port);
return UV_EINVAL;
diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c
index 92c1b5d2c7..8016c69bcb 100644
--- a/src/nvim/ex_cmds.c
+++ b/src/nvim/ex_cmds.c
@@ -876,8 +876,7 @@ void ex_retab(exarg_T *eap)
long *old_vts_ary = curbuf->b_p_vts_array;
if (tabstop_count(old_vts_ary) > 0 || tabstop_count(new_vts_array) > 1) {
- set_string_option_direct("vts", -1, (char_u *)new_ts_str,
- OPT_FREE | OPT_LOCAL, 0);
+ set_string_option_direct("vts", -1, new_ts_str, OPT_FREE | OPT_LOCAL, 0);
curbuf->b_p_vts_array = new_vts_array;
xfree(old_vts_ary);
} else {
@@ -1232,7 +1231,7 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
msg_start();
msg_putchar(':');
msg_putchar('!');
- msg_outtrans((char_u *)newcmd);
+ msg_outtrans(newcmd);
msg_clr_eos();
ui_cursor_goto(msg_row, msg_col);
@@ -1738,7 +1737,7 @@ int rename_buffer(char *new_fname)
xfname = curbuf->b_fname;
curbuf->b_ffname = NULL;
curbuf->b_sfname = NULL;
- if (setfname(curbuf, (char_u *)new_fname, NULL, true) == FAIL) {
+ if (setfname(curbuf, new_fname, NULL, true) == FAIL) {
curbuf->b_ffname = (char_u *)fname;
curbuf->b_sfname = (char_u *)sfname;
return FAIL;
@@ -2218,7 +2217,7 @@ int getfile(int fnum, char *ffname_arg, char *sfname_arg, int setpm, linenr_T ln
if (fnum == 0) {
// make ffname full path, set sfname
- fname_expand(curbuf, (char_u **)&ffname, (char_u **)&sfname);
+ fname_expand(curbuf, &ffname, &sfname);
other = otherfile((char_u *)ffname);
free_me = ffname; // has been allocated, free() later
} else {
@@ -4453,8 +4452,7 @@ skip:
// Show 'inccommand' preview if there are matched lines.
if (cmdpreview && !aborting()) {
if (got_quit || profile_passed_limit(timeout)) { // Too slow, disable.
- set_string_option_direct("icm", -1, (char_u *)"", OPT_FREE,
- SID_NONE);
+ set_string_option_direct("icm", -1, "", OPT_FREE, SID_NONE);
} else if (*p_icm != NUL && pat != NULL) {
if (pre_hl_id == 0) {
pre_hl_id = syn_check_group(S_LEN("Substitute"));
@@ -4742,7 +4740,7 @@ bool prepare_tagpreview(bool undo_sync)
and 'cursorbind' */
curwin->w_p_diff = false; // no 'diff'
set_string_option_direct("fdc", -1, // no 'foldcolumn'
- (char_u *)"0", OPT_FREE, SID_NONE);
+ "0", OPT_FREE, SID_NONE);
return true;
}
}
@@ -5272,8 +5270,7 @@ int find_help_tags(const char *arg, int *num_matches, char ***matches, bool keep
static void prepare_help_buffer(void)
{
curbuf->b_help = true;
- set_string_option_direct("buftype", -1, (char_u *)"help",
- OPT_FREE|OPT_LOCAL, 0);
+ set_string_option_direct("buftype", -1, "help", OPT_FREE|OPT_LOCAL, 0);
// Always set these options after jumping to a help tag, because the
// user may have an autocommand that gets in the way.
@@ -5282,14 +5279,13 @@ static void prepare_help_buffer(void)
// Only set it when needed, buf_init_chartab() is some work.
char *p = "!-~,^*,^|,^\",192-255";
if (STRCMP(curbuf->b_p_isk, p) != 0) {
- set_string_option_direct("isk", -1, (char_u *)p, OPT_FREE|OPT_LOCAL, 0);
+ set_string_option_direct("isk", -1, p, OPT_FREE|OPT_LOCAL, 0);
check_buf_options(curbuf);
(void)buf_init_chartab(curbuf, FALSE);
}
// Don't use the global foldmethod.
- set_string_option_direct("fdm", -1, (char_u *)"manual",
- OPT_FREE|OPT_LOCAL, 0);
+ set_string_option_direct("fdm", -1, "manual", OPT_FREE|OPT_LOCAL, 0);
curbuf->b_p_ts = 8; // 'tabstop' is 8.
curwin->w_p_list = FALSE; // No list mode.
@@ -5375,7 +5371,7 @@ void fix_help_buffer(void)
copy_option_part((char_u **)&p, NameBuff, MAXPATHL, ",");
char *const rt = vim_getenv("VIMRUNTIME");
if (rt != NULL
- && path_full_compare((char_u *)rt, NameBuff, false, true) != kEqualFiles) {
+ && path_full_compare(rt, (char *)NameBuff, false, true) != kEqualFiles) {
int fcount;
char **fnames;
char *s;
@@ -5582,8 +5578,7 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
// add the "help-tags" tag.
ga_init(&ga, (int)sizeof(char_u *), 100);
if (add_help_tags
- || path_full_compare((char_u *)"$VIMRUNTIME/doc",
- (char_u *)dir, false, true) == kEqualFiles) {
+ || path_full_compare("$VIMRUNTIME/doc", dir, false, true) == kEqualFiles) {
size_t s_len = 18 + STRLEN(tagfname);
s = xmalloc(s_len);
snprintf(s, s_len, "help-tags\t%s\t1\n", tagfname);
@@ -5874,8 +5869,7 @@ static int show_sub(exarg_T *eap, pos_T old_cusr, PreviewLines *preview_lines, i
buf_T *cmdpreview_buf = NULL;
// disable file info message
- set_string_option_direct("shm", -1, (char_u *)"F", OPT_FREE,
- SID_NONE);
+ set_string_option_direct("shm", -1, "F", OPT_FREE, SID_NONE);
// Update the topline to ensure that main window is on the correct line
update_topline(curwin);
@@ -5977,7 +5971,7 @@ static int show_sub(exarg_T *eap, pos_T old_cusr, PreviewLines *preview_lines, i
xfree(str);
- set_string_option_direct("shm", -1, (char_u *)save_shm_p, OPT_FREE, SID_NONE);
+ set_string_option_direct("shm", -1, save_shm_p, OPT_FREE, SID_NONE);
xfree(save_shm_p);
return preview ? 2 : 1;
@@ -6077,7 +6071,7 @@ void ex_oldfiles(exarg_T *eap)
if (!message_filtered((char_u *)fname)) {
msg_outnum(nr);
msg_puts(": ");
- msg_outtrans((char_u *)tv_get_string(TV_LIST_ITEM_TV(li)));
+ msg_outtrans((char *)tv_get_string(TV_LIST_ITEM_TV(li)));
msg_clr_eos();
msg_putchar('\n');
ui_flush(); // output one line at a time
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 9b260f9091..621004103e 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -732,7 +732,7 @@ bool check_changed_any(bool hidden, bool unload)
if ((buf->terminal && channel_job_running((uint64_t)buf->b_p_channel))
? semsg(_("E947: Job still running in buffer \"%s\""), buf->b_fname)
: semsg(_("E162: No write since last change for buffer \"%s\""),
- buf_spname(buf) != NULL ? buf_spname(buf) : (char_u *)buf->b_fname)) {
+ buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname)) {
save = no_wait_return;
no_wait_return = false;
wait_return(false);
@@ -929,8 +929,7 @@ static int do_arglist(char *str, int what, int after, bool will_edit)
didone = false;
for (match = 0; match < ARGCOUNT; match++) {
- if (vim_regexec(&regmatch, alist_name(&ARGLIST[match]),
- (colnr_T)0)) {
+ if (vim_regexec(&regmatch, (char_u *)alist_name(&ARGLIST[match]), (colnr_T)0)) {
didone = true;
xfree(ARGLIST[match].ae_fname);
memmove(ARGLIST + match, ARGLIST + match + 1,
@@ -993,7 +992,8 @@ static bool editing_arg_idx(win_T *win)
!= WARGLIST(win)[win->w_arg_idx].ae_fnum
&& (win->w_buffer->b_ffname == NULL
|| !(path_full_compare(alist_name(&WARGLIST(win)[win->w_arg_idx]),
- win->w_buffer->b_ffname, true, true) & kEqualFiles))));
+ (char *)win->w_buffer->b_ffname, true,
+ true) & kEqualFiles))));
}
/// Check if window "win" is editing the w_arg_idx file in its argument list.
@@ -1011,7 +1011,7 @@ void check_arg_idx(win_T *win)
&& (win->w_buffer->b_fnum == GARGLIST[GARGCOUNT - 1].ae_fnum
|| (win->w_buffer->b_ffname != NULL
&& (path_full_compare(alist_name(&GARGLIST[GARGCOUNT - 1]),
- win->w_buffer->b_ffname, true, true)
+ (char *)win->w_buffer->b_ffname, true, true)
& kEqualFiles)))) {
arg_had_last = true;
}
@@ -1050,7 +1050,7 @@ void ex_args(exarg_T *eap)
// required and no wait_return().
gotocmdline(true);
for (int i = 0; i < ARGCOUNT; i++) {
- items[i] = (char *)alist_name(&ARGLIST[i]);
+ items[i] = alist_name(&ARGLIST[i]);
}
list_in_columns((char_u **)items, ARGCOUNT, curwin->w_arg_idx);
xfree(items);
@@ -1137,7 +1137,7 @@ void do_argfile(exarg_T *eap, int argn)
// the same buffer
other = true;
if (buf_hide(curbuf)) {
- p = fix_fname((char *)alist_name(&ARGLIST[argn]));
+ p = fix_fname(alist_name(&ARGLIST[argn]));
other = otherfile((char_u *)p);
xfree(p);
}
@@ -1159,7 +1159,7 @@ void do_argfile(exarg_T *eap, int argn)
// Edit the file; always use the last known line number.
// When it fails (e.g. Abort for already edited file) restore the
// argument index.
- if (do_ecmd(0, (char *)alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
+ if (do_ecmd(0, alist_name(&ARGLIST[curwin->w_arg_idx]), NULL,
eap, ECMD_LAST,
(buf_hide(curwin->w_buffer) ? ECMD_HIDE : 0)
+ (eap->forceit ? ECMD_FORCEIT : 0), curwin) == FAIL) {
@@ -1568,7 +1568,7 @@ char *get_arglist_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
if (idx >= ARGCOUNT) {
return NULL;
}
- return (char *)alist_name(&ARGLIST[idx]);
+ return alist_name(&ARGLIST[idx]);
}
/// ":compiler[!] {name}"
@@ -2206,11 +2206,11 @@ void ex_scriptnames(exarg_T *eap)
for (int i = 1; i <= script_items.ga_len && !got_int; i++) {
if (SCRIPT_ITEM(i).sn_name != NULL) {
- home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, true);
+ 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)) {
msg_putchar('\n');
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
line_breakcheck();
}
}
diff --git a/src/nvim/ex_cmds_defs.h b/src/nvim/ex_cmds_defs.h
index 8280f99547..9350a9f60b 100644
--- a/src/nvim/ex_cmds_defs.h
+++ b/src/nvim/ex_cmds_defs.h
@@ -274,7 +274,7 @@ typedef struct {
int cmod_verbose; ///< 0 if not set, > 0 to set 'verbose' to cmod_verbose - 1
// values for undo_cmdmod()
- char_u *cmod_save_ei; ///< saved value of 'eventignore'
+ char *cmod_save_ei; ///< saved value of 'eventignore'
int cmod_did_sandbox; ///< set when "sandbox" was incremented
long cmod_verbose_save; ///< if 'verbose' was set: value of p_verbose plus one
int cmod_save_msg_silent; ///< if non-zero: saved value of msg_silent + 1
diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c
index 88177533ab..48e6dad720 100644
--- a/src/nvim/ex_docmd.c
+++ b/src/nvim/ex_docmd.c
@@ -1212,7 +1212,7 @@ static char *skip_colon_white(const char *p, bool skipleadingwhite)
/// Set the addr type for command
///
/// @param p pointer to character after command name in cmdline
-void set_cmd_addr_type(exarg_T *eap, char_u *p)
+void set_cmd_addr_type(exarg_T *eap, char *p)
{
// ea.addr_type for user commands is set by find_ucmd
if (IS_USER_CMDIDX(eap->cmdidx)) {
@@ -1225,7 +1225,7 @@ void set_cmd_addr_type(exarg_T *eap, char_u *p)
}
// :wincmd range depends on the argument
if (eap->cmdidx == CMD_wincmd && p != NULL) {
- get_wincmd_addr_type(skipwhite((char *)p), eap);
+ get_wincmd_addr_type(skipwhite(p), eap);
}
// :.cc in quickfix window uses line number
if ((eap->cmdidx == CMD_cc || eap->cmdidx == CMD_ll) && bt_quickfix(curbuf)) {
@@ -1453,7 +1453,7 @@ bool parse_cmdline(char *cmdline, exarg_T *eap, CmdParseInfo *cmdinfo, char **er
}
// Set command address type and parse command range
- set_cmd_addr_type(eap, (char_u *)p);
+ set_cmd_addr_type(eap, p);
eap->cmd = cmd;
if (parse_cmd_address(eap, errormsg, false) == FAIL) {
return false;
@@ -1824,7 +1824,7 @@ static char *do_one_cmd(char **cmdlinep, int flags, cstack_T *cstack, LineGetter
// The ea.cmd pointer is updated to point to the first character following the
// range spec. If an initial address is found, but no second, the upper bound
// is equal to the lower.
- set_cmd_addr_type(&ea, (char_u *)p);
+ set_cmd_addr_type(&ea, p);
ea.cmd = cmd;
if (parse_cmd_address(&ea, &errormsg, false) == FAIL) {
@@ -2667,8 +2667,8 @@ static void apply_cmdmod(cmdmod_T *cmod)
if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL) {
// Set 'eventignore' to "all".
// First save the existing option value for restoring it later.
- cmod->cmod_save_ei = vim_strsave(p_ei);
- set_string_option_direct("ei", -1, (char_u *)"all", OPT_FREE, SID_NONE);
+ cmod->cmod_save_ei = (char *)vim_strsave(p_ei);
+ set_string_option_direct("ei", -1, "all", OPT_FREE, SID_NONE);
}
}
@@ -2688,7 +2688,7 @@ static void undo_cmdmod(cmdmod_T *cmod)
if (cmod->cmod_save_ei != NULL) {
// Restore 'eventignore' to the value before ":noautocmd".
- set_string_option_direct("ei", -1, (char_u *)cmod->cmod_save_ei, OPT_FREE, SID_NONE);
+ set_string_option_direct("ei", -1, cmod->cmod_save_ei, OPT_FREE, SID_NONE);
free_string_option((char_u *)cmod->cmod_save_ei);
cmod->cmod_save_ei = NULL;
}
@@ -5804,7 +5804,7 @@ static void uc_list(char *name, size_t name_len)
} while (len < 25 - over);
IObuff[len] = '\0';
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
msg_outtrans_special(cmd->uc_rep, false,
name_len == 0 ? Columns - 47 : 0);
@@ -7574,7 +7574,7 @@ static void ex_recover(exarg_T *eap)
| CCGD_EXCMD)
&& (*eap->arg == NUL
- || setfname(curbuf, (char_u *)eap->arg, NULL, true) == OK)) {
+ || setfname(curbuf, eap->arg, NULL, true) == OK)) {
ml_recover(true);
}
recoverymode = false;
@@ -7762,9 +7762,9 @@ static void ex_tabs(exarg_T *eap)
if (buf_spname(wp->w_buffer) != NULL) {
STRLCPY(IObuff, buf_spname(wp->w_buffer), IOSIZE);
} else {
- home_replace(wp->w_buffer, (char_u *)wp->w_buffer->b_fname, IObuff, IOSIZE, true);
+ home_replace(wp->w_buffer, wp->w_buffer->b_fname, (char *)IObuff, IOSIZE, true);
}
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
ui_flush(); // output one line at a time
os_breakcheck();
}
@@ -9646,7 +9646,7 @@ static char *arg_all(void)
for (;;) {
len = 0;
for (idx = 0; idx < ARGCOUNT; idx++) {
- p = (char *)alist_name(&ARGLIST[idx]);
+ p = alist_name(&ARGLIST[idx]);
if (p == NULL) {
continue;
}
diff --git a/src/nvim/ex_getln.c b/src/nvim/ex_getln.c
index 420f3f73af..93758b9ec9 100644
--- a/src/nvim/ex_getln.c
+++ b/src/nvim/ex_getln.c
@@ -952,8 +952,7 @@ static uint8_t *command_line_enter(int firstc, long count, int indent, bool init
need_wait_return = false;
}
- set_string_option_direct("icm", -1, s->save_p_icm, OPT_FREE,
- SID_NONE);
+ set_string_option_direct("icm", -1, (char *)s->save_p_icm, OPT_FREE, SID_NONE);
State = s->save_State;
if (cmdpreview != save_cmdpreview) {
cmdpreview = save_cmdpreview; // restore preview state
@@ -2751,7 +2750,7 @@ static int cmdline_charsize(int idx)
if (cmdline_star > 0) { // showing '*', always 1 position
return 1;
}
- return ptr2cells(ccline.cmdbuff + idx);
+ return ptr2cells((char *)ccline.cmdbuff + idx);
}
/// Compute the offset of the cursor on the command line for the prompt and
@@ -3554,7 +3553,7 @@ void put_on_cmdline(char_u *str, int len, int redraw)
}
if (i != 0) {
// Also backup the cursor position.
- i = ptr2cells(ccline.cmdbuff + ccline.cmdpos);
+ i = ptr2cells((char *)ccline.cmdbuff + ccline.cmdpos);
ccline.cmdspos -= i;
msg_col -= i;
if (msg_col < 0) {
@@ -4551,10 +4550,10 @@ static int showmatches(expand_T *xp, int wildmenu)
if (!showtail && (xp->xp_context == EXPAND_FILES
|| xp->xp_context == EXPAND_SHELLCMD
|| xp->xp_context == EXPAND_BUFFERS)) {
- home_replace(NULL, files_found[i], NameBuff, MAXPATHL, TRUE);
- j = vim_strsize(NameBuff);
+ home_replace(NULL, (char *)files_found[i], (char *)NameBuff, MAXPATHL, true);
+ j = vim_strsize((char *)NameBuff);
} else {
- j = vim_strsize(L_SHOWFILE(i));
+ j = vim_strsize((char *)L_SHOWFILE(i));
}
if (j > maxlen) {
maxlen = j;
@@ -4621,8 +4620,7 @@ static int showmatches(expand_T *xp, int wildmenu)
if (showtail) {
p = L_SHOWFILE(k);
} else {
- home_replace(NULL, files_found[k], NameBuff, MAXPATHL,
- TRUE);
+ home_replace(NULL, (char *)files_found[k], (char *)NameBuff, MAXPATHL, true);
p = NameBuff;
}
} else {
@@ -6536,13 +6534,13 @@ void ex_history(exarg_T *eap)
msg_putchar('\n');
snprintf((char *)IObuff, IOSIZE, "%c%6d ", i == idx ? '>' : ' ',
hist[i].hisnum);
- if (vim_strsize(hist[i].hisstr) > Columns - 10) {
+ if (vim_strsize((char *)hist[i].hisstr) > Columns - 10) {
trunc_string(hist[i].hisstr, IObuff + STRLEN(IObuff),
Columns - 10, IOSIZE - (int)STRLEN(IObuff));
} else {
STRCAT(IObuff, hist[i].hisstr);
}
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
ui_flush();
}
if (i == idx) {
diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c
index e60be80923..08c232ea69 100644
--- a/src/nvim/ex_session.c
+++ b/src/nvim/ex_session.c
@@ -215,7 +215,7 @@ static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigne
}
for (int i = 0; i < gap->ga_len; i++) {
// NULL file names are skipped (only happens when out of memory).
- s = alist_name(&((aentry_T *)gap->ga_data)[i]);
+ s = (char_u *)alist_name(&((aentry_T *)gap->ga_data)[i]);
if (s != NULL) {
if (fullname) {
buf = xmalloc(MAXPATHL);
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c
index 4c1dd63b8f..f53f70dcda 100644
--- a/src/nvim/fileio.c
+++ b/src/nvim/fileio.c
@@ -1697,7 +1697,7 @@ failed:
save_file_ff(curbuf);
// If editing a new file: set 'fenc' for the current buffer.
// Also for ":read ++edit file".
- set_string_option_direct("fenc", -1, (char_u *)fenc, OPT_FREE | OPT_LOCAL, 0);
+ set_string_option_direct("fenc", -1, fenc, OPT_FREE | OPT_LOCAL, 0);
}
if (fenc_alloced) {
xfree(fenc);
@@ -2057,7 +2057,7 @@ void set_forced_fenc(exarg_T *eap)
{
if (eap->force_enc != 0) {
char_u *fenc = enc_canonize((char_u *)eap->cmd + eap->force_enc);
- set_string_option_direct("fenc", -1, fenc, OPT_FREE|OPT_LOCAL, 0);
+ set_string_option_direct("fenc", -1, (char *)fenc, OPT_FREE|OPT_LOCAL, 0);
xfree(fenc);
}
}
@@ -3765,7 +3765,7 @@ static int set_rw_fname(char_u *fname, char_u *sfname)
return FAIL;
}
- if (setfname(curbuf, fname, sfname, false) == OK) {
+ if (setfname(curbuf, (char *)fname, (char *)sfname, false) == OK) {
curbuf->b_flags |= BF_NOTEDITED;
}
@@ -3805,8 +3805,7 @@ static void add_quoted_fname(char *const ret_buf, const size_t buf_len, const bu
fname = "-stdin-";
}
ret_buf[0] = '"';
- home_replace(buf, (const char_u *)fname, (char_u *)ret_buf + 1,
- (int)buf_len - 4, true);
+ home_replace(buf, fname, ret_buf + 1, (int)buf_len - 4, true);
xstrlcat(ret_buf, "\" ", buf_len);
}
diff --git a/src/nvim/fold.c b/src/nvim/fold.c
index 93ad2a6926..3c3aaa1031 100644
--- a/src/nvim/fold.c
+++ b/src/nvim/fold.c
@@ -1813,7 +1813,7 @@ char_u *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldin
p += len - 1;
} else if (*p == TAB) {
*p = ' ';
- } else if (ptr2cells(p) > 1) {
+ } else if (ptr2cells((char *)p) > 1) {
break;
}
}
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index d11088ed6b..6fdc10ae0b 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2501,7 +2501,7 @@ static int vgetorpeek(bool advance)
&& State != MODE_HITRETURN) {
// this looks nice when typing a dead character map
if (State & MODE_INSERT
- && ptr2cells(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - 1) == 1) {
+ && ptr2cells((char *)typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - 1) == 1) {
edit_putchar(typebuf.tb_buf[typebuf.tb_off + typebuf.tb_len - 1], false);
setcursor(); // put cursor back where it belongs
c1 = 1;
@@ -2524,9 +2524,9 @@ static int vgetorpeek(bool advance)
// this looks nice when typing a dead character map
if ((State & MODE_CMDLINE) && cmdline_star == 0) {
- char_u *p = typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - 1;
- if (ptr2cells(p) == 1 && *p < 128) {
- putcmdline((char)(*p), false);
+ char *p = (char *)typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - 1;
+ if (ptr2cells(p) == 1 && (uint8_t)(*p) < 128) {
+ putcmdline(*p, false);
c1 = 1;
}
}
diff --git a/src/nvim/hardcopy.c b/src/nvim/hardcopy.c
index aeccac060a..1dd0a5f3e8 100644
--- a/src/nvim/hardcopy.c
+++ b/src/nvim/hardcopy.c
@@ -658,7 +658,7 @@ void ex_hardcopy(exarg_T *eap)
* PS.)
*/
if (mch_print_init(&settings,
- curbuf->b_fname == NULL ? buf_spname(curbuf) : curbuf->b_sfname ==
+ curbuf->b_fname == NULL ? (char_u *)buf_spname(curbuf) : curbuf->b_sfname ==
NULL ? (char_u *)curbuf->b_fname : curbuf->b_sfname, eap->forceit) == FAIL) {
return;
}
diff --git a/src/nvim/highlight_group.c b/src/nvim/highlight_group.c
index ac7f6c4317..e5d9a9269c 100644
--- a/src/nvim/highlight_group.c
+++ b/src/nvim/highlight_group.c
@@ -811,7 +811,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
// ":highlight {group-name}": list highlighting for one group.
if (!doclear && !dolink && ends_excmd((uint8_t)(*linep))) {
- id = syn_name2id_len((const char_u *)line, (size_t)(name_end - line));
+ id = syn_name2id_len(line, (size_t)(name_end - line));
if (id == 0) {
semsg(_("E411: highlight group not found: %s"), line);
} else {
@@ -1389,7 +1389,7 @@ static void highlight_list_one(const int id)
didh = true;
msg_puts_attr("links to", HL_ATTR(HLF_D));
msg_putchar(' ');
- msg_outtrans(hl_table[hl_table[id - 1].sg_link - 1].sg_name);
+ msg_outtrans((char *)hl_table[hl_table[id - 1].sg_link - 1].sg_name);
}
if (!didh) {
@@ -1450,14 +1450,14 @@ static bool highlight_list_arg(const int id, bool didh, const int type, int iarg
}
}
- (void)syn_list_header(didh, vim_strsize((char_u *)ts) + (int)STRLEN(name) + 1, id, false);
+ (void)syn_list_header(didh, vim_strsize((char *)ts) + (int)STRLEN(name) + 1, id, false);
didh = true;
if (!got_int) {
if (*name != NUL) {
msg_puts_attr(name, HL_ATTR(HLF_D));
msg_puts_attr("=", HL_ATTR(HLF_D));
}
- msg_outtrans((char_u *)ts);
+ msg_outtrans((char *)ts);
}
}
return didh;
@@ -1581,7 +1581,7 @@ bool syn_list_header(const bool did_header, const int outlen, const int id, bool
if (got_int) {
return true;
}
- msg_outtrans(hl_table[id - 1].sg_name);
+ msg_outtrans((char *)hl_table[id - 1].sg_name);
name_col = msg_col;
endcol = 15;
} else if ((ui_has(kUIMessages) || msg_silent) && !force_newline) {
@@ -1650,14 +1650,14 @@ static void set_hl_attr(int idx)
int syn_name2id(const char *name)
FUNC_ATTR_NONNULL_ALL
{
- return syn_name2id_len((char_u *)name, STRLEN(name));
+ return syn_name2id_len(name, STRLEN(name));
}
/// Lookup a highlight group name and return its ID.
///
/// @param highlight name e.g. 'Cursor', 'Normal'
/// @return the highlight id, else 0 if \p name does not exist
-int syn_name2id_len(const char_u *name, size_t len)
+int syn_name2id_len(const char *name, size_t len)
FUNC_ATTR_NONNULL_ALL
{
char name_u[MAX_SYN_NAME + 1];
@@ -1719,7 +1719,7 @@ int syn_check_group(const char *name, size_t len)
emsg(_(e_highlight_group_name_too_long));
return 0;
}
- int id = syn_name2id_len((char_u *)name, len);
+ int id = syn_name2id_len(name, len);
if (id == 0) { // doesn't exist yet
return syn_add_group(name, len);
}
@@ -1735,7 +1735,7 @@ static int syn_add_group(const char *name, size_t len)
{
// Check that the name is ASCII letters, digits and underscore.
for (size_t i = 0; i < len; i++) {
- int c = (int8_t)name[i];
+ int c = (uint8_t)name[i];
if (!vim_isprintc(c)) {
emsg(_("E669: Unprintable character in group name"));
return 0;
diff --git a/src/nvim/if_cscope.c b/src/nvim/if_cscope.c
index f01f4fc771..8d08c2fc19 100644
--- a/src/nvim/if_cscope.c
+++ b/src/nvim/if_cscope.c
@@ -1078,7 +1078,7 @@ static int cs_help(exarg_T *eap)
(void)msg_puts(_("cscope commands:\n"));
while (cmdp->name != NULL) {
char *help = _(cmdp->help);
- int space_cnt = 30 - vim_strsize((char_u *)help);
+ int space_cnt = 30 - vim_strsize(help);
// Use %*s rather than %30s to ensure proper alignment in utf-8
if (space_cnt < 0) {
diff --git a/src/nvim/indent.c b/src/nvim/indent.c
index d71b3adb5c..8a5b4cbf0f 100644
--- a/src/nvim/indent.c
+++ b/src/nvim/indent.c
@@ -75,7 +75,7 @@ int get_indent_str(const char_u *ptr, int ts, bool list)
} else {
// In list mode, when tab is not set, count screen char width
// for Tab, displays: ^I
- count += ptr2cells(ptr);
+ count += ptr2cells((char *)ptr);
}
} else if (*ptr == ' ') {
// Count a space for one.
@@ -101,7 +101,7 @@ int get_indent_str_vtab(const char_u *ptr, long ts, long *vts, bool list)
} else {
// In list mode, when tab is not set, count screen char width
// for Tab, displays: ^I
- count += ptr2cells(ptr);
+ count += ptr2cells((char *)ptr);
}
} else if (*ptr == ' ') {
count++; // count a space for one
@@ -481,7 +481,7 @@ int get_breakindent_win(win_T *wp, char_u *line)
// indent minus the length of the showbreak string
if (wp->w_briopt_sbr) {
- bri -= vim_strsize(get_showbreak_value(wp));
+ bri -= vim_strsize((char *)get_showbreak_value(wp));
}
// never indent past left window margin
diff --git a/src/nvim/indent_c.c b/src/nvim/indent_c.c
index 29d3c5f95b..cb807dec24 100644
--- a/src/nvim/indent_c.c
+++ b/src/nvim/indent_c.c
@@ -2049,9 +2049,9 @@ int get_c_indent(void)
if (!cin_iscomment(theline) && comment_pos != NULL) { // XXX
int lead_start_len = 2;
int lead_middle_len = 1;
- char_u lead_start[COM_MAX_LEN]; // start-comment string
- char_u lead_middle[COM_MAX_LEN]; // middle-comment string
- char_u lead_end[COM_MAX_LEN]; // end-comment string
+ char lead_start[COM_MAX_LEN]; // start-comment string
+ char lead_middle[COM_MAX_LEN]; // middle-comment string
+ char lead_end[COM_MAX_LEN]; // end-comment string
char_u *p;
int start_align = 0;
int start_off = 0;
@@ -2084,7 +2084,7 @@ int get_c_indent(void)
if (*p == ':') {
p++;
}
- (void)copy_option_part(&p, lead_end, COM_MAX_LEN, ",");
+ (void)copy_option_part(&p, (char_u *)lead_end, COM_MAX_LEN, ",");
if (what == COM_START) {
STRCPY(lead_start, lead_end);
lead_start_len = (int)STRLEN(lead_start);
@@ -2120,8 +2120,7 @@ int get_c_indent(void)
if (start_off != 0) {
amount += start_off;
} else if (start_align == COM_RIGHT) {
- amount += vim_strsize(lead_start)
- - vim_strsize(lead_middle);
+ amount += vim_strsize(lead_start) - vim_strsize(lead_middle);
}
break;
}
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 124248508e..2b5a5a9033 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -1357,9 +1357,8 @@ scripterror:
char_u *p = vim_strsave((char_u *)argv[0]);
if (parmp->diff_mode && os_isdir(p) && GARGCOUNT > 0
- && !os_isdir(alist_name(&GARGLIST[0]))) {
- char_u *r = (char_u *)concat_fnames((char *)p,
- path_tail((char *)alist_name(&GARGLIST[0])), true);
+ && !os_isdir((char_u *)alist_name(&GARGLIST[0]))) {
+ char_u *r = (char_u *)concat_fnames((char *)p, path_tail(alist_name(&GARGLIST[0])), true);
xfree(p);
p = r;
}
@@ -1477,7 +1476,7 @@ static void init_path(const char *exename)
/// Get filename from command line, if any.
static char_u *get_fname(mparm_T *parmp, char_u *cwd)
{
- return alist_name(&GARGLIST[0]);
+ return (char_u *)alist_name(&GARGLIST[0]);
}
/*
@@ -1502,7 +1501,7 @@ static void handle_quickfix(mparm_T *paramp)
{
if (paramp->edit_type == EDIT_QF) {
if (paramp->use_ef != NULL) {
- set_string_option_direct("ef", -1, (char_u *)paramp->use_ef, OPT_FREE, SID_CARG);
+ set_string_option_direct("ef", -1, paramp->use_ef, OPT_FREE, SID_CARG);
}
vim_snprintf((char *)IObuff, IOSIZE, "cfile %s", p_ef);
if (qf_init(NULL, (char *)p_ef, p_efm, true, (char *)IObuff, (char *)p_menc) < 0) {
@@ -1743,7 +1742,7 @@ static void edit_buffers(mparm_T *parmp, char_u *cwd)
// at the ATTENTION prompt close the window.
swap_exists_did_quit = false;
(void)do_ecmd(0, arg_idx < GARGCOUNT
- ? (char *)alist_name(&GARGLIST[arg_idx])
+ ? alist_name(&GARGLIST[arg_idx])
: NULL, NULL, NULL, ECMD_LASTL, ECMD_HIDE, curwin);
if (swap_exists_did_quit) {
// abort or quit selected
@@ -1946,9 +1945,7 @@ static bool do_user_initialization(void)
if (do_source((char *)user_vimrc, true, DOSO_VIMRC) != FAIL) {
do_exrc = p_exrc;
if (do_exrc) {
- do_exrc = (path_full_compare((char_u *)VIMRC_FILE, user_vimrc,
- false, true)
- != kEqualFiles);
+ do_exrc = (path_full_compare(VIMRC_FILE, (char *)user_vimrc, false, true) != kEqualFiles);
}
xfree(user_vimrc);
return do_exrc;
@@ -1974,8 +1971,7 @@ static bool do_user_initialization(void)
if (do_source(vimrc, true, DOSO_VIMRC) != FAIL) {
do_exrc = p_exrc;
if (do_exrc) {
- do_exrc = (path_full_compare((char_u *)VIMRC_FILE, (char_u *)vimrc,
- false, true) != kEqualFiles);
+ do_exrc = (path_full_compare(VIMRC_FILE, vimrc, false, true) != kEqualFiles);
}
xfree(vimrc);
xfree(config_dirs);
diff --git a/src/nvim/mapping.c b/src/nvim/mapping.c
index d0ecf7549a..d4f7450af4 100644
--- a/src/nvim/mapping.c
+++ b/src/nvim/mapping.c
@@ -2324,7 +2324,7 @@ void ex_map(exarg_T *eap)
// print the mappings for security reasons.
if (secure) {
secure = 2;
- msg_outtrans((char_u *)eap->cmd);
+ msg_outtrans(eap->cmd);
msg_putchar('\n');
}
do_exmap(eap, false);
diff --git a/src/nvim/mark.c b/src/nvim/mark.c
index 8d1a917600..a0fed19a98 100644
--- a/src/nvim/mark.c
+++ b/src/nvim/mark.c
@@ -637,7 +637,7 @@ static char_u *mark_line(pos_T *mp, int lead_len)
// Truncate the line to fit it in the window
len = 0;
for (p = s; *p != NUL; MB_PTR_ADV(p)) {
- len += ptr2cells(p);
+ len += ptr2cells((char *)p);
if (len >= Columns - lead_len) {
break;
}
@@ -733,7 +733,7 @@ static void show_one_mark(int c, char_u *arg, pos_T *p, char_u *name_arg, int cu
msg_putchar('\n');
if (!got_int) {
snprintf((char *)IObuff, IOSIZE, " %c %6" PRIdLINENR " %4d ", c, p->lnum, p->col);
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
if (name != NULL) {
msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
}
@@ -864,7 +864,7 @@ void ex_jumps(exarg_T *eap)
i == curwin->w_jumplistidx ? '>' : ' ',
i > curwin->w_jumplistidx ? i - curwin->w_jumplistidx : curwin->w_jumplistidx - i,
curwin->w_jumplist[i].fmark.mark.lnum, curwin->w_jumplist[i].fmark.mark.col);
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
msg_outtrans_attr(name,
curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum
? HL_ATTR(HLF_D) : 0);
@@ -908,7 +908,7 @@ void ex_changes(exarg_T *eap)
: curwin->w_changelistidx - i,
(long)curbuf->b_changelist[i].mark.lnum,
curbuf->b_changelist[i].mark.col);
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
name = mark_line(&curbuf->b_changelist[i].mark, 17);
msg_outtrans_attr(name, HL_ATTR(HLF_D));
xfree(name);
@@ -1578,7 +1578,7 @@ void mark_mb_adjustpos(buf_T *buf, pos_T *lp)
if (lp->coladd == 1
&& p[lp->col] != TAB
&& vim_isprintc(utf_ptr2char((char *)p + lp->col))
- && ptr2cells(p + lp->col) > 1) {
+ && ptr2cells((char *)p + lp->col) > 1) {
lp->coladd = 0;
}
}
diff --git a/src/nvim/mbyte.c b/src/nvim/mbyte.c
index 24d079ea2c..1032986a02 100644
--- a/src/nvim/mbyte.c
+++ b/src/nvim/mbyte.c
@@ -2012,7 +2012,7 @@ void mb_check_adjust_col(void *win_)
// Column 0 is always valid.
if (oldcol != 0) {
- char_u *p = ml_get_buf(win->w_buffer, win->w_cursor.lnum, false);
+ char *p = (char *)ml_get_buf(win->w_buffer, win->w_cursor.lnum, false);
colnr_T len = (colnr_T)STRLEN(p);
// Empty line or invalid column?
@@ -2024,13 +2024,13 @@ void mb_check_adjust_col(void *win_)
win->w_cursor.col = len - 1;
}
// Move the cursor to the head byte.
- win->w_cursor.col -= utf_head_off(p, p + win->w_cursor.col);
+ win->w_cursor.col -= utf_head_off((char_u *)p, (char_u *)p + win->w_cursor.col);
}
// Reset `coladd` when the cursor would be on the right half of a
// double-wide character.
if (win->w_cursor.coladd == 1 && p[win->w_cursor.col] != TAB
- && vim_isprintc(utf_ptr2char((char *)p + win->w_cursor.col))
+ && vim_isprintc(utf_ptr2char(p + win->w_cursor.col))
&& ptr2cells(p + win->w_cursor.col) > 1) {
win->w_cursor.coladd = 0;
}
diff --git a/src/nvim/memline.c b/src/nvim/memline.c
index 21b0ab89d7..9da5aa54c5 100644
--- a/src/nvim/memline.c
+++ b/src/nvim/memline.c
@@ -531,7 +531,7 @@ void ml_open_file(buf_T *buf)
need_wait_return = true; // call wait_return later
no_wait_return++;
(void)semsg(_("E303: Unable to open swap file for \"%s\", recovery impossible"),
- buf_spname(buf) != NULL ? buf_spname(buf) : (char_u *)buf->b_fname);
+ buf_spname(buf) != NULL ? buf_spname(buf) : buf->b_fname);
no_wait_return--;
}
@@ -665,8 +665,8 @@ static void set_b0_fname(ZERO_BL *b0p, buf_T *buf)
* First replace home dir path with "~/" with home_replace().
* Then insert the user name to get "~user/".
*/
- home_replace(NULL, buf->b_ffname, b0p->b0_fname,
- B0_FNAME_SIZE_CRYPT, TRUE);
+ home_replace(NULL, (char *)buf->b_ffname, (char *)b0p->b0_fname,
+ B0_FNAME_SIZE_CRYPT, true);
if (b0p->b0_fname[0] == '~') {
// If there is no user name or it is too long, don't use "~/"
int retval = os_get_user_name(uname, B0_UNAME_SIZE);
@@ -933,18 +933,18 @@ void ml_recover(bool checkext)
*/
if (directly) {
expand_env(b0p->b0_fname, NameBuff, MAXPATHL);
- if (setfname(curbuf, NameBuff, NULL, true) == FAIL) {
+ if (setfname(curbuf, (char *)NameBuff, NULL, true) == FAIL) {
goto theend;
}
}
- home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE);
+ home_replace(NULL, (char *)mfp->mf_fname, (char *)NameBuff, MAXPATHL, true);
smsg(_("Using swap file \"%s\""), NameBuff);
if (buf_spname(curbuf) != NULL) {
STRLCPY(NameBuff, buf_spname(curbuf), MAXPATHL);
} else {
- home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
+ home_replace(NULL, (char *)curbuf->b_ffname, (char *)NameBuff, MAXPATHL, true);
}
smsg(_("Original file \"%s\""), NameBuff);
msg_putchar('\n');
@@ -1377,7 +1377,7 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
for (int i = 0; i < num_files; i++) {
// Do not expand wildcards, on Windows would try to expand
// "%tmp%" in "%tmp%file"
- if (path_full_compare(p, files[i], true, false) & kEqualFiles) {
+ if (path_full_compare((char *)p, (char *)files[i], true, false) & kEqualFiles) {
// Remove the name from files[i]. Move further entries
// down. When the array becomes empty free it here, since
// FreeWild() won't be called below.
@@ -1520,7 +1520,7 @@ static time_t swapfile_info(char_u *fname)
// print name of owner of the file
if (os_get_uname(file_info.stat.st_uid, uname, B0_UNAME_SIZE) == OK) {
msg_puts(_(" owned by: "));
- msg_outtrans((char_u *)uname);
+ msg_outtrans(uname);
msg_puts(_(" dated: "));
} else
#endif
@@ -1547,7 +1547,7 @@ static time_t swapfile_info(char_u *fname)
if (b0.b0_fname[0] == NUL) {
msg_puts(_("[No Name]"));
} else {
- msg_outtrans(b0.b0_fname);
+ msg_outtrans((char *)b0.b0_fname);
}
msg_puts(_("\n modified: "));
@@ -1555,7 +1555,7 @@ static time_t swapfile_info(char_u *fname)
if (*(b0.b0_uname) != NUL) {
msg_puts(_("\n user name: "));
- msg_outtrans(b0.b0_uname);
+ msg_outtrans((char *)b0.b0_uname);
}
if (*(b0.b0_hname) != NUL) {
@@ -1564,7 +1564,7 @@ static time_t swapfile_info(char_u *fname)
} else {
msg_puts(_("\n host name: "));
}
- msg_outtrans(b0.b0_hname);
+ msg_outtrans((char *)b0.b0_hname);
}
if (char_to_long(b0.b0_pid) != 0L) {
@@ -3317,7 +3317,7 @@ static void attention_message(buf_T *buf, char_u *fname)
msg_puts("\"\n");
const time_t swap_mtime = swapfile_info(fname);
msg_puts(_("While opening file \""));
- msg_outtrans((char_u *)buf->b_fname);
+ msg_outtrans(buf->b_fname);
msg_puts("\"\n");
FileInfo file_info;
if (!os_fileinfo(buf->b_fname, &file_info)) {
@@ -3339,10 +3339,10 @@ static void attention_message(buf_T *buf, char_u *fname)
" Quit, or continue with caution.\n"));
msg_puts(_("(2) An edit session for this file crashed.\n"));
msg_puts(_(" If this is the case, use \":recover\" or \"vim -r "));
- msg_outtrans((char_u *)buf->b_fname);
+ msg_outtrans(buf->b_fname);
msg_puts(_("\"\n to recover the changes (see \":help recovery\").\n"));
msg_puts(_(" If you did this already, delete the swap file \""));
- msg_outtrans(fname);
+ msg_outtrans((char *)fname);
msg_puts(_("\"\n to avoid this message.\n"));
cmdline_row = msg_row;
--no_wait_return;
@@ -3552,8 +3552,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
char *const name = xmalloc(name_len);
memcpy(name, sw_msg_1, sw_msg_1_len + 1);
- home_replace(NULL, (char_u *)fname, (char_u *)&name[sw_msg_1_len],
- fname_len, true);
+ home_replace(NULL, fname, &name[sw_msg_1_len], fname_len, true);
xstrlcat(name, sw_msg_2, name_len);
choice = do_dialog(VIM_WARNING, (char_u *)_("VIM - ATTENTION"),
(char_u *)name,
diff --git a/src/nvim/message.c b/src/nvim/message.c
index 82e299e8e9..733b4808fe 100644
--- a/src/nvim/message.c
+++ b/src/nvim/message.c
@@ -348,7 +348,7 @@ bool msg_attr_keep(const char *s, int attr, bool keep, bool multiline)
}
retval = msg_end();
- if (keep && retval && vim_strsize((char_u *)s) < (Rows - cmdline_row - 1) * Columns + sc_col) {
+ if (keep && retval && vim_strsize((char *)s) < (Rows - cmdline_row - 1) * Columns + sc_col) {
set_keep_msg((char *)s, 0);
}
@@ -374,7 +374,7 @@ char_u *msg_strtrunc(char_u *s, int force)
if ((!msg_scroll && !need_wait_return && shortmess(SHM_TRUNCALL)
&& !exmode_active && msg_silent == 0 && !ui_has(kUIMessages))
|| force) {
- len = vim_strsize(s);
+ len = vim_strsize((char *)s);
if (msg_scrolled != 0) {
// Use all the columns.
room = (Rows - msg_row) * Columns - 1;
@@ -423,7 +423,7 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen)
buf[e] = NUL;
return;
}
- n = ptr2cells(s + e);
+ n = ptr2cells((char *)s + e);
if (len + n > half) {
break;
}
@@ -443,7 +443,7 @@ void trunc_string(char_u *s, char_u *buf, int room_in, int buflen)
do {
half = half - utf_head_off(s, s + half - 1) - 1;
} while (half > 0 && utf_iscomposing(utf_ptr2char((char *)s + half)));
- n = ptr2cells(s + half);
+ n = ptr2cells((char *)s + half);
if (len + n > room || half == 0) {
break;
}
@@ -892,7 +892,7 @@ char_u *msg_may_trunc(bool force, char_u *s)
room = (Rows - cmdline_row - 1) * Columns + sc_col - 1;
if ((force || (shortmess(SHM_TRUNC) && !exmode_active))
&& (int)STRLEN(s) - room > 0) {
- int size = vim_strsize(s);
+ int size = vim_strsize((char *)s);
// There may be room anyway when there are multibyte chars.
if (size <= room) {
@@ -1275,7 +1275,7 @@ void wait_return(int redraw)
emsg_on_display = false; // can delete error message now
lines_left = -1; // reset lines_left at next msg_start()
reset_last_sourcing();
- if (keep_msg != NULL && vim_strsize(keep_msg) >=
+ if (keep_msg != NULL && vim_strsize((char *)keep_msg) >=
(Rows - cmdline_row - 1) * Columns + sc_col) {
XFREE_CLEAR(keep_msg); // don't redisplay message, it's too long
}
@@ -1489,9 +1489,9 @@ static void msg_home_replace_attr(char_u *fname, int attr)
/// Use attributes 'attr'.
///
/// @return the number of characters it takes on the screen.
-int msg_outtrans(char_u *str)
+int msg_outtrans(char *str)
{
- return msg_outtrans_attr(str, 0);
+ return msg_outtrans_attr((char_u *)str, 0);
}
int msg_outtrans_attr(const char_u *str, int attr)
@@ -1654,7 +1654,7 @@ int msg_outtrans_special(const char_u *strstart, bool from, int maxlen)
// single-byte character or illegal byte
text = (char *)transchar_byte((uint8_t)text[0]);
}
- const int len = vim_strsize((char_u *)text);
+ const int len = vim_strsize((char *)text);
if (maxlen > 0 && retval + len >= maxlen) {
break;
}
@@ -3027,7 +3027,7 @@ void msg_moremsg(int full)
if (full) {
grid_puts(&msg_grid_adj, (char_u *)
_(" SPACE/d/j: screen/page/line down, b/u/k: up, q: quit "),
- Rows - 1, vim_strsize(s), attr);
+ Rows - 1, vim_strsize((char *)s), attr);
}
}
@@ -3376,7 +3376,8 @@ int verbose_open(void)
/// Give a warning message (for searching).
/// Use 'w' highlighting and may repeat the message after redrawing
-void give_warning(char_u *message, bool hl) FUNC_ATTR_NONNULL_ARG(1)
+void give_warning(char *message, bool hl)
+ FUNC_ATTR_NONNULL_ARG(1)
{
// Don't do this for ":silent".
if (msg_silent != 0) {
@@ -3386,7 +3387,7 @@ void give_warning(char_u *message, bool hl) FUNC_ATTR_NONNULL_ARG(1)
// Don't want a hit-enter prompt here.
no_wait_return++;
- set_vim_var_string(VV_WARNINGMSG, (char *)message, -1);
+ set_vim_var_string(VV_WARNINGMSG, message, -1);
XFREE_CLEAR(keep_msg);
if (hl) {
keep_msg_attr = HL_ATTR(HLF_W);
@@ -3399,7 +3400,7 @@ void give_warning(char_u *message, bool hl) FUNC_ATTR_NONNULL_ARG(1)
}
if (msg_attr((const char *)message, keep_msg_attr) && msg_scrolled == 0) {
- set_keep_msg((char *)message, keep_msg_attr);
+ set_keep_msg(message, keep_msg_attr);
}
msg_didout = false; // Overwrite this message.
msg_nowait = true; // Don't wait for this message.
@@ -3411,7 +3412,7 @@ void give_warning(char_u *message, bool hl) FUNC_ATTR_NONNULL_ARG(1)
void give_warning2(char_u *const message, char_u *const a1, bool hl)
{
vim_snprintf((char *)IObuff, IOSIZE, (char *)message, a1);
- give_warning(IObuff, hl);
+ give_warning((char *)IObuff, hl);
}
/// Advance msg cursor to column "col".
diff --git a/src/nvim/move.c b/src/nvim/move.c
index cc811fca18..99ca5060cd 100644
--- a/src/nvim/move.c
+++ b/src/nvim/move.c
@@ -802,7 +802,7 @@ void curs_columns(win_T *wp, int may_scroll)
// column
char *const sbr = (char *)get_showbreak_value(wp);
if (*sbr && *get_cursor_pos_ptr() == NUL
- && wp->w_wcol == vim_strsize((char_u *)sbr)) {
+ && wp->w_wcol == vim_strsize(sbr)) {
wp->w_wcol = 0;
}
}
diff --git a/src/nvim/normal.c b/src/nvim/normal.c
index 5ed1a61b54..9637fe85e2 100644
--- a/src/nvim/normal.c
+++ b/src/nvim/normal.c
@@ -3287,7 +3287,7 @@ static bool nv_screengo(oparg_T *oap, int dir, long dist)
validate_virtcol();
colnr_T virtcol = curwin->w_virtcol;
if (virtcol > (colnr_T)width1 && *get_showbreak_value(curwin) != NUL) {
- virtcol -= vim_strsize(get_showbreak_value(curwin));
+ virtcol -= vim_strsize((char *)get_showbreak_value(curwin));
}
int c = utf_ptr2char((char *)get_cursor_pos_ptr());
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index 20bbc5b440..fcff2517ab 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3847,7 +3847,7 @@ void ex_display(exarg_T *eap)
n -= 2;
}
for (p = (char_u *)yb->y_array[j];
- *p != NUL && (n -= ptr2cells(p)) >= 0; p++) { // -V1019
+ *p != NUL && (n -= ptr2cells((char *)p)) >= 0; p++) { // -V1019
clen = utfc_ptr2len((char *)p);
msg_outtrans_len(p, clen);
p += clen - 1;
@@ -3925,7 +3925,7 @@ static void dis_msg(const char_u *p, bool skip_esc)
n = Columns - 6;
while (*p != NUL
&& !(*p == ESC && skip_esc && *(p + 1) == NUL)
- && (n -= ptr2cells(p)) >= 0) {
+ && (n -= ptr2cells((char *)p)) >= 0) {
if ((l = utfc_ptr2len((char *)p)) > 1) {
msg_outtrans_len(p, l);
p += l;
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 8cd9b5aead..09a597f7e2 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -621,7 +621,7 @@ static void set_option_default(int opt_idx, int opt_flags)
// freeing and allocating the value.
if (options[opt_idx].indir != PV_NONE) {
set_string_option_direct(NULL, opt_idx,
- options[opt_idx].def_val, opt_flags, 0);
+ (char *)options[opt_idx].def_val, opt_flags, 0);
} else {
if ((opt_flags & OPT_FREE) && (flags & P_ALLOCED)) {
free_string_option(*(char_u **)(varp));
@@ -944,7 +944,7 @@ void ex_set(exarg_T *eap)
if (eap->forceit) {
flags |= OPT_ONECOLUMN;
}
- (void)do_set((char_u *)eap->arg, flags);
+ (void)do_set(eap->arg, flags);
}
/// Parse 'arg' for option settings.
@@ -962,7 +962,7 @@ void ex_set(exarg_T *eap)
/// @param arg option string (may be written to!)
///
/// @return FAIL if an error is detected, OK otherwise
-int do_set(char_u *arg, int opt_flags)
+int do_set(char *arg, int opt_flags)
{
int opt_idx;
char *errmsg;
@@ -990,7 +990,7 @@ int do_set(char_u *arg, int opt_flags)
while (*arg != NUL) { // loop to process all options
errmsg = NULL;
- startarg = arg; // remember for error message
+ startarg = (char_u *)arg; // remember for error message
if (STRNCMP(arg, "all", 3) == 0 && !isalpha(arg[3])
&& !(opt_flags & OPT_MODELINE)) {
@@ -1043,7 +1043,7 @@ int do_set(char_u *arg, int opt_flags)
}
len++;
if (opt_idx == -1) {
- key = find_key_option(arg + 1, true);
+ key = find_key_option((char_u *)arg + 1, true);
}
} else {
len = 0;
@@ -1057,12 +1057,12 @@ int do_set(char_u *arg, int opt_flags)
}
opt_idx = findoption_len((const char *)arg, (size_t)len);
if (opt_idx == -1) {
- key = find_key_option(arg, false);
+ key = find_key_option((char_u *)arg, false);
}
}
// remember character after option name
- afterchar = arg[len];
+ afterchar = (uint8_t)arg[len];
// skip white space, allow ":set ai ?"
while (ascii_iswhite(arg[len])) {
@@ -1084,7 +1084,7 @@ int do_set(char_u *arg, int opt_flags)
len++;
}
}
- nextchar = arg[len];
+ nextchar = (uint8_t)arg[len];
if (opt_idx == -1 && key == 0) { // found a mismatch: skip
errmsg = N_("E518: Unknown option");
@@ -1282,14 +1282,14 @@ int do_set(char_u *arg, int opt_flags)
|| *arg == '^'
|| (*arg != NUL && (!arg[1] || ascii_iswhite(arg[1]))
&& !ascii_isdigit(*arg)))) {
- value = string_to_key(arg);
+ value = string_to_key((char_u *)arg);
if (value == 0 && (long *)varp != &p_wcm) {
errmsg = e_invarg;
goto skip;
}
} else if (*arg == '-' || ascii_isdigit(*arg)) {
// Allow negative, octal and hex numbers.
- vim_str2nr(arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, true);
+ vim_str2nr((char_u *)arg, NULL, &i, STR2NR_ALL, &value, NULL, 0, true);
if (i == 0 || (arg[i] != NUL && !ascii_iswhite(arg[i]))) {
errmsg = N_("E521: Number required after =");
goto skip;
@@ -1391,8 +1391,8 @@ int do_set(char_u *arg, int opt_flags)
if (varp == (char_u *)&p_kp
&& (*arg == NUL || *arg == ' ')) {
STRCPY(errbuf, ":help");
- save_arg = arg;
- arg = (char_u *)errbuf;
+ save_arg = (char_u *)arg;
+ arg = errbuf;
}
/*
* Convert 'backspace' number to string, for
@@ -1435,7 +1435,7 @@ int do_set(char_u *arg, int opt_flags)
else if (varp == (char_u *)&p_ww
&& ascii_isdigit(*arg)) {
*errbuf = NUL;
- i = getdigits_int(&arg, true, 0);
+ i = getdigits_int((char_u **)&arg, true, 0);
if (i & 1) {
STRLCAT(errbuf, "b,", sizeof(errbuf));
}
@@ -1451,8 +1451,8 @@ int do_set(char_u *arg, int opt_flags)
if (i & 16) {
STRLCAT(errbuf, "[,],", sizeof(errbuf));
}
- save_arg = arg;
- arg = (char_u *)errbuf;
+ save_arg = (char_u *)arg;
+ arg = errbuf;
}
/*
* Remove '>' before 'dir' and 'bdir', for
@@ -1498,14 +1498,14 @@ int do_set(char_u *arg, int opt_flags)
) {
arg++; // remove backslash
}
- i = utfc_ptr2len((char *)arg);
+ i = utfc_ptr2len(arg);
if (i > 1) {
// copy multibyte char
memmove(s, arg, (size_t)i);
arg += i;
s += i;
} else {
- *s++ = *arg++;
+ *s++ = (uint8_t)(*arg++);
}
}
*s = NUL;
@@ -1622,7 +1622,7 @@ int do_set(char_u *arg, int opt_flags)
}
if (save_arg != NULL) { // number for 'whichwrap'
- arg = save_arg;
+ arg = (char *)save_arg;
}
new_value_alloced = true;
}
@@ -1710,7 +1710,7 @@ skip:
arg++;
}
}
- arg = (char_u *)skipwhite((char *)arg);
+ arg = skipwhite(arg);
if (*arg != '=') {
break;
}
@@ -1720,12 +1720,12 @@ skip:
if (errmsg != NULL) {
STRLCPY(IObuff, _(errmsg), IOSIZE);
i = (int)STRLEN(IObuff) + 2;
- if (i + (arg - startarg) < IOSIZE) {
+ if (i + ((char_u *)arg - startarg) < IOSIZE) {
// append the argument with the error
STRCAT(IObuff, ": ");
- assert(arg >= startarg);
- memmove(IObuff + i, startarg, (size_t)(arg - startarg));
- IObuff[i + (arg - startarg)] = NUL;
+ assert((char_u *)arg >= startarg);
+ memmove(IObuff + i, startarg, (size_t)((char_u *)arg - startarg));
+ IObuff[i + ((char_u *)arg - startarg)] = NUL;
}
// make sure all characters are printable
trans_characters(IObuff, IOSIZE);
@@ -1737,7 +1737,7 @@ skip:
return FAIL;
}
- arg = (char_u *)skipwhite((char *)arg);
+ arg = skipwhite(arg);
}
theend:
@@ -2181,11 +2181,11 @@ static int shada_idx = -1;
/// "set_sid".
///
/// @param opt_flags OPT_FREE, OPT_LOCAL and/or OPT_GLOBAL
-void set_string_option_direct(const char *name, int opt_idx, const char_u *val, int opt_flags,
+void set_string_option_direct(const char *name, int opt_idx, const char *val, int opt_flags,
int set_sid)
{
- char_u *s;
- char_u **varp;
+ char *s;
+ char **varp;
int both = (opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0;
int idx = opt_idx;
@@ -2204,18 +2204,17 @@ void set_string_option_direct(const char *name, int opt_idx, const char_u *val,
assert((void *)options[idx].var != (void *)&p_shada);
- s = vim_strsave(val);
+ s = xstrdup(val);
{
- varp = (char_u **)get_varp_scope(&(options[idx]),
- both ? OPT_LOCAL : opt_flags);
+ varp = (char **)get_varp_scope(&(options[idx]), both ? OPT_LOCAL : opt_flags);
if ((opt_flags & OPT_FREE) && (options[idx].flags & P_ALLOCED)) {
- free_string_option(*varp);
+ free_string_option((char_u *)(*varp));
}
*varp = s;
// For buffer/window local option may also set the global value.
if (both) {
- set_string_option_global(idx, varp);
+ set_string_option_global(idx, (char_u **)varp);
}
options[idx].flags |= P_ALLOCED;
@@ -2223,8 +2222,8 @@ void set_string_option_direct(const char *name, int opt_idx, const char_u *val,
/* When setting both values of a global option with a local value,
* make the local value empty, so that the global value is used. */
if (((int)options[idx].indir & PV_BOTH) && both) {
- free_string_option(*varp);
- *varp = empty_option;
+ free_string_option((char_u *)(*varp));
+ *varp = (char *)empty_option;
}
if (set_sid != SID_NONE) {
sctx_T script_ctx;
@@ -2814,7 +2813,7 @@ ambw_end:
}
} else if (gvarp == &p_sbr) { // 'showbreak'
for (s = *varp; *s;) {
- if (ptr2cells(s) != 1) {
+ if (ptr2cells((char *)s) != 1) {
errmsg = N_("E595: 'showbreak' contains unprintable or wide character");
}
MB_PTR_ADV(s);
@@ -2834,7 +2833,7 @@ ambw_end:
int flagval = (varp == &p_titlestring) ? STL_IN_TITLE : STL_IN_ICON;
// NULL => statusline syntax
- if (vim_strchr((char *)(*varp), '%') && check_stl_option(*varp) == NULL) {
+ if (vim_strchr((char *)(*varp), '%') && check_stl_option((char *)(*varp)) == NULL) {
stl_syntax |= flagval;
} else {
stl_syntax &= ~flagval;
@@ -2943,14 +2942,14 @@ ambw_end:
s++;
}
wid = getdigits_int(&s, true, 0);
- if (wid && *s == '(' && (errmsg = check_stl_option(p_ruf)) == NULL) {
+ if (wid && *s == '(' && (errmsg = check_stl_option((char *)p_ruf)) == NULL) {
ru_wid = wid;
} else {
- errmsg = check_stl_option(p_ruf);
+ errmsg = check_stl_option((char *)p_ruf);
}
} else if (varp == &p_ruf || s[0] != '%' || s[1] != '!') {
// check 'statusline', 'winbar' or 'tabline' only if it doesn't start with "%!"
- errmsg = check_stl_option(s);
+ errmsg = check_stl_option((char *)s);
}
if (varp == &p_ruf && errmsg == NULL) {
comp_col();
@@ -3786,7 +3785,7 @@ static char *set_chars_option(win_T *wp, char_u **varp, bool set)
/// Check validity of options with the 'statusline' format.
/// Return an untranslated error message or NULL.
-char *check_stl_option(char_u *s)
+char *check_stl_option(char *s)
{
int groupdepth = 0;
static char errbuf[80];
@@ -5325,7 +5324,7 @@ static void showoptions(int all, int opt_flags)
len = 1; // a toggle option fits always
} else {
option_value2string(p, opt_flags);
- len = (int)STRLEN(p->fullname) + vim_strsize(NameBuff) + 1;
+ len = (int)STRLEN(p->fullname) + vim_strsize((char *)NameBuff) + 1;
}
if ((len <= INC - GAP && run == 1)
|| (len > INC - GAP && run == 2)) {
@@ -5438,7 +5437,7 @@ static void showoneopt(vimoption_T *p, int opt_flags)
msg_putchar('=');
// put value string in NameBuff
option_value2string(p, opt_flags);
- msg_outtrans(NameBuff);
+ msg_outtrans((char *)NameBuff);
}
silent_mode = save_silent;
@@ -5631,7 +5630,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char_u **valuep, uint6
// replace home directory in the whole option value into "buf"
buf = xmalloc(size);
- home_replace(NULL, *valuep, buf, size, false);
+ home_replace(NULL, (char *)(*valuep), (char *)buf, size, false);
// If the option value is longer than MAXPATHL, we need to append
// each comma separated part of the option separately, so that it
@@ -7042,7 +7041,7 @@ static void option_value2string(vimoption_T *opp, int opt_flags)
if (varp == NULL) { // Just in case.
NameBuff[0] = NUL;
} else if (opp->flags & P_EXPAND) {
- home_replace(NULL, varp, NameBuff, MAXPATHL, false);
+ home_replace(NULL, (char *)varp, (char *)NameBuff, MAXPATHL, false);
// Translate 'pastetoggle' into special key names.
} else if ((char_u **)opp->var == &p_pt) {
str2specialbuf((const char *)p_pt, (char *)NameBuff, MAXPATHL);
@@ -7963,11 +7962,7 @@ void set_fileformat(int eol_style, int opt_flags)
// p is NULL if "eol_style" is EOL_UNKNOWN.
if (p != NULL) {
- set_string_option_direct("ff",
- -1,
- (char_u *)p,
- OPT_FREE | opt_flags,
- 0);
+ set_string_option_direct("ff", -1, p, OPT_FREE | opt_flags, 0);
}
// This may cause the buffer to become (un)modified.
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index 4bc003bc7f..3a213605dc 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -1033,7 +1033,7 @@ char *vim_getenv(const char *name)
/// a list of them.
///
/// @return length of the string put into dst, does not include NUL byte.
-size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst, size_t dstlen,
+size_t home_replace(const buf_T *const buf, const char *src, char *const dst, size_t dstlen,
const bool one)
FUNC_ATTR_NONNULL_ARG(3)
{
@@ -1085,9 +1085,9 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
}
if (!one) {
- src = (char_u *)skipwhite((char *)src);
+ src = skipwhite((char *)src);
}
- char *dst_p = (char *)dst;
+ char *dst_p = dst;
while (*src && dstlen > 0) {
// Here we are at the beginning of a file name.
// First, check to see if the beginning of the file name matches
@@ -1123,11 +1123,11 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
// if (!one) skip to separator: space or comma.
while (*src && (one || (*src != ',' && *src != ' ')) && --dstlen > 0) {
- *dst_p++ = (char)(*src++);
+ *dst_p++ = *src++;
}
// Skip separator.
while ((*src == ' ' || *src == ',') && --dstlen > 0) {
- *dst_p++ = (char)(*src++);
+ *dst_p++ = *src++;
}
}
// If (dstlen == 0) out of space, what to do???
@@ -1137,7 +1137,7 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
if (must_free) {
xfree(homedir_env_mod);
}
- return (size_t)(dst_p - (char *)dst);
+ return (size_t)(dst_p - dst);
}
/// Like home_replace, store the replaced string in allocated memory.
@@ -1149,9 +1149,9 @@ char_u *home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
if (src != NULL) { // just in case
len += STRLEN(src);
}
- char_u *dst = xmalloc(len);
- home_replace(buf, src, dst, len, true);
- return dst;
+ char *dst = xmalloc(len);
+ home_replace(buf, (char *)src, dst, len, true);
+ return (char_u *)dst;
}
/// Function given to ExpandGeneric() to obtain an environment variable name.
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index d331bd21a2..9283ea2e42 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -854,9 +854,9 @@ static int do_os_system(char **argv, const char *input, size_t len, char **outpu
// Failed, probably 'shell' is not executable.
if (!silent) {
msg_puts(_("\nshell failed to start: "));
- msg_outtrans((char_u *)os_strerror(status));
+ msg_outtrans((char *)os_strerror(status));
msg_puts(": ");
- msg_outtrans((char_u *)prog);
+ msg_outtrans(prog);
msg_putchar('\n');
}
multiqueue_free(events);
diff --git a/src/nvim/path.c b/src/nvim/path.c
index 9859ca7daa..f5c662ca88 100644
--- a/src/nvim/path.c
+++ b/src/nvim/path.c
@@ -52,27 +52,27 @@
/// @param checkname When both files don't exist, only compare their names.
/// @param expandenv Whether to expand environment variables in file names.
/// @return Enum of type FileComparison. @see FileComparison.
-FileComparison path_full_compare(char_u *const s1, char_u *const s2, const bool checkname,
+FileComparison path_full_compare(char *const s1, char *const s2, const bool checkname,
const bool expandenv)
{
assert(s1 && s2);
- char_u exp1[MAXPATHL];
- char_u full1[MAXPATHL];
- char_u full2[MAXPATHL];
+ char exp1[MAXPATHL];
+ char full1[MAXPATHL];
+ char full2[MAXPATHL];
FileID file_id_1, file_id_2;
if (expandenv) {
- expand_env(s1, exp1, MAXPATHL);
+ expand_env((char_u *)s1, (char_u *)exp1, MAXPATHL);
} else {
STRLCPY(exp1, s1, MAXPATHL);
}
- bool id_ok_1 = os_fileid((char *)exp1, &file_id_1);
- bool id_ok_2 = os_fileid((char *)s2, &file_id_2);
+ bool id_ok_1 = os_fileid(exp1, &file_id_1);
+ bool id_ok_2 = os_fileid(s2, &file_id_2);
if (!id_ok_1 && !id_ok_2) {
// If os_fileid() doesn't work, may compare the names.
if (checkname) {
- vim_FullName((char *)exp1, (char *)full1, MAXPATHL, false);
- vim_FullName((char *)s2, (char *)full2, MAXPATHL, false);
+ vim_FullName(exp1, full1, MAXPATHL, false);
+ vim_FullName(s2, full2, MAXPATHL, false);
if (FNAMECMP(full1, full2) == 0) {
return kEqualFileNames;
}
diff --git a/src/nvim/plines.c b/src/nvim/plines.c
index 35f2512ee3..70bdbd8b1d 100644
--- a/src/nvim/plines.c
+++ b/src/nvim/plines.c
@@ -229,7 +229,7 @@ int win_chartabsize(win_T *wp, char_u *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(p);
+ return ptr2cells((char *)p);
}
}
@@ -408,7 +408,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he
// Set *headp to the size of what we add.
added = 0;
- char_u *const sbr = get_showbreak_value(wp);
+ char *const sbr = (char *)get_showbreak_value(wp);
if ((*sbr != NUL || wp->w_p_bri) && wp->w_p_wrap && col != 0) {
colnr_T sbrlen = 0;
int numberwidth = win_col_off(wp);
@@ -423,7 +423,7 @@ int win_lbr_chartabsize(win_T *wp, char_u *line, char_u *s, colnr_T col, int *he
col %= numberextra;
}
if (*sbr != NUL) {
- sbrlen = (colnr_T)mb_charlen(sbr);
+ sbrlen = (colnr_T)mb_charlen((char_u *)sbr);
if (col >= sbrlen) {
col -= sbrlen;
}
@@ -494,7 +494,7 @@ static int win_nolbr_chartabsize(win_T *wp, char_u *s, colnr_T col, int *headp)
wp->w_buffer->b_p_ts,
wp->w_buffer->b_p_vts_array);
}
- n = ptr2cells(s);
+ n = ptr2cells((char *)s);
// Add one cell for a double-width character in the last column of the
// window, displayed with a ">".
diff --git a/src/nvim/popupmnu.c b/src/nvim/popupmnu.c
index db1054eb1f..ecaeca005d 100644
--- a/src/nvim/popupmnu.c
+++ b/src/nvim/popupmnu.c
@@ -66,19 +66,19 @@ static void pum_compute_size(void)
for (int i = 0; i < pum_size; i++) {
int w;
if (pum_array[i].pum_text != NULL) {
- w = vim_strsize(pum_array[i].pum_text);
+ w = vim_strsize((char *)pum_array[i].pum_text);
if (pum_base_width < w) {
pum_base_width = w;
}
}
if (pum_array[i].pum_kind != NULL) {
- w = vim_strsize(pum_array[i].pum_kind) + 1;
+ w = vim_strsize((char *)pum_array[i].pum_kind) + 1;
if (pum_kind_width < w) {
pum_kind_width = w;
}
}
if (pum_array[i].pum_extra != NULL) {
- w = vim_strsize(pum_array[i].pum_extra) + 1;
+ w = vim_strsize((char *)pum_array[i].pum_extra) + 1;
if (pum_extra_width < w) {
pum_extra_width = w;
}
@@ -504,7 +504,7 @@ void pum_redraw(void)
if (s == NULL) {
s = p;
}
- w = ptr2cells(p);
+ w = ptr2cells((char *)p);
if ((*p == NUL) || (*p == TAB) || (totwidth + w > pum_width)) {
// Display the text that fits or comes before a Tab.
@@ -517,13 +517,13 @@ void pum_redraw(void)
*p = saved;
if (pum_rl) {
- char_u *rt = reverse_text(st);
- char_u *rt_start = rt;
+ char *rt = (char *)reverse_text(st);
+ char *rt_start = rt;
int size = vim_strsize(rt);
if (size > pum_width) {
do {
- size -= utf_ptr2cells((char *)rt);
+ size -= utf_ptr2cells(rt);
MB_PTR_ADV(rt);
} while (size > pum_width);
@@ -535,7 +535,7 @@ void pum_redraw(void)
size++;
}
}
- grid_puts_len(&pum_grid, rt, (int)STRLEN(rt), row,
+ grid_puts_len(&pum_grid, (char_u *)rt, (int)STRLEN(rt), row,
grid_col - size + 1, attr);
xfree(rt_start);
xfree(st);
diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c
index 868a68969c..22e72669ee 100644
--- a/src/nvim/quickfix.c
+++ b/src/nvim/quickfix.c
@@ -4343,7 +4343,7 @@ static char *make_get_fullcmd(const char *makecmd, const char *fname)
}
msg_start();
msg_puts(":!");
- msg_outtrans((char_u *)cmd); // show what we are doing
+ msg_outtrans(cmd); // show what we are doing
return cmd;
}
@@ -5100,7 +5100,7 @@ void ex_cfile(exarg_T *eap)
}
}
if (*eap->arg != NUL) {
- set_string_option_direct("ef", -1, (char_u *)eap->arg, OPT_FREE, 0);
+ set_string_option_direct("ef", -1, eap->arg, OPT_FREE, 0);
}
char *enc = (*curbuf->b_p_menc != NUL) ? (char *)curbuf->b_p_menc : (char *)p_menc;
@@ -5199,9 +5199,9 @@ static void vgr_display_fname(char *fname)
msg_start();
char *p = (char *)msg_strtrunc((char_u *)fname, true);
if (p == NULL) {
- msg_outtrans((char_u *)fname);
+ msg_outtrans(fname);
} else {
- msg_outtrans((char_u *)p);
+ msg_outtrans(p);
xfree(p);
}
msg_clr_eos();
@@ -5716,7 +5716,7 @@ static buf_T *load_dummy_buffer(char *fname, char *dirname_start, char *resultin
aucmd_prepbuf(&aco, newbuf);
// Need to set the filename for autocommands.
- (void)setfname(curbuf, (char_u *)fname, NULL, false);
+ (void)setfname(curbuf, fname, NULL, false);
// Create swap file now to avoid the ATTENTION message.
check_need_swap(true);
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 98f8e30391..ea75900ded 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -4718,7 +4718,7 @@ static int status_match_len(expand_T *xp, char_u *s)
while (*s != NUL) {
s += skip_status_match_char(xp, s);
- len += ptr2cells(s);
+ len += ptr2cells((char *)s);
MB_PTR_ADV(s);
}
@@ -4856,7 +4856,7 @@ void win_redr_status_matches(expand_T *xp, int num_matches, char_u **matches, in
} else {
for (; *s != NUL; ++s) {
s += skip_status_match_char(xp, s);
- clen += ptr2cells(s);
+ clen += ptr2cells((char *)s);
if ((l = utfc_ptr2len((char *)s)) > 1) {
STRNCPY(buf + len, s, l); // NOLINT(runtime/printf)
s += l - 1;
@@ -5034,7 +5034,7 @@ static void win_redr_status(win_T *wp)
grid_fill(&default_grid, row, row + 1, len + col,
this_ru_col + col, fillchar, fillchar, attr);
- if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL)
+ if (get_keymap_str(wp, "<%s>", (char *)NameBuff, MAXPATHL)
&& this_ru_col - len > (int)(STRLEN(NameBuff) + 1)) {
grid_puts(&default_grid, NameBuff, row,
(int)(this_ru_col - STRLEN(NameBuff) - 1), attr);
@@ -5079,7 +5079,7 @@ static void redraw_custom_statusline(win_T *wp)
// When there is an error disable the statusline, otherwise the
// display is messed up with errors and a redraw triggers the problem
// again and again.
- set_string_option_direct("statusline", -1, (char_u *)"",
+ set_string_option_direct("statusline", -1, "",
OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
}
@@ -5109,7 +5109,7 @@ static void win_redr_winbar(win_T *wp)
// When there is an error disable the winbar, otherwise the
// display is messed up with errors and a redraw triggers the problem
// again and again.
- set_string_option_direct("winbar", -1, (char_u *)"",
+ set_string_option_direct("winbar", -1, "",
OPT_FREE | (*wp->w_p_stl != NUL
? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
}
@@ -5218,9 +5218,9 @@ static bool vsep_connected(win_T *wp, WindowCorner corner)
/// @param fmt format string containing one %s item
/// @param buf buffer for the result
/// @param len length of buffer
-bool get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len)
+bool get_keymap_str(win_T *wp, char *fmt, char *buf, int len)
{
- char_u *p;
+ char *p;
if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP) {
return false;
@@ -5229,24 +5229,24 @@ bool get_keymap_str(win_T *wp, char_u *fmt, char_u *buf, int len)
{
buf_T *old_curbuf = curbuf;
win_T *old_curwin = curwin;
- char_u *s;
+ char *s;
curbuf = wp->w_buffer;
curwin = wp;
STRCPY(buf, "b:keymap_name"); // must be writable
emsg_skip++;
- s = p = (char_u *)eval_to_string((char *)buf, NULL, false);
+ s = p = eval_to_string(buf, NULL, false);
emsg_skip--;
curbuf = old_curbuf;
curwin = old_curwin;
if (p == NULL || *p == NUL) {
if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) {
- p = wp->w_buffer->b_p_keymap;
+ p = (char *)wp->w_buffer->b_p_keymap;
} else {
- p = (char_u *)"lang";
+ p = "lang";
}
}
- if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1) {
+ if (vim_snprintf(buf, len, fmt, p) > len - 1) {
buf[0] = NUL;
}
xfree(s);
@@ -5268,9 +5268,9 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
int n;
int len;
int fillchar;
- char_u buf[MAXPATHL];
+ char buf[MAXPATHL];
char_u *stl;
- char_u *p;
+ char *p;
stl_hlrec_t *hltab;
StlClickRecord *tabtab;
int use_sandbox = false;
@@ -5389,20 +5389,20 @@ static void win_redr_custom(win_T *wp, bool draw_winbar, bool draw_ruler)
* might change the option value and free the memory. */
stl = vim_strsave(stl);
width =
- build_stl_str_hl(ewp, (char *)buf, sizeof(buf), (char *)stl, use_sandbox,
+ build_stl_str_hl(ewp, buf, sizeof(buf), (char *)stl, use_sandbox,
fillchar, maxwidth, &hltab, &tabtab);
xfree(stl);
ewp->w_p_crb = p_crb_save;
// Make all characters printable.
- p = (char_u *)transstr((const char *)buf, true);
+ p = transstr(buf, true);
len = STRLCPY(buf, p, sizeof(buf));
len = (size_t)len < sizeof(buf) ? len : (int)sizeof(buf) - 1;
xfree(p);
// fill up with "fillchar"
while (width < maxwidth && len < (int)sizeof(buf) - 1) {
- len += utf_char2bytes(fillchar, (char *)buf + len);
+ len += utf_char2bytes(fillchar, buf + len);
width++;
}
buf[len] = NUL;
@@ -5416,8 +5416,8 @@ static 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, p, textlen, row, col, curattr);
- col += vim_strnsize(p, textlen);
+ grid_puts_len(grid, (char_u *)p, textlen, row, col, curattr);
+ col += vim_strnsize((char_u *)p, textlen);
p = hltab[n].start;
if (hltab[n].userhl == 0) {
@@ -5431,7 +5431,7 @@ static 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 *)"" : p, row, col,
+ grid_puts(grid, p >= buf + len ? (char_u *)"" : (char_u *)p, row, col,
curattr);
grid_puts_line_flush(false);
@@ -5453,11 +5453,11 @@ static 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(p, (int)(tabtab[n].start - (char *)p));
+ len += vim_strnsize((char_u *)p, (int)(tabtab[n].start - p));
while (col < len) {
click_defs[col++] = cur_click_def;
}
- p = (char_u *)tabtab[n].start;
+ p = (char *)tabtab[n].start;
cur_click_def = tabtab[n].def;
if ((wp != NULL) && !(cur_click_def.type == kStlClickDisabled
|| cur_click_def.type == kStlClickFuncRun)) {
@@ -5980,13 +5980,13 @@ int showmode(void)
length = (Rows - msg_row) * Columns - 3;
}
if (edit_submode_extra != NULL) {
- length -= vim_strsize(edit_submode_extra);
+ length -= vim_strsize((char *)edit_submode_extra);
}
if (length > 0) {
if (edit_submode_pre != NULL) {
- length -= vim_strsize(edit_submode_pre);
+ length -= vim_strsize((char *)edit_submode_pre);
}
- if (length - vim_strsize(edit_submode) > 0) {
+ if (length - vim_strsize((char *)edit_submode) > 0) {
if (edit_submode_pre != NULL) {
msg_puts_attr((const char *)edit_submode_pre, attr);
}
@@ -6028,8 +6028,8 @@ int showmode(void)
if (State & MODE_LANGMAP) {
if (curwin->w_p_arab) {
msg_puts_attr(_(" Arabic"), attr);
- } else if (get_keymap_str(curwin, (char_u *)" (%s)",
- NameBuff, MAXPATHL)) {
+ } else if (get_keymap_str(curwin, " (%s)",
+ (char *)NameBuff, MAXPATHL)) {
msg_puts_attr((char *)NameBuff, attr);
}
}
@@ -6211,8 +6211,7 @@ void draw_tabline(void)
did_emsg = false;
win_redr_custom(NULL, false, false);
if (did_emsg) {
- set_string_option_direct("tabline", -1,
- (char_u *)"", OPT_FREE, SID_ERROR);
+ set_string_option_direct("tabline", -1, "", OPT_FREE, SID_ERROR);
}
did_emsg |= saved_did_emsg;
} else {
@@ -6289,10 +6288,10 @@ void draw_tabline(void)
// Get buffer name in NameBuff[]
get_trans_bufname(cwp->w_buffer);
shorten_dir(NameBuff);
- len = vim_strsize(NameBuff);
+ len = vim_strsize((char *)NameBuff);
p = NameBuff;
while (len > room) {
- len -= ptr2cells(p);
+ len -= ptr2cells((char *)p);
MB_PTR_ADV(p);
}
if (len > Columns - col - 1) {
@@ -6395,7 +6394,7 @@ void get_trans_bufname(buf_T *buf)
if (buf_spname(buf) != NULL) {
STRLCPY(NameBuff, buf_spname(buf), MAXPATHL);
} else {
- home_replace(buf, (char_u *)buf->b_fname, NameBuff, MAXPATHL, true);
+ home_replace(buf, buf->b_fname, (char *)NameBuff, MAXPATHL, true);
}
trans_characters(NameBuff, MAXPATHL);
}
@@ -6521,8 +6520,7 @@ static void win_redr_ruler(win_T *wp, bool always)
called_emsg = false;
win_redr_custom(wp, false, true);
if (called_emsg) {
- set_string_option_direct("rulerformat", -1, (char_u *)"",
- OPT_FREE, SID_ERROR);
+ set_string_option_direct("rulerformat", -1, "", OPT_FREE, SID_ERROR);
}
called_emsg |= save_called_emsg;
return;
@@ -6588,17 +6586,17 @@ static void win_redr_ruler(win_T *wp, bool always)
}
#define RULER_BUF_LEN 70
- char_u buffer[RULER_BUF_LEN];
+ char buffer[RULER_BUF_LEN];
/*
* Some sprintfs return the length, some return a pointer.
* To avoid portability problems we use strlen() here.
*/
- vim_snprintf((char *)buffer, RULER_BUF_LEN, "%" PRId64 ",",
+ vim_snprintf(buffer, RULER_BUF_LEN, "%" PRId64 ",",
(wp->w_buffer->b_ml.ml_flags & ML_EMPTY) ? (int64_t)0L
: (int64_t)wp->w_cursor.lnum);
size_t len = STRLEN(buffer);
- col_print(buffer + len, RULER_BUF_LEN - len,
+ col_print((char_u *)buffer + len, RULER_BUF_LEN - len,
empty_line ? 0 : (int)wp->w_cursor.col + 1,
(int)virtcol + 1);
@@ -6625,7 +6623,7 @@ static void win_redr_ruler(win_T *wp, bool always)
if (this_ru_col + o < width) {
// Need at least 3 chars left for get_rel_pos() + NUL.
while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) {
- i += utf_char2bytes(fillchar, (char *)buffer + i);
+ i += utf_char2bytes(fillchar, buffer + i);
o++;
}
get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
@@ -6646,8 +6644,8 @@ static void win_redr_ruler(win_T *wp, bool always)
}
// Truncate at window boundary.
o = 0;
- for (i = 0; buffer[i] != NUL; i += utfc_ptr2len((char *)buffer + i)) {
- o += utf_ptr2cells((char *)buffer + i);
+ for (i = 0; buffer[i] != NUL; i += utfc_ptr2len(buffer + i)) {
+ o += utf_ptr2cells(buffer + i);
if (this_ru_col + o > width) {
buffer[i] = NUL;
break;
@@ -6655,7 +6653,7 @@ static void win_redr_ruler(win_T *wp, bool always)
}
ScreenGrid *grid = part_of_status ? &default_grid : &msg_grid_adj;
- grid_puts(grid, buffer, row, this_ru_col + off, attr);
+ grid_puts(grid, (char_u *)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);
diff --git a/src/nvim/search.c b/src/nvim/search.c
index 1e862f10ec..a5c18bd03a 100644
--- a/src/nvim/search.c
+++ b/src/nvim/search.c
@@ -910,8 +910,7 @@ int searchit(win_T *win, buf_T *buf, pos_T *pos, pos_T *end_pos, Direction dir,
lnum = 1;
}
if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG)) {
- give_warning((char_u *)_(dir == BACKWARD
- ? top_bot_msg : bot_top_msg), true);
+ give_warning(_(dir == BACKWARD ? top_bot_msg : bot_top_msg), true);
}
if (extra_arg != NULL) {
extra_arg->sa_wrapped = true;
@@ -1261,7 +1260,7 @@ int do_search(oparg_T *oap, int dirc, int search_delim, char_u *pat, long count,
memset(msgbuf + pat_len, ' ', r - msgbuf);
}
}
- msg_outtrans(msgbuf);
+ msg_outtrans((char *)msgbuf);
msg_clr_eos();
msg_check();
@@ -1452,7 +1451,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char_u *pat)
if (p_ws) {
pos->lnum = buf->b_ml.ml_line_count;
if (!shortmess(SHM_SEARCH)) {
- give_warning((char_u *)_(top_bot_msg), true);
+ give_warning(_(top_bot_msg), true);
}
} else {
pos->lnum = 1;
@@ -1462,7 +1461,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char_u *pat)
if (p_ws) {
pos->lnum = 1;
if (!shortmess(SHM_SEARCH)) {
- give_warning((char_u *)_(bot_top_msg), true);
+ give_warning(_(bot_top_msg), true);
}
} else {
pos->lnum = 1;
@@ -4515,7 +4514,7 @@ static void cmdline_search_stat(int dirc, pos_T *pos, pos_T *cursor_pos, bool sh
// keep the message even after redraw, but don't put in history
msg_hist_off = true;
msg_ext_set_kind("search_count");
- give_warning(msgbuf, false);
+ give_warning((char *)msgbuf, false);
msg_hist_off = false;
}
}
@@ -5414,8 +5413,8 @@ void find_pattern_in_path(char_u *ptr, Direction dir, size_t len, bool whole, bo
if (i == max_path_depth) {
break;
}
- if (path_full_compare(new_fname, files[i].name,
- true, true) & kEqualFiles) {
+ if (path_full_compare((char *)new_fname, (char *)files[i].name, true,
+ true) & kEqualFiles) {
if (type != CHECK_PATH
&& action == ACTION_SHOW_ALL && files[i].matched) {
msg_putchar('\n'); // cursor below last one */
diff --git a/src/nvim/shada.c b/src/nvim/shada.c
index 5410740d9e..32a0f3902d 100644
--- a/src/nvim/shada.c
+++ b/src/nvim/shada.c
@@ -3977,7 +3977,7 @@ static bool shada_removable(const char *name)
for (p = (char *)p_shada; *p;) {
(void)copy_option_part((char_u **)&p, (char_u *)part, ARRAY_SIZE(part), ", ");
if (part[0] == 'r') {
- home_replace(NULL, (char_u *)(part + 1), (char_u *)NameBuff, MAXPATHL, true);
+ home_replace(NULL, part + 1, (char *)NameBuff, MAXPATHL, true);
size_t n = STRLEN(NameBuff);
if (mb_strnicmp((char_u *)NameBuff, (char_u *)new_name, n) == 0) {
retval = true;
diff --git a/src/nvim/sign.c b/src/nvim/sign.c
index a5adc48540..24da650743 100644
--- a/src/nvim/sign.c
+++ b/src/nvim/sign.c
@@ -1624,12 +1624,12 @@ static void sign_list_defined(sign_T *sp)
smsg("sign %s", sp->sn_name);
if (sp->sn_icon != NULL) {
msg_puts(" icon=");
- msg_outtrans(sp->sn_icon);
+ msg_outtrans((char *)sp->sn_icon);
msg_puts(_(" (not supported)"));
}
if (sp->sn_text != NULL) {
msg_puts(" text=");
- msg_outtrans(sp->sn_text);
+ msg_outtrans((char *)sp->sn_text);
}
if (sp->sn_line_hl > 0) {
msg_puts(" linehl=");
diff --git a/src/nvim/spell.c b/src/nvim/spell.c
index 8ae846e074..e4805f3c4a 100644
--- a/src/nvim/spell.c
+++ b/src/nvim/spell.c
@@ -1576,7 +1576,7 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
lnum = wp->w_buffer->b_ml.ml_line_count;
wrapped = true;
if (!shortmess(SHM_SEARCH)) {
- give_warning((char_u *)_(top_bot_msg), true);
+ give_warning(_(top_bot_msg), true);
}
}
capcol = -1;
@@ -1591,7 +1591,7 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
lnum = 1;
wrapped = true;
if (!shortmess(SHM_SEARCH)) {
- give_warning((char_u *)_(bot_top_msg), true);
+ give_warning(_(bot_top_msg), true);
}
}
@@ -2115,7 +2115,7 @@ char *did_set_spelllang(win_T *wp)
// Check if we loaded this language before.
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
- if (path_full_compare(lang, slang->sl_fname, false, true)
+ if (path_full_compare((char *)lang, (char *)slang->sl_fname, false, true)
== kEqualFiles) {
break;
}
@@ -2164,7 +2164,7 @@ char *did_set_spelllang(win_T *wp)
// Loop over the languages, there can be several files for "lang".
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
if (filename
- ? path_full_compare(lang, slang->sl_fname, false, true) == kEqualFiles
+ ? path_full_compare((char *)lang, (char *)slang->sl_fname, false, true) == kEqualFiles
: STRICMP(lang, slang->sl_name) == 0) {
region_mask = REGION_ALL;
if (!filename && region != NULL) {
@@ -2222,7 +2222,7 @@ char *did_set_spelllang(win_T *wp)
for (c = 0; c < ga.ga_len; ++c) {
p = LANGP_ENTRY(ga, c)->lp_slang->sl_fname;
if (p != NULL
- && path_full_compare(spf_name, p, false, true) == kEqualFiles) {
+ && path_full_compare((char *)spf_name, (char *)p, false, true) == kEqualFiles) {
break;
}
}
@@ -2233,7 +2233,7 @@ char *did_set_spelllang(win_T *wp)
// Check if it was loaded already.
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
- if (path_full_compare(spf_name, slang->sl_fname, false, true)
+ if (path_full_compare((char *)spf_name, (char *)slang->sl_fname, false, true)
== kEqualFiles) {
break;
}
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 2b6bb098d1..07f3d39886 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -1826,7 +1826,7 @@ static void spell_reload_one(char_u *fname, bool added_word)
bool didit = false;
for (slang = first_lang; slang != NULL; slang = slang->sl_next) {
- if (path_full_compare(fname, slang->sl_fname, false, true) == kEqualFiles) {
+ if (path_full_compare((char *)fname, (char *)slang->sl_fname, false, true) == kEqualFiles) {
slang_clear(slang);
if (spell_load_file(fname, NULL, slang, false) == NULL) {
// reloading failed, clear the language
@@ -4903,7 +4903,7 @@ 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(wfname, slang->sl_fname, false, true)
+ if (path_full_compare((char *)wfname, (char *)slang->sl_fname, false, true)
== kEqualFiles) {
break;
}
@@ -5598,9 +5598,8 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
if (fseek(fd, fpos, SEEK_SET) == 0) {
fputc('#', fd);
if (undo) {
- home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);
- smsg(_("Word '%.*s' removed from %s"),
- len, word, NameBuff);
+ home_replace(NULL, (char *)fname, (char *)NameBuff, MAXPATHL, true);
+ smsg(_("Word '%.*s' removed from %s"), len, word, NameBuff);
}
}
if (fseek(fd, fpos_next, SEEK_SET) != 0) {
@@ -5648,7 +5647,7 @@ void spell_add_word(char_u *word, int len, SpellAddType what, int idx, bool undo
}
fclose(fd);
- home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);
+ home_replace(NULL, (char *)fname, (char *)NameBuff, MAXPATHL, true);
smsg(_("Word '%.*s' added to %s"), len, word, NameBuff);
}
}
diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c
index 0d43458b5b..9615423765 100644
--- a/src/nvim/syntax.c
+++ b/src/nvim/syntax.c
@@ -3171,9 +3171,9 @@ static void syn_cmd_iskeyword(exarg_T *eap, int syncing)
msg_puts("\n");
if (curwin->w_s->b_syn_isk != empty_option) {
msg_puts("syntax iskeyword ");
- msg_outtrans(curwin->w_s->b_syn_isk);
+ msg_outtrans((char *)curwin->w_s->b_syn_isk);
} else {
- msg_outtrans((char_u *)_("syntax iskeyword not set"));
+ msg_outtrans(_("syntax iskeyword not set"));
}
} else {
if (STRNICMP(arg, "clear", 5) == 0) {
@@ -3382,7 +3382,7 @@ static void syn_cmd_clear(exarg_T *eap, int syncing)
XFREE_CLEAR(SYN_CLSTR(curwin->w_s)[scl_id].scl_list);
}
} else {
- id = syn_name2id_len(arg, (int)(arg_end - arg));
+ id = syn_name2id_len((char *)arg, (int)(arg_end - arg));
if (id == 0) {
semsg(_(e_nogroup), arg);
break;
@@ -3553,7 +3553,7 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
syn_list_cluster(id - SYNID_CLUSTER);
}
} else {
- int id = syn_name2id_len(arg, (int)(arg_end - arg));
+ int id = syn_name2id_len((char *)arg, (int)(arg_end - arg));
if (id == 0) {
semsg(_(e_nogroup), arg);
} else {
@@ -3690,8 +3690,8 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
}
msg_putchar(' ');
if (spp->sp_sync_idx >= 0) {
- msg_outtrans(highlight_group_name(SYN_ITEMS(curwin->w_s)
- [spp->sp_sync_idx].sp_syn.id - 1));
+ msg_outtrans((char *)highlight_group_name(SYN_ITEMS(curwin->w_s)
+ [spp->sp_sync_idx].sp_syn.id - 1));
} else {
msg_puts("NONE");
}
@@ -3704,7 +3704,7 @@ static void syn_list_one(const int id, const bool syncing, const bool link_only)
(void)syn_list_header(did_header, 0, id, true);
msg_puts_attr("links to", attr);
msg_putchar(' ');
- msg_outtrans(highlight_group_name(highlight_link_id(id - 1) - 1));
+ msg_outtrans((char *)highlight_group_name(highlight_link_id(id - 1) - 1));
}
}
@@ -3729,7 +3729,7 @@ static void syn_list_cluster(int id)
// slight hack: roughly duplicate the guts of syn_list_header()
msg_putchar('\n');
- msg_outtrans(SYN_CLSTR(curwin->w_s)[id].scl_name);
+ msg_outtrans((char *)SYN_CLSTR(curwin->w_s)[id].scl_name);
if (msg_col >= endcol) { // output at least one space
endcol = msg_col + 1;
@@ -3766,9 +3766,9 @@ static void put_id_list(const char *const name, const int16_t *const list, const
int scl_id = *p - SYNID_CLUSTER;
msg_putchar('@');
- msg_outtrans(SYN_CLSTR(curwin->w_s)[scl_id].scl_name);
+ msg_outtrans((char *)SYN_CLSTR(curwin->w_s)[scl_id].scl_name);
} else {
- msg_outtrans(highlight_group_name(*p - 1));
+ msg_outtrans((char *)highlight_group_name(*p - 1));
}
if (p[1]) {
msg_putchar(',');
@@ -3788,9 +3788,9 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const
msg_puts_attr("matchgroup", attr);
msg_putchar('=');
if (last_matchgroup == 0) {
- msg_outtrans((char_u *)"NONE");
+ msg_outtrans("NONE");
} else {
- msg_outtrans(highlight_group_name(last_matchgroup - 1));
+ msg_outtrans((char *)highlight_group_name(last_matchgroup - 1));
}
msg_putchar(' ');
}
@@ -3807,7 +3807,7 @@ static void put_pattern(const char *const s, const int c, const synpat_T *const
}
}
msg_putchar(sepchars[i]);
- msg_outtrans(spp->sp_pattern);
+ msg_outtrans((char *)spp->sp_pattern);
msg_putchar(sepchars[i]);
// output any pattern options
@@ -3917,7 +3917,7 @@ static bool syn_list_keywords(const int id, const hashtab_T *const ht, bool did_
prev_skipempty = (kp->flags & HL_SKIPEMPTY);
}
}
- msg_outtrans(kp->keyword);
+ msg_outtrans((char *)kp->keyword);
}
}
}
@@ -6038,7 +6038,7 @@ static void syntime_report(void)
msg_puts(profile_msg(p->average));
msg_puts(" ");
msg_advance(50);
- msg_outtrans(highlight_group_name(p->id - 1));
+ msg_outtrans((char *)highlight_group_name(p->id - 1));
msg_puts(" ");
msg_advance(69);
diff --git a/src/nvim/tag.c b/src/nvim/tag.c
index b9f6494459..796a2fa5f3 100644
--- a/src/nvim/tag.c
+++ b/src/nvim/tag.c
@@ -624,7 +624,7 @@ bool do_tag(char_u *tag, int type, int count, int forceit, int verbose)
}
msg_scroll = true; // Don't overwrite this message.
} else {
- give_warning(IObuff, ic);
+ give_warning((char *)IObuff, ic);
}
if (ic && !msg_scrolled && msg_silent == 0) {
ui_flush();
@@ -784,7 +784,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_
// print all other extra fields
attr = HL_ATTR(HLF_CM);
while (*p && *p != '\r' && *p != '\n') {
- if (msg_col + ptr2cells(p) >= Columns) {
+ if (msg_col + ptr2cells((char *)p) >= Columns) {
msg_putchar('\n');
if (got_int) {
break;
@@ -830,7 +830,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char_
}
while (p != command_end) {
- if (msg_col + (*p == TAB ? 1 : ptr2cells(p)) > Columns) {
+ if (msg_col + (*p == TAB ? 1 : ptr2cells((char *)p)) > Columns) {
msg_putchar('\n');
}
if (got_int) {
@@ -1050,7 +1050,7 @@ void do_tags(exarg_T *eap)
tagstack[i].cur_match + 1,
tagstack[i].tagname,
tagstack[i].fmark.mark.lnum);
- msg_outtrans(IObuff);
+ msg_outtrans((char *)IObuff);
msg_outtrans_attr(name, tagstack[i].fmark.fnum == curbuf->b_fnum
? HL_ATTR(HLF_D) : 0);
xfree(name);
@@ -3032,8 +3032,7 @@ static int test_for_current(char_u *fname, char_u *fname_end, char_u *tag_fname,
*fname_end = NUL;
}
fullname = expand_tag_fname(fname, tag_fname, true);
- retval = (path_full_compare(fullname, buf_ffname, true, true)
- & kEqualFiles);
+ retval = (path_full_compare((char *)fullname, (char *)buf_ffname, true, true) & kEqualFiles);
xfree(fullname);
*fname_end = (char_u)c;
}
diff --git a/src/nvim/undo.c b/src/nvim/undo.c
index 684a9cf99e..078cb6a210 100644
--- a/src/nvim/undo.c
+++ b/src/nvim/undo.c
@@ -1468,8 +1468,7 @@ void u_read_undo(char *name, const char_u *hash, const char_u *orig_name FUNC_AT
if (name == NULL) {
verbose_enter();
}
- give_warning((char_u *)
- _("File contents changed, cannot use undo info"), true);
+ give_warning(_("File contents changed, cannot use undo info"), true);
if (name == NULL) {
verbose_leave();
}
diff --git a/src/nvim/version.c b/src/nvim/version.c
index 1c8fdce1eb..a70778fdd9 100644
--- a/src/nvim/version.c
+++ b/src/nvim/version.c
@@ -2020,7 +2020,7 @@ void ex_version(exarg_T *eap)
/// @param wrap
static void version_msg_wrap(char *s, int wrap)
{
- int len = vim_strsize((char_u *)s) + (wrap ? 2 : 0);
+ int len = vim_strsize(s) + (wrap ? 2 : 0);
if (!got_int
&& (len < Columns)
@@ -2071,7 +2071,7 @@ void list_in_columns(char_u **items, int size, int current)
// Find the length of the longest item, use that + 1 as the column width.
int i;
for (i = 0; size < 0 ? items[i] != NULL : i < size; i++) {
- int l = vim_strsize(items[i]) + (i == current ? 2 : 0);
+ int l = vim_strsize((char *)items[i]) + (i == current ? 2 : 0);
if (l > width) {
width = l;
@@ -2294,7 +2294,7 @@ static void do_intro_line(long row, char_u *mesg, int attr)
int clen;
// Center the message horizontally.
- col = vim_strsize(mesg);
+ col = vim_strsize((char *)mesg);
col = (Columns - col) / 2;
@@ -2309,7 +2309,7 @@ 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(p + l);
+ clen += ptr2cells((char *)p + l);
l += utfc_ptr2len((char *)p + l) - 1;
}
assert(row <= INT_MAX && col <= INT_MAX);