quartz: 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-07-17 21:20:08 +02:00 committed by Alexandre Julliard
parent d93954bd93
commit 53c80a2bd1
7 changed files with 13 additions and 13 deletions

View File

@ -794,7 +794,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
case ckidSTREAMNAME: case ckidSTREAMNAME:
TRACE("processing stream name\n"); TRACE("processing stream name\n");
/* FIXME: this doesn't exactly match native version (we omit the "##)" prefix), but hey... */ /* FIXME: this doesn't exactly match native version (we omit the "##)" prefix), but hey... */
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)(pChunk + 1), pChunk->cb, piOutput.achName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0])); MultiByteToWideChar(CP_ACP, 0, (LPCSTR)(pChunk + 1), pChunk->cb, piOutput.achName, ARRAY_SIZE(piOutput.achName));
break; break;
case ckidSTREAMHANDLERDATA: case ckidSTREAMHANDLERDATA:
FIXME("process stream handler data\n"); FIXME("process stream handler data\n");

View File

@ -282,7 +282,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID *
{ {
HKEY hkeyMajor; HKEY hkeyMajor;
WCHAR wszMajorKeyName[CHARS_IN_GUID]; WCHAR wszMajorKeyName[CHARS_IN_GUID];
DWORD dwKeyNameLength = sizeof(wszMajorKeyName) / sizeof(wszMajorKeyName[0]); DWORD dwKeyNameLength = ARRAY_SIZE(wszMajorKeyName);
static const WCHAR wszExtensions[] = {'E','x','t','e','n','s','i','o','n','s',0}; static const WCHAR wszExtensions[] = {'E','x','t','e','n','s','i','o','n','s',0};
if (RegEnumKeyExW(hkeyMediaType, indexMajor, wszMajorKeyName, &dwKeyNameLength, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) if (RegEnumKeyExW(hkeyMediaType, indexMajor, wszMajorKeyName, &dwKeyNameLength, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
@ -304,7 +304,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID *
{ {
HKEY hkeyMinor; HKEY hkeyMinor;
WCHAR wszMinorKeyName[CHARS_IN_GUID]; WCHAR wszMinorKeyName[CHARS_IN_GUID];
DWORD dwMinorKeyNameLen = sizeof(wszMinorKeyName) / sizeof(wszMinorKeyName[0]); DWORD dwMinorKeyNameLen = ARRAY_SIZE(wszMinorKeyName);
WCHAR wszSourceFilterKeyName[CHARS_IN_GUID]; WCHAR wszSourceFilterKeyName[CHARS_IN_GUID];
DWORD dwSourceFilterKeyNameLen = sizeof(wszSourceFilterKeyName); DWORD dwSourceFilterKeyNameLen = sizeof(wszSourceFilterKeyName);
DWORD maxValueLen; DWORD maxValueLen;
@ -326,7 +326,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID *
DWORD dwType; DWORD dwType;
WCHAR wszValueName[14]; /* longest name we should encounter will be "Source Filter" */ WCHAR wszValueName[14]; /* longest name we should encounter will be "Source Filter" */
LPWSTR wszPatternString = HeapAlloc(GetProcessHeap(), 0, maxValueLen); LPWSTR wszPatternString = HeapAlloc(GetProcessHeap(), 0, maxValueLen);
DWORD dwValueNameLen = sizeof(wszValueName) / sizeof(wszValueName[0]); /* remember this is in chars */ DWORD dwValueNameLen = ARRAY_SIZE(wszValueName);
DWORD dwDataLen = maxValueLen; /* remember this is in bytes */ DWORD dwDataLen = maxValueLen; /* remember this is in bytes */
if (RegEnumValueW(hkeyMinor, indexValue, wszValueName, &dwValueNameLen, NULL, &dwType, (LPBYTE)wszPatternString, &dwDataLen) != ERROR_SUCCESS) if (RegEnumValueW(hkeyMinor, indexValue, wszValueName, &dwValueNameLen, NULL, &dwType, (LPBYTE)wszPatternString, &dwDataLen) != ERROR_SUCCESS)

View File

@ -703,7 +703,7 @@ static HRESULT WINAPI FilterMapper3_RegisterFilter(
* the + 1 is for the separator ('\\'). The -1 is * the + 1 is for the separator ('\\'). The -1 is
* because CHARS_IN_GUID includes the null terminator * because CHARS_IN_GUID includes the null terminator
*/ */
nameLen = sizeof(wszDevice)/sizeof(wszDevice[0]) + CHARS_IN_GUID - 1 + 1; nameLen = ARRAY_SIZE(wszDevice) + CHARS_IN_GUID - 1 + 1;
if (szInstance) if (szInstance)
nameLen += strlenW(szInstance); nameLen += strlenW(szInstance);

View File

@ -185,7 +185,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
if (IsEqualGUID( &IID_IClassFactory, riid ) || IsEqualGUID( &IID_IUnknown, riid)) if (IsEqualGUID( &IID_IClassFactory, riid ) || IsEqualGUID( &IID_IUnknown, riid))
{ {
for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{ {
if (IsEqualGUID(object_creation[i].clsid, rclsid)) if (IsEqualGUID(object_creation[i].clsid, rclsid))
{ {
@ -313,7 +313,7 @@ DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR buffer, DWORD maxlen)
if (!buffer) if (!buffer)
return 0; return 0;
res = AMGetErrorTextW(hr, errorW, sizeof(errorW)/sizeof(*errorW)); res = AMGetErrorTextW(hr, errorW, ARRAY_SIZE(errorW));
return WideCharToMultiByte(CP_ACP, 0, errorW, res, buffer, maxlen, 0, 0); return WideCharToMultiByte(CP_ACP, 0, errorW, res, buffer, maxlen, 0, 0);
} }

View File

@ -109,7 +109,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c
/* construct input pin */ /* construct input pin */
piInput.dir = PINDIR_INPUT; piInput.dir = PINDIR_INPUT;
piInput.pFilter = &pParser->filter.IBaseFilter_iface; piInput.pFilter = &pParser->filter.IBaseFilter_iface;
lstrcpynW(piInput.achName, wcsInputPinName, sizeof(piInput.achName) / sizeof(piInput.achName[0])); lstrcpynW(piInput.achName, wcsInputPinName, ARRAY_SIZE(piInput.achName));
if (!start) if (!start)
start = Parser_ChangeStart; start = Parser_ChangeStart;

View File

@ -1322,7 +1322,7 @@ static BOOL CALLBACK get_available_monitors_proc(HMONITOR hmon, HDC hdc, LPRECT
info->hMon = hmon; info->hMon = hmon;
info->dwFlags = mi.dwFlags; info->dwFlags = mi.dwFlags;
lstrcpynW(info->szDevice, mi.szDevice, sizeof(info->szDevice)/sizeof(WCHAR)); lstrcpynW(info->szDevice, mi.szDevice, ARRAY_SIZE(info->szDevice));
/* FIXME: how to get these values? */ /* FIXME: how to get these values? */
info->szDescription[0] = 0; info->szDescription[0] = 0;
@ -1339,7 +1339,7 @@ static BOOL CALLBACK get_available_monitors_proc(HMONITOR hmon, HDC hdc, LPRECT
info->hMon = hmon; info->hMon = hmon;
info->dwFlags = mi.dwFlags; info->dwFlags = mi.dwFlags;
lstrcpynW(info->szDevice, mi.szDevice, sizeof(info->szDevice)/sizeof(WCHAR)); lstrcpynW(info->szDevice, mi.szDevice, ARRAY_SIZE(info->szDevice));
/* FIXME: how to get these values? */ /* FIXME: how to get these values? */
info->szDescription[0] = 0; info->szDescription[0] = 0;
@ -2958,7 +2958,7 @@ static HRESULT VMR9_SurfaceAllocator_UpdateDeviceReset(VMR9DefaultAllocatorPrese
width = This->info.dwWidth; width = This->info.dwWidth;
height = This->info.dwHeight; height = This->info.dwHeight;
for (i = 0; i < sizeof(t_vert) / sizeof(t_vert[0]); ++i) for (i = 0; i < ARRAY_SIZE(t_vert); ++i)
{ {
if (i % 2) if (i % 2)
{ {

View File

@ -254,8 +254,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
piOutput.dir = PINDIR_OUTPUT; piOutput.dir = PINDIR_OUTPUT;
piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface; piOutput.pFilter = &pWAVEParser->Parser.filter.IBaseFilter_iface;
lstrcpynW(piOutput.achName, wcsOutputPinName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0])); lstrcpynW(piOutput.achName, wcsOutputPinName, ARRAY_SIZE(piOutput.achName));
hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list); hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list);
pos += sizeof(list); pos += sizeof(list);