Author: tfaber
Date: Sat May 6 08:22:50 2017
New Revision: 74482
URL:
http://svn.reactos.org/svn/reactos?rev=74482&view=rev
Log:
[MMSYS]
Patch by Katayama Hirofumi MZ:
- Use _countof where appropriate
- Prefer sizeof(variable) to sizeof(TYPE)
CORE-12903
Modified:
trunk/reactos/dll/cpl/mmsys/audio.c
trunk/reactos/dll/cpl/mmsys/mmsys.c
trunk/reactos/dll/cpl/mmsys/sounds.c
Modified: trunk/reactos/dll/cpl/mmsys/audio.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/mmsys/audio.c?rev=…
==============================================================================
--- trunk/reactos/dll/cpl/mmsys/audio.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/mmsys/audio.c [iso-8859-1] Sat May 6 08:22:50 2017
@@ -22,7 +22,7 @@
HWND hCB;
LRESULT Res;
- LoadString(hApplet, IDS_NO_DEVICES, szNoDevices, sizeof(szNoDevices) /
sizeof(TCHAR));
+ LoadString(hApplet, IDS_NO_DEVICES, szNoDevices, _countof(szNoDevices));
// Init sound playback devices list
hCB = GetDlgItem(hwnd, IDC_DEVICE_PLAY_LIST);
Modified: trunk/reactos/dll/cpl/mmsys/mmsys.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/mmsys/mmsys.c?rev=…
==============================================================================
--- trunk/reactos/dll/cpl/mmsys/mmsys.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/mmsys/mmsys.c [iso-8859-1] Sat May 6 08:22:50 2017
@@ -703,10 +703,7 @@
UNREFERENCED_PARAMETER(wParam);
UNREFERENCED_PARAMETER(uMsg);
- LoadString(hApplet,
- IDS_CPLNAME,
- Caption,
- sizeof(Caption) / sizeof(TCHAR));
+ LoadString(hApplet, IDS_CPLNAME, Caption, _countof(Caption));
psh.dwSize = sizeof(PROPSHEETHEADER);
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_PROPTITLE;
Modified: trunk/reactos/dll/cpl/mmsys/sounds.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/mmsys/sounds.c?rev…
==============================================================================
--- trunk/reactos/dll/cpl/mmsys/sounds.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/mmsys/sounds.c [iso-8859-1] Sat May 6 08:22:50 2017
@@ -262,7 +262,7 @@
dwCount = 0;
do
{
- dwName = sizeof(szName) / sizeof(szName[0]);
+ dwName = _countof(szName);
dwResult = RegEnumKeyEx(hSubKey,
dwCurKey,
szName,
@@ -379,7 +379,7 @@
dwCurKey = 0;
do
{
- dwName = sizeof(szName) / sizeof(szName[0]);
+ dwName = _countof(szName);
dwResult = RegEnumKeyEx(hSubKey,
dwCurKey,
szName,
@@ -482,8 +482,8 @@
}
pLabelContext = FindLabelContext(pScheme, AppMap->szName, LabelMap->szName);
- dwValue = ExpandEnvironmentStrings(szValue, szBuffer, sizeof(szBuffer) /
sizeof(TCHAR));
- if (dwValue == 0 || dwValue > (sizeof(szBuffer) / sizeof(TCHAR)))
+ dwValue = ExpandEnvironmentStrings(szValue, szBuffer, _countof(szBuffer));
+ if (dwValue == 0 || dwValue > _countof(szBuffer))
{
/* fixme */
return FALSE;
@@ -530,7 +530,7 @@
dwCurKey = 0;
do
{
- dwProfile = sizeof(szProfile) / sizeof(TCHAR);
+ dwProfile = _countof(szProfile);
dwResult = RegEnumKeyEx(hSubKey,
dwCurKey,
szProfile,
@@ -624,7 +624,7 @@
dwNumEntry = 0;
do
{
- dwName = sizeof(szName) / sizeof(TCHAR);
+ dwName = _countof(szName);
dwResult = RegEnumKeyEx(hSubKey,
dwCurKey,
szName,
@@ -673,7 +673,7 @@
dwResult = RegEnumKey(hSubKey,
dwCurKey,
szName,
- sizeof(szName) / sizeof(TCHAR));
+ _countof(szName));
if (dwResult == ERROR_SUCCESS)
{
@@ -731,9 +731,9 @@
UINT length;
/* Add no sound listview item */
- if (LoadString(hApplet, IDS_NO_SOUND, szPath, MAX_PATH))
- {
- szPath[(sizeof(szPath)/sizeof(WCHAR))-1] = L'\0';
+ if (LoadString(hApplet, IDS_NO_SOUND, szPath, _countof(szPath)))
+ {
+ szPath[_countof(szPath)-1] = L'\0';
SendDlgItemMessageW(hwndDlg, IDC_SOUND_LIST, CB_ADDSTRING, (WPARAM)0,
(LPARAM)szPath);
}
@@ -815,7 +815,7 @@
/* add column for app */
GetClientRect(hList, &rect);
- ZeroMemory(&dummy, sizeof(LV_COLUMN));
+ ZeroMemory(&dummy, sizeof(dummy));
dummy.mask = LVCF_WIDTH;
dummy.iSubItem = 0;
dummy.cx = rect.right - rect.left - GetSystemMetrics(SM_CXVSCROLL);
@@ -828,7 +828,7 @@
PLABEL_MAP pLabelMap = pAppMap->LabelMap;
while (pLabelMap)
{
- ZeroMemory(&listItem, sizeof(LV_ITEM));
+ ZeroMemory(&listItem, sizeof(listItem));
listItem.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
listItem.pszText = pLabelMap->szDesc;
listItem.lParam = (LPARAM)FindLabelContext(pScheme, pAppMap->szName,
pLabelMap->szName);
@@ -959,8 +959,8 @@
{
case IDC_BROWSE_SOUND:
{
- ZeroMemory(&ofn, sizeof(OPENFILENAMEW));
- ofn.lStructSize = sizeof(OPENFILENAMEW);
+ ZeroMemory(&ofn, sizeof(ofn));
+ ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFile = filename;
ofn.lpstrFile[0] = L'\0';
@@ -974,7 +974,7 @@
if (GetOpenFileNameW(&ofn) == TRUE)
{
- // FIXME search if list already contains that sound
+ // FIXME search if list already contains that sound
// extract file name
pFileName = wcsrchr(filename, L'\\');
@@ -1040,7 +1040,7 @@
{
break;
}
- ZeroMemory(&item, sizeof(LVITEM));
+ ZeroMemory(&item, sizeof(item));
item.mask = LVIF_PARAM;
item.iItem = SelCount;
if (ListView_GetItem(GetDlgItem(hwndDlg, IDC_SCHEME_LIST),
&item))
@@ -1104,7 +1104,7 @@
{
return FALSE;
}
- ZeroMemory(&item, sizeof(LVITEM));
+ ZeroMemory(&item, sizeof(item));
item.mask = LVIF_PARAM;
item.iItem = nm->iItem;