[PATCH v4 2/5] mfplat: Implement IMFAttributes::DeleteItem().
Jactry Zeng
jzeng at codeweavers.com
Thu Mar 7 20:43:00 CST 2019
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
---
dlls/mfplat/main.c | 23 +++++++++++++++++++++--
dlls/mfplat/tests/mfplat.c | 5 ++++-
2 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 22803dc1b4..05e56ccb72 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -818,10 +818,29 @@ static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, RE
static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key)
{
mfattributes *This = impl_from_IMFAttributes(iface);
+ struct mfattribute *attribute = NULL;
+ size_t index = 0;
- FIXME("%p, %s\n", This, debugstr_guid(key));
+ TRACE("(%p, %s)\n", This, debugstr_guid(key));
- return E_NOTIMPL;
+ EnterCriticalSection(&This->lock);
+
+ attribute = mfattributes_find_item(This, key, &index);
+ if (attribute)
+ {
+ size_t count;
+
+ PropVariantClear(&attribute->value);
+
+ This->count--;
+ count = This->count - index;
+ if (count)
+ memmove(&This->attributes[index], &This->attributes[index + 1], count * sizeof(*This->attributes));
+ }
+
+ LeaveCriticalSection(&This->lock);
+
+ return S_OK;
}
static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 95f13725bf..c355e792a7 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -502,7 +502,7 @@ static void test_MFCreateAttributes(void)
ok(hr == S_OK, "IMFAttributes_SetItem failed: 0x%08x.\n", hr);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
- todo_wine ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr);
+ ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr);
key = GUID_NULL;
if (is_win8_plus)
hr = IMFAttributes_GetItemByIndex(attributes, 0, &key, &ret_propvar);
@@ -524,6 +524,9 @@ static void test_MFCreateAttributes(void)
todo_wine ok(!PropVariantCompareEx(&propvar, &ret_propvar, 0, 0), "got wrong property.\n");
todo_wine ok(IsEqualIID(&key, &DUMMY_GUID1), "got wrong key: %s.\n", wine_dbgstr_guid(&key));
+ hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
+ ok(hr == S_OK, "IMFAttributes_DeleteItem failed: 0x%08x.\n", hr);
+
IMFAttributes_Release(attributes);
}
--
2.20.1
More information about the wine-devel
mailing list