Zebediah Figura : qcap/capturegraph: Return BOOL from pin_matches().

Alexandre Julliard julliard at winehq.org
Fri Mar 6 16:38:42 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Thu Mar  5 20:04:33 2020 -0600

qcap/capturegraph: Return BOOL from pin_matches().

It is not interesting to account for IPin::QueryDirection failing.

Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/qcap/capturegraph.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/dlls/qcap/capturegraph.c b/dlls/qcap/capturegraph.c
index bae75f8372..7a96101724 100644
--- a/dlls/qcap/capturegraph.c
+++ b/dlls/qcap/capturegraph.c
@@ -580,25 +580,24 @@ fnCaptureGraphBuilder2_CopyCaptureFile(ICaptureGraphBuilder2 * iface,
     return E_NOTIMPL;
 }
 
-static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected)
+static BOOL pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat, const GUID *type, BOOL unconnected)
 {
     IPin *partner;
     PIN_DIRECTION pindir;
     HRESULT hr;
 
-    hr = IPin_QueryDirection(pin, &pindir);
+    if (FAILED(hr = IPin_QueryDirection(pin, &pindir)))
+        ERR("Failed to query direction, hr %#x.\n", hr);
 
     if (unconnected && IPin_ConnectedTo(pin, &partner) == S_OK && partner!=NULL)
     {
         IPin_Release(partner);
         TRACE("No match, %p already connected to %p\n", pin, partner);
-        return FAILED(hr) ? hr : S_FALSE;
+        return FALSE;
     }
 
-    if (FAILED(hr))
-        return hr;
-    if (SUCCEEDED(hr) && pindir != direction)
-        return S_FALSE;
+    if (pindir != direction)
+        return FALSE;
 
     if (cat)
     {
@@ -608,13 +607,13 @@ static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat,
 
         hr = IPin_QueryInterface(pin, &IID_IKsPropertySet, (void**)&props);
         if (FAILED(hr))
-            return S_FALSE;
+            return FALSE;
 
         hr = IKsPropertySet_Get(props, &AMPROPSETID_Pin, 0, NULL,
                 0, &category, sizeof(category), &fetched);
         IKsPropertySet_Release(props);
         if (FAILED(hr) || !IsEqualIID(&category, cat))
-            return S_FALSE;
+            return FALSE;
     }
 
     if (type)
@@ -625,14 +624,14 @@ static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat,
 
         hr = IPin_EnumMediaTypes(pin, &types);
         if (FAILED(hr))
-            return S_FALSE;
+            return FALSE;
 
         IEnumMediaTypes_Reset(types);
         while (1) {
             if (IEnumMediaTypes_Next(types, 1, &media_type, &fetched) != S_OK || fetched != 1)
             {
                 IEnumMediaTypes_Release(types);
-                return S_FALSE;
+                return FALSE;
             }
 
             if (IsEqualIID(&media_type->majortype, type))
@@ -646,7 +645,7 @@ static HRESULT pin_matches(IPin *pin, PIN_DIRECTION direction, const GUID *cat,
     }
 
     TRACE("Pin matched\n");
-    return S_OK;
+    return TRUE;
 }
 
 static HRESULT WINAPI
@@ -712,13 +711,10 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
             }
 
             TRACE("Testing match\n");
-            hr = pin_matches(pin, pindir, pCategory, pType, fUnconnected);
-            if (hr == S_OK && numcurrent++ == num)
+            if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) && numcurrent++ == num)
                 break;
             IPin_Release(pin);
             pin = NULL;
-            if (FAILED(hr))
-                break;
         }
         IEnumPins_Release(enumpins);
         IBaseFilter_Release(filter);
@@ -729,7 +725,7 @@ fnCaptureGraphBuilder2_FindPin(ICaptureGraphBuilder2 * iface,
             return E_FAIL;
         }
     }
-    else if (pin_matches(pin, pindir, pCategory, pType, fUnconnected) != S_OK)
+    else if (!pin_matches(pin, pindir, pCategory, pType, fUnconnected))
     {
         IPin_Release(pin);
         return E_FAIL;




More information about the wine-cvs mailing list