Author: tfaber
Date: Thu Jul 12 19:10:48 2012
New Revision: 56876
URL:
http://svn.reactos.org/svn/reactos?rev=56876&view=rev
Log:
[REGEDIT]
- Use COUNT_OF where appropriate. Miscellaneous code cleanup. Patch by Hermès Bélusca
See issue #7182 for more details.
Modified:
trunk/reactos/base/applications/regedit/about.c
trunk/reactos/base/applications/regedit/childwnd.c
trunk/reactos/base/applications/regedit/edit.c
trunk/reactos/base/applications/regedit/find.c
trunk/reactos/base/applications/regedit/framewnd.c
trunk/reactos/base/applications/regedit/listview.c
trunk/reactos/base/applications/regedit/main.c
trunk/reactos/base/applications/regedit/regedit.c
trunk/reactos/base/applications/regedit/regproc.c
trunk/reactos/base/applications/regedit/security.c
trunk/reactos/base/applications/regedit/settings.c
trunk/reactos/base/applications/regedit/treeview.c
Modified: trunk/reactos/base/applications/regedit/about.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/about.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/about.c [iso-8859-1] Thu Jul 12 19:10:48 2012
@@ -24,6 +24,6 @@
void ShowAboutBox(HWND hWnd)
{
TCHAR AppStr[255];
- LoadString(hInst, IDS_APP_TITLE, AppStr, sizeof(AppStr)/sizeof(TCHAR));
+ LoadString(hInst, IDS_APP_TITLE, AppStr, COUNT_OF(AppStr));
ShellAbout(hWnd, AppStr, _T(""), LoadIcon(hInst,
MAKEINTRESOURCE(IDI_REGEDIT)));
}
Modified: trunk/reactos/base/applications/regedit/childwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/childwnd.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -292,7 +292,7 @@
case WM_KEYUP:
if (wParam == VK_RETURN)
{
- GetWindowText(hwnd, s_szNode, sizeof(s_szNode) / sizeof(s_szNode[0]));
+ GetWindowText(hwnd, s_szNode, COUNT_OF(s_szNode));
SelectNode(g_pChildWnd->hTreeWnd, s_szNode);
}
break;
@@ -325,7 +325,7 @@
HFONT hFont;
TCHAR buffer[MAX_PATH];
/* load "My Computer" string */
- LoadString(hInst, IDS_MY_COMPUTER, buffer, sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MY_COMPUTER, buffer, COUNT_OF(buffer));
g_pChildWnd = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(ChildWnd));
if (!g_pChildWnd) return 0;
@@ -557,7 +557,7 @@
if (ptvdi->item.pszText)
{
keyPath = GetItemPath(g_pChildWnd->hTreeWnd,
TreeView_GetParent(g_pChildWnd->hTreeWnd, ptvdi->item.hItem), &hRootKey);
- _sntprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]),
_T("%s\\%s"), keyPath, ptvdi->item.pszText);
+ _sntprintf(szBuffer, COUNT_OF(szBuffer), _T("%s\\%s"),
keyPath, ptvdi->item.pszText);
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, ptvdi->item.hItem,
&hRootKey);
if (RegOpenKeyEx(hRootKey, szBuffer, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS)
{
@@ -693,7 +693,7 @@
(void)TreeView_GetItem(g_pChildWnd->hTreeWnd, &item);
/* Set the Expand/Collapse menu item appropriately */
- LoadString(hInst, (item.state & TVIS_EXPANDED) ? IDS_COLLAPSE :
IDS_EXPAND, buffer, sizeof(buffer) / sizeof(buffer[0]));
+ LoadString(hInst, (item.state & TVIS_EXPANDED) ? IDS_COLLAPSE :
IDS_EXPAND, buffer, COUNT_OF(buffer));
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING | MIIM_STATE | MIIM_ID;
@@ -720,18 +720,18 @@
/* Come up with suggestions */
keyPath = GetItemPath(g_pChildWnd->hTreeWnd, NULL, &hRootKey);
- SuggestKeys(hRootKey, keyPath, Suggestions, sizeof(Suggestions) /
sizeof(Suggestions[0]));
+ SuggestKeys(hRootKey, keyPath, Suggestions, COUNT_OF(Suggestions));
if (Suggestions[0])
{
AppendMenu(hContextMenu, MF_SEPARATOR, 0, NULL);
- LoadString(hInst, IDS_GOTO_SUGGESTED_KEY, resource, sizeof(resource)
/ sizeof(resource[0]));
+ LoadString(hInst, IDS_GOTO_SUGGESTED_KEY, resource,
COUNT_OF(resource));
s = Suggestions;
wID = ID_TREE_SUGGESTION_MIN;
while(*s && (wID <= ID_TREE_SUGGESTION_MAX))
{
- _sntprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), resource,
s);
+ _sntprintf(buffer, COUNT_OF(buffer), resource, s);
memset(&mii, 0, sizeof(mii));
mii.cbSize = sizeof(mii);
Modified: trunk/reactos/base/applications/regedit/edit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/edit.c [iso-8859-1] Thu Jul 12 19:10:48 2012
@@ -108,7 +108,7 @@
else
{
TCHAR buffer[255];
- LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, buffer);
}
SetDlgItemText(hwndDlg, IDC_VALUE_DATA, stringValueData);
@@ -176,7 +176,7 @@
else
{
TCHAR buffer[255];
- LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, buffer);
}
SetDlgItemText(hwndDlg, IDC_VALUE_DATA, stringValueData);
@@ -296,7 +296,7 @@
else
{
TCHAR buffer[255];
- LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, buffer);
}
CheckRadioButton (hwndDlg, IDC_FORMAT_HEX, IDC_FORMAT_DEC, IDC_FORMAT_HEX);
@@ -397,7 +397,7 @@
else
{
TCHAR buffer[255];
- LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, buffer);
}
hwndValue = GetDlgItem(hwndDlg, IDC_VALUE_DATA);
@@ -451,13 +451,13 @@
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = (rc.right - rc.left) / 2;
- LoadString(hInst, IDS_DMA_CHANNEL, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DMA_CHANNEL, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;
lvC.iSubItem = 1;
lvC.cx = (rc.right - rc.left) - lvC.cx;
- LoadString(hInst, IDS_DMA_PORT, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DMA_PORT, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;
@@ -471,23 +471,23 @@
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
- LoadString(hInst, IDS_INTERRUPT_VECTOR, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERRUPT_VECTOR, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;
lvC.iSubItem = 1;
- LoadString(hInst, IDS_INTERRUPT_LEVEL, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERRUPT_LEVEL, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;
lvC.iSubItem = 2;
- LoadString(hInst, IDS_INTERRUPT_AFFINITY, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERRUPT_AFFINITY, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;
lvC.iSubItem = 3;
lvC.cx = (rc.right - rc.left) - 3 * width;
- LoadString(hInst, IDS_INTERRUPT_TYPE, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERRUPT_TYPE, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 3, &lvC) == -1)
return FALSE;
@@ -501,18 +501,18 @@
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
- LoadString(hInst, IDS_MEMORY_ADDRESS, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MEMORY_ADDRESS, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;
lvC.iSubItem = 1;
- LoadString(hInst, IDS_MEMORY_LENGTH, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MEMORY_LENGTH, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;
lvC.iSubItem = 2;
lvC.cx = (rc.right - rc.left) - 2 * width;
- LoadString(hInst, IDS_MEMORY_ACCESS, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MEMORY_ACCESS, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;
@@ -526,18 +526,18 @@
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
- LoadString(hInst, IDS_PORT_ADDRESS, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_PORT_ADDRESS, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;
lvC.iSubItem = 1;
- LoadString(hInst, IDS_PORT_LENGTH, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_PORT_LENGTH, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;
lvC.iSubItem = 2;
lvC.cx = (rc.right - rc.left) - 2 * width;
- LoadString(hInst, IDS_PORT_ACCESS, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_PORT_ACCESS, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;
@@ -550,18 +550,18 @@
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = width;
- LoadString(hInst, IDS_SPECIFIC_RESERVED1, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_SPECIFIC_RESERVED1, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 0, &lvC) == -1)
return FALSE;
lvC.iSubItem = 1;
- LoadString(hInst, IDS_SPECIFIC_RESERVED2, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_SPECIFIC_RESERVED2, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 1, &lvC) == -1)
return FALSE;
lvC.iSubItem = 2;
lvC.cx = (rc.right - rc.left) - 2 * width;
- LoadString(hInst, IDS_SPECIFIC_DATASIZE, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_SPECIFIC_DATASIZE, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hwndLV, 2, &lvC) == -1)
return FALSE;
@@ -715,9 +715,9 @@
ListView_SetItemText(hwndLV, iItem, 1, buffer);
if (pDescriptor->Flags & CM_RESOURCE_PORT_IO)
- LoadString(hInst, IDS_PORT_PORT_IO, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_PORT_PORT_IO, buffer, COUNT_OF(buffer));
else
- LoadString(hInst, IDS_PORT_MEMORY_IO, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_PORT_MEMORY_IO, buffer, COUNT_OF(buffer));
ListView_SetItemText(hwndLV, iItem, 2, buffer);
}
break;
@@ -746,9 +746,9 @@
ListView_SetItemText(hwndLV, iItem, 2, buffer);
if (pDescriptor->Flags & CM_RESOURCE_INTERRUPT_LATCHED)
- LoadString(hInst, IDS_INTERRUPT_EDGE_SENSITIVE, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERRUPT_EDGE_SENSITIVE, buffer,
COUNT_OF(buffer));
else
- LoadString(hInst, IDS_INTERRUPT_LEVEL_SENSITIVE, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERRUPT_LEVEL_SENSITIVE, buffer,
COUNT_OF(buffer));
ListView_SetItemText(hwndLV, iItem, 3, buffer);
}
@@ -781,15 +781,15 @@
switch (pDescriptor->Flags & (CM_RESOURCE_MEMORY_READ_ONLY |
CM_RESOURCE_MEMORY_WRITE_ONLY))
{
case CM_RESOURCE_MEMORY_READ_ONLY:
- LoadString(hInst, IDS_MEMORY_READ_ONLY, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MEMORY_READ_ONLY, buffer,
COUNT_OF(buffer));
break;
case CM_RESOURCE_MEMORY_WRITE_ONLY:
- LoadString(hInst, IDS_MEMORY_WRITE_ONLY, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MEMORY_WRITE_ONLY, buffer,
COUNT_OF(buffer));
break;
default:
- LoadString(hInst, IDS_MEMORY_READ_WRITE, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_MEMORY_READ_WRITE, buffer,
COUNT_OF(buffer));
break;
}
@@ -951,13 +951,13 @@
/* Load the column labels from the resource file. */
lvC.iSubItem = 0;
lvC.cx = (rc.right - rc.left) / 2;
- LoadString(hInst, IDS_BUSNUMBER, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_BUSNUMBER, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hWndListView, 0, &lvC) == -1)
return FALSE;
lvC.iSubItem = 1;
lvC.cx = (rc.right - rc.left) - lvC.cx;
- LoadString(hInst, IDS_INTERFACE, szText, sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INTERFACE, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hWndListView, 1, &lvC) == -1)
return FALSE;
@@ -1456,8 +1456,8 @@
return FALSE;
}
- LoadString(hInst, IDS_QUERY_DELETE_KEY_CONFIRM, caption,
sizeof(caption)/sizeof(TCHAR));
- LoadString(hInst, IDS_QUERY_DELETE_KEY_ONE, msg, sizeof(msg)/sizeof(TCHAR));
+ LoadString(hInst, IDS_QUERY_DELETE_KEY_CONFIRM, caption, COUNT_OF(caption));
+ LoadString(hInst, IDS_QUERY_DELETE_KEY_ONE, msg, COUNT_OF(msg));
if (MessageBox(g_pChildWnd->hWnd, msg, caption, MB_ICONQUESTION | MB_YESNO) !=
IDYES)
goto done;
Modified: trunk/reactos/base/applications/regedit/find.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/find.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/find.c [iso-8859-1] Thu Jul 12 19:10:48 2012
@@ -774,7 +774,7 @@
hControl = GetDlgItem(hDlg, IDC_FINDWHAT);
if (hControl)
- GetWindowText(hControl, s_szFindWhat, sizeof(s_szFindWhat) /
sizeof(s_szFindWhat[0]));
+ GetWindowText(hControl, s_szFindWhat, COUNT_OF(s_szFindWhat));
EndDialog(hDlg, 1);
break;
@@ -788,7 +788,7 @@
switch(LOWORD(wParam))
{
case IDC_FINDWHAT:
- GetWindowText((HWND) lParam, s_szSavedFindValue,
sizeof(s_szSavedFindValue) / sizeof(s_szSavedFindValue[0]));
+ GetWindowText((HWND) lParam, s_szSavedFindValue,
COUNT_OF(s_szSavedFindValue));
hControl = GetDlgItem(hDlg, IDOK);
if (hControl)
{
@@ -817,8 +817,8 @@
{
TCHAR msg[128], caption[128];
- LoadString(hInst, IDS_FINISHEDFIND, msg, sizeof(msg)/sizeof(TCHAR));
- LoadString(hInst, IDS_APP_TITLE, caption, sizeof(caption)/sizeof(TCHAR));
+ LoadString(hInst, IDS_FINISHEDFIND, msg, COUNT_OF(msg));
+ LoadString(hInst, IDS_APP_TITLE, caption, COUNT_OF(caption));
MessageBox(0, msg, caption, MB_ICONINFORMATION);
}
}
Modified: trunk/reactos/base/applications/regedit/framewnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/framewnd.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/framewnd.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -924,7 +924,7 @@
InitInfo.cbSize = sizeof(InitInfo);
InitInfo.pwzTargetComputer = NULL;
- InitInfo.cDsScopeInfos = sizeof(Scopes) / sizeof(Scopes[0]);
+ InitInfo.cDsScopeInfos = COUNT_OF(Scopes);
InitInfo.aDsScopeInfos = Scopes;
InitInfo.flOptions = 0;
InitInfo.cAttributesToFetch = 0;
@@ -1065,7 +1065,7 @@
hRet = InvokeRemoteRegistryPickerDialog(ObjectPicker,
hWnd,
szComputerName,
- sizeof(szComputerName) /
sizeof(szComputerName[0]));
+ COUNT_OF(szComputerName));
if (hRet == S_OK)
{
/* FIXME - connect to the registry */
@@ -1269,7 +1269,7 @@
mii.fMask = MIIM_TYPE;
mii.fType = MFT_STRING;
mii.dwTypeData = szFavorite;
- mii.cch = sizeof(szFavorite) / sizeof(szFavorite[0]);
+ mii.cch = COUNT_OF(szFavorite);
if (GetMenuItemInfo(hMenu, LOWORD(wParam) - ID_FAVORITES_MIN, TRUE,
&mii))
{
Modified: trunk/reactos/base/applications/regedit/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/listview.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/listview.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -176,7 +176,7 @@
{
TCHAR buffer[255];
/* load (value not set) string */
- LoadString(hInst, IDS_VALUE_NOT_SET, buffer,
sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_VALUE_NOT_SET, buffer, COUNT_OF(buffer));
ListView_SetItemText(hwndLV, index, 2, buffer);
}
break;
@@ -216,7 +216,7 @@
}
else
{
- LoadString(hInst, IDS_INVALID_DWORD, buf, sizeof(buf)/sizeof(TCHAR));
+ LoadString(hInst, IDS_INVALID_DWORD, buf, COUNT_OF(buf));
}
ListView_SetItemText(hwndLV, index, 2, buf);
}
@@ -241,7 +241,7 @@
else
{
TCHAR szText[128];
- LoadString(hInst, IDS_BINARY_EMPTY, szText,
sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_BINARY_EMPTY, szText, COUNT_OF(szText));
ListView_SetItemText(hwndLV, index, 2, szText);
}
}
@@ -266,7 +266,7 @@
lvC.iSubItem = index;
lvC.cx = default_column_widths[index];
lvC.fmt = column_alignment[index];
- LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText,
sizeof(szText)/sizeof(TCHAR));
+ LoadString(hInst, IDS_LIST_COLUMN_FIRST + index, szText, COUNT_OF(szText));
if (ListView_InsertColumn(hWndListView, index, &lvC) == -1) return FALSE;
}
return TRUE;
@@ -313,7 +313,7 @@
switch (plvdi->item.iSubItem)
{
case 0:
- LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer, sizeof(buffer)/sizeof(TCHAR));
+ LoadString(hInst, IDS_DEFAULT_VALUE_NAME, buffer, COUNT_OF(buffer));
plvdi->item.pszText = buffer;
break;
case 1:
@@ -358,7 +358,7 @@
default:
{
TCHAR buf2[200];
- LoadString(hInst, IDS_UNKNOWN_TYPE, buf2, sizeof(buf2)/sizeof(TCHAR));
+ LoadString(hInst, IDS_UNKNOWN_TYPE, buf2, COUNT_OF(buf2));
wsprintf(buffer, buf2, ((LINE_INFO*)plvdi->item.lParam)->dwValType);
plvdi->item.pszText = buffer;
break;
@@ -453,8 +453,8 @@
{
TCHAR msg[128], caption[128];
- LoadString(hInst, IDS_ERR_RENVAL_TOEMPTY, msg,
sizeof(msg)/sizeof(TCHAR));
- LoadString(hInst, IDS_ERR_RENVAL_CAPTION, caption,
sizeof(caption)/sizeof(TCHAR));
+ LoadString(hInst, IDS_ERR_RENVAL_TOEMPTY, msg, COUNT_OF(msg));
+ LoadString(hInst, IDS_ERR_RENVAL_CAPTION, caption,
COUNT_OF(caption));
MessageBox(0, msg, caption, 0);
*Result = TRUE;
}
Modified: trunk/reactos/base/applications/regedit/main.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/main.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/main.c [iso-8859-1] Thu Jul 12 19:10:48 2012
@@ -82,10 +82,11 @@
wcChild.cbWndExtra = sizeof(HANDLE);
wcChild.hInstance = hInstance;
wcChild.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_REGEDIT));
- wcChild.hCursor = LoadCursor(0, IDC_ARROW),
- wcChild.lpszClassName = szChildClass,
- wcChild.hIconSm = (HICON)LoadImage(hInstance,
MAKEINTRESOURCE(IDI_REGEDIT), IMAGE_ICON,
- GetSystemMetrics(SM_CXSMICON),
GetSystemMetrics(SM_CYSMICON), LR_SHARED);
+ wcChild.hCursor = LoadCursor(0, IDC_ARROW);
+ wcChild.lpszClassName = szChildClass;
+ wcChild.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_REGEDIT),
+ IMAGE_ICON, GetSystemMetrics(SM_CXSMICON),
+ GetSystemMetrics(SM_CYSMICON), LR_SHARED);
RegisterClassEx(&wcChild); /* register child windows class */
Modified: trunk/reactos/base/applications/regedit/regedit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/regedit.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/regedit.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -108,7 +108,7 @@
pos++;
}
}
- memcpy(file_name, *command_line, pos * sizeof((*command_line)[0]));
+ memcpy(file_name, *command_line, pos * sizeof(WCHAR));
/* remove the last backslash */
if (file_name[pos - 1] == L'\\')
{
@@ -163,8 +163,8 @@
}
import_registry_file(fp);
get_file_name(&s, filename);
- LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle));
- LoadString(hInst, IDS_IMPORTED_OK, szText, sizeof(szTitle));
+ LoadString(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
+ LoadString(hInst, IDS_IMPORTED_OK, szText, COUNT_OF(szText));
/* show successful import */
if (!silent)
MessageBox(NULL, szText, szTitle, MB_OK);
@@ -322,18 +322,17 @@
}
if (*s && action == ACTION_UNDEF)
- {
- TCHAR szTitle[256], szText[256];
- LoadString(hInst, IDS_APP_TITLE, szTitle, sizeof(szTitle));
- LoadString(hInst, IDS_IMPORT_PROMPT, szText, sizeof(szTitle));
- /* request import confirmation */
- if (silent || MessageBox(NULL, szText, szTitle, MB_YESNO) == IDYES)
- {
- action = ACTION_ADD;
- }
- else return TRUE;
- }
- if (action == ACTION_UNDEF)
+ {
+ TCHAR szTitle[256], szText[256];
+ LoadString(hInst, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle));
+ LoadString(hInst, IDS_IMPORT_PROMPT, szText, COUNT_OF(szText));
+ /* request import confirmation */
+ if (silent || MessageBox(NULL, szText, szTitle, MB_YESNO) == IDYES)
+ action = ACTION_ADD;
+ else
+ return TRUE;
+ }
+ if (action == ACTION_UNDEF)
return FALSE;
return PerformRegAction(action, s, silent);
Modified: trunk/reactos/base/applications/regedit/regproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/regproc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/regproc.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -36,7 +36,7 @@
"HKEY_CURRENT_CONFIG", "HKEY_CURRENT_USER",
"HKEY_DYN_DATA"
};
-#define REG_CLASS_NUMBER (sizeof(reg_class_names) / sizeof(reg_class_names[0]))
+#define REG_CLASS_NUMBER (COUNT_OF(reg_class_names))
const WCHAR* reg_class_namesW[REG_CLASS_NUMBER] =
{
Modified: trunk/reactos/base/applications/regedit/security.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/security.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/security.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -447,7 +447,7 @@
ULONG* piDefaultAccess)
{
*ppAccess = RegAccess;
- *pcAccesses = sizeof(RegAccess) / sizeof(RegAccess[0]);
+ *pcAccesses = COUNT_OF(RegAccess);
*piDefaultAccess = RegDefaultAccess;
return S_OK;
}
@@ -475,7 +475,7 @@
if (obj->ObjectInfo.dwFlags & SI_CONTAINER)
{
*ppInheritTypes = RegInheritTypes;
- *pcInheritTypes = sizeof(RegInheritTypes) / sizeof(RegInheritTypes[0]);
+ *pcInheritTypes = COUNT_OF(RegInheritTypes);
return S_OK;
}
Modified: trunk/reactos/base/applications/regedit/settings.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/settings.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/settings.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -128,7 +128,7 @@
if (keyPath)
{
rootName = get_root_key_name(hRootKey);
- _sntprintf(szBuffer, sizeof(szBuffer) / sizeof(szBuffer[0]), _T("My
Computer\\%s\\%s"), rootName, keyPath);
+ _sntprintf(szBuffer, COUNT_OF(szBuffer), _T("My
Computer\\%s\\%s"), rootName, keyPath);
RegSetValueEx(hKey, _T("LastKey"), 0, REG_SZ, (LPBYTE)
szBuffer, (DWORD) _tcslen(szBuffer) * sizeof(szBuffer[0]));
}
Modified: trunk/reactos/base/applications/regedit/treeview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/regedit/…
==============================================================================
--- trunk/reactos/base/applications/regedit/treeview.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/regedit/treeview.c [iso-8859-1] Thu Jul 12 19:10:48
2012
@@ -586,7 +586,7 @@
else if (RegOpenKey(hRootKey, pszKeyPath, &hKey) != ERROR_SUCCESS)
goto done;
- if (LoadString(hInst, IDS_NEW_KEY, szNewKeyFormat, sizeof(szNewKeyFormat) /
sizeof(szNewKeyFormat[0])) <= 0)
+ if (LoadString(hInst, IDS_NEW_KEY, szNewKeyFormat, COUNT_OF(szNewKeyFormat)) <=
0)
goto done;
/* Need to create a new key with a unique name */
@@ -704,7 +704,7 @@
tvi.hItem = hChildItem;
tvi.mask = TVIF_TEXT | TVIF_CHILDREN;
tvi.pszText = szBuffer;
- tvi.cchTextMax = sizeof(szBuffer) / sizeof(szBuffer[0]);
+ tvi.cchTextMax = COUNT_OF(szBuffer);
(void)TreeView_GetItem(hwndTV, &tvi);