Mercurial > vim
comparison src/gui_gtk_x11.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 | 7ae2396cef62 |
children | ce04ebdf26b8 |
comparison
equal
deleted
inserted
replaced
16763:fccf84413b53 | 16764:ef00b6bc186b |
---|---|
427 /* | 427 /* |
428 * Move all the entries in argv which are relevant to GTK+ and GNOME | 428 * Move all the entries in argv which are relevant to GTK+ and GNOME |
429 * into gui_argv. Freed later in gui_mch_init(). | 429 * into gui_argv. Freed later in gui_mch_init(). |
430 */ | 430 */ |
431 gui_argc = 0; | 431 gui_argc = 0; |
432 gui_argv = (char **)alloc((unsigned)((*argc + 1) * sizeof(char *))); | 432 gui_argv = (char **)alloc((*argc + 1) * sizeof(char *)); |
433 | 433 |
434 g_return_if_fail(gui_argv != NULL); | 434 g_return_if_fail(gui_argv != NULL); |
435 | 435 |
436 gui_argv[gui_argc++] = argv[i++]; | 436 gui_argv[gui_argc++] = argv[i++]; |
437 | 437 |
1542 * (Not that pasting 2G of text is ever going to work, but... ;-) */ | 1542 * (Not that pasting 2G of text is ever going to work, but... ;-) */ |
1543 length = MIN(tmplen, (long_u)(G_MAXINT - 1)); | 1543 length = MIN(tmplen, (long_u)(G_MAXINT - 1)); |
1544 | 1544 |
1545 if (info == (guint)TARGET_VIM) | 1545 if (info == (guint)TARGET_VIM) |
1546 { | 1546 { |
1547 tmpbuf = alloc((unsigned)length + 1); | 1547 tmpbuf = alloc(length + 1); |
1548 if (tmpbuf != NULL) | 1548 if (tmpbuf != NULL) |
1549 { | 1549 { |
1550 tmpbuf[0] = motion_type; | 1550 tmpbuf[0] = motion_type; |
1551 mch_memmove(tmpbuf + 1, string, (size_t)length); | 1551 mch_memmove(tmpbuf + 1, string, (size_t)length); |
1552 } | 1552 } |
1601 else if (info == (guint)TARGET_VIMENC) | 1601 else if (info == (guint)TARGET_VIMENC) |
1602 { | 1602 { |
1603 int l = STRLEN(p_enc); | 1603 int l = STRLEN(p_enc); |
1604 | 1604 |
1605 /* contents: motion_type 'encoding' NUL text */ | 1605 /* contents: motion_type 'encoding' NUL text */ |
1606 tmpbuf = alloc((unsigned)length + l + 2); | 1606 tmpbuf = alloc(length + l + 2); |
1607 if (tmpbuf != NULL) | 1607 if (tmpbuf != NULL) |
1608 { | 1608 { |
1609 tmpbuf[0] = motion_type; | 1609 tmpbuf[0] = motion_type; |
1610 STRCPY(tmpbuf + 1, p_enc); | 1610 STRCPY(tmpbuf + 1, p_enc); |
1611 mch_memmove(tmpbuf + l + 2, string, (size_t)length); | 1611 mch_memmove(tmpbuf + l + 2, string, (size_t)length); |
2510 break; | 2510 break; |
2511 | 2511 |
2512 if (i == count) | 2512 if (i == count) |
2513 { | 2513 { |
2514 /* allocate an Atoms array which is one item longer */ | 2514 /* allocate an Atoms array which is one item longer */ |
2515 new_atoms = (Atom *)alloc((unsigned)((count + 1) | 2515 new_atoms = (Atom *)alloc((count + 1) * sizeof(Atom)); |
2516 * sizeof(Atom))); | |
2517 if (new_atoms != NULL) | 2516 if (new_atoms != NULL) |
2518 { | 2517 { |
2519 memcpy(new_atoms, existing_atoms, count * sizeof(Atom)); | 2518 memcpy(new_atoms, existing_atoms, count * sizeof(Atom)); |
2520 new_atoms[count] = save_yourself_xatom; | 2519 new_atoms[count] = save_yourself_xatom; |
2521 XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), | 2520 XSetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), |