Jactry Zeng : mfplat: Implement IMFAttributes::DeleteAllItems().
Alexandre Julliard
julliard at winehq.org
Thu Mar 14 18:33:20 CDT 2019
Module: wine
Branch: master
Commit: 20ab5230f6835a66f9ae004b6f22f368dbb41f4b
URL: https://source.winehq.org/git/wine.git/?a=commit;h=20ab5230f6835a66f9ae004b6f22f368dbb41f4b
Author: Jactry Zeng <jzeng at codeweavers.com>
Date: Thu Mar 14 11:03:16 2019 +0300
mfplat: Implement IMFAttributes::DeleteAllItems().
Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/mfplat/main.c | 18 +++++++++++++++---
dlls/mfplat/tests/mfplat.c | 4 ++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c
index 31bed33..5a37eba 100644
--- a/dlls/mfplat/main.c
+++ b/dlls/mfplat/main.c
@@ -962,11 +962,23 @@ static HRESULT WINAPI mfattributes_DeleteItem(IMFAttributes *iface, REFGUID key)
static HRESULT WINAPI mfattributes_DeleteAllItems(IMFAttributes *iface)
{
- mfattributes *This = impl_from_IMFAttributes(iface);
+ struct attributes *attributes = impl_from_IMFAttributes(iface);
- FIXME("%p\n", This);
+ TRACE("%p.\n", iface);
- return E_NOTIMPL;
+ EnterCriticalSection(&attributes->cs);
+
+ while (attributes->count)
+ {
+ PropVariantClear(&attributes->attributes[--attributes->count].value);
+ }
+ heap_free(attributes->attributes);
+ attributes->attributes = NULL;
+ attributes->capacity = 0;
+
+ LeaveCriticalSection(&attributes->cs);
+
+ return S_OK;
}
static HRESULT WINAPI mfattributes_SetUINT32(IMFAttributes *iface, REFGUID key, UINT32 value)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c
index 5579e02..a999b9b 100644
--- a/dlls/mfplat/tests/mfplat.c
+++ b/dlls/mfplat/tests/mfplat.c
@@ -714,6 +714,10 @@ static void test_MFCreateAttributes(void)
hr = IMFAttributes_GetUnknown(attributes, &DUMMY_CLSID, &IID_IUnknown, (void **)&unk_value);
ok(hr == MF_E_INVALIDTYPE, "Unexpected hr %#x.\n", hr);
+ hr = IMFAttributes_DeleteAllItems(attributes);
+ ok(hr == S_OK, "Failed to delete items, hr %#x.\n", hr);
+ CHECK_ATTR_COUNT(attributes, 0);
+
IMFAttributes_Release(attributes);
}
More information about the wine-cvs
mailing list