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

Alexandre Julliard julliard at winehq.org
Mon Nov 5 15:51:53 CST 2018


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

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Mon Nov  5 21:56:21 2018 +0100

winegstreamer: Use the ARRAY_SIZE() macro.

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

---

 dlls/winegstreamer/gstdemux.c | 6 +++---
 dlls/winegstreamer/main.c     | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c
index 833464b..0d9ab8d 100644
--- a/dlls/winegstreamer/gstdemux.c
+++ b/dlls/winegstreamer/gstdemux.c
@@ -794,12 +794,12 @@ static void init_new_decoded_pad(GstElement *bin, GstPad *pad, GSTImpl *This)
     piOutput.dir = PINDIR_OUTPUT;
     piOutput.pFilter = &This->filter.IBaseFilter_iface;
     name = gst_pad_get_name(pad);
-    MultiByteToWideChar(CP_UNIXCP, 0, name, -1, piOutput.achName, sizeof(piOutput.achName) / sizeof(piOutput.achName[0]) - 1);
+    MultiByteToWideChar(CP_UNIXCP, 0, name, -1, piOutput.achName, ARRAY_SIZE(piOutput.achName) - 1);
     TRACE("Name: %s\n", name);
     strcpy(my_name, "qz_sink_");
     strcat(my_name, name);
     g_free(name);
-    piOutput.achName[sizeof(piOutput.achName) / sizeof(piOutput.achName[0]) - 1] = 0;
+    piOutput.achName[ARRAY_SIZE(piOutput.achName) - 1] = 0;
 
     caps = gst_pad_query_caps(pad, NULL);
     caps = gst_caps_make_writable(caps);
@@ -1259,7 +1259,7 @@ IUnknown * CALLBACK Gstreamer_Splitter_create(IUnknown *pUnkOuter, HRESULT *phr)
     piInput = &This->pInputPin.pin.pinInfo;
     piInput->dir = PINDIR_INPUT;
     piInput->pFilter = &This->filter.IBaseFilter_iface;
-    lstrcpynW(piInput->achName, wcsInputPinName, sizeof(piInput->achName) / sizeof(piInput->achName[0]));
+    lstrcpynW(piInput->achName, wcsInputPinName, ARRAY_SIZE(piInput->achName));
     This->pInputPin.pin.IPin_iface.lpVtbl = &GST_InputPin_Vtbl;
     This->pInputPin.pin.refCount = 1;
     This->pInputPin.pin.pConnectedTo = NULL;
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
index dc988cf..b9cddcb 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -223,7 +223,7 @@ FactoryTemplate const g_Templates[] = {
     },
 };
 
-const int g_cTemplates = sizeof(g_Templates) / sizeof (g_Templates[0]);
+const int g_cTemplates = ARRAY_SIZE(g_Templates);
 
 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 {
@@ -323,7 +323,7 @@ static HRESULT register_server(BOOL do_register)
     INF_SET_ID(MEDIATYPE_Stream);
     INF_SET_ID(WINESUBTYPE_Gstreamer);
 
-    for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) {
+    for(i = 0; i < ARRAY_SIZE(pse); i++) {
         pse[i].pszValue = HeapAlloc(GetProcessHeap(),0,39);
         sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
                 clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0],
@@ -331,7 +331,7 @@ static HRESULT register_server(BOOL do_register)
                 clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]);
     }
 
-    strtable.cEntries = sizeof(pse)/sizeof(pse[0]);
+    strtable.cEntries = ARRAY_SIZE(pse);
     strtable.pse = pse;
 
     hAdvpack = LoadLibraryW(wszAdvpack);
@@ -339,7 +339,7 @@ static HRESULT register_server(BOOL do_register)
 
     hres = pRegInstall(hInst, do_register ? "RegisterDll" : "UnregisterDll", &strtable);
 
-    for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++)
+    for(i = 0; i < ARRAY_SIZE(pse); i++)
         HeapFree(GetProcessHeap(),0,pse[i].pszValue);
 
     if(FAILED(hres)) {




More information about the wine-cvs mailing list