0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.1.0743: giving error messages is not flexible

Problem:    Giving error messages is not flexible.
Solution:   Add semsg().  Change argument from "char_u *" to "char *", also
            for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes
            #3302)  Also make emsg() accept a "char *" argument.  Get rid of
            an enormous number of type casts.
This commit is contained in:
Bram Moolenaar
2019-01-13 23:38:42 +01:00
parent 05500ece62
commit f9e3e09fdc
95 changed files with 1963 additions and 2018 deletions

View File

@@ -776,7 +776,7 @@ mch_chdir(char *path)
if (p_verbose >= 5)
{
verbose_enter();
smsg((char_u *)"chdir(%s)", path);
smsg("chdir(%s)", path);
verbose_leave();
}
if (isalpha(path[0]) && path[1] == ':') /* has a drive name */
@@ -841,7 +841,7 @@ mch_check_messages(void)
int
mch_screenmode(char_u *arg UNUSED)
{
EMSG(_(e_screenmode));
emsg(_(e_screenmode));
return FAIL;
}
@@ -1004,7 +1004,7 @@ mch_libcall(
if (!fRunTimeLinkSuccess)
{
EMSG2(_(e_libcall), funcname);
semsg(_(e_libcall), funcname);
return FAIL;
}
@@ -1524,7 +1524,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
if (prt_dlg.hDC == NULL)
{
EMSG(_("E237: Printer selection failed"));
emsg(_("E237: Printer selection failed"));
mch_print_cleanup();
return FALSE;
}
@@ -1601,7 +1601,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
vim_memset(&fLogFont, 0, sizeof(fLogFont));
if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL)
{
EMSG2(_("E613: Unknown printer font: %s"), p_pfn);
semsg(_("E613: Unknown printer font: %s"), p_pfn);
mch_print_cleanup();
return FALSE;
}
@@ -1662,7 +1662,7 @@ init_fail_dlg:
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, 0, (LPTSTR)(&buf), 0, NULL);
EMSG2(_("E238: Print error: %s"),
semsg(_("E238: Print error: %s"),
buf == NULL ? (char_u *)_("Unknown") : buf);
LocalFree((LPVOID)(buf));
}
@@ -2504,7 +2504,7 @@ serverSendToVim(
if (target == 0)
{
if (!silent)
EMSG2(_(e_noserver), name);
semsg(_(e_noserver), name);
return -1;
}
@@ -3070,9 +3070,7 @@ get_logfont(
}
if (cp->name == NULL && verbose)
{
vim_snprintf((char *)IObuff, IOSIZE,
_("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
EMSG(IObuff);
semsg(_("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
break;
}
break;
@@ -3090,21 +3088,14 @@ get_logfont(
}
if (qp->name == NULL && verbose)
{
vim_snprintf((char *)IObuff, IOSIZE,
_("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
EMSG(IObuff);
semsg(_("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
break;
}
break;
}
default:
if (verbose)
{
vim_snprintf((char *)IObuff, IOSIZE,
_("E245: Illegal char '%c' in font name \"%s\""),
p[-1], name);
EMSG(IObuff);
}
semsg(_("E245: Illegal char '%c' in font name \"%s\""), p[-1], name);
goto theend;
}
while (*p == ':')