Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
e91b05bb
Commit
e91b05bb
authored
May 31, 2021
by
Nikolay Sivov
Committed by
Alexandre Julliard
May 31, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
propsys: Add support for VT_VECTOR|VT_UI1 type in PropVariantCompareEx().
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c7339d62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
85 additions
and
3 deletions
+85
-3
propvar.c
dlls/propsys/propvar.c
+12
-1
propsys.c
dlls/propsys/tests/propsys.c
+73
-2
No files found.
dlls/propsys/propvar.c
View file @
e91b05bb
...
...
@@ -798,7 +798,10 @@ static BOOL isemptyornull(const PROPVARIANT *propvar)
if
(
propvar
->
vt
==
VT_CLSID
)
return
!
propvar
->
puuid
;
/* FIXME: vectors, byrefs, errors? */
if
(
propvar
->
vt
&
VT_VECTOR
)
return
!
propvar
->
caub
.
cElems
;
/* FIXME: byrefs, errors? */
return
FALSE
;
}
...
...
@@ -807,6 +810,7 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
{
const
PROPVARIANT
*
propvar2_converted
;
PROPVARIANT
propvar2_static
;
unsigned
int
count
;
HRESULT
hr
;
INT
res
=-
1
;
...
...
@@ -894,6 +898,13 @@ INT WINAPI PropVariantCompareEx(REFPROPVARIANT propvar1, REFPROPVARIANT propvar2
res
=
memcmp
(
propvar1
->
puuid
,
propvar2
->
puuid
,
sizeof
(
*
propvar1
->
puuid
));
if
(
res
)
res
=
res
>
0
?
1
:
-
1
;
break
;
case
VT_VECTOR
|
VT_UI1
:
count
=
min
(
propvar1
->
caub
.
cElems
,
propvar2
->
caub
.
cElems
);
res
=
count
?
memcmp
(
propvar1
->
caub
.
pElems
,
propvar2
->
caub
.
pElems
,
sizeof
(
*
propvar1
->
caub
.
pElems
)
*
count
)
:
0
;
if
(
res
)
res
=
res
>
0
?
1
:
-
1
;
if
(
!
res
&&
propvar1
->
caub
.
cElems
!=
propvar2
->
caub
.
cElems
)
res
=
propvar1
->
caub
.
cElems
>
propvar2
->
caub
.
cElems
?
1
:
-
1
;
break
;
default:
FIXME
(
"vartype %#x not handled
\n
"
,
propvar1
->
vt
);
res
=
-
1
;
...
...
dlls/propsys/tests/propsys.c
View file @
e91b05bb
...
...
@@ -666,15 +666,18 @@ static void test_PropVariantToStringAlloc(void)
CoTaskMemFree
(
str
);
}
static
void
test_PropVariantCompare
(
void
)
static
void
test_PropVariantCompare
Ex
(
void
)
{
PROPVARIANT
empty
,
null
,
emptyarray
,
i2_0
,
i2_2
,
i4_large
,
i4_largeneg
,
i4_2
,
str_2
,
str_02
,
str_b
;
PROPVARIANT
clsid_null
,
clsid
,
clsid2
,
r4_0
,
r4_2
,
r8_0
,
r8_2
;
PROPVARIANT
var1
,
var2
;
INT
res
;
static
const
WCHAR
str_2W
[]
=
{
'2'
,
0
};
static
const
WCHAR
str_02W
[]
=
{
'0'
,
'2'
,
0
};
static
const
WCHAR
str_bW
[]
=
{
'b'
,
0
};
SAFEARRAY
emptysafearray
;
unsigned
char
bytevector1
[]
=
{
1
,
2
,
3
};
unsigned
char
bytevector2
[]
=
{
4
,
5
,
6
};
PropVariantInit
(
&
empty
);
PropVariantInit
(
&
null
);
...
...
@@ -847,6 +850,74 @@ todo_wine
res
=
PropVariantCompareEx
(
&
r8_2
,
&
r8_0
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
/* VT_VECTOR | VT_UI1 */
var1
.
vt
=
VT_VECTOR
|
VT_UI1
;
var1
.
caub
.
cElems
=
1
;
var1
.
caub
.
pElems
=
bytevector1
;
var2
.
vt
=
VT_VECTOR
|
VT_UI1
;
var2
.
caub
.
cElems
=
1
;
var2
.
caub
.
pElems
=
bytevector2
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
-
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var2
,
&
var1
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
/* Vector length mismatch */
var1
.
caub
.
cElems
=
2
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
-
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var2
,
&
var1
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
var1
.
caub
.
pElems
=
bytevector2
;
var2
.
caub
.
pElems
=
bytevector1
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
var1
.
caub
.
pElems
=
bytevector1
;
var2
.
caub
.
pElems
=
bytevector2
;
var1
.
caub
.
cElems
=
1
;
var2
.
caub
.
cElems
=
2
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
-
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var2
,
&
var1
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
/* Length mismatch over same data */
var1
.
caub
.
pElems
=
bytevector1
;
var2
.
caub
.
pElems
=
bytevector1
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
-
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var2
,
&
var1
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
var1
.
caub
.
cElems
=
1
;
var2
.
caub
.
cElems
=
1
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
0
,
"res=%i
\n
"
,
res
);
var1
.
caub
.
cElems
=
0
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
PVCF_TREATEMPTYASGREATERTHAN
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var2
,
&
var1
,
0
,
PVCF_TREATEMPTYASGREATERTHAN
);
ok
(
res
==
-
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
-
1
,
"res=%i
\n
"
,
res
);
res
=
PropVariantCompareEx
(
&
var2
,
&
var1
,
0
,
0
);
ok
(
res
==
1
,
"res=%i
\n
"
,
res
);
var2
.
caub
.
cElems
=
0
;
res
=
PropVariantCompareEx
(
&
var1
,
&
var2
,
0
,
0
);
ok
(
res
==
0
,
"res=%i
\n
"
,
res
);
SysFreeString
(
str_2
.
bstrVal
);
SysFreeString
(
str_02
.
bstrVal
);
SysFreeString
(
str_b
.
bstrVal
);
...
...
@@ -1957,7 +2028,7 @@ START_TEST(propsys)
test_InitPropVariantFromBuffer
();
test_PropVariantToGUID
();
test_PropVariantToStringAlloc
();
test_PropVariantCompare
();
test_PropVariantCompare
Ex
();
test_intconversions
();
test_PropVariantChangeType_LPWSTR
();
test_PropVariantToBoolean
();
...
...
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