Merge pull request #2619 from Pyrohh/char_u-to-char

[RDY] Remove char_u (6)
This commit is contained in:
Michael Reed 2015-05-13 15:31:40 -04:00
commit e888c479f3
32 changed files with 341 additions and 371 deletions

View File

@ -41,7 +41,7 @@ void vim_command(String str, Error *err)
{ {
// Run the command // Run the command
try_start(); try_start();
do_cmdline_cmd((char_u *) str.data); do_cmdline_cmd(str.data);
update_screen(VALID); update_screen(VALID);
try_end(err); try_end(err);
} }
@ -124,9 +124,9 @@ String vim_replace_termcodes(String str, Boolean from_part, Boolean do_lt,
String vim_command_output(String str, Error *err) String vim_command_output(String str, Error *err)
{ {
do_cmdline_cmd((char_u *)"redir => v:command_output"); do_cmdline_cmd("redir => v:command_output");
vim_command(str, err); vim_command(str, err);
do_cmdline_cmd((char_u *)"redir END"); do_cmdline_cmd("redir END");
if (err->set) { if (err->set) {
return (String) STRING_INIT; return (String) STRING_INIT;

View File

@ -778,17 +778,17 @@ do_bufdel (
if (deleted == 1) if (deleted == 1)
MSG(_("1 buffer unloaded")); MSG(_("1 buffer unloaded"));
else else
smsg((char_u *)_("%d buffers unloaded"), deleted); smsg(_("%d buffers unloaded"), deleted);
} else if (command == DOBUF_DEL) { } else if (command == DOBUF_DEL) {
if (deleted == 1) if (deleted == 1)
MSG(_("1 buffer deleted")); MSG(_("1 buffer deleted"));
else else
smsg((char_u *)_("%d buffers deleted"), deleted); smsg(_("%d buffers deleted"), deleted);
} else { } else {
if (deleted == 1) if (deleted == 1)
MSG(_("1 buffer wiped out")); MSG(_("1 buffer wiped out"));
else else
smsg((char_u *)_("%d buffers wiped out"), deleted); smsg(_("%d buffers wiped out"), deleted);
} }
} }
} }

View File

@ -978,7 +978,7 @@ void ex_diffpatch(exarg_T *eap)
// Do filetype detection with the new name. // Do filetype detection with the new name.
if (au_has_group((char_u *)"filetypedetect")) { if (au_has_group((char_u *)"filetypedetect")) {
do_cmdline_cmd((char_u *)":doau filetypedetect BufRead"); do_cmdline_cmd(":doau filetypedetect BufRead");
} }
} }
} }
@ -1087,7 +1087,7 @@ void diff_win_options(win_T *wp, int addbuf)
// make sure topline is not halfway through a fold // make sure topline is not halfway through a fold
changed_window_setting_win(wp); changed_window_setting_win(wp);
if (vim_strchr(p_sbo, 'h') == NULL) { if (vim_strchr(p_sbo, 'h') == NULL) {
do_cmdline_cmd((char_u *)"set sbo+=hor"); do_cmdline_cmd("set sbo+=hor");
} }
// Saved the current values, to be restored in ex_diffoff(). // Saved the current values, to be restored in ex_diffoff().
@ -1173,7 +1173,7 @@ void ex_diffoff(exarg_T *eap)
// Remove "hor" from from 'scrollopt' if there are no diff windows left. // Remove "hor" from from 'scrollopt' if there are no diff windows left.
if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) { if (!diffwin && (vim_strchr(p_sbo, 'h') != NULL)) {
do_cmdline_cmd((char_u *)"set sbo-=hor"); do_cmdline_cmd("set sbo-=hor");
} }
} }

View File

@ -1743,7 +1743,7 @@ char_u* keymap_init(void)
// Stop any active keymap and clear the table. Also remove // Stop any active keymap and clear the table. Also remove
// b:keymap_name, as no keymap is active now. // b:keymap_name, as no keymap is active now.
keymap_unload(); keymap_unload();
do_cmdline_cmd((char_u *)"unlet! b:keymap_name"); do_cmdline_cmd("unlet! b:keymap_name");
} else { } else {
char *buf; char *buf;
size_t buflen; size_t buflen;

View File

@ -1049,9 +1049,9 @@ doESCkey:
* cursor. */ * cursor. */
if (bt_quickfix(curbuf) && c == CAR) { if (bt_quickfix(curbuf) && c == CAR) {
if (curwin->w_llist_ref == NULL) /* quickfix window */ if (curwin->w_llist_ref == NULL) /* quickfix window */
do_cmdline_cmd((char_u *)".cc"); do_cmdline_cmd(".cc");
else /* location list window */ else /* location list window */
do_cmdline_cmd((char_u *)".ll"); do_cmdline_cmd(".ll");
break; break;
} }
if (cmdwin_type != 0) { if (cmdwin_type != 0) {
@ -2342,7 +2342,7 @@ void ins_compl_show_pum(void)
return; return;
/* Dirty hard-coded hack: remove any matchparen highlighting. */ /* Dirty hard-coded hack: remove any matchparen highlighting. */
do_cmdline_cmd((char_u *)"if exists('g:loaded_matchparen')|3match none|endif"); do_cmdline_cmd("if exists('g:loaded_matchparen')|3match none|endif");
/* Update the screen before drawing the popup menu over it. */ /* Update the screen before drawing the popup menu over it. */
update_screen(0); update_screen(0);

View File

@ -19105,7 +19105,7 @@ call_user_func (
++no_wait_return; ++no_wait_return;
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)_("calling %s"), sourcing_name); smsg(_("calling %s"), sourcing_name);
if (p_verbose >= 14) { if (p_verbose >= 14) {
char_u buf[MSG_BUF_LEN]; char_u buf[MSG_BUF_LEN];
char_u numbuf2[NUMBUFLEN]; char_u numbuf2[NUMBUFLEN];
@ -19203,9 +19203,9 @@ call_user_func (
verbose_enter_scroll(); verbose_enter_scroll();
if (aborting()) if (aborting())
smsg((char_u *)_("%s aborted"), sourcing_name); smsg(_("%s aborted"), sourcing_name);
else if (fc->rettv->v_type == VAR_NUMBER) else if (fc->rettv->v_type == VAR_NUMBER)
smsg((char_u *)_("%s returning #%" PRId64 ""), smsg(_("%s returning #%" PRId64 ""),
sourcing_name, (int64_t)fc->rettv->vval.v_number); sourcing_name, (int64_t)fc->rettv->vval.v_number);
else { else {
char_u buf[MSG_BUF_LEN]; char_u buf[MSG_BUF_LEN];
@ -19224,7 +19224,7 @@ call_user_func (
trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN); trunc_string(s, buf, MSG_BUF_CLEN, MSG_BUF_LEN);
s = buf; s = buf;
} }
smsg((char_u *)_("%s returning %s"), sourcing_name, s); smsg(_("%s returning %s"), sourcing_name, s);
xfree(tofree); xfree(tofree);
} }
} }
@ -19245,7 +19245,7 @@ call_user_func (
++no_wait_return; ++no_wait_return;
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)_("continuing in %s"), sourcing_name); smsg(_("continuing in %s"), sourcing_name);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ msg_puts((char_u *)"\n"); /* don't overwrite this either */
verbose_leave_scroll(); verbose_leave_scroll();

View File

@ -748,7 +748,7 @@ int do_move(linenr_T line1, linenr_T line2, linenr_T dest)
if (num_lines == 1) if (num_lines == 1)
MSG(_("1 line moved")); MSG(_("1 line moved"));
else else
smsg((char_u *)_("%" PRId64 " lines moved"), (int64_t)num_lines); smsg(_("%" PRId64 " lines moved"), (int64_t)num_lines);
} }
/* /*
@ -1439,7 +1439,7 @@ read_viminfo (
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Reading viminfo file \"%s\"%s%s%s"), smsg(_("Reading viminfo file \"%s\"%s%s%s"),
fname, fname,
(flags & VIF_WANT_INFO) ? _(" info") : "", (flags & VIF_WANT_INFO) ? _(" info") : "",
(flags & VIF_WANT_MARKS) ? _(" marks") : "", (flags & VIF_WANT_MARKS) ? _(" marks") : "",
@ -1616,7 +1616,7 @@ void write_viminfo(char_u *file, int forceit)
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Writing viminfo file \"%s\""), fname); smsg(_("Writing viminfo file \"%s\""), fname);
verbose_leave(); verbose_leave();
} }
@ -3899,7 +3899,7 @@ void do_sub(exarg_T *eap)
/* write message same highlighting as for /* write message same highlighting as for
* wait_return */ * wait_return */
smsg_attr(hl_attr(HLF_R), smsg_attr(hl_attr(HLF_R),
(char_u *)_("replace with %s (y/n/a/q/l/^E/^Y)?"), sub); _("replace with %s (y/n/a/q/l/^E/^Y)?"), sub);
msg_no_more = FALSE; msg_no_more = FALSE;
msg_scroll = i; msg_scroll = i;
showruler(TRUE); showruler(TRUE);
@ -4440,9 +4440,9 @@ void ex_global(exarg_T *eap)
MSG(_(e_interr)); MSG(_(e_interr));
else if (ndone == 0) { else if (ndone == 0) {
if (type == 'v') if (type == 'v')
smsg((char_u *)_("Pattern found in every line: %s"), pat); smsg(_("Pattern found in every line: %s"), pat);
else else
smsg((char_u *)_("Pattern not found: %s"), pat); smsg(_("Pattern not found: %s"), pat);
} else } else
global_exe(cmd); global_exe(cmd);
@ -4682,7 +4682,7 @@ void ex_help(exarg_T *eap)
* Try to open the file specified by the "helpfile" option. * Try to open the file specified by the "helpfile" option.
*/ */
if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) { if ((helpfd = mch_fopen((char *)p_hf, READBIN)) == NULL) {
smsg((char_u *)_("Sorry, help file \"%s\" not found"), p_hf); smsg(_("Sorry, help file \"%s\" not found"), p_hf);
goto erret; goto erret;
} }
fclose(helpfd); fclose(helpfd);
@ -5252,7 +5252,7 @@ void fix_help_buffer(void)
*/ */
void ex_exusage(exarg_T *eap) void ex_exusage(exarg_T *eap)
{ {
do_cmdline_cmd((char_u *)"help ex-cmd-index"); do_cmdline_cmd("help ex-cmd-index");
} }
/* /*
@ -5260,7 +5260,7 @@ void ex_exusage(exarg_T *eap)
*/ */
void ex_viusage(exarg_T *eap) void ex_viusage(exarg_T *eap)
{ {
do_cmdline_cmd((char_u *)"help normal-index"); do_cmdline_cmd("help normal-index");
} }
@ -5973,11 +5973,9 @@ void ex_sign(exarg_T *eap)
beginline(BL_WHITE); beginline(BL_WHITE);
} }
else else
{ /* ... not currently in a window */ { // ... not currently in a window
char_u *cmd; char *cmd = xmalloc(STRLEN(buf->b_fname) + 25);
sprintf(cmd, "e +%" PRId64 " %s",
cmd = xmalloc(STRLEN(buf->b_fname) + 25);
sprintf((char *)cmd, "e +%" PRId64 " %s",
(int64_t)lnum, buf->b_fname); (int64_t)lnum, buf->b_fname);
do_cmdline_cmd(cmd); do_cmdline_cmd(cmd);
xfree(cmd); xfree(cmd);
@ -6040,7 +6038,7 @@ static void sign_list_defined(sign_T *sp)
{ {
char_u *p; char_u *p;
smsg((char_u *)"sign %s", sp->sn_name); smsg("sign %s", sp->sn_name);
if (sp->sn_icon != NULL) { if (sp->sn_icon != NULL) {
MSG_PUTS(" icon="); MSG_PUTS(" icon=");
msg_outtrans(sp->sn_icon); msg_outtrans(sp->sn_icon);

View File

@ -169,9 +169,9 @@ void do_debug(char_u *cmd)
if (sourcing_name != NULL) if (sourcing_name != NULL)
msg(sourcing_name); msg(sourcing_name);
if (sourcing_lnum != 0) if (sourcing_lnum != 0)
smsg((char_u *)_("line %" PRId64 ": %s"), (int64_t)sourcing_lnum, cmd); smsg(_("line %" PRId64 ": %s"), (int64_t)sourcing_lnum, cmd);
else else
smsg((char_u *)_("cmd: %s"), cmd); smsg(_("cmd: %s"), cmd);
/* /*
* Repeat getting a command and executing it. * Repeat getting a command and executing it.
@ -310,7 +310,7 @@ void ex_debug(exarg_T *eap)
int debug_break_level_save = debug_break_level; int debug_break_level_save = debug_break_level;
debug_break_level = 9999; debug_break_level = 9999;
do_cmdline_cmd(eap->arg); do_cmdline_cmd((char *)eap->arg);
debug_break_level = debug_break_level_save; debug_break_level = debug_break_level_save;
} }
@ -348,7 +348,7 @@ void dbg_check_breakpoint(exarg_T *eap)
p = (char_u *)"<SNR>"; p = (char_u *)"<SNR>";
else else
p = (char_u *)""; p = (char_u *)"";
smsg((char_u *)_("Breakpoint in \"%s%s\" line %" PRId64), smsg(_("Breakpoint in \"%s%s\" line %" PRId64),
p, p,
debug_breakpoint_name + (*p == NUL ? 0 : 3), debug_breakpoint_name + (*p == NUL ? 0 : 3),
(int64_t)debug_breakpoint_lnum); (int64_t)debug_breakpoint_lnum);
@ -637,7 +637,7 @@ void ex_breaklist(exarg_T *eap)
bp = &BREAKP(i); bp = &BREAKP(i);
if (bp->dbg_type == DBG_FILE) if (bp->dbg_type == DBG_FILE)
home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, TRUE); home_replace(NULL, bp->dbg_name, NameBuff, MAXPATHL, TRUE);
smsg((char_u *)_("%3d %s %s line %" PRId64), smsg(_("%3d %s %s line %" PRId64),
bp->dbg_nr, bp->dbg_nr,
bp->dbg_type == DBG_FUNC ? "func" : "file", bp->dbg_type == DBG_FUNC ? "func" : "file",
bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff, bp->dbg_type == DBG_FUNC ? bp->dbg_name : NameBuff,
@ -2025,14 +2025,13 @@ void ex_compiler(exarg_T *eap)
if (*eap->arg == NUL) { if (*eap->arg == NUL) {
/* List all compiler scripts. */ /* List all compiler scripts. */
do_cmdline_cmd((char_u *)"echo globpath(&rtp, 'compiler/*.vim')"); do_cmdline_cmd("echo globpath(&rtp, 'compiler/*.vim')");
/* ) keep the indenter happy... */ /* ) keep the indenter happy... */
} else { } else {
buf = xmalloc(STRLEN(eap->arg) + 14); buf = xmalloc(STRLEN(eap->arg) + 14);
if (eap->forceit) { if (eap->forceit) {
/* ":compiler! {name}" sets global options */ /* ":compiler! {name}" sets global options */
do_cmdline_cmd((char_u *) do_cmdline_cmd("command -nargs=* CompilerSet set <args>");
"command -nargs=* CompilerSet set <args>");
} else { } else {
/* ":compiler! {name}" sets local options. /* ":compiler! {name}" sets local options.
* To remain backwards compatible "current_compiler" is always * To remain backwards compatible "current_compiler" is always
@ -2043,8 +2042,7 @@ void ex_compiler(exarg_T *eap)
old_cur_comp = get_var_value((char_u *)"g:current_compiler"); old_cur_comp = get_var_value((char_u *)"g:current_compiler");
if (old_cur_comp != NULL) if (old_cur_comp != NULL)
old_cur_comp = vim_strsave(old_cur_comp); old_cur_comp = vim_strsave(old_cur_comp);
do_cmdline_cmd((char_u *) do_cmdline_cmd("command -nargs=* CompilerSet setlocal <args>");
"command -nargs=* CompilerSet setlocal <args>");
} }
do_unlet((char_u *)"g:current_compiler", TRUE); do_unlet((char_u *)"g:current_compiler", TRUE);
do_unlet((char_u *)"b:current_compiler", TRUE); do_unlet((char_u *)"b:current_compiler", TRUE);
@ -2054,7 +2052,7 @@ void ex_compiler(exarg_T *eap)
EMSG2(_("E666: compiler not supported: %s"), eap->arg); EMSG2(_("E666: compiler not supported: %s"), eap->arg);
xfree(buf); xfree(buf);
do_cmdline_cmd((char_u *)":delcommand CompilerSet"); do_cmdline_cmd(":delcommand CompilerSet");
/* Set "b:current_compiler" from "current_compiler". */ /* Set "b:current_compiler" from "current_compiler". */
p = get_var_value((char_u *)"g:current_compiler"); p = get_var_value((char_u *)"g:current_compiler");
@ -2129,7 +2127,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
{ {
if (p_verbose > 1 && name != NULL) { if (p_verbose > 1 && name != NULL) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Searching for \"%s\" in \"%s\""), smsg(_("Searching for \"%s\" in \"%s\""),
(char *)name, (char *)p_rtp); (char *)name, (char *)p_rtp);
verbose_leave(); verbose_leave();
} }
@ -2157,7 +2155,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
if (p_verbose > 2) { if (p_verbose > 2) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Searching for \"%s\""), buf); smsg(_("Searching for \"%s\""), buf);
verbose_leave(); verbose_leave();
} }
@ -2180,7 +2178,7 @@ int do_in_runtimepath(char_u *name, int all, DoInRuntimepathCB callback,
xfree(rtp_copy); xfree(rtp_copy);
if (p_verbose > 0 && !did_one && name != NULL) { if (p_verbose > 0 && !did_one && name != NULL) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("not found in 'runtimepath': \"%s\""), name); smsg(_("not found in 'runtimepath': \"%s\""), name);
verbose_leave(); verbose_leave();
} }
@ -2318,7 +2316,7 @@ do_source (
if (fname_exp == NULL) if (fname_exp == NULL)
return retval; return retval;
if (os_isdir(fname_exp)) { if (os_isdir(fname_exp)) {
smsg((char_u *)_("Cannot source a directory: \"%s\""), fname); smsg(_("Cannot source a directory: \"%s\""), fname);
goto theend; goto theend;
} }
@ -2364,9 +2362,9 @@ do_source (
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
if (sourcing_name == NULL) if (sourcing_name == NULL)
smsg((char_u *)_("could not source \"%s\""), fname); smsg(_("could not source \"%s\""), fname);
else else
smsg((char_u *)_("line %" PRId64 ": could not source \"%s\""), smsg(_("line %" PRId64 ": could not source \"%s\""),
(int64_t)sourcing_lnum, fname); (int64_t)sourcing_lnum, fname);
verbose_leave(); verbose_leave();
} }
@ -2381,9 +2379,9 @@ do_source (
if (p_verbose > 1) { if (p_verbose > 1) {
verbose_enter(); verbose_enter();
if (sourcing_name == NULL) if (sourcing_name == NULL)
smsg((char_u *)_("sourcing \"%s\""), fname); smsg(_("sourcing \"%s\""), fname);
else else
smsg((char_u *)_("line %" PRId64 ": sourcing \"%s\""), smsg(_("line %" PRId64 ": sourcing \"%s\""),
(int64_t)sourcing_lnum, fname); (int64_t)sourcing_lnum, fname);
verbose_leave(); verbose_leave();
} }
@ -2534,9 +2532,9 @@ do_source (
sourcing_lnum = save_sourcing_lnum; sourcing_lnum = save_sourcing_lnum;
if (p_verbose > 1) { if (p_verbose > 1) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("finished sourcing %s"), fname); smsg(_("finished sourcing %s"), fname);
if (sourcing_name != NULL) if (sourcing_name != NULL)
smsg((char_u *)_("continuing in %s"), sourcing_name); smsg(_("continuing in %s"), sourcing_name);
verbose_leave(); verbose_leave();
} }
@ -2578,7 +2576,7 @@ void ex_scriptnames(exarg_T *eap)
if (SCRIPT_ITEM(i).sn_name != NULL) { if (SCRIPT_ITEM(i).sn_name != NULL) {
home_replace(NULL, SCRIPT_ITEM(i).sn_name, home_replace(NULL, SCRIPT_ITEM(i).sn_name,
NameBuff, MAXPATHL, TRUE); NameBuff, MAXPATHL, TRUE);
smsg((char_u *)"%3d: %s", i, NameBuff); smsg("%3d: %s", i, NameBuff);
} }
} }
@ -3143,7 +3141,7 @@ void ex_language(exarg_T *eap)
p = (char_u *)setlocale(what, NULL); p = (char_u *)setlocale(what, NULL);
if (p == NULL || *p == NUL) if (p == NULL || *p == NUL)
p = (char_u *)"Unknown"; p = (char_u *)"Unknown";
smsg((char_u *)_("Current %slanguage: \"%s\""), whatstr, p); smsg(_("Current %slanguage: \"%s\""), whatstr, p);
} else { } else {
#ifndef LC_MESSAGES #ifndef LC_MESSAGES
if (what == VIM_LC_MESSAGES) if (what == VIM_LC_MESSAGES)

View File

@ -289,9 +289,9 @@ do_exmode (
/* /*
* Execute a simple command line. Used for translated commands like "*". * Execute a simple command line. Used for translated commands like "*".
*/ */
int do_cmdline_cmd(char_u *cmd) int do_cmdline_cmd(char *cmd)
{ {
return do_cmdline(cmd, NULL, NULL, return do_cmdline((char_u *)cmd, NULL, NULL,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED); DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_KEYTYPED);
} }
@ -604,7 +604,7 @@ int do_cmdline(char_u *cmdline, LineGetter fgetline,
++no_wait_return; ++no_wait_return;
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)_("line %" PRId64 ": %s"), smsg(_("line %" PRId64 ": %s"),
(int64_t)sourcing_lnum, cmdline_copy); (int64_t)sourcing_lnum, cmdline_copy);
if (msg_silent == 0) if (msg_silent == 0)
msg_puts((char_u *)"\n"); /* don't overwrite this */ msg_puts((char_u *)"\n"); /* don't overwrite this */
@ -4357,7 +4357,7 @@ static void ex_buffer(exarg_T *eap)
goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2); goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2);
} }
if (eap->do_ecmd_cmd != NULL) { if (eap->do_ecmd_cmd != NULL) {
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
} }
} }
} }
@ -4370,7 +4370,7 @@ static void ex_bmodified(exarg_T *eap)
{ {
goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2);
if (eap->do_ecmd_cmd != NULL) { if (eap->do_ecmd_cmd != NULL) {
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
} }
} }
@ -4382,7 +4382,7 @@ static void ex_bnext(exarg_T *eap)
{ {
goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2);
if (eap->do_ecmd_cmd != NULL) { if (eap->do_ecmd_cmd != NULL) {
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
} }
} }
@ -4396,7 +4396,7 @@ static void ex_bprevious(exarg_T *eap)
{ {
goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2);
if (eap->do_ecmd_cmd != NULL) { if (eap->do_ecmd_cmd != NULL) {
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
} }
} }
@ -4410,7 +4410,7 @@ static void ex_brewind(exarg_T *eap)
{ {
goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); goto_buffer(eap, DOBUF_FIRST, FORWARD, 0);
if (eap->do_ecmd_cmd != NULL) { if (eap->do_ecmd_cmd != NULL) {
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
} }
} }
@ -4422,7 +4422,7 @@ static void ex_blast(exarg_T *eap)
{ {
goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); goto_buffer(eap, DOBUF_LAST, BACKWARD, 0);
if (eap->do_ecmd_cmd != NULL) { if (eap->do_ecmd_cmd != NULL) {
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
} }
} }
@ -6622,7 +6622,7 @@ do_exedit (
readonlymode = n; readonlymode = n;
} else { } else {
if (eap->do_ecmd_cmd != NULL) if (eap->do_ecmd_cmd != NULL)
do_cmdline_cmd(eap->do_ecmd_cmd); do_cmdline_cmd((char *)eap->do_ecmd_cmd);
n = curwin->w_arg_idx_invalid; n = curwin->w_arg_idx_invalid;
check_arg_idx(curwin); check_arg_idx(curwin);
if (n != curwin->w_arg_idx_invalid) if (n != curwin->w_arg_idx_invalid)
@ -6901,7 +6901,7 @@ static void ex_pwd(exarg_T *eap)
*/ */
static void ex_equal(exarg_T *eap) static void ex_equal(exarg_T *eap)
{ {
smsg((char_u *)"%" PRId64, (int64_t)eap->line2); smsg("%" PRId64, (int64_t)eap->line2);
ex_may_print(eap); ex_may_print(eap);
} }
@ -7409,7 +7409,6 @@ static void ex_mkrc(exarg_T *eap)
{ {
FILE *fd; FILE *fd;
int failed = FALSE; int failed = FALSE;
char_u *fname;
int view_session = FALSE; int view_session = FALSE;
int using_vdir = FALSE; /* using 'viewdir'? */ int using_vdir = FALSE; /* using 'viewdir'? */
char_u *viewFile = NULL; char_u *viewFile = NULL;
@ -7423,12 +7422,13 @@ static void ex_mkrc(exarg_T *eap)
* short file name when 'acd' is set, that is checked later. */ * short file name when 'acd' is set, that is checked later. */
did_lcd = FALSE; did_lcd = FALSE;
char_u *fname;
/* ":mkview" or ":mkview 9": generate file name with 'viewdir' */ /* ":mkview" or ":mkview 9": generate file name with 'viewdir' */
if (eap->cmdidx == CMD_mkview if (eap->cmdidx == CMD_mkview
&& (*eap->arg == NUL && (*eap->arg == NUL
|| (ascii_isdigit(*eap->arg) && eap->arg[1] == NUL))) { || (ascii_isdigit(*eap->arg) && eap->arg[1] == NUL))) {
eap->forceit = TRUE; eap->forceit = TRUE;
fname = get_view_file(*eap->arg); fname = (char_u *)get_view_file(*eap->arg);
if (fname == NULL) if (fname == NULL)
return; return;
viewFile = fname; viewFile = fname;
@ -9050,48 +9050,40 @@ static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp)
*/ */
static void ex_loadview(exarg_T *eap) static void ex_loadview(exarg_T *eap)
{ {
char_u *fname; char *fname = get_view_file(*eap->arg);
fname = get_view_file(*eap->arg);
if (fname != NULL) { if (fname != NULL) {
if (do_source(fname, FALSE, DOSO_NONE) == FAIL) { if (do_source((char_u *)fname, FALSE, DOSO_NONE) == FAIL) {
EMSG2(_(e_notopen), fname); EMSG2(_(e_notopen), fname);
} }
xfree(fname); xfree(fname);
} }
} }
/* /// Get the name of the view file for the current buffer.
* Get the name of the view file for the current buffer. static char *get_view_file(int c)
*/
static char_u *get_view_file(int c)
{ {
int len = 0;
char_u *p, *s;
char_u *retval;
char_u *sname;
if (curbuf->b_ffname == NULL) { if (curbuf->b_ffname == NULL) {
EMSG(_(e_noname)); EMSG(_(e_noname));
return NULL; return NULL;
} }
sname = home_replace_save(NULL, curbuf->b_ffname); char *sname = (char *)home_replace_save(NULL, curbuf->b_ffname);
/* // We want a file name without separators, because we're not going to make
* We want a file name without separators, because we're not going to make // a directory.
* a directory. // "normal" path separator -> "=+"
* "normal" path separator -> "=+" // "=" -> "=="
* "=" -> "==" // ":" path separator -> "=-"
* ":" path separator -> "=-" size_t len = 0;
*/ for (char *p = sname; *p; p++) {
for (p = sname; *p; ++p) if (*p == '=' || vim_ispathsep(*p)) {
if (*p == '=' || vim_ispathsep(*p))
++len; ++len;
retval = xmalloc(STRLEN(sname) + len + STRLEN(p_vdir) + 9); }
}
char *retval = xmalloc(strlen(sname) + len + STRLEN(p_vdir) + 9);
STRCPY(retval, p_vdir); STRCPY(retval, p_vdir);
add_pathsep((char *)retval); add_pathsep(retval);
s = retval + STRLEN(retval); char *s = retval + strlen(retval);
for (p = sname; *p; ++p) { for (char *p = sname; *p; p++) {
if (*p == '=') { if (*p == '=') {
*s++ = '='; *s++ = '=';
*s++ = '='; *s++ = '=';
@ -9108,7 +9100,7 @@ static char_u *get_view_file(int c)
} }
*s++ = '='; *s++ = '=';
*s++ = c; *s++ = c;
STRCPY(s, ".vim"); strcpy(s, ".vim");
xfree(sname); xfree(sname);
return retval; return retval;
@ -9229,7 +9221,7 @@ static void ex_filetype(exarg_T *eap)
if (*eap->arg == NUL) { if (*eap->arg == NUL) {
/* Print current status. */ /* Print current status. */
smsg((char_u *)"filetype detection:%s plugin:%s indent:%s", smsg("filetype detection:%s plugin:%s indent:%s",
filetype_detect ? "ON" : "OFF", filetype_detect ? "ON" : "OFF",
filetype_plugin ? (filetype_detect ? "ON" : "(on)") : "OFF", filetype_plugin ? (filetype_detect ? "ON" : "(on)") : "OFF",
filetype_indent ? (filetype_detect ? "ON" : "(on)") : "OFF"); filetype_indent ? (filetype_detect ? "ON" : "(on)") : "OFF");
@ -9423,7 +9415,7 @@ static void ex_terminal(exarg_T *eap)
snprintf(ex_cmd, sizeof(ex_cmd), snprintf(ex_cmd, sizeof(ex_cmd),
":enew%s | call termopen(%s%s%s) | startinsert", ":enew%s | call termopen(%s%s%s) | startinsert",
eap->forceit==TRUE ? "!" : "", lquote, name, rquote); eap->forceit==TRUE ? "!" : "", lquote, name, rquote);
do_cmdline_cmd((uint8_t *)ex_cmd); do_cmdline_cmd(ex_cmd);
if (name != (char *)p_sh) { if (name != (char *)p_sh) {
xfree(name); xfree(name);

View File

@ -489,7 +489,7 @@ static int throw_exception(void *value, int type, char_u *cmdname)
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; /* always scroll up, don't overwrite */
smsg((char_u *)_("Exception thrown: %s"), excp->value); smsg(_("Exception thrown: %s"), excp->value);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ msg_puts((char_u *)"\n"); /* don't overwrite this either */
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
@ -537,10 +537,9 @@ static void discard_exception(except_T *excp, int was_finished)
++no_wait_return; ++no_wait_return;
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; /* always scroll up, don't overwrite */
smsg(was_finished smsg(was_finished ? _("Exception finished: %s")
? (char_u *)_("Exception finished: %s") : _("Exception discarded: %s"),
: (char_u *)_("Exception discarded: %s"), excp->value);
excp->value);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ msg_puts((char_u *)"\n"); /* don't overwrite this either */
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
cmdline_row = msg_row; cmdline_row = msg_row;
@ -601,7 +600,7 @@ static void catch_exception(except_T *excp)
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; /* always scroll up, don't overwrite */
smsg((char_u *)_("Exception caught: %s"), excp->value); smsg(_("Exception caught: %s"), excp->value);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ msg_puts((char_u *)"\n"); /* don't overwrite this either */
if (debug_break_level > 0 || *p_vfile == NUL) if (debug_break_level > 0 || *p_vfile == NUL)
@ -662,22 +661,22 @@ static void finish_exception(except_T *excp)
*/ */
static void report_pending(int action, int pending, void *value) static void report_pending(int action, int pending, void *value)
{ {
char_u *mesg; char *mesg;
char *s; char *s;
int save_msg_silent; int save_msg_silent;
assert(value || !(pending & CSTP_THROW)); assert(value || !(pending & CSTP_THROW));
switch (action) { switch (action) {
case RP_MAKE: case RP_MAKE:
mesg = (char_u *)_("%s made pending"); mesg = _("%s made pending");
break; break;
case RP_RESUME: case RP_RESUME:
mesg = (char_u *)_("%s resumed"); mesg = _("%s resumed");
break; break;
/* case RP_DISCARD: */ /* case RP_DISCARD: */
default: default:
mesg = (char_u *)_("%s discarded"); mesg = _("%s discarded");
break; break;
} }
@ -702,9 +701,8 @@ static void report_pending(int action, int pending, void *value)
default: default:
if (pending & CSTP_THROW) { if (pending & CSTP_THROW) {
vim_snprintf((char *)IObuff, IOSIZE, vim_snprintf((char *)IObuff, IOSIZE,
(char *)mesg, _("Exception")); mesg, _("Exception"));
mesg = vim_strnsave(IObuff, STRLEN(IObuff) + 4); mesg = (char *)concat_str(IObuff, (char_u *)": %s");
STRCAT(mesg, ": %s");
s = (char *)((except_T *)value)->value; s = (char *)((except_T *)value)->value;
} else if ((pending & CSTP_ERROR) && (pending & CSTP_INTERRUPT)) } else if ((pending & CSTP_ERROR) && (pending & CSTP_INTERRUPT))
s = _("Error and interrupt"); s = _("Error and interrupt");
@ -719,7 +717,7 @@ static void report_pending(int action, int pending, void *value)
msg_silent = FALSE; /* display messages */ msg_silent = FALSE; /* display messages */
++no_wait_return; ++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */ msg_scroll = TRUE; /* always scroll up, don't overwrite */
smsg(mesg, (char_u *)s); smsg(mesg, s);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ msg_puts((char_u *)"\n"); /* don't overwrite this either */
cmdline_row = msg_row; cmdline_row = msg_row;
--no_wait_return; --no_wait_return;

View File

@ -1588,8 +1588,8 @@ void conv_to_pvim(void)
} }
// Following lines contains Farsi encoded character. // Following lines contains Farsi encoded character.
do_cmdline_cmd((char_u *)"%s/\202\231/\232/g"); do_cmdline_cmd("%s/\202\231/\232/g");
do_cmdline_cmd((char_u *)"%s/\201\231/\370\334/g"); do_cmdline_cmd("%s/\201\231/\370\334/g");
// Assume the screen has been messed up: clear it and redraw. // Assume the screen has been messed up: clear it and redraw.
redraw_later(CLEAR); redraw_later(CLEAR);
@ -1603,7 +1603,7 @@ void conv_to_pstd(void)
int lnum, llen, i; int lnum, llen, i;
// Following line contains Farsi encoded character. // Following line contains Farsi encoded character.
do_cmdline_cmd((char_u *)"%s/\232/\202\231/g"); do_cmdline_cmd("%s/\232/\202\231/g");
for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) { for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) {
ptr = ml_get((linenr_T)lnum); ptr = ml_get((linenr_T)lnum);
llen = (int)STRLEN(ptr); llen = (int)STRLEN(ptr);
@ -2044,11 +2044,11 @@ void farsi_fkey(cmdarg_T *cap)
if (p_altkeymap) { if (p_altkeymap) {
if (curwin->w_farsi & W_R_L) { if (curwin->w_farsi & W_R_L) {
p_fkmap = 0; p_fkmap = 0;
do_cmdline_cmd((char_u *)"set norl"); do_cmdline_cmd("set norl");
MSG(""); MSG("");
} else { } else {
p_fkmap = 1; p_fkmap = 1;
do_cmdline_cmd((char_u *)"set rl"); do_cmdline_cmd("set rl");
MSG(""); MSG("");
} }

View File

@ -647,7 +647,7 @@ char_u *vim_findfile(void *search_ctx_arg)
#ifdef FF_VERBOSE #ifdef FF_VERBOSE
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)"Already Searched: %s (%s)", smsg("Already Searched: %s (%s)",
stackp->ffs_fix_path, stackp->ffs_wc_path); stackp->ffs_fix_path, stackp->ffs_wc_path);
/* don't overwrite this either */ /* don't overwrite this either */
msg_puts((char_u *)"\n"); msg_puts((char_u *)"\n");
@ -660,8 +660,8 @@ char_u *vim_findfile(void *search_ctx_arg)
#ifdef FF_VERBOSE #ifdef FF_VERBOSE
else if (p_verbose >= 5) { else if (p_verbose >= 5) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)"Searching: %s (%s)", smsg("Searching: %s (%s)",
stackp->ffs_fix_path, stackp->ffs_wc_path); stackp->ffs_fix_path, stackp->ffs_wc_path);
/* don't overwrite this either */ /* don't overwrite this either */
msg_puts((char_u *)"\n"); msg_puts((char_u *)"\n");
verbose_leave_scroll(); verbose_leave_scroll();
@ -821,7 +821,7 @@ char_u *vim_findfile(void *search_ctx_arg)
) == FAIL) { ) == FAIL) {
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)"Already: %s", smsg("Already: %s",
file_path); file_path);
/* don't overwrite this either */ /* don't overwrite this either */
msg_puts((char_u *)"\n"); msg_puts((char_u *)"\n");
@ -848,7 +848,7 @@ char_u *vim_findfile(void *search_ctx_arg)
#ifdef FF_VERBOSE #ifdef FF_VERBOSE
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)"HIT: %s", file_path); smsg("HIT: %s", file_path);
/* don't overwrite this either */ /* don't overwrite this either */
msg_puts((char_u *)"\n"); msg_puts((char_u *)"\n");
verbose_leave_scroll(); verbose_leave_scroll();
@ -1011,7 +1011,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
#ifdef FF_VERBOSE #ifdef FF_VERBOSE
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)"ff_get_visited_list: FOUND list for %s", smsg("ff_get_visited_list: FOUND list for %s",
filename); filename);
/* don't overwrite this either */ /* don't overwrite this either */
msg_puts((char_u *)"\n"); msg_puts((char_u *)"\n");
@ -1027,7 +1027,7 @@ static ff_visited_list_hdr_T *ff_get_visited_list(char_u *filename, ff_visited_l
#ifdef FF_VERBOSE #ifdef FF_VERBOSE
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)"ff_get_visited_list: new list for %s", filename); smsg("ff_get_visited_list: new list for %s", filename);
/* don't overwrite this either */ /* don't overwrite this either */
msg_puts((char_u *)"\n"); msg_puts((char_u *)"\n");
verbose_leave_scroll(); verbose_leave_scroll();

View File

@ -5404,8 +5404,7 @@ void aubuflocal_remove(buf_T *buf)
au_remove_pat(ap); au_remove_pat(ap);
if (p_verbose >= 6) { if (p_verbose >= 6) {
verbose_enter(); verbose_enter();
smsg((char_u *) smsg(_("auto-removing autocommand: %s <buffer=%d>"),
_("auto-removing autocommand: %s <buffer=%d>"),
event_nr2name(event), buf->b_fnum); event_nr2name(event), buf->b_fnum);
verbose_leave(); verbose_leave();
} }
@ -6835,7 +6834,7 @@ auto_next_pat (
(char *)name, (char *)ap->pat); (char *)name, (char *)ap->pat);
if (p_verbose >= 8) { if (p_verbose >= 8) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Executing %s"), sourcing_name); smsg(_("Executing %s"), sourcing_name);
verbose_leave(); verbose_leave();
} }
@ -6897,7 +6896,7 @@ char_u *getnextac(int c, void *cookie, int indent)
if (p_verbose >= 9) { if (p_verbose >= 9) {
verbose_enter_scroll(); verbose_enter_scroll();
smsg((char_u *)_("autocommand %s"), ac->cmd); smsg(_("autocommand %s"), ac->cmd);
msg_puts((char_u *)"\n"); /* don't overwrite this either */ msg_puts((char_u *)"\n"); /* don't overwrite this either */
verbose_leave_scroll(); verbose_leave_scroll();
} }

View File

@ -531,8 +531,8 @@ staterr:
if (p_csverbose) { if (p_csverbose) {
msg_clr_eos(); msg_clr_eos();
(void)smsg_attr(hl_attr(HLF_R), (void)smsg_attr(hl_attr(HLF_R),
(char_u *)_("Added cscope database %s"), _("Added cscope database %s"),
csinfo[i].fname); csinfo[i].fname);
} }
} }
@ -1115,7 +1115,7 @@ static int cs_help(exarg_T *eap)
/* Use %*s rather than %30s to ensure proper alignment in utf-8 */ /* Use %*s rather than %30s to ensure proper alignment in utf-8 */
if (space_cnt < 0) if (space_cnt < 0)
space_cnt = 0; space_cnt = 0;
(void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"), (void)smsg(_("%-5s: %s%*s (Usage: %s)"),
cmdp->name, cmdp->name,
help, space_cnt, " ", help, space_cnt, " ",
cmdp->usage); cmdp->usage);
@ -1316,7 +1316,7 @@ cs_kill_execute (
if (p_csverbose) { if (p_csverbose) {
msg_clr_eos(); msg_clr_eos();
(void)smsg_attr(hl_attr(HLF_R) | MSG_HIST, (void)smsg_attr(hl_attr(HLF_R) | MSG_HIST,
(char_u *)_("cscope connection %s closed"), cname); _("cscope connection %s closed"), cname);
} }
cs_release_csp(i, TRUE); cs_release_csp(i, TRUE);
} }
@ -2083,10 +2083,10 @@ static int cs_show(exarg_T *eap)
continue; continue;
if (csinfo[i].ppath != NULL) if (csinfo[i].ppath != NULL)
(void)smsg((char_u *)"%2d %-5ld %-34s %-32s", (void)smsg("%2d %-5ld %-34s %-32s",
i, (long)csinfo[i].pid, csinfo[i].fname, csinfo[i].ppath); i, (long)csinfo[i].pid, csinfo[i].fname, csinfo[i].ppath);
else else
(void)smsg((char_u *)"%2d %-5ld %-34s <none>", (void)smsg("%2d %-5ld %-34s <none>",
i, (long)csinfo[i].pid, csinfo[i].fname); i, (long)csinfo[i].pid, csinfo[i].fname);
} }
} }

View File

@ -81,13 +81,13 @@ typedef struct {
int argc; int argc;
char **argv; char **argv;
char_u *use_vimrc; /* vimrc from -u argument */ char *use_vimrc; // vimrc from -u argument
int n_commands; /* no. of commands from + or -c */ int n_commands; /* no. of commands from + or -c */
char_u *commands[MAX_ARG_CMDS]; /* commands from + or -c arg. */ char *commands[MAX_ARG_CMDS]; // commands from + or -c arg
char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */ char_u cmds_tofree[MAX_ARG_CMDS]; /* commands that need free() */
int n_pre_commands; /* no. of commands from --cmd */ int n_pre_commands; /* no. of commands from --cmd */
char_u *pre_commands[MAX_ARG_CMDS]; /* commands from --cmd argument */ char *pre_commands[MAX_ARG_CMDS]; // commands from --cmd argument
int edit_type; /* type of editing to do */ int edit_type; /* type of editing to do */
char_u *tagname; /* tag from -t argument */ char_u *tagname; /* tag from -t argument */
@ -286,15 +286,14 @@ int main(int argc, char **argv)
} }
// open terminals when opening files that start with term:// // open terminals when opening files that start with term://
do_cmdline_cmd((uint8_t *) do_cmdline_cmd("autocmd BufReadCmd term://* "
"autocmd BufReadCmd term://* " ":call termopen( "
":call termopen( " // Capture the command string
// Capture the command string "matchstr(expand(\"<amatch>\"), "
"matchstr(expand(\"<amatch>\"), " "'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), "
"'\\c\\mterm://\\%(.\\{-}//\\%(\\d\\+:\\)\\?\\)\\?\\zs.*'), " // capture the working directory
// capture the working directory "{'cwd': get(matchlist(expand(\"<amatch>\"), "
"{'cwd': get(matchlist(expand(\"<amatch>\"), " "'\\c\\mterm://\\(.\\{-}\\)//'), 1, '')})");
"'\\c\\mterm://\\(.\\{-}\\)//'), 1, '')})");
/* Execute --cmd arguments. */ /* Execute --cmd arguments. */
exe_pre_commands(&params); exe_pre_commands(&params);
@ -872,9 +871,9 @@ static void command_line_scan(mparm_T *parmp)
mainerr(ME_EXTRA_CMD, NULL); mainerr(ME_EXTRA_CMD, NULL);
argv_idx = -1; /* skip to next argument */ argv_idx = -1; /* skip to next argument */
if (argv[0][1] == NUL) if (argv[0][1] == NUL)
parmp->commands[parmp->n_commands++] = (char_u *)"$"; parmp->commands[parmp->n_commands++] = "$";
else else
parmp->commands[parmp->n_commands++] = (char_u *)&(argv[0][1]); parmp->commands[parmp->n_commands++] = &(argv[0][1]);
} }
/* /*
* Optional argument. * Optional argument.
@ -1116,7 +1115,7 @@ static void command_line_scan(mparm_T *parmp)
if (argv[0][argv_idx] != NUL) { if (argv[0][argv_idx] != NUL) {
if (parmp->n_commands >= MAX_ARG_CMDS) if (parmp->n_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL); mainerr(ME_EXTRA_CMD, NULL);
parmp->commands[parmp->n_commands++] = (char_u *)argv[0] parmp->commands[parmp->n_commands++] = argv[0]
+ argv_idx; + argv_idx;
argv_idx = -1; argv_idx = -1;
break; break;
@ -1169,15 +1168,16 @@ static void command_line_scan(mparm_T *parmp)
a = SESSION_FILE; a = SESSION_FILE;
++argc; ++argc;
--argv; --argv;
} else } else {
a = argv[0]; a = argv[0];
p = xmalloc(STRLEN(a) + 4); }
sprintf((char *)p, "so %s", a); char *s = xmalloc(STRLEN(a) + 4);
sprintf(s, "so %s", a);
parmp->cmds_tofree[parmp->n_commands] = TRUE; parmp->cmds_tofree[parmp->n_commands] = TRUE;
parmp->commands[parmp->n_commands++] = p; parmp->commands[parmp->n_commands++] = s;
} else } else {
parmp->commands[parmp->n_commands++] = parmp->commands[parmp->n_commands++] = argv[0];
(char_u *)argv[0]; }
break; break;
case '-': case '-':
@ -1185,8 +1185,7 @@ static void command_line_scan(mparm_T *parmp)
/* "--cmd {command}" execute command */ /* "--cmd {command}" execute command */
if (parmp->n_pre_commands >= MAX_ARG_CMDS) if (parmp->n_pre_commands >= MAX_ARG_CMDS)
mainerr(ME_EXTRA_CMD, NULL); mainerr(ME_EXTRA_CMD, NULL);
parmp->pre_commands[parmp->n_pre_commands++] = parmp->pre_commands[parmp->n_pre_commands++] = argv[0];
(char_u *)argv[0];
} }
/* "--startuptime <file>" already handled */ /* "--startuptime <file>" already handled */
break; break;
@ -1232,7 +1231,7 @@ scripterror:
break; break;
case 'u': /* "-u {vimrc}" vim inits file */ case 'u': /* "-u {vimrc}" vim inits file */
parmp->use_vimrc = (char_u *)argv[0]; parmp->use_vimrc = argv[0];
break; break;
case 'U': /* "-U {gvimrc}" gvim inits file */ case 'U': /* "-U {gvimrc}" gvim inits file */
@ -1376,9 +1375,9 @@ static char_u *get_fname(mparm_T *parmp)
/* Temporarily add '(' and ')' to 'isfname'. These are valid /* Temporarily add '(' and ')' to 'isfname'. These are valid
* filename characters but are excluded from 'isfname' to make * filename characters but are excluded from 'isfname' to make
* "gf" work on a file name in parenthesis (e.g.: see vim.h). */ * "gf" work on a file name in parenthesis (e.g.: see vim.h). */
do_cmdline_cmd((char_u *)":set isf+=(,)"); do_cmdline_cmd(":set isf+=(,)");
alist_expand(NULL, 0); alist_expand(NULL, 0);
do_cmdline_cmd((char_u *)":set isf&"); do_cmdline_cmd(":set isf&");
} }
#endif #endif
return alist_name(&GARGLIST[0]); return alist_name(&GARGLIST[0]);
@ -1438,7 +1437,7 @@ static void handle_tag(char_u *tagname)
swap_exists_did_quit = FALSE; swap_exists_did_quit = FALSE;
vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname); vim_snprintf((char *)IObuff, IOSIZE, "ta %s", tagname);
do_cmdline_cmd(IObuff); do_cmdline_cmd((char *)IObuff);
TIME_MSG("jumping to tag"); TIME_MSG("jumping to tag");
/* If the user doesn't want to edit the file then we quit here. */ /* If the user doesn't want to edit the file then we quit here. */
@ -1715,7 +1714,7 @@ static void edit_buffers(mparm_T *parmp)
*/ */
static void exe_pre_commands(mparm_T *parmp) static void exe_pre_commands(mparm_T *parmp)
{ {
char_u **cmds = parmp->pre_commands; char **cmds = parmp->pre_commands;
int cnt = parmp->n_pre_commands; int cnt = parmp->n_pre_commands;
int i; int i;
@ -1779,12 +1778,12 @@ static void source_startup_scripts(mparm_T *parmp)
* nothing else. * nothing else.
*/ */
if (parmp->use_vimrc != NULL) { if (parmp->use_vimrc != NULL) {
if (STRCMP(parmp->use_vimrc, "NONE") == 0 if (strcmp(parmp->use_vimrc, "NONE") == 0
|| STRCMP(parmp->use_vimrc, "NORC") == 0) { || strcmp(parmp->use_vimrc, "NORC") == 0) {
if (parmp->use_vimrc[2] == 'N') if (parmp->use_vimrc[2] == 'N')
p_lpl = FALSE; /* don't load plugins either */ p_lpl = FALSE; // don't load plugins either
} else { } else {
if (do_source(parmp->use_vimrc, FALSE, DOSO_NONE) != OK) if (do_source((char_u *)parmp->use_vimrc, FALSE, DOSO_NONE) != OK)
EMSG2(_("E282: Cannot read from \"%s\""), parmp->use_vimrc); EMSG2(_("E282: Cannot read from \"%s\""), parmp->use_vimrc);
} }
} else if (!silent_mode) { } else if (!silent_mode) {
@ -1806,7 +1805,7 @@ static void source_startup_scripts(mparm_T *parmp)
* - second user exrc file ($VIM/.exrc for Dos) * - second user exrc file ($VIM/.exrc for Dos)
* The first that exists is used, the rest is ignored. * The first that exists is used, the rest is ignored.
*/ */
if (process_env((char_u *)"VIMINIT", TRUE) != OK) { if (process_env("VIMINIT", true) != OK) {
if (do_source((char_u *)USR_VIMRC_FILE, TRUE, DOSO_VIMRC) == FAIL if (do_source((char_u *)USR_VIMRC_FILE, TRUE, DOSO_VIMRC) == FAIL
#ifdef USR_VIMRC_FILE2 #ifdef USR_VIMRC_FILE2
&& do_source((char_u *)USR_VIMRC_FILE2, TRUE, && do_source((char_u *)USR_VIMRC_FILE2, TRUE,
@ -1816,7 +1815,7 @@ static void source_startup_scripts(mparm_T *parmp)
&& do_source((char_u *)USR_VIMRC_FILE3, TRUE, && do_source((char_u *)USR_VIMRC_FILE3, TRUE,
DOSO_VIMRC) == FAIL DOSO_VIMRC) == FAIL
#endif #endif
&& process_env((char_u *)"EXINIT", FALSE) == FAIL && process_env("EXINIT", FALSE) == FAIL
&& do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL) { && do_source((char_u *)USR_EXRC_FILE, FALSE, DOSO_NONE) == FAIL) {
#ifdef USR_EXRC_FILE2 #ifdef USR_EXRC_FILE2
(void)do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE); (void)do_source((char_u *)USR_EXRC_FILE2, FALSE, DOSO_NONE);
@ -1894,30 +1893,25 @@ static void main_start_gui(void)
} }
/* /// Get an environment variable, and execute it as Ex commands.
* Get an environment variable, and execute it as Ex commands. ///
* Returns FAIL if the environment variable was not executed, OK otherwise. /// @param env environment variable to execute
*/ /// @param is_viminit when true, called for VIMINIT
int ///
process_env ( /// @return FAIL if the environment variable was not executed,
char_u *env, /// OK otherwise.
int is_viminit /* when TRUE, called for VIMINIT */ static int process_env(char *env, bool is_viminit)
)
{ {
char_u *initstr; char *initstr = (char *)os_getenv(env);
char_u *save_sourcing_name;
linenr_T save_sourcing_lnum;
scid_T save_sid;
initstr = (char_u *)os_getenv((char *)env);
if (initstr != NULL && *initstr != NUL) { if (initstr != NULL && *initstr != NUL) {
if (is_viminit) if (is_viminit) {
vimrc_found(NULL, NULL); vimrc_found(NULL, NULL);
save_sourcing_name = sourcing_name; }
save_sourcing_lnum = sourcing_lnum; char_u *save_sourcing_name = sourcing_name;
sourcing_name = env; linenr_T save_sourcing_lnum = sourcing_lnum;
sourcing_name = (char_u *)env;
sourcing_lnum = 0; sourcing_lnum = 0;
save_sid = current_SID; scid_T save_sid = current_SID;
current_SID = SID_ENV; current_SID = SID_ENV;
do_cmdline_cmd(initstr); do_cmdline_cmd(initstr);
sourcing_name = save_sourcing_name; sourcing_name = save_sourcing_name;

View File

@ -950,13 +950,13 @@ void ml_recover(void)
} }
home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE); home_replace(NULL, mfp->mf_fname, NameBuff, MAXPATHL, TRUE);
smsg((char_u *)_("Using swap file \"%s\""), NameBuff); smsg(_("Using swap file \"%s\""), NameBuff);
if (buf_spname(curbuf) != NULL) if (buf_spname(curbuf) != NULL)
STRLCPY(NameBuff, buf_spname(curbuf), MAXPATHL); STRLCPY(NameBuff, buf_spname(curbuf), MAXPATHL);
else else
home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE); home_replace(NULL, curbuf->b_ffname, NameBuff, MAXPATHL, TRUE);
smsg((char_u *)_("Original file \"%s\""), NameBuff); smsg(_("Original file \"%s\""), NameBuff);
msg_putchar('\n'); msg_putchar('\n');
/* /*

View File

@ -498,9 +498,9 @@ void free_all_mem(void)
/* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */ /* Close all tabs and windows. Reset 'equalalways' to avoid redraws. */
p_ea = FALSE; p_ea = FALSE;
if (first_tabpage->tp_next != NULL) if (first_tabpage->tp_next != NULL)
do_cmdline_cmd((char_u *)"tabonly!"); do_cmdline_cmd("tabonly!");
if (firstwin != lastwin) if (firstwin != lastwin)
do_cmdline_cmd((char_u *)"only!"); do_cmdline_cmd("only!");
/* Free all spell info. */ /* Free all spell info. */
spell_free_all(); spell_free_all();
@ -509,18 +509,18 @@ void free_all_mem(void)
ex_comclear(NULL); ex_comclear(NULL);
/* Clear menus. */ /* Clear menus. */
do_cmdline_cmd((char_u *)"aunmenu *"); do_cmdline_cmd("aunmenu *");
do_cmdline_cmd((char_u *)"menutranslate clear"); do_cmdline_cmd("menutranslate clear");
/* Clear mappings, abbreviations, breakpoints. */ /* Clear mappings, abbreviations, breakpoints. */
do_cmdline_cmd((char_u *)"lmapclear"); do_cmdline_cmd("lmapclear");
do_cmdline_cmd((char_u *)"xmapclear"); do_cmdline_cmd("xmapclear");
do_cmdline_cmd((char_u *)"mapclear"); do_cmdline_cmd("mapclear");
do_cmdline_cmd((char_u *)"mapclear!"); do_cmdline_cmd("mapclear!");
do_cmdline_cmd((char_u *)"abclear"); do_cmdline_cmd("abclear");
do_cmdline_cmd((char_u *)"breakdel *"); do_cmdline_cmd("breakdel *");
do_cmdline_cmd((char_u *)"profdel *"); do_cmdline_cmd("profdel *");
do_cmdline_cmd((char_u *)"set keymap="); do_cmdline_cmd("set keymap=");
free_titles(); free_titles();
free_findfile(); free_findfile();

View File

@ -329,22 +329,22 @@ void trunc_string(char_u *s, char_u *buf, int room, int buflen)
* shorter than IOSIZE!!! * shorter than IOSIZE!!!
*/ */
int smsg(char_u *s, ...) int smsg(char *s, ...)
{ {
va_list arglist; va_list arglist;
va_start(arglist, s); va_start(arglist, s);
vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist, NULL);
va_end(arglist); va_end(arglist);
return msg(IObuff); return msg(IObuff);
} }
int smsg_attr(int attr, char_u *s, ...) int smsg_attr(int attr, char *s, ...)
{ {
va_list arglist; va_list arglist;
va_start(arglist, s); va_start(arglist, s);
vim_vsnprintf((char *)IObuff, IOSIZE, (char *)s, arglist, NULL); vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist, NULL);
va_end(arglist); va_end(arglist);
return msg_attr(IObuff, attr); return msg_attr(IObuff, attr);
} }

View File

@ -2296,7 +2296,8 @@ int ask_yesno(char_u *str, int direct)
while (r != 'y' && r != 'n') { while (r != 'y' && r != 'n') {
/* same highlighting as for wait_return */ /* same highlighting as for wait_return */
smsg_attr(hl_attr(HLF_R), (char_u *)"%s (y/n)?", str); smsg_attr(hl_attr(HLF_R),
"%s (y/n)?", str);
if (direct) if (direct)
r = get_keystroke(); r = get_keystroke();
else else

View File

@ -296,8 +296,8 @@ int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
if (p_verbose > 3) { if (p_verbose > 3) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Calling shell to execute: \"%s\""), smsg(_("Calling shell to execute: \"%s\""),
cmd == NULL ? p_sh : cmd); cmd == NULL ? p_sh : cmd);
ui_putc('\n'); ui_putc('\n');
verbose_leave(); verbose_leave();
} }

View File

@ -4172,11 +4172,11 @@ static void nv_Zet(cmdarg_T *cap)
if (!checkclearopq(cap->oap)) { if (!checkclearopq(cap->oap)) {
switch (cap->nchar) { switch (cap->nchar) {
/* "ZZ": equivalent to ":x". */ /* "ZZ": equivalent to ":x". */
case 'Z': do_cmdline_cmd((char_u *)"x"); case 'Z': do_cmdline_cmd("x");
break; break;
/* "ZQ": equivalent to ":q!" (Elvis compatible). */ /* "ZQ": equivalent to ":q!" (Elvis compatible). */
case 'Q': do_cmdline_cmd((char_u *)"q!"); case 'Q': do_cmdline_cmd("q!");
break; break;
default: clearopbeep(cap->oap); default: clearopbeep(cap->oap);
@ -4392,7 +4392,7 @@ static void nv_ident(cmdarg_T *cap)
add_to_history(HIST_SEARCH, buf, true, NUL); add_to_history(HIST_SEARCH, buf, true, NUL);
(void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0); (void)normal_search(cap, cmdchar == '*' ? '/' : '?', buf, 0);
} else } else
do_cmdline_cmd(buf); do_cmdline_cmd((char *)buf);
xfree(buf); xfree(buf);
} }
@ -4704,9 +4704,9 @@ static void nv_down(cmdarg_T *cap)
/* In a quickfix window a <CR> jumps to the error under the cursor. */ /* In a quickfix window a <CR> jumps to the error under the cursor. */
if (bt_quickfix(curbuf) && cap->cmdchar == CAR) if (bt_quickfix(curbuf) && cap->cmdchar == CAR)
if (curwin->w_llist_ref == NULL) if (curwin->w_llist_ref == NULL)
do_cmdline_cmd((char_u *)".cc"); /* quickfix window */ do_cmdline_cmd(".cc"); /* quickfix window */
else else
do_cmdline_cmd((char_u *)".ll"); /* location list window */ do_cmdline_cmd(".ll"); /* location list window */
else { else {
/* In the cmdline window a <CR> executes the command. */ /* In the cmdline window a <CR> executes the command. */
if (cmdwin_type != 0 && cap->cmdchar == CAR) if (cmdwin_type != 0 && cap->cmdchar == CAR)
@ -6018,7 +6018,7 @@ static void nv_suspend(cmdarg_T *cap)
clearop(cap->oap); clearop(cap->oap);
if (VIsual_active) if (VIsual_active)
end_visual_mode(); /* stop Visual mode */ end_visual_mode(); /* stop Visual mode */
do_cmdline_cmd((char_u *)"st"); do_cmdline_cmd("st");
} }
/* /*
@ -6045,7 +6045,7 @@ static void nv_g_cmd(cmdarg_T *cap)
break; break;
case '&': case '&':
do_cmdline_cmd((char_u *)"%s//~/&"); do_cmdline_cmd("%s//~/&");
break; break;
/* /*

View File

@ -591,7 +591,7 @@ void op_reindent(oparg_T *oap, Indenter how)
if (i > 1 if (i > 1
&& (i % 50 == 0 || i == oap->line_count - 1) && (i % 50 == 0 || i == oap->line_count - 1)
&& oap->line_count > p_report) && oap->line_count > p_report)
smsg((char_u *)_("%" PRId64 " lines to indent... "), (int64_t)i); smsg(_("%" PRId64 " lines to indent... "), (int64_t)i);
/* /*
* Be vi-compatible: For lisp indenting the first line is not * Be vi-compatible: For lisp indenting the first line is not
@ -635,7 +635,7 @@ void op_reindent(oparg_T *oap, Indenter how)
if (i == 1) if (i == 1)
MSG(_("1 line indented ")); MSG(_("1 line indented "));
else else
smsg((char_u *)_("%" PRId64 " lines indented "), (int64_t)i); smsg(_("%" PRId64 " lines indented "), (int64_t)i);
} }
/* set '[ and '] marks */ /* set '[ and '] marks */
curbuf->b_op_start = oap->start; curbuf->b_op_start = oap->start;
@ -1902,7 +1902,7 @@ void op_tilde(oparg_T *oap)
if (oap->line_count == 1) if (oap->line_count == 1)
MSG(_("1 line changed")); MSG(_("1 line changed"));
else else
smsg((char_u *)_("%" PRId64 " lines changed"), (int64_t)oap->line_count); smsg(_("%" PRId64 " lines changed"), (int64_t)oap->line_count);
} }
} }
@ -2497,10 +2497,10 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
else else
MSG(_("1 line yanked")); MSG(_("1 line yanked"));
} else if (oap->block_mode) } else if (oap->block_mode)
smsg((char_u *)_("block of %" PRId64 " lines yanked"), smsg(_("block of %" PRId64 " lines yanked"),
(int64_t)yanklines); (int64_t)yanklines);
else else
smsg((char_u *)_("%" PRId64 " lines yanked"), (int64_t)yanklines); smsg(_("%" PRId64 " lines yanked"), (int64_t)yanklines);
} }
} }

View File

@ -28,7 +28,7 @@ int os_chdir(const char *path)
{ {
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter(); verbose_enter();
smsg((char_u *)"chdir(%s)", path); smsg("chdir(%s)", path);
verbose_leave(); verbose_leave();
} }
return uv_chdir(path); return uv_chdir(path);

View File

@ -1861,7 +1861,7 @@ void qf_age(exarg_T *eap)
static void qf_msg(qf_info_T *qi) static void qf_msg(qf_info_T *qi)
{ {
smsg((char_u *)_("error list %d of %d; %d errors"), smsg(_("error list %d of %d; %d errors"),
qi->qf_curlist + 1, qi->qf_listcount, qi->qf_curlist + 1, qi->qf_listcount,
qi->qf_lists[qi->qf_curlist].qf_count); qi->qf_lists[qi->qf_curlist].qf_count);
qf_update_buffer(qi); qf_update_buffer(qi);
@ -2888,7 +2888,7 @@ void ex_vimgrep(exarg_T *eap)
if (buf == NULL) { if (buf == NULL) {
if (!got_int) if (!got_int)
smsg((char_u *)_("Cannot open file \"%s\""), fname); smsg(_("Cannot open file \"%s\""), fname);
} else { } else {
/* Try for a match in all lines of the buffer. /* Try for a match in all lines of the buffer.
* For ":1vimgrep" look for first match only. */ * For ":1vimgrep" look for first match only. */

View File

@ -6968,7 +6968,7 @@ regprog_T *vim_regcomp(char_u *expr_arg, int re_flags)
regexp_engine = expr[4] - '0'; regexp_engine = expr[4] - '0';
expr += 5; expr += 5;
#ifdef REGEXP_DEBUG #ifdef REGEXP_DEBUG
smsg((char_u *)"New regexp mode selected (%d): %s", smsg("New regexp mode selected (%d): %s",
regexp_engine, regexp_engine,
regname[newengine]); regname[newengine]);
#endif #endif

View File

@ -4200,7 +4200,7 @@ find_pattern_in_path (
msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R)); msg_trunc_attr(IObuff, TRUE, hl_attr(HLF_R));
} else if (p_verbose >= 5) { } else if (p_verbose >= 5) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Searching included file %s"), smsg(_("Searching included file %s"),
(char *)new_fname); (char *)new_fname);
verbose_leave(); verbose_leave();
} }

View File

@ -2327,9 +2327,8 @@ static void spell_load_lang(char_u *lang)
} }
if (r == FAIL) { if (r == FAIL) {
smsg((char_u *) smsg(_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""),
_("Warning: Cannot find word list \"%s.%s.spl\" or \"%s.ascii.spl\""), lang, spell_enc(), lang);
lang, spell_enc(), lang);
} else if (sl.sl_slang != NULL) { } else if (sl.sl_slang != NULL) {
// At least one file was loaded, now load ALL the additions. // At least one file was loaded, now load ALL the additions.
STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl"); STRCPY(fname_enc + STRLEN(fname_enc) - 3, "add.spl");
@ -2540,14 +2539,14 @@ spell_load_file (
EMSG2(_(e_notopen), fname); EMSG2(_(e_notopen), fname);
else if (p_verbose > 2) { else if (p_verbose > 2) {
verbose_enter(); verbose_enter();
smsg(e_notopen, fname); smsg((char *)e_notopen, fname);
verbose_leave(); verbose_leave();
} }
goto endFAIL; goto endFAIL;
} }
if (p_verbose > 2) { if (p_verbose > 2) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Reading spell file \"%s\""), fname); smsg(_("Reading spell file \"%s\""), fname);
verbose_leave(); verbose_leave();
} }
@ -3824,9 +3823,8 @@ char_u *did_set_spelllang(win_T *wp)
} else } else
// This is probably an error. Give a warning and // This is probably an error. Give a warning and
// accept the words anyway. // accept the words anyway.
smsg((char_u *) smsg(_("Warning: region %s not supported"),
_("Warning: region %s not supported"), region);
region);
} else } else
region_mask = 1 << c; region_mask = 1 << c;
} }
@ -4395,8 +4393,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (spin->si_conv.vc_type != CONV_NONE) { if (spin->si_conv.vc_type != CONV_NONE) {
pc = string_convert(&spin->si_conv, rline, NULL); pc = string_convert(&spin->si_conv, rline, NULL);
if (pc == NULL) { if (pc == NULL) {
smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), smsg(_("Conversion failure for word in %s line %d: %s"),
fname, lnum, rline); fname, lnum, rline);
continue; continue;
} }
line = pc; line = pc;
@ -4436,8 +4434,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (!spin->si_ascii if (!spin->si_ascii
&& convert_setup(&spin->si_conv, aff->af_enc, && convert_setup(&spin->si_conv, aff->af_enc,
p_enc) == FAIL) p_enc) == FAIL)
smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), smsg(_("Conversion in %s not supported: from %s to %s"),
fname, aff->af_enc, p_enc); fname, aff->af_enc, p_enc);
spin->si_conv.vc_fail = true; spin->si_conv.vc_fail = true;
} else if (is_aff_rule(items, itemcnt, "FLAG", 2) } else if (is_aff_rule(items, itemcnt, "FLAG", 2)
&& aff->af_flagtype == AFT_CHAR) { && aff->af_flagtype == AFT_CHAR) {
@ -4448,8 +4446,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
else if (STRCMP(items[1], "caplong") == 0) else if (STRCMP(items[1], "caplong") == 0)
aff->af_flagtype = AFT_CAPLONG; aff->af_flagtype = AFT_CAPLONG;
else else
smsg((char_u *)_("Invalid value for FLAG in %s line %d: %s"), smsg(_("Invalid value for FLAG in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
if (aff->af_rare != 0 if (aff->af_rare != 0
|| aff->af_keepcase != 0 || aff->af_keepcase != 0
|| aff->af_bad != 0 || aff->af_bad != 0
@ -4461,8 +4459,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
|| compflags != NULL || compflags != NULL
|| aff->af_suff.ht_used > 0 || aff->af_suff.ht_used > 0
|| aff->af_pref.ht_used > 0) || aff->af_pref.ht_used > 0)
smsg((char_u *)_("FLAG after using flags in %s line %d: %s"), smsg(_("FLAG after using flags in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else if (spell_info_item(items[0]) && itemcnt > 1) { } else if (spell_info_item(items[0]) && itemcnt > 1) {
p = (char_u *)getroom(spin, p = (char_u *)getroom(spin,
(spin->si_info == NULL ? 0 : STRLEN(spin->si_info)) (spin->si_info == NULL ? 0 : STRLEN(spin->si_info))
@ -4528,17 +4526,15 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1], aff->af_compforbid = affitem2flag(aff->af_flagtype, items[1],
fname, lnum); fname, lnum);
if (aff->af_pref.ht_used > 0) if (aff->af_pref.ht_used > 0)
smsg((char_u *)_( smsg(_("Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"),
"Defining COMPOUNDFORBIDFLAG after PFX item may give wrong results in %s line %d"), fname, lnum);
fname, lnum);
} else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2) } else if (is_aff_rule(items, itemcnt, "COMPOUNDPERMITFLAG", 2)
&& aff->af_comppermit == 0) { && aff->af_comppermit == 0) {
aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1], aff->af_comppermit = affitem2flag(aff->af_flagtype, items[1],
fname, lnum); fname, lnum);
if (aff->af_pref.ht_used > 0) if (aff->af_pref.ht_used > 0)
smsg((char_u *)_( smsg(_("Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"),
"Defining COMPOUNDPERMITFLAG after PFX item may give wrong results in %s line %d"), fname, lnum);
fname, lnum);
} else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2) } else if (is_aff_rule(items, itemcnt, "COMPOUNDFLAG", 2)
&& compflags == NULL) { && compflags == NULL) {
// Turn flag "c" into COMPOUNDRULE compatible string "c+", // Turn flag "c" into COMPOUNDRULE compatible string "c+",
@ -4551,8 +4547,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// We don't use the count, but do check that it's a number and // We don't use the count, but do check that it's a number and
// not COMPOUNDRULE mistyped. // not COMPOUNDRULE mistyped.
if (atoi((char *)items[1]) == 0) if (atoi((char *)items[1]) == 0)
smsg((char_u *)_("Wrong COMPOUNDRULES value in %s line %d: %s"), smsg(_("Wrong COMPOUNDRULES value in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) { } else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) {
// Don't use the first rule if it is a number. // Don't use the first rule if it is a number.
if (compflags != NULL || *skipdigits(items[1]) != NUL) { if (compflags != NULL || *skipdigits(items[1]) != NUL) {
@ -4573,20 +4569,20 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
&& compmax == 0) { && compmax == 0) {
compmax = atoi((char *)items[1]); compmax = atoi((char *)items[1]);
if (compmax == 0) if (compmax == 0)
smsg((char_u *)_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"), smsg(_("Wrong COMPOUNDWORDMAX value in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2) } else if (is_aff_rule(items, itemcnt, "COMPOUNDMIN", 2)
&& compminlen == 0) { && compminlen == 0) {
compminlen = atoi((char *)items[1]); compminlen = atoi((char *)items[1]);
if (compminlen == 0) if (compminlen == 0)
smsg((char_u *)_("Wrong COMPOUNDMIN value in %s line %d: %s"), smsg(_("Wrong COMPOUNDMIN value in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2) } else if (is_aff_rule(items, itemcnt, "COMPOUNDSYLMAX", 2)
&& compsylmax == 0) { && compsylmax == 0) {
compsylmax = atoi((char *)items[1]); compsylmax = atoi((char *)items[1]);
if (compsylmax == 0) if (compsylmax == 0)
smsg((char_u *)_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"), smsg(_("Wrong COMPOUNDSYLMAX value in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) { } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDDUP", 1)) {
compoptions |= COMP_CHECKDUP; compoptions |= COMP_CHECKDUP;
} else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) { } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDREP", 1)) {
@ -4597,8 +4593,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
compoptions |= COMP_CHECKTRIPLE; compoptions |= COMP_CHECKTRIPLE;
} else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) { } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 2)) {
if (atoi((char *)items[1]) == 0) if (atoi((char *)items[1]) == 0)
smsg((char_u *)_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"), smsg(_("Wrong CHECKCOMPOUNDPATTERN value in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) { } else if (is_aff_rule(items, itemcnt, "CHECKCOMPOUNDPATTERN", 3)) {
garray_T *gap = &spin->si_comppat; garray_T *gap = &spin->si_comppat;
int i; int i;
@ -4650,12 +4646,11 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (!HASHITEM_EMPTY(hi)) { if (!HASHITEM_EMPTY(hi)) {
cur_aff = HI2AH(hi); cur_aff = HI2AH(hi);
if (cur_aff->ah_combine != (*items[2] == 'Y')) if (cur_aff->ah_combine != (*items[2] == 'Y'))
smsg((char_u *)_( smsg(_("Different combining flag in continued affix block in %s line %d: %s"),
"Different combining flag in continued affix block in %s line %d: %s"), fname, lnum, items[1]);
fname, lnum, items[1]);
if (!cur_aff->ah_follows) if (!cur_aff->ah_follows)
smsg((char_u *)_("Duplicate affix in %s line %d: %s"), smsg(_("Duplicate affix in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
} else { } else {
// New affix letter. // New affix letter.
cur_aff = (affheader_T *)getroom(spin, cur_aff = (affheader_T *)getroom(spin,
@ -4674,8 +4669,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
|| cur_aff->ah_flag == aff->af_nosuggest || cur_aff->ah_flag == aff->af_nosuggest
|| cur_aff->ah_flag == aff->af_needcomp || cur_aff->ah_flag == aff->af_needcomp
|| cur_aff->ah_flag == aff->af_comproot) || cur_aff->ah_flag == aff->af_comproot)
smsg((char_u *)_( smsg(_("Affix also used for "
"Affix also used for BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST in %s line %d: %s"), "BAD/RARE/KEEPCASE/NEEDAFFIX/NEEDCOMPOUND/NOSUGGEST"
"in %s line %d: %s"),
fname, lnum, items[1]); fname, lnum, items[1]);
STRCPY(cur_aff->ah_key, items[1]); STRCPY(cur_aff->ah_key, items[1]);
hash_add(tp, cur_aff->ah_key); hash_add(tp, cur_aff->ah_key);
@ -4697,10 +4693,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (itemcnt > lasti if (itemcnt > lasti
&& !aff->af_ignoreextra && !aff->af_ignoreextra
&& *items[lasti] != '#') && *items[lasti] != '#')
smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); smsg(_(e_afftrailing), fname, lnum, items[lasti]);
if (STRCMP(items[2], "Y") != 0 && STRCMP(items[2], "N") != 0) if (STRCMP(items[2], "Y") != 0 && STRCMP(items[2], "N") != 0)
smsg((char_u *)_("Expected Y or N in %s line %d: %s"), smsg(_("Expected Y or N in %s line %d: %s"),
fname, lnum, items[2]); fname, lnum, items[2]);
if (*items[0] == 'P' && aff->af_pfxpostpone) { if (*items[0] == 'P' && aff->af_pfxpostpone) {
@ -4735,7 +4731,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (itemcnt > lasti && *items[lasti] != '#' if (itemcnt > lasti && *items[lasti] != '#'
&& (STRCMP(items[lasti], "-") != 0 && (STRCMP(items[lasti], "-") != 0
|| itemcnt != lasti + 1)) || itemcnt != lasti + 1))
smsg((char_u *)_(e_afftrailing), fname, lnum, items[lasti]); smsg(_(e_afftrailing), fname, lnum, items[lasti]);
// New item for an affix letter. // New item for an affix letter.
--aff_todo; --aff_todo;
@ -4775,8 +4771,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
aff_entry->ae_prog = vim_regcomp(buf, aff_entry->ae_prog = vim_regcomp(buf,
RE_MAGIC + RE_STRING + RE_STRICT); RE_MAGIC + RE_STRING + RE_STRICT);
if (aff_entry->ae_prog == NULL) if (aff_entry->ae_prog == NULL)
smsg((char_u *)_("Broken condition in %s line %d: %s"), smsg(_("Broken condition in %s line %d: %s"),
fname, lnum, items[4]); fname, lnum, items[4]);
} }
// For postponed prefixes we need an entry in si_prefcond // For postponed prefixes we need an entry in si_prefcond
@ -4893,8 +4889,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
|| is_aff_rule(items, itemcnt, "REPSAL", 2)) { || is_aff_rule(items, itemcnt, "REPSAL", 2)) {
/* Ignore REP/REPSAL count */; /* Ignore REP/REPSAL count */;
if (!isdigit(*items[1])) if (!isdigit(*items[1]))
smsg((char_u *)_("Expected REP(SAL) count in %s line %d"), smsg(_("Expected REP(SAL) count in %s line %d"),
fname, lnum); fname, lnum);
} else if ((STRCMP(items[0], "REP") == 0 } else if ((STRCMP(items[0], "REP") == 0
|| STRCMP(items[0], "REPSAL") == 0) || STRCMP(items[0], "REPSAL") == 0)
&& itemcnt >= 3) { && itemcnt >= 3) {
@ -4902,7 +4898,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// Myspell ignores extra arguments, we require it starts with // Myspell ignores extra arguments, we require it starts with
// # to detect mistakes. // # to detect mistakes.
if (itemcnt > 3 && items[3][0] != '#') if (itemcnt > 3 && items[3][0] != '#')
smsg((char_u *)_(e_afftrailing), fname, lnum, items[3]); smsg(_(e_afftrailing), fname, lnum, items[3]);
if (items[0][3] == 'S' ? do_repsal : do_rep) { if (items[0][3] == 'S' ? do_repsal : do_rep) {
// Replace underscore with space (can't include a space // Replace underscore with space (can't include a space
// directly). // directly).
@ -4922,8 +4918,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// First line contains the count. // First line contains the count.
found_map = true; found_map = true;
if (!isdigit(*items[1])) if (!isdigit(*items[1]))
smsg((char_u *)_("Expected MAP count in %s line %d"), smsg(_("Expected MAP count in %s line %d"),
fname, lnum); fname, lnum);
} else if (do_mapline) { } else if (do_mapline) {
int c; int c;
@ -4934,8 +4930,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
&& vim_strchr(spin->si_map.ga_data, c) && vim_strchr(spin->si_map.ga_data, c)
!= NULL) != NULL)
|| vim_strchr(p, c) != NULL) || vim_strchr(p, c) != NULL)
smsg((char_u *)_("Duplicate character in MAP in %s line %d"), smsg(_("Duplicate character in MAP in %s line %d"),
fname, lnum); fname, lnum);
} }
// We simply concatenate all the MAP strings, separated by // We simply concatenate all the MAP strings, separated by
@ -4978,8 +4974,8 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
} }
} }
} else } else
smsg((char_u *)_("Unrecognized or duplicate item in %s line %d: %s"), smsg(_("Unrecognized or duplicate item in %s line %d: %s"),
fname, lnum, items[0]); fname, lnum, items[0]);
} }
} }
@ -4999,7 +4995,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
&& !enc_utf8 && !enc_utf8
) { ) {
if (fol == NULL || low == NULL || upp == NULL) if (fol == NULL || low == NULL || upp == NULL)
smsg((char_u *)_("Missing FOL/LOW/UPP line in %s"), fname); smsg(_("Missing FOL/LOW/UPP line in %s"), fname);
else else
(void)set_spell_chartab(fol, low, upp); (void)set_spell_chartab(fol, low, upp);
} }
@ -5022,7 +5018,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (compsylmax != 0) { if (compsylmax != 0) {
if (syllable == NULL) if (syllable == NULL)
smsg((char_u *)_("COMPOUNDSYLMAX used without SYLLABLE")); smsg(_("COMPOUNDSYLMAX used without SYLLABLE"));
aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX"); aff_check_number(spin->si_compsylmax, compsylmax, "COMPOUNDSYLMAX");
spin->si_compsylmax = compsylmax; spin->si_compsylmax = compsylmax;
} }
@ -5052,10 +5048,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (sofofrom != NULL || sofoto != NULL) { if (sofofrom != NULL || sofoto != NULL) {
if (sofofrom == NULL || sofoto == NULL) if (sofofrom == NULL || sofoto == NULL)
smsg((char_u *)_("Missing SOFO%s line in %s"), smsg(_("Missing SOFO%s line in %s"),
sofofrom == NULL ? "FROM" : "TO", fname); sofofrom == NULL ? "FROM" : "TO", fname);
else if (!GA_EMPTY(&spin->si_sal)) else if (!GA_EMPTY(&spin->si_sal))
smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname); smsg(_("Both SAL and SOFO lines in %s"), fname);
else { else {
aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM"); aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM");
aff_check_string(spin->si_sofoto, sofoto, "SOFOTO"); aff_check_string(spin->si_sofoto, sofoto, "SOFOTO");
@ -5133,14 +5129,14 @@ static unsigned affitem2flag(int flagtype, char_u *item, char_u *fname, int lnum
res = get_affitem(flagtype, &p); res = get_affitem(flagtype, &p);
if (res == 0) { if (res == 0) {
if (flagtype == AFT_NUM) if (flagtype == AFT_NUM)
smsg((char_u *)_("Flag is not a number in %s line %d: %s"), smsg(_("Flag is not a number in %s line %d: %s"),
fname, lnum, item); fname, lnum, item);
else else
smsg((char_u *)_("Illegal flag in %s line %d: %s"), smsg(_("Illegal flag in %s line %d: %s"),
fname, lnum, item); fname, lnum, item);
} }
if (*p != NUL) { if (*p != NUL) {
smsg((char_u *)_(e_affname), fname, lnum, item); smsg(_(e_affname), fname, lnum, item);
return 0; return 0;
} }
@ -5294,16 +5290,16 @@ static bool flag_in_afflist(int flagtype, char_u *afflist, unsigned flag)
static void aff_check_number(int spinval, int affval, char *name) static void aff_check_number(int spinval, int affval, char *name)
{ {
if (spinval != 0 && spinval != affval) if (spinval != 0 && spinval != affval)
smsg((char_u *)_( smsg(_("%s value differs from what is used in another .aff file"),
"%s value differs from what is used in another .aff file"), name); name);
} }
// Give a warning when "spinval" and "affval" strings are set and not the same. // Give a warning when "spinval" and "affval" strings are set and not the same.
static void aff_check_string(char_u *spinval, char_u *affval, char *name) static void aff_check_string(char_u *spinval, char_u *affval, char *name)
{ {
if (spinval != NULL && STRCMP(spinval, affval) != 0) if (spinval != NULL && STRCMP(spinval, affval) != 0)
smsg((char_u *)_( smsg(_("%s value differs from what is used in another .aff file"),
"%s value differs from what is used in another .aff file"), name); name);
} }
// Returns true if strings "s1" and "s2" are equal. Also consider both being // Returns true if strings "s1" and "s2" are equal. Also consider both being
@ -5434,8 +5430,8 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
if (spin->si_conv.vc_type != CONV_NONE) { if (spin->si_conv.vc_type != CONV_NONE) {
pc = string_convert(&spin->si_conv, line, NULL); pc = string_convert(&spin->si_conv, line, NULL);
if (pc == NULL) { if (pc == NULL) {
smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), smsg(_("Conversion failure for word in %s line %d: %s"),
fname, lnum, line); fname, lnum, line);
continue; continue;
} }
w = pc; w = pc;
@ -5490,11 +5486,11 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
hi = hash_lookup(&ht, dw, hash); hi = hash_lookup(&ht, dw, hash);
if (!HASHITEM_EMPTY(hi)) { if (!HASHITEM_EMPTY(hi)) {
if (p_verbose > 0) if (p_verbose > 0)
smsg((char_u *)_("Duplicate word in %s line %d: %s"), smsg(_("Duplicate word in %s line %d: %s"),
fname, lnum, dw); fname, lnum, dw);
else if (duplicate == 0) else if (duplicate == 0)
smsg((char_u *)_("First duplicate word in %s line %d: %s"), smsg(_("First duplicate word in %s line %d: %s"),
fname, lnum, dw); fname, lnum, dw);
++duplicate; ++duplicate;
} else } else
hash_add_item(&ht, hi, dw, hash); hash_add_item(&ht, hi, dw, hash);
@ -5545,10 +5541,10 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
} }
if (duplicate > 0) if (duplicate > 0)
smsg((char_u *)_("%d duplicate word(s) in %s"), duplicate, fname); smsg(_("%d duplicate word(s) in %s"), duplicate, fname);
if (spin->si_ascii && non_ascii > 0) if (spin->si_ascii && non_ascii > 0)
smsg((char_u *)_("Ignored %d word(s) with non-ASCII characters in %s"), smsg(_("Ignored %d word(s) with non-ASCII characters in %s"),
non_ascii, fname); non_ascii, fname);
hash_clear(&ht); hash_clear(&ht);
fclose(fd); fclose(fd);
@ -5938,8 +5934,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
if (spin->si_conv.vc_type != CONV_NONE) { if (spin->si_conv.vc_type != CONV_NONE) {
pc = string_convert(&spin->si_conv, rline, NULL); pc = string_convert(&spin->si_conv, rline, NULL);
if (pc == NULL) { if (pc == NULL) {
smsg((char_u *)_("Conversion failure for word in %s line %d: %s"), smsg(_("Conversion failure for word in %s line %d: %s"),
fname, lnum, rline); fname, lnum, rline);
continue; continue;
} }
line = pc; line = pc;
@ -5952,13 +5948,11 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
++line; ++line;
if (STRNCMP(line, "encoding=", 9) == 0) { if (STRNCMP(line, "encoding=", 9) == 0) {
if (spin->si_conv.vc_type != CONV_NONE) if (spin->si_conv.vc_type != CONV_NONE)
smsg((char_u *)_( smsg(_("Duplicate /encoding= line ignored in %s line %d: %s"),
"Duplicate /encoding= line ignored in %s line %d: %s"), fname, lnum, line - 1);
fname, lnum, line - 1);
else if (did_word) else if (did_word)
smsg((char_u *)_( smsg(_("/encoding= line after word ignored in %s line %d: %s"),
"/encoding= line after word ignored in %s line %d: %s"), fname, lnum, line - 1);
fname, lnum, line - 1);
else { else {
char_u *enc; char_u *enc;
@ -5968,8 +5962,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
if (!spin->si_ascii if (!spin->si_ascii
&& convert_setup(&spin->si_conv, enc, && convert_setup(&spin->si_conv, enc,
p_enc) == FAIL) p_enc) == FAIL)
smsg((char_u *)_("Conversion in %s not supported: from %s to %s"), smsg(_("Conversion in %s not supported: from %s to %s"),
fname, line, p_enc); fname, line, p_enc);
xfree(enc); xfree(enc);
spin->si_conv.vc_fail = true; spin->si_conv.vc_fail = true;
} }
@ -5978,13 +5972,13 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
if (STRNCMP(line, "regions=", 8) == 0) { if (STRNCMP(line, "regions=", 8) == 0) {
if (spin->si_region_count > 1) if (spin->si_region_count > 1)
smsg((char_u *)_("Duplicate /regions= line ignored in %s line %d: %s"), smsg(_("Duplicate /regions= line ignored in %s line %d: %s"),
fname, lnum, line); fname, lnum, line);
else { else {
line += 8; line += 8;
if (STRLEN(line) > 16) if (STRLEN(line) > 16)
smsg((char_u *)_("Too many regions in %s line %d: %s"), smsg(_("Too many regions in %s line %d: %s"),
fname, lnum, line); fname, lnum, line);
else { else {
spin->si_region_count = (int)STRLEN(line) / 2; spin->si_region_count = (int)STRLEN(line) / 2;
STRCPY(spin->si_region_name, line); STRCPY(spin->si_region_name, line);
@ -5996,8 +5990,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
continue; continue;
} }
smsg((char_u *)_("/ line ignored in %s line %d: %s"), smsg(_("/ line ignored in %s line %d: %s"),
fname, lnum, line - 1); fname, lnum, line - 1);
continue; continue;
} }
@ -6022,14 +6016,14 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
l = *p - '0'; l = *p - '0';
if (l > spin->si_region_count) { if (l > spin->si_region_count) {
smsg((char_u *)_("Invalid region nr in %s line %d: %s"), smsg(_("Invalid region nr in %s line %d: %s"),
fname, lnum, p); fname, lnum, p);
break; break;
} }
regionmask |= 1 << (l - 1); regionmask |= 1 << (l - 1);
} else { } else {
smsg((char_u *)_("Unrecognized flags in %s line %d: %s"), smsg(_("Unrecognized flags in %s line %d: %s"),
fname, lnum, p); fname, lnum, p);
break; break;
} }
++p; ++p;
@ -7146,8 +7140,8 @@ static void spell_make_sugfile(spellinfo_T *spin, char_u *wfname)
if (sug_maketable(spin) == FAIL) if (sug_maketable(spin) == FAIL)
goto theend; goto theend;
smsg((char_u *)_("Number of words after soundfolding: %" PRId64), smsg(_("Number of words after soundfolding: %" PRId64),
(int64_t)spin->si_spellbuf->b_ml.ml_line_count); (int64_t)spin->si_spellbuf->b_ml.ml_line_count);
// Compress the soundfold trie. // Compress the soundfold trie.
spell_message(spin, (char_u *)_(msg_compressing)); spell_message(spin, (char_u *)_(msg_compressing));
@ -7254,7 +7248,7 @@ static int sug_filltree(spellinfo_T *spin, slang_T *slang)
} }
} }
smsg((char_u *)_("Total number of words: %d"), words_done); smsg(_("Total number of words: %d"), words_done);
return OK; return OK;
} }
@ -7847,8 +7841,8 @@ spell_add_word (
fputc('#', fd); fputc('#', fd);
if (undo) { if (undo) {
home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);
smsg((char_u *)_("Word '%.*s' removed from %s"), smsg(_("Word '%.*s' removed from %s"),
len, word, NameBuff); len, word, NameBuff);
} }
} }
fseek(fd, fpos_next, SEEK_SET); fseek(fd, fpos_next, SEEK_SET);
@ -7890,7 +7884,7 @@ spell_add_word (
fclose(fd); fclose(fd);
home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE); home_replace(NULL, fname, NameBuff, MAXPATHL, TRUE);
smsg((char_u *)_("Word '%.*s' added to %s"), len, word, NameBuff); smsg(_("Word '%.*s' added to %s"), len, word, NameBuff);
} }
} }
@ -8457,8 +8451,8 @@ void spell_suggest(int count)
MSG(_("Sorry, no suggestions")); MSG(_("Sorry, no suggestions"));
else if (count > 0) { else if (count > 0) {
if (count > sug.su_ga.ga_len) if (count > sug.su_ga.ga_len)
smsg((char_u *)_("Sorry, only %" PRId64 " suggestions"), smsg(_("Sorry, only %" PRId64 " suggestions"),
(int64_t)sug.su_ga.ga_len); (int64_t)sug.su_ga.ga_len);
} else { } else {
xfree(repl_from); xfree(repl_from);
repl_from = NULL; repl_from = NULL;
@ -11190,7 +11184,6 @@ badword:
} }
} }
} }
// smsg("word %s (%d): %s (%d)", sftword, sftnr, theword, orgnr);
} }
} }
@ -12901,7 +12894,7 @@ void ex_spelldump(exarg_T *eap)
get_option_value((char_u*)"spl", &dummy, &spl, OPT_LOCAL); get_option_value((char_u*)"spl", &dummy, &spl, OPT_LOCAL);
// Create a new empty buffer in a new window. // Create a new empty buffer in a new window.
do_cmdline_cmd((char_u *)"new"); do_cmdline_cmd("new");
// enable spelling locally in the new window // enable spelling locally in the new window
set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL); set_option_value((char_u*)"spell", TRUE, (char_u*)"", OPT_LOCAL);

View File

@ -3268,7 +3268,7 @@ static void syn_cmd_reset(exarg_T *eap, int syncing)
eap->nextcmd = check_nextcmd(eap->arg); eap->nextcmd = check_nextcmd(eap->arg);
if (!eap->skip) { if (!eap->skip) {
set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset"); set_internal_string_var((char_u *)"syntax_cmd", (char_u *)"reset");
do_cmdline_cmd((char_u *)"runtime! syntax/syncolor.vim"); do_cmdline_cmd("runtime! syntax/syncolor.vim");
do_unlet((char_u *)"g:syntax_cmd", TRUE); do_unlet((char_u *)"g:syntax_cmd", TRUE);
} }
} }
@ -3291,12 +3291,12 @@ static void syn_cmd_off(exarg_T *eap, int syncing)
static void syn_cmd_onoff(exarg_T *eap, char *name) static void syn_cmd_onoff(exarg_T *eap, char *name)
{ {
char_u buf[100]; char buf[100];
eap->nextcmd = check_nextcmd(eap->arg); eap->nextcmd = check_nextcmd(eap->arg);
if (!eap->skip) { if (!eap->skip) {
STRCPY(buf, "so "); strcpy(buf, "so ");
vim_snprintf((char *)buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name); vim_snprintf(buf + 3, sizeof(buf) - 3, SYNTAX_FNAME, name);
do_cmdline_cmd(buf); do_cmdline_cmd(buf);
} }
} }

View File

@ -856,7 +856,7 @@ do_tag (
* file didn't exist. Otherwise an EMSG() is given below. * file didn't exist. Otherwise an EMSG() is given below.
*/ */
if (nofile_fname != NULL && error_cur_match != cur_match) if (nofile_fname != NULL && error_cur_match != cur_match)
smsg((char_u *)_("File \"%s\" does not exist"), nofile_fname); smsg(_("File \"%s\" does not exist"), nofile_fname);
ic = (matches[cur_match][0] & MT_IC_OFF); ic = (matches[cur_match][0] & MT_IC_OFF);
@ -1289,7 +1289,7 @@ find_tags (
if (p_verbose >= 5) { if (p_verbose >= 5) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Searching tags file %s"), tag_fname); smsg(_("Searching tags file %s"), tag_fname);
verbose_leave(); verbose_leave();
} }
} }
@ -2511,7 +2511,7 @@ jumpto_tag (
check_cursor(); check_cursor();
} else { } else {
curwin->w_cursor.lnum = 1; /* start command in line 1 */ curwin->w_cursor.lnum = 1; /* start command in line 1 */
do_cmdline_cmd(pbuf); do_cmdline_cmd((char *)pbuf);
retval = OK; retval = OK;
} }
@ -2742,7 +2742,7 @@ add_tag_field (
if (dict_find(dict, (char_u *)field_name, -1) != NULL) { if (dict_find(dict, (char_u *)field_name, -1) != NULL) {
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Duplicate field name: %s"), field_name); smsg(_("Duplicate field name: %s"), field_name);
verbose_leave(); verbose_leave();
} }
return FAIL; return FAIL;

View File

@ -412,7 +412,7 @@ end:
ui_busy_stop(); ui_busy_stop();
if (close) { if (close) {
term->opts.close_cb(term->opts.data); term->opts.close_cb(term->opts.data);
do_cmdline_cmd((uint8_t *)"bwipeout!"); do_cmdline_cmd("bwipeout!");
} }
} }

View File

@ -159,12 +159,12 @@ static void u_check_tree(u_header_T *uhp,
/* Check pointers back are correct. */ /* Check pointers back are correct. */
if (uhp->uh_next.ptr != exp_uh_next) { if (uhp->uh_next.ptr != exp_uh_next) {
EMSG("uh_next wrong"); EMSG("uh_next wrong");
smsg((char_u *)"expected: 0x%x, actual: 0x%x", smsg("expected: 0x%x, actual: 0x%x",
exp_uh_next, uhp->uh_next.ptr); exp_uh_next, uhp->uh_next.ptr);
} }
if (uhp->uh_alt_prev.ptr != exp_uh_alt_prev) { if (uhp->uh_alt_prev.ptr != exp_uh_alt_prev) {
EMSG("uh_alt_prev wrong"); EMSG("uh_alt_prev wrong");
smsg((char_u *)"expected: 0x%x, actual: 0x%x", smsg("expected: 0x%x, actual: 0x%x",
exp_uh_alt_prev, uhp->uh_alt_prev.ptr); exp_uh_alt_prev, uhp->uh_alt_prev.ptr);
} }
@ -198,7 +198,7 @@ static void u_check(int newhead_may_be_NULL) {
EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead); EMSGN("b_u_curhead invalid: 0x%x", curbuf->b_u_curhead);
if (header_count != curbuf->b_u_numhead) { if (header_count != curbuf->b_u_numhead) {
EMSG("b_u_numhead invalid"); EMSG("b_u_numhead invalid");
smsg((char_u *)"expected: %" PRId64 ", actual: %" PRId64, smsg("expected: %" PRId64 ", actual: %" PRId64,
(int64_t)header_count, (int64_t)curbuf->b_u_numhead); (int64_t)header_count, (int64_t)curbuf->b_u_numhead);
} }
} }
@ -1013,8 +1013,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
if (file_name == NULL) { if (file_name == NULL) {
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *) smsg(_("Cannot write undo file in any directory in 'undodir'"));
_("Cannot write undo file in any directory in 'undodir'"));
verbose_leave(); verbose_leave();
} }
return; return;
@ -1048,9 +1047,8 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
if (name != NULL || p_verbose > 0) { if (name != NULL || p_verbose > 0) {
if (name == NULL) if (name == NULL)
verbose_enter(); verbose_enter();
smsg((char_u *) smsg(_("Will not overwrite with undo file, cannot read: %s"),
_("Will not overwrite with undo file, cannot read: %s"), file_name);
file_name);
if (name == NULL) if (name == NULL)
verbose_leave(); verbose_leave();
} }
@ -1064,9 +1062,8 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
if (name != NULL || p_verbose > 0) { if (name != NULL || p_verbose > 0) {
if (name == NULL) if (name == NULL)
verbose_enter(); verbose_enter();
smsg((char_u *) smsg(_("Will not overwrite, this is not an undo file: %s"),
_("Will not overwrite, this is not an undo file: %s"), file_name);
file_name);
if (name == NULL) if (name == NULL)
verbose_leave(); verbose_leave();
} }
@ -1094,7 +1091,7 @@ void u_write_undo(char_u *name, int forceit, buf_T *buf, char_u *hash)
(void)os_setperm(file_name, perm); (void)os_setperm(file_name, perm);
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Writing undo file: %s"), file_name); smsg(_("Writing undo file: %s"), file_name);
verbose_leave(); verbose_leave();
} }
@ -1236,8 +1233,8 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
&& file_info_undo.stat.st_uid != getuid()) { && file_info_undo.stat.st_uid != getuid()) {
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Not reading undo file, owner differs: %s"), smsg(_("Not reading undo file, owner differs: %s"),
file_name); file_name);
verbose_leave(); verbose_leave();
} }
return; return;
@ -1249,7 +1246,7 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
if (p_verbose > 0) { if (p_verbose > 0) {
verbose_enter(); verbose_enter();
smsg((char_u *)_("Reading undo file: %s"), file_name); smsg(_("Reading undo file: %s"), file_name);
verbose_leave(); verbose_leave();
} }
@ -1483,7 +1480,7 @@ void u_read_undo(char_u *name, char_u *hash, char_u *orig_name)
#endif #endif
if (name != NULL) { if (name != NULL) {
smsg((char_u *)_("Finished reading undo file %s"), file_name); smsg(_("Finished reading undo file %s"), file_name);
} }
goto theend; goto theend;
@ -2289,7 +2286,7 @@ u_undo_end (
} }
} }
smsg((char_u *)_("%" PRId64 " %s; %s #%" PRId64 " %s"), smsg(_("%" PRId64 " %s; %s #%" PRId64 " %s"),
u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount, u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount,
_(msgstr), _(msgstr),
did_undo ? _("before") : _("after"), did_undo ? _("before") : _("after"),

View File

@ -87,7 +87,7 @@ do_window (
linenr_T lnum = -1; linenr_T lnum = -1;
int type = FIND_DEFINE; int type = FIND_DEFINE;
size_t len; size_t len;
char_u cbuf[40]; char cbuf[40];
if (Prenum == 0) if (Prenum == 0)
Prenum1 = 1; Prenum1 = 1;
@ -124,7 +124,7 @@ do_window (
case Ctrl_HAT: case Ctrl_HAT:
case '^': case '^':
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("split #", cbuf, sizeof(cbuf), Prenum); cmd_with_count("split #", (char_u *)cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf); do_cmdline_cmd(cbuf);
break; break;
@ -135,12 +135,12 @@ do_window (
newwindow: newwindow:
if (Prenum) if (Prenum)
/* window height */ /* window height */
vim_snprintf((char *)cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum); vim_snprintf(cbuf, sizeof(cbuf) - 5, "%" PRId64, (int64_t)Prenum);
else else
cbuf[0] = NUL; cbuf[0] = NUL;
if (nchar == 'v' || nchar == Ctrl_V) if (nchar == 'v' || nchar == Ctrl_V)
STRCAT(cbuf, "v"); strcat(cbuf, "v");
STRCAT(cbuf, "new"); strcat(cbuf, "new");
do_cmdline_cmd(cbuf); do_cmdline_cmd(cbuf);
break; break;
@ -148,7 +148,7 @@ newwindow:
case Ctrl_Q: case Ctrl_Q:
case 'q': case 'q':
reset_VIsual_and_resel(); /* stop Visual mode */ reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("quit", cbuf, sizeof(cbuf), Prenum); cmd_with_count("quit", (char_u *)cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf); do_cmdline_cmd(cbuf);
break; break;
@ -156,7 +156,7 @@ newwindow:
case Ctrl_C: case Ctrl_C:
case 'c': case 'c':
reset_VIsual_and_resel(); /* stop Visual mode */ reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("close", cbuf, sizeof(cbuf), Prenum); cmd_with_count("close", (char_u *)cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf); do_cmdline_cmd(cbuf);
break; break;
@ -164,7 +164,7 @@ newwindow:
case Ctrl_Z: case Ctrl_Z:
case 'z': case 'z':
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
do_cmdline_cmd((char_u *)"pclose"); do_cmdline_cmd("pclose");
break; break;
/* cursor to preview window */ /* cursor to preview window */
@ -182,7 +182,7 @@ newwindow:
case Ctrl_O: case Ctrl_O:
case 'o': case 'o':
CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */ CHECK_CMDWIN reset_VIsual_and_resel(); /* stop Visual mode */
cmd_with_count("only", cbuf, sizeof(cbuf), Prenum); cmd_with_count("only", (char_u *)cbuf, sizeof(cbuf), Prenum);
do_cmdline_cmd(cbuf); do_cmdline_cmd(cbuf);
break; break;
@ -430,7 +430,7 @@ wingotofile:
* cursor in a new window. * cursor in a new window.
*/ */
if (bt_quickfix(curbuf)) { if (bt_quickfix(curbuf)) {
sprintf((char *)cbuf, "split +%" PRId64 "%s", sprintf(cbuf, "split +%" PRId64 "%s",
(int64_t)curwin->w_cursor.lnum, (int64_t)curwin->w_cursor.lnum,
(curwin->w_llist_ref == NULL) ? "cc" : "ll"); (curwin->w_llist_ref == NULL) ? "cc" : "ll");
do_cmdline_cmd(cbuf); do_cmdline_cmd(cbuf);