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
743b75ab
Commit
743b75ab
authored
Mar 22, 2004
by
Jon Griffiths
Committed by
Alexandre Julliard
Mar 22, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement VarXor and simplify VarEqv to use it.
parent
b74750c1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
58 deletions
+71
-58
oleaut32.spec
dlls/oleaut32/oleaut32.spec
+1
-1
variant.c
dlls/oleaut32/variant.c
+70
-57
No files found.
dlls/oleaut32/oleaut32.spec
View file @
743b75ab
...
...
@@ -162,7 +162,7 @@
164 stdcall QueryPathOfRegTypeLib(ptr long long long ptr)
165 stdcall LHashValOfNameSys(long long wstr)
166 stdcall LHashValOfNameSysA(long long str)
167 st
ub VarXor # stdcall
(ptr ptr ptr)
167 st
dcall VarXor
(ptr ptr ptr)
168 stdcall VarAbs(ptr ptr)
169 stdcall VarFix(ptr ptr)
170 stdcall OaBuildVersion()
...
...
dlls/oleaut32/variant.c
View file @
743b75ab
...
...
@@ -3370,26 +3370,21 @@ HRESULT WINAPI VarInt(LPVARIANT pVarIn, LPVARIANT pVarOut)
}
/**********************************************************************
* Var
Eqv [OLEAUT32.172
]
* Var
Xor [OLEAUT32.167
]
*
*
Determine if two variants contain the same value
.
*
Perform a logical exclusive-or (XOR) operation on two variants
.
*
* PARAMS
* pVarLeft [I] First variant
to compare
* pVarRight [I] Variant to
compare to
pVarLeft
* pVarOut [O] Destination for
comparason
result
* pVarLeft [I] First variant
* pVarRight [I] Variant to
XOR with
pVarLeft
* pVarOut [O] Destination for
XOR
result
*
* RETURNS
* Success: S_OK. pVarOut contains the result of the comparason (VARIANT_TRUE
* if equivalent or VARIANT_FALSE or -2 otherwise, with type from the
* table below).
* Success: S_OK. pVarOut contains the result of the operation with its type
* taken from the table below).
* Failure: An HRESULT error code indicating the error.
*
* NOTES
* - Equvalence is defined as containing the same value if one variant is
* converted to the other.
* - Any value in pVarLeft or pVarRight that will not fit in a VT_I4 will
* cause overflow (This is compatable with the native implementation).
* - The result stored in pVarOut depends on the types of pVarLeft/pVarRight
* according to the following table:
*| Type 1 Type 2 Result Type
...
...
@@ -3412,9 +3407,9 @@ HRESULT WINAPI VarInt(LPVARIANT pVarIn, LPVARIANT pVarOut)
*| VT_BOOL VT_I2
*| All Other Combinations VT_UI4
*/
HRESULT
WINAPI
Var
Eqv
(
LPVARIANT
pVarLeft
,
LPVARIANT
pVarRight
,
LPVARIANT
pVarOut
)
HRESULT
WINAPI
Var
Xor
(
LPVARIANT
pVarLeft
,
LPVARIANT
pVarRight
,
LPVARIANT
pVarOut
)
{
VARTYPE
vt
=
VT_
U
I4
;
VARTYPE
vt
=
VT_I4
;
VARIANT
varLeft
,
varRight
;
HRESULT
hRet
;
...
...
@@ -3469,10 +3464,14 @@ HRESULT WINAPI VarEqv(LPVARIANT pVarLeft, LPVARIANT pVarRight, LPVARIANT pVarOut
/* Fall Through ... */
case
VT_DATE
:
case
VT_CY
:
case
VT_DECIMAL
:
case
VT_R4
:
case
VT_R8
:
case
VT_I1
:
case
VT_UI2
:
case
VT_I4
:
case
VT_UI4
:
case
VT_INT
:
case
VT_UINT
:
case
VT_
I8
:
case
VT_
UI8
:
case
VT_INT
:
case
VT_UINT
:
case
VT_UI8
:
V_VT
(
pVarOut
)
=
VT_I4
;
V_I4
(
pVarOut
)
=
VARIANT_FALSE
;
return
S_OK
;
case
VT_I8
:
V_VT
(
pVarOut
)
=
VT_I8
;
V_I4
(
pVarOut
)
=
VARIANT_FALSE
;
return
S_OK
;
default:
return
DISP_E_BADVARTYPE
;
}
...
...
@@ -3481,26 +3480,14 @@ HRESULT WINAPI VarEqv(LPVARIANT pVarLeft, LPVARIANT pVarRight, LPVARIANT pVarOut
if
(
V_VT
(
pVarLeft
)
==
VT_BOOL
&&
V_VT
(
pVarRight
)
==
VT_BOOL
)
{
V_VT
(
pVarOut
)
=
VT_BOOL
;
if
(
V_BOOL
(
pVarLeft
)
==
V_BOOL
(
pVarRight
))
V_BOOL
(
pVarOut
)
=
VARIANT_TRUE
;
else
if
(
V_BOOL
(
pVarLeft
)
==
VARIANT_TRUE
&&
V_BOOL
(
pVarRight
)
==
VARIANT_FALSE
)
{
V_BOOL
(
pVarOut
)
=
VARIANT_FALSE
;
}
else
if
(
V_BOOL
(
pVarLeft
)
==
VARIANT_FALSE
&&
V_BOOL
(
pVarRight
)
==
VARIANT_TRUE
)
{
V_BOOL
(
pVarOut
)
=
VARIANT_FALSE
;
}
else
V_BOOL
(
pVarOut
)
=
-
2
;
/* Go Figure; this matches native */
V_BOOL
(
pVarOut
)
=
V_BOOL
(
pVarLeft
)
^
V_BOOL
(
pVarRight
);
return
S_OK
;
}
if
(
V_VT
(
pVarLeft
)
==
VT_UI1
&&
V_VT
(
pVarRight
)
==
VT_UI1
)
{
V_VT
(
pVarOut
)
=
VT_UI1
;
V_UI1
(
pVarOut
)
=
V_UI1
(
pVarLeft
)
==
V_UI1
(
pVarRight
)
?
0xff
:
0xfe
;
V_UI1
(
pVarOut
)
=
V_UI1
(
pVarLeft
)
^
V_UI1
(
pVarRight
)
;
return
S_OK
;
}
...
...
@@ -3509,63 +3496,89 @@ HRESULT WINAPI VarEqv(LPVARIANT pVarLeft, LPVARIANT pVarRight, LPVARIANT pVarOut
(
V_VT
(
pVarRight
)
==
VT_BOOL
||
V_VT
(
pVarRight
)
==
VT_UI1
||
V_VT
(
pVarRight
)
==
VT_I2
))
vt
=
VT_I2
;
else
if
(
V_VT
(
pVarLeft
)
==
VT_I8
||
V_VT
(
pVarRight
)
==
VT_I8
)
{
if
(
V_VT
(
pVarLeft
)
==
VT_INT
||
V_VT
(
pVarRight
)
==
VT_INT
)
return
DISP_E_TYPEMISMATCH
;
vt
=
VT_I8
;
}
V_VT
(
&
varLeft
)
=
V_VT
(
&
varRight
)
=
VT_EMPTY
;
hRet
=
VariantCopy
(
&
varLeft
,
pVarLeft
);
if
(
FAILED
(
hRet
))
goto
Var
Eqv
_Exit
;
goto
Var
Xor
_Exit
;
hRet
=
VariantCopy
(
&
varRight
,
pVarRight
);
if
(
FAILED
(
hRet
))
goto
Var
Eqv
_Exit
;
goto
Var
Xor
_Exit
;
hRet
=
VariantChangeTypeEx
(
&
varLeft
,
pVarLeft
,
LOCALE_USER_DEFAULT
,
0
,
vt
);
if
(
FAILED
(
hRet
))
goto
Var
Eqv
_Exit
;
goto
Var
Xor
_Exit
;
hRet
=
VariantChangeTypeEx
(
&
varRight
,
pVarRight
,
LOCALE_USER_DEFAULT
,
0
,
vt
);
if
(
FAILED
(
hRet
))
goto
Var
Eqv
_Exit
;
goto
Var
Xor
_Exit
;
V_VT
(
pVarOut
)
=
vt
;
if
(
vt
==
VT_UI4
)
{
if
(
V_UI4
(
&
varLeft
)
==
V_UI4
(
&
varRight
))
V_UI4
(
pVarOut
)
=
VARIANT_TRUE
;
else
if
(
V_UI4
(
&
varLeft
)
==
VARIANT_TRUE
&&
V_UI4
(
&
varRight
)
==
VARIANT_FALSE
)
if
(
vt
==
VT_I8
)
{
V_UI4
(
pVarOut
)
=
VARIANT_FALSE
;
V_I8
(
pVarOut
)
=
V_I8
(
&
varLeft
)
^
V_I8
(
&
varRight
)
;
}
else
if
(
V_UI4
(
&
varLeft
)
==
VARIANT_FALSE
&&
V_UI4
(
&
varRight
)
==
VARIANT_TRUE
)
else
if
(
vt
==
VT_UI4
)
{
V_UI4
(
pVarOut
)
=
VARIANT_FALSE
;
V_I4
(
pVarOut
)
=
V_I4
(
&
varLeft
)
^
V_I4
(
&
varRight
)
;
}
else
V_UI4
(
pVarOut
)
=
-
2
;
}
else
{
if
(
V_I2
(
&
varLeft
)
==
V_I2
(
&
varRight
))
V_I2
(
pVarOut
)
=
VARIANT_TRUE
;
else
if
(
V_I2
(
&
varLeft
)
==
VARIANT_TRUE
&&
V_I2
(
&
varRight
)
==
VARIANT_FALSE
)
{
V_I2
(
pVarOut
)
=
VARIANT_FALSE
;
}
else
if
(
V_I2
(
&
varLeft
)
==
VARIANT_FALSE
&&
V_I2
(
&
varRight
)
==
VARIANT_TRUE
)
{
V_I2
(
pVarOut
)
=
VARIANT_FALSE
;
}
else
V_I2
(
pVarOut
)
=
-
2
;
V_I2
(
pVarOut
)
=
V_I2
(
&
varLeft
)
^
V_I2
(
&
varRight
);
}
Var
Eqv
_Exit:
Var
Xor
_Exit:
VariantClear
(
&
varLeft
);
VariantClear
(
&
varRight
);
return
hRet
;
}
/**********************************************************************
* VarEqv [OLEAUT32.172]
*
* Determine if two variants contain the same value.
*
* PARAMS
* pVarLeft [I] First variant to compare
* pVarRight [I] Variant to compare to pVarLeft
* pVarOut [O] Destination for comparison result
*
* RETURNS
* Success: S_OK. pVarOut contains the result of the comparason (VARIANT_TRUE
* if equivalent or non-zero otherwise.
* Failure: An HRESULT error code indicating the error.
*
* NOTES
* - This function simply calls VarXor() on pVarLeft and pVarRight and inverts
* the result.
*/
HRESULT
WINAPI
VarEqv
(
LPVARIANT
pVarLeft
,
LPVARIANT
pVarRight
,
LPVARIANT
pVarOut
)
{
HRESULT
hRet
;
TRACE
(
"(%p->(%s%s),%p->(%s%s),%p)
\n
"
,
pVarLeft
,
debugstr_VT
(
pVarLeft
),
debugstr_VF
(
pVarLeft
),
pVarRight
,
debugstr_VT
(
pVarRight
),
debugstr_VF
(
pVarRight
),
pVarOut
);
hRet
=
VarXor
(
pVarLeft
,
pVarRight
,
pVarOut
);
if
(
SUCCEEDED
(
hRet
))
{
if
(
V_VT
(
pVarOut
)
==
VT_I8
)
V_I8
(
pVarOut
)
=
~
V_I8
(
pVarOut
);
else
V_UI4
(
pVarOut
)
=
~
V_UI4
(
pVarOut
);
}
return
hRet
;
}
/**********************************************************************
* VarNeg [OLEAUT32.173]
*
* Negate the value of a variant.
...
...
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