Mercurial > vim
comparison src/os_mswin.c @ 8080:b6cb94ad97a4 v7.4.1334
commit https://github.com/vim/vim/commit/6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 16 15:06:59 2016 +0100
patch 7.4.1334
Problem: Many compiler warnings with MingW.
Solution: Add type casts. (Yasuhiro Matsumoto)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 16 Feb 2016 15:15:06 +0100 |
parents | c079097365f3 |
children | 54cfe888c627 |
comparison
equal
deleted
inserted
replaced
8079:6dac7e594219 | 8080:b6cb94ad97a4 |
---|---|
271 | 271 |
272 /* Init the tables for toupper() and tolower() */ | 272 /* Init the tables for toupper() and tolower() */ |
273 for (i = 0; i < 256; ++i) | 273 for (i = 0; i < 256; ++i) |
274 toupper_tab[i] = tolower_tab[i] = i; | 274 toupper_tab[i] = tolower_tab[i] = i; |
275 #ifdef WIN3264 | 275 #ifdef WIN3264 |
276 CharUpperBuff(toupper_tab, 256); | 276 CharUpperBuff((LPSTR)toupper_tab, 256); |
277 CharLowerBuff(tolower_tab, 256); | 277 CharLowerBuff((LPSTR)tolower_tab, 256); |
278 #else | 278 #else |
279 AnsiUpperBuff(toupper_tab, 256); | 279 AnsiUpperBuff((LPSTR)toupper_tab, 256); |
280 AnsiLowerBuff(tolower_tab, 256); | 280 AnsiLowerBuff((LPSTR)tolower_tab, 256); |
281 #endif | 281 #endif |
282 } | 282 } |
283 | 283 |
284 | 284 |
285 /* | 285 /* |
325 if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) | 325 if (n != 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED) |
326 return; | 326 return; |
327 } | 327 } |
328 } | 328 } |
329 # endif | 329 # endif |
330 SetConsoleTitle(title); | 330 SetConsoleTitle((LPCSTR)title); |
331 } | 331 } |
332 # endif | 332 # endif |
333 } | 333 } |
334 | 334 |
335 | 335 |
426 vim_free(cname); | 426 vim_free(cname); |
427 } | 427 } |
428 if (nResult == FAIL) /* fall back to non-wide function */ | 428 if (nResult == FAIL) /* fall back to non-wide function */ |
429 #endif | 429 #endif |
430 { | 430 { |
431 if (_fullpath(buf, fname, len - 1) == NULL) | 431 if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL) |
432 { | 432 { |
433 /* failed, use relative path name */ | 433 /* failed, use relative path name */ |
434 vim_strncpy(buf, fname, len - 1); | 434 vim_strncpy(buf, fname, len - 1); |
435 } | 435 } |
436 else | 436 else |
467 if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\')) | 467 if ((fname[0] && fname[1] == ':' && (fname[2] == '/' || fname[2] == '\\')) |
468 || (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\'))) | 468 || (fname[0] == fname[1] && (fname[0] == '/' || fname[0] == '\\'))) |
469 return TRUE; | 469 return TRUE; |
470 | 470 |
471 /* A name that can't be made absolute probably isn't absolute. */ | 471 /* A name that can't be made absolute probably isn't absolute. */ |
472 if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL) | 472 if (mch_FullName(fname, (char_u *)szName, sizeof(szName) - 1, FALSE) == FAIL) |
473 return FALSE; | 473 return FALSE; |
474 | 474 |
475 return pathcmp(fname, szName, -1) == 0; | 475 return pathcmp((const char *)fname, (const char *)szName, -1) == 0; |
476 } | 476 } |
477 | 477 |
478 /* | 478 /* |
479 * Replace all slashes by backslashes. | 479 * Replace all slashes by backslashes. |
480 * This used to be the other way around, but MS-DOS sometimes has problems | 480 * This used to be the other way around, but MS-DOS sometimes has problems |
617 { | 617 { |
618 #ifdef FEAT_MBYTE | 618 #ifdef FEAT_MBYTE |
619 /* WinNT and later can use _MAX_PATH wide characters for a pathname, which | 619 /* WinNT and later can use _MAX_PATH wide characters for a pathname, which |
620 * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is | 620 * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is |
621 * UTF-8. */ | 621 * UTF-8. */ |
622 char buf[_MAX_PATH * 3 + 1]; | 622 char_u buf[_MAX_PATH * 3 + 1]; |
623 #else | 623 #else |
624 char buf[_MAX_PATH + 1]; | 624 char_u buf[_MAX_PATH + 1]; |
625 #endif | 625 #endif |
626 char *p; | 626 char_u *p; |
627 | 627 |
628 vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); | 628 vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); |
629 p = buf + strlen(buf); | 629 p = buf + STRLEN(buf); |
630 if (p > buf) | 630 if (p > buf) |
631 mb_ptr_back(buf, p); | 631 mb_ptr_back(buf, p); |
632 | 632 |
633 /* Remove trailing '\\' except root path. */ | 633 /* Remove trailing '\\' except root path. */ |
634 if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':') | 634 if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':') |
635 *p = NUL; | 635 *p = NUL; |
636 | 636 |
637 if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) | 637 if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) |
638 { | 638 { |
639 /* UNC root path must be followed by '\\'. */ | 639 /* UNC root path must be followed by '\\'. */ |
640 p = vim_strpbrk(buf + 2, "\\/"); | 640 p = vim_strpbrk(buf + 2, (char_u *)"\\/"); |
641 if (p != NULL) | 641 if (p != NULL) |
642 { | 642 { |
643 p = vim_strpbrk(p + 1, "\\/"); | 643 p = vim_strpbrk(p + 1, (char_u *)"\\/"); |
644 if (p == NULL) | 644 if (p == NULL) |
645 STRCAT(buf, "\\"); | 645 STRCAT(buf, "\\"); |
646 } | 646 } |
647 } | 647 } |
648 #ifdef FEAT_MBYTE | 648 #ifdef FEAT_MBYTE |
666 * GetLastError() here and it's unclear what errno gets set to if | 666 * GetLastError() here and it's unclear what errno gets set to if |
667 * the _wstat() fails for missing wide functions. */ | 667 * the _wstat() fails for missing wide functions. */ |
668 } | 668 } |
669 } | 669 } |
670 #endif | 670 #endif |
671 return stat_symlink_aware(buf, stp); | 671 return stat_symlink_aware((char *)buf, stp); |
672 } | 672 } |
673 | 673 |
674 #if defined(FEAT_GUI_MSWIN) || defined(PROTO) | 674 #if defined(FEAT_GUI_MSWIN) || defined(PROTO) |
675 /*ARGSUSED*/ | 675 /*ARGSUSED*/ |
676 void | 676 void |
818 return 0; | 818 return 0; |
819 | 819 |
820 #ifdef FEAT_MBYTE | 820 #ifdef FEAT_MBYTE |
821 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | 821 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
822 { | 822 { |
823 WCHAR *p = enc_to_utf16(path, NULL); | 823 WCHAR *p = enc_to_utf16((char_u *)path, NULL); |
824 int n; | 824 int n; |
825 | 825 |
826 if (p != NULL) | 826 if (p != NULL) |
827 { | 827 { |
828 n = _wchdir(p); | 828 n = _wchdir(p); |
851 return TRUE; /* GUI starts a new console anyway */ | 851 return TRUE; /* GUI starts a new console anyway */ |
852 #else | 852 #else |
853 if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80) | 853 if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80) |
854 return TRUE; | 854 return TRUE; |
855 if (give_msg) | 855 if (give_msg) |
856 msg(_("'columns' is not 80, cannot execute external commands")); | 856 msg((char_u *) |
857 _("'columns' is not 80, cannot execute external commands")); | |
857 return FALSE; | 858 return FALSE; |
858 #endif | 859 #endif |
859 } | 860 } |
860 | 861 |
861 #ifdef FEAT_GUI_MSWIN | 862 #ifdef FEAT_GUI_MSWIN |
913 { | 914 { |
914 SYSTEM_INFO si; | 915 SYSTEM_INFO si; |
915 MEMORY_BASIC_INFORMATION mbi; | 916 MEMORY_BASIC_INFORMATION mbi; |
916 size_t length = 0; | 917 size_t length = 0; |
917 size_t i; | 918 size_t i; |
918 const char *p; | 919 const char_u *p; |
919 | 920 |
920 /* get page size */ | 921 /* get page size */ |
921 GetSystemInfo(&si); | 922 GetSystemInfo(&si); |
922 | 923 |
923 /* get memory information */ | 924 /* get memory information */ |
951 mch_icon_load_cb(char_u *fname, void *cookie) | 952 mch_icon_load_cb(char_u *fname, void *cookie) |
952 { | 953 { |
953 HANDLE *h = (HANDLE *)cookie; | 954 HANDLE *h = (HANDLE *)cookie; |
954 | 955 |
955 *h = LoadImage(NULL, | 956 *h = LoadImage(NULL, |
956 fname, | 957 (LPSTR)fname, |
957 IMAGE_ICON, | 958 IMAGE_ICON, |
958 64, | 959 64, |
959 64, | 960 64, |
960 LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); | 961 LR_LOADFROMFILE | LR_LOADMAP3DCOLORS); |
961 } | 962 } |
990 | 991 |
991 // Get a handle to the DLL module. | 992 // Get a handle to the DLL module. |
992 # ifdef WIN16 | 993 # ifdef WIN16 |
993 hinstLib = LoadLibrary(libname); | 994 hinstLib = LoadLibrary(libname); |
994 # else | 995 # else |
995 hinstLib = vimLoadLib(libname); | 996 hinstLib = vimLoadLib((char *)libname); |
996 # endif | 997 # endif |
997 | 998 |
998 // If the handle is valid, try to get the function address. | 999 // If the handle is valid, try to get the function address. |
999 if (hinstLib != NULL) | 1000 if (hinstLib != NULL) |
1000 { | 1001 { |
1003 { | 1004 { |
1004 #endif | 1005 #endif |
1005 if (argstring != NULL) | 1006 if (argstring != NULL) |
1006 { | 1007 { |
1007 /* Call with string argument */ | 1008 /* Call with string argument */ |
1008 ProcAdd = (MYSTRPROCSTR) GetProcAddress(hinstLib, funcname); | 1009 ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname); |
1009 if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0) | 1010 if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0) |
1010 { | 1011 { |
1011 if (string_result == NULL) | 1012 if (string_result == NULL) |
1012 retval_int = ((MYSTRPROCINT)ProcAdd)(argstring); | 1013 retval_int = ((MYSTRPROCINT)ProcAdd)((LPSTR)argstring); |
1013 else | 1014 else |
1014 retval_str = (ProcAdd)(argstring); | 1015 retval_str = (char_u *)(ProcAdd)((LPSTR)argstring); |
1015 } | 1016 } |
1016 } | 1017 } |
1017 else | 1018 else |
1018 { | 1019 { |
1019 /* Call with number argument */ | 1020 /* Call with number argument */ |
1020 ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, funcname); | 1021 ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, (LPCSTR)funcname); |
1021 if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0) | 1022 if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0) |
1022 { | 1023 { |
1023 if (string_result == NULL) | 1024 if (string_result == NULL) |
1024 retval_int = ((MYINTPROCINT)ProcAddI)(argint); | 1025 retval_int = ((MYINTPROCINT)ProcAddI)(argint); |
1025 else | 1026 else |
1026 retval_str = (ProcAddI)(argint); | 1027 retval_str = (char_u *)(ProcAddI)(argint); |
1027 } | 1028 } |
1028 } | 1029 } |
1029 | 1030 |
1030 // Save the string before we free the library. | 1031 // Save the string before we free the library. |
1031 // Assume that a "1" result is an illegal pointer. | 1032 // Assume that a "1" result is an illegal pointer. |
1226 { | 1227 { |
1227 ret = SetDlgItemTextW(hDlg, nIDDlgItem, wp); | 1228 ret = SetDlgItemTextW(hDlg, nIDDlgItem, wp); |
1228 vim_free(wp); | 1229 vim_free(wp); |
1229 return ret; | 1230 return ret; |
1230 } | 1231 } |
1231 return SetDlgItemText(hDlg, nIDDlgItem, s); | 1232 return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s); |
1232 } | 1233 } |
1233 #endif | 1234 #endif |
1234 | 1235 |
1235 /* | 1236 /* |
1236 * Convert BGR to RGB for Windows GDI calls | 1237 * Convert BGR to RGB for Windows GDI calls |
1281 hfont = CreateFontIndirect(&nm.lfMessageFont); | 1282 hfont = CreateFontIndirect(&nm.lfMessageFont); |
1282 for (i = IDC_PRINTTEXT1; i <= IDC_PROGRESS; i++) | 1283 for (i = IDC_PRINTTEXT1; i <= IDC_PROGRESS; i++) |
1283 { | 1284 { |
1284 SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); | 1285 SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); |
1285 if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) | 1286 if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) |
1286 vimSetDlgItemText(hDlg,i, _(buff)); | 1287 vimSetDlgItemText(hDlg,i, (char_u *)_(buff)); |
1287 } | 1288 } |
1288 SendDlgItemMessage(hDlg, IDCANCEL, | 1289 SendDlgItemMessage(hDlg, IDCANCEL, |
1289 WM_SETFONT, (WPARAM)hfont, 1); | 1290 WM_SETFONT, (WPARAM)hfont, 1); |
1290 if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) | 1291 if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) |
1291 vimSetDlgItemText(hDlg,IDCANCEL, _(buff)); | 1292 vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff)); |
1292 } | 1293 } |
1293 #endif | 1294 #endif |
1294 SetWindowText(hDlg, szAppName); | 1295 SetWindowText(hDlg, (LPCSTR)szAppName); |
1295 if (prt_name != NULL) | 1296 if (prt_name != NULL) |
1296 { | 1297 { |
1297 vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name); | 1298 vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); |
1298 vim_free(prt_name); | 1299 vim_free(prt_name); |
1299 prt_name = NULL; | 1300 prt_name = NULL; |
1300 } | 1301 } |
1301 EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); | 1302 EnableMenuItem(GetSystemMenu(hDlg, FALSE), SC_CLOSE, MF_GRAYED); |
1302 #ifndef FEAT_GUI | 1303 #ifndef FEAT_GUI |
1583 /* | 1584 /* |
1584 * MSDN suggests setting the first parameter to WINSPOOL for | 1585 * MSDN suggests setting the first parameter to WINSPOOL for |
1585 * NT, but NULL appears to work just as well. | 1586 * NT, but NULL appears to work just as well. |
1586 */ | 1587 */ |
1587 if (*p_pdev != NUL) | 1588 if (*p_pdev != NUL) |
1588 prt_dlg.hDC = CreateDC(NULL, p_pdev, NULL, NULL); | 1589 prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL); |
1589 else | 1590 else |
1590 #endif | 1591 #endif |
1591 { | 1592 { |
1592 prt_dlg.Flags |= PD_RETURNDEFAULT; | 1593 prt_dlg.Flags |= PD_RETURNDEFAULT; |
1593 if (PrintDlg(&prt_dlg) == 0) | 1594 if (PrintDlg(&prt_dlg) == 0) |
1647 devname = (DEVNAMES *)GlobalLock(prt_dlg.hDevNames); | 1648 devname = (DEVNAMES *)GlobalLock(prt_dlg.hDevNames); |
1648 if (devname != 0) | 1649 if (devname != 0) |
1649 { | 1650 { |
1650 char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; | 1651 char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; |
1651 char_u *port_name = (char_u *)devname +devname->wOutputOffset; | 1652 char_u *port_name = (char_u *)devname +devname->wOutputOffset; |
1652 char_u *text = _("to %s on %s"); | 1653 char_u *text = (char_u *)_("to %s on %s"); |
1653 #ifdef FEAT_MBYTE | 1654 #ifdef FEAT_MBYTE |
1654 char_u *printer_name_orig = printer_name; | 1655 char_u *printer_name_orig = printer_name; |
1655 char_u *port_name_orig = port_name; | 1656 char_u *port_name_orig = port_name; |
1656 | 1657 |
1657 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | 1658 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
1669 } | 1670 } |
1670 #endif | 1671 #endif |
1671 prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) | 1672 prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) |
1672 + STRLEN(text))); | 1673 + STRLEN(text))); |
1673 if (prt_name != NULL) | 1674 if (prt_name != NULL) |
1674 wsprintf(prt_name, text, printer_name, port_name); | 1675 wsprintf((char *)prt_name, (const char *)text, |
1676 printer_name, port_name); | |
1675 #ifdef FEAT_MBYTE | 1677 #ifdef FEAT_MBYTE |
1676 if (printer_name != printer_name_orig) | 1678 if (printer_name != printer_name_orig) |
1677 vim_free(printer_name); | 1679 vim_free(printer_name); |
1678 if (port_name != port_name_orig) | 1680 if (port_name != port_name_orig) |
1679 vim_free(port_name); | 1681 vim_free(port_name); |
1779 Escape(prt_dlg.hDC, SETABORTPROC, 0, (LPSTR)AbortProc, NULL); | 1781 Escape(prt_dlg.hDC, SETABORTPROC, 0, (LPSTR)AbortProc, NULL); |
1780 #else | 1782 #else |
1781 SetAbortProc(prt_dlg.hDC, AbortProc); | 1783 SetAbortProc(prt_dlg.hDC, AbortProc); |
1782 #endif | 1784 #endif |
1783 wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); | 1785 wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); |
1784 vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer); | 1786 vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer); |
1785 | 1787 |
1786 vim_memset(&di, 0, sizeof(DOCINFO)); | 1788 vim_memset(&di, 0, sizeof(DOCINFO)); |
1787 di.cbSize = sizeof(DOCINFO); | 1789 di.cbSize = sizeof(DOCINFO); |
1788 di.lpszDocName = psettings->jobname; | 1790 di.lpszDocName = (LPCSTR)psettings->jobname; |
1789 ret = StartDoc(prt_dlg.hDC, &di); | 1791 ret = StartDoc(prt_dlg.hDC, &di); |
1790 | 1792 |
1791 #ifdef FEAT_GUI | 1793 #ifdef FEAT_GUI |
1792 /* Give focus back to main window (when using MDI). */ | 1794 /* Give focus back to main window (when using MDI). */ |
1793 SetFocus(s_hwnd); | 1795 SetFocus(s_hwnd); |
1813 | 1815 |
1814 int | 1816 int |
1815 mch_print_begin_page(char_u *msg) | 1817 mch_print_begin_page(char_u *msg) |
1816 { | 1818 { |
1817 if (msg != NULL) | 1819 if (msg != NULL) |
1818 vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg); | 1820 vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg); |
1819 return (StartPage(prt_dlg.hDC) > 0); | 1821 return (StartPage(prt_dlg.hDC) > 0); |
1820 } | 1822 } |
1821 | 1823 |
1822 int | 1824 int |
1823 mch_print_blank_page(void) | 1825 mch_print_blank_page(void) |
1876 } | 1878 } |
1877 return ret; | 1879 return ret; |
1878 } | 1880 } |
1879 #endif | 1881 #endif |
1880 TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, | 1882 TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, |
1881 prt_pos_y + prt_top_margin, p, len); | 1883 prt_pos_y + prt_top_margin, |
1884 (LPCSTR)p, len); | |
1882 #ifndef FEAT_PROPORTIONAL_FONTS | 1885 #ifndef FEAT_PROPORTIONAL_FONTS |
1883 prt_pos_x += len * prt_tm.tmAveCharWidth; | 1886 prt_pos_x += len * prt_tm.tmAveCharWidth; |
1884 return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth | 1887 return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth |
1885 + prt_tm.tmOverhang > prt_right_margin); | 1888 + prt_tm.tmOverhang > prt_right_margin); |
1886 #else | 1889 #else |
1887 # ifdef WIN16 | 1890 # ifdef WIN16 |
1888 GetTextExtentPoint(prt_dlg.hDC, p, len, &sz); | 1891 GetTextExtentPoint(prt_dlg.hDC, (LPCSTR)p, len, &sz); |
1889 # else | 1892 # else |
1890 GetTextExtentPoint32(prt_dlg.hDC, p, len, &sz); | 1893 GetTextExtentPoint32(prt_dlg.hDC, (LPCSTR)p, len, &sz); |
1891 # endif | 1894 # endif |
1892 prt_pos_x += (sz.cx - prt_tm.tmOverhang); | 1895 prt_pos_x += (sz.cx - prt_tm.tmOverhang); |
1893 /* This is wrong when printing spaces for a TAB. */ | 1896 /* This is wrong when printing spaces for a TAB. */ |
1894 if (p[len] == NUL) | 1897 if (p[len] == NUL) |
1895 return FALSE; | 1898 return FALSE; |
2025 psl, &IID_IPersistFile, (void**)&ppf); | 2028 psl, &IID_IPersistFile, (void**)&ppf); |
2026 if (hr != S_OK) | 2029 if (hr != S_OK) |
2027 goto shortcut_end; | 2030 goto shortcut_end; |
2028 | 2031 |
2029 // full path string must be in Unicode. | 2032 // full path string must be in Unicode. |
2030 MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH); | 2033 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)fname, -1, wsz, MAX_PATH); |
2031 | 2034 |
2032 // "load" the name and resolve the link | 2035 // "load" the name and resolve the link |
2033 hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ); | 2036 hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ); |
2034 if (hr != S_OK) | 2037 if (hr != S_OK) |
2035 goto shortcut_end; | 2038 goto shortcut_end; |
2041 | 2044 |
2042 // Get the path to the link target. | 2045 // Get the path to the link target. |
2043 ZeroMemory(buf, MAX_PATH); | 2046 ZeroMemory(buf, MAX_PATH); |
2044 hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0); | 2047 hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0); |
2045 if (hr == S_OK && buf[0] != NUL) | 2048 if (hr == S_OK && buf[0] != NUL) |
2046 rfname = vim_strsave(buf); | 2049 rfname = vim_strsave((char_u *)buf); |
2047 | 2050 |
2048 shortcut_end: | 2051 shortcut_end: |
2049 // Release all interface pointers (both belong to the same object) | 2052 // Release all interface pointers (both belong to the same object) |
2050 if (ppf != NULL) | 2053 if (ppf != NULL) |
2051 ppf->lpVtbl->Release(ppf); | 2054 ppf->lpVtbl->Release(ppf); |
2232 res = eval_client_expr_to_string(str); | 2235 res = eval_client_expr_to_string(str); |
2233 vim_free(tofree); | 2236 vim_free(tofree); |
2234 | 2237 |
2235 if (res == NULL) | 2238 if (res == NULL) |
2236 { | 2239 { |
2237 res = vim_strsave(_(e_invexprmsg)); | 2240 res = vim_strsave((char_u *)_(e_invexprmsg)); |
2238 reply.dwData = COPYDATA_ERROR_RESULT; | 2241 reply.dwData = COPYDATA_ERROR_RESULT; |
2239 } | 2242 } |
2240 else | 2243 else |
2241 reply.dwData = COPYDATA_RESULT; | 2244 reply.dwData = COPYDATA_RESULT; |
2242 reply.lpData = res; | 2245 reply.lpData = res; |
2397 /* Get the title of the window */ | 2400 /* Get the title of the window */ |
2398 if (getVimServerName(hwnd, server, sizeof(server)) == 0) | 2401 if (getVimServerName(hwnd, server, sizeof(server)) == 0) |
2399 return TRUE; | 2402 return TRUE; |
2400 | 2403 |
2401 /* Add the name to the list */ | 2404 /* Add the name to the list */ |
2402 ga_concat(ga, server); | 2405 ga_concat(ga, (char_u *)server); |
2403 ga_concat(ga, "\n"); | 2406 ga_concat(ga, (char_u *)"\n"); |
2404 return TRUE; | 2407 return TRUE; |
2405 } | 2408 } |
2406 | 2409 |
2407 static HWND | 2410 static HWND |
2408 findServer(char_u *name) | 2411 findServer(char_u *name) |
2457 #ifdef FEAT_TITLE | 2460 #ifdef FEAT_TITLE |
2458 need_maketitle = TRUE; /* update Vim window title later */ | 2461 need_maketitle = TRUE; /* update Vim window title later */ |
2459 #endif | 2462 #endif |
2460 | 2463 |
2461 /* Update the message window title */ | 2464 /* Update the message window title */ |
2462 SetWindowText(message_window, ok_name); | 2465 SetWindowText(message_window, (LPCSTR)ok_name); |
2463 | 2466 |
2464 #ifdef FEAT_EVAL | 2467 #ifdef FEAT_EVAL |
2465 /* Set the servername variable */ | 2468 /* Set the servername variable */ |
2466 set_vim_var_string(VV_SEND_SERVER, serverName, -1); | 2469 set_vim_var_string(VV_SEND_SERVER, serverName, -1); |
2467 #endif | 2470 #endif |
2946 * lf->lfFaceName uses the current codepage. | 2949 * lf->lfFaceName uses the current codepage. |
2947 * TODO: Use Wide APIs instead of ANSI APIs. */ | 2950 * TODO: Use Wide APIs instead of ANSI APIs. */ |
2948 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) | 2951 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
2949 { | 2952 { |
2950 int len; | 2953 int len; |
2951 enc_to_acp(name, (int)strlen(name), &acpname, &len); | 2954 enc_to_acp(name, (int)strlen((char *)name), &acpname, &len); |
2952 name = acpname; | 2955 name = acpname; |
2953 } | 2956 } |
2954 #endif | 2957 #endif |
2955 if (STRCMP(name, "*") == 0) | 2958 if (STRCMP(name, "*") == 0) |
2956 { | 2959 { |