Nikolay Sivov : scrrun: Support BYREF types for integer keys.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 23 10:03:19 CDT 2015


Module: wine
Branch: master
Commit: f70ddf76140fd808996c726d1ce3495081f78467
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f70ddf76140fd808996c726d1ce3495081f78467

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Mar 23 08:19:12 2015 +0300

scrrun: Support BYREF types for integer keys.

---

 dlls/scrrun/dictionary.c       |  9 ++++++---
 dlls/scrrun/tests/dictionary.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dlls/scrrun/dictionary.c b/dlls/scrrun/dictionary.c
index 2dc5d2c..cce8a37 100644
--- a/dlls/scrrun/dictionary.c
+++ b/dlls/scrrun/dictionary.c
@@ -795,14 +795,17 @@ static HRESULT WINAPI dictionary_get_HashVal(IDictionary *iface, VARIANT *key, V
     case VT_BSTR:
         V_I4(hash) = get_str_hash(get_key_strptr(key), This->method);
         break;
+    case VT_UI1|VT_BYREF:
     case VT_UI1:
-        V_I4(hash) = get_num_hash(V_UI1(key));
+        V_I4(hash) = get_num_hash(V_VT(key) & VT_BYREF ? *V_UI1REF(key) : V_UI1(key));
         break;
+    case VT_I2|VT_BYREF:
     case VT_I2:
-        V_I4(hash) = get_num_hash(V_I2(key));
+        V_I4(hash) = get_num_hash(V_VT(key) & VT_BYREF ? *V_I2REF(key) : V_I2(key));
         break;
+    case VT_I4|VT_BYREF:
     case VT_I4:
-        V_I4(hash) = get_num_hash(V_I4(key));
+        V_I4(hash) = get_num_hash(V_VT(key) & VT_BYREF ? *V_I4REF(key) : V_I4(key));
         break;
     case VT_UNKNOWN|VT_BYREF:
     case VT_DISPATCH|VT_BYREF:
diff --git a/dlls/scrrun/tests/dictionary.c b/dlls/scrrun/tests/dictionary.c
index f53222f..e1c80f9 100644
--- a/dlls/scrrun/tests/dictionary.c
+++ b/dlls/scrrun/tests/dictionary.c
@@ -429,6 +429,10 @@ static void test_hash_value(void)
     ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
 
     for (i = 0; i < sizeof(int_hash_tests)/sizeof(int_hash_tests[0]); i++) {
+        SHORT i2;
+        BYTE ui1;
+        LONG i4;
+
         expected = get_num_hash(int_hash_tests[i]);
 
         V_VT(&key) = VT_I2;
@@ -440,6 +444,16 @@ static void test_hash_value(void)
         ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
             expected);
 
+        i2 = int_hash_tests[i];
+        V_VT(&key) = VT_I2|VT_BYREF;
+        V_I2REF(&key) = &i2;
+        VariantInit(&hash);
+        hr = IDictionary_get_HashVal(dict, &key, &hash);
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
+        ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
+            expected);
+
         V_VT(&key) = VT_I4;
         V_I4(&key) = int_hash_tests[i];
         VariantInit(&hash);
@@ -449,6 +463,16 @@ static void test_hash_value(void)
         ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
             expected);
 
+        i4 = int_hash_tests[i];
+        V_VT(&key) = VT_I4|VT_BYREF;
+        V_I4REF(&key) = &i4;
+        VariantInit(&hash);
+        hr = IDictionary_get_HashVal(dict, &key, &hash);
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
+        ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
+            expected);
+
         expected = get_num_hash((FLOAT)(BYTE)int_hash_tests[i]);
         V_VT(&key) = VT_UI1;
         V_UI1(&key) = int_hash_tests[i];
@@ -458,6 +482,16 @@ static void test_hash_value(void)
         ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
         ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
             expected);
+
+        ui1 = int_hash_tests[i];
+        V_VT(&key) = VT_UI1|VT_BYREF;
+        V_UI1REF(&key) = &ui1;
+        VariantInit(&hash);
+        hr = IDictionary_get_HashVal(dict, &key, &hash);
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(V_VT(&hash) == VT_I4, "got %d\n", V_VT(&hash));
+        ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
+            expected);
     }
 
     /* nan */




More information about the wine-cvs mailing list