mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #18489 from dundargoc/refactor/remove-char_u
refactor: replace char_u variables and functions with char
This commit is contained in:
commit
af9c1e572d
@ -1521,11 +1521,10 @@ bool apply_autocmds(event_T event, char_u *fname, char_u *fname_io, bool force,
|
||||
/// @param exarg Ex command arguments
|
||||
///
|
||||
/// @return true if some commands were executed.
|
||||
bool apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, bool force, buf_T *buf,
|
||||
bool apply_autocmds_exarg(event_T event, char *fname, char *fname_io, bool force, buf_T *buf,
|
||||
exarg_T *eap)
|
||||
{
|
||||
return apply_autocmds_group(event, (char *)fname, (char *)fname_io, force, AUGROUP_ALL, buf,
|
||||
eap);
|
||||
return apply_autocmds_group(event, fname, fname_io, force, AUGROUP_ALL, buf, eap);
|
||||
}
|
||||
|
||||
/// Like apply_autocmds(), but handles the caller's retval. If the script
|
||||
@ -1541,14 +1540,14 @@ bool apply_autocmds_exarg(event_T event, char_u *fname, char_u *fname_io, bool f
|
||||
/// @param[in,out] retval caller's retval
|
||||
///
|
||||
/// @return true if some autocommands were executed
|
||||
bool apply_autocmds_retval(event_T event, char_u *fname, char_u *fname_io, bool force, buf_T *buf,
|
||||
bool apply_autocmds_retval(event_T event, char *fname, char *fname_io, bool force, buf_T *buf,
|
||||
int *retval)
|
||||
{
|
||||
if (should_abort(*retval)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool did_cmd = apply_autocmds_group(event, (char *)fname, (char *)fname_io, force,
|
||||
bool did_cmd = apply_autocmds_group(event, fname, fname_io, force,
|
||||
AUGROUP_ALL, buf, NULL);
|
||||
if (did_cmd && aborting()) {
|
||||
*retval = FAIL;
|
||||
@ -1659,9 +1658,9 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
||||
}
|
||||
|
||||
// Save the autocmd_* variables and info about the current buffer.
|
||||
char *save_autocmd_fname = (char *)autocmd_fname;
|
||||
char *save_autocmd_fname = autocmd_fname;
|
||||
int save_autocmd_bufnr = autocmd_bufnr;
|
||||
char *save_autocmd_match = (char *)autocmd_match;
|
||||
char *save_autocmd_match = autocmd_match;
|
||||
int save_autocmd_busy = autocmd_busy;
|
||||
int save_autocmd_nested = autocmd_nested;
|
||||
bool save_changed = curbuf->b_changed;
|
||||
@ -1675,18 +1674,18 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
||||
|| event == EVENT_OPTIONSET || event == EVENT_MODECHANGED) {
|
||||
autocmd_fname = NULL;
|
||||
} else if (fname != NULL && !ends_excmd(*fname)) {
|
||||
autocmd_fname = (char_u *)fname;
|
||||
autocmd_fname = fname;
|
||||
} else if (buf != NULL) {
|
||||
autocmd_fname = buf->b_ffname;
|
||||
autocmd_fname = (char *)buf->b_ffname;
|
||||
} else {
|
||||
autocmd_fname = NULL;
|
||||
}
|
||||
} else {
|
||||
autocmd_fname = (char_u *)fname_io;
|
||||
autocmd_fname = fname_io;
|
||||
}
|
||||
if (autocmd_fname != NULL) {
|
||||
// Allocate MAXPATHL for when eval_vars() resolves the fullpath.
|
||||
autocmd_fname = vim_strnsave(autocmd_fname, MAXPATHL);
|
||||
autocmd_fname = xstrnsave(autocmd_fname, MAXPATHL);
|
||||
}
|
||||
|
||||
// Set the buffer number to be used for <abuf>.
|
||||
@ -1754,11 +1753,11 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
||||
#endif
|
||||
|
||||
// Set the name to be used for <amatch>.
|
||||
autocmd_match = (char_u *)fname;
|
||||
autocmd_match = fname;
|
||||
|
||||
// Don't redraw while doing autocommands.
|
||||
RedrawingDisabled++;
|
||||
char *save_sourcing_name = (char *)sourcing_name;
|
||||
char *save_sourcing_name = sourcing_name;
|
||||
sourcing_name = NULL; // don't free this one
|
||||
linenr_T save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_lnum = 0; // no line number here
|
||||
@ -1793,7 +1792,7 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
||||
did_filetype = true;
|
||||
}
|
||||
|
||||
char *tail = (char *)path_tail((char_u *)fname);
|
||||
char *tail = path_tail(fname);
|
||||
|
||||
// Find first autocommand that matches
|
||||
AutoPatCmd patcmd;
|
||||
@ -1860,12 +1859,12 @@ bool apply_autocmds_group(event_T event, char *fname, char *fname_io, bool force
|
||||
filechangeshell_busy = false;
|
||||
autocmd_nested = save_autocmd_nested;
|
||||
xfree(sourcing_name);
|
||||
sourcing_name = (char_u *)save_sourcing_name;
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
xfree(autocmd_fname);
|
||||
autocmd_fname = (char_u *)save_autocmd_fname;
|
||||
autocmd_fname = save_autocmd_fname;
|
||||
autocmd_bufnr = save_autocmd_bufnr;
|
||||
autocmd_match = (char_u *)save_autocmd_match;
|
||||
autocmd_match = save_autocmd_match;
|
||||
current_sctx = save_current_sctx;
|
||||
restore_funccal();
|
||||
if (do_profiling == PROF_YES) {
|
||||
@ -1933,7 +1932,7 @@ void block_autocmds(void)
|
||||
{
|
||||
// Remember the value of v:termresponse.
|
||||
if (!is_autocmd_blocked()) {
|
||||
old_termresponse = (char *)get_vim_var_str(VV_TERMRESPONSE);
|
||||
old_termresponse = get_vim_var_str(VV_TERMRESPONSE);
|
||||
}
|
||||
autocmd_blocked++;
|
||||
}
|
||||
@ -1946,7 +1945,7 @@ void unblock_autocmds(void)
|
||||
// the autocommands now. Esp. useful when executing a shell command
|
||||
// during startup (nvim -d).
|
||||
if (!is_autocmd_blocked()
|
||||
&& get_vim_var_str(VV_TERMRESPONSE) != (char_u *)old_termresponse) {
|
||||
&& get_vim_var_str(VV_TERMRESPONSE) != old_termresponse) {
|
||||
apply_autocmds(EVENT_TERMRESPONSE, NULL, NULL, false, curbuf);
|
||||
}
|
||||
}
|
||||
@ -1979,9 +1978,9 @@ void auto_next_pat(AutoPatCmd *apc, int stop_at_last)
|
||||
if (ap->buflocal_nr == 0
|
||||
? match_file_pat(NULL,
|
||||
&ap->reg_prog,
|
||||
(char_u *)apc->fname,
|
||||
(char_u *)apc->sfname,
|
||||
(char_u *)apc->tail,
|
||||
apc->fname,
|
||||
apc->sfname,
|
||||
apc->tail,
|
||||
ap->allow_dirs)
|
||||
: ap->buflocal_nr == apc->arg_bufnr) {
|
||||
const char *const name = event_nr2name(apc->event);
|
||||
@ -1991,7 +1990,7 @@ void auto_next_pat(AutoPatCmd *apc, int stop_at_last)
|
||||
= (STRLEN(s) + strlen(name) + (size_t)ap->patlen + 1);
|
||||
|
||||
sourcing_name = xmalloc(sourcing_name_len);
|
||||
snprintf((char *)sourcing_name, sourcing_name_len, s, name, ap->pat);
|
||||
snprintf(sourcing_name, sourcing_name_len, s, name, ap->pat);
|
||||
if (p_verbose >= 8) {
|
||||
verbose_enter();
|
||||
smsg(_("Executing %s"), sourcing_name);
|
||||
@ -2064,7 +2063,7 @@ static bool call_autocmd_callback(const AutoCmd *ac, const AutoPatCmd *apc)
|
||||
/// Get next autocommand command.
|
||||
/// Called by do_cmdline() to get the next line for ":if".
|
||||
/// @return allocated string, or NULL for end of autocommands.
|
||||
char_u *getnextac(int c, void *cookie, int indent, bool do_concat)
|
||||
char *getnextac(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
// These arguments are required for do_cmdline.
|
||||
(void)c;
|
||||
@ -2155,7 +2154,7 @@ char_u *getnextac(int c, void *cookie, int indent, bool do_concat)
|
||||
acp->nextcmd = ac->next;
|
||||
}
|
||||
|
||||
return (char_u *)retval;
|
||||
return retval;
|
||||
}
|
||||
|
||||
/// Return true if there is a matching autocommand for "fname".
|
||||
@ -2165,12 +2164,13 @@ char_u *getnextac(int c, void *cookie, int indent, bool do_concat)
|
||||
/// @param event event that occurred.
|
||||
/// @param sfname filename the event occurred in.
|
||||
/// @param buf buffer the file is open in
|
||||
bool has_autocmd(event_T event, char_u *sfname, buf_T *buf) FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
bool has_autocmd(event_T event, char *sfname, buf_T *buf)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
char *tail = (char *)path_tail(sfname);
|
||||
char *tail = path_tail(sfname);
|
||||
bool retval = false;
|
||||
|
||||
char *fname = FullName_save((char *)sfname, false);
|
||||
char *fname = FullName_save(sfname, false);
|
||||
if (fname == NULL) {
|
||||
return false;
|
||||
}
|
||||
@ -2188,9 +2188,9 @@ bool has_autocmd(event_T event, char_u *sfname, buf_T *buf) FUNC_ATTR_WARN_UNUSE
|
||||
&& (ap->buflocal_nr == 0
|
||||
? match_file_pat(NULL,
|
||||
&ap->reg_prog,
|
||||
(char_u *)fname,
|
||||
fname,
|
||||
sfname,
|
||||
(char_u *)tail,
|
||||
tail,
|
||||
ap->allow_dirs)
|
||||
: buf != NULL && ap->buflocal_nr == buf->b_fnum)) {
|
||||
retval = true;
|
||||
@ -2208,12 +2208,12 @@ bool has_autocmd(event_T event, char_u *sfname, buf_T *buf) FUNC_ATTR_WARN_UNUSE
|
||||
|
||||
// Function given to ExpandGeneric() to obtain the list of autocommand group
|
||||
// names.
|
||||
char_u *expand_get_augroup_name(expand_T *xp, int idx)
|
||||
char *expand_get_augroup_name(expand_T *xp, int idx)
|
||||
{
|
||||
// Required for ExpandGeneric
|
||||
(void)xp;
|
||||
|
||||
return (char_u *)augroup_name(idx + 1);
|
||||
return augroup_name(idx + 1);
|
||||
}
|
||||
|
||||
/// @param doautocmd true for :doauto*, false for :autocmd
|
||||
@ -2263,7 +2263,7 @@ char *set_context_in_autocmd(expand_T *xp, char *arg, int doautocmd)
|
||||
}
|
||||
|
||||
// Function given to ExpandGeneric() to obtain the list of event names.
|
||||
char_u *expand_get_event_name(expand_T *xp, int idx)
|
||||
char *expand_get_event_name(expand_T *xp, int idx)
|
||||
{
|
||||
// xp is a required parameter to be used with ExpandGeneric
|
||||
(void)xp;
|
||||
@ -2273,14 +2273,14 @@ char_u *expand_get_event_name(expand_T *xp, int idx)
|
||||
if (name != NULL) {
|
||||
// skip when not including groups or skip deleted entries
|
||||
if (!autocmd_include_groups || name == get_deleted_augroup()) {
|
||||
return (char_u *)"";
|
||||
return "";
|
||||
}
|
||||
|
||||
return (char_u *)name;
|
||||
return name;
|
||||
}
|
||||
|
||||
// List event names
|
||||
return (char_u *)event_names[idx - next_augroup_id].name;
|
||||
return event_names[idx - next_augroup_id].name;
|
||||
}
|
||||
|
||||
/// Check whether given autocommand is supported
|
||||
@ -2373,7 +2373,7 @@ bool au_exists(const char *const arg) FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
&& (group == AUGROUP_ALL || ap->group == group)
|
||||
&& (pattern == NULL
|
||||
|| (buflocal_buf == NULL
|
||||
? FNAMECMP(ap->pat, (char_u *)pattern) == 0
|
||||
? FNAMECMP(ap->pat, pattern) == 0
|
||||
: ap->buflocal_nr == buflocal_buf->b_fnum))) {
|
||||
retval = true;
|
||||
break;
|
||||
@ -2410,7 +2410,7 @@ int aupat_get_buflocal_nr(char *pat, int patlen)
|
||||
}
|
||||
|
||||
// "<buffer=123>"
|
||||
if (skipdigits((char_u *)pat + 8) == (char_u *)pat + patlen - 1) {
|
||||
if (skipdigits(pat + 8) == pat + patlen - 1) {
|
||||
return atoi(pat + 8);
|
||||
}
|
||||
}
|
||||
@ -2434,10 +2434,10 @@ void aupat_normalize_buflocal_pat(char *dest, char *pat, int patlen, int bufloca
|
||||
buflocal_nr);
|
||||
}
|
||||
|
||||
int autocmd_delete_event(int group, event_T event, char_u *pat)
|
||||
int autocmd_delete_event(int group, event_T event, char *pat)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
return do_autocmd_event(event, (char *)pat, false, false, "", true, group);
|
||||
return do_autocmd_event(event, pat, false, false, "", true, group);
|
||||
}
|
||||
|
||||
/// Deletes an autocmd by ID.
|
||||
|
@ -111,8 +111,8 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags)
|
||||
// the end. This makes it possible to retry when 'fileformat' or
|
||||
// 'fileencoding' was guessed wrong.
|
||||
line_count = curbuf->b_ml.ml_line_count;
|
||||
retval = readfile(read_stdin ? NULL : curbuf->b_ffname,
|
||||
read_stdin ? NULL : curbuf->b_fname,
|
||||
retval = readfile(read_stdin ? NULL : (char *)curbuf->b_ffname,
|
||||
read_stdin ? NULL : (char *)curbuf->b_fname,
|
||||
line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap,
|
||||
flags | READ_BUFFER, silent);
|
||||
if (retval == OK) {
|
||||
@ -229,7 +229,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags)
|
||||
}
|
||||
#endif
|
||||
|
||||
retval = readfile(curbuf->b_ffname, curbuf->b_fname,
|
||||
retval = readfile((char *)curbuf->b_ffname, (char *)curbuf->b_fname,
|
||||
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap,
|
||||
flags | READ_NEW | (read_fifo ? READ_FIFO : 0), silent);
|
||||
#ifdef UNIX
|
||||
@ -3175,7 +3175,7 @@ void maketitle(void)
|
||||
SPACE_FOR_FNAME + 1);
|
||||
buf_p += MIN(size, SPACE_FOR_FNAME);
|
||||
} else {
|
||||
buf_p += transstr_buf((const char *)path_tail(curbuf->b_fname),
|
||||
buf_p += transstr_buf((const char *)path_tail((char *)curbuf->b_fname),
|
||||
buf_p, SPACE_FOR_FNAME + 1, true);
|
||||
}
|
||||
|
||||
@ -3285,7 +3285,7 @@ void maketitle(void)
|
||||
if (buf_spname(curbuf) != NULL) {
|
||||
buf_p = buf_spname(curbuf);
|
||||
} else { // use file name only in icon
|
||||
buf_p = path_tail(curbuf->b_ffname);
|
||||
buf_p = (char_u *)path_tail((char *)curbuf->b_ffname);
|
||||
}
|
||||
*icon_str = NUL;
|
||||
// Truncate name at 100 bytes.
|
||||
@ -3841,7 +3841,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
|
||||
if (opt != STL_FILENAME) {
|
||||
str = (char *)NameBuff;
|
||||
} else {
|
||||
str = (char *)path_tail(NameBuff);
|
||||
str = path_tail((char *)NameBuff);
|
||||
}
|
||||
break;
|
||||
case STL_VIM_EXPR: // '{'
|
||||
@ -3909,7 +3909,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, int use_san
|
||||
// Check if the evaluated result is a number.
|
||||
// If so, convert the number to an int and free the string.
|
||||
if (str != NULL && *str != 0) {
|
||||
if (*skipdigits((char_u *)str) == NUL) {
|
||||
if (*skipdigits(str) == NUL) {
|
||||
num = atoi(str);
|
||||
XFREE_CLEAR(str);
|
||||
itemisflag = false;
|
||||
@ -5201,9 +5201,9 @@ static int chk_modeline(linenr_T lnum, int flags)
|
||||
s = linecopy = vim_strsave(s); // copy the line, it will change
|
||||
|
||||
save_sourcing_lnum = sourcing_lnum;
|
||||
save_sourcing_name = sourcing_name;
|
||||
save_sourcing_name = (char_u *)sourcing_name;
|
||||
sourcing_lnum = lnum; // prepare for emsg()
|
||||
sourcing_name = (char_u *)"modelines";
|
||||
sourcing_name = "modelines";
|
||||
|
||||
end = false;
|
||||
while (end == false) {
|
||||
@ -5259,7 +5259,7 @@ static int chk_modeline(linenr_T lnum, int flags)
|
||||
}
|
||||
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_name = (char *)save_sourcing_name;
|
||||
|
||||
xfree(linecopy);
|
||||
|
||||
@ -5594,7 +5594,7 @@ bool buf_contents_changed(buf_T *buf)
|
||||
aucmd_prepbuf(&aco, newbuf);
|
||||
|
||||
if (ml_open(curbuf) == OK
|
||||
&& readfile(buf->b_ffname, buf->b_fname,
|
||||
&& readfile((char *)buf->b_ffname, (char *)buf->b_fname,
|
||||
(linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM,
|
||||
&ea, READ_NEW | READ_DUMMY, false) == OK) {
|
||||
// compare the two files line by line
|
||||
|
@ -557,7 +557,7 @@ void ins_char(int c)
|
||||
if (buf[0] == 0) {
|
||||
buf[0] = '\n';
|
||||
}
|
||||
ins_char_bytes(buf, n);
|
||||
ins_char_bytes((char_u *)buf, n);
|
||||
}
|
||||
|
||||
void ins_char_bytes(char_u *buf, size_t charlen)
|
||||
|
@ -1187,16 +1187,16 @@ intptr_t getwhitecols(const char_u *p)
|
||||
/// @param[in] q String to skip digits in.
|
||||
///
|
||||
/// @return Pointer to the character after the skipped digits.
|
||||
char_u *skipdigits(const char_u *q)
|
||||
char *skipdigits(const char *q)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
const char_u *p = q;
|
||||
const char *p = q;
|
||||
while (ascii_isdigit(*p)) {
|
||||
// skip to next non-digit
|
||||
p++;
|
||||
}
|
||||
return (char_u *)p;
|
||||
return (char *)p;
|
||||
}
|
||||
|
||||
/// skip over binary digits
|
||||
|
@ -129,8 +129,8 @@ bool ctx_restore(Context *ctx, const int flags)
|
||||
free_ctx = true;
|
||||
}
|
||||
|
||||
char_u *op_shada;
|
||||
get_option_value("shada", NULL, (char **)&op_shada, OPT_GLOBAL);
|
||||
char *op_shada;
|
||||
get_option_value("shada", NULL, &op_shada, OPT_GLOBAL);
|
||||
set_option_value("shada", 0L, "!,'100,%", OPT_GLOBAL);
|
||||
|
||||
if (flags & kCtxRegs) {
|
||||
@ -157,7 +157,7 @@ bool ctx_restore(Context *ctx, const int flags)
|
||||
ctx_free(ctx);
|
||||
}
|
||||
|
||||
set_option_value("shada", 0L, (char *)op_shada, OPT_GLOBAL);
|
||||
set_option_value("shada", 0L, op_shada, OPT_GLOBAL);
|
||||
xfree(op_shada);
|
||||
|
||||
return true;
|
||||
|
@ -60,7 +60,7 @@ void do_debug(char_u *cmd)
|
||||
int save_ignore_script = 0;
|
||||
int n;
|
||||
char_u *cmdline = NULL;
|
||||
char_u *p;
|
||||
char *p;
|
||||
char *tail = NULL;
|
||||
static int last_cmd = 0;
|
||||
#define CMD_CONT 1
|
||||
@ -141,7 +141,7 @@ void do_debug(char_u *cmd)
|
||||
// If this is a debug command, set "last_cmd".
|
||||
// If not, reset "last_cmd".
|
||||
// For a blank line use previous command.
|
||||
p = (char_u *)skipwhite((char *)cmdline);
|
||||
p = skipwhite((char *)cmdline);
|
||||
if (*p != NUL) {
|
||||
switch (*p) {
|
||||
case 'c':
|
||||
@ -200,7 +200,7 @@ void do_debug(char_u *cmd)
|
||||
if (last_cmd != 0) {
|
||||
// Check that the tail matches.
|
||||
p++;
|
||||
while (*p != NUL && *p == (char_u)(*tail)) {
|
||||
while (*p != NUL && *p == *tail) {
|
||||
p++;
|
||||
tail++;
|
||||
}
|
||||
@ -242,8 +242,8 @@ void do_debug(char_u *cmd)
|
||||
if (*p == NUL) {
|
||||
do_showbacktrace(cmd);
|
||||
} else {
|
||||
p = (char_u *)skipwhite((char *)p);
|
||||
do_setdebugtracelevel(p);
|
||||
p = skipwhite(p);
|
||||
do_setdebugtracelevel((char_u *)p);
|
||||
}
|
||||
continue;
|
||||
case CMD_UP:
|
||||
|
@ -744,7 +744,7 @@ static int diff_write_buffer(buf_T *buf, diffin_T *din)
|
||||
for (char_u *s = ml_get_buf(buf, lnum, false); *s != NUL;) {
|
||||
if (diff_flags & DIFF_ICASE) {
|
||||
int c;
|
||||
char_u cbuf[MB_MAXBYTES + 1];
|
||||
char cbuf[MB_MAXBYTES + 1];
|
||||
|
||||
if (*s == NL) {
|
||||
c = NUL;
|
||||
@ -794,7 +794,7 @@ static int diff_write(buf_T *buf, diffin_T *din)
|
||||
// Writing the buffer is an implementation detail of performing the diff,
|
||||
// so it shouldn't update the '[ and '] marks.
|
||||
cmdmod.lockmarks = true;
|
||||
int r = buf_write(buf, din->din_fname, NULL,
|
||||
int r = buf_write(buf, (char *)din->din_fname, NULL,
|
||||
(linenr_T)1, buf->b_ml.ml_line_count,
|
||||
NULL, false, false, false, true);
|
||||
cmdmod.lockmarks = save_lockmarks;
|
||||
@ -1178,7 +1178,7 @@ void ex_diffpatch(exarg_T *eap)
|
||||
}
|
||||
|
||||
// Write the current buffer to "tmp_orig".
|
||||
if (buf_write(curbuf, tmp_orig, NULL,
|
||||
if (buf_write(curbuf, (char *)tmp_orig, NULL,
|
||||
(linenr_T)1, curbuf->b_ml.ml_line_count,
|
||||
NULL, false, false, false, true) == FAIL) {
|
||||
goto theend;
|
||||
@ -1982,8 +1982,8 @@ static int diff_cmp(char_u *s1, char_u *s2)
|
||||
return mb_stricmp((const char *)s1, (const char *)s2);
|
||||
}
|
||||
|
||||
char_u *p1 = s1;
|
||||
char_u *p2 = s2;
|
||||
char *p1 = (char *)s1;
|
||||
char *p2 = (char *)s2;
|
||||
|
||||
// Ignore white space changes and possibly ignore case.
|
||||
while (*p1 != NUL && *p2 != NUL) {
|
||||
@ -1991,11 +1991,11 @@ static int diff_cmp(char_u *s1, char_u *s2)
|
||||
&& ascii_iswhite(*p1) && ascii_iswhite(*p2))
|
||||
|| ((diff_flags & DIFF_IWHITEALL)
|
||||
&& (ascii_iswhite(*p1) || ascii_iswhite(*p2)))) {
|
||||
p1 = (char_u *)skipwhite((char *)p1);
|
||||
p2 = (char_u *)skipwhite((char *)p2);
|
||||
p1 = skipwhite(p1);
|
||||
p2 = skipwhite(p2);
|
||||
} else {
|
||||
int l;
|
||||
if (!diff_equal_char(p1, p2, &l)) {
|
||||
if (!diff_equal_char((char_u *)p1, (char_u *)p2, &l)) {
|
||||
break;
|
||||
}
|
||||
p1 += l;
|
||||
@ -2004,8 +2004,8 @@ static int diff_cmp(char_u *s1, char_u *s2)
|
||||
}
|
||||
|
||||
// Ignore trailing white space.
|
||||
p1 = (char_u *)skipwhite((char *)p1);
|
||||
p2 = (char_u *)skipwhite((char *)p2);
|
||||
p1 = skipwhite(p1);
|
||||
p2 = skipwhite(p2);
|
||||
|
||||
if ((*p1 != NUL) || (*p2 != NUL)) {
|
||||
return 1;
|
||||
|
@ -2087,7 +2087,7 @@ void ex_loadkeymap(exarg_T *eap)
|
||||
|
||||
// Get each line of the sourced file, break at the end.
|
||||
for (;;) {
|
||||
char_u *line = eap->getline(0, eap->cookie, 0, true);
|
||||
char *line = eap->getline(0, eap->cookie, 0, true);
|
||||
|
||||
if (line == NULL) {
|
||||
break;
|
||||
|
@ -1325,14 +1325,14 @@ normalchar:
|
||||
|
||||
if (!p_paste) {
|
||||
// Trigger InsertCharPre.
|
||||
char_u *str = do_insert_char_pre(s->c);
|
||||
char_u *p;
|
||||
char *str = (char *)do_insert_char_pre(s->c);
|
||||
char *p;
|
||||
|
||||
if (str != NULL) {
|
||||
if (*str != NUL && stop_arrow() != FAIL) {
|
||||
// Insert the new value of v:char literally.
|
||||
for (p = str; *p != NUL; MB_PTR_ADV(p)) {
|
||||
s->c = utf_ptr2char((char *)p);
|
||||
s->c = utf_ptr2char(p);
|
||||
if (s->c == CAR || s->c == K_KENTER || s->c == NL) {
|
||||
ins_eol(s->c);
|
||||
} else {
|
||||
@ -3505,11 +3505,11 @@ static void ins_compl_addleader(int c)
|
||||
return;
|
||||
}
|
||||
if ((cc = utf_char2len(c)) > 1) {
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
|
||||
utf_char2bytes(c, (char *)buf);
|
||||
buf[cc] = NUL;
|
||||
ins_char_bytes(buf, (size_t)cc);
|
||||
ins_char_bytes((char_u *)buf, (size_t)cc);
|
||||
} else {
|
||||
ins_char(c);
|
||||
}
|
||||
@ -5939,11 +5939,11 @@ void insertchar(int c, int flags, int second_indent)
|
||||
int cc;
|
||||
|
||||
if ((cc = utf_char2len(c)) > 1) {
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
|
||||
utf_char2bytes(c, (char *)buf);
|
||||
buf[cc] = NUL;
|
||||
ins_char_bytes(buf, (size_t)cc);
|
||||
ins_char_bytes((char_u *)buf, (size_t)cc);
|
||||
AppendCharToRedobuff(c);
|
||||
} else {
|
||||
ins_char(c);
|
||||
@ -6840,7 +6840,7 @@ char_u *add_char2buf(int c, char_u *s)
|
||||
char_u temp[MB_MAXBYTES + 1];
|
||||
const int len = utf_char2bytes(c, (char *)temp);
|
||||
for (int i = 0; i < len; i++) {
|
||||
c = temp[i];
|
||||
c = (uint8_t)temp[i];
|
||||
// Need to escape K_SPECIAL like in the typeahead buffer.
|
||||
if (c == K_SPECIAL) {
|
||||
*s++ = K_SPECIAL;
|
||||
@ -9460,7 +9460,7 @@ static char_u *do_insert_char_pre(int c)
|
||||
// character. Only use it when changed, otherwise continue with the
|
||||
// original character to avoid breaking autoindent.
|
||||
if (STRCMP(buf, get_vim_var_str(VV_CHAR)) != 0) {
|
||||
res = vim_strsave(get_vim_var_str(VV_CHAR));
|
||||
res = vim_strsave((char_u *)get_vim_var_str(VV_CHAR));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1327,7 +1327,7 @@ static list_T *heredoc_get(exarg_T *eap, char *cmd)
|
||||
int mi = 0;
|
||||
int ti = 0;
|
||||
|
||||
char *theline = (char *)eap->getline(NUL, eap->cookie, 0, false);
|
||||
char *theline = eap->getline(NUL, eap->cookie, 0, false);
|
||||
if (theline == NULL) {
|
||||
semsg(_("E990: Missing end marker '%s'"), marker);
|
||||
break;
|
||||
@ -3170,7 +3170,7 @@ char *cat_prefix_varname(int prefix, const char *name)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of user defined
|
||||
/// (global/buffer/window/built-in) variable names.
|
||||
char_u *get_user_var_name(expand_T *xp, int idx)
|
||||
char *get_user_var_name(expand_T *xp, int idx)
|
||||
{
|
||||
static size_t gdone;
|
||||
static size_t bdone;
|
||||
@ -3195,9 +3195,9 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
||||
++hi;
|
||||
}
|
||||
if (STRNCMP("g:", xp->xp_pattern, 2) == 0) {
|
||||
return (char_u *)cat_prefix_varname('g', (char *)hi->hi_key);
|
||||
return cat_prefix_varname('g', (char *)hi->hi_key);
|
||||
}
|
||||
return hi->hi_key;
|
||||
return (char *)hi->hi_key;
|
||||
}
|
||||
|
||||
// b: variables
|
||||
@ -3211,7 +3211,7 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
||||
while (HASHITEM_EMPTY(hi)) {
|
||||
++hi;
|
||||
}
|
||||
return (char_u *)cat_prefix_varname('b', (char *)hi->hi_key);
|
||||
return cat_prefix_varname('b', (char *)hi->hi_key);
|
||||
}
|
||||
|
||||
// w: variables
|
||||
@ -3225,7 +3225,7 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
||||
while (HASHITEM_EMPTY(hi)) {
|
||||
++hi;
|
||||
}
|
||||
return (char_u *)cat_prefix_varname('w', (char *)hi->hi_key);
|
||||
return cat_prefix_varname('w', (char *)hi->hi_key);
|
||||
}
|
||||
|
||||
// t: variables
|
||||
@ -3239,12 +3239,12 @@ char_u *get_user_var_name(expand_T *xp, int idx)
|
||||
while (HASHITEM_EMPTY(hi)) {
|
||||
++hi;
|
||||
}
|
||||
return (char_u *)cat_prefix_varname('t', (char *)hi->hi_key);
|
||||
return cat_prefix_varname('t', (char *)hi->hi_key);
|
||||
}
|
||||
|
||||
// v: variables
|
||||
if (vidx < ARRAY_SIZE(vimvars)) {
|
||||
return (char_u *)cat_prefix_varname('v', vimvars[vidx++].vv_name);
|
||||
return cat_prefix_varname('v', vimvars[vidx++].vv_name);
|
||||
}
|
||||
|
||||
XFREE_CLEAR(varnamebuf);
|
||||
@ -4057,7 +4057,7 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
|
||||
case '7':
|
||||
case '8':
|
||||
case '9': {
|
||||
char *p = (char *)skipdigits((char_u *)(*arg) + 1);
|
||||
char *p = skipdigits(*arg + 1);
|
||||
int get_float = false;
|
||||
|
||||
// We accept a float when the format matches
|
||||
@ -4067,7 +4067,7 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
|
||||
// ":let vers = 1.2.3" doesn't fail.
|
||||
if (!want_string && p[0] == '.' && ascii_isdigit(p[1])) {
|
||||
get_float = true;
|
||||
p = (char *)skipdigits((char_u *)p + 2);
|
||||
p = skipdigits(p + 2);
|
||||
if (*p == 'e' || *p == 'E') {
|
||||
++p;
|
||||
if (*p == '-' || *p == '+') {
|
||||
@ -4076,7 +4076,7 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
|
||||
if (!ascii_isdigit(*p)) {
|
||||
get_float = false;
|
||||
} else {
|
||||
p = (char *)skipdigits((char_u *)p + 1);
|
||||
p = skipdigits(p + 1);
|
||||
}
|
||||
}
|
||||
if (ASCII_ISALPHA(*p) || *p == '.') {
|
||||
@ -8206,9 +8206,10 @@ varnumber_T get_vim_var_nr(int idx) FUNC_ATTR_PURE
|
||||
/// Get string v: variable value. Uses a static buffer, can only be used once.
|
||||
/// If the String variable has never been set, return an empty string.
|
||||
/// Never returns NULL;
|
||||
char_u *get_vim_var_str(int idx) FUNC_ATTR_PURE FUNC_ATTR_NONNULL_RET
|
||||
char *get_vim_var_str(int idx)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
return (char_u *)tv_get_string(&vimvars[idx].vv_tv);
|
||||
return (char *)tv_get_string(&vimvars[idx].vv_tv);
|
||||
}
|
||||
|
||||
/// Get List v: variable value. Caller must take care of reference count when
|
||||
@ -10217,7 +10218,7 @@ repeat:
|
||||
}
|
||||
}
|
||||
|
||||
tail = (char *)path_tail((char_u *)(*fnamep));
|
||||
tail = path_tail(*fnamep);
|
||||
*fnamelen = STRLEN(*fnamep);
|
||||
|
||||
// ":h" - head, remove "/file_name", can be repeated
|
||||
|
@ -113,7 +113,7 @@ static va_list dummy_ap;
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of internal
|
||||
/// or user defined function names.
|
||||
char_u *get_function_name(expand_T *xp, int idx)
|
||||
char *get_function_name(expand_T *xp, int idx)
|
||||
{
|
||||
static int intidx = -1;
|
||||
char_u *name;
|
||||
@ -122,13 +122,13 @@ char_u *get_function_name(expand_T *xp, int idx)
|
||||
intidx = -1;
|
||||
}
|
||||
if (intidx < 0) {
|
||||
name = get_user_func_name(xp, idx);
|
||||
name = (char_u *)get_user_func_name(xp, idx);
|
||||
if (name != NULL) {
|
||||
if (*name != NUL && *name != '<'
|
||||
&& STRNCMP("g:", xp->xp_pattern, 2) == 0) {
|
||||
return (char_u *)cat_prefix_varname('g', (char *)name);
|
||||
return cat_prefix_varname('g', (char *)name);
|
||||
}
|
||||
return name;
|
||||
return (char *)name;
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,12 +145,12 @@ char_u *get_function_name(expand_T *xp, int idx)
|
||||
} else {
|
||||
IObuff[key_len + 1] = NUL;
|
||||
}
|
||||
return IObuff;
|
||||
return (char *)IObuff;
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of internal or
|
||||
/// user defined variable or function names.
|
||||
char_u *get_expr_name(expand_T *xp, int idx)
|
||||
char *get_expr_name(expand_T *xp, int idx)
|
||||
{
|
||||
static int intidx = -1;
|
||||
char_u *name;
|
||||
@ -159,9 +159,9 @@ char_u *get_expr_name(expand_T *xp, int idx)
|
||||
intidx = -1;
|
||||
}
|
||||
if (intidx < 0) {
|
||||
name = get_function_name(xp, idx);
|
||||
name = (char_u *)get_function_name(xp, idx);
|
||||
if (name != NULL) {
|
||||
return name;
|
||||
return (char *)name;
|
||||
}
|
||||
}
|
||||
return get_user_var_name(xp, ++intidx);
|
||||
@ -1926,7 +1926,7 @@ typedef struct {
|
||||
const listitem_T *li;
|
||||
} GetListLineCookie;
|
||||
|
||||
static char_u *get_list_line(int c, void *cookie, int indent, bool do_concat)
|
||||
static char *get_list_line(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
GetListLineCookie *const p = (GetListLineCookie *)cookie;
|
||||
|
||||
@ -1937,7 +1937,7 @@ static char_u *get_list_line(int c, void *cookie, int indent, bool do_concat)
|
||||
char buf[NUMBUFLEN];
|
||||
const char *const s = tv_get_string_buf_chk(TV_LIST_ITEM_TV(item), buf);
|
||||
p->li = TV_LIST_ITEM_NEXT(p->l, item);
|
||||
return (char_u *)(s == NULL ? NULL : xstrdup(s));
|
||||
return s == NULL ? NULL : xstrdup(s);
|
||||
}
|
||||
|
||||
static void execute_common(typval_T *argvars, typval_T *rettv, FunPtr fptr, int arg_off)
|
||||
@ -2557,7 +2557,7 @@ static void f_foldtext(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
foldstart = (linenr_T)get_vim_var_nr(VV_FOLDSTART);
|
||||
foldend = (linenr_T)get_vim_var_nr(VV_FOLDEND);
|
||||
dashes = get_vim_var_str(VV_FOLDDASHES);
|
||||
dashes = (char_u *)get_vim_var_str(VV_FOLDDASHES);
|
||||
if (foldstart > 0 && foldend <= curbuf->b_ml.ml_line_count) {
|
||||
// Find first non-empty line in the fold.
|
||||
for (lnum = foldstart; lnum < foldend; lnum++) {
|
||||
@ -3077,7 +3077,7 @@ static void f_getcharstr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
getchar_common(argvars, rettv);
|
||||
|
||||
if (rettv->v_type == VAR_NUMBER) {
|
||||
char_u temp[7]; // mbyte-char: 6, NUL: 1
|
||||
char temp[7]; // mbyte-char: 6, NUL: 1
|
||||
const varnumber_T n = rettv->vval.v_number;
|
||||
int i = 0;
|
||||
|
||||
@ -3087,7 +3087,7 @@ static void f_getcharstr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
assert(i < 7);
|
||||
temp[i++] = NUL;
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = (char *)vim_strsave(temp);
|
||||
rettv->vval.v_string = xstrdup(temp);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3672,7 +3672,7 @@ static int getreg_get_regname(typval_T *argvars)
|
||||
}
|
||||
} else {
|
||||
// Default to v:register
|
||||
strregname = get_vim_var_str(VV_REG);
|
||||
strregname = (char_u *)get_vim_var_str(VV_REG);
|
||||
}
|
||||
|
||||
return *strregname == 0 ? '"' : *strregname;
|
||||
@ -5096,7 +5096,7 @@ static dict_T *create_environment(const dictitem_T *job_env, const bool clear_en
|
||||
}
|
||||
|
||||
// Set $NVIM (in the child process) to v:servername. #3118
|
||||
char *nvim_addr = (char *)get_vim_var_str(VV_SEND_SERVER);
|
||||
char *nvim_addr = get_vim_var_str(VV_SEND_SERVER);
|
||||
if (nvim_addr[0] != '\0') {
|
||||
dictitem_T *dv = tv_dict_find(env, S_LEN("NVIM"));
|
||||
if (dv) {
|
||||
@ -5641,7 +5641,7 @@ static void f_list2str(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
|
||||
ga_init(&ga, 1, 80);
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
|
||||
TV_LIST_ITER_CONST(l, li, {
|
||||
buf[utf_char2bytes(tv_get_number(TV_LIST_ITEM_TV(li)), (char *)buf)] = NUL;
|
||||
@ -5661,7 +5661,7 @@ static void f_localtime(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
|
||||
static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
{
|
||||
char_u *keys_buf = NULL;
|
||||
char *keys_buf = NULL;
|
||||
char_u *alt_keys_buf = NULL;
|
||||
bool did_simplify = false;
|
||||
char_u *rhs;
|
||||
@ -5677,7 +5677,7 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
rettv->v_type = VAR_STRING;
|
||||
rettv->vval.v_string = NULL;
|
||||
|
||||
char_u *keys = (char_u *)tv_get_string(&argvars[0]);
|
||||
char *keys = (char *)tv_get_string(&argvars[0]);
|
||||
if (*keys == NUL) {
|
||||
return;
|
||||
}
|
||||
@ -5702,14 +5702,14 @@ static void get_maparg(typval_T *argvars, typval_T *rettv, int exact)
|
||||
mode = get_map_mode((char **)&which, 0);
|
||||
|
||||
char_u *keys_simplified
|
||||
= (char_u *)replace_termcodes((char *)keys,
|
||||
STRLEN(keys), (char **)&keys_buf, flags, &did_simplify,
|
||||
= (char_u *)replace_termcodes(keys,
|
||||
STRLEN(keys), &keys_buf, flags, &did_simplify,
|
||||
CPO_TO_CPO_FLAGS);
|
||||
rhs = check_map(keys_simplified, mode, exact, false, abbr, &mp, &buffer_local, &rhs_lua);
|
||||
if (did_simplify) {
|
||||
// When the lhs is being simplified the not-simplified keys are
|
||||
// preferred for printing, like in do_map().
|
||||
(void)replace_termcodes((char *)keys,
|
||||
(void)replace_termcodes(keys,
|
||||
STRLEN(keys),
|
||||
(char **)&alt_keys_buf, flags | REPTERM_NO_SIMPLIFY, NULL,
|
||||
CPO_TO_CPO_FLAGS);
|
||||
@ -6095,7 +6095,7 @@ static void f_mkdir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
return;
|
||||
}
|
||||
|
||||
if (*path_tail((char_u *)dir) == NUL) {
|
||||
if (*path_tail(dir) == NUL) {
|
||||
// Remove trailing slashes.
|
||||
*path_tail_with_sep((char_u *)dir) = NUL;
|
||||
}
|
||||
@ -7397,11 +7397,11 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
q[-1] = NUL;
|
||||
}
|
||||
|
||||
q = (char *)path_tail((char_u *)p);
|
||||
q = path_tail(p);
|
||||
if (q > p && *q == NUL) {
|
||||
// Ignore trailing path separator.
|
||||
q[-1] = NUL;
|
||||
q = (char *)path_tail((char_u *)p);
|
||||
q = path_tail(p);
|
||||
}
|
||||
if (q > p && !path_is_absolute((const char_u *)buf)) {
|
||||
// Symlink is relative to directory of argument. Replace the
|
||||
@ -7409,7 +7409,7 @@ static void f_resolve(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
const size_t p_len = strlen(p);
|
||||
const size_t buf_len = strlen(buf);
|
||||
p = xrealloc(p, p_len + buf_len + 1);
|
||||
memcpy(path_tail((char_u *)p), buf, buf_len + 1);
|
||||
memcpy(path_tail(p), buf, buf_len + 1);
|
||||
} else {
|
||||
xfree(p);
|
||||
p = xstrdup(buf);
|
||||
@ -7519,15 +7519,15 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
return;
|
||||
}
|
||||
|
||||
const char_u *func_name;
|
||||
const char *func_name;
|
||||
partial_T *partial = NULL;
|
||||
if (argvars[1].v_type == VAR_FUNC) {
|
||||
func_name = (char_u *)argvars[1].vval.v_string;
|
||||
func_name = argvars[1].vval.v_string;
|
||||
} else if (argvars[1].v_type == VAR_PARTIAL) {
|
||||
partial = argvars[1].vval.v_partial;
|
||||
func_name = (char_u *)partial_name(partial);
|
||||
func_name = partial_name(partial);
|
||||
} else {
|
||||
func_name = (const char_u *)tv_get_string(&argvars[1]);
|
||||
func_name = tv_get_string(&argvars[1]);
|
||||
}
|
||||
if (*func_name == NUL) {
|
||||
return; // type error or empty name
|
||||
@ -7876,7 +7876,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
}
|
||||
|
||||
sctx_T save_current_sctx;
|
||||
uint8_t *save_sourcing_name, *save_autocmd_fname, *save_autocmd_match;
|
||||
char *save_sourcing_name, *save_autocmd_fname, *save_autocmd_match;
|
||||
linenr_T save_sourcing_lnum;
|
||||
int save_autocmd_bufnr;
|
||||
funccal_entry_T funccal_entry;
|
||||
@ -9853,13 +9853,13 @@ static void f_stdpath(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
/// "str2float()" function
|
||||
static void f_str2float(typval_T *argvars, typval_T *rettv, FunPtr fptr)
|
||||
{
|
||||
char_u *p = (char_u *)skipwhite(tv_get_string(&argvars[0]));
|
||||
char *p = skipwhite(tv_get_string(&argvars[0]));
|
||||
bool isneg = (*p == '-');
|
||||
|
||||
if (*p == '+' || *p == '-') {
|
||||
p = (char_u *)skipwhite((char *)p + 1);
|
||||
p = skipwhite(p + 1);
|
||||
}
|
||||
(void)string2float((char *)p, &rettv->vval.v_float);
|
||||
(void)string2float(p, &rettv->vval.v_float);
|
||||
if (isneg) {
|
||||
rettv->vval.v_float *= -1;
|
||||
}
|
||||
|
@ -85,9 +85,7 @@ static inline size_t tv_strlen(const typval_T *const tv)
|
||||
static inline size_t tv_strlen(const typval_T *const tv)
|
||||
{
|
||||
assert(tv->v_type == VAR_STRING);
|
||||
return (tv->vval.v_string == NULL
|
||||
? 0
|
||||
: strlen((char *)tv->vval.v_string));
|
||||
return (tv->vval.v_string == NULL ? 0 : strlen(tv->vval.v_string));
|
||||
}
|
||||
|
||||
/// Code for checking whether container references itself
|
||||
|
@ -994,7 +994,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
|
||||
// Don't redraw while executing the function.
|
||||
RedrawingDisabled++;
|
||||
save_sourcing_name = sourcing_name;
|
||||
save_sourcing_name = (char_u *)sourcing_name;
|
||||
save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_lnum = 1;
|
||||
|
||||
@ -1014,7 +1014,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
{
|
||||
if (save_sourcing_name != NULL
|
||||
&& STRNCMP(save_sourcing_name, "function ", 9) == 0) {
|
||||
vim_snprintf((char *)sourcing_name,
|
||||
vim_snprintf(sourcing_name,
|
||||
len,
|
||||
"%s[%" PRId64 "]..",
|
||||
save_sourcing_name,
|
||||
@ -1022,7 +1022,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
} else {
|
||||
STRCPY(sourcing_name, "function ");
|
||||
}
|
||||
cat_func_name(sourcing_name + STRLEN(sourcing_name), fp);
|
||||
cat_func_name((char_u *)sourcing_name + STRLEN(sourcing_name), fp);
|
||||
|
||||
if (p_verbose >= 12) {
|
||||
++no_wait_return;
|
||||
@ -1175,7 +1175,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
||||
}
|
||||
|
||||
xfree(sourcing_name);
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_name = (char *)save_sourcing_name;
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
current_sctx = save_current_sctx;
|
||||
if (do_profiling_yes) {
|
||||
@ -2219,7 +2219,7 @@ void ex_function(exarg_T *eap)
|
||||
if (eap->getline == NULL) {
|
||||
theline = getcmdline(':', 0L, indent, do_concat);
|
||||
} else {
|
||||
theline = eap->getline(':', eap->cookie, indent, do_concat);
|
||||
theline = (char_u *)eap->getline(':', eap->cookie, indent, do_concat);
|
||||
}
|
||||
line_to_free = theline;
|
||||
}
|
||||
@ -2644,7 +2644,7 @@ bool function_exists(const char *const name, bool no_deref)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of user defined
|
||||
/// function names.
|
||||
char_u *get_user_func_name(expand_T *xp, int idx)
|
||||
char *get_user_func_name(expand_T *xp, int idx)
|
||||
{
|
||||
static size_t done;
|
||||
static hashitem_T *hi;
|
||||
@ -2666,11 +2666,11 @@ char_u *get_user_func_name(expand_T *xp, int idx)
|
||||
|
||||
if ((fp->uf_flags & FC_DICT)
|
||||
|| STRNCMP(fp->uf_name, "<lambda>", 8) == 0) {
|
||||
return (char_u *)""; // don't show dict and lambda functions
|
||||
return ""; // don't show dict and lambda functions
|
||||
}
|
||||
|
||||
if (STRLEN(fp->uf_name) + 4 >= IOSIZE) {
|
||||
return fp->uf_name; // Prevent overflow.
|
||||
return (char *)fp->uf_name; // Prevent overflow.
|
||||
}
|
||||
|
||||
cat_func_name(IObuff, fp);
|
||||
@ -2680,7 +2680,7 @@ char_u *get_user_func_name(expand_T *xp, int idx)
|
||||
STRCAT(IObuff, ")");
|
||||
}
|
||||
}
|
||||
return IObuff;
|
||||
return (char *)IObuff;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -3137,7 +3137,7 @@ char_u *get_return_cmd(void *rettv)
|
||||
/// Called by do_cmdline() to get the next line.
|
||||
///
|
||||
/// @return allocated string, or NULL for end of function.
|
||||
char_u *get_func_line(int c, void *cookie, int indent, bool do_concat)
|
||||
char *get_func_line(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
funccall_T *fcp = (funccall_T *)cookie;
|
||||
ufunc_T *fp = fcp->func;
|
||||
@ -3184,7 +3184,7 @@ char_u *get_func_line(int c, void *cookie, int indent, bool do_concat)
|
||||
fcp->dbg_tick = debug_tick;
|
||||
}
|
||||
|
||||
return retval;
|
||||
return (char *)retval;
|
||||
}
|
||||
|
||||
/// @return TRUE if the currently active function should be ended, because a
|
||||
|
@ -124,7 +124,7 @@ int socket_watcher_start(SocketWatcher *watcher, int backlog, socket_cb cb)
|
||||
if (result == UV_EACCES) {
|
||||
// Libuv converts ENOENT to EACCES for Windows compatibility, but if
|
||||
// the parent directory does not exist, ENOENT would be more accurate.
|
||||
*path_tail((char_u *)watcher->addr) = NUL;
|
||||
*path_tail(watcher->addr) = NUL;
|
||||
if (!os_path_exists((char_u *)watcher->addr)) {
|
||||
result = UV_ENOENT;
|
||||
}
|
||||
|
@ -1341,7 +1341,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b
|
||||
* Vi also doesn't do this and the messages are not very informative.
|
||||
*/
|
||||
no_wait_return++; // don't call wait_return() while busy
|
||||
if (itmp != NULL && buf_write(curbuf, (char_u *)itmp, NULL, line1, line2, eap,
|
||||
if (itmp != NULL && buf_write(curbuf, itmp, NULL, line1, line2, eap,
|
||||
false, false, false, true) == FAIL) {
|
||||
msg_putchar('\n'); // Keep message from buf_write().
|
||||
no_wait_return--;
|
||||
@ -1386,7 +1386,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char *cmd, b
|
||||
|
||||
if (do_out) {
|
||||
if (otmp != NULL) {
|
||||
if (readfile((char_u *)otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap,
|
||||
if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap,
|
||||
READ_FILTER, false) != OK) {
|
||||
if (!aborting()) {
|
||||
msg_putchar('\n');
|
||||
@ -1930,7 +1930,7 @@ int do_write(exarg_T *eap)
|
||||
}
|
||||
|
||||
name_was_missing = curbuf->b_ffname == NULL;
|
||||
retval = buf_write(curbuf, (char_u *)ffname, (char_u *)fname, eap->line1, eap->line2,
|
||||
retval = buf_write(curbuf, ffname, fname, eap->line1, eap->line2,
|
||||
eap, eap->append, eap->forceit, true, false);
|
||||
|
||||
// After ":saveas fname" reset 'readonly'.
|
||||
@ -5360,7 +5360,7 @@ void fix_help_buffer(void)
|
||||
* In the "help.txt" and "help.abx" file, add the locally added help
|
||||
* files. This uses the very first line in the help file.
|
||||
*/
|
||||
char *const fname = (char *)path_tail(curbuf->b_fname);
|
||||
char *const fname = path_tail((char *)curbuf->b_fname);
|
||||
if (FNAMECMP(fname, "help.txt") == 0
|
||||
|| (FNAMENCMP(fname, "help.", 5) == 0
|
||||
&& ASCII_ISALPHA(fname[5])
|
||||
@ -5413,8 +5413,8 @@ void fix_help_buffer(void)
|
||||
}
|
||||
const char *const f1 = fnames[i1];
|
||||
const char *const f2 = fnames[i2];
|
||||
const char *const t1 = (char *)path_tail((char_u *)f1);
|
||||
const char *const t2 = (char *)path_tail((char_u *)f2);
|
||||
const char *const t1 = path_tail(f1);
|
||||
const char *const t2 = path_tail(f2);
|
||||
const char *const e1 = (char *)STRRCHR(t1, '.');
|
||||
const char *const e2 = (char *)STRRCHR(t2, '.');
|
||||
if (e1 == NULL || e2 == NULL) {
|
||||
|
@ -200,12 +200,12 @@ static char *pexpand_cmds[] = {
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the profile command
|
||||
/// specific expansion.
|
||||
char_u *get_profile_name(expand_T *xp, int idx)
|
||||
char *get_profile_name(expand_T *xp, int idx)
|
||||
FUNC_ATTR_PURE
|
||||
{
|
||||
switch (pexpand_what) {
|
||||
case PEXP_SUBCMD:
|
||||
return (char_u *)pexpand_cmds[idx];
|
||||
return pexpand_cmds[idx];
|
||||
// case PEXP_FUNC: TODO
|
||||
default:
|
||||
return NULL;
|
||||
@ -792,7 +792,7 @@ int buf_write_all(buf_T *buf, int forceit)
|
||||
int retval;
|
||||
buf_T *old_curbuf = curbuf;
|
||||
|
||||
retval = (buf_write(buf, buf->b_ffname, buf->b_fname,
|
||||
retval = (buf_write(buf, (char *)buf->b_ffname, (char *)buf->b_fname,
|
||||
(linenr_T)1, buf->b_ml.ml_line_count, NULL,
|
||||
false, forceit, true, false));
|
||||
if (curbuf != old_curbuf) {
|
||||
@ -1571,12 +1571,12 @@ static void alist_add_list(int count, char **files, int after, bool will_edit)
|
||||
|
||||
// Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
// argedit and argdelete commands.
|
||||
char_u *get_arglist_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
char *get_arglist_name(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
{
|
||||
if (idx >= ARGCOUNT) {
|
||||
return NULL;
|
||||
}
|
||||
return alist_name(&ARGLIST[idx]);
|
||||
return (char *)alist_name(&ARGLIST[idx]);
|
||||
}
|
||||
|
||||
/// ":compiler[!] {name}"
|
||||
@ -1766,7 +1766,7 @@ typedef struct {
|
||||
///
|
||||
/// @return pointer to allocated line, or NULL for end-of-file or
|
||||
/// some error.
|
||||
static char_u *get_str_line(int c, void *cookie, int indent, bool do_concat)
|
||||
static char *get_str_line(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
GetStrLineCookie *p = cookie;
|
||||
if (STRLEN(p->buf) <= p->offset) {
|
||||
@ -1818,16 +1818,16 @@ scriptitem_T *new_script_item(char *const name, scid_T *const sid_out)
|
||||
|
||||
static int source_using_linegetter(void *cookie, LineGetter fgetline, const char *traceback_name)
|
||||
{
|
||||
char *save_sourcing_name = (char *)sourcing_name;
|
||||
char *save_sourcing_name = sourcing_name;
|
||||
linenr_T save_sourcing_lnum = sourcing_lnum;
|
||||
char sourcing_name_buf[256];
|
||||
if (save_sourcing_name == NULL) {
|
||||
sourcing_name = (char_u *)traceback_name;
|
||||
sourcing_name = (char *)traceback_name;
|
||||
} else {
|
||||
snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf),
|
||||
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
|
||||
save_sourcing_lnum);
|
||||
sourcing_name = (char_u *)sourcing_name_buf; // -V507 reassigned below, before return.
|
||||
sourcing_name = sourcing_name_buf; // -V507 reassigned below, before return.
|
||||
}
|
||||
sourcing_lnum = 0;
|
||||
|
||||
@ -1842,7 +1842,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char
|
||||
int retval = do_cmdline(NULL, fgetline, cookie,
|
||||
DOCMD_VERBOSE | DOCMD_NOWAIT | DOCMD_REPEAT);
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
sourcing_name = (char_u *)save_sourcing_name;
|
||||
sourcing_name = save_sourcing_name;
|
||||
current_sctx = save_current_sctx;
|
||||
restore_funccal();
|
||||
return retval;
|
||||
@ -1935,7 +1935,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
}
|
||||
|
||||
// Apply SourceCmd autocommands, they should get the file and source it.
|
||||
if (has_autocmd(EVENT_SOURCECMD, (char_u *)fname_exp, NULL)
|
||||
if (has_autocmd(EVENT_SOURCECMD, fname_exp, NULL)
|
||||
&& apply_autocmds(EVENT_SOURCECMD, (char_u *)fname_exp, (char_u *)fname_exp,
|
||||
false, curbuf)) {
|
||||
retval = aborting() ? FAIL : OK;
|
||||
@ -1953,7 +1953,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
if (cookie.fp == NULL && check_other) {
|
||||
// Try again, replacing file name ".vimrc" by "_vimrc" or vice versa,
|
||||
// and ".exrc" by "_exrc" or vice versa.
|
||||
p = (char *)path_tail((char_u *)fname_exp);
|
||||
p = path_tail(fname_exp);
|
||||
if ((*p == '.' || *p == '_')
|
||||
&& (STRICMP(p + 1, "nvimrc") == 0 || STRICMP(p + 1, "exrc") == 0)) {
|
||||
*p = (*p == '_') ? '.' : '_';
|
||||
@ -2014,8 +2014,8 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
cookie.level = ex_nesting_level;
|
||||
|
||||
// Keep the sourcing name/lnum, for recursive calls.
|
||||
save_sourcing_name = (char *)sourcing_name;
|
||||
sourcing_name = (char_u *)fname_exp;
|
||||
save_sourcing_name = sourcing_name;
|
||||
sourcing_name = fname_exp;
|
||||
save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_lnum = 0;
|
||||
|
||||
@ -2059,7 +2059,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
cookie.conv.vc_type = CONV_NONE; // no conversion
|
||||
|
||||
// Read the first line so we can check for a UTF-8 BOM.
|
||||
firstline = getsourceline(0, (void *)&cookie, 0, true);
|
||||
firstline = (uint8_t *)getsourceline(0, (void *)&cookie, 0, true);
|
||||
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
|
||||
&& firstline[1] == 0xbb && firstline[2] == 0xbf) {
|
||||
// Found BOM; setup conversion, skip over BOM and recode the line.
|
||||
@ -2104,7 +2104,7 @@ int do_source(char *fname, int check_other, int is_vimrc)
|
||||
if (got_int) {
|
||||
emsg(_(e_interr));
|
||||
}
|
||||
sourcing_name = (char_u *)save_sourcing_name;
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
if (p_verbose > 1) {
|
||||
verbose_enter();
|
||||
@ -2302,7 +2302,7 @@ linenr_T get_sourced_lnum(LineGetter fgetline, void *cookie)
|
||||
///
|
||||
/// @return pointer to the line in allocated memory, or NULL for end-of-file or
|
||||
/// some error.
|
||||
char_u *getsourceline(int c, void *cookie, int indent, bool do_concat)
|
||||
char *getsourceline(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
struct source_cookie *sp = (struct source_cookie *)cookie;
|
||||
char *line;
|
||||
@ -2382,7 +2382,7 @@ char_u *getsourceline(int c, void *cookie, int indent, bool do_concat)
|
||||
sp->dbg_tick = debug_tick;
|
||||
}
|
||||
|
||||
return (char_u *)line;
|
||||
return line;
|
||||
}
|
||||
|
||||
static char *get_one_sourceline(struct source_cookie *sp)
|
||||
@ -2942,36 +2942,36 @@ void free_locales(void)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
/// ":language" command.
|
||||
char_u *get_lang_arg(expand_T *xp, int idx)
|
||||
char *get_lang_arg(expand_T *xp, int idx)
|
||||
{
|
||||
if (idx == 0) {
|
||||
return (char_u *)"messages";
|
||||
return "messages";
|
||||
}
|
||||
if (idx == 1) {
|
||||
return (char_u *)"ctype";
|
||||
return "ctype";
|
||||
}
|
||||
if (idx == 2) {
|
||||
return (char_u *)"time";
|
||||
return "time";
|
||||
}
|
||||
if (idx == 3) {
|
||||
return (char_u *)"collate";
|
||||
return "collate";
|
||||
}
|
||||
|
||||
init_locales();
|
||||
if (locales == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return (char_u *)locales[idx - 4];
|
||||
return locales[idx - 4];
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the available locales.
|
||||
char_u *get_locales(expand_T *xp, int idx)
|
||||
char *get_locales(expand_T *xp, int idx)
|
||||
{
|
||||
init_locales();
|
||||
if (locales == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return (char_u *)locales[idx];
|
||||
return locales[idx];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -121,7 +121,7 @@ struct aucmd_executable_t {
|
||||
|
||||
#define AUCMD_EXECUTABLE_INIT { .type = CALLABLE_NONE }
|
||||
|
||||
typedef char_u *(*LineGetter)(int, void *, int, bool);
|
||||
typedef char *(*LineGetter)(int, void *, int, bool);
|
||||
|
||||
/// Structure for command definition.
|
||||
typedef struct cmdname {
|
||||
|
@ -111,7 +111,7 @@ struct loop_cookie {
|
||||
int current_line; // last read line from growarray
|
||||
int repeating; // TRUE when looping a second time
|
||||
// When "repeating" is FALSE use "getline" and "cookie" to get lines
|
||||
char_u *(*getline)(int, void *, int, bool);
|
||||
char *(*getline)(int, void *, int, bool);
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
@ -324,7 +324,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
struct msglist *private_msg_list;
|
||||
|
||||
// "fgetline" and "cookie" passed to do_one_cmd()
|
||||
char_u *(*cmd_getline)(int, void *, int, bool);
|
||||
char *(*cmd_getline)(int, void *, int, bool);
|
||||
void *cmd_cookie;
|
||||
struct loop_cookie cmd_loop_cookie;
|
||||
void *real_cookie;
|
||||
@ -372,7 +372,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
breakpoint = func_breakpoint(real_cookie);
|
||||
dbg_tick = func_dbg_tick(real_cookie);
|
||||
} else if (getline_equal(fgetline, cookie, getsourceline)) {
|
||||
fname = (char *)sourcing_name;
|
||||
fname = sourcing_name;
|
||||
breakpoint = source_breakpoint(real_cookie);
|
||||
dbg_tick = source_dbg_tick(real_cookie);
|
||||
}
|
||||
@ -518,7 +518,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
msg_didout = true;
|
||||
}
|
||||
if (fgetline == NULL
|
||||
|| (next_cmdline = (char *)fgetline(':', cookie,
|
||||
|| (next_cmdline = fgetline(':', cookie,
|
||||
cstack.cs_idx <
|
||||
0 ? 0 : (cstack.cs_idx + 1) * 2,
|
||||
true)) == NULL) {
|
||||
@ -832,9 +832,9 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
break;
|
||||
}
|
||||
|
||||
saved_sourcing_name = (char *)sourcing_name;
|
||||
saved_sourcing_name = sourcing_name;
|
||||
saved_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_name = (char_u *)current_exception->throw_name;
|
||||
sourcing_name = current_exception->throw_name;
|
||||
sourcing_lnum = current_exception->throw_lnum;
|
||||
current_exception->throw_name = NULL;
|
||||
|
||||
@ -856,7 +856,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
xfree(p);
|
||||
}
|
||||
xfree(sourcing_name);
|
||||
sourcing_name = (char_u *)saved_sourcing_name;
|
||||
sourcing_name = saved_sourcing_name;
|
||||
sourcing_lnum = saved_sourcing_lnum;
|
||||
} else if (got_int || (did_emsg && force_abort)) {
|
||||
// On an interrupt or an aborting error not converted to an exception,
|
||||
@ -949,7 +949,7 @@ int do_cmdline(char *cmdline, LineGetter fgetline, void *cookie, int flags)
|
||||
}
|
||||
|
||||
/// Obtain a line when inside a ":while" or ":for" loop.
|
||||
static char_u *get_loop_line(int c, void *cookie, int indent, bool do_concat)
|
||||
static char *get_loop_line(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
struct loop_cookie *cp = (struct loop_cookie *)cookie;
|
||||
wcmd_T *wp;
|
||||
@ -963,21 +963,21 @@ static char_u *get_loop_line(int c, void *cookie, int indent, bool do_concat)
|
||||
if (cp->getline == NULL) {
|
||||
line = (char *)getcmdline(c, 0L, indent, do_concat);
|
||||
} else {
|
||||
line = (char *)cp->getline(c, cp->cookie, indent, do_concat);
|
||||
line = cp->getline(c, cp->cookie, indent, do_concat);
|
||||
}
|
||||
if (line != NULL) {
|
||||
store_loop_line(cp->lines_gap, line);
|
||||
++cp->current_line;
|
||||
}
|
||||
|
||||
return (char_u *)line;
|
||||
return line;
|
||||
}
|
||||
|
||||
KeyTyped = false;
|
||||
cp->current_line++;
|
||||
wp = (wcmd_T *)(cp->lines_gap->ga_data) + cp->current_line;
|
||||
sourcing_lnum = wp->lnum;
|
||||
return vim_strsave((char_u *)wp->line);
|
||||
return xstrdup(wp->line);
|
||||
}
|
||||
|
||||
/// Store a line in "gap" so that a ":while" loop can execute it again.
|
||||
@ -1387,7 +1387,7 @@ static int parse_count(exarg_T *eap, char **errormsg, bool validate)
|
||||
long n;
|
||||
|
||||
if ((eap->argt & EX_COUNT) && ascii_isdigit(*eap->arg)
|
||||
&& (!(eap->argt & EX_BUFNAME) || *(p = (char *)skipdigits((char_u *)eap->arg + 1)) == NUL
|
||||
&& (!(eap->argt & EX_BUFNAME) || *(p = skipdigits(eap->arg + 1)) == NUL
|
||||
|| ascii_iswhite(*p))) {
|
||||
n = getdigits_long((char_u **)&eap->arg, false, -1);
|
||||
eap->arg = skipwhite(eap->arg);
|
||||
@ -3189,7 +3189,7 @@ int modifier_len(char *cmd)
|
||||
char *p = cmd;
|
||||
|
||||
if (ascii_isdigit(*cmd)) {
|
||||
p = skipwhite((char *)skipdigits((char_u *)cmd + 1));
|
||||
p = skipwhite(skipdigits(cmd + 1));
|
||||
}
|
||||
for (int i = 0; i < (int)ARRAY_SIZE(cmdmods); i++) {
|
||||
int j;
|
||||
@ -3817,7 +3817,7 @@ const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
||||
case CMD_isplit:
|
||||
case CMD_dsplit:
|
||||
// Skip count.
|
||||
arg = (const char *)skipwhite((char *)skipdigits((const char_u *)arg));
|
||||
arg = (const char *)skipwhite(skipdigits(arg));
|
||||
if (*arg == '/') { // Match regexp, not just whole words.
|
||||
for (++arg; *arg && *arg != '/'; arg++) {
|
||||
if (*arg == '\\' && arg[1] != NUL) {
|
||||
@ -5498,12 +5498,12 @@ static int check_more(int message, bool forceit)
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of command names.
|
||||
char_u *get_command_name(expand_T *xp, int idx)
|
||||
char *get_command_name(expand_T *xp, int idx)
|
||||
{
|
||||
if (idx >= CMD_SIZE) {
|
||||
return (char_u *)expand_user_command_name(idx);
|
||||
return expand_user_command_name(idx);
|
||||
}
|
||||
return (char_u *)cmdnames[idx].cmd_name;
|
||||
return cmdnames[idx].cmd_name;
|
||||
}
|
||||
|
||||
/// Check for a valid user command name
|
||||
@ -6729,28 +6729,28 @@ static void do_ucmd(exarg_T *eap)
|
||||
|
||||
static char *expand_user_command_name(int idx)
|
||||
{
|
||||
return (char *)get_user_commands(NULL, idx - CMD_SIZE);
|
||||
return get_user_commands(NULL, idx - CMD_SIZE);
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of user address type names.
|
||||
char_u *get_user_cmd_addr_type(expand_T *xp, int idx)
|
||||
char *get_user_cmd_addr_type(expand_T *xp, int idx)
|
||||
{
|
||||
return (char_u *)addr_type_complete[idx].name;
|
||||
return addr_type_complete[idx].name;
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of user command names.
|
||||
char_u *get_user_commands(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
char *get_user_commands(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
// In cmdwin, the alternative buffer should be used.
|
||||
const buf_T *const buf = prevwin_curwin()->w_buffer;
|
||||
|
||||
if (idx < buf->b_ucmds.ga_len) {
|
||||
return USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
|
||||
return (char *)USER_CMD_GA(&buf->b_ucmds, idx)->uc_name;
|
||||
}
|
||||
idx -= buf->b_ucmds.ga_len;
|
||||
if (idx < ucmds.ga_len) {
|
||||
return USER_CMD(idx)->uc_name;
|
||||
return (char *)USER_CMD(idx)->uc_name;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -6777,7 +6777,7 @@ static char *get_user_command_name(int idx, int cmdidx)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of user command
|
||||
/// attributes.
|
||||
char_u *get_user_cmd_flags(expand_T *xp, int idx)
|
||||
char *get_user_cmd_flags(expand_T *xp, int idx)
|
||||
{
|
||||
static char *user_cmd_flags[] = { "addr", "bang", "bar",
|
||||
"buffer", "complete", "count",
|
||||
@ -6786,31 +6786,31 @@ char_u *get_user_cmd_flags(expand_T *xp, int idx)
|
||||
if (idx >= (int)ARRAY_SIZE(user_cmd_flags)) {
|
||||
return NULL;
|
||||
}
|
||||
return (char_u *)user_cmd_flags[idx];
|
||||
return user_cmd_flags[idx];
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of values for -nargs.
|
||||
char_u *get_user_cmd_nargs(expand_T *xp, int idx)
|
||||
char *get_user_cmd_nargs(expand_T *xp, int idx)
|
||||
{
|
||||
static char *user_cmd_nargs[] = { "0", "1", "*", "?", "+" };
|
||||
|
||||
if (idx >= (int)ARRAY_SIZE(user_cmd_nargs)) {
|
||||
return NULL;
|
||||
}
|
||||
return (char_u *)user_cmd_nargs[idx];
|
||||
return user_cmd_nargs[idx];
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the list of values for -complete.
|
||||
char_u *get_user_cmd_complete(expand_T *xp, int idx)
|
||||
char *get_user_cmd_complete(expand_T *xp, int idx)
|
||||
{
|
||||
if (idx >= (int)ARRAY_SIZE(command_complete)) {
|
||||
return NULL;
|
||||
}
|
||||
char *cmd_compl = get_command_complete(idx);
|
||||
if (cmd_compl == NULL) {
|
||||
return (char_u *)"";
|
||||
return "";
|
||||
} else {
|
||||
return (char_u *)cmd_compl;
|
||||
return cmd_compl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8098,13 +8098,13 @@ static void ex_read(exarg_T *eap)
|
||||
if (check_fname() == FAIL) { // check for no file name
|
||||
return;
|
||||
}
|
||||
i = readfile(curbuf->b_ffname, curbuf->b_fname,
|
||||
i = readfile((char *)curbuf->b_ffname, (char *)curbuf->b_fname,
|
||||
eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false);
|
||||
} else {
|
||||
if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) {
|
||||
(void)setaltfname((char_u *)eap->arg, (char_u *)eap->arg, (linenr_T)1);
|
||||
}
|
||||
i = readfile((char_u *)eap->arg, NULL,
|
||||
i = readfile(eap->arg, NULL,
|
||||
eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false);
|
||||
}
|
||||
if (i != OK) {
|
||||
@ -9551,17 +9551,17 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
|
||||
|
||||
case SPEC_AFILE: // file name for autocommand
|
||||
if (autocmd_fname != NULL
|
||||
&& !path_is_absolute(autocmd_fname)
|
||||
&& !path_is_absolute((char_u *)autocmd_fname)
|
||||
// For CmdlineEnter and related events, <afile> is not a path! #9348
|
||||
&& !strequal("/", (char *)autocmd_fname)) {
|
||||
&& !strequal("/", autocmd_fname)) {
|
||||
// Still need to turn the fname into a full path. It was
|
||||
// postponed to avoid a delay when <afile> is not used.
|
||||
result = FullName_save((char *)autocmd_fname, false);
|
||||
result = FullName_save(autocmd_fname, false);
|
||||
// Copy into `autocmd_fname`, don't reassign it. #8165
|
||||
STRLCPY(autocmd_fname, result, MAXPATHL);
|
||||
xfree(result);
|
||||
}
|
||||
result = (char *)autocmd_fname;
|
||||
result = autocmd_fname;
|
||||
if (result == NULL) {
|
||||
*errormsg = _("E495: no autocommand file name to substitute for \"<afile>\"");
|
||||
return NULL;
|
||||
@ -9579,7 +9579,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
|
||||
break;
|
||||
|
||||
case SPEC_AMATCH: // match name for autocommand
|
||||
result = (char *)autocmd_match;
|
||||
result = autocmd_match;
|
||||
if (result == NULL) {
|
||||
*errormsg = _("E497: no autocommand match name to substitute for \"<amatch>\"");
|
||||
return NULL;
|
||||
@ -9587,7 +9587,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
|
||||
break;
|
||||
|
||||
case SPEC_SFILE: // file name for ":so" command
|
||||
result = (char *)sourcing_name;
|
||||
result = sourcing_name;
|
||||
if (result == NULL) {
|
||||
*errormsg = _("E498: no :source file name to substitute for \"<sfile>\"");
|
||||
return NULL;
|
||||
@ -9636,7 +9636,7 @@ char_u *eval_vars(char_u *src, char_u *srcstart, size_t *usedlen, linenr_T *lnum
|
||||
if (src[*usedlen] == '<') {
|
||||
(*usedlen)++;
|
||||
if ((s = (char *)STRRCHR(result, '.')) != NULL
|
||||
&& (char_u *)s >= path_tail((char_u *)result)) {
|
||||
&& s >= path_tail(result)) {
|
||||
resultlen = (size_t)(s - result);
|
||||
}
|
||||
} else if (!skip_mod) {
|
||||
@ -9820,31 +9820,31 @@ static void ex_behave(exarg_T *eap)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
/// ":behave {mswin,xterm}" command.
|
||||
char_u *get_behave_arg(expand_T *xp, int idx)
|
||||
char *get_behave_arg(expand_T *xp, int idx)
|
||||
{
|
||||
if (idx == 0) {
|
||||
return (char_u *)"mswin";
|
||||
return "mswin";
|
||||
}
|
||||
if (idx == 1) {
|
||||
return (char_u *)"xterm";
|
||||
return "xterm";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
/// ":messages {clear}" command.
|
||||
char_u *get_messages_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
char *get_messages_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
{
|
||||
if (idx == 0) {
|
||||
return (char_u *)"clear";
|
||||
return "clear";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
char_u *get_mapclear_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
char *get_mapclear_arg(expand_T *xp FUNC_ATTR_UNUSED, int idx)
|
||||
{
|
||||
if (idx == 0) {
|
||||
return (char_u *)"<buffer>";
|
||||
return "<buffer>";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ static int throw_exception(void *value, except_type_T type, char *cmdname)
|
||||
}
|
||||
|
||||
excp->type = type;
|
||||
excp->throw_name = (char *)vim_strsave(sourcing_name == NULL ? (char_u *)"" : sourcing_name);
|
||||
excp->throw_name = xstrdup(sourcing_name == NULL ? "" : sourcing_name);
|
||||
excp->throw_lnum = sourcing_lnum;
|
||||
|
||||
if (p_verbose >= 13 || debug_break_level > 0) {
|
||||
|
@ -293,7 +293,7 @@ static void init_incsearch_state(incsearch_state_T *s)
|
||||
/// Given to ExpandGeneric() to obtain all available heathcheck names.
|
||||
/// @param[in] idx Index of the healthcheck item.
|
||||
/// @param[in] xp Not used.
|
||||
static char_u *get_healthcheck_names(expand_T *xp, int idx)
|
||||
static char *get_healthcheck_names(expand_T *xp, int idx)
|
||||
{
|
||||
// Generate the first time or on new prompt.
|
||||
if (healthchecks.last_gen == 0 || healthchecks.last_gen != last_prompt_id) {
|
||||
@ -311,8 +311,8 @@ static char_u *get_healthcheck_names(expand_T *xp, int idx)
|
||||
// Tracked to regenerate items on next prompt.
|
||||
healthchecks.last_gen = last_prompt_id;
|
||||
}
|
||||
return idx <
|
||||
healthchecks.names.ga_len ? ((char_u **)(healthchecks.names.ga_data))[idx] : NULL;
|
||||
return idx < healthchecks.names.ga_len
|
||||
? ((char **)(healthchecks.names.ga_data))[idx] : NULL;
|
||||
}
|
||||
|
||||
/// Transform healthcheck file path into it's name.
|
||||
@ -326,7 +326,7 @@ static void get_healthcheck_cb(char *path, void *cookie)
|
||||
struct healthchecks_cookie *hcookie = (struct healthchecks_cookie *)cookie;
|
||||
char *pattern;
|
||||
char *sub = "\\1";
|
||||
char_u *res;
|
||||
char *res;
|
||||
|
||||
if (hcookie->is_lua) {
|
||||
// Lua: transform "../lua/vim/lsp/health.lua" into "vim.lsp"
|
||||
@ -336,16 +336,16 @@ static void get_healthcheck_cb(char *path, void *cookie)
|
||||
pattern = ".*[\\/]\\([^\\/]*\\)\\.vim$";
|
||||
}
|
||||
|
||||
res = (char_u *)do_string_sub(path, pattern, sub, NULL, "g");
|
||||
res = do_string_sub(path, pattern, sub, NULL, "g");
|
||||
if (hcookie->is_lua && res != NULL) {
|
||||
// Replace slashes with dots as represented by the healthcheck plugin.
|
||||
char_u *ares = (char_u *)do_string_sub((char *)res, "[\\/]", ".", NULL, "g");
|
||||
char *ares = do_string_sub(res, "[\\/]", ".", NULL, "g");
|
||||
xfree(res);
|
||||
res = ares;
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
GA_APPEND(char_u *, hcookie->names, res);
|
||||
GA_APPEND(char *, hcookie->names, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -356,12 +356,12 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
int *skiplen, int *patlen)
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
char_u *cmd;
|
||||
char *cmd;
|
||||
cmdmod_T save_cmdmod = cmdmod;
|
||||
char_u *p;
|
||||
char *p;
|
||||
bool delim_optional = false;
|
||||
int delim;
|
||||
char_u *end;
|
||||
char *end;
|
||||
char *dummy;
|
||||
exarg_T ea;
|
||||
pos_T save_cursor;
|
||||
@ -397,14 +397,14 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
parse_command_modifiers(&ea, &dummy, true);
|
||||
cmdmod = save_cmdmod;
|
||||
|
||||
cmd = (char_u *)skip_range(ea.cmd, NULL);
|
||||
cmd = skip_range(ea.cmd, NULL);
|
||||
if (vim_strchr((char_u *)"sgvl", *cmd) == NULL) {
|
||||
goto theend;
|
||||
}
|
||||
|
||||
// Skip over "substitute" to find the pattern separator.
|
||||
for (p = cmd; ASCII_ISALPHA(*p); p++) {}
|
||||
if (*skipwhite((char *)p) == NUL) {
|
||||
if (*skipwhite(p) == NUL) {
|
||||
goto theend;
|
||||
}
|
||||
|
||||
@ -420,9 +420,9 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
} else if (STRNCMP(cmd, "sort", MAX(p - cmd, 3)) == 0) {
|
||||
// skip over ! and flags
|
||||
if (*p == '!') {
|
||||
p = (char_u *)skipwhite((char *)p + 1);
|
||||
p = skipwhite(p + 1);
|
||||
}
|
||||
while (ASCII_ISALPHA(*(p = (char_u *)skipwhite((char *)p)))) {
|
||||
while (ASCII_ISALPHA(*(p = skipwhite((char *)p)))) {
|
||||
p++;
|
||||
}
|
||||
if (*p == NUL) {
|
||||
@ -436,7 +436,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
// skip over "!/".
|
||||
if (*p == '!') {
|
||||
p++;
|
||||
if (*skipwhite((char *)p) == NUL) {
|
||||
if (*skipwhite(p) == NUL) {
|
||||
goto theend;
|
||||
}
|
||||
}
|
||||
@ -447,10 +447,10 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
goto theend;
|
||||
}
|
||||
|
||||
p = (char_u *)skipwhite((char *)p);
|
||||
p = skipwhite(p);
|
||||
delim = (delim_optional && vim_isIDc(*p)) ? ' ' : *p++;
|
||||
*search_delim = delim;
|
||||
end = skip_regexp(p, delim, p_magic, NULL);
|
||||
end = (char *)skip_regexp((char_u *)p, delim, p_magic, NULL);
|
||||
|
||||
use_last_pat = end == p && *end == delim;
|
||||
if (end == p && !use_last_pat) {
|
||||
@ -459,11 +459,11 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
|
||||
// Don't do 'hlsearch' highlighting if the pattern matches everything.
|
||||
if (!use_last_pat) {
|
||||
char_u c = *end;
|
||||
char c = *end;
|
||||
int empty;
|
||||
|
||||
*end = NUL;
|
||||
empty = empty_pattern(p);
|
||||
empty = empty_pattern((char_u *)p);
|
||||
*end = c;
|
||||
if (empty) {
|
||||
goto theend;
|
||||
@ -471,7 +471,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
||||
}
|
||||
|
||||
// found a non-empty pattern or //
|
||||
*skiplen = (int)(p - ccline.cmdbuff);
|
||||
*skiplen = (int)((char_u *)p - ccline.cmdbuff);
|
||||
*patlen = (int)(end - p);
|
||||
|
||||
// parse the address range
|
||||
@ -2602,14 +2602,14 @@ static void correct_screencol(int idx, int cells, int *col)
|
||||
///
|
||||
/// @param c normally ':', NUL for ":append"
|
||||
/// @param indent indent for inside conditionals
|
||||
char_u *getexline(int c, void *cookie, int indent, bool do_concat)
|
||||
char *getexline(int c, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
// When executing a register, remove ':' that's in front of each line.
|
||||
if (exec_from_reg && vpeekc() == ':') {
|
||||
(void)vgetc();
|
||||
}
|
||||
|
||||
return getcmdline(c, 1L, indent, do_concat);
|
||||
return (char *)getcmdline(c, 1L, indent, do_concat);
|
||||
}
|
||||
|
||||
bool cmdline_overstrike(void)
|
||||
@ -2676,7 +2676,7 @@ static void realloc_cmdbuff(int len)
|
||||
}
|
||||
}
|
||||
|
||||
static char_u *arshape_buf = NULL;
|
||||
static char *arshape_buf = NULL;
|
||||
|
||||
#if defined(EXITFREE)
|
||||
void free_arshape_buf(void)
|
||||
@ -3074,11 +3074,11 @@ static void draw_cmdline(int start, int len)
|
||||
|
||||
u8c = arabic_shape(u8c, NULL, &u8cc[0], pc, pc1, nc);
|
||||
|
||||
newlen += utf_char2bytes(u8c, (char *)arshape_buf + newlen);
|
||||
newlen += utf_char2bytes(u8c, arshape_buf + newlen);
|
||||
if (u8cc[0] != 0) {
|
||||
newlen += utf_char2bytes(u8cc[0], (char *)arshape_buf + newlen);
|
||||
newlen += utf_char2bytes(u8cc[0], arshape_buf + newlen);
|
||||
if (u8cc[1] != 0) {
|
||||
newlen += utf_char2bytes(u8cc[1], (char *)arshape_buf + newlen);
|
||||
newlen += utf_char2bytes(u8cc[1], arshape_buf + newlen);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -3088,7 +3088,7 @@ static void draw_cmdline(int start, int len)
|
||||
}
|
||||
}
|
||||
|
||||
msg_outtrans_len(arshape_buf, newlen);
|
||||
msg_outtrans_len((char_u *)arshape_buf, newlen);
|
||||
} else {
|
||||
draw_cmdline_no_arabicshape:
|
||||
if (kv_size(ccline.last_colors.colors)) {
|
||||
@ -4491,7 +4491,7 @@ static int expand_showtail(expand_T *xp)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
end = path_tail((char_u *)xp->xp_pattern);
|
||||
end = (char_u *)path_tail(xp->xp_pattern);
|
||||
if (end == (char_u *)xp->xp_pattern) { // there is no path separator
|
||||
return false;
|
||||
}
|
||||
@ -4618,7 +4618,7 @@ char_u *addstar(char_u *fname, size_t len, int context)
|
||||
* ` could be anywhere in the file name.
|
||||
* When the name ends in '$' don't add a star, remove the '$'.
|
||||
*/
|
||||
tail = path_tail(retval);
|
||||
tail = (char_u *)path_tail((char *)retval);
|
||||
ends_in_star = (len > 0 && retval[len - 1] == '*');
|
||||
#ifndef BACKSLASH_IN_FILENAME
|
||||
for (ssize_t k = (ssize_t)len - 2; k >= 0; k--) {
|
||||
@ -4834,7 +4834,7 @@ static void cleanup_help_tags(int num_file, char_u **file)
|
||||
}
|
||||
}
|
||||
|
||||
typedef char_u *(*ExpandFunc)(expand_T *, int);
|
||||
typedef char *(*ExpandFunc)(expand_T *, int);
|
||||
|
||||
/// Do the expansion based on xp->xp_context and "pat".
|
||||
///
|
||||
@ -5099,8 +5099,8 @@ static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, cha
|
||||
char_u *str;
|
||||
|
||||
// count the number of matching names
|
||||
for (i = 0;; ++i) {
|
||||
str = (*func)(xp, i);
|
||||
for (i = 0;; i++) {
|
||||
str = (char_u *)(*func)(xp, i);
|
||||
if (str == NULL) { // end of list
|
||||
break;
|
||||
}
|
||||
@ -5121,7 +5121,7 @@ static void ExpandGeneric(expand_T *xp, regmatch_T *regmatch, int *num_file, cha
|
||||
// copy the matching names into allocated memory
|
||||
count = 0;
|
||||
for (i = 0;; i++) {
|
||||
str = (*func)(xp, i);
|
||||
str = (char_u *)(*func)(xp, i);
|
||||
if (str == NULL) { // End of list.
|
||||
break;
|
||||
}
|
||||
@ -5571,7 +5571,7 @@ static int ExpandPackAddDir(char_u *pat, int *num_file, char_u ***file)
|
||||
|
||||
for (int i = 0; i < ga.ga_len; i++) {
|
||||
char_u *match = ((char_u **)ga.ga_data)[i];
|
||||
s = path_tail(match);
|
||||
s = (char_u *)path_tail((char *)match);
|
||||
memmove(match, s, STRLEN(s) + 1);
|
||||
}
|
||||
|
||||
@ -5678,7 +5678,7 @@ static char *(history_names[]) =
|
||||
* Function given to ExpandGeneric() to obtain the possible first
|
||||
* arguments of the ":history command.
|
||||
*/
|
||||
static char_u *get_history_arg(expand_T *xp, int idx)
|
||||
static char *get_history_arg(expand_T *xp, int idx)
|
||||
{
|
||||
static char_u compl[2] = { NUL, NUL };
|
||||
char *short_names = ":=@>?/";
|
||||
@ -5687,13 +5687,13 @@ static char_u *get_history_arg(expand_T *xp, int idx)
|
||||
|
||||
if (idx < short_names_count) {
|
||||
compl[0] = (char_u)short_names[idx];
|
||||
return compl;
|
||||
return (char *)compl;
|
||||
}
|
||||
if (idx < short_names_count + history_name_count) {
|
||||
return (char_u *)history_names[idx - short_names_count];
|
||||
return history_names[idx - short_names_count];
|
||||
}
|
||||
if (idx == short_names_count + history_name_count) {
|
||||
return (char_u *)"all";
|
||||
return "all";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -5960,9 +5960,9 @@ char_u *get_cmdline_completion(void)
|
||||
|
||||
if (p != NULL && p->xpc != NULL) {
|
||||
set_expand_context(p->xpc);
|
||||
char_u *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context);
|
||||
char *cmd_compl = get_user_cmd_complete(p->xpc, p->xpc->xp_context);
|
||||
if (cmd_compl != NULL) {
|
||||
return vim_strsave(cmd_compl);
|
||||
return vim_strsave((char_u *)cmd_compl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -6642,8 +6642,8 @@ char *script_get(exarg_T *const eap, size_t *const lenp)
|
||||
|
||||
const char *const end_pattern = (cmd[2] != NUL ? (const char *)skipwhite(cmd + 2) : ".");
|
||||
for (;;) {
|
||||
char *const theline = (char *)eap->getline(eap->cstack->cs_looplevel > 0 ? -1 :
|
||||
NUL, eap->cookie, 0, true);
|
||||
char *const theline = (char *)eap->getline(eap->cstack->cs_looplevel > 0 ? -1 : NUL,
|
||||
eap->cookie, 0, true);
|
||||
|
||||
if (theline == NULL || strcmp(end_pattern, theline) == 0) {
|
||||
xfree(theline);
|
||||
|
@ -48,7 +48,7 @@ typedef enum {
|
||||
/// Number of history tables
|
||||
#define HIST_COUNT (HIST_DEBUG + 1)
|
||||
|
||||
typedef char_u *(*CompleteListItemGetter)(expand_T *, int);
|
||||
typedef char *(*CompleteListItemGetter)(expand_T *, int);
|
||||
|
||||
/// History entry definition
|
||||
typedef struct hist_entry {
|
||||
|
@ -930,7 +930,7 @@ void ex_mkrc(exarg_T *eap)
|
||||
viewFile = fname;
|
||||
using_vdir = true;
|
||||
} else if (*eap->arg != NUL) {
|
||||
fname = (char *)eap->arg;
|
||||
fname = eap->arg;
|
||||
} else if (eap->cmdidx == CMD_mkvimrc) {
|
||||
fname = VIMRC_FILE;
|
||||
} else if (eap->cmdidx == CMD_mksession) {
|
||||
|
@ -298,7 +298,7 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le
|
||||
&& (vim_ispathsep(path[1]) || path[1] == NUL)
|
||||
&& (!tagfile || vim_strchr(p_cpo, CPO_DOTTAG) == NULL)
|
||||
&& rel_fname != NULL) {
|
||||
size_t len = (size_t)(path_tail(rel_fname) - rel_fname);
|
||||
size_t len = (size_t)((char_u *)path_tail((char *)rel_fname) - rel_fname);
|
||||
|
||||
if (!vim_isAbsName(rel_fname) && len + 1 < MAXPATHL) {
|
||||
// Make the start dir an absolute path name.
|
||||
@ -477,7 +477,7 @@ void *vim_findfile_init(char_u *path, char_u *filename, char_u *stopdirs, int le
|
||||
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
|
||||
add_pathsep((char *)ff_expand_buffer);
|
||||
} else {
|
||||
char_u *p = path_tail(search_ctx->ffsc_fix_path);
|
||||
char_u *p = (char_u *)path_tail((char *)search_ctx->ffsc_fix_path);
|
||||
char_u *wc_path = NULL;
|
||||
char_u *temp = NULL;
|
||||
int len = 0;
|
||||
@ -1481,7 +1481,7 @@ char_u *find_file_in_path_option(char_u *ptr, size_t len, int options, int first
|
||||
&& rel_fname != NULL
|
||||
&& STRLEN(rel_fname) + l < MAXPATHL) {
|
||||
STRCPY(NameBuff, rel_fname);
|
||||
STRCPY(path_tail(NameBuff), ff_file_to_find);
|
||||
STRCPY(path_tail((char *)NameBuff), ff_file_to_find);
|
||||
l = STRLEN(NameBuff);
|
||||
} else {
|
||||
STRCPY(NameBuff, ff_file_to_find);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3009,7 +3009,7 @@ int str_to_mapargs(const char_u *strargs, bool is_unmap, MapArguments *mapargs)
|
||||
//
|
||||
// With :unmap, literal white space is included in the {lhs}; there is no
|
||||
// separate {rhs}.
|
||||
const char_u *lhs_end = to_parse;
|
||||
const char *lhs_end = (char *)to_parse;
|
||||
bool do_backslash = (vim_strchr(p_cpo, CPO_BSLASH) == NULL);
|
||||
while (*lhs_end && (is_unmap || !ascii_iswhite(*lhs_end))) {
|
||||
if ((lhs_end[0] == Ctrl_V || (do_backslash && lhs_end[0] == '\\'))
|
||||
@ -3025,7 +3025,7 @@ int str_to_mapargs(const char_u *strargs, bool is_unmap, MapArguments *mapargs)
|
||||
|
||||
// Given {lhs} might be larger than MAXMAPLEN before replace_termcodes
|
||||
// (e.g. "<Space>" is longer than ' '), so first copy into a buffer.
|
||||
size_t orig_lhs_len = (size_t)(lhs_end - to_parse);
|
||||
size_t orig_lhs_len = (size_t)((char_u *)lhs_end - to_parse);
|
||||
char_u *lhs_to_replace = xcalloc(orig_lhs_len + 1, sizeof(char_u));
|
||||
STRLCPY(lhs_to_replace, to_parse, orig_lhs_len + 1);
|
||||
|
||||
@ -3820,7 +3820,7 @@ bool map_to_exists(const char *const str, const char *const modechars, const boo
|
||||
MAPMODE(mode, modechars, 'c', MODE_CMDLINE);
|
||||
#undef MAPMODE
|
||||
|
||||
retval = map_to_exists_mode((const char *)rhs, mode, abbr);
|
||||
retval = map_to_exists_mode((char *)rhs, mode, abbr);
|
||||
xfree(buf);
|
||||
|
||||
return retval;
|
||||
@ -4828,7 +4828,7 @@ mapblock_T *get_maphash(int index, buf_T *buf)
|
||||
}
|
||||
|
||||
/// Get command argument for <Cmd> key
|
||||
char_u *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
|
||||
char *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
|
||||
{
|
||||
garray_T line_ga;
|
||||
int c1 = -1, c2;
|
||||
@ -4901,7 +4901,7 @@ char_u *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
|
||||
ga_clear(&line_ga);
|
||||
}
|
||||
|
||||
return (char_u *)line_ga.ga_data;
|
||||
return line_ga.ga_data;
|
||||
}
|
||||
|
||||
bool map_execute_lua(void)
|
||||
|
@ -253,7 +253,7 @@ EXTERN int lines_left INIT(= -1); // lines left for listing
|
||||
EXTERN int msg_no_more INIT(= false); // don't use more prompt, truncate
|
||||
// messages
|
||||
|
||||
EXTERN char_u *sourcing_name INIT(= NULL); // name of error message source
|
||||
EXTERN char *sourcing_name INIT(= NULL); // name of error message source
|
||||
EXTERN linenr_T sourcing_lnum INIT(= 0); // line number of the source file
|
||||
|
||||
EXTERN int ex_nesting_level INIT(= 0); // nesting level
|
||||
@ -354,7 +354,7 @@ EXTERN bool did_source_packages INIT(= false);
|
||||
// provider function call
|
||||
EXTERN struct caller_scope {
|
||||
sctx_T script_ctx;
|
||||
uint8_t *sourcing_name, *autocmd_fname, *autocmd_match;
|
||||
char *sourcing_name, *autocmd_fname, *autocmd_match;
|
||||
linenr_T sourcing_lnum;
|
||||
int autocmd_bufnr;
|
||||
void *funccalp;
|
||||
@ -755,9 +755,9 @@ EXTERN char last_mode[MODE_MAX_LENGTH] INIT(= "n");
|
||||
EXTERN char_u *last_cmdline INIT(= NULL); // last command line (for ":)
|
||||
EXTERN char_u *repeat_cmdline INIT(= NULL); // command line for "."
|
||||
EXTERN char_u *new_last_cmdline INIT(= NULL); // new value for last_cmdline
|
||||
EXTERN char_u *autocmd_fname INIT(= NULL); // fname for <afile> on cmdline
|
||||
EXTERN char *autocmd_fname INIT(= NULL); // fname for <afile> on cmdline
|
||||
EXTERN int autocmd_bufnr INIT(= 0); // fnum for <abuf> on cmdline
|
||||
EXTERN char_u *autocmd_match INIT(= NULL); // name for <amatch> on cmdline
|
||||
EXTERN char *autocmd_match INIT(= NULL); // name for <amatch> on cmdline
|
||||
EXTERN bool did_cursorhold INIT(= false); // set when CursorHold t'gerd
|
||||
|
||||
EXTERN int postponed_split INIT(= 0); // for CTRL-W CTRL-] command
|
||||
|
@ -1576,7 +1576,7 @@ static void prt_resource_name(char *filename, void *cookie)
|
||||
|
||||
static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
|
||||
{
|
||||
char_u *buffer;
|
||||
char *buffer;
|
||||
int retval;
|
||||
|
||||
buffer = xmallocz(MAXPATHL);
|
||||
@ -1584,7 +1584,7 @@ static int prt_find_resource(char *name, struct prt_ps_resource_S *resource)
|
||||
STRLCPY(resource->name, name, 64);
|
||||
// Look for named resource file in runtimepath
|
||||
STRCPY(buffer, "print");
|
||||
add_pathsep((char *)buffer);
|
||||
add_pathsep(buffer);
|
||||
STRLCAT(buffer, name, MAXPATHL);
|
||||
STRLCAT(buffer, ".ps", MAXPATHL);
|
||||
resource->filename[0] = NUL;
|
||||
|
@ -80,7 +80,7 @@ static enum {
|
||||
* Function given to ExpandGeneric() to obtain the cscope command
|
||||
* expansion.
|
||||
*/
|
||||
char_u *get_cscope_name(expand_T *xp, int idx)
|
||||
char *get_cscope_name(expand_T *xp, int idx)
|
||||
{
|
||||
int current_idx;
|
||||
|
||||
@ -88,7 +88,7 @@ char_u *get_cscope_name(expand_T *xp, int idx)
|
||||
case EXP_CSCOPE_SUBCMD:
|
||||
// Complete with sub-commands of ":cscope":
|
||||
// add, find, help, kill, reset, show
|
||||
return (char_u *)cs_cmds[idx].name;
|
||||
return cs_cmds[idx].name;
|
||||
case EXP_SCSCOPE_SUBCMD: {
|
||||
// Complete with sub-commands of ":scscope": same sub-commands as
|
||||
// ":cscope" but skip commands which don't support split windows
|
||||
@ -100,7 +100,7 @@ char_u *get_cscope_name(expand_T *xp, int idx)
|
||||
}
|
||||
}
|
||||
}
|
||||
return (char_u *)cs_cmds[i].name;
|
||||
return cs_cmds[i].name;
|
||||
}
|
||||
case EXP_CSCOPE_FIND: {
|
||||
const char *query_type[] =
|
||||
@ -112,7 +112,7 @@ char_u *get_cscope_name(expand_T *xp, int idx)
|
||||
// {query_type} can be letters (c, d, ... a) or numbers (0, 1,
|
||||
// ..., 9) but only complete with letters, since numbers are
|
||||
// redundant.
|
||||
return (char_u *)query_type[idx];
|
||||
return (char *)query_type[idx];
|
||||
}
|
||||
case EXP_CSCOPE_KILL: {
|
||||
static char connection[5];
|
||||
@ -128,10 +128,10 @@ char_u *get_cscope_name(expand_T *xp, int idx)
|
||||
}
|
||||
if (current_idx++ == idx) {
|
||||
vim_snprintf(connection, sizeof(connection), "%zu", i);
|
||||
return (char_u *)connection;
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
return (current_idx == idx && idx > 0) ? (char_u *)"-1" : NULL;
|
||||
return (current_idx == idx && idx > 0) ? "-1" : NULL;
|
||||
}
|
||||
default:
|
||||
return NULL;
|
||||
@ -2008,8 +2008,8 @@ static char *cs_resolve_file(size_t i, char *name)
|
||||
// path in path resolution.
|
||||
csdir = xmalloc(MAXPATHL);
|
||||
STRLCPY(csdir, csinfo[i].fname,
|
||||
path_tail((char_u *)csinfo[i].fname)
|
||||
- (char_u *)csinfo[i].fname + 1);
|
||||
path_tail(csinfo[i].fname)
|
||||
- csinfo[i].fname + 1);
|
||||
len += STRLEN(csdir);
|
||||
}
|
||||
|
||||
|
@ -920,7 +920,7 @@ int nlua_call(lua_State *lstate)
|
||||
{
|
||||
Error err = ERROR_INIT;
|
||||
size_t name_len;
|
||||
const char_u *name = (const char_u *)luaL_checklstring(lstate, 1, &name_len);
|
||||
const char *name = luaL_checklstring(lstate, 1, &name_len);
|
||||
if (!nlua_is_deferred_safe()) {
|
||||
return luaL_error(lstate, e_luv_api_disabled, "vimL function");
|
||||
}
|
||||
@ -1249,7 +1249,7 @@ int nlua_source_using_linegetter(LineGetter fgetline, void *cookie, char *name)
|
||||
char_u *line = NULL;
|
||||
|
||||
ga_init(&ga, (int)sizeof(char_u *), 10);
|
||||
while ((line = fgetline(0, cookie, 0, false)) != NULL) {
|
||||
while ((line = (char_u *)fgetline(0, cookie, 0, false)) != NULL) {
|
||||
GA_APPEND(char_u *, &ga, line);
|
||||
}
|
||||
char *code = ga_concat_strings_sep(&ga, "\n");
|
||||
|
@ -807,7 +807,7 @@ static void init_locale(void)
|
||||
snprintf(localepath, sizeof(localepath), "%s", get_vim_var_str(VV_PROGPATH));
|
||||
char *tail = (char *)path_tail_with_sep((char_u *)localepath);
|
||||
*tail = NUL;
|
||||
tail = (char *)path_tail((char_u *)localepath);
|
||||
tail = path_tail(localepath);
|
||||
xstrlcpy(tail, "share/locale",
|
||||
sizeof(localepath) - (size_t)(tail - localepath));
|
||||
bindtextdomain(PROJECT_NAME, localepath);
|
||||
@ -1364,7 +1364,7 @@ scripterror:
|
||||
if (parmp->diff_mode && os_isdir(p) && GARGCOUNT > 0
|
||||
&& !os_isdir(alist_name(&GARGLIST[0]))) {
|
||||
char_u *r = (char_u *)concat_fnames((char *)p,
|
||||
(char *)path_tail(alist_name(&GARGLIST[0])), true);
|
||||
path_tail((char *)alist_name(&GARGLIST[0])), true);
|
||||
xfree(p);
|
||||
p = r;
|
||||
}
|
||||
@ -1470,7 +1470,7 @@ static void init_path(const char *exename)
|
||||
path_guess_exepath(exename, exepath, sizeof(exepath));
|
||||
}
|
||||
set_vim_var_string(VV_PROGPATH, exepath, -1);
|
||||
set_vim_var_string(VV_PROGNAME, (char *)path_tail((char_u *)exename), -1);
|
||||
set_vim_var_string(VV_PROGNAME, path_tail(exename), -1);
|
||||
|
||||
#ifdef WIN32
|
||||
// Append the process start directory to $PATH, so that ":!foo" finds tools
|
||||
@ -1813,7 +1813,7 @@ static void exe_pre_commands(mparm_T *parmp)
|
||||
|
||||
if (cnt > 0) {
|
||||
curwin->w_cursor.lnum = 0; // just in case..
|
||||
sourcing_name = (char_u *)_("pre-vimrc command line");
|
||||
sourcing_name = _("pre-vimrc command line");
|
||||
current_sctx.sc_sid = SID_CMDARG;
|
||||
for (i = 0; i < cnt; i++) {
|
||||
do_cmdline_cmd(cmds[i]);
|
||||
@ -1840,7 +1840,7 @@ static void exe_commands(mparm_T *parmp)
|
||||
if (parmp->tagname == NULL && curwin->w_cursor.lnum <= 1) {
|
||||
curwin->w_cursor.lnum = 0;
|
||||
}
|
||||
sourcing_name = (char_u *)"command line";
|
||||
sourcing_name = "command line";
|
||||
current_sctx.sc_sid = SID_CARG;
|
||||
current_sctx.sc_seq = 0;
|
||||
for (i = 0; i < parmp->n_commands; i++) {
|
||||
@ -2061,16 +2061,16 @@ static int execute_env(char *env)
|
||||
{
|
||||
const char *initstr = os_getenv(env);
|
||||
if (initstr != NULL) {
|
||||
char_u *save_sourcing_name = sourcing_name;
|
||||
char_u *save_sourcing_name = (char_u *)sourcing_name;
|
||||
linenr_T save_sourcing_lnum = sourcing_lnum;
|
||||
sourcing_name = (char_u *)env;
|
||||
sourcing_name = env;
|
||||
sourcing_lnum = 0;
|
||||
const sctx_T save_current_sctx = current_sctx;
|
||||
current_sctx.sc_sid = SID_ENV;
|
||||
current_sctx.sc_seq = 0;
|
||||
current_sctx.sc_lnum = 0;
|
||||
do_cmdline_cmd((char *)initstr);
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_name = (char *)save_sourcing_name;
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
current_sctx = save_current_sctx;
|
||||
return OK;
|
||||
@ -2104,7 +2104,7 @@ static bool file_owned(const char *fname)
|
||||
static void mainerr(const char *errstr, const char *str)
|
||||
FUNC_ATTR_NORETURN
|
||||
{
|
||||
char *prgname = (char *)path_tail((char_u *)argv0);
|
||||
char *prgname = path_tail(argv0);
|
||||
|
||||
signal_stop(); // kill us with CTRL-C here, if you like
|
||||
|
||||
|
@ -1332,7 +1332,7 @@ bool mb_isalpha(int a)
|
||||
static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2)
|
||||
{
|
||||
int c1, c2, cdiff;
|
||||
char_u buffer[6];
|
||||
char buffer[6];
|
||||
|
||||
for (;;) {
|
||||
c1 = utf_safe_read_char_adv(&s1, &n1);
|
||||
@ -1371,10 +1371,10 @@ static int utf_strnicmp(const char_u *s1, const char_u *s2, size_t n1, size_t n2
|
||||
|
||||
if (c1 != -1 && c2 == -1) {
|
||||
n1 = utf_char2bytes(utf_fold(c1), (char *)buffer);
|
||||
s1 = buffer;
|
||||
s1 = (char_u *)buffer;
|
||||
} else if (c2 != -1 && c1 == -1) {
|
||||
n2 = utf_char2bytes(utf_fold(c2), (char *)buffer);
|
||||
s2 = buffer;
|
||||
s2 = (char_u *)buffer;
|
||||
}
|
||||
|
||||
while (n1 > 0 && n2 > 0 && *s1 != NUL && *s2 != NUL) {
|
||||
|
@ -992,7 +992,7 @@ void ml_recover(bool checkext)
|
||||
* 'fileencoding', etc. Ignore errors. The text itself is not used.
|
||||
*/
|
||||
if (curbuf->b_ffname != NULL) {
|
||||
orig_file_status = readfile(curbuf->b_ffname, NULL, (linenr_T)0,
|
||||
orig_file_status = readfile((char *)curbuf->b_ffname, NULL, (linenr_T)0,
|
||||
(linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW, false);
|
||||
}
|
||||
|
||||
@ -1066,7 +1066,7 @@ void ml_recover(bool checkext)
|
||||
*/
|
||||
if (!cannot_open) {
|
||||
line_count = pp->pb_pointer[idx].pe_line_count;
|
||||
if (readfile(curbuf->b_ffname, NULL, lnum,
|
||||
if (readfile((char *)curbuf->b_ffname, NULL, lnum,
|
||||
pp->pb_pointer[idx].pe_old_lnum - 1, line_count,
|
||||
NULL, 0, false) != OK) {
|
||||
cannot_open = true;
|
||||
@ -1338,8 +1338,8 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
|
||||
tail = (char_u *)make_percent_swname((char *)dir_name,
|
||||
(char *)fname_res);
|
||||
} else {
|
||||
tail = path_tail(fname_res);
|
||||
tail = (char_u *)concat_fnames((char *)dir_name, (char *)tail, TRUE);
|
||||
tail = (char_u *)path_tail((char *)fname_res);
|
||||
tail = (char_u *)concat_fnames((char *)dir_name, (char *)tail, true);
|
||||
}
|
||||
num_names = recov_file_names(names, tail, FALSE);
|
||||
xfree(tail);
|
||||
@ -1418,7 +1418,7 @@ int recover_names(char_u *fname, int list, int nr, char_u **fname_out)
|
||||
// print the swap file name
|
||||
msg_outnum((long)++file_count);
|
||||
msg_puts(". ");
|
||||
msg_puts((const char *)path_tail(files[i]));
|
||||
msg_puts((const char *)path_tail((char *)files[i]));
|
||||
msg_putchar('\n');
|
||||
(void)swapfile_info(files[i]);
|
||||
}
|
||||
@ -3204,7 +3204,7 @@ int resolve_symlink(const char_u *fname, char_u *buf)
|
||||
if (path_is_absolute(buf)) {
|
||||
STRCPY(tmp, buf);
|
||||
} else {
|
||||
char_u *tail = path_tail(tmp);
|
||||
char_u *tail = (char_u *)path_tail((char *)tmp);
|
||||
if (STRLEN(tail) + STRLEN(buf) >= MAXPATHL) {
|
||||
return FAIL;
|
||||
}
|
||||
@ -3283,7 +3283,7 @@ char_u *get_file_in_dir(char_u *fname, char_u *dname)
|
||||
char_u *retval;
|
||||
int save_char;
|
||||
|
||||
tail = path_tail(fname);
|
||||
tail = (char_u *)path_tail((char *)fname);
|
||||
|
||||
if (dname[0] == '.' && dname[1] == NUL) {
|
||||
retval = vim_strsave(fname);
|
||||
@ -3482,8 +3482,8 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
|
||||
// buffer don't compare the directory names, they can
|
||||
// have a different mountpoint.
|
||||
if (b0.b0_flags & B0_SAME_DIR) {
|
||||
if (FNAMECMP(path_tail(buf->b_ffname),
|
||||
path_tail(b0.b0_fname)) != 0
|
||||
if (FNAMECMP(path_tail((char *)buf->b_ffname),
|
||||
path_tail((char *)b0.b0_fname)) != 0
|
||||
|| !same_directory((char_u *)fname, buf->b_ffname)) {
|
||||
// Symlinks may point to the same file even
|
||||
// when the name differs, need to check the
|
||||
@ -3528,7 +3528,7 @@ static char *findswapname(buf_T *buf, char **dirp, char *old_fname, bool *found_
|
||||
// response, trigger it. It may return 0 to ask the user anyway.
|
||||
if (choice == 0
|
||||
&& swap_exists_action != SEA_NONE
|
||||
&& has_autocmd(EVENT_SWAPEXISTS, (char_u *)buf_fname, buf)) {
|
||||
&& has_autocmd(EVENT_SWAPEXISTS, buf_fname, buf)) {
|
||||
choice = do_swapexists(buf, (char_u *)fname);
|
||||
}
|
||||
|
||||
|
@ -1034,7 +1034,7 @@ char *set_context_in_menu_cmd(expand_T *xp, const char *cmd, char *arg, bool for
|
||||
* Function given to ExpandGeneric() to obtain the list of (sub)menus (not
|
||||
* entries).
|
||||
*/
|
||||
char_u *get_menu_name(expand_T *xp, int idx)
|
||||
char *get_menu_name(expand_T *xp, int idx)
|
||||
{
|
||||
static vimmenu_T *menu = NULL;
|
||||
char *str;
|
||||
@ -1076,14 +1076,14 @@ char_u *get_menu_name(expand_T *xp, int idx)
|
||||
|
||||
should_advance = !should_advance;
|
||||
|
||||
return (char_u *)str;
|
||||
return str;
|
||||
}
|
||||
|
||||
/*
|
||||
* Function given to ExpandGeneric() to obtain the list of menus and menu
|
||||
* entries.
|
||||
*/
|
||||
char_u *get_menu_names(expand_T *xp, int idx)
|
||||
char *get_menu_names(expand_T *xp, int idx)
|
||||
{
|
||||
static vimmenu_T *menu = NULL;
|
||||
#define TBUFFER_LEN 256
|
||||
@ -1143,7 +1143,7 @@ char_u *get_menu_names(expand_T *xp, int idx)
|
||||
|
||||
should_advance = !should_advance;
|
||||
|
||||
return (char_u *)str;
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
|
@ -586,7 +586,7 @@ void msg_source(int attr)
|
||||
if (sourcing_name == NULL) {
|
||||
last_sourcing_name = NULL;
|
||||
} else {
|
||||
last_sourcing_name = vim_strsave(sourcing_name);
|
||||
last_sourcing_name = vim_strsave((char_u *)sourcing_name);
|
||||
}
|
||||
}
|
||||
--no_wait_return;
|
||||
@ -2418,7 +2418,7 @@ void msg_reset_scroll(void)
|
||||
static void inc_msg_scrolled(void)
|
||||
{
|
||||
if (*get_vim_var_str(VV_SCROLLSTART) == NUL) {
|
||||
char *p = (char *)sourcing_name;
|
||||
char *p = sourcing_name;
|
||||
char *tofree = NULL;
|
||||
|
||||
// v:scrollstart is empty, set it to the script/function name and line
|
||||
|
@ -884,7 +884,7 @@ yankreg_T *copy_register(int name)
|
||||
if (copy->y_size == 0) {
|
||||
copy->y_array = NULL;
|
||||
} else {
|
||||
copy->y_array = xcalloc(copy->y_size, sizeof(char_u *));
|
||||
copy->y_array = xcalloc(copy->y_size, sizeof(char *));
|
||||
for (size_t i = 0; i < copy->y_size; i++) {
|
||||
copy->y_array[i] = xstrdup(reg->y_array[i]);
|
||||
}
|
||||
@ -1161,7 +1161,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
|
||||
* Insert lines into typeahead buffer, from last one to first one.
|
||||
*/
|
||||
put_reedit_in_typebuf(silent);
|
||||
char_u *escaped;
|
||||
char *escaped;
|
||||
for (size_t i = reg->y_size; i-- > 0;) { // from y_size - 1 to 0 included
|
||||
// insert NL between lines and after last line if type is kMTLineWise
|
||||
if (reg->y_type == kMTLineWise || i < reg->y_size - 1 || addcr) {
|
||||
@ -1180,7 +1180,7 @@ int do_execreg(int regname, int colon, int addcr, int silent)
|
||||
free_str = true;
|
||||
}
|
||||
}
|
||||
escaped = (char_u *)vim_strsave_escape_ks((char *)str);
|
||||
escaped = vim_strsave_escape_ks((char *)str);
|
||||
if (free_str) {
|
||||
xfree(str);
|
||||
}
|
||||
@ -1237,12 +1237,12 @@ static int put_in_typebuf(char_u *s, bool esc, bool colon, int silent)
|
||||
retval = ins_typebuf("\n", REMAP_NONE, 0, true, silent);
|
||||
}
|
||||
if (retval == OK) {
|
||||
char_u *p;
|
||||
char *p;
|
||||
|
||||
if (esc) {
|
||||
p = (char_u *)vim_strsave_escape_ks((char *)s);
|
||||
p = vim_strsave_escape_ks((char *)s);
|
||||
} else {
|
||||
p = s;
|
||||
p = (char *)s;
|
||||
}
|
||||
if (p == NULL) {
|
||||
retval = FAIL;
|
||||
@ -2679,7 +2679,7 @@ bool op_yank(oparg_T *oap, bool message)
|
||||
static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
||||
{
|
||||
yankreg_T newreg; // new yank register when appending
|
||||
char_u **new_ptr;
|
||||
char **new_ptr;
|
||||
linenr_T lnum; // current line number
|
||||
size_t j;
|
||||
MotionType yank_type = oap->motion_type;
|
||||
@ -2713,7 +2713,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
||||
reg->y_size = yanklines;
|
||||
reg->y_type = yank_type; // set the yank register type
|
||||
reg->y_width = 0;
|
||||
reg->y_array = xcalloc(yanklines, sizeof(char_u *));
|
||||
reg->y_array = xcalloc(yanklines, sizeof(char *));
|
||||
reg->additional_data = NULL;
|
||||
reg->timestamp = os_time();
|
||||
|
||||
@ -2808,10 +2808,10 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
||||
if (curr != reg) { // append the new block to the old block
|
||||
new_ptr = xmalloc(sizeof(char_u *) * (curr->y_size + reg->y_size));
|
||||
for (j = 0; j < curr->y_size; j++) {
|
||||
new_ptr[j] = (char_u *)curr->y_array[j];
|
||||
new_ptr[j] = curr->y_array[j];
|
||||
}
|
||||
xfree(curr->y_array);
|
||||
curr->y_array = (char **)new_ptr;
|
||||
curr->y_array = new_ptr;
|
||||
|
||||
if (yank_type == kMTLineWise) {
|
||||
// kMTLineWise overrides kMTCharWise and kMTBlockWise
|
||||
@ -5777,7 +5777,7 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char_u *str
|
||||
|
||||
// When appending, copy the previous line and free it after.
|
||||
size_t extra = append ? STRLEN(pp[--lnum]) : 0;
|
||||
char_u *s = xmallocz(line_len + extra);
|
||||
char *s = xmallocz(line_len + extra);
|
||||
if (extra > 0) {
|
||||
memcpy(s, pp[lnum], extra);
|
||||
}
|
||||
@ -5788,7 +5788,7 @@ static void str_to_reg(yankreg_T *y_ptr, MotionType yank_type, const char_u *str
|
||||
xfree(pp[lnum]);
|
||||
append = false; // only first line is appended
|
||||
}
|
||||
pp[lnum] = s;
|
||||
pp[lnum] = (char_u *)s;
|
||||
|
||||
// Convert NULs to '\n' to prevent truncation.
|
||||
memchrsub(pp[lnum], NUL, '\n', s_len);
|
||||
@ -7120,7 +7120,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
|
||||
reg->y_type = kMTUnknown;
|
||||
}
|
||||
|
||||
reg->y_array = xcalloc((size_t)tv_list_len(lines), sizeof(char_u *));
|
||||
reg->y_array = xcalloc((size_t)tv_list_len(lines), sizeof(char *));
|
||||
reg->y_size = (size_t)tv_list_len(lines);
|
||||
reg->additional_data = NULL;
|
||||
reg->timestamp = 0;
|
||||
|
@ -8161,13 +8161,13 @@ size_t copy_option_part(char_u **option, char_u *buf, size_t maxlen, char *sep_c
|
||||
/// Return true when 'shell' has "csh" in the tail.
|
||||
int csh_like_shell(void)
|
||||
{
|
||||
return strstr((char *)path_tail(p_sh), "csh") != NULL;
|
||||
return strstr(path_tail((char *)p_sh), "csh") != NULL;
|
||||
}
|
||||
|
||||
/// Return true when 'shell' has "fish" in the tail.
|
||||
bool fish_like_shell(void)
|
||||
{
|
||||
return strstr((char *)path_tail(p_sh), "fish") != NULL;
|
||||
return strstr(path_tail((char *)p_sh), "fish") != NULL;
|
||||
}
|
||||
|
||||
/// Return the number of requested sign columns, based on current
|
||||
|
@ -888,7 +888,7 @@ void vim_get_prefix_from_exepath(char *exe_name)
|
||||
MAXPATHL * sizeof(*exe_name));
|
||||
char *path_end = (char *)path_tail_with_sep((char_u *)exe_name);
|
||||
*path_end = '\0'; // remove the trailing "nvim.exe"
|
||||
path_end = (char *)path_tail((char_u *)exe_name);
|
||||
path_end = path_tail(exe_name);
|
||||
*path_end = '\0'; // remove the trailing "bin/"
|
||||
}
|
||||
|
||||
@ -957,7 +957,7 @@ char *vim_getenv(const char *name)
|
||||
|
||||
if (vim_path != NULL) {
|
||||
// remove the file name
|
||||
char *vim_path_end = (char *)path_tail((char_u *)vim_path);
|
||||
char *vim_path_end = path_tail(vim_path);
|
||||
|
||||
// remove "doc/" from 'helpfile', if present
|
||||
if (vim_path == (char *)p_hf) {
|
||||
@ -1048,7 +1048,7 @@ size_t home_replace(const buf_T *const buf, const char_u *src, char_u *const dst
|
||||
}
|
||||
|
||||
if (buf != NULL && buf->b_help) {
|
||||
const size_t dlen = STRLCPY(dst, path_tail(src), dstlen);
|
||||
const size_t dlen = STRLCPY(dst, path_tail((char *)src), dstlen);
|
||||
return MIN(dlen, dstlen - 1);
|
||||
}
|
||||
|
||||
@ -1158,7 +1158,7 @@ char_u *home_replace_save(buf_T *buf, char_u *src) FUNC_ATTR_NONNULL_RET
|
||||
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain an environment variable name.
|
||||
char_u *get_env_name(expand_T *xp, int idx)
|
||||
char *get_env_name(expand_T *xp, int idx)
|
||||
{
|
||||
#define ENVNAMELEN 100
|
||||
// this static buffer is needed to avoid a memory leak in ExpandGeneric
|
||||
@ -1168,7 +1168,7 @@ char_u *get_env_name(expand_T *xp, int idx)
|
||||
if (envname) {
|
||||
STRLCPY(name, envname, ENVNAMELEN);
|
||||
xfree(envname);
|
||||
return name;
|
||||
return (char *)name;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
@ -1226,10 +1226,10 @@ bool os_shell_is_cmdexe(const char *sh)
|
||||
}
|
||||
if (striequal(sh, "$COMSPEC")) {
|
||||
const char *comspec = os_getenv("COMSPEC");
|
||||
return striequal("cmd.exe", (char *)path_tail((char_u *)comspec));
|
||||
return striequal("cmd.exe", path_tail(comspec));
|
||||
}
|
||||
if (striequal(sh, "cmd.exe") || striequal(sh, "cmd")) {
|
||||
return true;
|
||||
}
|
||||
return striequal("cmd.exe", (char *)path_tail((char_u *)sh));
|
||||
return striequal("cmd.exe", path_tail(sh));
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ int os_expand_wildcards(int num_pat, char_u **pat, int *num_file, char_u ***file
|
||||
}
|
||||
}
|
||||
if (shell_style == STYLE_ECHO
|
||||
&& strstr((char *)path_tail(p_sh), "sh") != NULL) {
|
||||
&& strstr(path_tail((char *)p_sh), "sh") != NULL) {
|
||||
shell_style = STYLE_VIMGLOB;
|
||||
}
|
||||
|
||||
|
@ -187,11 +187,11 @@ static void init_users(void)
|
||||
}
|
||||
|
||||
/// Given to ExpandGeneric() to obtain an user names.
|
||||
char_u *get_users(expand_T *xp, int idx)
|
||||
char *get_users(expand_T *xp, int idx)
|
||||
{
|
||||
init_users();
|
||||
if (idx < ga_users.ga_len) {
|
||||
return ((char_u **)ga_users.ga_data)[idx];
|
||||
return ((char **)ga_users.ga_data)[idx];
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -92,15 +92,15 @@ FileComparison path_full_compare(char_u *const s1, char_u *const s2, const bool
|
||||
///
|
||||
/// @return pointer just past the last path separator (empty string, if fname
|
||||
/// ends in a slash), or empty string if fname is NULL.
|
||||
char_u *path_tail(const char_u *fname)
|
||||
char *path_tail(const char *fname)
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
if (fname == NULL) {
|
||||
return (char_u *)"";
|
||||
return "";
|
||||
}
|
||||
|
||||
const char_u *tail = get_past_head(fname);
|
||||
const char_u *p = tail;
|
||||
const char *tail = (char *)get_past_head((char_u *)fname);
|
||||
const char *p = tail;
|
||||
// Find last part of path.
|
||||
while (*p != NUL) {
|
||||
if (vim_ispathsep_nocolon(*p)) {
|
||||
@ -108,7 +108,7 @@ char_u *path_tail(const char_u *fname)
|
||||
}
|
||||
MB_PTR_ADV(p);
|
||||
}
|
||||
return (char_u *)tail;
|
||||
return (char *)tail;
|
||||
}
|
||||
|
||||
/// Get pointer to tail of "fname", including path separators.
|
||||
@ -126,7 +126,7 @@ char_u *path_tail_with_sep(char_u *fname)
|
||||
|
||||
// Don't remove the '/' from "c:/file".
|
||||
char_u *past_head = get_past_head(fname);
|
||||
char_u *tail = path_tail(fname);
|
||||
char_u *tail = (char_u *)path_tail((char *)fname);
|
||||
while (tail > past_head && after_pathsep((char *)fname, (char *)tail)) {
|
||||
tail--;
|
||||
}
|
||||
@ -275,7 +275,7 @@ int vim_ispathlistsep(int c)
|
||||
/// It's done in-place.
|
||||
void shorten_dir_len(char_u *str, int trim_len)
|
||||
{
|
||||
char_u *tail = path_tail(str);
|
||||
char_u *tail = (char_u *)path_tail((char *)str);
|
||||
char_u *d = str;
|
||||
bool skip = false;
|
||||
int dirchunk_len = 0;
|
||||
@ -849,7 +849,7 @@ static void expand_path_option(char_u *curdir, garray_T *gap)
|
||||
if (curbuf->b_ffname == NULL) {
|
||||
continue;
|
||||
}
|
||||
char_u *p = path_tail(curbuf->b_ffname);
|
||||
char_u *p = (char_u *)path_tail((char *)curbuf->b_ffname);
|
||||
size_t len = (size_t)(p - curbuf->b_ffname);
|
||||
if (len + STRLEN(buf) >= MAXPATHL) {
|
||||
continue;
|
||||
@ -1375,17 +1375,18 @@ static int vim_backtick(char_u *p)
|
||||
/// @param flags EW_* flags
|
||||
static int expand_backtick(garray_T *gap, char_u *pat, int flags)
|
||||
{
|
||||
char_u *p;
|
||||
char_u *buffer;
|
||||
char *p;
|
||||
char *buffer;
|
||||
int cnt = 0;
|
||||
|
||||
// Create the command: lop off the backticks.
|
||||
char_u *cmd = vim_strnsave(pat + 1, STRLEN(pat) - 2);
|
||||
char *cmd = (char *)vim_strnsave(pat + 1, STRLEN(pat) - 2);
|
||||
|
||||
if (*cmd == '=') { // `={expr}`: Expand expression
|
||||
buffer = (char_u *)eval_to_string((char *)cmd + 1, (char **)&p, true);
|
||||
buffer = eval_to_string(cmd + 1, &p, true);
|
||||
} else {
|
||||
buffer = get_cmd_output(cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0, NULL);
|
||||
buffer = (char *)get_cmd_output((char_u *)cmd, NULL, (flags & EW_SILENT) ? kShellOptSilent : 0,
|
||||
NULL);
|
||||
}
|
||||
xfree(cmd);
|
||||
if (buffer == NULL) {
|
||||
@ -1394,16 +1395,16 @@ static int expand_backtick(garray_T *gap, char_u *pat, int flags)
|
||||
|
||||
cmd = buffer;
|
||||
while (*cmd != NUL) {
|
||||
cmd = (char_u *)skipwhite((char *)cmd); // skip over white space
|
||||
cmd = skipwhite(cmd); // skip over white space
|
||||
p = cmd;
|
||||
while (*p != NUL && *p != '\r' && *p != '\n') { // skip over entry
|
||||
++p;
|
||||
}
|
||||
// add an entry if it is not empty
|
||||
if (p > cmd) {
|
||||
char_u i = *p;
|
||||
char i = *p;
|
||||
*p = NUL;
|
||||
addfile(gap, cmd, flags);
|
||||
addfile(gap, (char_u *)cmd, flags);
|
||||
*p = i;
|
||||
++cnt;
|
||||
}
|
||||
@ -2244,7 +2245,7 @@ int match_suffix(char_u *fname)
|
||||
for (char_u *setsuf = p_su; *setsuf;) {
|
||||
setsuflen = copy_option_part(&setsuf, suf_buf, MAXSUFLEN, ".,");
|
||||
if (setsuflen == 0) {
|
||||
char_u *tail = path_tail(fname);
|
||||
char_u *tail = (char_u *)path_tail((char *)fname);
|
||||
|
||||
// empty entry: match name without a '.'
|
||||
if (vim_strchr(tail, '.') == NULL) {
|
||||
|
@ -3104,7 +3104,7 @@ static void qf_list_entry(qfline_T *qfp, int qf_idx, bool cursel)
|
||||
&& (buf = buflist_findnr(qfp->qf_fnum)) != NULL) {
|
||||
fname = (char *)buf->b_fname;
|
||||
if (qfp->qf_type == 1) { // :helpgrep
|
||||
fname = (char *)path_tail((char_u *)fname);
|
||||
fname = path_tail(fname);
|
||||
}
|
||||
}
|
||||
if (fname == NULL) {
|
||||
@ -4038,7 +4038,7 @@ static int qf_buf_add_line(qf_list_T *qfl, buf_T *buf, linenr_T lnum, const qfli
|
||||
&& (errbuf = buflist_findnr(qfp->qf_fnum)) != NULL
|
||||
&& errbuf->b_fname != NULL) {
|
||||
if (qfp->qf_type == 1) { // :helpgrep
|
||||
STRLCPY(IObuff, path_tail(errbuf->b_fname), IOSIZE);
|
||||
STRLCPY(IObuff, path_tail((char *)errbuf->b_fname), IOSIZE);
|
||||
} else {
|
||||
// Shorten the file name if not done already.
|
||||
// For optimization, do this only for the first entry in a
|
||||
@ -5740,7 +5740,7 @@ static buf_T *load_dummy_buffer(char *fname, char *dirname_start, char *resultin
|
||||
curbuf->b_flags &= ~BF_DUMMY;
|
||||
|
||||
newbuf_to_wipe.br_buf = NULL;
|
||||
readfile_result = readfile((char_u *)fname, NULL, (linenr_T)0, (linenr_T)0,
|
||||
readfile_result = readfile(fname, NULL, (linenr_T)0, (linenr_T)0,
|
||||
(linenr_T)MAXLNUM, NULL,
|
||||
READ_NEW | READ_DUMMY, false);
|
||||
newbuf->b_locked--;
|
||||
@ -6887,7 +6887,7 @@ static int cbuffer_process_args(exarg_T *eap, buf_T **bufp, linenr_T *line1, lin
|
||||
|
||||
if (*eap->arg == NUL) {
|
||||
buf = curbuf;
|
||||
} else if (*skipwhite((char *)skipdigits((char_u *)eap->arg)) == NUL) {
|
||||
} else if (*skipwhite(skipdigits(eap->arg)) == NUL) {
|
||||
buf = buflist_findnr(atoi(eap->arg));
|
||||
}
|
||||
|
||||
|
@ -1742,33 +1742,33 @@ static char_u *get_nth_sign_group_name(int idx)
|
||||
|
||||
/// Function given to ExpandGeneric() to obtain the sign command
|
||||
/// expansion.
|
||||
char_u *get_sign_name(expand_T *xp, int idx)
|
||||
char *get_sign_name(expand_T *xp, int idx)
|
||||
{
|
||||
switch (expand_what) {
|
||||
case EXP_SUBCMD:
|
||||
return (char_u *)cmds[idx];
|
||||
return cmds[idx];
|
||||
case EXP_DEFINE: {
|
||||
char *define_arg[] = { "culhl=", "icon=", "linehl=", "numhl=", "text=", "texthl=",
|
||||
NULL };
|
||||
return (char_u *)define_arg[idx];
|
||||
return define_arg[idx];
|
||||
}
|
||||
case EXP_PLACE: {
|
||||
char *place_arg[] = { "line=", "name=", "group=", "priority=", "file=",
|
||||
"buffer=", NULL };
|
||||
return (char_u *)place_arg[idx];
|
||||
return place_arg[idx];
|
||||
}
|
||||
case EXP_LIST: {
|
||||
char *list_arg[] = { "group=", "file=", "buffer=", NULL };
|
||||
return (char_u *)list_arg[idx];
|
||||
return list_arg[idx];
|
||||
}
|
||||
case EXP_UNPLACE: {
|
||||
char *unplace_arg[] = { "group=", "file=", "buffer=", NULL };
|
||||
return (char_u *)unplace_arg[idx];
|
||||
return unplace_arg[idx];
|
||||
}
|
||||
case EXP_SIGN_NAMES:
|
||||
return get_nth_sign_name(idx);
|
||||
return (char *)get_nth_sign_name(idx);
|
||||
case EXP_SIGN_GROUPS:
|
||||
return get_nth_sign_group_name(idx);
|
||||
return (char *)get_nth_sign_group_name(idx);
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ size_t spell_check(win_T *wp, char_u *ptr, hlf_T *attrp, int *capcol, bool docou
|
||||
} else if (*ptr == '0' && (ptr[1] == 'x' || ptr[1] == 'X')) {
|
||||
mi.mi_end = skiphex(ptr + 2);
|
||||
} else {
|
||||
mi.mi_end = skipdigits(ptr);
|
||||
mi.mi_end = (char_u *)skipdigits((char *)ptr);
|
||||
}
|
||||
nrlen = (size_t)(mi.mi_end - ptr);
|
||||
}
|
||||
@ -1656,7 +1656,7 @@ void spell_cat_line(char_u *buf, char_u *line, int maxlen)
|
||||
// "lang" must be the language without the region: e.g., "en".
|
||||
static void spell_load_lang(char_u *lang)
|
||||
{
|
||||
char_u fname_enc[85];
|
||||
char fname_enc[85];
|
||||
int r;
|
||||
spelload_T sl;
|
||||
int round;
|
||||
@ -2105,7 +2105,7 @@ char *did_set_spelllang(win_T *wp)
|
||||
filename = true;
|
||||
|
||||
// Locate a region and remove it from the file name.
|
||||
p = vim_strchr(path_tail(lang), '_');
|
||||
p = vim_strchr((char_u *)path_tail((char *)lang), '_');
|
||||
if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2])
|
||||
&& !ASCII_ISALPHA(p[3])) {
|
||||
STRLCPY(region_cp, p + 1, 3);
|
||||
@ -2247,7 +2247,7 @@ char *did_set_spelllang(win_T *wp)
|
||||
if (round == 0) {
|
||||
STRCPY(lang, "internal wordlist");
|
||||
} else {
|
||||
STRLCPY(lang, path_tail(spf_name), MAXWLEN + 1);
|
||||
STRLCPY(lang, path_tail((char *)spf_name), MAXWLEN + 1);
|
||||
p = vim_strchr(lang, '.');
|
||||
if (p != NULL) {
|
||||
*p = NUL; // truncate at ".encoding.add"
|
||||
@ -5652,12 +5652,12 @@ static void make_case_word(char_u *fword, char_u *cword, int flags)
|
||||
static bool similar_chars(slang_T *slang, int c1, int c2)
|
||||
{
|
||||
int m1, m2;
|
||||
char_u buf[MB_MAXBYTES + 1];
|
||||
char buf[MB_MAXBYTES + 1];
|
||||
hashitem_T *hi;
|
||||
|
||||
if (c1 >= 256) {
|
||||
buf[utf_char2bytes(c1, (char *)buf)] = 0;
|
||||
hi = hash_find(&slang->sl_map_hash, buf);
|
||||
hi = hash_find(&slang->sl_map_hash, (char_u *)buf);
|
||||
if (HASHITEM_EMPTY(hi)) {
|
||||
m1 = 0;
|
||||
} else {
|
||||
@ -5672,7 +5672,7 @@ static bool similar_chars(slang_T *slang, int c1, int c2)
|
||||
|
||||
if (c2 >= 256) {
|
||||
buf[utf_char2bytes(c2, (char *)buf)] = 0;
|
||||
hi = hash_find(&slang->sl_map_hash, buf);
|
||||
hi = hash_find(&slang->sl_map_hash, (char_u *)buf);
|
||||
if (HASHITEM_EMPTY(hi)) {
|
||||
m2 = 0;
|
||||
} else {
|
||||
@ -6871,20 +6871,20 @@ void ex_spellinfo(exarg_T *eap)
|
||||
// ":spelldump"
|
||||
void ex_spelldump(exarg_T *eap)
|
||||
{
|
||||
char_u *spl;
|
||||
char *spl;
|
||||
long dummy;
|
||||
|
||||
if (no_spell_checking(curwin)) {
|
||||
return;
|
||||
}
|
||||
get_option_value("spl", &dummy, (char **)&spl, OPT_LOCAL);
|
||||
get_option_value("spl", &dummy, &spl, OPT_LOCAL);
|
||||
|
||||
// Create a new empty buffer in a new window.
|
||||
do_cmdline_cmd("new");
|
||||
|
||||
// enable spelling locally in the new window
|
||||
set_option_value("spell", true, "", OPT_LOCAL);
|
||||
set_option_value("spl", dummy, (char *)spl, OPT_LOCAL);
|
||||
set_option_value("spl", dummy, spl, OPT_LOCAL);
|
||||
xfree(spl);
|
||||
|
||||
if (!buf_is_empty(curbuf)) {
|
||||
|
@ -576,7 +576,7 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
|
||||
char_u *p;
|
||||
int n;
|
||||
int len;
|
||||
char_u *save_sourcing_name = sourcing_name;
|
||||
char_u *save_sourcing_name = (char_u *)sourcing_name;
|
||||
linenr_T save_sourcing_lnum = sourcing_lnum;
|
||||
slang_T *lp = NULL;
|
||||
int c = 0;
|
||||
@ -606,13 +606,13 @@ slang_T *spell_load_file(char_u *fname, char_u *lang, slang_T *old_lp, bool sile
|
||||
lp->sl_fname = vim_strsave(fname);
|
||||
|
||||
// Check for .add.spl.
|
||||
lp->sl_add = strstr((char *)path_tail(fname), SPL_FNAME_ADD) != NULL;
|
||||
lp->sl_add = strstr(path_tail((char *)fname), SPL_FNAME_ADD) != NULL;
|
||||
} else {
|
||||
lp = old_lp;
|
||||
}
|
||||
|
||||
// Set sourcing_name, so that error messages mention the file name.
|
||||
sourcing_name = fname;
|
||||
sourcing_name = (char *)fname;
|
||||
sourcing_lnum = 0;
|
||||
|
||||
// <HEADER>: <fileID>
|
||||
@ -810,7 +810,7 @@ endOK:
|
||||
if (fd != NULL) {
|
||||
fclose(fd);
|
||||
}
|
||||
sourcing_name = save_sourcing_name;
|
||||
sourcing_name = (char *)save_sourcing_name;
|
||||
sourcing_lnum = save_sourcing_lnum;
|
||||
|
||||
return lp;
|
||||
@ -2252,7 +2252,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
|
||||
}
|
||||
} else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) {
|
||||
// Don't use the first rule if it is a number.
|
||||
if (compflags != NULL || *skipdigits(items[1]) != NUL) {
|
||||
if (compflags != NULL || *skipdigits((char *)items[1]) != NUL) {
|
||||
// Concatenate this string to previously defined ones,
|
||||
// using a slash to separate them.
|
||||
l = (int)STRLEN(items[1]) + 1;
|
||||
@ -4407,7 +4407,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
|
||||
// Also skip this for an .add.spl file, the main spell file must contain
|
||||
// the table (avoids that it conflicts). File is shorter too.
|
||||
if (!spin->si_ascii && !spin->si_add) {
|
||||
char_u folchars[128 * 8];
|
||||
char folchars[128 * 8];
|
||||
int flags;
|
||||
|
||||
putc(SN_CHARFLAGS, fd); // <sectionID>
|
||||
@ -5326,19 +5326,19 @@ static void mkspell(int fcount, char_u **fnames, bool ascii, bool over_write, bo
|
||||
}
|
||||
|
||||
// Check for .ascii.spl.
|
||||
if (strstr((char *)path_tail(wfname), SPL_FNAME_ASCII) != NULL) {
|
||||
if (strstr(path_tail((char *)wfname), SPL_FNAME_ASCII) != NULL) {
|
||||
spin.si_ascii = true;
|
||||
}
|
||||
|
||||
// Check for .add.spl.
|
||||
if (strstr((char *)path_tail(wfname), SPL_FNAME_ADD) != NULL) {
|
||||
if (strstr(path_tail((char *)wfname), SPL_FNAME_ADD) != NULL) {
|
||||
spin.si_add = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (incount <= 0) {
|
||||
emsg(_(e_invarg)); // need at least output and input names
|
||||
} else if (vim_strchr(path_tail(wfname), '_') != NULL) {
|
||||
} else if (vim_strchr((char_u *)path_tail((char *)wfname), '_') != NULL) {
|
||||
emsg(_("E751: Output file name must not have region name"));
|
||||
} else if (incount > MAXREGIONS) {
|
||||
semsg(_("E754: Only up to %d regions supported"), MAXREGIONS);
|
||||
@ -5363,7 +5363,7 @@ static void mkspell(int fcount, char_u **fnames, bool ascii, bool over_write, bo
|
||||
|
||||
if (incount > 1) {
|
||||
len = (int)STRLEN(innames[i]);
|
||||
if (STRLEN(path_tail(innames[i])) < 5
|
||||
if (STRLEN(path_tail((char *)innames[i])) < 5
|
||||
|| innames[i][len - 3] != '_') {
|
||||
semsg(_("E755: Invalid region in %s"), innames[i]);
|
||||
goto theend;
|
||||
@ -5736,7 +5736,7 @@ static void init_spellfile(void)
|
||||
->lp_slang->sl_fname;
|
||||
vim_snprintf((char *)buf + l, MAXPATHL - l, ".%s.add",
|
||||
((fname != NULL
|
||||
&& strstr((char *)path_tail(fname), ".ascii.") != NULL)
|
||||
&& strstr(path_tail((char *)fname), ".ascii.") != NULL)
|
||||
? "ascii"
|
||||
: (const char *)spell_enc()));
|
||||
set_option_value("spellfile", 0L, (const char *)buf, OPT_LOCAL);
|
||||
@ -5873,7 +5873,7 @@ static void set_map_str(slang_T *lp, char_u *map)
|
||||
if (c >= 256) {
|
||||
int cl = utf_char2len(c);
|
||||
int headcl = utf_char2len(headc);
|
||||
char_u *b;
|
||||
char *b;
|
||||
hash_T hash;
|
||||
hashitem_T *hi;
|
||||
|
||||
@ -5882,10 +5882,10 @@ static void set_map_str(slang_T *lp, char_u *map)
|
||||
b[cl] = NUL;
|
||||
utf_char2bytes(headc, (char *)b + cl + 1);
|
||||
b[cl + 1 + headcl] = NUL;
|
||||
hash = hash_hash(b);
|
||||
hash = hash_hash((char_u *)b);
|
||||
hi = hash_lookup(&lp->sl_map_hash, (const char *)b, STRLEN(b), hash);
|
||||
if (HASHITEM_EMPTY(hi)) {
|
||||
hash_add_item(&lp->sl_map_hash, hi, b, hash);
|
||||
hash_add_item(&lp->sl_map_hash, hi, (char_u *)b, hash);
|
||||
} else {
|
||||
// This should have been checked when generating the .spl
|
||||
// file.
|
||||
|
@ -5303,8 +5303,8 @@ static void syn_cmd_sync(exarg_T *eap, int syncing)
|
||||
/// @return FAIL for some error, OK for success.
|
||||
static int get_id_list(char_u **const arg, const int keylen, int16_t **const list, const bool skip)
|
||||
{
|
||||
char_u *p = NULL;
|
||||
char_u *end;
|
||||
char *p = NULL;
|
||||
char *end;
|
||||
int total_count = 0;
|
||||
int16_t *retval = NULL;
|
||||
regmatch_T regmatch;
|
||||
@ -5318,12 +5318,12 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
|
||||
// grow when a regexp is used. In that case round 1 is done once again.
|
||||
for (int round = 1; round <= 2; round++) {
|
||||
// skip "contains"
|
||||
p = (char_u *)skipwhite((char *)(*arg) + keylen);
|
||||
p = skipwhite((char *)(*arg) + keylen);
|
||||
if (*p != '=') {
|
||||
semsg(_("E405: Missing equal sign: %s"), *arg);
|
||||
break;
|
||||
}
|
||||
p = (char_u *)skipwhite((char *)p + 1);
|
||||
p = skipwhite(p + 1);
|
||||
if (ends_excmd(*p)) {
|
||||
semsg(_("E406: Empty argument: %s"), *arg);
|
||||
break;
|
||||
@ -5427,11 +5427,11 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
|
||||
}
|
||||
++count;
|
||||
}
|
||||
p = (char_u *)skipwhite((char *)end);
|
||||
p = skipwhite(end);
|
||||
if (*p != ',') {
|
||||
break;
|
||||
}
|
||||
p = (char_u *)skipwhite((char *)p + 1); // skip comma in between arguments
|
||||
p = skipwhite(p + 1); // skip comma in between arguments
|
||||
} while (!ends_excmd(*p));
|
||||
if (failed) {
|
||||
break;
|
||||
@ -5443,7 +5443,7 @@ static int get_id_list(char_u **const arg, const int keylen, int16_t **const lis
|
||||
}
|
||||
}
|
||||
|
||||
*arg = p;
|
||||
*arg = (char_u *)p;
|
||||
if (failed || retval == NULL) {
|
||||
xfree(retval);
|
||||
return FAIL;
|
||||
@ -5763,26 +5763,26 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
|
||||
* Function given to ExpandGeneric() to obtain the list syntax names for
|
||||
* expansion.
|
||||
*/
|
||||
char_u *get_syntax_name(expand_T *xp, int idx)
|
||||
char *get_syntax_name(expand_T *xp, int idx)
|
||||
{
|
||||
switch (expand_what) {
|
||||
case EXP_SUBCMD:
|
||||
return (char_u *)subcommands[idx].name;
|
||||
return subcommands[idx].name;
|
||||
case EXP_CASE: {
|
||||
static char *case_args[] = { "match", "ignore", NULL };
|
||||
return (char_u *)case_args[idx];
|
||||
return case_args[idx];
|
||||
}
|
||||
case EXP_SPELL: {
|
||||
static char *spell_args[] =
|
||||
{ "toplevel", "notoplevel", "default", NULL };
|
||||
return (char_u *)spell_args[idx];
|
||||
return spell_args[idx];
|
||||
}
|
||||
case EXP_SYNC: {
|
||||
static char *sync_args[] =
|
||||
{ "ccomment", "clear", "fromstart",
|
||||
"linebreaks=", "linecont", "lines=", "match",
|
||||
"maxlines=", "minlines=", "region", NULL };
|
||||
return (char_u *)sync_args[idx];
|
||||
return sync_args[idx];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -5965,17 +5965,17 @@ static void syntime_clear(void)
|
||||
* Function given to ExpandGeneric() to obtain the possible arguments of the
|
||||
* ":syntime {on,off,clear,report}" command.
|
||||
*/
|
||||
char_u *get_syntime_arg(expand_T *xp, int idx)
|
||||
char *get_syntime_arg(expand_T *xp, int idx)
|
||||
{
|
||||
switch (idx) {
|
||||
case 0:
|
||||
return (char_u *)"on";
|
||||
return "on";
|
||||
case 1:
|
||||
return (char_u *)"off";
|
||||
return "off";
|
||||
case 2:
|
||||
return (char_u *)"clear";
|
||||
return "clear";
|
||||
case 3:
|
||||
return (char_u *)"report";
|
||||
return "report";
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2369,7 +2369,7 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
|
||||
}
|
||||
++tnp->tn_hf_idx;
|
||||
STRCPY(buf, p_hf);
|
||||
STRCPY(path_tail(buf), "tags");
|
||||
STRCPY(path_tail((char *)buf), "tags");
|
||||
#ifdef BACKSLASH_IN_FILENAME
|
||||
slash_adjust(buf);
|
||||
#endif
|
||||
@ -2428,7 +2428,7 @@ int get_tagfname(tagname_T *tnp, int first, char_u *buf)
|
||||
r_ptr = vim_findfile_stopdir(buf);
|
||||
// move the filename one char forward and truncate the
|
||||
// filepath with a NUL
|
||||
filename = path_tail(buf);
|
||||
filename = (char_u *)path_tail((char *)buf);
|
||||
STRMOVE(filename + 1, filename);
|
||||
*filename++ = NUL;
|
||||
|
||||
@ -2715,7 +2715,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
|
||||
* autocommand event (e.g., http://sys/file).
|
||||
*/
|
||||
if (!os_path_exists(fname)
|
||||
&& !has_autocmd(EVENT_BUFREADCMD, fname,
|
||||
&& !has_autocmd(EVENT_BUFREADCMD, (char *)fname,
|
||||
NULL)) {
|
||||
retval = NOTAGFILE;
|
||||
xfree(nofile_fname);
|
||||
@ -2997,7 +2997,7 @@ static char_u *expand_tag_fname(char_u *fname, char_u *const tag_fname, const bo
|
||||
char_u *retval;
|
||||
if ((p_tr || curbuf->b_help)
|
||||
&& !vim_isAbsName(fname)
|
||||
&& (p = path_tail(tag_fname)) != tag_fname) {
|
||||
&& (p = (char_u *)path_tail((char *)tag_fname)) != tag_fname) {
|
||||
retval = xmalloc(MAXPATHL);
|
||||
STRCPY(retval, tag_fname);
|
||||
STRLCPY(retval + (p - tag_fname), fname,
|
||||
@ -3054,7 +3054,7 @@ static int find_extra(char_u **pp)
|
||||
// Repeat for addresses separated with ';'
|
||||
for (;;) {
|
||||
if (ascii_isdigit(*str)) {
|
||||
str = skipdigits(str + 1);
|
||||
str = (char_u *)skipdigits((char *)str + 1);
|
||||
} else if (*str == '/' || *str == '?') {
|
||||
str = skip_regexp(str + 1, *str, false, NULL);
|
||||
if (*str != first_char) {
|
||||
|
@ -702,7 +702,7 @@ char *u_get_undo_file_name(const char *const buf_ffname, const bool reading)
|
||||
const size_t ffname_len = strlen(ffname);
|
||||
undo_file_name = xmalloc(ffname_len + 6);
|
||||
memmove(undo_file_name, ffname, ffname_len + 1);
|
||||
char *const tail = (char *)path_tail((char_u *)undo_file_name);
|
||||
char *const tail = path_tail(undo_file_name);
|
||||
const size_t tail_len = strlen(tail);
|
||||
memmove(tail + 1, tail, tail_len + 1);
|
||||
*tail = '.';
|
||||
|
@ -6477,7 +6477,7 @@ char_u *file_name_at_cursor(int options, long count, linenr_T *file_lnum)
|
||||
char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u *rel_fname,
|
||||
linenr_T *file_lnum)
|
||||
{
|
||||
char_u *ptr;
|
||||
char *ptr;
|
||||
size_t len;
|
||||
bool in_type = true;
|
||||
bool is_url = false;
|
||||
@ -6485,7 +6485,7 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
|
||||
/*
|
||||
* search forward for what could be the start of a file name
|
||||
*/
|
||||
ptr = line + col;
|
||||
ptr = (char *)line + col;
|
||||
while (*ptr != NUL && !vim_isfilec(*ptr)) {
|
||||
MB_PTR_ADV(ptr);
|
||||
}
|
||||
@ -6500,11 +6500,10 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
|
||||
* Search backward for first char of the file name.
|
||||
* Go one char back to ":" before "//" even when ':' is not in 'isfname'.
|
||||
*/
|
||||
while (ptr > line) {
|
||||
if ((len = (size_t)(utf_head_off(line, ptr - 1))) > 0) {
|
||||
while ((char_u *)ptr > line) {
|
||||
if ((len = (size_t)(utf_head_off(line, (char_u *)ptr - 1))) > 0) {
|
||||
ptr -= len + 1;
|
||||
} else if (vim_isfilec(ptr[-1])
|
||||
|| ((options & FNAME_HYP) && path_is_url((char *)ptr - 1))) {
|
||||
} else if (vim_isfilec(ptr[-1]) || ((options & FNAME_HYP) && path_is_url(ptr - 1))) {
|
||||
ptr--;
|
||||
} else {
|
||||
break;
|
||||
@ -6517,13 +6516,13 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
|
||||
*/
|
||||
len = 0;
|
||||
while (vim_isfilec(ptr[len]) || (ptr[len] == '\\' && ptr[len + 1] == ' ')
|
||||
|| ((options & FNAME_HYP) && path_is_url((char *)ptr + len))
|
||||
|| ((options & FNAME_HYP) && path_is_url(ptr + len))
|
||||
|| (is_url && vim_strchr((char_u *)":?&=", ptr[len]) != NULL)) {
|
||||
// After type:// we also include :, ?, & and = as valid characters, so that
|
||||
// http://google.com:8080?q=this&that=ok works.
|
||||
if ((ptr[len] >= 'A' && ptr[len] <= 'Z')
|
||||
|| (ptr[len] >= 'a' && ptr[len] <= 'z')) {
|
||||
if (in_type && path_is_url((char *)ptr + len + 1)) {
|
||||
if (in_type && path_is_url(ptr + len + 1)) {
|
||||
is_url = true;
|
||||
}
|
||||
} else {
|
||||
@ -6534,7 +6533,7 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
|
||||
// Skip over the "\" in "\ ".
|
||||
++len;
|
||||
}
|
||||
len += (size_t)(utfc_ptr2len((char *)ptr + len));
|
||||
len += (size_t)(utfc_ptr2len(ptr + len));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -6547,7 +6546,7 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
|
||||
}
|
||||
|
||||
if (file_lnum != NULL) {
|
||||
char_u *p;
|
||||
char *p;
|
||||
const char *line_english = " line ";
|
||||
const char *line_transl = _(line_msg);
|
||||
|
||||
@ -6560,20 +6559,20 @@ char_u *file_name_in_line(char_u *line, int col, int options, long count, char_u
|
||||
} else if (STRNCMP(p, line_transl, STRLEN(line_transl)) == 0) {
|
||||
p += STRLEN(line_transl);
|
||||
} else {
|
||||
p = (char_u *)skipwhite((char *)p);
|
||||
p = skipwhite(p);
|
||||
}
|
||||
if (*p != NUL) {
|
||||
if (!isdigit(*p)) {
|
||||
p++; // skip the separator
|
||||
}
|
||||
p = (char_u *)skipwhite((char *)p);
|
||||
p = skipwhite(p);
|
||||
if (isdigit(*p)) {
|
||||
*file_lnum = getdigits_long(&p, false, 0);
|
||||
*file_lnum = getdigits_long((char_u **)&p, false, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return find_file_name_in_path(ptr, len, options, count, rel_fname);
|
||||
return find_file_name_in_path((char_u *)ptr, len, options, count, rel_fname);
|
||||
}
|
||||
|
||||
/// Add or remove a status line from window(s), according to the
|
||||
|
Loading…
Reference in New Issue
Block a user