Module: wine Branch: master Commit: 50a57f8613f170d680191a9ccf4ffe485c56e1e4 URL: https://source.winehq.org/git/wine.git/?a=commit;h=50a57f8613f170d680191a9cc...
Author: Jactry Zeng jzeng@codeweavers.com Date: Thu Mar 14 11:03:09 2019 +0300
mfplat: Implement IMFAttributes::DeleteItem().
Signed-off-by: Jactry Zeng jzeng@codeweavers.com Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
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 8ab7c97..e12847e 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 8550160..3a94d4b 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);