[PATCH 11/11] mfplat: Implement IMFAttributes::DeleteAllItems().

Nikolay Sivov nsivov at codeweavers.com
Thu Mar 14 03:03:16 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         | 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 31bed3340e..5a37ebab21 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 5579e02953..a999b9bbe9 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);
 }
 
-- 
2.20.1




More information about the wine-devel mailing list