summaryrefslogtreecommitdiff
path: root/src/os_win32.c
diff options
context:
space:
mode:
authorK.Takata <kentkt@csc.jp>2021-06-02 13:28:16 +0200
committerBram Moolenaar <Bram@vim.org>2021-06-02 13:28:16 +0200
commiteeec2548785b2dd245a31ab25d7bde0f88ea1a6d (patch)
tree533236c436888fd7a072c4d94a75279158f9c8a5 /src/os_win32.c
parentb54abeeafb074248597878a874fed9a66b114c06 (diff)
downloadvim-git-eeec2548785b2dd245a31ab25d7bde0f88ea1a6d.tar.gz
patch 8.2.2922: computing array length is done in various waysv8.2.2922
Problem: Computing array length is done in various ways. Solution: Use ARRAY_LENGTH everywhere. (Ken Takata, closes #8305)
Diffstat (limited to 'src/os_win32.c')
-rw-r--r--src/os_win32.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/os_win32.c b/src/os_win32.c
index c5bbc2bf2..874a2c69d 100644
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -1105,7 +1105,7 @@ decode_key_event(
return TRUE;
}
- for (i = sizeof(VirtKeyMap) / sizeof(VirtKeyMap[0]); --i >= 0; )
+ for (i = ARRAY_LENGTH(VirtKeyMap); --i >= 0; )
{
if (VirtKeyMap[i].wVirtKey == pker->wVirtualKeyCode)
{
@@ -3045,7 +3045,7 @@ mch_get_user_name(
int len)
{
WCHAR wszUserName[256 + 1]; // UNLEN is 256
- DWORD wcch = sizeof(wszUserName) / sizeof(WCHAR);
+ DWORD wcch = ARRAY_LENGTH(wszUserName);
if (GetUserNameW(wszUserName, &wcch))
{
@@ -3072,7 +3072,7 @@ mch_get_host_name(
int len)
{
WCHAR wszHostName[256 + 1];
- DWORD wcch = sizeof(wszHostName) / sizeof(WCHAR);
+ DWORD wcch = ARRAY_LENGTH(wszHostName);
if (GetComputerNameW(wszHostName, &wcch))
{
@@ -4757,8 +4757,7 @@ mch_call_shell(
WCHAR szShellTitle[512];
// Change the title to reflect that we are in a subshell.
- if (GetConsoleTitleW(szShellTitle,
- sizeof(szShellTitle)/sizeof(WCHAR) - 4) > 0)
+ if (GetConsoleTitleW(szShellTitle, ARRAY_LENGTH(szShellTitle) - 4) > 0)
{
if (cmd == NULL)
wcscat(szShellTitle, L" :sh");
@@ -4770,7 +4769,7 @@ mch_call_shell(
{
wcscat(szShellTitle, L" - !");
if ((wcslen(szShellTitle) + wcslen(wn) <
- sizeof(szShellTitle)/sizeof(WCHAR)))
+ ARRAY_LENGTH(szShellTitle)))
wcscat(szShellTitle, wn);
SetConsoleTitleW(szShellTitle);
vim_free(wn);