https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3ea85289098802d3484fd…
commit 3ea85289098802d3484fdc5b113d98a014bae959
Author: Amine Khaldi <amine.khaldi(a)reactos.org>
AuthorDate: Sat Jan 26 13:18:13 2019 +0100
Commit: Amine Khaldi <amine.khaldi(a)reactos.org>
CommitDate: Sat Jan 26 13:18:13 2019 +0100
[MSACM32] Sync with Wine Staging 4.0. CORE-15682
---
dll/win32/msacm32/CMakeLists.txt | 1 +
dll/win32/msacm32/filter.c | 4 ++--
dll/win32/msacm32/format.c | 18 +++++++++---------
dll/win32/msacm32/internal.c | 14 +++++++-------
dll/win32/msacm32/pcmconverter.c | 22 ++++++++++------------
media/doc/README.WINE | 2 +-
6 files changed, 30 insertions(+), 31 deletions(-)
diff --git a/dll/win32/msacm32/CMakeLists.txt b/dll/win32/msacm32/CMakeLists.txt
index 88a5830b0b..b1be7b9b48 100644
--- a/dll/win32/msacm32/CMakeLists.txt
+++ b/dll/win32/msacm32/CMakeLists.txt
@@ -1,4 +1,5 @@
+add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/sdk/include/reactos/wine)
spec2def(msacm32.dll msacm32.spec ADD_IMPORTLIB)
diff --git a/dll/win32/msacm32/filter.c b/dll/win32/msacm32/filter.c
index 53db82777d..8d5abced9d 100644
--- a/dll/win32/msacm32/filter.c
+++ b/dll/win32/msacm32/filter.c
@@ -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;
}
diff --git a/dll/win32/msacm32/format.c b/dll/win32/msacm32/format.c
index b3d2900393..fcc0d9b1c6 100644
--- a/dll/win32/msacm32/format.c
+++ b/dll/win32/msacm32/format.c
@@ -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
diff --git a/dll/win32/msacm32/internal.c b/dll/win32/msacm32/internal.c
index 7bafcaad5e..aad071e8ad 100644
--- a/dll/win32/msacm32/internal.c
+++ b/dll/win32/msacm32/internal.c
@@ -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);
diff --git a/dll/win32/msacm32/pcmconverter.c b/dll/win32/msacm32/pcmconverter.c
index d52662ac76..dc10f11e7a 100644
--- a/dll/win32/msacm32/pcmconverter.c
+++ b/dll/win32/msacm32/pcmconverter.c
@@ -71,7 +71,6 @@ static DWORD PCM_drvClose(DWORD dwDevID)
return 1;
}
-#define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0]))
#define NUM_OF(a,b) ((a)/(b))
/* flags for fdwDriver */
@@ -114,7 +113,7 @@ static DWORD PCM_GetFormatIndex(LPWAVEFORMATEX wfx)
unsigned int i;
TRACE("(%p)\n", wfx);
- for (i = 0; i < NUM_PCM_FORMATS; i++) {
+ for (i = 0; i < ARRAY_SIZE(PCM_Formats); i++) {
if (wfx->nChannels == PCM_Formats[i].nChannels &&
wfx->nSamplesPerSec == PCM_Formats[i].rate &&
wfx->wBitsPerSample == PCM_Formats[i].nBits)
@@ -985,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;
@@ -1035,7 +1033,7 @@ static LRESULT PCM_FormatTagDetails(PACMFORMATTAGDETAILSW aftd,
DWORD dwQuery)
aftd->dwFormatTag = WAVE_FORMAT_PCM;
aftd->cbFormatSize = sizeof(PCMWAVEFORMAT);
aftd->fdwSupport = ACMDRIVERDETAILS_SUPPORTF_CONVERTER;
- aftd->cStandardFormats = NUM_PCM_FORMATS;
+ aftd->cStandardFormats = ARRAY_SIZE(PCM_Formats);
aftd->szFormatTag[0] = 0;
return MMSYSERR_NOERROR;
@@ -1057,7 +1055,7 @@ static LRESULT PCM_FormatDetails(PACMFORMATDETAILSW afd, DWORD
dwQuery)
}
break;
case ACM_FORMATDETAILSF_INDEX:
- assert(afd->dwFormatIndex < NUM_PCM_FORMATS);
+ assert(afd->dwFormatIndex < ARRAY_SIZE(PCM_Formats));
afd->pwfx->wFormatTag = WAVE_FORMAT_PCM;
afd->pwfx->nChannels = PCM_Formats[afd->dwFormatIndex].nChannels;
afd->pwfx->nSamplesPerSec = PCM_Formats[afd->dwFormatIndex].rate;
diff --git a/media/doc/README.WINE b/media/doc/README.WINE
index bb6ca8c70a..d27f4d3675 100644
--- a/media/doc/README.WINE
+++ b/media/doc/README.WINE
@@ -100,7 +100,7 @@ reactos/dll/win32/mlang # Synced to WineStaging-4.0
reactos/dll/win32/mmdevapi # Synced to WineStaging-4.0
reactos/dll/win32/mpr # Synced to WineStaging-3.17
reactos/dll/win32/mprapi # Synced to WineStaging-3.3
-reactos/dll/win32/msacm32 # Synced to WineStaging-3.3
+reactos/dll/win32/msacm32 # Synced to WineStaging-4.0
reactos/dll/win32/msacm32.drv # Synced to WineStaging-3.3
reactos/dll/win32/msadp32.acm # Synced to WineStaging-3.3
reactos/dll/win32/mscat32 # Synced to WineStaging-3.3