Nikolay Sivov : scrrun: Implement put_Key() for dictionary.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Mar 3 09:42:10 CST 2015
Module: wine
Branch: master
Commit: a25f1931a61b2536ab036b7b02322b053a8ddab9
URL: http://source.winehq.org/git/wine.git/?a=commit;h=a25f1931a61b2536ab036b7b02322b053a8ddab9
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Feb 27 18:25:06 2015 +0300
scrrun: Implement put_Key() for dictionary.
---
dlls/scrrun/dictionary.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c
index 6543aa0..8d534e7 100644
--- a/dlls/scrrun/dictionary.c
+++ b/dlls/scrrun/dictionary.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Alistair Leslie-Hughes
+ * Copyright 2015 Nikolay Sivov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -420,13 +421,28 @@ static HRESULT WINAPI dictionary_Items(IDictionary *iface, VARIANT *items)
return S_OK;
}
-static HRESULT WINAPI dictionary_put_Key(IDictionary *iface, VARIANT *Key, VARIANT *rhs)
+static HRESULT WINAPI dictionary_put_Key(IDictionary *iface, VARIANT *key, VARIANT *newkey)
{
dictionary *This = impl_from_IDictionary(iface);
+ struct keyitem_pair *pair;
+ VARIANT empty;
+ HRESULT hr;
- FIXME("(%p)->(%p %p)\n", This, Key, rhs);
+ TRACE("(%p)->(%s %s)\n", This, debugstr_variant(key), debugstr_variant(newkey));
- return E_NOTIMPL;
+ if ((pair = get_keyitem_pair(This, key))) {
+ /* found existing pair for a key, add new pair with new key
+ and old item and remove old pair after that */
+
+ hr = IDictionary_Add(iface, newkey, &pair->item);
+ if (FAILED(hr))
+ return hr;
+
+ return IDictionary_Remove(iface, key);
+ }
+
+ VariantInit(&empty);
+ return IDictionary_Add(iface, newkey, &empty);
}
static HRESULT WINAPI dictionary_Keys(IDictionary *iface, VARIANT *keys)
More information about the wine-cvs
mailing list