summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-16 15:06:59 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-16 15:06:59 +0100
commit6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c (patch)
treed2277cebb1354524326ac1333b3bd47f7453c456 /src/os_win32.c
parentf8df7addc5f741c16fa2a458f8777ac1fdf2e01e (diff)
downloadvim-git-6aa2cd4be287f35f95f35c2cec6d5a24f53c4d3c.tar.gz
patch 7.4.1334v7.4.1334
Problem: Many compiler warnings with MingW. Solution: Add type casts. (Yasuhiro Matsumoto)
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c118
1 files changed, 59 insertions, 59 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index e05be4b8b..0c252ac8d 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);
}
@@ -1961,7 +1962,7 @@ executable_exists(char *name, char_u **path)
#ifdef FEAT_MBYTE
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 *dumw;
WCHAR *wcurpath, *wnewpath;
@@ -2003,10 +2004,10 @@ executable_exists(char *name, char_u **path)
vim_free(newpath);
if (n == 0)
return FALSE;
- if (mch_isdir(fname))
+ if (mch_isdir((char_u *)fname))
return FALSE;
if (path != NULL)
- *path = vim_strsave(fname);
+ *path = vim_strsave((char_u *)fname);
return TRUE;
}
@@ -2383,7 +2384,7 @@ static ConsoleBuffer g_cbTermcap = { 0 };
#ifdef __BORLANDC__
typedef HWND (__stdcall *GETCONSOLEWINDOWPROC)(VOID);
#else
-typedef WINBASEAPI HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID);
+typedef HWND (WINAPI *GETCONSOLEWINDOWPROC)(VOID);
#endif
char g_szOrigTitle[256] = { 0 };
HWND g_hWnd = NULL; /* also used in os_mswin.c */
@@ -2439,18 +2440,15 @@ SetConsoleIcon(
HICON hIconSmall,
HICON hIcon)
{
- HICON hPrevIconSmall;
- HICON hPrevIcon;
-
if (hWnd == NULL)
return FALSE;
if (hIconSmall != NULL)
- hPrevIconSmall = (HICON)SendMessage(hWnd, WM_SETICON,
- (WPARAM)ICON_SMALL, (LPARAM)hIconSmall);
+ SendMessage(hWnd, WM_SETICON,
+ (WPARAM)ICON_SMALL, (LPARAM)hIconSmall);
if (hIcon != NULL)
- hPrevIcon = (HICON)SendMessage(hWnd, WM_SETICON,
- (WPARAM)ICON_BIG,(LPARAM) hIcon);
+ SendMessage(hWnd, WM_SETICON,
+ (WPARAM)ICON_BIG, (LPARAM) hIcon);
return TRUE;
}
@@ -2496,7 +2494,7 @@ SaveConsoleTitleAndIcon(void)
/* Extract the first icon contained in the Vim executable. */
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)
g_fCanChangeIcon = TRUE;
}
@@ -2851,7 +2849,7 @@ fname_case(
return;
/* Build the new name in szTrueName[] one component at a time. */
- porig = name;
+ porig = (char *)name;
ptrue = szTrueName;
if (isalpha(porig[0]) && porig[1] == ':')
@@ -2877,7 +2875,7 @@ fname_case(
if (enc_dbcs)
{
- l = (*mb_ptr2len)(porig);
+ l = (*mb_ptr2len)((char_u *)porig);
while (--l >= 0)
*ptrue++ = *porig++;
}
@@ -2978,7 +2976,7 @@ mch_get_user_name(
#endif
if (GetUserName(szUserName, &cch))
{
- vim_strncpy(s, szUserName, len - 1);
+ vim_strncpy(s, (char_u *)szUserName, len - 1);
return OK;
}
s[0] = NUL;
@@ -3018,8 +3016,8 @@ mch_get_host_name(
/* Retry with non-wide function (for Windows 98). */
}
#endif
- if (!GetComputerName(s, &cch))
- vim_strncpy(s, "PC (Win32 Vim)", len - 1);
+ if (!GetComputerName((LPSTR)s, &cch))
+ vim_strncpy(s, (char_u *)"PC (Win32 Vim)", len - 1);
}
@@ -3069,7 +3067,7 @@ mch_dirname(
/* Retry with non-wide function (for Windows 98). */
}
#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;
int n;
- n = mch_stat(name, &st);
+ n = mch_stat((char *)name, &st);
return n == 0 ? (long)(unsigned short)st.st_mode : -1L;
}
@@ -3113,7 +3111,7 @@ mch_setperm(char_u *name, long perm)
}
if (n == -1)
#endif
- n = _chmod(name, perm);
+ n = _chmod((const char *)name, perm);
if (n == -1)
return FAIL;
@@ -3197,7 +3195,7 @@ mch_mkdir(char_u *name)
return retval;
}
#endif
- return _mkdir(name);
+ return _mkdir((const char *)name);
}
/*
@@ -3221,7 +3219,7 @@ mch_rmdir(char_u *name)
return retval;
}
#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)
{
/* Retry with non-wide function (for Windows 98). */
- hFind = FindFirstFile(name, &findDataA);
+ hFind = FindFirstFile((LPCSTR)name, &findDataA);
if (hFind != INVALID_HANDLE_VALUE)
{
fileFlags = findDataA.dwFileAttributes;
@@ -3276,7 +3274,7 @@ mch_is_symbolic_link(char_u *name)
else
#endif
{
- hFind = FindFirstFile(name, &findDataA);
+ hFind = FindFirstFile((LPCSTR)name, &findDataA);
if (hFind != INVALID_HANDLE_VALUE)
{
fileFlags = findDataA.dwFileAttributes;
@@ -3347,8 +3345,8 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
}
if (wn == NULL)
#endif
- hFile = CreateFile(fname, /* file name */
- GENERIC_READ, /* access mode */
+ hFile = CreateFile((LPCSTR)fname, /* file name */
+ GENERIC_READ, /* access mode */
FILE_SHARE_READ | FILE_SHARE_WRITE, /* share mode */
NULL, /* security descriptor */
OPEN_EXISTING, /* creation disposition */
@@ -3566,13 +3564,13 @@ mch_nodetype(char_u *name)
}
if (wn == NULL)
#endif
- hFile = CreateFile(name, /* file name */
- GENERIC_WRITE, /* access mode */
- 0, /* share mode */
- NULL, /* security descriptor */
- OPEN_EXISTING, /* creation disposition */
- 0, /* file attributes */
- NULL); /* handle to template file */
+ hFile = CreateFile((LPCSTR)name, /* file name */
+ GENERIC_WRITE, /* access mode */
+ 0, /* share mode */
+ NULL, /* security descriptor */
+ OPEN_EXISTING, /* creation disposition */
+ 0, /* file attributes */
+ NULL); /* handle to template file */
#ifdef FEAT_MBYTE
vim_free(wn);
@@ -4084,7 +4082,7 @@ vim_create_process(
# ifdef FEAT_MBYTE
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)
{
@@ -4725,7 +4723,7 @@ mch_system(char *cmd, int options)
{
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)
{
int ret = _wsystem(wcmd);
@@ -4768,7 +4766,7 @@ mch_call_shell(
wcscat(szShellTitle, L" :sh");
else
{
- WCHAR *wn = enc_to_utf16(cmd, NULL);
+ WCHAR *wn = enc_to_utf16((char_u *)cmd, NULL);
if (wn != NULL)
{
@@ -4793,8 +4791,9 @@ mch_call_shell(
else
{
strcat(szShellTitle, " - !");
- if ((strlen(szShellTitle) + strlen(cmd) < sizeof(szShellTitle)))
- strcat(szShellTitle, cmd);
+ if ((strlen(szShellTitle) + strlen((char *)cmd)
+ < sizeof(szShellTitle)))
+ strcat(szShellTitle, (char *)cmd);
}
SetConsoleTitle(szShellTitle);
}
@@ -4831,7 +4830,7 @@ mch_call_shell(
if (cmd == NULL)
{
- x = mch_system(p_sh, options);
+ x = mch_system((char *)p_sh, options);
}
else
{
@@ -4915,9 +4914,10 @@ mch_call_shell(
char_u *cmd_shell = mch_getenv("COMSPEC");
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)
{
/* make "cmd.exe /c arguments" */
@@ -4937,7 +4937,7 @@ mch_call_shell(
* inherit our handles which causes unpleasant dangling swap
* 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;
else
{
@@ -5010,7 +5010,7 @@ mch_call_shell(
#endif
)
{
- smsg(_("shell returned %d"), x);
+ smsg((char_u *)_("shell returned %d"), x);
msg_putchar('\n');
}
#ifdef FEAT_TITLE
@@ -5745,7 +5745,7 @@ mch_write(
{
/* optimization: use one single write_chars for runs of text,
* 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)
{
@@ -6083,7 +6083,7 @@ mch_remove(char_u *name)
}
}
#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;
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
- wn = enc_to_utf16(n, NULL);
+ wn = enc_to_utf16((char_u *)n, NULL);
#endif
- if (mch_isdir(n))
+ if (mch_isdir((char_u *)n))
{
char TempName[_MAX_PATH + 16] = "";
#ifdef FEAT_MBYTE
@@ -6414,7 +6414,7 @@ mch_access(char *n, int p)
char *pch;
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;
if (*pch != '\\' && *pch != '/')
*++pch = '\\';
@@ -6506,7 +6506,7 @@ mch_open(char *name, int flags, int mode)
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)
{
f = _wopen(wn, flags, mode);
@@ -6558,8 +6558,8 @@ mch_fopen(char *name, char *mode)
else if (newMode == 'b')
_set_fmode(_O_BINARY);
# endif
- wn = enc_to_utf16(name, NULL);
- wm = enc_to_utf16(mode, NULL);
+ wn = enc_to_utf16((char_u *)name, NULL);
+ wm = enc_to_utf16((char_u *)mode, NULL);
if (wn != NULL && wm != NULL)
f = _wfopen(wn, wm);
vim_free(wn);