[PATCH 04/11] mfplat: Implement IMFAttributes::DeleteItem().
Nikolay Sivov
nsivov at codeweavers.com
Thu Mar 14 03:03:09 CDT 2019
From: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/mfplat/main.c | 24 ++++++++++++++++++++++--
dlls/mfplat/tests/mfplat.c | 5 ++++-
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 8ab7c979a8..e12847e90d 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -837,9 +837,29 @@ static HRESULT WINAPI mfattributes_SetItem(IMFAttributes *iface, REFGUID key, RE
static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key)
{
- FIXME("%p, %s.\n", iface, debugstr_attr(key));
+ struct attributes *attributes = impl_from_IMFAttributes(iface);
+ struct attribute *attribute;
+ size_t index = 0;
- return E_NOTIMPL;
+ TRACE("%p, %s.\n", iface, debugstr_attr(key));
+
+ EnterCriticalSection(&attributes->cs);
+
+ if ((attribute = attributes_find_item(attributes, key, &index)))
+ {
+ size_t count;
+
+ PropVariantClear(&attribute->value);
+
+ attributes->count--;
+ count = attributes->count - index;
+ if (count)
+ memmove(&attributes->attributes[index], &attributes->attributes[index + 1], count * sizeof(*attributes->attributes));
+ }
+
+ LeaveCriticalSection(&attributes->cs);
+
+ 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 8550160b8e..3a94d4bd17 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -583,7 +583,10 @@ static void test_MFCreateAttributes(void)
ok(hr == S_OK, "Failed to set item, hr %#x.\n", hr);
hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
- todo_wine ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr);
+ ok(hr == S_OK, "Failed to delete item, hr %#x.\n", hr);
+
+ hr = IMFAttributes_DeleteItem(attributes, &DUMMY_GUID2);
+ ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
hr = IMFAttributes_GetItem(attributes, &DUMMY_GUID3, &ret_propvar);
ok(hr == S_OK, "Failed to get item, hr %#x.\n", hr);
--
2.20.1
More information about the wine-devel
mailing list