https://git.reactos.org/?p=reactos.git;a=commitdiff;h=36aea8e56eb6eb9f1cab5…
commit 36aea8e56eb6eb9f1cab5fd6ce040b80ef6a302f
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Thu Jun 15 16:22:43 2023 +0900
Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
CommitDate: Thu Jun 15 16:22:43 2023 +0900
[TASKMGR] affinity.c: Use _countof instead of sizeof/sizeof
CORE-18991
---
base/applications/taskmgr/affinity.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/base/applications/taskmgr/affinity.c b/base/applications/taskmgr/affinity.c
index 6172a79753d..1b5ec4247ca 100644
--- a/base/applications/taskmgr/affinity.c
+++ b/base/applications/taskmgr/affinity.c
@@ -51,8 +51,8 @@ void ProcessPage_OnSetAffinity(void)
hProcessAffinityHandle =
OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
- GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
- LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, _countof(szTitle));
MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
return;
}
@@ -80,13 +80,13 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
* the number of CPUs present in the system
*/
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask,
&dwSystemAffinityMask)) {
- GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
EndDialog(hDlg, 0);
- LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, _countof(szTitle));
MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
}
- for (nCpu=0; nCpu<sizeof(dwCpuTable) / sizeof(dwCpuTable[0]); nCpu++) {
+ for (nCpu = 0; nCpu < _countof(dwCpuTable); nCpu++) {
/*
* Enable a checkbox for each processor present in the system
*/
@@ -118,7 +118,7 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
* to adjust the process affinity mask
*/
if (LOWORD(wParam) == IDOK) {
- for (nCpu=0; nCpu<sizeof(dwCpuTable) / sizeof(dwCpuTable[0]); nCpu++) {
+ for (nCpu = 0; nCpu < _countof(dwCpuTable); nCpu++) {
/*
* First we have to create a mask out of each
* checkbox that the user checked.
@@ -134,8 +134,8 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
* of it's cpu time.
*/
if (!dwProcessAffinityMask) {
- LoadStringW(hInst, IDS_MSG_PROCESSONEPRO, strErrorText,
sizeof(strErrorText) / sizeof(WCHAR));
- LoadStringW(hInst, IDS_MSG_INVALIDOPTION, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ LoadStringW(hInst, IDS_MSG_PROCESSONEPRO, strErrorText,
_countof(strErrorText));
+ LoadStringW(hInst, IDS_MSG_INVALIDOPTION, szTitle, _countof(szTitle));
MessageBoxW(hDlg, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
return TRUE;
}
@@ -144,9 +144,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam)
* Try to set the process affinity
*/
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask))
{
- GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
+ GetLastErrorText(strErrorText, _countof(strErrorText));
EndDialog(hDlg, LOWORD(wParam));
- LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle,
_countof(szTitle));
MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
}