Module: wine Branch: master Commit: 0e55fb682f4f4085e516ef03002fecbe09114e65 URL: http://source.winehq.org/git/wine.git/?a=commit;h=0e55fb682f4f4085e516ef0300...
Author: Dmitry Timoshkov dmitry@baikal.ru Date: Wed Jun 20 14:00:25 2012 +0900
windowscodecs: Implement MetadataHandler_GetValueByIndex.
---
dlls/windowscodecs/metadatahandler.c | 28 +++++++++++++++++++++++++--- dlls/windowscodecs/tests/metadata.c | 6 ------ 2 files changed, 25 insertions(+), 9 deletions(-)
diff --git a/dlls/windowscodecs/metadatahandler.c b/dlls/windowscodecs/metadatahandler.c index f8b8fcb..9f36d65 100644 --- a/dlls/windowscodecs/metadatahandler.c +++ b/dlls/windowscodecs/metadatahandler.c @@ -185,10 +185,32 @@ static HRESULT WINAPI MetadataHandler_GetCount(IWICMetadataWriter *iface, }
static HRESULT WINAPI MetadataHandler_GetValueByIndex(IWICMetadataWriter *iface, - UINT nIndex, PROPVARIANT *pvarSchema, PROPVARIANT *pvarId, PROPVARIANT *pvarValue) + UINT index, PROPVARIANT *schema, PROPVARIANT *id, PROPVARIANT *value) { - FIXME("(%p,%u,%p,%p,%p): stub\n", iface, nIndex, pvarSchema, pvarId, pvarValue); - return E_NOTIMPL; + HRESULT hr = S_OK; + MetadataHandler *This = impl_from_IWICMetadataWriter(iface); + + TRACE("%p,%u,%p,%p,%p\n", iface, index, schema, id, value); + + EnterCriticalSection(&This->lock); + + if (index >= This->item_count) + { + LeaveCriticalSection(&This->lock); + return E_INVALIDARG; + } + + if (schema) + hr = PropVariantCopy(schema, &This->items[index].schema); + + if (SUCCEEDED(hr) && id) + hr = PropVariantCopy(id, &This->items[index].id); + + if (SUCCEEDED(hr) && value) + hr = PropVariantCopy(value, &This->items[index].value); + + LeaveCriticalSection(&This->lock); + return hr; }
static HRESULT WINAPI MetadataHandler_GetValue(IWICMetadataWriter *iface, diff --git a/dlls/windowscodecs/tests/metadata.c b/dlls/windowscodecs/tests/metadata.c index e746c89..3c433bd 100644 --- a/dlls/windowscodecs/tests/metadata.c +++ b/dlls/windowscodecs/tests/metadata.c @@ -425,13 +425,7 @@ static void test_metadata_IFD(void) ok(hr == E_INVALIDARG, "GetMetadataFormat should fail\n");
hr = IWICMetadataReader_GetValueByIndex(reader, 0, NULL, NULL, NULL); -todo_wine ok(hr == S_OK, "GetValueByIndex error %#x\n", hr); - if (FAILED(hr)) - { - IWICMetadataReader_Release(reader); - return; - }
hr = IWICMetadataReader_GetValueByIndex(reader, count - 1, NULL, NULL, NULL); ok(hr == S_OK, "GetValueByIndex error %#x\n", hr);