comparison src/os_win32.c @ 16764:ef00b6bc186b v8.1.1384

patch 8.1.1384: using "int" for alloc() often results in compiler warnings commit https://github.com/vim/vim/commit/964b3746b9c81e65887e2ac9a335f181db2bb592 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 24 18:54:09 2019 +0200 patch 8.1.1384: using "int" for alloc() often results in compiler warnings Problem: Using "int" for alloc() often results in compiler warnings. Solution: Use "size_t" and remove type casts. Remove alloc_check(), Vim only works with 32 bit ints anyway.
author Bram Moolenaar <Bram@vim.org>
date Fri, 24 May 2019 19:00:07 +0200
parents 8050cde51945
children 695d9ef00b03
comparison
equal deleted inserted replaced
16763:fccf84413b53 16764:ef00b6bc186b
2073 p = enc_to_utf16((char_u *)name, NULL); 2073 p = enc_to_utf16((char_u *)name, NULL);
2074 if (p == NULL) 2074 if (p == NULL)
2075 return FALSE; 2075 return FALSE;
2076 2076
2077 wcurpath = _wgetenv(L"PATH"); 2077 wcurpath = _wgetenv(L"PATH");
2078 wnewpath = (WCHAR*)alloc((unsigned)(wcslen(wcurpath) + 3) 2078 wnewpath = (WCHAR *)alloc((wcslen(wcurpath) + 3) * sizeof(WCHAR));
2079 * sizeof(WCHAR));
2080 if (wnewpath == NULL) 2079 if (wnewpath == NULL)
2081 return FALSE; 2080 return FALSE;
2082 wcscpy(wnewpath, L".;"); 2081 wcscpy(wnewpath, L".;");
2083 wcscat(wnewpath, wcurpath); 2082 wcscat(wnewpath, wcurpath);
2084 n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw); 2083 n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw);
7203 mch_setenv(char *var, char *value, int x) 7202 mch_setenv(char *var, char *value, int x)
7204 { 7203 {
7205 char_u *envbuf; 7204 char_u *envbuf;
7206 WCHAR *p; 7205 WCHAR *p;
7207 7206
7208 envbuf = alloc((unsigned)(STRLEN(var) + STRLEN(value) + 2)); 7207 envbuf = alloc(STRLEN(var) + STRLEN(value) + 2);
7209 if (envbuf == NULL) 7208 if (envbuf == NULL)
7210 return -1; 7209 return -1;
7211 7210
7212 sprintf((char *)envbuf, "%s=%s", var, value); 7211 sprintf((char *)envbuf, "%s=%s", var, value);
7213 7212