Mercurial > vim
comparison src/gui_w32.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 |
---|---|
3118 if (font_name == NULL) | 3118 if (font_name == NULL) |
3119 return NULL; | 3119 return NULL; |
3120 charset_name = charset_id2name((int)lf.lfCharSet); | 3120 charset_name = charset_id2name((int)lf.lfCharSet); |
3121 quality_name = quality_id2name((int)lf.lfQuality); | 3121 quality_name = quality_id2name((int)lf.lfQuality); |
3122 | 3122 |
3123 res = (char *)alloc((unsigned)(strlen(font_name) + 30 | 3123 res = (char *)alloc(strlen(font_name) + 30 |
3124 + (charset_name == NULL ? 0 : strlen(charset_name) + 2) | 3124 + (charset_name == NULL ? 0 : strlen(charset_name) + 2) |
3125 + (quality_name == NULL ? 0 : strlen(quality_name) + 2))); | 3125 + (quality_name == NULL ? 0 : strlen(quality_name) + 2)); |
3126 if (res != NULL) | 3126 if (res != NULL) |
3127 { | 3127 { |
3128 p = res; | 3128 p = res; |
3129 // make a normal font string out of the lf thing: | 3129 // make a normal font string out of the lf thing: |
3130 points = pixels_to_points( | 3130 points = pixels_to_points( |
7716 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); | 7716 len += (int)STRLEN(TEAROFF_SUBMENU_LABEL); |
7717 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); | 7717 menuID = (WORD)((long_u)(menu->submenu_id) | (DWORD)0x8000); |
7718 } | 7718 } |
7719 | 7719 |
7720 /* Allocate menu label and fill it in */ | 7720 /* Allocate menu label and fill it in */ |
7721 text = label = alloc((unsigned)len + 1); | 7721 text = label = alloc(len + 1); |
7722 if (label == NULL) | 7722 if (label == NULL) |
7723 break; | 7723 break; |
7724 | 7724 |
7725 vim_strncpy(text, menu->name, nameLen); | 7725 vim_strncpy(text, menu->name, nameLen); |
7726 text = vim_strchr(text, TAB); /* stop at TAB before actext */ | 7726 text = vim_strchr(text, TAB); /* stop at TAB before actext */ |