comparison src/os_mswin.c @ 15470:55ccc2d353bd v8.1.0743

patch 8.1.0743: giving error messages is not flexible commit https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jan 13 23:38:42 2019 +0100 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.
author Bram Moolenaar <Bram@vim.org>
date Sun, 13 Jan 2019 23:45:08 +0100
parents 16b2f2db6f28
children 639b8318472c
comparison
equal deleted inserted replaced
15469:bc9b5261ed01 15470:55ccc2d353bd
774 return -1; 774 return -1;
775 775
776 if (p_verbose >= 5) 776 if (p_verbose >= 5)
777 { 777 {
778 verbose_enter(); 778 verbose_enter();
779 smsg((char_u *)"chdir(%s)", path); 779 smsg("chdir(%s)", path);
780 verbose_leave(); 780 verbose_leave();
781 } 781 }
782 if (isalpha(path[0]) && path[1] == ':') /* has a drive name */ 782 if (isalpha(path[0]) && path[1] == ':') /* has a drive name */
783 { 783 {
784 /* If we can change to the drive, skip that part of the path. If we 784 /* If we can change to the drive, skip that part of the path. If we
839 * set screen mode, always fails. 839 * set screen mode, always fails.
840 */ 840 */
841 int 841 int
842 mch_screenmode(char_u *arg UNUSED) 842 mch_screenmode(char_u *arg UNUSED)
843 { 843 {
844 EMSG(_(e_screenmode)); 844 emsg(_(e_screenmode));
845 return FAIL; 845 return FAIL;
846 } 846 }
847 847
848 848
849 #if defined(FEAT_LIBCALL) || defined(PROTO) 849 #if defined(FEAT_LIBCALL) || defined(PROTO)
1002 (void)FreeLibrary(hinstLib); 1002 (void)FreeLibrary(hinstLib);
1003 } 1003 }
1004 1004
1005 if (!fRunTimeLinkSuccess) 1005 if (!fRunTimeLinkSuccess)
1006 { 1006 {
1007 EMSG2(_(e_libcall), funcname); 1007 semsg(_(e_libcall), funcname);
1008 return FAIL; 1008 return FAIL;
1009 } 1009 }
1010 1010
1011 return OK; 1011 return OK;
1012 } 1012 }
1522 stored_nCopies = prt_dlg.nCopies; 1522 stored_nCopies = prt_dlg.nCopies;
1523 } 1523 }
1524 1524
1525 if (prt_dlg.hDC == NULL) 1525 if (prt_dlg.hDC == NULL)
1526 { 1526 {
1527 EMSG(_("E237: Printer selection failed")); 1527 emsg(_("E237: Printer selection failed"));
1528 mch_print_cleanup(); 1528 mch_print_cleanup();
1529 return FALSE; 1529 return FALSE;
1530 } 1530 }
1531 1531
1532 /* Not all printer drivers report the support of color (or grey) in the 1532 /* Not all printer drivers report the support of color (or grey) in the
1599 * Initialise the font according to 'printfont' 1599 * Initialise the font according to 'printfont'
1600 */ 1600 */
1601 vim_memset(&fLogFont, 0, sizeof(fLogFont)); 1601 vim_memset(&fLogFont, 0, sizeof(fLogFont));
1602 if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL) 1602 if (get_logfont(&fLogFont, p_pfn, prt_dlg.hDC, TRUE) == FAIL)
1603 { 1603 {
1604 EMSG2(_("E613: Unknown printer font: %s"), p_pfn); 1604 semsg(_("E613: Unknown printer font: %s"), p_pfn);
1605 mch_print_cleanup(); 1605 mch_print_cleanup();
1606 return FALSE; 1606 return FALSE;
1607 } 1607 }
1608 1608
1609 for (pifBold = 0; pifBold <= 1; pifBold++) 1609 for (pifBold = 0; pifBold <= 1; pifBold++)
1660 * CommDlgExtendedError(). What does? */ 1660 * CommDlgExtendedError(). What does? */
1661 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | 1661 FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
1662 FORMAT_MESSAGE_FROM_SYSTEM | 1662 FORMAT_MESSAGE_FROM_SYSTEM |
1663 FORMAT_MESSAGE_IGNORE_INSERTS, 1663 FORMAT_MESSAGE_IGNORE_INSERTS,
1664 NULL, err, 0, (LPTSTR)(&buf), 0, NULL); 1664 NULL, err, 0, (LPTSTR)(&buf), 0, NULL);
1665 EMSG2(_("E238: Print error: %s"), 1665 semsg(_("E238: Print error: %s"),
1666 buf == NULL ? (char_u *)_("Unknown") : buf); 1666 buf == NULL ? (char_u *)_("Unknown") : buf);
1667 LocalFree((LPVOID)(buf)); 1667 LocalFree((LPVOID)(buf));
1668 } 1668 }
1669 else 1669 else
1670 msg_clr_eos(); /* Maybe canceled */ 1670 msg_clr_eos(); /* Maybe canceled */
2502 target = findServer(altname_buf); 2502 target = findServer(altname_buf);
2503 2503
2504 if (target == 0) 2504 if (target == 0)
2505 { 2505 {
2506 if (!silent) 2506 if (!silent)
2507 EMSG2(_(e_noserver), name); 2507 semsg(_(e_noserver), name);
2508 return -1; 2508 return -1;
2509 } 2509 }
2510 2510
2511 if (ptarget) 2511 if (ptarget)
2512 *(HWND *)ptarget = target; 2512 *(HWND *)ptarget = target;
3068 p += strlen(cp->name); 3068 p += strlen(cp->name);
3069 break; 3069 break;
3070 } 3070 }
3071 if (cp->name == NULL && verbose) 3071 if (cp->name == NULL && verbose)
3072 { 3072 {
3073 vim_snprintf((char *)IObuff, IOSIZE, 3073 semsg(_("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
3074 _("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
3075 EMSG(IObuff);
3076 break; 3074 break;
3077 } 3075 }
3078 break; 3076 break;
3079 } 3077 }
3080 case 'q': 3078 case 'q':
3088 p += strlen(qp->name); 3086 p += strlen(qp->name);
3089 break; 3087 break;
3090 } 3088 }
3091 if (qp->name == NULL && verbose) 3089 if (qp->name == NULL && verbose)
3092 { 3090 {
3093 vim_snprintf((char *)IObuff, IOSIZE, 3091 semsg(_("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
3094 _("E244: Illegal quality name \"%s\" in font name \"%s\""), p, name);
3095 EMSG(IObuff);
3096 break; 3092 break;
3097 } 3093 }
3098 break; 3094 break;
3099 } 3095 }
3100 default: 3096 default:
3101 if (verbose) 3097 if (verbose)
3102 { 3098 semsg(_("E245: Illegal char '%c' in font name \"%s\""), p[-1], name);
3103 vim_snprintf((char *)IObuff, IOSIZE,
3104 _("E245: Illegal char '%c' in font name \"%s\""),
3105 p[-1], name);
3106 EMSG(IObuff);
3107 }
3108 goto theend; 3099 goto theend;
3109 } 3100 }
3110 while (*p == ':') 3101 while (*p == ':')
3111 p++; 3102 p++;
3112 } 3103 }