Author: hbelusca
Date: Thu Oct 6 12:22:32 2016
New Revision: 72918
URL:
http://svn.reactos.org/svn/reactos?rev=72918&view=rev
Log:
[RAPPS][RAPPS_NEW]: Try to not hardcode types of variables in sizeofs, and use _countof
where possible.
Modified:
trunk/reactos/base/applications/rapps/installed.c
trunk/reactos/base/applications/rapps/listview.c
trunk/reactos/base/applications/rapps/loaddlg.c
trunk/reactos/base/applications/rapps/misc.c
trunk/reactos/base/applications/rapps/richedit.c
trunk/reactos/base/applications/rapps/settingsdlg.c
trunk/reactos/base/applications/rapps/splitter.c
trunk/reactos/base/applications/rapps/toolbar.c
trunk/reactos/base/applications/rapps/treeview.c
trunk/reactos/base/applications/rapps/winmain.c
trunk/reactos/base/applications/rapps_new/crichedit.h
trunk/reactos/base/applications/rapps_new/gui.cpp
trunk/reactos/base/applications/rapps_new/installed.cpp
trunk/reactos/base/applications/rapps_new/loaddlg.cpp
trunk/reactos/base/applications/rapps_new/misc.cpp
trunk/reactos/base/applications/rapps_new/settingsdlg.cpp
trunk/reactos/base/applications/rapps_new/splitter.cpp
trunk/reactos/base/applications/rapps_new/winmain.cpp
Modified: trunk/reactos/base/applications/rapps/installed.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/in…
==============================================================================
--- trunk/reactos/base/applications/rapps/installed.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/installed.c [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -104,10 +104,10 @@
ItemIndex = Index;
}
- ListView_GetItemText(hListView, ItemIndex, 0, szAppName, sizeof(szAppName) /
sizeof(WCHAR));
+ ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName));
WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
- ZeroMemory(&Item, sizeof(LVITEM));
+ ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@@ -149,7 +149,7 @@
#define GET_INFO(a, b, c, d) \
if (GetApplicationString(Info->hSubKey, a, szInfo)) \
{ \
- LoadStringW(hInst, b, szText, sizeof(szText) / sizeof(WCHAR)); \
+ LoadStringW(hInst, b, szText, _countof(szText)); \
InsertRichEditText(szText, c); \
InsertRichEditText(szInfo, d); \
} \
@@ -190,8 +190,8 @@
Info = ListViewGetlParam(Index);
if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
- if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)) ||
- !LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, sizeof(szMsgTitle) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, _countof(szMsgText)) ||
+ !LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, _countof(szMsgTitle)))
return;
if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) ==
IDYES)
@@ -204,7 +204,7 @@
return;
}
- if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, _countof(szMsgText)))
return;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
Modified: trunk/reactos/base/applications/rapps/listview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/li…
==============================================================================
--- trunk/reactos/base/applications/rapps/listview.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/listview.c [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -28,7 +28,7 @@
ItemIndex = Index;
}
- ZeroMemory(&Item, sizeof(LVITEM));
+ ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@@ -43,7 +43,7 @@
{
LV_COLUMN Column;
- ZeroMemory(&Column, sizeof(LV_COLUMN));
+ ZeroMemory(&Column, sizeof(Column));
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
Column.iSubItem = Index;
@@ -59,7 +59,7 @@
{
LV_ITEMW Item;
- ZeroMemory(&Item, sizeof(LV_ITEM));
+ ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
Item.pszText = lpText;
@@ -82,11 +82,11 @@
IndexInfo.lParam = lParam1;
Index = ListView_FindItem(hListView, -1, &IndexInfo);
- ListView_GetItemText(hListView, Index, (INT)lParamSort, Item1, sizeof(Item1) /
sizeof(WCHAR));
+ ListView_GetItemText(hListView, Index, (INT)lParamSort, Item1, _countof(Item1));
IndexInfo.lParam = lParam2;
Index = ListView_FindItem(hListView, -1, &IndexInfo);
- ListView_GetItemText(hListView, Index, (INT)lParamSort, Item2, sizeof(Item2) /
sizeof(WCHAR));
+ ListView_GetItemText(hListView, Index, (INT)lParamSort, Item2, _countof(Item2));
if (bAscending)
return wcscmp(Item2, Item1);
Modified: trunk/reactos/base/applications/rapps/loaddlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/lo…
==============================================================================
--- trunk/reactos/base/applications/rapps/loaddlg.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/loaddlg.c [iso-8859-1] Thu Oct 6 12:22:32 2016
@@ -257,7 +257,7 @@
Ret = HttpSendRequestW(hRequest, L"", 0, NULL, 0);
if (Ret)
{
- certInfoLength = sizeof(INTERNET_CERTIFICATE_INFOW);
+ certInfoLength = sizeof(certInfo);
Ret = InternetQueryOptionW(hRequest,
INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
&certInfo,
@@ -402,7 +402,7 @@
{
WCHAR szMsgText[MAX_STR_LEN];
- if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
@@ -440,7 +440,7 @@
{
WCHAR szMsgText[MAX_STR_LEN];
- if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText,
_countof(szMsgText)))
goto end;
MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
@@ -705,7 +705,7 @@
{
APPLICATION_INFO IntInfo;
- ZeroMemory(&IntInfo, sizeof(APPLICATION_INFO));
+ ZeroMemory(&IntInfo, sizeof(IntInfo));
if (FAILED(StringCbCopyW(IntInfo.szUrlDownload,
sizeof(IntInfo.szUrlDownload),
lpUrl)))
Modified: trunk/reactos/base/applications/rapps/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/mi…
==============================================================================
--- trunk/reactos/base/applications/rapps/misc.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/misc.c [iso-8859-1] Thu Oct 6 12:22:32 2016
@@ -55,7 +55,7 @@
DEVMODE pDevMode;
INT ColorDepth;
- pDevMode.dmSize = sizeof(DEVMODE);
+ pDevMode.dmSize = sizeof(pDevMode);
pDevMode.dmDriverExtra = 0;
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
@@ -143,13 +143,13 @@
{
WCHAR szText[MAX_STR_LEN*3];
- LoadStringW(hInst, IDS_WELCOME_TITLE, szText, sizeof(szText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WELCOME_TITLE, szText, _countof(szText));
NewRichEditText(szText, CFE_BOLD);
- LoadStringW(hInst, IDS_WELCOME_TEXT, szText, sizeof(szText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WELCOME_TEXT, szText, _countof(szText));
InsertRichEditText(szText, 0);
- LoadStringW(hInst, IDS_WELCOME_URL, szText, sizeof(szText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WELCOME_URL, szText, _countof(szText));
InsertRichEditText(szText, CFM_LINK);
}
@@ -272,7 +272,7 @@
pfnExtract = (void *) GetProcAddress(hCabinetDll, "Extract");
if (pfnExtract)
{
- ZeroMemory(&Dest, sizeof(SESSION));
+ ZeroMemory(&Dest, sizeof(Dest));
WideCharToMultiByte(CP_ACP, 0, lpOutputPath, -1, Dest.Destination, MAX_PATH,
NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, lpCabName, -1, szCabName, MAX_PATH, NULL,
NULL);
@@ -315,7 +315,7 @@
return;
}
- if (!GetModuleFileName(NULL, szPath, sizeof(szPath) / sizeof(szPath[0])))
+ if (!GetModuleFileNameW(NULL, szPath, _countof(szPath)))
return;
if (RegSetValueExW(hKey,
Modified: trunk/reactos/base/applications/rapps/richedit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/ri…
==============================================================================
--- trunk/reactos/base/applications/rapps/richedit.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/richedit.c [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -49,9 +49,9 @@
SendMessageW(hRichEdit, EM_SETSEL, Start, End);
- ZeroMemory(&CharFormat, sizeof(CHARFORMAT2));
+ ZeroMemory(&CharFormat, sizeof(CharFormat));
- CharFormat.cbSize = sizeof(CHARFORMAT2);
+ CharFormat.cbSize = sizeof(CharFormat);
CharFormat.dwMask = dwEffects;
CharFormat.dwEffects = dwEffects;
Modified: trunk/reactos/base/applications/rapps/settingsdlg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/se…
==============================================================================
--- trunk/reactos/base/applications/rapps/settingsdlg.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/settingsdlg.c [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -20,7 +20,7 @@
BROWSEINFO bi;
WCHAR szPath[MAX_PATH], szBuf[MAX_STR_LEN];
- LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
+ LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, _countof(szBuf));
ZeroMemory(&bi, sizeof(bi));
bi.hwndOwner = hwnd;
@@ -162,7 +162,7 @@
LoadStringW(hInst,
IDS_CHOOSE_FOLDER_ERROR,
- szMsgText, sizeof(szMsgText) / sizeof(WCHAR));
+ szMsgText, _countof(szMsgText));
if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
{
Modified: trunk/reactos/base/applications/rapps/splitter.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/sp…
==============================================================================
--- trunk/reactos/base/applications/rapps/splitter.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/splitter.c [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -123,7 +123,7 @@
WCHAR szWindowClass[] = L"HSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
- WndClass.cbSize = sizeof(WNDCLASSEXW);
+ WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = HSplitterWindowProc;
WndClass.hInstance = hInst;
@@ -264,7 +264,7 @@
WCHAR szWindowClass[] = L"VSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
- WndClass.cbSize = sizeof(WNDCLASSEXW);
+ WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = VSplitterWindowProc;
WndClass.hInstance = hInst;
Modified: trunk/reactos/base/applications/rapps/toolbar.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/to…
==============================================================================
--- trunk/reactos/base/applications/rapps/toolbar.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/toolbar.c [iso-8859-1] Thu Oct 6 12:22:32 2016
@@ -137,7 +137,7 @@
SendMessageW(hSearchBar, WM_SETFONT, (WPARAM)GetStockObject(DEFAULT_GUI_FONT), 0);
- LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, sizeof(szBuf) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
SetWindowTextW(hSearchBar, szBuf);
SetParent(hSearchBar, hToolBar);
@@ -148,12 +148,12 @@
BOOL
CreateToolBar(HWND hwnd)
{
- INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
+ INT NumButtons = _countof(Buttons);
HIMAGELIST hImageList;
- LoadStringW(hInst, IDS_INSTALL, szInstallBtn, sizeof(szInstallBtn) / sizeof(WCHAR));
- LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, sizeof(szUninstallBtn) /
sizeof(WCHAR));
- LoadStringW(hInst, IDS_MODIFY, szModifyBtn, sizeof(szModifyBtn) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_INSTALL, szInstallBtn, _countof(szInstallBtn));
+ LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, _countof(szUninstallBtn));
+ LoadStringW(hInst, IDS_MODIFY, szModifyBtn, _countof(szModifyBtn));
hToolBar = CreateWindowExW(0,
TOOLBARCLASSNAMEW,
Modified: trunk/reactos/base/applications/rapps/treeview.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/tr…
==============================================================================
--- trunk/reactos/base/applications/rapps/treeview.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/treeview.c [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -15,7 +15,7 @@
{
TV_INSERTSTRUCTW Insert;
- ZeroMemory(&Insert, sizeof(TV_INSERTSTRUCT));
+ ZeroMemory(&Insert, sizeof(Insert));
Insert.item.mask = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
Insert.hInsertAfter = TVI_LAST;
Modified: trunk/reactos/base/applications/rapps/winmain.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/wi…
==============================================================================
--- trunk/reactos/base/applications/rapps/winmain.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps/winmain.c [iso-8859-1] Thu Oct 6 12:22:32 2016
@@ -61,7 +61,7 @@
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0,
KEY_READ, &hKey) == ERROR_SUCCESS)
{
- dwSize = sizeof(SETTINGS_INFO);
+ dwSize = sizeof(SettingsInfo);
if (RegQueryValueExW(hKey, L"Settings", NULL, NULL,
(LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@@ -82,7 +82,7 @@
if (SettingsInfo.bSaveWndPos)
{
- wp.length = sizeof(WINDOWPLACEMENT);
+ wp.length = sizeof(wp);
GetWindowPlacement(hwnd, &wp);
SettingsInfo.Left = wp.rcNormalPosition.left;
@@ -95,7 +95,7 @@
if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0,
NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
{
- RegSetValueExW(hKey, L"Settings", 0, REG_BINARY,
(LPBYTE)&SettingsInfo, sizeof(SETTINGS_INFO));
+ RegSetValueExW(hKey, L"Settings", 0, REG_BINARY,
(LPBYTE)&SettingsInfo, sizeof(SettingsInfo));
RegCloseKey(hKey);
}
}
@@ -943,7 +943,7 @@
InitCommonControls();
/* Create the window */
- WndClass.cbSize = sizeof(WNDCLASSEXW);
+ WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = MainWindowProc;
WndClass.hInstance = hInstance;
Modified: trunk/reactos/base/applications/rapps_new/crichedit.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/crichedit.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/crichedit.h [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -10,9 +10,9 @@
SendMessageW(EM_SETSEL, Start, End);
- ZeroMemory(&CharFormat, sizeof(CHARFORMAT2));
+ ZeroMemory(&CharFormat, sizeof(CharFormat));
- CharFormat.cbSize = sizeof(CHARFORMAT2);
+ CharFormat.cbSize = sizeof(CharFormat);
CharFormat.dwMask = dwEffects;
CharFormat.dwEffects = dwEffects;
Modified: trunk/reactos/base/applications/rapps_new/gui.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/gui.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/gui.cpp [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -129,12 +129,12 @@
{ 6, ID_EXIT, TBSTATE_ENABLED, BTNS_BUTTON | BTNS_AUTOSIZE, { 0 }, 0, 0 }
};
- INT NumButtons = sizeof(Buttons) / sizeof(Buttons[0]);
+ INT NumButtons = _countof(Buttons);
HIMAGELIST hImageList;
- LoadStringW(hInst, IDS_INSTALL, szInstallBtn, sizeof(szInstallBtn) /
sizeof(WCHAR));
- LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, sizeof(szUninstallBtn) /
sizeof(WCHAR));
- LoadStringW(hInst, IDS_MODIFY, szModifyBtn, sizeof(szModifyBtn) /
sizeof(WCHAR));
+ LoadStringW(hInst, IDS_INSTALL, szInstallBtn, _countof(szInstallBtn));
+ LoadStringW(hInst, IDS_UNINSTALL, szUninstallBtn, _countof(szUninstallBtn));
+ LoadStringW(hInst, IDS_MODIFY, szModifyBtn, _countof(szModifyBtn));
m_hWnd = CreateWindowExW(0,
TOOLBARCLASSNAMEW,
@@ -213,7 +213,7 @@
ItemIndex = Index;
}
- ZeroMemory(&Item, sizeof(LVITEM));
+ ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@@ -227,7 +227,7 @@
{
LV_COLUMN Column;
- ZeroMemory(&Column, sizeof(LV_COLUMN));
+ ZeroMemory(&Column, sizeof(Column));
Column.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM;
Column.iSubItem = Index;
@@ -242,7 +242,7 @@
{
LV_ITEMW Item;
- ZeroMemory(&Item, sizeof(LV_ITEM));
+ ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_TEXT | LVIF_PARAM | LVIF_STATE | LVIF_IMAGE;
Item.pszText = lpText;
@@ -269,11 +269,11 @@
IndexInfo.lParam = lParam1;
Index = FindItem(-1, &IndexInfo);
- GetItemText(Index, iSubItem, Item1, sizeof(Item1) / sizeof(WCHAR));
+ GetItemText(Index, iSubItem, Item1, _countof(Item1));
IndexInfo.lParam = lParam2;
Index = FindItem(-1, &IndexInfo);
- GetItemText(Index, iSubItem, Item2, sizeof(Item2) / sizeof(WCHAR));
+ GetItemText(Index, iSubItem, Item2, _countof(Item2));
if (bAscending)
return wcscmp(Item2, Item1);
@@ -510,7 +510,7 @@
m_SearchBar->SendMessageW(WM_SETFONT, (WPARAM)
GetStockObject(DEFAULT_GUI_FONT), 0);
- LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, sizeof(szBuf) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_SEARCH_TEXT, szBuf, _countof(szBuf));
m_SearchBar->SetWindowTextW(szBuf);
return hwnd != NULL;
Modified: trunk/reactos/base/applications/rapps_new/installed.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/installed.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/installed.cpp [iso-8859-1] Thu Oct 6
12:22:32 2016
@@ -104,10 +104,10 @@
ItemIndex = Index;
}
- ListView_GetItemText(hListView, ItemIndex, 0, szAppName, sizeof(szAppName) /
sizeof(WCHAR));
+ ListView_GetItemText(hListView, ItemIndex, 0, szAppName, _countof(szAppName));
WriteLogMessage(EVENTLOG_SUCCESS, MSG_SUCCESS_REMOVE, szAppName);
- ZeroMemory(&Item, sizeof(LVITEM));
+ ZeroMemory(&Item, sizeof(Item));
Item.mask = LVIF_PARAM;
Item.iItem = ItemIndex;
@@ -149,7 +149,7 @@
#define GET_INFO(a, b, c, d) \
if (GetApplicationString(Info->hSubKey, a, szInfo)) \
{ \
- LoadStringW(hInst, b, szText, sizeof(szText) / sizeof(WCHAR)); \
+ LoadStringW(hInst, b, szText, _countof(szText)); \
InsertRichEditText(szText, c); \
InsertRichEditText(szInfo, d); \
} \
@@ -190,8 +190,8 @@
Info = (PINSTALLED_INFO) ListViewGetlParam(Index);
if (!Info || !Info->hSubKey || (ItemIndex == -1)) return;
- if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)) ||
- !LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, sizeof(szMsgTitle) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_APP_REG_REMOVE, szMsgText, _countof(szMsgText)) ||
+ !LoadStringW(hInst, IDS_INFORMATION, szMsgTitle, _countof(szMsgTitle)))
return;
if (MessageBoxW(hMainWnd, szMsgText, szMsgTitle, MB_YESNO | MB_ICONQUESTION) ==
IDYES)
@@ -204,7 +204,7 @@
return;
}
- if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_UNABLE_TO_REMOVE, szMsgText, _countof(szMsgText)))
return;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
Modified: trunk/reactos/base/applications/rapps_new/loaddlg.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/loaddlg.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/loaddlg.cpp [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -212,7 +212,7 @@
Ret = HttpSendRequestW(hRequest, L"", 0, NULL, 0);
if (Ret)
{
- certInfoLength = sizeof(INTERNET_CERTIFICATE_INFOW);
+ certInfoLength = sizeof(certInfo);
Ret = InternetQueryOptionW(hRequest,
INTERNET_OPTION_SECURITY_CERTIFICATE_STRUCT,
&certInfo,
@@ -351,7 +351,7 @@
{
WCHAR szMsgText[MAX_STR_LEN];
- if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD2, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD2, szMsgText,
_countof(szMsgText)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
@@ -365,7 +365,7 @@
{
WCHAR szMsgText[MAX_STR_LEN];
- if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_UNABLE_TO_DOWNLOAD, szMsgText, _countof(szMsgText)))
goto end;
MessageBoxW(hMainWnd, szMsgText, NULL, MB_OK | MB_ICONERROR);
@@ -403,7 +403,7 @@
{
WCHAR szMsgText[MAX_STR_LEN];
- if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText, sizeof(szMsgText) /
sizeof(WCHAR)))
+ if (!LoadStringW(hInst, IDS_CERT_DOES_NOT_MATCH, szMsgText,
_countof(szMsgText)))
goto end;
MessageBoxW(Dlg, szMsgText, NULL, MB_OK | MB_ICONERROR);
@@ -664,7 +664,7 @@
{
APPLICATION_INFO IntInfo;
- ZeroMemory(&IntInfo, sizeof(APPLICATION_INFO));
+ ZeroMemory(&IntInfo, sizeof(IntInfo));
if (FAILED(StringCbCopyW(IntInfo.szUrlDownload,
sizeof(IntInfo.szUrlDownload),
lpUrl)))
Modified: trunk/reactos/base/applications/rapps_new/misc.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/misc.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/misc.cpp [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -55,7 +55,7 @@
DEVMODE pDevMode;
INT ColorDepth;
- pDevMode.dmSize = sizeof(DEVMODE);
+ pDevMode.dmSize = sizeof(pDevMode);
pDevMode.dmDriverExtra = 0;
if (!EnumDisplaySettings(NULL, ENUM_CURRENT_SETTINGS, &pDevMode))
@@ -143,13 +143,13 @@
{
WCHAR szText[MAX_STR_LEN*3];
- LoadStringW(hInst, IDS_WELCOME_TITLE, szText, sizeof(szText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WELCOME_TITLE, szText, _countof(szText));
NewRichEditText(szText, CFE_BOLD);
- LoadStringW(hInst, IDS_WELCOME_TEXT, szText, sizeof(szText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WELCOME_TEXT, szText, _countof(szText));
InsertRichEditText(szText, 0);
- LoadStringW(hInst, IDS_WELCOME_URL, szText, sizeof(szText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WELCOME_URL, szText, _countof(szText));
InsertRichEditText(szText, CFM_LINK);
}
@@ -272,7 +272,7 @@
pfnExtract = (fnExtract) GetProcAddress(hCabinetDll, "Extract");
if (pfnExtract)
{
- ZeroMemory(&Dest, sizeof(SESSION));
+ ZeroMemory(&Dest, sizeof(Dest));
WideCharToMultiByte(CP_ACP, 0, lpOutputPath, -1, Dest.Destination, MAX_PATH,
NULL, NULL);
WideCharToMultiByte(CP_ACP, 0, lpCabName, -1, szCabName, MAX_PATH, NULL,
NULL);
@@ -315,7 +315,7 @@
return;
}
- if (!GetModuleFileName(NULL, szPath, sizeof(szPath) / sizeof(szPath[0])))
+ if (!GetModuleFileNameW(NULL, szPath, _countof(szPath)))
return;
if (RegSetValueExW(hKey,
Modified: trunk/reactos/base/applications/rapps_new/settingsdlg.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/settingsdlg.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/settingsdlg.cpp [iso-8859-1] Thu Oct 6
12:22:32 2016
@@ -20,7 +20,7 @@
BROWSEINFO bi;
WCHAR szPath[MAX_PATH], szBuf[MAX_STR_LEN];
- LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, sizeof(szBuf) / sizeof(TCHAR));
+ LoadStringW(hInst, IDS_CHOOSE_FOLDER_TEXT, szBuf, _countof(szBuf));
ZeroMemory(&bi, sizeof(bi));
bi.hwndOwner = hwnd;
@@ -162,7 +162,7 @@
LoadStringW(hInst,
IDS_CHOOSE_FOLDER_ERROR,
- szMsgText, sizeof(szMsgText) / sizeof(WCHAR));
+ szMsgText, _countof(szMsgText));
if (MessageBoxW(hDlg, szMsgText, NULL, MB_YESNO) == IDYES)
{
Modified: trunk/reactos/base/applications/rapps_new/splitter.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/splitter.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/splitter.cpp [iso-8859-1] Thu Oct 6
12:22:32 2016
@@ -123,7 +123,7 @@
WCHAR szWindowClass[] = L"HSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
- WndClass.cbSize = sizeof(WNDCLASSEXW);
+ WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = HSplitterWindowProc;
WndClass.hInstance = hInst;
@@ -264,7 +264,7 @@
WCHAR szWindowClass[] = L"VSplitterWindowClass";
WNDCLASSEXW WndClass = {0};
- WndClass.cbSize = sizeof(WNDCLASSEXW);
+ WndClass.cbSize = sizeof(WndClass);
WndClass.lpszClassName = szWindowClass;
WndClass.lpfnWndProc = VSplitterWindowProc;
WndClass.hInstance = hInst;
Modified: trunk/reactos/base/applications/rapps_new/winmain.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps_ne…
==============================================================================
--- trunk/reactos/base/applications/rapps_new/winmain.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/applications/rapps_new/winmain.cpp [iso-8859-1] Thu Oct 6 12:22:32
2016
@@ -78,7 +78,7 @@
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0,
KEY_READ, &hKey) == ERROR_SUCCESS)
{
- dwSize = sizeof(SETTINGS_INFO);
+ dwSize = sizeof(SettingsInfo);
if (RegQueryValueExW(hKey, L"Settings", NULL, NULL,
(LPBYTE)&SettingsInfo, &dwSize) == ERROR_SUCCESS)
{
RegCloseKey(hKey);
@@ -99,7 +99,7 @@
if (SettingsInfo.bSaveWndPos)
{
- wp.length = sizeof(WINDOWPLACEMENT);
+ wp.length = sizeof(wp);
GetWindowPlacement(hwnd, &wp);
SettingsInfo.Left = wp.rcNormalPosition.left;
@@ -112,7 +112,7 @@
if (RegCreateKeyExW(HKEY_CURRENT_USER, L"Software\\ReactOS\\rapps", 0,
NULL,
REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) == ERROR_SUCCESS)
{
- RegSetValueExW(hKey, L"Settings", 0, REG_BINARY,
(LPBYTE)&SettingsInfo, sizeof(SETTINGS_INFO));
+ RegSetValueExW(hKey, L"Settings", 0, REG_BINARY,
(LPBYTE)&SettingsInfo, sizeof(SettingsInfo));
RegCloseKey(hKey);
}
}