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
3fc11806
Commit
3fc11806
authored
Feb 07, 2019
by
Jactry Zeng
Committed by
Alexandre Julliard
Feb 14, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
propsys: Implement PropVariantToDouble().
Signed-off-by:
Jactry Zeng
<
jzeng@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2e2fc550
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
77 additions
and
1 deletion
+77
-1
propsys.spec
dlls/propsys/propsys.spec
+1
-1
propvar.c
dlls/propsys/propvar.c
+18
-0
propsys.c
dlls/propsys/tests/propsys.c
+57
-0
propvarutil.h
include/propvarutil.h
+1
-0
No files found.
dlls/propsys/propsys.spec
View file @
3fc11806
...
...
@@ -112,7 +112,7 @@
@ stub PropVariantToBooleanVectorAlloc
@ stub PropVariantToBooleanWithDefault
@ stub PropVariantToBuffer
@ st
ub PropVariantToDouble
@ st
dcall PropVariantToDouble(ptr ptr)
@ stub PropVariantToDoubleVector
@ stub PropVariantToDoubleVectorAlloc
@ stub PropVariantToDoubleWithDefault
...
...
dlls/propsys/propvar.c
View file @
3fc11806
...
...
@@ -129,6 +129,12 @@ static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits,
src_signed
=
*
res
<
0
;
break
;
}
case
VT_R8
:
{
src_signed
=
TRUE
;
*
res
=
pv
->
u
.
dblVal
;
break
;
}
default:
FIXME
(
"unhandled vt %d
\n
"
,
pv
->
vt
);
return
E_NOTIMPL
;
...
...
@@ -155,6 +161,18 @@ static HRESULT PROPVAR_ConvertNumber(REFPROPVARIANT pv, int dest_bits,
return
S_OK
;
}
HRESULT
WINAPI
PropVariantToDouble
(
REFPROPVARIANT
propvarIn
,
double
*
ret
)
{
LONGLONG
res
;
HRESULT
hr
;
TRACE
(
"(%p, %p)
\n
"
,
propvarIn
,
ret
);
hr
=
PROPVAR_ConvertNumber
(
propvarIn
,
64
,
TRUE
,
&
res
);
if
(
SUCCEEDED
(
hr
))
*
ret
=
(
double
)
res
;
return
hr
;
}
HRESULT
WINAPI
PropVariantToInt16
(
REFPROPVARIANT
propvarIn
,
SHORT
*
ret
)
{
LONGLONG
res
;
...
...
dlls/propsys/tests/propsys.c
View file @
3fc11806
...
...
@@ -1248,6 +1248,62 @@ static void test_InitPropVariantFromCLSID(void)
PropVariantClear
(
&
propvar
);
}
static
void
test_PropVariantToDouble
(
void
)
{
PROPVARIANT
propvar
;
double
value
;
HRESULT
hr
;
PropVariantInit
(
&
propvar
);
propvar
.
vt
=
VT_R8
;
propvar
.
u
.
dblVal
=
15
.
0
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
15
.
0
,
"Unexpected value: %f.
\n
"
,
value
);
PropVariantClear
(
&
propvar
);
propvar
.
vt
=
VT_I4
;
propvar
.
u
.
lVal
=
123
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
123
.
0
,
"Unexpected value: %f.
\n
"
,
value
);
PropVariantClear
(
&
propvar
);
propvar
.
vt
=
VT_I4
;
propvar
.
u
.
lVal
=
-
256
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
-
256
,
"Unexpected value: %f
\n
"
,
value
);
PropVariantClear
(
&
propvar
);
propvar
.
vt
=
VT_I8
;
propvar
.
u
.
lVal
=
65536
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
65536
.
0
,
"Unexpected value: %f.
\n
"
,
value
);
PropVariantClear
(
&
propvar
);
propvar
.
vt
=
VT_I8
;
propvar
.
u
.
lVal
=
-
321
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
4294966975
.
0
,
"Unexpected value: %f.
\n
"
,
value
);
PropVariantClear
(
&
propvar
);
propvar
.
vt
=
VT_UI4
;
propvar
.
u
.
ulVal
=
6
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
6
.
0
,
"Unexpected value: %f.
\n
"
,
value
);
PropVariantClear
(
&
propvar
);
propvar
.
vt
=
VT_UI8
;
propvar
.
u
.
uhVal
.
QuadPart
=
8
;
hr
=
PropVariantToDouble
(
&
propvar
,
&
value
);
ok
(
hr
==
S_OK
,
"PropVariantToDouble failed: 0x%08x.
\n
"
,
hr
);
ok
(
value
==
8
.
0
,
"Unexpected value: %f.
\n
"
,
value
);
}
START_TEST
(
propsys
)
{
test_PSStringFromPropertyKey
();
...
...
@@ -1263,4 +1319,5 @@ START_TEST(propsys)
test_PropVariantToBoolean
();
test_PropVariantToStringWithDefault
();
test_InitPropVariantFromCLSID
();
test_PropVariantToDouble
();
}
include/propvarutil.h
View file @
3fc11806
...
...
@@ -71,6 +71,7 @@ HRESULT WINAPI VariantToGUID(const VARIANT *pvar, GUID *guid);
INT
WINAPI
PropVariantCompareEx
(
REFPROPVARIANT
propvar1
,
REFPROPVARIANT
propvar2
,
PROPVAR_COMPARE_UNIT
uint
,
PROPVAR_COMPARE_FLAGS
flags
);
HRESULT
WINAPI
PropVariantToDouble
(
REFPROPVARIANT
propvarIn
,
double
*
ret
);
HRESULT
WINAPI
PropVariantToInt16
(
REFPROPVARIANT
propvarIn
,
SHORT
*
ret
);
HRESULT
WINAPI
PropVariantToInt32
(
REFPROPVARIANT
propvarIn
,
LONG
*
ret
);
HRESULT
WINAPI
PropVariantToInt64
(
REFPROPVARIANT
propvarIn
,
LONGLONG
*
ret
);
...
...
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