Nikolay Sivov : scrrun: Implement Remove() for dictionary.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 2 08:51:51 CST 2015
Module: wine
Branch: master
Commit: acfde52f06eb9800faae0a1d537ff064da50758f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=acfde52f06eb9800faae0a1d537ff064da50758f
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Feb 27 18:15:10 2015 +0300
scrrun: Implement Remove() for dictionary.
---
dlls/scrrun/dictionary.c | 16 +++++++++++++---
dlls/scrrun/tests/dictionary.c | 2 --
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c
index a7c90db..2306fad 100644
--- a/dlls/scrrun/dictionary.c
+++ b/dlls/scrrun/dictionary.c
@@ -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)
diff --git a/dlls/scrrun/tests/dictionary.c b/dlls/scrrun/tests/dictionary.c
index c9e71a5..deeea50 100644
--- a/dlls/scrrun/tests/dictionary.c
+++ b/dlls/scrrun/tests/dictionary.c
@@ -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);
More information about the wine-cvs
mailing list