diff --git a/programs/regedit/about.c b/programs/regedit/about.c index e0e469efe19..6684dbe6346 100644 --- a/programs/regedit/about.c +++ b/programs/regedit/about.c @@ -29,6 +29,6 @@ void ShowAboutBox(HWND hWnd) { WCHAR title[64]; HICON icon = LoadImageW( hInst, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON, 48, 48, LR_SHARED ); - LoadStringW(hInst, IDS_APP_TITLE, title, COUNT_OF(title)); + LoadStringW(hInst, IDS_APP_TITLE, title, ARRAY_SIZE(title)); ShellAboutW(hWnd, title, NULL, icon); } diff --git a/programs/regedit/edit.c b/programs/regedit/edit.c index c982791b35c..db768b65cc6 100644 --- a/programs/regedit/edit.c +++ b/programs/regedit/edit.c @@ -54,8 +54,8 @@ static int vmessagebox(HWND hwnd, int buttons, int titleId, int resId, __ms_va_l WCHAR *str; int ret; - LoadStringW(hInst, titleId, title, COUNT_OF(title)); - LoadStringW(hInst, resId, fmt, COUNT_OF(fmt)); + LoadStringW(hInst, titleId, title, ARRAY_SIZE(title)); + LoadStringW(hInst, resId, fmt, ARRAY_SIZE(fmt)); FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ALLOCATE_BUFFER, fmt, 0, 0, (WCHAR *)&str, 0, &va_args); @@ -94,7 +94,7 @@ static BOOL change_dword_base(HWND hwndDlg, BOOL toHex) WCHAR buf[128]; DWORD val; - if (!GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, COUNT_OF(buf))) return FALSE; + if (!GetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf, ARRAY_SIZE(buf))) return FALSE; if (!swscanf(buf, toHex ? percent_u : percent_x, &val)) return FALSE; wsprintfW(buf, toHex ? percent_x : percent_u, val); return SetDlgItemTextW(hwndDlg, IDC_VALUE_DATA, buf); @@ -244,7 +244,7 @@ BOOL CreateKey(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, LPWSTR keyName) goto done; } - if (!LoadStringW(GetModuleHandleW(0), IDS_NEWKEY, newKey, COUNT_OF(newKey))) goto done; + if (!LoadStringW(GetModuleHandleW(0), IDS_NEWKEY, newKey, ARRAY_SIZE(newKey))) goto done; /* try to find a name for the key being created (maximum = 100 attempts) */ for (keyNum = 1; keyNum < 100; keyNum++) { @@ -460,7 +460,7 @@ BOOL CreateValue(HWND hwnd, HKEY hKeyRoot, LPCWSTR keyPath, DWORD valueType, LPW return FALSE; } - if (!LoadStringW(GetModuleHandleW(0), IDS_NEWVALUE, newValue, COUNT_OF(newValue))) goto done; + if (!LoadStringW(GetModuleHandleW(0), IDS_NEWVALUE, newValue, ARRAY_SIZE(newValue))) goto done; /* try to find a name for the value being created (maximum = 100 attempts) */ for (valueNum = 1; valueNum < 100; valueNum++) { diff --git a/programs/regedit/framewnd.c b/programs/regedit/framewnd.c index 94da217045a..804573e0c00 100644 --- a/programs/regedit/framewnd.c +++ b/programs/regedit/framewnd.c @@ -167,7 +167,7 @@ static void update_new_items_and_copy_keyname(HMENU hMenu, WCHAR *keyName) if (!keyName) state = MF_GRAYED; - for (i = 0; i < COUNT_OF(items); i++) + for (i = 0; i < ARRAY_SIZE(items); i++) EnableMenuItem(hMenu, items[i], state | MF_BYCOMMAND); } @@ -469,7 +469,7 @@ static BOOL ImportRegistryFile(HWND hWnd) InitOpenFileName(hWnd, &ofn); ofn.Flags |= OFN_ENABLESIZING; - LoadStringW(hInst, IDS_FILEDIALOG_IMPORT_TITLE, title, COUNT_OF(title)); + LoadStringW(hInst, IDS_FILEDIALOG_IMPORT_TITLE, title, ARRAY_SIZE(title)); ofn.lpstrTitle = title; if (GetOpenFileNameW(&ofn)) { if (!import_registry_filename(ofn.lpstrFile)) { @@ -498,7 +498,7 @@ static BOOL ExportRegistryFile(HWND hWnd) WCHAR title[128]; InitOpenFileName(hWnd, &ofn); - LoadStringW(hInst, IDS_FILEDIALOG_EXPORT_TITLE, title, COUNT_OF(title)); + LoadStringW(hInst, IDS_FILEDIALOG_EXPORT_TITLE, title, ARRAY_SIZE(title)); ofn.lpstrTitle = title; ofn.Flags = OFN_ENABLETEMPLATE | OFN_ENABLEHOOK | OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT; ofn.lpfnHook = ExportRegistryFile_OFNHookProc; @@ -676,7 +676,7 @@ static INT_PTR CALLBACK addtofavorites_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM w item.mask = TVIF_HANDLE | TVIF_TEXT; item.hItem = selected; item.pszText = buf; - item.cchTextMax = COUNT_OF(buf); + item.cchTextMax = ARRAY_SIZE(buf); SendMessageW(g_pChildWnd->hTreeWnd, TVM_GETITEMW, 0, (LPARAM)&item); EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE); @@ -1065,10 +1065,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa CreateWindowExW(0, szChildClass, captionW, WS_CHILD | WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, hWnd, NULL, hInst, 0); - LoadStringW(hInst, IDS_EXPAND, expandW, COUNT_OF(expandW)); - LoadStringW(hInst, IDS_COLLAPSE, collapseW, COUNT_OF(collapseW)); - LoadStringW(hInst, IDS_EDIT_MODIFY, modifyW, COUNT_OF(modifyW)); - LoadStringW(hInst, IDS_EDIT_MODIFY_BIN, modify_binaryW, COUNT_OF(modify_binaryW)); + LoadStringW(hInst, IDS_EXPAND, expandW, ARRAY_SIZE(expandW)); + LoadStringW(hInst, IDS_COLLAPSE, collapseW, ARRAY_SIZE(collapseW)); + LoadStringW(hInst, IDS_EDIT_MODIFY, modifyW, ARRAY_SIZE(modifyW)); + LoadStringW(hInst, IDS_EDIT_MODIFY_BIN, modify_binaryW, ARRAY_SIZE(modify_binaryW)); break; case WM_COMMAND: if (!_CmdWndProc(hWnd, message, wParam, lParam)) diff --git a/programs/regedit/listview.c b/programs/regedit/listview.c index 0934e03a39e..404699fab8c 100644 --- a/programs/regedit/listview.c +++ b/programs/regedit/listview.c @@ -361,7 +361,7 @@ HWND CreateListView(HWND hwndParent, UINT id) WCHAR ListView[] = {'L','i','s','t',' ','V','i','e','w',0}; /* prepare strings */ - LoadStringW(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, COUNT_OF(g_szValueNotSet)); + LoadStringW(hInst, IDS_REGISTRY_VALUE_NOT_SET, g_szValueNotSet, ARRAY_SIZE(g_szValueNotSet)); /* Get the dimensions of the parent window's client area, and create the list view control. */ GetClientRect(hwndParent, &rcClient); diff --git a/programs/regedit/main.c b/programs/regedit/main.c index 19d720d4d22..62fd616b519 100644 --- a/programs/regedit/main.c +++ b/programs/regedit/main.c @@ -172,8 +172,8 @@ int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLi } /* Initialize global strings */ - LoadStringW(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); - LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName)); + LoadStringW(hInstance, IDS_APP_TITLE, szTitle, ARRAY_SIZE(szTitle)); + LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, ARRAY_SIZE(g_pszDefaultValueName)); /* Store instance handle in our global variable */ hInst = hInstance; diff --git a/programs/regedit/main.h b/programs/regedit/main.h index 788de1a5098..1d0109f9e5a 100644 --- a/programs/regedit/main.h +++ b/programs/regedit/main.h @@ -30,7 +30,7 @@ #define SPLIT_WIDTH 5 -#define COUNT_OF(a) (sizeof(a)/sizeof(a[0])) +#define ARRAY_SIZE(A) (sizeof(A)/sizeof(*A)) #define MAX_NEW_KEY_LEN 128 diff --git a/programs/regedit/treeview.c b/programs/regedit/treeview.c index 4bbec40df8d..86224e231b1 100644 --- a/programs/regedit/treeview.c +++ b/programs/regedit/treeview.c @@ -521,7 +521,7 @@ HTREEITEM InsertNode(HWND hwndTV, HTREEITEM hItem, LPWSTR name) item.mask = TVIF_HANDLE | TVIF_TEXT; item.hItem = hNewItem; item.pszText = buf; - item.cchTextMax = COUNT_OF(buf); + item.cchTextMax = ARRAY_SIZE(buf); if (!TreeView_GetItemW(hwndTV, &item)) continue; if (lstrcmpW(name, item.pszText) == 0) break; }