Michael Stefaniuc : quartz: Use the ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Tue Jul 17 15:52:37 CDT 2018


Module: wine
Branch: master
Commit: 53c80a2bd16cfe338a103a8de48d260289cd5f0a
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=53c80a2bd16cfe338a103a8de48d260289cd5f0a

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Tue Jul 17 21:20:08 2018 +0200

quartz: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/avisplit.c     | 2 +-
 dlls/quartz/filesource.c   | 6 +++---
 dlls/quartz/filtermapper.c | 2 +-
 dlls/quartz/main.c         | 4 ++--
 dlls/quartz/parser.c       | 2 +-
 dlls/quartz/vmr9.c         | 6 +++---
 dlls/quartz/waveparser.c   | 4 ++--
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c
index 564ccd3..6f27c29 100644
--- a/dlls/quartz/avisplit.c
+++ b/dlls/quartz/avisplit.c
@@ -794,7 +794,7 @@ static HRESULT AVISplitter_ProcessStreamList(AVISplitterImpl * This, const BYTE
         case ckidSTREAMNAME:
             TRACE("processing stream name\n");
             /* 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;
         case ckidSTREAMHANDLERDATA:
             FIXME("process stream handler data\n");
diff --git a/dlls/quartz/filesource.c b/dlls/quartz/filesource.c
index bcce0e1..67af560 100644
--- a/dlls/quartz/filesource.c
+++ b/dlls/quartz/filesource.c
@@ -282,7 +282,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID *
         {
             HKEY hkeyMajor;
             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};
 
             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;
                     WCHAR wszMinorKeyName[CHARS_IN_GUID];
-                    DWORD dwMinorKeyNameLen = sizeof(wszMinorKeyName) / sizeof(wszMinorKeyName[0]);
+                    DWORD dwMinorKeyNameLen = ARRAY_SIZE(wszMinorKeyName);
                     WCHAR wszSourceFilterKeyName[CHARS_IN_GUID];
                     DWORD dwSourceFilterKeyNameLen = sizeof(wszSourceFilterKeyName);
                     DWORD maxValueLen;
@@ -326,7 +326,7 @@ HRESULT GetClassMediaFile(IAsyncReader * pReader, LPCOLESTR pszFileName, GUID *
                         DWORD dwType;
                         WCHAR wszValueName[14]; /* longest name we should encounter will be "Source Filter" */
                         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 */
 
                         if (RegEnumValueW(hkeyMinor, indexValue, wszValueName, &dwValueNameLen, NULL, &dwType, (LPBYTE)wszPatternString, &dwDataLen) != ERROR_SUCCESS)
diff --git a/dlls/quartz/filtermapper.c b/dlls/quartz/filtermapper.c
index d189d1d..0d26198 100644
--- a/dlls/quartz/filtermapper.c
+++ b/dlls/quartz/filtermapper.c
@@ -703,7 +703,7 @@ static HRESULT WINAPI FilterMapper3_RegisterFilter(
      * the + 1 is for the separator ('\\'). The -1 is
      * 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)
         nameLen += strlenW(szInstance);
diff --git a/dlls/quartz/main.c b/dlls/quartz/main.c
index 7c2accb..4575c6e 100644
--- a/dlls/quartz/main.c
+++ b/dlls/quartz/main.c
@@ -185,7 +185,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 
     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))
             {
@@ -313,7 +313,7 @@ DWORD WINAPI AMGetErrorTextA(HRESULT hr, LPSTR buffer, DWORD maxlen)
     if (!buffer)
         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);
 }
 
diff --git a/dlls/quartz/parser.c b/dlls/quartz/parser.c
index 034bca0..49b0adf 100644
--- a/dlls/quartz/parser.c
+++ b/dlls/quartz/parser.c
@@ -109,7 +109,7 @@ HRESULT Parser_Create(ParserImpl* pParser, const IBaseFilterVtbl *Parser_Vtbl, c
     /* construct input pin */
     piInput.dir = PINDIR_INPUT;
     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)
         start = Parser_ChangeStart;
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index d9e4f46..5aa9799 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -1322,7 +1322,7 @@ static BOOL CALLBACK get_available_monitors_proc(HMONITOR hmon, HDC hdc, LPRECT
             info->hMon          = hmon;
             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? */
             info->szDescription[0] = 0;
@@ -1339,7 +1339,7 @@ static BOOL CALLBACK get_available_monitors_proc(HMONITOR hmon, HDC hdc, LPRECT
             info->hMon          = hmon;
             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? */
             info->szDescription[0] = 0;
@@ -2958,7 +2958,7 @@ static HRESULT VMR9_SurfaceAllocator_UpdateDeviceReset(VMR9DefaultAllocatorPrese
     width = This->info.dwWidth;
     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)
         {
diff --git a/dlls/quartz/waveparser.c b/dlls/quartz/waveparser.c
index 0a84fcb..403c052 100644
--- a/dlls/quartz/waveparser.c
+++ b/dlls/quartz/waveparser.c
@@ -254,8 +254,8 @@ static HRESULT WAVEParser_InputPin_PreConnect(IPin * iface, IPin * pConnectPin,
 
     piOutput.dir = PINDIR_OUTPUT;
     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);
     pos += sizeof(list);
 




More information about the wine-cvs mailing list