It is not interesting to account for IPin::QueryDirection failing.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- 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 f258ccb6499..8c85f59bb4c 100644 --- a/dlls/qcap/capturegraph.c +++ b/dlls/qcap/capturegraph.c @@ -574,25 +574,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) { @@ -602,13 +601,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, &ROPSETID_Pin, 0, NULL, 0, &category, sizeof(category), &fetched); IKsPropertySet_Release(props); if (FAILED(hr) || !IsEqualIID(&category, cat)) - return S_FALSE; + return FALSE; }
if (type) @@ -619,14 +618,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)) @@ -640,7 +639,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 @@ -706,13 +705,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); @@ -723,7 +719,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;