Mercurial > vim
diff src/os_mswin.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 | 7e733046db1d |
children | 695d9ef00b03 |
line wrap: on
line diff
--- a/src/os_mswin.c +++ b/src/os_mswin.c @@ -1466,8 +1466,8 @@ mch_print_init(prt_settings_T *psettings char_u *port_name = utf16_to_enc(wport_name, NULL); if (printer_name != NULL && port_name != NULL) - prt_name = alloc((unsigned)(STRLEN(printer_name) - + STRLEN(port_name) + STRLEN(text))); + prt_name = alloc(STRLEN(printer_name) + + STRLEN(port_name) + STRLEN(text)); if (prt_name != NULL) wsprintf((char *)prt_name, (const char *)text, printer_name, port_name); @@ -2111,7 +2111,7 @@ Messaging_WndProc(HWND hwnd, UINT msg, W char *err = _(e_invexprmsg); size_t len = STRLEN(str) + STRLEN(err) + 5; - res = alloc((unsigned)len); + res = alloc(len); if (res != NULL) vim_snprintf((char *)res, len, "%s: \"%s\"", err, str); reply.dwData = COPYDATA_ERROR_RESULT; @@ -2340,7 +2340,7 @@ serverSetName(char_u *name) char_u *p; /* Leave enough space for a 9-digit suffix to ensure uniqueness! */ - ok_name = alloc((unsigned)STRLEN(name) + 10); + ok_name = alloc(STRLEN(name) + 10); STRCPY(ok_name, name); p = ok_name + STRLEN(name);