Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
94a1838b
Commit
94a1838b
authored
Mar 23, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 23, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
scrrun: Added support for VT_DATE keys, and BYREF float key types.
parent
5189dc41
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
83 additions
and
15 deletions
+83
-15
dictionary.c
dlls/scrrun/dictionary.c
+23
-15
dictionary.c
dlls/scrrun/tests/dictionary.c
+60
-0
No files found.
dlls/scrrun/dictionary.c
View file @
94a1838b
...
...
@@ -761,6 +761,22 @@ static DWORD get_num_hash(FLOAT num)
return
(
*
((
DWORD
*
)
&
num
))
%
DICT_HASH_MOD
;
}
static
HRESULT
get_flt_hash
(
FLOAT
flt
,
LONG
*
hash
)
{
if
(
isinf
(
flt
))
{
*
hash
=
0
;
return
S_OK
;
}
else
if
(
!
isnan
(
flt
))
{
*
hash
=
get_num_hash
(
flt
);
return
S_OK
;
}
/* NaN case */
*
hash
=
~
0u
;
return
CTL_E_ILLEGALFUNCTIONCALL
;
}
static
DWORD
get_ptr_hash
(
void
*
ptr
)
{
return
PtrToUlong
(
ptr
)
%
DICT_HASH_MOD
;
...
...
@@ -810,23 +826,15 @@ static HRESULT WINAPI dictionary_get_HashVal(IDictionary *iface, VARIANT *key, V
IUnknown_Release
(
unk
);
break
;
}
case
VT_DATE
|
VT_BYREF
:
case
VT_DATE
:
return
get_flt_hash
(
V_VT
(
key
)
&
VT_BYREF
?
*
V_DATEREF
(
key
)
:
V_DATE
(
key
),
&
V_I4
(
hash
));
case
VT_R4
|
VT_BYREF
:
case
VT_R4
:
return
get_flt_hash
(
V_VT
(
key
)
&
VT_BYREF
?
*
V_R4REF
(
key
)
:
V_R4
(
key
),
&
V_I4
(
hash
));
case
VT_R8
|
VT_BYREF
:
case
VT_R8
:
{
FLOAT
flt
=
V_VT
(
key
)
==
VT_R4
?
V_R4
(
key
)
:
V_R8
(
key
);
if
(
isinf
(
flt
))
{
V_I4
(
hash
)
=
0
;
break
;
}
else
if
(
!
isnan
(
flt
))
{
V_I4
(
hash
)
=
get_num_hash
(
flt
);
break
;
}
/* fallthrough on NAN */
}
return
get_flt_hash
(
V_VT
(
key
)
&
VT_BYREF
?
*
V_R8REF
(
key
)
:
V_R8
(
key
),
&
V_I4
(
hash
));
case
VT_INT
:
case
VT_UINT
:
case
VT_I1
:
...
...
dlls/scrrun/tests/dictionary.c
View file @
94a1838b
...
...
@@ -499,6 +499,15 @@ static void test_hash_value(void)
ok
(
V_I4
(
&
hash
)
==
~
0u
||
broken
(
V_I4
(
&
hash
)
==
0
/* win2k */
||
V_I4
(
&
hash
)
==
0x1f4
/* vista, win2k8 */
),
"got hash 0x%08x
\n
"
,
V_I4
(
&
hash
));
V_VT
(
&
key
)
=
VT_DATE
;
V_DATE
(
&
key
)
=
fx8
.
d
;
VariantInit
(
&
hash
);
hr
=
IDictionary_get_HashVal
(
dict
,
&
key
,
&
hash
);
ok
(
hr
==
CTL_E_ILLEGALFUNCTIONCALL
||
broken
(
hr
==
S_OK
)
/* win2k, win2k3 */
,
"got 0x%08x
\n
"
,
hr
);
ok
(
V_VT
(
&
hash
)
==
VT_I4
,
"got %d
\n
"
,
V_VT
(
&
hash
));
ok
(
V_I4
(
&
hash
)
==
~
0u
||
broken
(
V_I4
(
&
hash
)
==
0
/* win2k */
||
V_I4
(
&
hash
)
==
0x1f4
/* vista, win2k8 */
),
"got hash 0x%08x
\n
"
,
V_I4
(
&
hash
));
/* inf */
fx8
.
d
=
10
.
0
;
fx8
.
i
.
m_lo
=
0
;
...
...
@@ -513,7 +522,19 @@ static void test_hash_value(void)
ok
(
V_VT
(
&
hash
)
==
VT_I4
,
"got %d
\n
"
,
V_VT
(
&
hash
));
ok
(
V_I4
(
&
hash
)
==
0
,
"got hash 0x%08x
\n
"
,
V_I4
(
&
hash
));
V_VT
(
&
key
)
=
VT_DATE
;
V_DATE
(
&
key
)
=
fx8
.
d
;
V_I4
(
&
hash
)
=
10
;
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
)
==
0
,
"got hash 0x%08x
\n
"
,
V_I4
(
&
hash
));
for
(
i
=
0
;
i
<
sizeof
(
float_hash_tests
)
/
sizeof
(
float_hash_tests
[
0
]);
i
++
)
{
double
dbl
;
FLOAT
flt
;
DATE
date
;
expected
=
get_num_hash
(
float_hash_tests
[
i
]);
V_VT
(
&
key
)
=
VT_R4
;
...
...
@@ -525,6 +546,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
);
flt
=
float_hash_tests
[
i
];
V_VT
(
&
key
)
=
VT_R4
|
VT_BYREF
;
V_R4REF
(
&
key
)
=
&
flt
;
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_R8
;
V_R8
(
&
key
)
=
float_hash_tests
[
i
];
VariantInit
(
&
hash
);
...
...
@@ -533,6 +564,35 @@ 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
);
dbl
=
float_hash_tests
[
i
];
V_VT
(
&
key
)
=
VT_R8
|
VT_BYREF
;
V_R8REF
(
&
key
)
=
&
dbl
;
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_DATE
;
V_DATE
(
&
key
)
=
float_hash_tests
[
i
];
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_DATE
|
VT_BYREF
;
date
=
float_hash_tests
[
i
];
V_DATEREF
(
&
key
)
=
&
date
;
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
);
}
/* interface pointers as keys */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment