scrrun: Implement Remove() for dictionary.

This commit is contained in:
Nikolay Sivov 2015-02-27 18:15:10 +03:00 committed by Alexandre Julliard
parent 1bc4c57e55
commit acfde52f06
2 changed files with 13 additions and 5 deletions

View File

@ -404,13 +404,23 @@ static HRESULT WINAPI dictionary_Keys(IDictionary *iface, VARIANT *pKeysArray)
return E_NOTIMPL;
}
static HRESULT WINAPI dictionary_Remove(IDictionary *iface, VARIANT *Key)
static HRESULT WINAPI dictionary_Remove(IDictionary *iface, VARIANT *key)
{
dictionary *This = impl_from_IDictionary(iface);
struct keyitem_pair *pair;
FIXME("(%p)->(%p)\n", This, Key);
TRACE("(%p)->(%p)\n", This, debugstr_variant(key));
return E_NOTIMPL;
if (!(pair = get_keyitem_pair(This, key)))
return CTL_E_ELEMENT_NOT_FOUND;
list_remove(&pair->entry);
if (This->buckets[pair->bucket] == pair)
This->buckets[pair->bucket] = NULL;
This->count--;
free_keyitem_pair(pair);
return S_OK;
}
static HRESULT WINAPI dictionary_RemoveAll(IDictionary *iface)

View File

@ -560,7 +560,6 @@ if (0)
V_VT(&key) = VT_R4;
V_R4(&key) = 0.0;
hr = IDictionary_Remove(dict, &key);
todo_wine
ok(hr == CTL_E_ELEMENT_NOT_FOUND, "got 0x%08x\n", hr);
VariantInit(&item);
@ -568,7 +567,6 @@ todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
hr = IDictionary_Remove(dict, &key);
todo_wine
ok(hr == S_OK, "got 0x%08x\n", hr);
IDictionary_Release(dict);