Mercurial > vim
comparison 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 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
1464 char_u *text = (char_u *)_("to %s on %s"); | 1464 char_u *text = (char_u *)_("to %s on %s"); |
1465 char_u *printer_name = utf16_to_enc(wprinter_name, NULL); | 1465 char_u *printer_name = utf16_to_enc(wprinter_name, NULL); |
1466 char_u *port_name = utf16_to_enc(wport_name, NULL); | 1466 char_u *port_name = utf16_to_enc(wport_name, NULL); |
1467 | 1467 |
1468 if (printer_name != NULL && port_name != NULL) | 1468 if (printer_name != NULL && port_name != NULL) |
1469 prt_name = alloc((unsigned)(STRLEN(printer_name) | 1469 prt_name = alloc(STRLEN(printer_name) |
1470 + STRLEN(port_name) + STRLEN(text))); | 1470 + STRLEN(port_name) + STRLEN(text)); |
1471 if (prt_name != NULL) | 1471 if (prt_name != NULL) |
1472 wsprintf((char *)prt_name, (const char *)text, | 1472 wsprintf((char *)prt_name, (const char *)text, |
1473 printer_name, port_name); | 1473 printer_name, port_name); |
1474 vim_free(printer_name); | 1474 vim_free(printer_name); |
1475 vim_free(port_name); | 1475 vim_free(port_name); |
2109 if (res == NULL) | 2109 if (res == NULL) |
2110 { | 2110 { |
2111 char *err = _(e_invexprmsg); | 2111 char *err = _(e_invexprmsg); |
2112 size_t len = STRLEN(str) + STRLEN(err) + 5; | 2112 size_t len = STRLEN(str) + STRLEN(err) + 5; |
2113 | 2113 |
2114 res = alloc((unsigned)len); | 2114 res = alloc(len); |
2115 if (res != NULL) | 2115 if (res != NULL) |
2116 vim_snprintf((char *)res, len, "%s: \"%s\"", err, str); | 2116 vim_snprintf((char *)res, len, "%s: \"%s\"", err, str); |
2117 reply.dwData = COPYDATA_ERROR_RESULT; | 2117 reply.dwData = COPYDATA_ERROR_RESULT; |
2118 } | 2118 } |
2119 else | 2119 else |
2338 HWND hwnd = 0; | 2338 HWND hwnd = 0; |
2339 int i = 0; | 2339 int i = 0; |
2340 char_u *p; | 2340 char_u *p; |
2341 | 2341 |
2342 /* Leave enough space for a 9-digit suffix to ensure uniqueness! */ | 2342 /* Leave enough space for a 9-digit suffix to ensure uniqueness! */ |
2343 ok_name = alloc((unsigned)STRLEN(name) + 10); | 2343 ok_name = alloc(STRLEN(name) + 10); |
2344 | 2344 |
2345 STRCPY(ok_name, name); | 2345 STRCPY(ok_name, name); |
2346 p = ok_name + STRLEN(name); | 2346 p = ok_name + STRLEN(name); |
2347 | 2347 |
2348 for (;;) | 2348 for (;;) |