Zebediah Figura : msdmo: Factor out any_types_match().
Alexandre Julliard
julliard at winehq.org
Fri Jul 10 16:30:31 CDT 2020
Module: wine
Branch: master
Commit: aa2406ecea33e511255ee3ae2d43b6cbc7dbd9cc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=aa2406ecea33e511255ee3ae2d43b6cbc7dbd9cc
Author: Zebediah Figura <z.figura12 at gmail.com>
Date: Fri Jul 10 11:42:49 2020 -0500
msdmo: Factor out any_types_match().
Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msdmo/dmoreg.c | 49 +++++++++++++++++++------------------------------
1 file changed, 19 insertions(+), 30 deletions(-)
diff --git a/dlls/msdmo/dmoreg.c b/dlls/msdmo/dmoreg.c
index 7e7f0c0fb8..ab3fda743c 100644
--- a/dlls/msdmo/dmoreg.c
+++ b/dlls/msdmo/dmoreg.c
@@ -417,6 +417,21 @@ static ULONG WINAPI IEnumDMO_fnRelease(IEnumDMO * iface)
return refCount;
}
+static BOOL any_types_match(const DMO_PARTIAL_MEDIATYPE *a, unsigned int a_count,
+ const DMO_PARTIAL_MEDIATYPE *b, unsigned int b_count)
+{
+ unsigned int i, j;
+
+ for (i = 0; i < a_count; ++i)
+ {
+ for (j = 0; j < b_count; ++j)
+ {
+ if (IsMediaTypeEqual(&a[i], &b[j]))
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
/******************************************************************************
* IEnumDMO_fnNext
@@ -483,8 +498,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
if (This->pInTypes)
{
- UINT i, j;
- DWORD cInTypes;
+ DWORD cInTypes, i;
hres = read_types(hkey, L"InputTypes", &cInTypes, ARRAY_SIZE(types), types);
if (FAILED(hres))
@@ -498,19 +512,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
debugstr_guid(&types[i].subtype));
}
- for (i = 0; i < This->cInTypes; i++)
- {
- for (j = 0; j < cInTypes; j++)
- {
- if (IsMediaTypeEqual(&types[j], &This->pInTypes[i]))
- break;
- }
-
- if (j >= cInTypes)
- break;
- }
-
- if (i < This->cInTypes)
+ if (!any_types_match(types, cInTypes, This->pInTypes, This->cInTypes))
{
RegCloseKey(hkey);
continue;
@@ -519,8 +521,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
if (This->pOutTypes)
{
- UINT i, j;
- DWORD cOutTypes;
+ DWORD cOutTypes, i;
hres = read_types(hkey, L"OutputTypes", &cOutTypes, ARRAY_SIZE(types), types);
if (FAILED(hres))
@@ -534,19 +535,7 @@ static HRESULT WINAPI IEnumDMO_fnNext(
debugstr_guid(&types[i].subtype));
}
- for (i = 0; i < This->cOutTypes; i++)
- {
- for (j = 0; j < cOutTypes; j++)
- {
- if (IsMediaTypeEqual(&types[j], &This->pOutTypes[i]))
- break;
- }
-
- if (j >= cOutTypes)
- break;
- }
-
- if (i < This->cOutTypes)
+ if (!any_types_match(types, cOutTypes, This->pOutTypes, This->cOutTypes))
{
RegCloseKey(hkey);
continue;
More information about the wine-cvs
mailing list