From af35e10c14b69702f91600fa53f438c4dc28dc9a Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Sat, 29 Jun 2019 13:43:50 -0500 Subject: [PATCH] strmbase: Fix implementation of IEnumMediaTypes::Skip(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47291 Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/qcap/tests/avico.c | 4 ++-- dlls/qcap/tests/avimux.c | 6 +++--- dlls/qcap/tests/smartteefilter.c | 2 +- dlls/qedit/tests/nullrenderer.c | 2 +- dlls/quartz/tests/avidec.c | 6 +++--- dlls/quartz/tests/avisplit.c | 6 +++--- dlls/quartz/tests/dsoundrender.c | 2 +- dlls/quartz/tests/filesource.c | 8 ++++---- dlls/quartz/tests/mpegsplit.c | 4 ++-- dlls/quartz/tests/videorenderer.c | 2 +- dlls/quartz/tests/vmr7.c | 2 +- dlls/quartz/tests/vmr9.c | 2 +- dlls/quartz/tests/waveparser.c | 6 +++--- dlls/strmbase/mediatype.c | 17 +++++++---------- 14 files changed, 33 insertions(+), 36 deletions(-) diff --git a/dlls/qcap/tests/avico.c b/dlls/qcap/tests/avico.c index 10402897575..dbc15e3f15d 100644 --- a/dlls/qcap/tests/avico.c +++ b/dlls/qcap/tests/avico.c @@ -611,7 +611,7 @@ static void test_enum_media_types(IBaseFilter *filter) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -642,7 +642,7 @@ static void test_enum_media_types(IBaseFilter *filter) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/qcap/tests/avimux.c b/dlls/qcap/tests/avimux.c index 98a775433c6..85ebd5c82c7 100644 --- a/dlls/qcap/tests/avimux.c +++ b/dlls/qcap/tests/avimux.c @@ -613,13 +613,13 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -648,7 +648,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c index 361b0603d85..487c8eca3c1 100644 --- a/dlls/qcap/tests/smartteefilter.c +++ b/dlls/qcap/tests/smartteefilter.c @@ -446,7 +446,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/qedit/tests/nullrenderer.c b/dlls/qedit/tests/nullrenderer.c index 7841720cfe1..45a0af16184 100644 --- a/dlls/qedit/tests/nullrenderer.c +++ b/dlls/qedit/tests/nullrenderer.c @@ -407,7 +407,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/avidec.c b/dlls/quartz/tests/avidec.c index b53b64ec8ae..19997e3c172 100644 --- a/dlls/quartz/tests/avidec.c +++ b/dlls/quartz/tests/avidec.c @@ -571,7 +571,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -602,13 +602,13 @@ static void test_enum_media_types(void) todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); IEnumMediaTypes_Release(enum1); IEnumMediaTypes_Release(enum2); diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index 7dc8b14c5e4..a1dadd481ad 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -685,7 +685,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -748,13 +748,13 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/dsoundrender.c b/dlls/quartz/tests/dsoundrender.c index 925a49c5da7..ecf4a46facd 100644 --- a/dlls/quartz/tests/dsoundrender.c +++ b/dlls/quartz/tests/dsoundrender.c @@ -542,7 +542,7 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 2); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 8d1d977b95e..18a9bf1499a 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -1159,19 +1159,19 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Reset(enum1); ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index 25c49438d06..5661c73e19a 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -876,7 +876,7 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 5); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -979,7 +979,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/videorenderer.c b/dlls/quartz/tests/videorenderer.c index 5b03a04e4e6..9e5c8eb281f 100644 --- a/dlls/quartz/tests/videorenderer.c +++ b/dlls/quartz/tests/videorenderer.c @@ -456,7 +456,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index cb35590df2f..81b42243b88 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -759,7 +759,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 0a55201f6ad..8d07522ab06 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -763,7 +763,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/tests/waveparser.c b/dlls/quartz/tests/waveparser.c index a0df5ccc9b3..4bfa17a9e5f 100644 --- a/dlls/quartz/tests/waveparser.c +++ b/dlls/quartz/tests/waveparser.c @@ -673,7 +673,7 @@ static void test_enum_media_types(void) ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Clone(enum1, &enum2); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); @@ -736,13 +736,13 @@ static void test_enum_media_types(void) ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Skip(enum1, 1); ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum1, 1, mts, NULL); - todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(hr == S_FALSE, "Got hr %#x.\n", hr); hr = IEnumMediaTypes_Next(enum2, 1, mts, NULL); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/strmbase/mediatype.c b/dlls/strmbase/mediatype.c index 66b5fa1721b..393264c094c 100644 --- a/dlls/strmbase/mediatype.c +++ b/dlls/strmbase/mediatype.c @@ -203,21 +203,18 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes *iface, return i == count ? S_OK : S_FALSE; } -static HRESULT WINAPI IEnumMediaTypesImpl_Skip(IEnumMediaTypes * iface, ULONG cMediaTypes) +static HRESULT WINAPI IEnumMediaTypesImpl_Skip(IEnumMediaTypes *iface, ULONG count) { - IEnumMediaTypesImpl *This = impl_from_IEnumMediaTypes(iface); + IEnumMediaTypesImpl *enummt = impl_from_IEnumMediaTypes(iface); - TRACE("(%p)->(%u)\n", iface, cMediaTypes); + TRACE("iface %p, count %u.\n", iface, count); - if (This->currentVersion != This->mediaVersionFunction(This->basePin)) + if (enummt->currentVersion != enummt->mediaVersionFunction(enummt->basePin)) return VFW_E_ENUM_OUT_OF_SYNC; - if (This->uIndex + cMediaTypes < This->count) - { - This->uIndex += cMediaTypes; - return S_OK; - } - return S_FALSE; + enummt->uIndex += count; + + return enummt->uIndex > enummt->count ? S_FALSE : S_OK; } static HRESULT WINAPI IEnumMediaTypesImpl_Reset(IEnumMediaTypes * iface)