Nikolay Sivov : mfplat: Do not make a copy when returning GUID attributes (Valgrind).
Module: wine Branch: master Commit: c091f9b7f6cbc776f0448c0879bf9dbe472de720 URL: https://source.winehq.org/git/wine.git/?a=commit;h=c091f9b7f6cbc776f0448c087... Author: Nikolay Sivov <nsivov(a)codeweavers.com> Date: Tue Nov 26 13:35:29 2019 +0300 mfplat: Do not make a copy when returning GUID attributes (Valgrind). Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/mfplat/main.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/dlls/mfplat/main.c b/dlls/mfplat/main.c index 48e64adeef..6336b1b347 100644 --- a/dlls/mfplat/main.c +++ b/dlls/mfplat/main.c @@ -1349,14 +1349,23 @@ HRESULT attributes_GetDouble(struct attributes *attributes, REFGUID key, double HRESULT attributes_GetGUID(struct attributes *attributes, REFGUID key, GUID *value) { - PROPVARIANT attrval; - HRESULT hr; + struct attribute *attribute; + HRESULT hr = S_OK; - PropVariantInit(&attrval); - attrval.vt = VT_CLSID; - hr = attributes_get_item(attributes, key, &attrval); - if (SUCCEEDED(hr)) - *value = *attrval.u.puuid; + EnterCriticalSection(&attributes->cs); + + attribute = attributes_find_item(attributes, key, NULL); + if (attribute) + { + if (attribute->value.vt == MF_ATTRIBUTE_GUID) + *value = *attribute->value.u.puuid; + else + hr = MF_E_INVALIDTYPE; + } + else + hr = MF_E_ATTRIBUTENOTFOUND; + + LeaveCriticalSection(&attributes->cs); return hr; }
participants (1)
-
Alexandre Julliard