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

patch 7.4.1334

Problem:    Many compiler warnings with MingW.
Solution:   Add type casts. (Yasuhiro Matsumoto)
This commit is contained in:
Bram Moolenaar 2016-02-16 15:06:59 +01:00
parent f8df7addc5
commit 6aa2cd4be2
18 changed files with 194 additions and 153 deletions

View File

@ -58,7 +58,7 @@ extern HWND s_hwnd; /* Gvim's Window handle */
#ifdef WIN32 #ifdef WIN32
static int static int
fd_read(sock_T fd, char_u *buf, size_t len) fd_read(sock_T fd, char *buf, size_t len)
{ {
HANDLE h = (HANDLE)fd; HANDLE h = (HANDLE)fd;
DWORD nread; DWORD nread;
@ -69,7 +69,7 @@ fd_read(sock_T fd, char_u *buf, size_t len)
} }
static int static int
fd_write(sock_T fd, char_u *buf, size_t len) fd_write(sock_T fd, char *buf, size_t len)
{ {
HANDLE h = (HANDLE)fd; HANDLE h = (HANDLE)fd;
DWORD nwrite; DWORD nwrite;
@ -1393,7 +1393,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
/* reading from a pipe, not a socket */ /* reading from a pipe, not a socket */
while (TRUE) while (TRUE)
{ {
if (PeekNamedPipe(fd, NULL, 0, NULL, &nread, NULL) && nread > 0) if (PeekNamedPipe((HANDLE)fd, NULL, 0, NULL, &nread, NULL) && nread > 0)
return OK; return OK;
diff = deadline - GetTickCount(); diff = deadline - GetTickCount();
if (diff < 0) if (diff < 0)
@ -1509,9 +1509,9 @@ channel_read(channel_T *channel, int which, char *func)
if (channel_wait(channel, fd, 0) == FAIL) if (channel_wait(channel, fd, 0) == FAIL)
break; break;
if (use_socket) if (use_socket)
len = sock_read(fd, buf, MAXMSGSIZE); len = sock_read(fd, (char *)buf, MAXMSGSIZE);
else else
len = fd_read(fd, buf, MAXMSGSIZE); len = fd_read(fd, (char *)buf, MAXMSGSIZE);
if (len <= 0) if (len <= 0)
break; /* error or nothing more to read */ break; /* error or nothing more to read */
@ -1713,9 +1713,9 @@ channel_send(channel_T *channel, char_u *buf, char *fun)
} }
if (use_socket) if (use_socket)
res = sock_write(fd, buf, len); res = sock_write(fd, (char *)buf, len);
else else
res = fd_write(fd, buf, len); res = fd_write(fd, (char *)buf, len);
if (res != len) if (res != len)
{ {
if (!channel->ch_error && fun != NULL) if (!channel->ch_error && fun != NULL)

View File

@ -452,7 +452,7 @@ run_command(char *cmd)
/* /*
* Append a backslash to "name" if there isn't one yet. * Append a backslash to "name" if there isn't one yet.
*/ */
static void void
add_pathsep(char *name) add_pathsep(char *name)
{ {
int len = strlen(name); int len = strlen(name);

View File

@ -14554,7 +14554,7 @@ f_job_start(typval_T *argvars UNUSED, typval_T *rettv)
#ifdef USE_ARGV #ifdef USE_ARGV
mch_start_job(argv, job); mch_start_job(argv, job);
#else #else
mch_start_job(cmd, job); mch_start_job((char *)cmd, job);
#endif #endif
theend: theend:
@ -16410,7 +16410,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv)
return; /* type error; errmsg already given */ return; /* type error; errmsg already given */
} }
# ifdef WIN32 # ifdef WIN32
sscanf(serverid, SCANF_HEX_LONG_U, &n); sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n);
if (n == 0) if (n == 0)
rettv->vval.v_number = -1; rettv->vval.v_number = -1;
else else
@ -16456,7 +16456,7 @@ f_remote_read(typval_T *argvars UNUSED, typval_T *rettv)
/* The server's HWND is encoded in the 'id' parameter */ /* The server's HWND is encoded in the 'id' parameter */
long_u n = 0; long_u n = 0;
sscanf(serverid, SCANF_HEX_LONG_U, &n); sscanf((char *)serverid, SCANF_HEX_LONG_U, &n);
if (n != 0) if (n != 0)
r = serverGetReply((HWND)n, FALSE, TRUE, TRUE); r = serverGetReply((HWND)n, FALSE, TRUE, TRUE);
if (r == NULL) if (r == NULL)
@ -25415,7 +25415,7 @@ get_short_pathname(char_u **fnamep, char_u **bufp, int *fnamelen)
char_u *newbuf; char_u *newbuf;
len = *fnamelen; len = *fnamelen;
l = GetShortPathName(*fnamep, *fnamep, len); l = GetShortPathName((LPSTR)*fnamep, (LPSTR)*fnamep, len);
if (l > len - 1) if (l > len - 1)
{ {
/* If that doesn't work (not enough space), then save the string /* If that doesn't work (not enough space), then save the string
@ -25428,7 +25428,7 @@ get_short_pathname(char_u **fnamep, char_u **bufp, int *fnamelen)
*fnamep = *bufp = newbuf; *fnamep = *bufp = newbuf;
/* Really should always succeed, as the buffer is big enough. */ /* Really should always succeed, as the buffer is big enough. */
l = GetShortPathName(*fnamep, *fnamep, l+1); l = GetShortPathName((LPSTR)*fnamep, (LPSTR)*fnamep, l+1);
} }
*fnamelen = l; *fnamelen = l;
@ -25720,7 +25720,7 @@ repeat:
p = alloc(_MAX_PATH + 1); p = alloc(_MAX_PATH + 1);
if (p != NULL) if (p != NULL)
{ {
if (GetLongPathName(*fnamep, p, _MAX_PATH)) if (GetLongPathName((LPSTR)*fnamep, (LPSTR)p, _MAX_PATH))
{ {
vim_free(*bufp); vim_free(*bufp);
*bufp = *fnamep = p; *bufp = *fnamep = p;

View File

@ -4149,16 +4149,16 @@ ex_checktime(exarg_T *eap)
#if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
&& (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG))
# define HAVE_GET_LOCALE_VAL # define HAVE_GET_LOCALE_VAL
static char *get_locale_val(int what); static char_u *get_locale_val(int what);
static char * static char_u *
get_locale_val(int what) get_locale_val(int what)
{ {
char *loc; char_u *loc;
/* Obtain the locale value from the libraries. For DJGPP this is /* Obtain the locale value from the libraries. For DJGPP this is
* redefined and it doesn't use the arguments. */ * redefined and it doesn't use the arguments. */
loc = setlocale(what, NULL); loc = (char_u *)setlocale(what, NULL);
# ifdef WIN32 # ifdef WIN32
if (loc != NULL) if (loc != NULL)
@ -4222,7 +4222,7 @@ gettext_lang(char_u *name)
for (i = 0; mtable[i] != NULL; i += 2) for (i = 0; mtable[i] != NULL; i += 2)
if (STRNICMP(mtable[i], name, STRLEN(mtable[i])) == 0) if (STRNICMP(mtable[i], name, STRLEN(mtable[i])) == 0)
return mtable[i + 1]; return (char_u *)mtable[i + 1];
return name; return name;
} }
#endif #endif
@ -4239,13 +4239,13 @@ get_mess_lang(void)
# ifdef HAVE_GET_LOCALE_VAL # ifdef HAVE_GET_LOCALE_VAL
# if defined(LC_MESSAGES) # if defined(LC_MESSAGES)
p = (char_u *)get_locale_val(LC_MESSAGES); p = get_locale_val(LC_MESSAGES);
# else # else
/* This is necessary for Win32, where LC_MESSAGES is not defined and $LANG /* This is necessary for Win32, where LC_MESSAGES is not defined and $LANG
* may be set to the LCID number. LC_COLLATE is the best guess, LC_TIME * may be set to the LCID number. LC_COLLATE is the best guess, LC_TIME
* and LC_MONETARY may be set differently for a Japanese working in the * and LC_MONETARY may be set differently for a Japanese working in the
* US. */ * US. */
p = (char_u *)get_locale_val(LC_COLLATE); p = get_locale_val(LC_COLLATE);
# endif # endif
# else # else
p = mch_getenv((char_u *)"LC_ALL"); p = mch_getenv((char_u *)"LC_ALL");
@ -4290,7 +4290,7 @@ get_mess_env(void)
p = NULL; /* ignore something like "1043" */ p = NULL; /* ignore something like "1043" */
# ifdef HAVE_GET_LOCALE_VAL # ifdef HAVE_GET_LOCALE_VAL
if (p == NULL || *p == NUL) if (p == NULL || *p == NUL)
p = (char_u *)get_locale_val(LC_CTYPE); p = get_locale_val(LC_CTYPE);
# endif # endif
} }
} }
@ -4310,7 +4310,7 @@ set_lang_var(void)
char_u *loc; char_u *loc;
# ifdef HAVE_GET_LOCALE_VAL # ifdef HAVE_GET_LOCALE_VAL
loc = (char_u *)get_locale_val(LC_CTYPE); loc = get_locale_val(LC_CTYPE);
# else # else
/* setlocale() not supported: use the default value */ /* setlocale() not supported: use the default value */
loc = (char_u *)"C"; loc = (char_u *)"C";
@ -4320,14 +4320,14 @@ set_lang_var(void)
/* When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall /* When LC_MESSAGES isn't defined use the value from $LC_MESSAGES, fall
* back to LC_CTYPE if it's empty. */ * back to LC_CTYPE if it's empty. */
# if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES) # if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES)
loc = (char_u *)get_locale_val(LC_MESSAGES); loc = get_locale_val(LC_MESSAGES);
# else # else
loc = get_mess_env(); loc = get_mess_env();
# endif # endif
set_vim_var_string(VV_LANG, loc, -1); set_vim_var_string(VV_LANG, loc, -1);
# ifdef HAVE_GET_LOCALE_VAL # ifdef HAVE_GET_LOCALE_VAL
loc = (char_u *)get_locale_val(LC_TIME); loc = get_locale_val(LC_TIME);
# endif # endif
set_vim_var_string(VV_LC_TIME, loc, -1); set_vim_var_string(VV_LC_TIME, loc, -1);
} }

View File

@ -626,8 +626,8 @@ getcmdline(
#endif #endif
if (vim_ispathsep(ccline.cmdbuff[j]) if (vim_ispathsep(ccline.cmdbuff[j])
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
&& vim_strchr(" *?[{`$%#", ccline.cmdbuff[j + 1]) && vim_strchr((char_u *)" *?[{`$%#",
== NULL ccline.cmdbuff[j + 1]) == NULL
#endif #endif
) )
{ {

View File

@ -7480,11 +7480,11 @@ vim_tempname(
} }
strcpy(buf4, "VIM"); strcpy(buf4, "VIM");
buf4[2] = extra_char; /* make it "VIa", "VIb", etc. */ buf4[2] = extra_char; /* make it "VIa", "VIb", etc. */
if (GetTempFileName(szTempFile, buf4, 0, itmp) == 0) if (GetTempFileName(szTempFile, buf4, 0, (LPSTR)itmp) == 0)
return NULL; return NULL;
if (!keep) if (!keep)
/* GetTempFileName() will create the file, we don't want that */ /* GetTempFileName() will create the file, we don't want that */
(void)DeleteFile(itmp); (void)DeleteFile((LPSTR)itmp);
/* Backslashes in a temp file name cause problems when filtering with /* Backslashes in a temp file name cause problems when filtering with
* "sh". NOTE: This also checks 'shellcmdflag' to help those people who * "sh". NOTE: This also checks 'shellcmdflag' to help those people who

View File

@ -839,7 +839,7 @@ cs_create_connection(int i)
# ifdef __BORLANDC__ # ifdef __BORLANDC__
# define OPEN_OH_ARGTYPE long # define OPEN_OH_ARGTYPE long
# else # else
# if (_MSC_VER >= 1300) # if (_MSC_VER >= 1300) || defined(__MINGW32__)
# define OPEN_OH_ARGTYPE intptr_t # define OPEN_OH_ARGTYPE intptr_t
# else # else
# define OPEN_OH_ARGTYPE long # define OPEN_OH_ARGTYPE long
@ -1423,7 +1423,7 @@ cs_insert_filelist(
/* On windows 9x GetFileInformationByHandle doesn't work, so skip it */ /* On windows 9x GetFileInformationByHandle doesn't work, so skip it */
if (!mch_windows95()) if (!mch_windows95())
{ {
switch (win32_fileinfo(fname, &bhfi)) switch (win32_fileinfo((char_u *)fname, &bhfi))
{ {
case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */ case FILEINFO_ENC_FAIL: /* enc_to_utf16() failed */
case FILEINFO_READ_FAIL: /* CreateFile() failed */ case FILEINFO_READ_FAIL: /* CreateFile() failed */
@ -1459,7 +1459,8 @@ cs_insert_filelist(
&& csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino && csinfo[j].st_dev == sb->st_dev && csinfo[j].st_ino == sb->st_ino
#else #else
/* compare pathnames first */ /* compare pathnames first */
&& ((fullpathcmp(csinfo[j].fname, fname, FALSE) & FPC_SAME) && ((fullpathcmp((char_u *)csinfo[j].fname,
(char_u *)fname, FALSE) & FPC_SAME)
/* if not Windows 9x, test index file attributes too */ /* if not Windows 9x, test index file attributes too */
|| (!mch_windows95() || (!mch_windows95()
&& csinfo[j].nVolume == bhfi.dwVolumeSerialNumber && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber

View File

@ -49,6 +49,12 @@
# define __inline__ __inline # define __inline__ __inline
#endif #endif
#ifdef __GNUC__
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-variable"
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#endif
#include <EXTERN.h> #include <EXTERN.h>
#include <perl.h> #include <perl.h>
#include <XSUB.h> #include <XSUB.h>
@ -1730,3 +1736,6 @@ Append(vimbuf, ...)
} }
} }
#ifdef __GNUC__
# pragma GCC diagnostic pop
#endif

View File

@ -43,6 +43,15 @@
# undef _DEBUG # undef _DEBUG
#endif #endif
#ifdef HAVE_STRFTIME
# undef HAVE_STRFTIME
#endif
#ifdef HAVE_STRING_H
# undef HAVE_STRING_H
#endif
#ifdef HAVE_PUTENV
# undef HAVE_PUTENV
#endif
#ifdef HAVE_STDARG_H #ifdef HAVE_STDARG_H
# undef HAVE_STDARG_H /* Python's config.h defines it as well. */ # undef HAVE_STDARG_H /* Python's config.h defines it as well. */
#endif #endif

View File

@ -51,6 +51,15 @@
# undef F_BLANK # undef F_BLANK
#endif #endif
#ifdef HAVE_STRFTIME
# undef HAVE_STRFTIME
#endif
#ifdef HAVE_STRING_H
# undef HAVE_STRING_H
#endif
#ifdef HAVE_PUTENV
# undef HAVE_PUTENV
#endif
#ifdef HAVE_STDARG_H #ifdef HAVE_STDARG_H
# undef HAVE_STDARG_H /* Python's config.h defines it as well. */ # undef HAVE_STDARG_H /* Python's config.h defines it as well. */
#endif #endif

View File

@ -158,6 +158,10 @@
# define RSTRING_PTR(s) RSTRING(s)->ptr # define RSTRING_PTR(s) RSTRING(s)->ptr
#endif #endif
#ifdef HAVE_DUP
# undef HAVE_DUP
#endif
#include "vim.h" #include "vim.h"
#include "version.h" #include "version.h"
@ -253,6 +257,7 @@ static void ruby_vim_init(void);
# define rb_raise dll_rb_raise # define rb_raise dll_rb_raise
# define rb_str_cat dll_rb_str_cat # define rb_str_cat dll_rb_str_cat
# define rb_str_concat dll_rb_str_concat # define rb_str_concat dll_rb_str_concat
# undef rb_str_new
# define rb_str_new dll_rb_str_new # define rb_str_new dll_rb_str_new
# ifdef rb_str_new2 # ifdef rb_str_new2
/* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */ /* Ruby may #define rb_str_new2 to use rb_str_new_cstr. */
@ -300,7 +305,8 @@ static void ruby_vim_init(void);
# define ruby_script dll_ruby_script # define ruby_script dll_ruby_script
# define rb_enc_find_index dll_rb_enc_find_index # define rb_enc_find_index dll_rb_enc_find_index
# define rb_enc_find dll_rb_enc_find # define rb_enc_find dll_rb_enc_find
# define rb_enc_str_new dll_rb_enc_str_new # undef rb_enc_str_new
# define rb_enc_str_new dll_rb_enc_str_new
# define rb_sprintf dll_rb_sprintf # define rb_sprintf dll_rb_sprintf
# define rb_require dll_rb_require # define rb_require dll_rb_require
# define ruby_options dll_ruby_options # define ruby_options dll_ruby_options

View File

@ -3940,7 +3940,7 @@ build_drop_cmd(
} }
cdp = vim_strsave_escaped_ext(cwd, cdp = vim_strsave_escaped_ext(cwd,
#ifdef BACKSLASH_IN_FILENAME #ifdef BACKSLASH_IN_FILENAME
"", /* rem_backslash() will tell what chars to escape */ (char_u *)"", /* rem_backslash() will tell what chars to escape */
#else #else
PATH_ESC_CHARS, PATH_ESC_CHARS,
#endif #endif

View File

@ -473,7 +473,7 @@ enc_canon_props(char_u *name)
CPINFO cpinfo; CPINFO cpinfo;
/* Get info on this codepage to find out what it is. */ /* Get info on this codepage to find out what it is. */
if (GetCPInfo(atoi(name + 2), &cpinfo) != 0) if (GetCPInfo(atoi((char *)name + 2), &cpinfo) != 0)
{ {
if (cpinfo.MaxCharSize == 1) /* some single-byte encoding */ if (cpinfo.MaxCharSize == 1) /* some single-byte encoding */
return ENC_8BIT; return ENC_8BIT;
@ -535,7 +535,7 @@ mb_init(void)
CPINFO cpinfo; CPINFO cpinfo;
/* Get info on this codepage to find out what it is. */ /* Get info on this codepage to find out what it is. */
if (GetCPInfo(atoi(p_enc + 2), &cpinfo) != 0) if (GetCPInfo(atoi((char *)p_enc + 2), &cpinfo) != 0)
{ {
if (cpinfo.MaxCharSize == 1) if (cpinfo.MaxCharSize == 1)
{ {
@ -547,7 +547,7 @@ mb_init(void)
&& (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0)) && (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0))
{ {
/* must be a DBCS encoding, check below */ /* must be a DBCS encoding, check below */
enc_dbcs_new = atoi(p_enc + 2); enc_dbcs_new = atoi((char *)p_enc + 2);
} }
else else
goto codepage_invalid; goto codepage_invalid;
@ -571,7 +571,7 @@ codepage_invalid:
#ifdef WIN3264 #ifdef WIN3264
/* Windows: accept only valid codepage numbers, check below. */ /* Windows: accept only valid codepage numbers, check below. */
if (p_enc[6] != 'c' || p_enc[7] != 'p' if (p_enc[6] != 'c' || p_enc[7] != 'p'
|| (enc_dbcs_new = atoi(p_enc + 8)) == 0) || (enc_dbcs_new = atoi((char *)p_enc + 8)) == 0)
return e_invarg; return e_invarg;
#else #else
/* Unix: accept any "2byte-" name, assume current locale. */ /* Unix: accept any "2byte-" name, assume current locale. */
@ -4338,7 +4338,7 @@ get_iconv_import_func(HINSTANCE hInst, const char *funcname)
continue; continue;
pImpName = (PIMAGE_IMPORT_BY_NAME)(pImage pImpName = (PIMAGE_IMPORT_BY_NAME)(pImage
+ (UINT_PTR)(pINT->u1.AddressOfData)); + (UINT_PTR)(pINT->u1.AddressOfData));
if (strcmp(pImpName->Name, funcname) == 0) if (strcmp((char *)pImpName->Name, funcname) == 0)
return (void *)pIAT->u1.Function; return (void *)pIAT->u1.Function;
} }
} }
@ -6268,7 +6268,7 @@ string_convert_ext(
{ {
tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, tmp_len = MultiByteToWideChar(vcp->vc_cpfrom,
unconvlenp ? MB_ERR_INVALID_CHARS : 0, unconvlenp ? MB_ERR_INVALID_CHARS : 0,
ptr, len, 0, 0); (char *)ptr, len, 0, 0);
if (tmp_len == 0 if (tmp_len == 0
&& GetLastError() == ERROR_NO_UNICODE_TRANSLATION) && GetLastError() == ERROR_NO_UNICODE_TRANSLATION)
{ {
@ -6288,7 +6288,8 @@ string_convert_ext(
if (vcp->vc_cpfrom == 0) if (vcp->vc_cpfrom == 0)
utf8_to_utf16(ptr, len, tmp, unconvlenp); utf8_to_utf16(ptr, len, tmp, unconvlenp);
else else
MultiByteToWideChar(vcp->vc_cpfrom, 0, ptr, len, tmp, tmp_len); MultiByteToWideChar(vcp->vc_cpfrom, 0,
(char *)ptr, len, tmp, tmp_len);
/* 2. ucs-2 -> codepage/UTF-8. */ /* 2. ucs-2 -> codepage/UTF-8. */
if (vcp->vc_cpto == 0) if (vcp->vc_cpto == 0)
@ -6303,7 +6304,8 @@ string_convert_ext(
utf16_to_utf8(tmp, tmp_len, retval); utf16_to_utf8(tmp, tmp_len, retval);
else else
WideCharToMultiByte(vcp->vc_cpto, 0, WideCharToMultiByte(vcp->vc_cpto, 0,
tmp, tmp_len, retval, retlen, 0, 0); tmp, tmp_len,
(char *)retval, retlen, 0, 0);
retval[retlen] = NUL; retval[retlen] = NUL;
if (lenp != NULL) if (lenp != NULL)
*lenp = retlen; *lenp = retlen;

View File

@ -3779,7 +3779,7 @@ init_homedir(void)
homedrive = mch_getenv((char_u *)"HOMEDRIVE"); homedrive = mch_getenv((char_u *)"HOMEDRIVE");
homepath = mch_getenv((char_u *)"HOMEPATH"); homepath = mch_getenv((char_u *)"HOMEPATH");
if (homepath == NULL || *homepath == NUL) if (homepath == NULL || *homepath == NUL)
homepath = "\\"; homepath = (char_u *)"\\";
if (homedrive != NULL if (homedrive != NULL
&& STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL) && STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL)
{ {
@ -3817,7 +3817,7 @@ init_homedir(void)
* Best assumption we can make in such a situation. * Best assumption we can make in such a situation.
*/ */
if (var == NULL) if (var == NULL)
var = "C:/"; var = (char_u *)"C:/";
#endif #endif
if (var != NULL) if (var != NULL)
{ {
@ -9944,7 +9944,7 @@ dos_expandpath(
if (wn == NULL) if (wn == NULL)
# endif # endif
hFind = FindFirstFile(buf, &fb); hFind = FindFirstFile((LPCSTR)buf, &fb);
ok = (hFind != INVALID_HANDLE_VALUE); ok = (hFind != INVALID_HANDLE_VALUE);
#else #else
/* If we are expanding wildcards we try both files and directories */ /* If we are expanding wildcards we try both files and directories */
@ -10042,7 +10042,7 @@ dos_expandpath(
} }
if (wn == NULL) if (wn == NULL)
# endif # endif
hFind = FindFirstFile(buf, &fb); hFind = FindFirstFile((LPCSTR)buf, &fb);
ok = (hFind != INVALID_HANDLE_VALUE); ok = (hFind != INVALID_HANDLE_VALUE);
#else #else
ok = (findfirst((char *)buf, &fb, ok = (findfirst((char *)buf, &fb,

View File

@ -3196,7 +3196,7 @@ set_init_1(void)
# endif # endif
|| ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL) || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL)
# ifdef WIN3264 # ifdef WIN3264
|| ((p = default_shell()) != NULL && *p != NUL) || ((p = (char_u *)default_shell()) != NULL && *p != NUL)
# endif # endif
#endif #endif
) )
@ -3479,7 +3479,7 @@ set_init_1(void)
STRCPY(buf, "ja"); STRCPY(buf, "ja");
else else
buf[2] = NUL; /* truncate to two-letter code */ buf[2] = NUL; /* truncate to two-letter code */
vim_setenv("LANG", buf); vim_setenv((char_u *)"LANG", (char_u *)buf);
} }
} }
# else # else

View File

@ -273,11 +273,11 @@ mch_early_init(void)
for (i = 0; i < 256; ++i) for (i = 0; i < 256; ++i)
toupper_tab[i] = tolower_tab[i] = i; toupper_tab[i] = tolower_tab[i] = i;
#ifdef WIN3264 #ifdef WIN3264
CharUpperBuff(toupper_tab, 256); CharUpperBuff((LPSTR)toupper_tab, 256);
CharLowerBuff(tolower_tab, 256); CharLowerBuff((LPSTR)tolower_tab, 256);
#else #else
AnsiUpperBuff(toupper_tab, 256); AnsiUpperBuff((LPSTR)toupper_tab, 256);
AnsiLowerBuff(tolower_tab, 256); AnsiLowerBuff((LPSTR)tolower_tab, 256);
#endif #endif
} }
@ -327,7 +327,7 @@ mch_settitle(
} }
} }
# endif # endif
SetConsoleTitle(title); SetConsoleTitle((LPCSTR)title);
} }
# endif # endif
} }
@ -428,7 +428,7 @@ mch_FullName(
if (nResult == FAIL) /* fall back to non-wide function */ if (nResult == FAIL) /* fall back to non-wide function */
#endif #endif
{ {
if (_fullpath(buf, fname, len - 1) == NULL) if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL)
{ {
/* failed, use relative path name */ /* failed, use relative path name */
vim_strncpy(buf, fname, len - 1); vim_strncpy(buf, fname, len - 1);
@ -469,10 +469,10 @@ mch_isFullName(char_u *fname)
return TRUE; return TRUE;
/* A name that can't be made absolute probably isn't absolute. */ /* A name that can't be made absolute probably isn't absolute. */
if (mch_FullName(fname, szName, sizeof(szName) - 1, FALSE) == FAIL) if (mch_FullName(fname, (char_u *)szName, sizeof(szName) - 1, FALSE) == FAIL)
return FALSE; return FALSE;
return pathcmp(fname, szName, -1) == 0; return pathcmp((const char *)fname, (const char *)szName, -1) == 0;
} }
/* /*
@ -619,14 +619,14 @@ vim_stat(const char *name, struct stat *stp)
/* WinNT and later can use _MAX_PATH wide characters for a pathname, which /* WinNT and later can use _MAX_PATH wide characters for a pathname, which
* means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is
* UTF-8. */ * UTF-8. */
char buf[_MAX_PATH * 3 + 1]; char_u buf[_MAX_PATH * 3 + 1];
#else #else
char buf[_MAX_PATH + 1]; char_u buf[_MAX_PATH + 1];
#endif #endif
char *p; char_u *p;
vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1);
p = buf + strlen(buf); p = buf + STRLEN(buf);
if (p > buf) if (p > buf)
mb_ptr_back(buf, p); mb_ptr_back(buf, p);
@ -637,10 +637,10 @@ vim_stat(const char *name, struct stat *stp)
if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/')) if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/'))
{ {
/* UNC root path must be followed by '\\'. */ /* UNC root path must be followed by '\\'. */
p = vim_strpbrk(buf + 2, "\\/"); p = vim_strpbrk(buf + 2, (char_u *)"\\/");
if (p != NULL) if (p != NULL)
{ {
p = vim_strpbrk(p + 1, "\\/"); p = vim_strpbrk(p + 1, (char_u *)"\\/");
if (p == NULL) if (p == NULL)
STRCAT(buf, "\\"); STRCAT(buf, "\\");
} }
@ -668,7 +668,7 @@ vim_stat(const char *name, struct stat *stp)
} }
} }
#endif #endif
return stat_symlink_aware(buf, stp); return stat_symlink_aware((char *)buf, stp);
} }
#if defined(FEAT_GUI_MSWIN) || defined(PROTO) #if defined(FEAT_GUI_MSWIN) || defined(PROTO)
@ -820,7 +820,7 @@ mch_chdir(char *path)
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
WCHAR *p = enc_to_utf16(path, NULL); WCHAR *p = enc_to_utf16((char_u *)path, NULL);
int n; int n;
if (p != NULL) if (p != NULL)
@ -853,7 +853,8 @@ can_end_termcap_mode(
if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80) if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80)
return TRUE; return TRUE;
if (give_msg) if (give_msg)
msg(_("'columns' is not 80, cannot execute external commands")); msg((char_u *)
_("'columns' is not 80, cannot execute external commands"));
return FALSE; return FALSE;
#endif #endif
} }
@ -915,7 +916,7 @@ check_str_len(char_u *str)
MEMORY_BASIC_INFORMATION mbi; MEMORY_BASIC_INFORMATION mbi;
size_t length = 0; size_t length = 0;
size_t i; size_t i;
const char *p; const char_u *p;
/* get page size */ /* get page size */
GetSystemInfo(&si); GetSystemInfo(&si);
@ -953,7 +954,7 @@ mch_icon_load_cb(char_u *fname, void *cookie)
HANDLE *h = (HANDLE *)cookie; HANDLE *h = (HANDLE *)cookie;
*h = LoadImage(NULL, *h = LoadImage(NULL,
fname, (LPSTR)fname,
IMAGE_ICON, IMAGE_ICON,
64, 64,
64, 64,
@ -992,7 +993,7 @@ mch_libcall(
# ifdef WIN16 # ifdef WIN16
hinstLib = LoadLibrary(libname); hinstLib = LoadLibrary(libname);
# else # else
hinstLib = vimLoadLib(libname); hinstLib = vimLoadLib((char *)libname);
# endif # endif
// If the handle is valid, try to get the function address. // If the handle is valid, try to get the function address.
@ -1005,25 +1006,25 @@ mch_libcall(
if (argstring != NULL) if (argstring != NULL)
{ {
/* Call with string argument */ /* Call with string argument */
ProcAdd = (MYSTRPROCSTR) GetProcAddress(hinstLib, funcname); ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname);
if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0) if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0)
{ {
if (string_result == NULL) if (string_result == NULL)
retval_int = ((MYSTRPROCINT)ProcAdd)(argstring); retval_int = ((MYSTRPROCINT)ProcAdd)((LPSTR)argstring);
else else
retval_str = (ProcAdd)(argstring); retval_str = (char_u *)(ProcAdd)((LPSTR)argstring);
} }
} }
else else
{ {
/* Call with number argument */ /* Call with number argument */
ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, funcname); ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, (LPCSTR)funcname);
if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0) if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0)
{ {
if (string_result == NULL) if (string_result == NULL)
retval_int = ((MYINTPROCINT)ProcAddI)(argint); retval_int = ((MYINTPROCINT)ProcAddI)(argint);
else else
retval_str = (ProcAddI)(argint); retval_str = (char_u *)(ProcAddI)(argint);
} }
} }
@ -1228,7 +1229,7 @@ vimSetDlgItemText(HWND hDlg, int nIDDlgItem, char_u *s)
vim_free(wp); vim_free(wp);
return ret; return ret;
} }
return SetDlgItemText(hDlg, nIDDlgItem, s); return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s);
} }
#endif #endif
@ -1283,18 +1284,18 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{ {
SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1);
if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) if (GetDlgItemText(hDlg,i, buff, sizeof(buff)))
vimSetDlgItemText(hDlg,i, _(buff)); vimSetDlgItemText(hDlg,i, (char_u *)_(buff));
} }
SendDlgItemMessage(hDlg, IDCANCEL, SendDlgItemMessage(hDlg, IDCANCEL,
WM_SETFONT, (WPARAM)hfont, 1); WM_SETFONT, (WPARAM)hfont, 1);
if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff)))
vimSetDlgItemText(hDlg,IDCANCEL, _(buff)); vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff));
} }
#endif #endif
SetWindowText(hDlg, szAppName); SetWindowText(hDlg, (LPCSTR)szAppName);
if (prt_name != NULL) if (prt_name != NULL)
{ {
vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name); vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name);
vim_free(prt_name); vim_free(prt_name);
prt_name = NULL; prt_name = NULL;
} }
@ -1585,7 +1586,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
* NT, but NULL appears to work just as well. * NT, but NULL appears to work just as well.
*/ */
if (*p_pdev != NUL) if (*p_pdev != NUL)
prt_dlg.hDC = CreateDC(NULL, p_pdev, NULL, NULL); prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL);
else else
#endif #endif
{ {
@ -1649,7 +1650,7 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
{ {
char_u *printer_name = (char_u *)devname + devname->wDeviceOffset; char_u *printer_name = (char_u *)devname + devname->wDeviceOffset;
char_u *port_name = (char_u *)devname +devname->wOutputOffset; char_u *port_name = (char_u *)devname +devname->wOutputOffset;
char_u *text = _("to %s on %s"); char_u *text = (char_u *)_("to %s on %s");
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
char_u *printer_name_orig = printer_name; char_u *printer_name_orig = printer_name;
char_u *port_name_orig = port_name; char_u *port_name_orig = port_name;
@ -1671,7 +1672,8 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name) prt_name = alloc((unsigned)(STRLEN(printer_name) + STRLEN(port_name)
+ STRLEN(text))); + STRLEN(text)));
if (prt_name != NULL) if (prt_name != NULL)
wsprintf(prt_name, text, printer_name, port_name); wsprintf((char *)prt_name, (const char *)text,
printer_name, port_name);
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (printer_name != printer_name_orig) if (printer_name != printer_name_orig)
vim_free(printer_name); vim_free(printer_name);
@ -1781,11 +1783,11 @@ mch_print_begin(prt_settings_T *psettings)
SetAbortProc(prt_dlg.hDC, AbortProc); SetAbortProc(prt_dlg.hDC, AbortProc);
#endif #endif
wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname)); wsprintf(szBuffer, _("Printing '%s'"), gettail(psettings->jobname));
vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (LPSTR)szBuffer); vimSetDlgItemText(hDlgPrint, IDC_PRINTTEXT1, (char_u *)szBuffer);
vim_memset(&di, 0, sizeof(DOCINFO)); vim_memset(&di, 0, sizeof(DOCINFO));
di.cbSize = sizeof(DOCINFO); di.cbSize = sizeof(DOCINFO);
di.lpszDocName = psettings->jobname; di.lpszDocName = (LPCSTR)psettings->jobname;
ret = StartDoc(prt_dlg.hDC, &di); ret = StartDoc(prt_dlg.hDC, &di);
#ifdef FEAT_GUI #ifdef FEAT_GUI
@ -1815,7 +1817,7 @@ mch_print_end_page(void)
mch_print_begin_page(char_u *msg) mch_print_begin_page(char_u *msg)
{ {
if (msg != NULL) if (msg != NULL)
vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg); vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg);
return (StartPage(prt_dlg.hDC) > 0); return (StartPage(prt_dlg.hDC) > 0);
} }
@ -1878,16 +1880,17 @@ mch_print_text_out(char_u *p, int len)
} }
#endif #endif
TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin, TextOut(prt_dlg.hDC, prt_pos_x + prt_left_margin,
prt_pos_y + prt_top_margin, p, len); prt_pos_y + prt_top_margin,
(LPCSTR)p, len);
#ifndef FEAT_PROPORTIONAL_FONTS #ifndef FEAT_PROPORTIONAL_FONTS
prt_pos_x += len * prt_tm.tmAveCharWidth; prt_pos_x += len * prt_tm.tmAveCharWidth;
return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth
+ prt_tm.tmOverhang > prt_right_margin); + prt_tm.tmOverhang > prt_right_margin);
#else #else
# ifdef WIN16 # ifdef WIN16
GetTextExtentPoint(prt_dlg.hDC, p, len, &sz); GetTextExtentPoint(prt_dlg.hDC, (LPCSTR)p, len, &sz);
# else # else
GetTextExtentPoint32(prt_dlg.hDC, p, len, &sz); GetTextExtentPoint32(prt_dlg.hDC, (LPCSTR)p, len, &sz);
# endif # endif
prt_pos_x += (sz.cx - prt_tm.tmOverhang); prt_pos_x += (sz.cx - prt_tm.tmOverhang);
/* This is wrong when printing spaces for a TAB. */ /* This is wrong when printing spaces for a TAB. */
@ -2027,7 +2030,7 @@ shortcut_errorw:
goto shortcut_end; goto shortcut_end;
// full path string must be in Unicode. // full path string must be in Unicode.
MultiByteToWideChar(CP_ACP, 0, fname, -1, wsz, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)fname, -1, wsz, MAX_PATH);
// "load" the name and resolve the link // "load" the name and resolve the link
hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ); hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ);
@ -2043,7 +2046,7 @@ shortcut_errorw:
ZeroMemory(buf, MAX_PATH); ZeroMemory(buf, MAX_PATH);
hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0); hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0);
if (hr == S_OK && buf[0] != NUL) if (hr == S_OK && buf[0] != NUL)
rfname = vim_strsave(buf); rfname = vim_strsave((char_u *)buf);
shortcut_end: shortcut_end:
// Release all interface pointers (both belong to the same object) // Release all interface pointers (both belong to the same object)
@ -2234,7 +2237,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
if (res == NULL) if (res == NULL)
{ {
res = vim_strsave(_(e_invexprmsg)); res = vim_strsave((char_u *)_(e_invexprmsg));
reply.dwData = COPYDATA_ERROR_RESULT; reply.dwData = COPYDATA_ERROR_RESULT;
} }
else else
@ -2399,8 +2402,8 @@ enumWindowsGetNames(HWND hwnd, LPARAM lparam)
return TRUE; return TRUE;
/* Add the name to the list */ /* Add the name to the list */
ga_concat(ga, server); ga_concat(ga, (char_u *)server);
ga_concat(ga, "\n"); ga_concat(ga, (char_u *)"\n");
return TRUE; return TRUE;
} }
@ -2459,7 +2462,7 @@ serverSetName(char_u *name)
#endif #endif
/* Update the message window title */ /* Update the message window title */
SetWindowText(message_window, ok_name); SetWindowText(message_window, (LPCSTR)ok_name);
#ifdef FEAT_EVAL #ifdef FEAT_EVAL
/* Set the servername variable */ /* Set the servername variable */
@ -2948,7 +2951,7 @@ get_logfont(
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
int len; int len;
enc_to_acp(name, (int)strlen(name), &acpname, &len); enc_to_acp(name, (int)strlen((char *)name), &acpname, &len);
name = acpname; name = acpname;
} }
#endif #endif

View File

@ -91,7 +91,6 @@ FILE* fdDump = NULL;
*/ */
#ifdef PROTO #ifdef PROTO
#define WINAPI #define WINAPI
#define WINBASEAPI
typedef char * LPCSTR; typedef char * LPCSTR;
typedef char * LPWSTR; typedef char * LPWSTR;
typedef int ACCESS_MASK; typedef int ACCESS_MASK;
@ -148,14 +147,14 @@ typedef int PROCESS_INFORMATION;
* and Michael Dietrich for helping me figure out this workaround. * and Michael Dietrich for helping me figure out this workaround.
*/ */
/* WINBASEAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */ /* WINAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */
#ifndef WINBASEAPI #ifndef WINAPI
# define WINBASEAPI __stdcall # define WINAPI __stdcall
#endif #endif
#if defined(__BORLANDC__) #if defined(__BORLANDC__)
typedef BOOL (__stdcall *PFNGCKLN)(LPSTR); typedef BOOL (__stdcall *PFNGCKLN)(LPSTR);
#else #else
typedef WINBASEAPI BOOL (WINAPI *PFNGCKLN)(LPSTR); typedef BOOL (WINAPI *PFNGCKLN)(LPSTR);
#endif #endif
static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL; static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL;
#endif #endif
@ -340,6 +339,7 @@ msg_wait_for_multiple_objects(
dwMilliseconds, dwWakeMask); dwMilliseconds, dwWakeMask);
} }
#ifndef FEAT_CLIENTSERVER
static DWORD static DWORD
wait_for_single_object( wait_for_single_object(
HANDLE hHandle, HANDLE hHandle,
@ -349,6 +349,7 @@ wait_for_single_object(
return WAIT_OBJECT_0; return WAIT_OBJECT_0;
return WaitForSingleObject(hHandle, dwMilliseconds); return WaitForSingleObject(hHandle, dwMilliseconds);
} }
#endif
static void static void
get_exe_name(void) get_exe_name(void)
@ -388,7 +389,7 @@ get_exe_name(void)
STRCAT(temp, ";"); STRCAT(temp, ";");
} }
STRCAT(temp, exe_path); STRCAT(temp, exe_path);
vim_setenv((char_u *)"PATH", temp); vim_setenv((char_u *)"PATH", (char_u *)temp);
} }
} }
} }
@ -440,7 +441,7 @@ vimLoadLib(char *name)
/* Change directory to where the executable is, both to make /* Change directory to where the executable is, both to make
* sure we find a .dll there and to avoid looking for a .dll * sure we find a .dll there and to avoid looking for a .dll
* in the current directory. */ * in the current directory. */
SetCurrentDirectory(exe_path); SetCurrentDirectory((LPCSTR)exe_path);
dll = LoadLibrary(name); dll = LoadLibrary(name);
SetCurrentDirectoryW(old_dirw); SetCurrentDirectoryW(old_dirw);
return dll; return dll;
@ -453,7 +454,7 @@ vimLoadLib(char *name)
/* Change directory to where the executable is, both to make /* Change directory to where the executable is, both to make
* sure we find a .dll there and to avoid looking for a .dll * sure we find a .dll there and to avoid looking for a .dll
* in the current directory. */ * in the current directory. */
SetCurrentDirectory(exe_path); SetCurrentDirectory((LPCSTR)exe_path);
dll = LoadLibrary(name); dll = LoadLibrary(name);
SetCurrentDirectory(old_dir); SetCurrentDirectory(old_dir);
} }
@ -1961,7 +1962,7 @@ executable_exists(char *name, char_u **path)
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
WCHAR *p = enc_to_utf16(name, NULL); WCHAR *p = enc_to_utf16((char_u *)name, NULL);
WCHAR fnamew[_MAX_PATH]; WCHAR fnamew[_MAX_PATH];
WCHAR *dumw; WCHAR *dumw;
WCHAR *wcurpath, *wnewpath; WCHAR *wcurpath, *wnewpath;
@ -2003,10 +2004,10 @@ executable_exists(char *name, char_u **path)
vim_free(newpath); vim_free(newpath);
if (n == 0) if (n == 0)
return FALSE; return FALSE;
if (mch_isdir(fname)) if (mch_isdir((char_u *)fname))
return FALSE; return FALSE;
if (path != NULL) if (path != NULL)
*path = vim_strsave(fname); *path = vim_strsave((char_u *)fname);
return TRUE; return TRUE;
} }
@ -2383,7 +2384,7 @@ static ConsoleBuffer g_cbTermcap = { 0 };
#ifdef __BORLANDC__ #ifdef __BORLANDC__
typedef HWND (__stdcall *GETCONSOLEWINDOWPROC)(VOID); typedef HWND (__stdcall *GETCONSOLEWINDOWPROC)(VOID);
#else #else
typedef WINBASEAPI HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID); typedef HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID);
#endif #endif
char g_szOrigTitle[256] = { 0 }; char g_szOrigTitle[256] = { 0 };
HWND g_hWnd = NULL; /* also used in os_mswin.c */ HWND g_hWnd = NULL; /* also used in os_mswin.c */
@ -2439,18 +2440,15 @@ SetConsoleIcon(
HICON hIconSmall, HICON hIconSmall,
HICON hIcon) HICON hIcon)
{ {
HICON hPrevIconSmall;
HICON hPrevIcon;
if (hWnd == NULL) if (hWnd == NULL)
return FALSE; return FALSE;
if (hIconSmall != NULL) if (hIconSmall != NULL)
hPrevIconSmall = (HICON)SendMessage(hWnd, WM_SETICON, SendMessage(hWnd, WM_SETICON,
(WPARAM)ICON_SMALL, (LPARAM)hIconSmall); (WPARAM)ICON_SMALL, (LPARAM)hIconSmall);
if (hIcon != NULL) if (hIcon != NULL)
hPrevIcon = (HICON)SendMessage(hWnd, WM_SETICON, SendMessage(hWnd, WM_SETICON,
(WPARAM)ICON_BIG,(LPARAM) hIcon); (WPARAM)ICON_BIG, (LPARAM) hIcon);
return TRUE; return TRUE;
} }
@ -2496,7 +2494,7 @@ SaveConsoleTitleAndIcon(void)
/* Extract the first icon contained in the Vim executable. */ /* Extract the first icon contained in the Vim executable. */
if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL) if (mch_icon_load((HANDLE *)&g_hVimIcon) == FAIL || g_hVimIcon == NULL)
g_hVimIcon = ExtractIcon(NULL, exe_name, 0); g_hVimIcon = ExtractIcon(NULL, (LPCSTR)exe_name, 0);
if (g_hVimIcon != NULL) if (g_hVimIcon != NULL)
g_fCanChangeIcon = TRUE; g_fCanChangeIcon = TRUE;
} }
@ -2851,7 +2849,7 @@ fname_case(
return; return;
/* Build the new name in szTrueName[] one component at a time. */ /* Build the new name in szTrueName[] one component at a time. */
porig = name; porig = (char *)name;
ptrue = szTrueName; ptrue = szTrueName;
if (isalpha(porig[0]) && porig[1] == ':') if (isalpha(porig[0]) && porig[1] == ':')
@ -2877,7 +2875,7 @@ fname_case(
if (enc_dbcs) if (enc_dbcs)
{ {
l = (*mb_ptr2len)(porig); l = (*mb_ptr2len)((char_u *)porig);
while (--l >= 0) while (--l >= 0)
*ptrue++ = *porig++; *ptrue++ = *porig++;
} }
@ -2978,7 +2976,7 @@ mch_get_user_name(
#endif #endif
if (GetUserName(szUserName, &cch)) if (GetUserName(szUserName, &cch))
{ {
vim_strncpy(s, szUserName, len - 1); vim_strncpy(s, (char_u *)szUserName, len - 1);
return OK; return OK;
} }
s[0] = NUL; s[0] = NUL;
@ -3018,8 +3016,8 @@ mch_get_host_name(
/* Retry with non-wide function (for Windows 98). */ /* Retry with non-wide function (for Windows 98). */
} }
#endif #endif
if (!GetComputerName(s, &cch)) if (!GetComputerName((LPSTR)s, &cch))
vim_strncpy(s, "PC (Win32 Vim)", len - 1); vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1);
} }
@ -3069,7 +3067,7 @@ mch_dirname(
/* Retry with non-wide function (for Windows 98). */ /* Retry with non-wide function (for Windows 98). */
} }
#endif #endif
return (GetCurrentDirectory(len, buf) != 0 ? OK : FAIL); return (GetCurrentDirectory(len, (LPSTR)buf) != 0 ? OK : FAIL);
} }
/* /*
@ -3082,7 +3080,7 @@ mch_getperm(char_u *name)
struct stat st; struct stat st;
int n; int n;
n = mch_stat(name, &st); n = mch_stat((char *)name, &st);
return n == 0 ? (long)(unsigned short)st.st_mode : -1L; return n == 0 ? (long)(unsigned short)st.st_mode : -1L;
} }
@ -3113,7 +3111,7 @@ mch_setperm(char_u *name, long perm)
} }
if (n == -1) if (n == -1)
#endif #endif
n = _chmod(name, perm); n = _chmod((const char *)name, perm);
if (n == -1) if (n == -1)
return FAIL; return FAIL;
@ -3197,7 +3195,7 @@ mch_mkdir(char_u *name)
return retval; return retval;
} }
#endif #endif
return _mkdir(name); return _mkdir((const char *)name);
} }
/* /*
@ -3221,7 +3219,7 @@ mch_rmdir(char_u *name)
return retval; return retval;
} }
#endif #endif
return _rmdir(name); return _rmdir((const char *)name);
} }
/* /*
@ -3260,7 +3258,7 @@ mch_is_symbolic_link(char_u *name)
&& GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
{ {
/* Retry with non-wide function (for Windows 98). */ /* Retry with non-wide function (for Windows 98). */
hFind = FindFirstFile(name, &findDataA); hFind = FindFirstFile((LPCSTR)name, &findDataA);
if (hFind != INVALID_HANDLE_VALUE) if (hFind != INVALID_HANDLE_VALUE)
{ {
fileFlags = findDataA.dwFileAttributes; fileFlags = findDataA.dwFileAttributes;
@ -3276,7 +3274,7 @@ mch_is_symbolic_link(char_u *name)
else else
#endif #endif
{ {
hFind = FindFirstFile(name, &findDataA); hFind = FindFirstFile((LPCSTR)name, &findDataA);
if (hFind != INVALID_HANDLE_VALUE) if (hFind != INVALID_HANDLE_VALUE)
{ {
fileFlags = findDataA.dwFileAttributes; fileFlags = findDataA.dwFileAttributes;
@ -3347,8 +3345,8 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
} }
if (wn == NULL) if (wn == NULL)
#endif #endif
hFile = CreateFile(fname, /* file name */ hFile = CreateFile((LPCSTR)fname, /* file name */
GENERIC_READ, /* access mode */ GENERIC_READ, /* access mode */
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */ FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */
NULL, /* security descriptor */ NULL, /* security descriptor */
OPEN_EXISTING, /* creation disposition */ OPEN_EXISTING, /* creation disposition */
@ -3566,13 +3564,13 @@ mch_nodetype(char_u *name)
} }
if (wn == NULL) if (wn == NULL)
#endif #endif
hFile = CreateFile(name, /* file name */ hFile = CreateFile((LPCSTR)name, /* file name */
GENERIC_WRITE, /* access mode */ GENERIC_WRITE, /* access mode */
0, /* share mode */ 0, /* share mode */
NULL, /* security descriptor */ NULL, /* security descriptor */
OPEN_EXISTING, /* creation disposition */ OPEN_EXISTING, /* creation disposition */
0, /* file attributes */ 0, /* file attributes */
NULL); /* handle to template file */ NULL); /* handle to template file */
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
vim_free(wn); vim_free(wn);
@ -4084,7 +4082,7 @@ vim_create_process(
# ifdef FEAT_MBYTE # ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
WCHAR *wcmd = enc_to_utf16(cmd, NULL); WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
if (wcmd != NULL) if (wcmd != NULL)
{ {
@ -4725,7 +4723,7 @@ mch_system(char *cmd, int options)
{ {
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
WCHAR *wcmd = enc_to_utf16(cmd, NULL); WCHAR *wcmd = enc_to_utf16((char_u *)cmd, NULL);
if (wcmd != NULL) if (wcmd != NULL)
{ {
int ret = _wsystem(wcmd); int ret = _wsystem(wcmd);
@ -4768,7 +4766,7 @@ mch_call_shell(
wcscat(szShellTitle, L" :sh"); wcscat(szShellTitle, L" :sh");
else else
{ {
WCHAR *wn = enc_to_utf16(cmd, NULL); WCHAR *wn = enc_to_utf16((char_u *)cmd, NULL);
if (wn != NULL) if (wn != NULL)
{ {
@ -4793,8 +4791,9 @@ mch_call_shell(
else else
{ {
strcat(szShellTitle, " - !"); strcat(szShellTitle, " - !");
if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle))) if ((strlen(szShellTitle) + strlen((char *)cmd)
strcat(szShellTitle, cmd); < sizeof(szShellTitle)))
strcat(szShellTitle, (char *)cmd);
} }
SetConsoleTitle(szShellTitle); SetConsoleTitle(szShellTitle);
} }
@ -4831,7 +4830,7 @@ mch_call_shell(
if (cmd == NULL) if (cmd == NULL)
{ {
x = mch_system(p_sh, options); x = mch_system((char *)p_sh, options);
} }
else else
{ {
@ -4915,9 +4914,10 @@ mch_call_shell(
char_u *cmd_shell = mch_getenv("COMSPEC"); char_u *cmd_shell = mch_getenv("COMSPEC");
if (cmd_shell == NULL || *cmd_shell == NUL) if (cmd_shell == NULL || *cmd_shell == NUL)
cmd_shell = default_shell(); cmd_shell = (char_u *)default_shell();
subcmd = vim_strsave_escaped_ext(cmdbase, "|", '^', FALSE); subcmd = vim_strsave_escaped_ext(cmdbase,
(char_u *)"|", '^', FALSE);
if (subcmd != NULL) if (subcmd != NULL)
{ {
/* make "cmd.exe /c arguments" */ /* make "cmd.exe /c arguments" */
@ -4937,7 +4937,7 @@ mch_call_shell(
* inherit our handles which causes unpleasant dangling swap * inherit our handles which causes unpleasant dangling swap
* files if we exit before the spawned process * files if we exit before the spawned process
*/ */
if (vim_create_process(newcmd, FALSE, flags, &si, &pi)) if (vim_create_process((char *)newcmd, FALSE, flags, &si, &pi))
x = 0; x = 0;
else else
{ {
@ -5010,7 +5010,7 @@ mch_call_shell(
#endif #endif
) )
{ {
smsg(_("shell returned %d"), x); smsg((char_u *)_("shell returned %d"), x);
msg_putchar('\n'); msg_putchar('\n');
} }
#ifdef FEAT_TITLE #ifdef FEAT_TITLE
@ -5745,7 +5745,7 @@ mch_write(
{ {
/* optimization: use one single write_chars for runs of text, /* optimization: use one single write_chars for runs of text,
* rather than once per character It ain't curses, but it helps. */ * rather than once per character It ain't curses, but it helps. */
DWORD prefix = (DWORD)strcspn(s, "\n\r\b\a\033"); DWORD prefix = (DWORD)strcspn((char *)s, "\n\r\b\a\033");
if (p_wd) if (p_wd)
{ {
@ -6083,7 +6083,7 @@ mch_remove(char_u *name)
} }
} }
#endif #endif
return DeleteFile(name) ? 0 : -1; return DeleteFile((LPCSTR)name) ? 0 : -1;
} }
@ -6368,10 +6368,10 @@ mch_access(char *n, int p)
WCHAR *wn = NULL; WCHAR *wn = NULL;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
wn = enc_to_utf16(n, NULL); wn = enc_to_utf16((char_u *)n, NULL);
#endif #endif
if (mch_isdir(n)) if (mch_isdir((char_u *)n))
{ {
char TempName[_MAX_PATH + 16] = ""; char TempName[_MAX_PATH + 16] = "";
#ifdef FEAT_MBYTE #ifdef FEAT_MBYTE
@ -6414,7 +6414,7 @@ mch_access(char *n, int p)
char *pch; char *pch;
WIN32_FIND_DATA d; WIN32_FIND_DATA d;
vim_strncpy(TempName, n, _MAX_PATH); vim_strncpy((char_u *)TempName, (char_u *)n, _MAX_PATH);
pch = TempName + STRLEN(TempName) - 1; pch = TempName + STRLEN(TempName) - 1;
if (*pch != '\\' && *pch != '/') if (*pch != '\\' && *pch != '/')
*++pch = '\\'; *++pch = '\\';
@ -6506,7 +6506,7 @@ mch_open(char *name, int flags, int mode)
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{ {
wn = enc_to_utf16(name, NULL); wn = enc_to_utf16((char_u *)name, NULL);
if (wn != NULL) if (wn != NULL)
{ {
f = _wopen(wn, flags, mode); f = _wopen(wn, flags, mode);
@ -6558,8 +6558,8 @@ mch_fopen(char *name, char *mode)
else if (newMode == 'b') else if (newMode == 'b')
_set_fmode(_O_BINARY); _set_fmode(_O_BINARY);
# endif # endif
wn = enc_to_utf16(name, NULL); wn = enc_to_utf16((char_u *)name, NULL);
wm = enc_to_utf16(mode, NULL); wm = enc_to_utf16((char_u *)mode, NULL);
if (wn != NULL && wm != NULL) if (wn != NULL && wm != NULL)
f = _wfopen(wn, wm); f = _wfopen(wn, wm);
vim_free(wn); vim_free(wn);

View File

@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1334,
/**/ /**/
1333, 1333,
/**/ /**/