diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-02-16 15:06:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-02-16 15:06:59 +0100 |
commit | 6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c (patch) | |
tree | d2277cebb1354524326ac1333b3bd47f7453c456 /src | |
parent | f8df7addc5f741c16fa2a458f8777ac1fdf2e01e (diff) |
patch 7.4.1334v7.4.1334
Problem: Many compiler warnings with MingW.
Solution: Add type casts. (Yasuhiro Matsumoto)
Diffstat (limited to 'src')
-rw-r--r-- | src/channel.c | 14 | ||||
-rw-r--r-- | src/dosinst.h | 2 | ||||
-rw-r--r-- | src/eval.c | 12 | ||||
-rw-r--r-- | src/ex_cmds2.c | 22 | ||||
-rw-r--r-- | src/ex_getln.c | 4 | ||||
-rw-r--r-- | src/fileio.c | 4 | ||||
-rw-r--r-- | src/if_cscope.c | 7 | ||||
-rw-r--r-- | src/if_perl.xs | 9 | ||||
-rw-r--r-- | src/if_python.c | 9 | ||||
-rw-r--r-- | src/if_python3.c | 9 | ||||
-rw-r--r-- | src/if_ruby.c | 8 | ||||
-rw-r--r-- | src/main.c | 2 | ||||
-rw-r--r-- | src/mbyte.c | 18 | ||||
-rw-r--r-- | src/misc1.c | 8 | ||||
-rw-r--r-- | src/option.c | 4 | ||||
-rw-r--r-- | src/os_mswin.c | 95 | ||||
-rw-r--r-- | src/os_win32.c | 118 | ||||
-rw-r--r-- | src/version.c | 2 |
18 files changed, 194 insertions, 153 deletions
diff --git a/src/channel.c b/src/channel.c index 28fee0ac91..e0ae267a72 100644 --- a/src/channel.c +++ b/src/channel.c @@ -58,7 +58,7 @@ extern HWND s_hwnd; /* Gvim's Window handle */ #ifdef WIN32 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; DWORD nread; @@ -69,7 +69,7 @@ fd_read(sock_T fd, char_u *buf, size_t len) } 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; DWORD nwrite; @@ -1393,7 +1393,7 @@ channel_wait(channel_T *channel, sock_T fd, int timeout) /* reading from a pipe, not a socket */ 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; diff = deadline - GetTickCount(); if (diff < 0) @@ -1509,9 +1509,9 @@ channel_read(channel_T *channel, int which, char *func) if (channel_wait(channel, fd, 0) == FAIL) break; if (use_socket) - len = sock_read(fd, buf, MAXMSGSIZE); + len = sock_read(fd, (char *)buf, MAXMSGSIZE); else - len = fd_read(fd, buf, MAXMSGSIZE); + len = fd_read(fd, (char *)buf, MAXMSGSIZE); if (len <= 0) break; /* error or nothing more to read */ @@ -1713,9 +1713,9 @@ channel_send(channel_T *channel, char_u *buf, char *fun) } if (use_socket) - res = sock_write(fd, buf, len); + res = sock_write(fd, (char *)buf, len); else - res = fd_write(fd, buf, len); + res = fd_write(fd, (char *)buf, len); if (res != len) { if (!channel->ch_error && fun != NULL) diff --git a/src/dosinst.h b/src/dosinst.h index b33426ad78..97d83d9700 100644 --- a/src/dosinst.h +++ b/src/dosinst.h @@ -452,7 +452,7 @@ run_command(char *cmd) /* * Append a backslash to "name" if there isn't one yet. */ - static void + void add_pathsep(char *name) { int len = strlen(name); diff --git a/src/eval.c b/src/eval.c index 84b7197c80..27f55ce8b8 100644 --- a/src/eval.c +++ b/src/eval.c @@ -14554,7 +14554,7 @@ f_job_start(typval_T *argvars UNUSED, typval_T *rettv) #ifdef USE_ARGV mch_start_job(argv, job); #else - mch_start_job(cmd, job); + mch_start_job((char *)cmd, job); #endif theend: @@ -16410,7 +16410,7 @@ f_remote_peek(typval_T *argvars UNUSED, typval_T *rettv) return; /* type error; errmsg already given */ } # ifdef WIN32 - sscanf(serverid, SCANF_HEX_LONG_U, &n); + sscanf((const char *)serverid, SCANF_HEX_LONG_U, &n); if (n == 0) rettv->vval.v_number = -1; 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 */ long_u n = 0; - sscanf(serverid, SCANF_HEX_LONG_U, &n); + sscanf((char *)serverid, SCANF_HEX_LONG_U, &n); if (n != 0) r = serverGetReply((HWND)n, FALSE, TRUE, TRUE); if (r == NULL) @@ -25415,7 +25415,7 @@ get_short_pathname(char_u **fnamep, char_u **bufp, int *fnamelen) char_u *newbuf; len = *fnamelen; - l = GetShortPathName(*fnamep, *fnamep, len); + l = GetShortPathName((LPSTR)*fnamep, (LPSTR)*fnamep, len); if (l > len - 1) { /* 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; /* 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; @@ -25720,7 +25720,7 @@ repeat: p = alloc(_MAX_PATH + 1); if (p != NULL) { - if (GetLongPathName(*fnamep, p, _MAX_PATH)) + if (GetLongPathName((LPSTR)*fnamep, (LPSTR)p, _MAX_PATH)) { vim_free(*bufp); *bufp = *fnamep = p; diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index 49e4d3df44..3b18ecee41 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -4149,16 +4149,16 @@ ex_checktime(exarg_T *eap) #if (defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \ && (defined(FEAT_EVAL) || defined(FEAT_MULTI_LANG)) # 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) { - char *loc; + char_u *loc; /* Obtain the locale value from the libraries. For DJGPP this is * redefined and it doesn't use the arguments. */ - loc = setlocale(what, NULL); + loc = (char_u *)setlocale(what, NULL); # ifdef WIN32 if (loc != NULL) @@ -4222,7 +4222,7 @@ gettext_lang(char_u *name) for (i = 0; mtable[i] != NULL; i += 2) if (STRNICMP(mtable[i], name, STRLEN(mtable[i])) == 0) - return mtable[i + 1]; + return (char_u *)mtable[i + 1]; return name; } #endif @@ -4239,13 +4239,13 @@ get_mess_lang(void) # ifdef HAVE_GET_LOCALE_VAL # if defined(LC_MESSAGES) - p = (char_u *)get_locale_val(LC_MESSAGES); + p = get_locale_val(LC_MESSAGES); # else /* 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 * and LC_MONETARY may be set differently for a Japanese working in the * US. */ - p = (char_u *)get_locale_val(LC_COLLATE); + p = get_locale_val(LC_COLLATE); # endif # else p = mch_getenv((char_u *)"LC_ALL"); @@ -4290,7 +4290,7 @@ get_mess_env(void) p = NULL; /* ignore something like "1043" */ # ifdef HAVE_GET_LOCALE_VAL if (p == NULL || *p == NUL) - p = (char_u *)get_locale_val(LC_CTYPE); + p = get_locale_val(LC_CTYPE); # endif } } @@ -4310,7 +4310,7 @@ set_lang_var(void) char_u *loc; # ifdef HAVE_GET_LOCALE_VAL - loc = (char_u *)get_locale_val(LC_CTYPE); + loc = get_locale_val(LC_CTYPE); # else /* setlocale() not supported: use the default value */ 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 * back to LC_CTYPE if it's empty. */ # if defined(HAVE_GET_LOCALE_VAL) && defined(LC_MESSAGES) - loc = (char_u *)get_locale_val(LC_MESSAGES); + loc = get_locale_val(LC_MESSAGES); # else loc = get_mess_env(); # endif set_vim_var_string(VV_LANG, loc, -1); # ifdef HAVE_GET_LOCALE_VAL - loc = (char_u *)get_locale_val(LC_TIME); + loc = get_locale_val(LC_TIME); # endif set_vim_var_string(VV_LC_TIME, loc, -1); } diff --git a/src/ex_getln.c b/src/ex_getln.c index 1512b0314a..a0c9877243 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -626,8 +626,8 @@ getcmdline( #endif if (vim_ispathsep(ccline.cmdbuff[j]) #ifdef BACKSLASH_IN_FILENAME - && vim_strchr(" *?[{`$%#", ccline.cmdbuff[j + 1]) - == NULL + && vim_strchr((char_u *)" *?[{`$%#", + ccline.cmdbuff[j + 1]) == NULL #endif ) { diff --git a/src/fileio.c b/src/fileio.c index f0ef675323..c5a3f2a8d1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7480,11 +7480,11 @@ vim_tempname( } strcpy(buf4, "VIM"); 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; if (!keep) /* 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 * "sh". NOTE: This also checks 'shellcmdflag' to help those people who diff --git a/src/if_cscope.c b/src/if_cscope.c index 4a7290713e..c135fe5bbc 100644 --- a/src/if_cscope.c +++ b/src/if_cscope.c @@ -839,7 +839,7 @@ cs_create_connection(int i) # ifdef __BORLANDC__ # define OPEN_OH_ARGTYPE long # else -# if (_MSC_VER >= 1300) +# if (_MSC_VER >= 1300) || defined(__MINGW32__) # define OPEN_OH_ARGTYPE intptr_t # else # define OPEN_OH_ARGTYPE long @@ -1423,7 +1423,7 @@ cs_insert_filelist( /* On windows 9x GetFileInformationByHandle doesn't work, so skip it */ 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_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 #else /* 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 */ || (!mch_windows95() && csinfo[j].nVolume == bhfi.dwVolumeSerialNumber diff --git a/src/if_perl.xs b/src/if_perl.xs index b723dcbe5b..47c944039c 100644 --- a/src/if_perl.xs +++ b/src/if_perl.xs @@ -49,6 +49,12 @@ # define __inline__ __inline #endif +#ifdef __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" +#endif + #include <EXTERN.h> #include <perl.h> #include <XSUB.h> @@ -1730,3 +1736,6 @@ Append(vimbuf, ...) } } +#ifdef __GNUC__ +# pragma GCC diagnostic pop +#endif diff --git a/src/if_python.c b/src/if_python.c index d319a398e7..56b0ee597a 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -43,6 +43,15 @@ # undef _DEBUG #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 # undef HAVE_STDARG_H /* Python's config.h defines it as well. */ #endif diff --git a/src/if_python3.c b/src/if_python3.c index 7d69b0c81f..84302bd636 100644 --- a/src/if_python3.c +++ b/src/if_python3.c @@ -51,6 +51,15 @@ # undef F_BLANK #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 # undef HAVE_STDARG_H /* Python's config.h defines it as well. */ #endif diff --git a/src/if_ruby.c b/src/if_ruby.c index cad6fd1fb9..d609d344ea 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -158,6 +158,10 @@ # define RSTRING_PTR(s) RSTRING(s)->ptr #endif +#ifdef HAVE_DUP +# undef HAVE_DUP +#endif + #include "vim.h" #include "version.h" @@ -253,6 +257,7 @@ static void ruby_vim_init(void); # define rb_raise dll_rb_raise # define rb_str_cat dll_rb_str_cat # define rb_str_concat dll_rb_str_concat +# undef rb_str_new # define rb_str_new dll_rb_str_new # ifdef rb_str_new2 /* 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 rb_enc_find_index dll_rb_enc_find_index # 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_require dll_rb_require # define ruby_options dll_ruby_options diff --git a/src/main.c b/src/main.c index e412641cc3..fac4be1c0a 100644 --- a/src/main.c +++ b/src/main.c @@ -3940,7 +3940,7 @@ build_drop_cmd( } cdp = vim_strsave_escaped_ext(cwd, #ifdef BACKSLASH_IN_FILENAME - "", /* rem_backslash() will tell what chars to escape */ + (char_u *)"", /* rem_backslash() will tell what chars to escape */ #else PATH_ESC_CHARS, #endif diff --git a/src/mbyte.c b/src/mbyte.c index 8f7bbb23ef..c5b0b59cc3 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -473,7 +473,7 @@ enc_canon_props(char_u *name) CPINFO cpinfo; /* 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 */ return ENC_8BIT; @@ -535,7 +535,7 @@ mb_init(void) CPINFO cpinfo; /* 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) { @@ -547,7 +547,7 @@ mb_init(void) && (cpinfo.LeadByte[0] != 0 || cpinfo.LeadByte[1] != 0)) { /* must be a DBCS encoding, check below */ - enc_dbcs_new = atoi(p_enc + 2); + enc_dbcs_new = atoi((char *)p_enc + 2); } else goto codepage_invalid; @@ -571,7 +571,7 @@ codepage_invalid: #ifdef WIN3264 /* Windows: accept only valid codepage numbers, check below. */ 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; #else /* Unix: accept any "2byte-" name, assume current locale. */ @@ -4338,7 +4338,7 @@ get_iconv_import_func(HINSTANCE hInst, const char *funcname) continue; pImpName = (PIMAGE_IMPORT_BY_NAME)(pImage + (UINT_PTR)(pINT->u1.AddressOfData)); - if (strcmp(pImpName->Name, funcname) == 0) + if (strcmp((char *)pImpName->Name, funcname) == 0) return (void *)pIAT->u1.Function; } } @@ -6268,7 +6268,7 @@ string_convert_ext( { tmp_len = MultiByteToWideChar(vcp->vc_cpfrom, unconvlenp ? MB_ERR_INVALID_CHARS : 0, - ptr, len, 0, 0); + (char *)ptr, len, 0, 0); if (tmp_len == 0 && GetLastError() == ERROR_NO_UNICODE_TRANSLATION) { @@ -6288,7 +6288,8 @@ string_convert_ext( if (vcp->vc_cpfrom == 0) utf8_to_utf16(ptr, len, tmp, unconvlenp); 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. */ if (vcp->vc_cpto == 0) @@ -6303,7 +6304,8 @@ string_convert_ext( utf16_to_utf8(tmp, tmp_len, retval); else WideCharToMultiByte(vcp->vc_cpto, 0, - tmp, tmp_len, retval, retlen, 0, 0); + tmp, tmp_len, + (char *)retval, retlen, 0, 0); retval[retlen] = NUL; if (lenp != NULL) *lenp = retlen; diff --git a/src/misc1.c b/src/misc1.c index d432125385..6f96f2f214 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3779,7 +3779,7 @@ init_homedir(void) homedrive = mch_getenv((char_u *)"HOMEDRIVE"); homepath = mch_getenv((char_u *)"HOMEPATH"); if (homepath == NULL || *homepath == NUL) - homepath = "\\"; + homepath = (char_u *)"\\"; if (homedrive != NULL && STRLEN(homedrive) + STRLEN(homepath) < MAXPATHL) { @@ -3817,7 +3817,7 @@ init_homedir(void) * Best assumption we can make in such a situation. */ if (var == NULL) - var = "C:/"; + var = (char_u *)"C:/"; #endif if (var != NULL) { @@ -9944,7 +9944,7 @@ dos_expandpath( if (wn == NULL) # endif - hFind = FindFirstFile(buf, &fb); + hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); #else /* If we are expanding wildcards we try both files and directories */ @@ -10042,7 +10042,7 @@ dos_expandpath( } if (wn == NULL) # endif - hFind = FindFirstFile(buf, &fb); + hFind = FindFirstFile((LPCSTR)buf, &fb); ok = (hFind != INVALID_HANDLE_VALUE); #else ok = (findfirst((char *)buf, &fb, diff --git a/src/option.c b/src/option.c index 72d8cf7a60..6554fcd016 100644 --- a/src/option.c +++ b/src/option.c @@ -3196,7 +3196,7 @@ set_init_1(void) # endif || ((p = mch_getenv((char_u *)"COMSPEC")) != NULL && *p != NUL) # ifdef WIN3264 - || ((p = default_shell()) != NULL && *p != NUL) + || ((p = (char_u *)default_shell()) != NULL && *p != NUL) # endif #endif ) @@ -3479,7 +3479,7 @@ set_init_1(void) STRCPY(buf, "ja"); else buf[2] = NUL; /* truncate to two-letter code */ - vim_setenv("LANG", buf); + vim_setenv((char_u *)"LANG", (char_u *)buf); } } # else diff --git a/src/os_mswin.c b/src/os_mswin.c index b7e3b5e5ec..fc06ab687c 100644 --- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -273,11 +273,11 @@ mch_early_init(void) for (i = 0; i < 256; ++i) toupper_tab[i] = tolower_tab[i] = i; #ifdef WIN3264 - CharUpperBuff(toupper_tab, 256); - CharLowerBuff(tolower_tab, 256); + CharUpperBuff((LPSTR)toupper_tab, 256); + CharLowerBuff((LPSTR)tolower_tab, 256); #else - AnsiUpperBuff(toupper_tab, 256); - AnsiLowerBuff(tolower_tab, 256); + AnsiUpperBuff((LPSTR)toupper_tab, 256); + AnsiLowerBuff((LPSTR)tolower_tab, 256); #endif } @@ -327,7 +327,7 @@ mch_settitle( } } # endif - SetConsoleTitle(title); + SetConsoleTitle((LPCSTR)title); } # endif } @@ -428,7 +428,7 @@ mch_FullName( if (nResult == FAIL) /* fall back to non-wide function */ #endif { - if (_fullpath(buf, fname, len - 1) == NULL) + if (_fullpath((char *)buf, (const char *)fname, len - 1) == NULL) { /* failed, use relative path name */ vim_strncpy(buf, fname, len - 1); @@ -469,10 +469,10 @@ mch_isFullName(char_u *fname) return TRUE; /* 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 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 * means that the maximum pathname is _MAX_PATH * 3 bytes when 'enc' is * UTF-8. */ - char buf[_MAX_PATH * 3 + 1]; + char_u buf[_MAX_PATH * 3 + 1]; #else - char buf[_MAX_PATH + 1]; + char_u buf[_MAX_PATH + 1]; #endif - char *p; + char_u *p; vim_strncpy((char_u *)buf, (char_u *)name, sizeof(buf) - 1); - p = buf + strlen(buf); + p = buf + STRLEN(buf); if (p > buf) 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] == '/')) { /* UNC root path must be followed by '\\'. */ - p = vim_strpbrk(buf + 2, "\\/"); + p = vim_strpbrk(buf + 2, (char_u *)"\\/"); if (p != NULL) { - p = vim_strpbrk(p + 1, "\\/"); + p = vim_strpbrk(p + 1, (char_u *)"\\/"); if (p == NULL) STRCAT(buf, "\\"); } @@ -668,7 +668,7 @@ vim_stat(const char *name, struct stat *stp) } } #endif - return stat_symlink_aware(buf, stp); + return stat_symlink_aware((char *)buf, stp); } #if defined(FEAT_GUI_MSWIN) || defined(PROTO) @@ -820,7 +820,7 @@ mch_chdir(char *path) #ifdef FEAT_MBYTE 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; if (p != NULL) @@ -853,7 +853,8 @@ can_end_termcap_mode( if (g_PlatformId == VER_PLATFORM_WIN32_NT || Columns == 80) return TRUE; 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; #endif } @@ -915,7 +916,7 @@ check_str_len(char_u *str) MEMORY_BASIC_INFORMATION mbi; size_t length = 0; size_t i; - const char *p; + const char_u *p; /* get page size */ GetSystemInfo(&si); @@ -953,7 +954,7 @@ mch_icon_load_cb(char_u *fname, void *cookie) HANDLE *h = (HANDLE *)cookie; *h = LoadImage(NULL, - fname, + (LPSTR)fname, IMAGE_ICON, 64, 64, @@ -992,7 +993,7 @@ mch_libcall( # ifdef WIN16 hinstLib = LoadLibrary(libname); # else - hinstLib = vimLoadLib(libname); + hinstLib = vimLoadLib((char *)libname); # endif // If the handle is valid, try to get the function address. @@ -1005,25 +1006,25 @@ mch_libcall( if (argstring != NULL) { /* Call with string argument */ - ProcAdd = (MYSTRPROCSTR) GetProcAddress(hinstLib, funcname); + ProcAdd = (MYSTRPROCSTR)GetProcAddress(hinstLib, (LPCSTR)funcname); if ((fRunTimeLinkSuccess = (ProcAdd != NULL)) != 0) { if (string_result == NULL) - retval_int = ((MYSTRPROCINT)ProcAdd)(argstring); + retval_int = ((MYSTRPROCINT)ProcAdd)((LPSTR)argstring); else - retval_str = (ProcAdd)(argstring); + retval_str = (char_u *)(ProcAdd)((LPSTR)argstring); } } else { /* Call with number argument */ - ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, funcname); + ProcAddI = (MYINTPROCSTR) GetProcAddress(hinstLib, (LPCSTR)funcname); if ((fRunTimeLinkSuccess = (ProcAddI != NULL)) != 0) { if (string_result == NULL) retval_int = ((MYINTPROCINT)ProcAddI)(argint); 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); return ret; } - return SetDlgItemText(hDlg, nIDDlgItem, s); + return SetDlgItemText(hDlg, nIDDlgItem, (LPCSTR)s); } #endif @@ -1283,18 +1284,18 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { SendDlgItemMessage(hDlg, i, WM_SETFONT, (WPARAM)hfont, 1); if (GetDlgItemText(hDlg,i, buff, sizeof(buff))) - vimSetDlgItemText(hDlg,i, _(buff)); + vimSetDlgItemText(hDlg,i, (char_u *)_(buff)); } SendDlgItemMessage(hDlg, IDCANCEL, WM_SETFONT, (WPARAM)hfont, 1); if (GetDlgItemText(hDlg,IDCANCEL, buff, sizeof(buff))) - vimSetDlgItemText(hDlg,IDCANCEL, _(buff)); + vimSetDlgItemText(hDlg,IDCANCEL, (char_u *)_(buff)); } #endif - SetWindowText(hDlg, szAppName); + SetWindowText(hDlg, (LPCSTR)szAppName); if (prt_name != NULL) { - vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (LPSTR)prt_name); + vimSetDlgItemText(hDlg, IDC_PRINTTEXT2, (char_u *)prt_name); vim_free(prt_name); 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. */ if (*p_pdev != NUL) - prt_dlg.hDC = CreateDC(NULL, p_pdev, NULL, NULL); + prt_dlg.hDC = CreateDC(NULL, (LPCSTR)p_pdev, NULL, NULL); else #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 *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 char_u *printer_name_orig = printer_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) + STRLEN(text))); 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 if (printer_name != printer_name_orig) vim_free(printer_name); @@ -1781,11 +1783,11 @@ mch_print_begin(prt_settings_T *psettings) SetAbortProc(prt_dlg.hDC, AbortProc); #endif 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)); di.cbSize = sizeof(DOCINFO); - di.lpszDocName = psettings->jobname; + di.lpszDocName = (LPCSTR)psettings->jobname; ret = StartDoc(prt_dlg.hDC, &di); #ifdef FEAT_GUI @@ -1815,7 +1817,7 @@ mch_print_end_page(void) mch_print_begin_page(char_u *msg) { if (msg != NULL) - vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, (LPSTR)msg); + vimSetDlgItemText(hDlgPrint, IDC_PROGRESS, msg); return (StartPage(prt_dlg.hDC) > 0); } @@ -1878,16 +1880,17 @@ mch_print_text_out(char_u *p, int len) } #endif 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 prt_pos_x += len * prt_tm.tmAveCharWidth; return (prt_pos_x + prt_left_margin + prt_tm.tmAveCharWidth + prt_tm.tmOverhang > prt_right_margin); #else # ifdef WIN16 - GetTextExtentPoint(prt_dlg.hDC, p, len, &sz); + GetTextExtentPoint(prt_dlg.hDC, (LPCSTR)p, len, &sz); # else - GetTextExtentPoint32(prt_dlg.hDC, p, len, &sz); + GetTextExtentPoint32(prt_dlg.hDC, (LPCSTR)p, len, &sz); # endif prt_pos_x += (sz.cx - prt_tm.tmOverhang); /* This is wrong when printing spaces for a TAB. */ @@ -2027,7 +2030,7 @@ shortcut_errorw: goto shortcut_end; // 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 hr = ppf->lpVtbl->Load(ppf, wsz, STGM_READ); @@ -2043,7 +2046,7 @@ shortcut_errorw: ZeroMemory(buf, MAX_PATH); hr = psl->lpVtbl->GetPath(psl, buf, MAX_PATH, &ffd, 0); if (hr == S_OK && buf[0] != NUL) - rfname = vim_strsave(buf); + rfname = vim_strsave((char_u *)buf); shortcut_end: // 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) { - res = vim_strsave(_(e_invexprmsg)); + res = vim_strsave((char_u *)_(e_invexprmsg)); reply.dwData = COPYDATA_ERROR_RESULT; } else @@ -2399,8 +2402,8 @@ enumWindowsGetNames(HWND hwnd, LPARAM lparam) return TRUE; /* Add the name to the list */ - ga_concat(ga, server); - ga_concat(ga, "\n"); + ga_concat(ga, (char_u *)server); + ga_concat(ga, (char_u *)"\n"); return TRUE; } @@ -2459,7 +2462,7 @@ serverSetName(char_u *name) #endif /* Update the message window title */ - SetWindowText(message_window, ok_name); + SetWindowText(message_window, (LPCSTR)ok_name); #ifdef FEAT_EVAL /* Set the servername variable */ @@ -2948,7 +2951,7 @@ get_logfont( if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) { int len; - enc_to_acp(name, (int)strlen(name), &acpname, &len); + enc_to_acp(name, (int)strlen((char *)name), &acpname, &len); name = acpname; } #endif diff --git a/src/os_win32.c b/src/os_win32.c index e05be4b8bb..0c252ac8d1 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -91,7 +91,6 @@ FILE* fdDump = NULL; */ #ifdef PROTO #define WINAPI -#define WINBASEAPI typedef char * LPCSTR; typedef char * LPWSTR; typedef int ACCESS_MASK; @@ -148,14 +147,14 @@ typedef int PROCESS_INFORMATION; * and Michael Dietrich for helping me figure out this workaround. */ -/* WINBASEAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */ -#ifndef WINBASEAPI -# define WINBASEAPI __stdcall +/* WINAPI BOOL WINAPI GetConsoleKeyboardLayoutNameA(LPSTR); */ +#ifndef WINAPI +# define WINAPI __stdcall #endif #if defined(__BORLANDC__) typedef BOOL (__stdcall *PFNGCKLN)(LPSTR); #else -typedef WINBASEAPI BOOL (WINAPI *PFNGCKLN)(LPSTR); +typedef BOOL (WINAPI *PFNGCKLN)(LPSTR); #endif static PFNGCKLN s_pfnGetConsoleKeyboardLayoutName = NULL; #endif @@ -340,6 +339,7 @@ msg_wait_for_multiple_objects( dwMilliseconds, dwWakeMask); } +#ifndef FEAT_CLIENTSERVER static DWORD wait_for_single_object( HANDLE hHandle, @@ -349,6 +349,7 @@ wait_for_single_object( return WAIT_OBJECT_0; return WaitForSingleObject(hHandle, dwMilliseconds); } +#endif static void get_exe_name(void) @@ -388,7 +389,7 @@ get_exe_name(void) STRCAT(temp, ";"); } 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 * sure we find a .dll there and to avoid looking for a .dll * in the current directory. */ - SetCurrentDirectory(exe_path); + SetCurrentDirectory((LPCSTR)exe_path); dll = LoadLibrary(name); SetCurrentDirectoryW(old_dirw); return dll; @@ -453,7 +454,7 @@ vimLoadLib(char *name) /* Change directory to where the executable is, both to make * sure we find a .dll there and to avoid looking for a .dll * in the current directory. */ - SetCurrentDirectory(exe_path); + SetCurrentDirectory((LPCSTR)exe_path); dll = LoadLibrary(name); SetCurrentDirectory(old_dir); } |