Zebediah Figura : msdmo: Return the number of media types retrieved from DMOGetTypes().

Alexandre Julliard julliard at winehq.org
Mon Jul 13 16:08:49 CDT 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jul 13 09:38:03 2020 -0500

msdmo: Return the number of media types retrieved from DMOGetTypes().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msdmo/dmoreg.c      | 22 ++++++++--------------
 dlls/msdmo/tests/msdmo.c |  2 +-
 2 files changed, 9 insertions(+), 15 deletions(-)

diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c
index cd253c3e9a..8c32a8f59f 100644
--- a/dlls/msdmo/dmoreg.c
+++ b/dlls/msdmo/dmoreg.c
@@ -730,22 +730,16 @@ HRESULT WINAPI DMOGetTypes(REFCLSID clsid, ULONG input_count, ULONG *ret_input_c
     }
 
     *ret_input_count = 0;
-    if (input_count > 0)
-    {
-        size = input_count * sizeof(DMO_PARTIAL_MEDIATYPE);
-        ret = RegQueryValueExW(key, L"InputTypes", NULL, NULL, (BYTE *)input, &size);
-        if (!ret || ret == ERROR_MORE_DATA)
-            *ret_input_count = size / sizeof(DMO_PARTIAL_MEDIATYPE);
-    }
+    size = input_count * sizeof(DMO_PARTIAL_MEDIATYPE);
+    ret = RegQueryValueExW(key, L"InputTypes", NULL, NULL, (BYTE *)input, &size);
+    if (!ret || ret == ERROR_MORE_DATA)
+        *ret_input_count = min(input_count, size / sizeof(DMO_PARTIAL_MEDIATYPE));
 
     *ret_output_count = 0;
-    if (output_count > 0)
-    {
-        size = output_count * sizeof(DMO_PARTIAL_MEDIATYPE);
-        ret = RegQueryValueExW(key, L"OutputTypes", NULL, NULL, (BYTE *)output, &size);
-        if (!ret || ret == ERROR_MORE_DATA)
-            *ret_output_count = size / sizeof(DMO_PARTIAL_MEDIATYPE);
-    }
+    size = output_count * sizeof(DMO_PARTIAL_MEDIATYPE);
+    ret = RegQueryValueExW(key, L"OutputTypes", NULL, NULL, (BYTE *)output, &size);
+    if (!ret || ret == ERROR_MORE_DATA)
+        *ret_output_count = min(output_count, size / sizeof(DMO_PARTIAL_MEDIATYPE));
 
     return S_OK;
 }
diff --git a/dlls/msdmo/tests/msdmo.c b/dlls/msdmo/tests/msdmo.c
index 2afa56e5a6..a1ab8ee00d 100644
--- a/dlls/msdmo/tests/msdmo.c
+++ b/dlls/msdmo/tests/msdmo.c
@@ -144,7 +144,7 @@ static void test_DMOGetTypes(void)
     memset(types, 0, sizeof(types));
     hr = DMOGetTypes(&GUID_unknowndmo, 1, &input_count, types, 0, &output_count, NULL);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(input_count == 1, "Got input count %u.\n", input_count);
+    ok(input_count == 1, "Got input count %u.\n", input_count);
     ok(!output_count, "Got output count %u.\n", output_count);
     todo_wine ok(!memcmp(types, input_types, sizeof(DMO_PARTIAL_MEDIATYPE)), "Types didn't match.\n");
 




More information about the wine-cvs mailing list