Instead of selecting the nth effect overall and checking whether it matches.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/dsound/buffer.c | 32 +++++++++++++++----------------- dlls/dsound/tests/dsound8.c | 22 +++++++++------------- 2 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index ea428c08166..bc30a8a5448 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -845,27 +845,25 @@ static HRESULT WINAPI IDirectSoundBufferImpl_AcquireResources(IDirectSoundBuffer }
static HRESULT WINAPI IDirectSoundBufferImpl_GetObjectInPath(IDirectSoundBuffer8 *iface, - REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, void **ppObject) + REFGUID clsid, DWORD index, REFGUID iid, void **out) { - IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface); + IDirectSoundBufferImpl *This = impl_from_IDirectSoundBuffer8(iface); + DWORD i, count = 0;
- TRACE("(%p,%s,%u,%s,%p)\n",This,debugstr_guid(rguidObject),dwIndex,debugstr_guid(rguidInterface),ppObject); + TRACE("(%p,%s,%u,%s,%p)\n", This, debugstr_guid(clsid), index, debugstr_guid(iid), out);
- if (dwIndex >= This->num_filters) - return DSERR_CONTROLUNAVAIL; - - if (!ppObject) - return E_INVALIDARG; + if (!out) + return E_INVALIDARG;
- if (IsEqualGUID(rguidObject, &This->filters[dwIndex].guid) || IsEqualGUID(rguidObject, &GUID_All_Objects)) { - if (SUCCEEDED(IMediaObject_QueryInterface(This->filters[dwIndex].obj, rguidInterface, ppObject))) - return DS_OK; - else - return E_NOINTERFACE; - } else { - WARN("control unavailable\n"); - return DSERR_OBJECTNOTFOUND; - } + for (i = 0; i < This->num_filters; i++) + { + if (IsEqualGUID(clsid, &This->filters[i].guid) || IsEqualGUID(clsid, &GUID_All_Objects)) + { + if (count++ == index) + return IMediaObject_QueryInterface(This->filters[i].obj, iid, out); + } + } + return DSERR_OBJECTNOTFOUND; }
static HRESULT WINAPI IDirectSoundBufferImpl_Initialize(IDirectSoundBuffer8 *iface, diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index fcac31ba637..468b460468b 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -1678,7 +1678,7 @@ static void test_effects(void)
dmo = (IMediaObject *)0xdeadbeef; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); ok(dmo == (IMediaObject *)0xdeadbeef, "Got object %p.\n", dmo);
effects[0].guidDSFXClass = GUID_DSFX_STANDARD_PARAMEQ; @@ -1705,9 +1705,8 @@ static void test_effects(void) echo = dmo; hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - reverb = dmo; + ok(hr == DS_OK, "Got hr %#x.\n", hr); + reverb = dmo;
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IMediaObject, (void **)&dmo); ok(hr == DS_OK, "Got hr %#x.\n", hr); @@ -1716,12 +1715,12 @@ static void test_effects(void)
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 1, &IID_IMediaObject, (void **)&dmo); ok(hr == DS_OK, "Got hr %#x.\n", hr); - todo_wine ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo); + ok(dmo == reverb, "Expected %p, got %p.\n", reverb, dmo); IMediaObject_Release(dmo);
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_I3DL2REVERB, 1, &IID_IMediaObject, (void **)&dmo); - todo_wine ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr); + ok(hr == DSERR_OBJECTNOTFOUND, "Got hr %#x.\n", hr);
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_All_Objects, 0, &IID_IDirectSoundFXParamEq, (void **)&unk); ok(hr == DS_OK, "Got hr %#x.\n", hr); @@ -1743,14 +1742,11 @@ static void test_effects(void)
hr = IDirectSoundBuffer8_GetObjectInPath(buffer8, &GUID_DSFX_STANDARD_I3DL2REVERB, 0, &IID_IDirectSoundFXI3DL2Reverb, (void **)&unk); - todo_wine ok(hr == DS_OK, "Got hr %#x.\n", hr); - if (hr == DS_OK) - IUnknown_Release(unk); + ok(hr == DS_OK, "Got hr %#x.\n", hr); + IUnknown_Release(unk);
- if (echo) - IMediaObject_Release(echo); - if (reverb) - IMediaObject_Release(reverb); + IMediaObject_Release(echo); + IMediaObject_Release(reverb);
got_Process = CreateEventA(NULL, TRUE, FALSE, NULL);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=76247
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/dsound/tests/dsound8.c:1705 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/dsound/tests/dsound8.c:1705 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/dsound/tests/dsound8.c:1705 Task: Patch failed to apply