diff src/fileio.c @ 15543:dd725a8ab112 v8.1.0779

patch 8.1.0779: argument for message functions is inconsistent commit https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 19 17:43:09 2019 +0100 patch 8.1.0779: argument for message functions is inconsistent Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *".
author Bram Moolenaar <Bram@vim.org>
date Sat, 19 Jan 2019 17:45:07 +0100
parents 959cf4c63b18
children d89c5b339c2a
line wrap: on
line diff
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2586,7 +2586,7 @@ failed:
 		p = msg_may_trunc(FALSE, IObuff);
 	    else
 #endif
-		p = msg_trunc_attr(IObuff, FALSE, 0);
+		p = (char_u *)msg_trunc_attr((char *)IObuff, FALSE, 0);
 	    if (read_stdin || read_buffer || restart_edit != 0
 		    || (msg_scrolled != 0 && !need_wait_return))
 		/* Need to repeat the message after redrawing when:
@@ -2902,28 +2902,28 @@ readfile_charconvert(
     int		*fdp)		/* in/out: file descriptor of file */
 {
     char_u	*tmpname;
-    char_u	*errmsg = NULL;
+    char	*errmsg = NULL;
 
     tmpname = vim_tempname('r', FALSE);
     if (tmpname == NULL)
-	errmsg = (char_u *)_("Can't find temp file for conversion");
+	errmsg = _("Can't find temp file for conversion");
     else
     {
 	close(*fdp);		/* close the input file, ignore errors */
 	*fdp = -1;
 	if (eval_charconvert(fenc, enc_utf8 ? (char_u *)"utf-8" : p_enc,
 						      fname, tmpname) == FAIL)
-	    errmsg = (char_u *)_("Conversion with 'charconvert' failed");
+	    errmsg = _("Conversion with 'charconvert' failed");
 	if (errmsg == NULL && (*fdp = mch_open((char *)tmpname,
 						  O_RDONLY | O_EXTRA, 0)) < 0)
-	    errmsg = (char_u *)_("can't read output of 'charconvert'");
+	    errmsg = _("can't read output of 'charconvert'");
     }
 
     if (errmsg != NULL)
     {
 	/* Don't use emsg(), it breaks mappings, the retry with
 	 * another type of conversion might still work. */
-	MSG(errmsg);
+	msg(errmsg);
 	if (tmpname != NULL)
 	{
 	    mch_remove(tmpname);	/* delete converted file */
@@ -4908,7 +4908,7 @@ restore_backup:
 		 * know we got the message. */
 		if (got_int)
 		{
-		    MSG(_(e_interr));
+		    msg(_(e_interr));
 		    out_flush();
 		}
 		if ((fd = mch_open((char *)backup, O_RDONLY | O_EXTRA, 0)) >= 0)
@@ -5007,7 +5007,7 @@ restore_backup:
 		STRCAT(IObuff, shortmess(SHM_WRI) ? _(" [w]") : _(" written"));
 	}
 
-	set_keep_msg(msg_trunc_attr(IObuff, FALSE, 0), 0);
+	set_keep_msg((char_u *)msg_trunc_attr((char *)IObuff, FALSE, 0), 0);
     }
 
     /* When written everything correctly: reset 'modified'.  Unless not
@@ -5157,9 +5157,9 @@ nofail:
 	retval = FAIL;
 	if (end == 0)
 	{
-	    MSG_PUTS_ATTR(_("\nWARNING: Original file may be lost or damaged\n"),
+	    msg_puts_attr(_("\nWARNING: Original file may be lost or damaged\n"),
 		    attr | MSG_HIST);
-	    MSG_PUTS_ATTR(_("don't quit the editor until the file is successfully written!"),
+	    msg_puts_attr(_("don't quit the editor until the file is successfully written!"),
 		    attr | MSG_HIST);
 
 	    /* Update the timestamp to avoid an "overwrite changed file"
@@ -5372,7 +5372,7 @@ check_mtime(buf_T *buf, stat_T *st)
 	msg_scroll = TRUE;	    /* don't overwrite messages here */
 	msg_silent = 0;		    /* must give this prompt */
 	/* don't use emsg() here, don't want to flush the buffers */
-	MSG_ATTR(_("WARNING: The file has been changed since reading it!!!"),
+	msg_attr(_("WARNING: The file has been changed since reading it!!!"),
 						       HL_ATTR(HLF_E));
 	if (ask_yesno((char_u *)_("Do you really want to write to it"),
 								 TRUE) == 'n')
@@ -6807,7 +6807,7 @@ check_timestamps(
 	if (need_wait_return && didit == 2)
 	{
 	    /* make sure msg isn't overwritten */
-	    msg_puts((char_u *)"\n");
+	    msg_puts("\n");
 	    out_flush();
 	}
     }
@@ -7093,10 +7093,9 @@ buf_check_timestamp(
 		if (!autocmd_busy)
 		{
 		    msg_start();
-		    msg_puts_attr((char_u *)tbuf, HL_ATTR(HLF_E) + MSG_HIST);
+		    msg_puts_attr(tbuf, HL_ATTR(HLF_E) + MSG_HIST);
 		    if (*mesg2 != NUL)
-			msg_puts_attr((char_u *)mesg2,
-						   HL_ATTR(HLF_W) + MSG_HIST);
+			msg_puts_attr(mesg2, HL_ATTR(HLF_W) + MSG_HIST);
 		    msg_clr_eos();
 		    (void)msg_end();
 		    if (emsg_silent == 0)
@@ -7926,12 +7925,12 @@ show_autocmd(AutoPat *ap, event_T event)
 	if (ap->group != AUGROUP_DEFAULT)
 	{
 	    if (AUGROUP_NAME(ap->group) == NULL)
-		msg_puts_attr(get_deleted_augroup(), HL_ATTR(HLF_E));
+		msg_puts_attr((char *)get_deleted_augroup(), HL_ATTR(HLF_E));
 	    else
-		msg_puts_attr(AUGROUP_NAME(ap->group), HL_ATTR(HLF_T));
-	    msg_puts((char_u *)"  ");
-	}
-	msg_puts_attr(event_nr2name(event), HL_ATTR(HLF_T));
+		msg_puts_attr((char *)AUGROUP_NAME(ap->group), HL_ATTR(HLF_T));
+	    msg_puts("  ");
+	}
+	msg_puts_attr((char *)event_nr2name(event), HL_ATTR(HLF_T));
 	last_event = event;
 	last_group = ap->group;
 	msg_putchar('\n');
@@ -8210,8 +8209,8 @@ do_augroup(char_u *arg, int del_group)
 	{
 	    if (AUGROUP_NAME(i) != NULL)
 	    {
-		msg_puts(AUGROUP_NAME(i));
-		msg_puts((char_u *)"  ");
+		msg_puts((char *)AUGROUP_NAME(i));
+		msg_puts("  ");
 	    }
 	}
 	msg_clr_eos();
@@ -8535,7 +8534,7 @@ do_autocmd(char_u *arg_in, int forceit)
     if (!forceit && *cmd == NUL)
     {
 	/* Highlight title */
-	MSG_PUTS_TITLE(_("\n--- Autocommands ---"));
+	msg_puts_title(_("\n--- Autocommands ---"));
     }
 
     /*
@@ -8902,7 +8901,7 @@ do_doautocmd(
 	    nothing_done = FALSE;
 
     if (nothing_done && do_msg)
-	MSG(_("No matching autocommands"));
+	msg(_("No matching autocommands"));
     if (did_something != NULL)
 	*did_something = !nothing_done;
 
@@ -9939,7 +9938,7 @@ getnextac(int c UNUSED, void *cookie, in
     {
 	verbose_enter_scroll();
 	smsg(_("autocommand %s"), ac->cmd);
-	msg_puts((char_u *)"\n");   /* don't overwrite this either */
+	msg_puts("\n");   /* don't overwrite this either */
 	verbose_leave_scroll();
     }
     retval = vim_strsave(ac->cmd);