Commit 077db39c authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

msacm32: Use the ARRAY_SIZE() macro.

parent f1a0cb0b
......@@ -361,8 +361,8 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
sizeof(paftd->szFilterTag)/sizeof(WCHAR) );
MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
ARRAY_SIZE(paftd->szFilterTag));
return mmr;
}
......
......@@ -503,9 +503,9 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2,
pafd->pwfx->wBitsPerSample);
}
MultiByteToWideChar( CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
pafd->szFormat + strlenW(pafd->szFormat),
sizeof(pafd->szFormat)/sizeof(WCHAR) - strlenW(pafd->szFormat) );
MultiByteToWideChar(CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
pafd->szFormat + strlenW(pafd->szFormat),
ARRAY_SIZE(pafd->szFormat) - strlenW(pafd->szFormat));
}
TRACE("=> %d\n", mmr);
......@@ -929,8 +929,8 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
ARRAY_SIZE(paftd->szFormatTag));
return mmr;
}
......@@ -1036,8 +1036,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
ARRAY_SIZE(paftd->szFormatTag));
/* (WS) I'm preserving this PCM hack since it seems to be
* correct. Please notice this block was borrowed from
* below.
......@@ -1062,8 +1062,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
ARRAY_SIZE(paftd->szFormatTag));
/* FIXME (EPP): I'm not sure this is the correct
* algorithm (should make more sense to apply the same
* for all already loaded formats, but this will do
......
......@@ -72,7 +72,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry)
/* The requested registry entry must have the format msacm.XXXXX in order to
be recognized in any future sessions of msacm
*/
if (0 == strncmpiW(pszRegEntry, msacmW, sizeof(msacmW)/sizeof(WCHAR))) {
if (0 == strncmpiW(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) {
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) {
WARN("unable to open registry key - 0x%08x\n", lRet);
......@@ -373,31 +373,31 @@ void MSACM_RegisterAllDrivers(void)
if (lRet == ERROR_SUCCESS) {
RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
for (i = 0; i < cnt; i++) {
bufLen = sizeof(buf) / sizeof(buf[0]);
bufLen = ARRAY_SIZE(buf);
lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue;
if (strncmpiW(buf, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
if (strncmpiW(buf, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(buf, '='))) continue;
*name = 0;
MSACM_RegisterDriver(buf, name + 1, 0);
}
i = 0;
cnt = sizeof(valname) / sizeof(*valname);
cnt = ARRAY_SIZE(valname);
bufLen = sizeof(buf);
while(RegEnumValueW(hKey, i, valname, &cnt, 0,
&type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){
if(!strncmpiW(valname, msacmW, sizeof(msacmW) / sizeof(*msacmW)))
if (!strncmpiW(valname, msacmW, ARRAY_SIZE(msacmW)))
MSACM_RegisterDriver(valname, buf, 0);
++i;
}
RegCloseKey( hKey );
}
if (GetPrivateProfileSectionW(drv32, buf, sizeof(buf)/sizeof(buf[0]), sys))
if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
{
for(s = buf; *s; s += strlenW(s) + 1)
{
if (strncmpiW(s, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
if (strncmpiW(s, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(s, '='))) continue;
*name = 0;
MSACM_RegisterDriver(s, name + 1, 0);
......
......@@ -984,14 +984,13 @@ static LRESULT PCM_DriverDetails(PACMDRIVERDETAILSW add)
add->cFormatTags = 1;
add->cFilterTags = 0;
add->hicon = NULL;
MultiByteToWideChar( CP_ACP, 0, "MS-PCM", -1,
add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Wine PCM converter", -1,
add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
MultiByteToWideChar(CP_ACP, 0, "MS-PCM", -1, add->szShortName, ARRAY_SIZE(add->szShortName));
MultiByteToWideChar(CP_ACP, 0, "Wine PCM converter", -1,
add->szLongName, ARRAY_SIZE(add->szLongName));
MultiByteToWideChar(CP_ACP, 0, "Brought to you by the Wine team...", -1,
add->szCopyright, ARRAY_SIZE(add->szCopyright));
MultiByteToWideChar(CP_ACP, 0, "Refer to LICENSE file", -1,
add->szLicensing, ARRAY_SIZE(add->szLicensing) );
add->szFeatures[0] = 0;
return MMSYSERR_NOERROR;
......
......@@ -1106,7 +1106,7 @@ static void test_convert(void)
MMRESULT mmr;
unsigned i;
for (i = 0; i < sizeof(expected_output)/sizeof(struct stream_output); i++)
for (i = 0; i < ARRAY_SIZE(expected_output); i++)
{
mmr = acmStreamOpen(&has, NULL, (WAVEFORMATEX *)&expected_output[i].src, (WAVEFORMATEX *)&expected_output[i].dst, NULL, 0, 0, 0);
ok(mmr == MMSYSERR_NOERROR, "#%d: open failed: 0x%x\n", i, mmr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment