devenum: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-08-04 22:45:40 +02:00 committed by Alexandre Julliard
parent d8e66774f4
commit e5216332c0
2 changed files with 10 additions and 11 deletions

View File

@ -155,7 +155,7 @@ static void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS2 *rgPin)
{ {
HKEY hkeyMajorType = NULL; HKEY hkeyMajorType = NULL;
WCHAR wszMajorTypeName[64]; WCHAR wszMajorTypeName[64];
DWORD cName = sizeof(wszMajorTypeName) / sizeof(WCHAR); DWORD cName = ARRAY_SIZE(wszMajorTypeName);
DWORD dwMinorTypes, i1; DWORD dwMinorTypes, i1;
if (RegEnumKeyExW(hkeyTypes, i, wszMajorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue; if (RegEnumKeyExW(hkeyTypes, i, wszMajorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue;
@ -175,7 +175,7 @@ static void DEVENUM_ReadPinTypes(HKEY hkeyPinKey, REGFILTERPINS2 *rgPin)
CLSID *clsMajorType = NULL, *clsMinorType = NULL; CLSID *clsMajorType = NULL, *clsMinorType = NULL;
HRESULT hr; HRESULT hr;
cName = sizeof(wszMinorTypeName) / sizeof(WCHAR); cName = ARRAY_SIZE(wszMinorTypeName);
if (RegEnumKeyExW(hkeyMajorType, i1, wszMinorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue; if (RegEnumKeyExW(hkeyMajorType, i1, wszMinorTypeName, &cName, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) continue;
clsMinorType = CoTaskMemAlloc(sizeof(CLSID)); clsMinorType = CoTaskMemAlloc(sizeof(CLSID));
@ -261,7 +261,7 @@ static void DEVENUM_ReadPins(HKEY hkeyFilterClass, REGFILTER2 *rgf2)
{ {
HKEY hkeyPinKey = NULL; HKEY hkeyPinKey = NULL;
WCHAR wszPinName[MAX_PATH]; WCHAR wszPinName[MAX_PATH];
DWORD cName = sizeof(wszPinName) / sizeof(WCHAR); DWORD cName = ARRAY_SIZE(wszPinName);
REGFILTERPINS2 *rgPin = &rgPins[rgf2->u.s2.cPins2]; REGFILTERPINS2 *rgPin = &rgPins[rgf2->u.s2.cPins2];
DWORD value, size, Type; DWORD value, size, Type;
LONG lRet; LONG lRet;
@ -408,7 +408,7 @@ static void register_legacy_filters(void)
for (i = 0; i < dwFilterSubkeys; i++) for (i = 0; i < dwFilterSubkeys; i++)
{ {
WCHAR wszFilterSubkeyName[64]; WCHAR wszFilterSubkeyName[64];
DWORD cName = sizeof(wszFilterSubkeyName) / sizeof(WCHAR); DWORD cName = ARRAY_SIZE(wszFilterSubkeyName);
IPropertyBag *prop_bag = NULL; IPropertyBag *prop_bag = NULL;
WCHAR wszRegKey[MAX_PATH]; WCHAR wszRegKey[MAX_PATH];
HKEY classkey = NULL; HKEY classkey = NULL;
@ -944,7 +944,7 @@ static HRESULT DEVENUM_CreateAMCategoryKey(const CLSID * clsidCategory)
strcpyW(wszRegKey, wszActiveMovieKey); strcpyW(wszRegKey, wszActiveMovieKey);
if (!StringFromGUID2(clsidCategory, wszRegKey + strlenW(wszRegKey), sizeof(wszRegKey)/sizeof(wszRegKey[0]) - strlenW(wszRegKey))) if (!StringFromGUID2(clsidCategory, wszRegKey + strlenW(wszRegKey), ARRAY_SIZE(wszRegKey) - strlenW(wszRegKey)))
res = E_INVALIDARG; res = E_INVALIDARG;
if (SUCCEEDED(res)) if (SUCCEEDED(res))
@ -1016,13 +1016,12 @@ static HRESULT register_codecs(void)
{ {
WCHAR szDeviceName[32], szDeviceVersion[32], szDevicePath[10]; WCHAR szDeviceName[32], szDeviceVersion[32], szDevicePath[10];
if (capGetDriverDescriptionW ((WORD) i, if (capGetDriverDescriptionW (i, szDeviceName, ARRAY_SIZE(szDeviceName),
szDeviceName, sizeof(szDeviceName)/sizeof(WCHAR), szDeviceVersion, ARRAY_SIZE(szDeviceVersion)))
szDeviceVersion, sizeof(szDeviceVersion)/sizeof(WCHAR)))
{ {
IMoniker * pMoniker = NULL; IMoniker * pMoniker = NULL;
WCHAR dprintf[] = { 'v','i','d','e','o','%','d',0 }; WCHAR dprintf[] = { 'v','i','d','e','o','%','d',0 };
snprintfW(szDevicePath, sizeof(szDevicePath)/sizeof(WCHAR), dprintf, i); snprintfW(szDevicePath, ARRAY_SIZE(szDevicePath), dprintf, i);
/* The above code prevents 1 device with a different ID overwriting another */ /* The above code prevents 1 device with a different ID overwriting another */
rfp2.nMediaTypes = 1; rfp2.nMediaTypes = 1;

View File

@ -889,7 +889,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt,
StringFromGUID2(&This->class, buffer + CHARS_IN_GUID - 1, CHARS_IN_GUID); StringFromGUID2(&This->class, buffer + CHARS_IN_GUID - 1, CHARS_IN_GUID);
} }
/* try DirectShow filters */ /* try DirectShow filters */
else if (!(res = RegEnumKeyW(This->sw_key, This->sw_index, buffer, sizeof(buffer)/sizeof(WCHAR)))) else if (!(res = RegEnumKeyW(This->sw_key, This->sw_index, buffer, ARRAY_SIZE(buffer))))
{ {
This->sw_index++; This->sw_index++;
if ((res = RegOpenKeyExW(This->sw_key, buffer, 0, KEY_QUERY_VALUE, &hkey))) if ((res = RegOpenKeyExW(This->sw_key, buffer, 0, KEY_QUERY_VALUE, &hkey)))
@ -908,7 +908,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(IEnumMoniker *iface, ULONG celt,
strcpyW(pMoniker->name, buffer); strcpyW(pMoniker->name, buffer);
} }
/* then try codecs */ /* then try codecs */
else if (!(res = RegEnumKeyW(This->cm_key, This->cm_index, buffer, sizeof(buffer)/sizeof(WCHAR)))) else if (!(res = RegEnumKeyW(This->cm_key, This->cm_index, buffer, ARRAY_SIZE(buffer))))
{ {
This->cm_index++; This->cm_index++;