From 91e3421525199a9c440d346ea78d624ec4927486 Mon Sep 17 00:00:00 2001 From: Milan Burda Date: Tue, 7 May 2019 15:19:14 +0200 Subject: [PATCH] refactor: use base::size() for array sizes (#18155) --- atom/browser/atom_browser_main_parts.cc | 2 +- atom/browser/ui/file_dialog_win.cc | 3 ++- atom/browser/ui/win/jump_list.cc | 7 ++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/atom/browser/atom_browser_main_parts.cc b/atom/browser/atom_browser_main_parts.cc index f77e437efe6..0b660279cae 100644 --- a/atom/browser/atom_browser_main_parts.cc +++ b/atom/browser/atom_browser_main_parts.cc @@ -368,7 +368,7 @@ void AtomBrowserMainParts::ToolkitInitialized() { gfx::win::SetGetMinimumFontSizeCallback(&GetMinimumFontSize); wchar_t module_name[MAX_PATH] = {0}; - if (GetModuleFileName(NULL, module_name, MAX_PATH)) + if (GetModuleFileName(NULL, module_name, base::size(module_name))) ui::CursorLoaderWin::SetCursorResourceModule(module_name); #endif diff --git a/atom/browser/ui/file_dialog_win.cc b/atom/browser/ui/file_dialog_win.cc index c8d7f36c06f..71f51875468 100644 --- a/atom/browser/ui/file_dialog_win.cc +++ b/atom/browser/ui/file_dialog_win.cc @@ -259,7 +259,8 @@ bool ShowOpenDialogSync(const DialogSettings& settings, return false; wchar_t file_name[MAX_PATH]; - hr = GetFileNameFromShellItem(item, SIGDN_FILESYSPATH, file_name, MAX_PATH); + hr = GetFileNameFromShellItem(item, SIGDN_FILESYSPATH, file_name, + base::size(file_name)); if (FAILED(hr)) return false; diff --git a/atom/browser/ui/win/jump_list.cc b/atom/browser/ui/win/jump_list.cc index 171bf84f6e2..0f2082a670e 100644 --- a/atom/browser/ui/win/jump_list.cc +++ b/atom/browser/ui/win/jump_list.cc @@ -83,7 +83,7 @@ bool ConvertShellLinkToJumpListItem(IShellLink* shell_link, item->type = JumpListItem::Type::TASK; wchar_t path[MAX_PATH]; - if (FAILED(shell_link->GetPath(path, MAX_PATH, nullptr, 0))) + if (FAILED(shell_link->GetPath(path, base::size(path), nullptr, 0))) return false; CComQIPtr property_store = shell_link; @@ -100,13 +100,14 @@ bool ConvertShellLinkToJumpListItem(IShellLink* shell_link, } int icon_index; - if (SUCCEEDED(shell_link->GetIconLocation(path, MAX_PATH, &icon_index))) { + if (SUCCEEDED( + shell_link->GetIconLocation(path, base::size(path), &icon_index))) { item->icon_path = base::FilePath(path); item->icon_index = icon_index; } wchar_t item_desc[INFOTIPSIZE]; - if (SUCCEEDED(shell_link->GetDescription(item_desc, INFOTIPSIZE))) + if (SUCCEEDED(shell_link->GetDescription(item_desc, base::size(item_desc)))) item->description = item_desc; return true;