scrrun: Support BYREF types for integer keys.
This commit is contained in:
parent
94a1838b7e
commit
f70ddf7614
|
@ -795,14 +795,17 @@ static HRESULT WINAPI dictionary_get_HashVal(IDictionary *iface, VARIANT *key, V
|
||||||
case VT_BSTR:
|
case VT_BSTR:
|
||||||
V_I4(hash) = get_str_hash(get_key_strptr(key), This->method);
|
V_I4(hash) = get_str_hash(get_key_strptr(key), This->method);
|
||||||
break;
|
break;
|
||||||
|
case VT_UI1|VT_BYREF:
|
||||||
case VT_UI1:
|
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;
|
break;
|
||||||
|
case VT_I2|VT_BYREF:
|
||||||
case VT_I2:
|
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;
|
break;
|
||||||
|
case VT_I4|VT_BYREF:
|
||||||
case VT_I4:
|
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;
|
break;
|
||||||
case VT_UNKNOWN|VT_BYREF:
|
case VT_UNKNOWN|VT_BYREF:
|
||||||
case VT_DISPATCH|VT_BYREF:
|
case VT_DISPATCH|VT_BYREF:
|
||||||
|
|
|
@ -429,6 +429,10 @@ static void test_hash_value(void)
|
||||||
ok(V_I4(&hash) == ~0u, "got hash 0x%08x\n", V_I4(&hash));
|
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++) {
|
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]);
|
expected = get_num_hash(int_hash_tests[i]);
|
||||||
|
|
||||||
V_VT(&key) = VT_I2;
|
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),
|
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||||
expected);
|
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_VT(&key) = VT_I4;
|
||||||
V_I4(&key) = int_hash_tests[i];
|
V_I4(&key) = int_hash_tests[i];
|
||||||
VariantInit(&hash);
|
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),
|
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||||
expected);
|
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]);
|
expected = get_num_hash((FLOAT)(BYTE)int_hash_tests[i]);
|
||||||
V_VT(&key) = VT_UI1;
|
V_VT(&key) = VT_UI1;
|
||||||
V_UI1(&key) = int_hash_tests[i];
|
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_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),
|
ok(V_I4(&hash) == expected, "%d: got hash 0x%08x, expected 0x%08x\n", i, V_I4(&hash),
|
||||||
expected);
|
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 */
|
/* nan */
|
||||||
|
|
Loading…
Reference in New Issue