Gijs Vermeulen : quartz: Only return S_FALSE in IEnumFilters::Skip() if count goes past the end of the sequence.

Alexandre Julliard julliard at winehq.org
Mon Nov 23 15:43:24 CST 2020


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

Author: Gijs Vermeulen <gijsvrm at gmail.com>
Date:   Mon Nov 23 17:29:28 2020 +0100

quartz: Only return S_FALSE in IEnumFilters::Skip() if count goes past the end of the sequence.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=28332
Signed-off-by: Gijs Vermeulen <gijsvrm at gmail.com>
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/filtergraph.c       |  2 +-
 dlls/quartz/tests/filtergraph.c | 24 ++++++++++++++++++++++++
 2 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c
index ff96c82baee..cf2421f64e2 100644
--- a/dlls/quartz/filtergraph.c
+++ b/dlls/quartz/filtergraph.c
@@ -331,7 +331,7 @@ static HRESULT WINAPI EnumFilters_Skip(IEnumFilters *iface, ULONG count)
     while (count--)
     {
         if (!(enum_filters->cursor = list_next(&enum_filters->graph->filters, enum_filters->cursor)))
-            return S_FALSE;
+            return count ? S_FALSE : S_OK;
     }
 
     return S_OK;
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c
index 7d423da6078..e4b72958e10 100644
--- a/dlls/quartz/tests/filtergraph.c
+++ b/dlls/quartz/tests/filtergraph.c
@@ -695,6 +695,30 @@ static void test_enum_filters(void)
     hr = IEnumFilters_Reset(enum1);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
+    hr = IEnumFilters_Skip(enum1, 0);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Skip(enum1, 1);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Skip(enum1, 2);
+    ok(hr == S_FALSE, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Skip(enum1, 1);
+    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Reset(enum1);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Skip(enum1, 2);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Skip(enum1, 1);
+    ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
+
+    hr = IEnumFilters_Reset(enum1);
+    ok(hr == S_OK, "Got hr %#x.\n", hr);
+
     hr = IEnumFilters_Next(enum1, 1, filters, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
     ok(filters[0] == filter2, "Got filter %p.\n", filters[0]);




More information about the wine-cvs mailing list