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
743fb99a
Commit
743fb99a
authored
Feb 22, 2005
by
Jon Griffiths
Committed by
Alexandre Julliard
Feb 22, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use variant macros instead of accessing the union directly.
parent
5f8797f1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
135 additions
and
135 deletions
+135
-135
olepicture.c
dlls/oleaut32/olepicture.c
+1
-1
typelib.c
dlls/oleaut32/typelib.c
+18
-18
usrmarshal.c
dlls/oleaut32/usrmarshal.c
+3
-3
variant.c
dlls/oleaut32/variant.c
+113
-113
No files found.
dlls/oleaut32/olepicture.c
View file @
743fb99a
...
...
@@ -1827,7 +1827,7 @@ static HRESULT WINAPI OLEPictureImpl_Invoke(
VariantInit
(
pVarResult
);
V_VT
(
pVarResult
)
=
VT_BOOL
;
V_
UNION
(
pVarResult
,
boolVal
)
=
FALSE
;
V_
BOOL
(
pVarResult
)
=
FALSE
;
return
S_OK
;
}
...
...
dlls/oleaut32/typelib.c
View file @
743fb99a
...
...
@@ -1497,7 +1497,7 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
if
(
offset
<
0
)
{
/* data are packed in here */
V_VT
(
pVar
)
=
(
offset
&
0x7c000000
)
>>
26
;
V_
UNION
(
pVar
,
iVal
)
=
offset
&
0x3ffffff
;
V_
I2
(
pVar
)
=
offset
&
0x3ffffff
;
return
;
}
MSFT_ReadLEWords
(
&
(
V_VT
(
pVar
)),
sizeof
(
VARTYPE
),
pcx
,
...
...
@@ -1537,7 +1537,7 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
}
else
{
ptr
=
TLB_Alloc
(
size
);
/* allocate temp buffer */
MSFT_Read
(
ptr
,
size
,
pcx
,
DO_NOT_SEEK
);
/* read string (ANSI) */
V_
UNION
(
pVar
,
bstrVal
)
=
SysAllocStringLen
(
NULL
,
size
);
V_
BSTR
(
pVar
)
=
SysAllocStringLen
(
NULL
,
size
);
/* FIXME: do we need a AtoW conversion here? */
V_UNION
(
pVar
,
bstrVal
[
size
])
=
L'\0'
;
while
(
size
--
)
V_UNION
(
pVar
,
bstrVal
[
size
])
=
ptr
[
size
];
...
...
@@ -1570,7 +1570,7 @@ static void MSFT_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
}
if
(
size
>
0
)
/* (big|small) endian correct? */
MSFT_Read
(
&
(
V_
UNION
(
pVar
,
iVal
)),
size
,
pcx
,
DO_NOT_SEEK
);
MSFT_Read
(
&
(
V_
I2
(
pVar
)),
size
,
pcx
,
DO_NOT_SEEK
);
return
;
}
/*
...
...
@@ -4523,12 +4523,12 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
}
if
(
V_VT
(
arg
)
==
vt
)
{
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
lVal
),
arglen
);
memcpy
(
argpos
,
&
V_
I4
(
arg
),
arglen
);
return
S_OK
;
}
if
(
V_ISARRAY
(
arg
)
&&
(
vt
==
VT_SAFEARRAY
))
{
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
parray
),
sizeof
(
SAFEARRAY
*
));
memcpy
(
argpos
,
&
V_
ARRAY
(
arg
),
sizeof
(
SAFEARRAY
*
));
return
S_OK
;
}
...
...
@@ -4538,13 +4538,13 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
}
/* Deref BYREF vars if there is need */
if
(
V_ISBYREF
(
arg
)
&&
((
V_VT
(
arg
)
&
~
VT_BYREF
)
==
vt
))
{
memcpy
(
argpos
,(
void
*
)
V_
UNION
(
arg
,
lVal
),
arglen
);
memcpy
(
argpos
,(
void
*
)
V_
I4
(
arg
),
arglen
);
return
S_OK
;
}
if
(
vt
==
VT_UNKNOWN
&&
V_VT
(
arg
)
==
VT_DISPATCH
)
{
/* in this context, if the type lib specifies IUnknown*, giving an
IDispatch* is correct; so, don't invoke VariantChangeType */
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
lVal
),
arglen
);
memcpy
(
argpos
,
&
V_
I4
(
arg
),
arglen
);
return
S_OK
;
}
if
((
vt
==
VT_PTR
)
&&
tdesc
)
...
...
@@ -4560,7 +4560,7 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
FIXME
(
"Could not get typeinfo of hreftype %lx for VT_USERDEFINED, "
"while coercing from vt 0x%x. Copying 4 byte.
\n
"
,
tdesc
->
u
.
hreftype
,
V_VT
(
arg
));
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
lVal
),
4
);
memcpy
(
argpos
,
&
V_
I4
(
arg
),
4
);
return
S_OK
;
}
hres
=
ITypeInfo_GetTypeAttr
(
tinfo2
,
&
tattr
);
...
...
@@ -4574,11 +4574,11 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
case
TKIND_ENUM
:
switch
(
V_VT
(
arg
)
)
{
case
VT_I2
:
*
argpos
=
V_
UNION
(
arg
,
iVal
);
*
argpos
=
V_
I2
(
arg
);
hres
=
S_OK
;
break
;
case
VT_I4
:
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
lVal
),
4
);
memcpy
(
argpos
,
&
V_
I4
(
arg
),
4
);
hres
=
S_OK
;
break
;
default:
...
...
@@ -4597,15 +4597,15 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
if
(
V_VT
(
arg
)
==
VT_DISPATCH
)
{
IDispatch
*
disp
;
if
(
IsEqualIID
(
&
IID_IDispatch
,
&
(
tattr
->
guid
)))
{
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
pdispVal
),
4
);
memcpy
(
argpos
,
&
V_
DISPATCH
(
arg
),
4
);
hres
=
S_OK
;
break
;
}
hres
=
IUnknown_QueryInterface
(
V_
UNION
(
arg
,
pdispVal
),
hres
=
IUnknown_QueryInterface
(
V_
DISPATCH
(
arg
),
&
IID_IDispatch
,(
LPVOID
*
)
&
disp
);
if
(
SUCCEEDED
(
hres
))
{
memcpy
(
argpos
,
&
disp
,
4
);
IUnknown_Release
(
V_
UNION
(
arg
,
pdispVal
));
IUnknown_Release
(
V_
DISPATCH
(
arg
));
hres
=
S_OK
;
break
;
}
...
...
@@ -4615,7 +4615,7 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
break
;
}
if
(
V_VT
(
arg
)
==
VT_UNKNOWN
)
{
memcpy
(
argpos
,
&
V_UN
ION
(
arg
,
punkVal
),
4
);
memcpy
(
argpos
,
&
V_UN
KNOWN
(
arg
),
4
);
hres
=
S_OK
;
break
;
}
...
...
@@ -4626,7 +4626,7 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
case
TKIND_DISPATCH
:
if
(
V_VT
(
arg
)
==
VT_DISPATCH
)
{
memcpy
(
argpos
,
&
V_
UNION
(
arg
,
pdispVal
),
4
);
memcpy
(
argpos
,
&
V_
DISPATCH
(
arg
),
4
);
hres
=
S_OK
;
}
else
{
...
...
@@ -4651,7 +4651,7 @@ _copy_arg( ITypeInfo2 *tinfo, TYPEDESC *tdesc,
oldvt
=
V_VT
(
arg
);
VariantInit
(
&
va
);
if
(
VariantChangeType
(
&
va
,
arg
,
0
,
vt
)
==
S_OK
)
{
memcpy
(
argpos
,
&
V_
UNION
(
&
va
,
lVal
),
arglen
);
memcpy
(
argpos
,
&
V_
I4
(
&
va
),
arglen
);
FIXME
(
"Should not use VariantChangeType here."
" (conversion from 0x%x -> 0x%x) %08lx
\n
"
,
V_VT
(
arg
),
vt
,
*
argpos
...
...
@@ -4773,7 +4773,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
if
(
i
<
func_desc
->
cParams
-
func_desc
->
cParamsOpt
)
ERR
(
"Parameter has PARAMFLAG_FOPT flag but is not one of last cParamOpt parameters
\n
"
);
if
(
V_VT
(
arg
)
==
VT_EMPTY
||
((
V_
VT
(
arg
)
&
VT_BYREF
)
&&
!
V_BYREF
(
arg
)))
{
||
((
V_
ISBYREF
(
arg
)
)
&&
!
V_BYREF
(
arg
)))
{
/* FIXME: Documentation says that we do this when parameter is left unspecified.
How to determine it? */
...
...
@@ -4839,7 +4839,7 @@ static HRESULT WINAPI ITypeInfo_fnInvoke(
continue
;
VariantInit
(
pVarResult
);
memcpy
(
&
V_
UNION
(
pVarResult
,
intVal
),
&
args2
[
args2pos
],
arglen
*
sizeof
(
DWORD
));
memcpy
(
&
V_
INT
(
pVarResult
),
&
args2
[
args2pos
],
arglen
*
sizeof
(
DWORD
));
if
(
tdesc
->
vt
==
VT_PTR
)
tdesc
=
tdesc
->
u
.
lptdesc
;
...
...
dlls/oleaut32/usrmarshal.c
View file @
743fb99a
...
...
@@ -190,7 +190,7 @@ static unsigned wire_extra(unsigned long *pFlags, VARIANT *pvar)
ULONG
size
;
HRESULT
hr
;
if
(
V_
VT
(
pvar
)
&
VT_ARRAY
)
{
if
(
V_
ISARRAY
(
pvar
)
)
{
FIXME
(
"wire-size safearray
\n
"
);
return
0
;
}
...
...
@@ -527,7 +527,7 @@ HRESULT CALLBACK IDispatch_Invoke_Proxy(
/* count by-ref args */
for
(
cVarRef
=
0
,
u
=
0
;
u
<
pDispParams
->
cArgs
;
u
++
)
{
VARIANTARG
*
arg
=
&
pDispParams
->
rgvarg
[
u
];
if
(
V_
VT
(
arg
)
&
VT_BYREF
)
{
if
(
V_
ISBYREF
(
arg
)
)
{
cVarRef
++
;
}
}
...
...
@@ -537,7 +537,7 @@ HRESULT CALLBACK IDispatch_Invoke_Proxy(
/* make list of by-ref args */
for
(
cVarRef
=
0
,
u
=
0
;
u
<
pDispParams
->
cArgs
;
u
++
)
{
VARIANTARG
*
arg
=
&
pDispParams
->
rgvarg
[
u
];
if
(
V_
VT
(
arg
)
&
VT_BYREF
)
{
if
(
V_
ISBYREF
(
arg
)
)
{
rgVarRefIdx
[
cVarRef
]
=
u
;
VariantInit
(
&
rgVarRef
[
cVarRef
]);
cVarRef
++
;
...
...
dlls/oleaut32/variant.c
View file @
743fb99a
...
...
@@ -984,7 +984,7 @@ HRESULT WINAPI VariantChangeTypeEx(VARIANTARG* pvargDest, VARIANTARG* pvargSrc,
{
VARIANTARG
vTmp
,
vSrcDeref
;
if
(
V_
VT
(
pvargSrc
)
&
VT_BYREF
&&
!
V_BYREF
(
pvargSrc
))
if
(
V_
ISBYREF
(
pvargSrc
)
&&
!
V_BYREF
(
pvargSrc
))
res
=
DISP_E_TYPEMISMATCH
;
else
{
...
...
@@ -2531,7 +2531,7 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
}
xmask
=
(
1
<<
(
V_VT
(
left
)
&
VT_TYPEMASK
))
|
(
1
<<
(
V_VT
(
right
)
&
VT_TYPEMASK
));
if
(
xmask
&
(
1
<<
VT_R8
)
)
{
if
(
xmask
&
VTBIT_R8
)
{
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
VT_R8
);
if
(
FAILED
(
rc
))
return
rc
;
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
VT_R8
);
...
...
@@ -2542,7 +2542,7 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
if
(
V_R8
(
&
lv
)
>
V_R8
(
&
rv
))
return
VARCMP_GT
;
return
E_FAIL
;
/* can't get here */
}
if
(
xmask
&
(
1
<<
VT_R4
)
)
{
if
(
xmask
&
VTBIT_R4
)
{
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
VT_R4
);
if
(
FAILED
(
rc
))
return
rc
;
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
VT_R4
);
...
...
@@ -2558,29 +2558,29 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
Use LONGLONG to maximize ranges */
lOk
=
TRUE
;
switch
(
V_VT
(
left
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
lVal
=
V_
UNION
(
left
,
cVal
);
break
;
case
VT_I2
:
lVal
=
V_
UNION
(
left
,
iVal
);
break
;
case
VT_I4
:
lVal
=
V_UNION
(
left
,
lVal
);
break
;
case
VT_INT
:
lVal
=
V_
UNION
(
left
,
lVal
);
break
;
case
VT_UI1
:
lVal
=
V_U
NION
(
left
,
bVal
);
break
;
case
VT_UI2
:
lVal
=
V_U
NION
(
left
,
uiVal
);
break
;
case
VT_UI4
:
lVal
=
V_UNION
(
left
,
ulVal
);
break
;
case
VT_UINT
:
lVal
=
V_U
NION
(
left
,
ulVal
);
break
;
case
VT_BOOL
:
lVal
=
V_
UNION
(
left
,
boolVal
);
break
;
case
VT_I1
:
lVal
=
V_
I1
(
left
);
break
;
case
VT_I2
:
lVal
=
V_
I2
(
left
);
break
;
case
VT_I4
:
case
VT_INT
:
lVal
=
V_
I4
(
left
);
break
;
case
VT_UI1
:
lVal
=
V_U
I1
(
left
);
break
;
case
VT_UI2
:
lVal
=
V_U
I2
(
left
);
break
;
case
VT_UI4
:
case
VT_UINT
:
lVal
=
V_U
I4
(
left
);
break
;
case
VT_BOOL
:
lVal
=
V_
BOOL
(
left
);
break
;
default:
lOk
=
FALSE
;
}
rOk
=
TRUE
;
switch
(
V_VT
(
right
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
rVal
=
V_
UNION
(
right
,
cVal
);
break
;
case
VT_I2
:
rVal
=
V_
UNION
(
right
,
iVal
);
break
;
case
VT_I4
:
rVal
=
V_UNION
(
right
,
lVal
);
break
;
case
VT_INT
:
rVal
=
V_
UNION
(
right
,
lVal
);
break
;
case
VT_UI1
:
rVal
=
V_U
NION
(
right
,
bVal
);
break
;
case
VT_UI2
:
rVal
=
V_U
NION
(
right
,
uiVal
);
break
;
case
VT_UI4
:
rVal
=
V_UNION
(
right
,
ulVal
);
break
;
case
VT_UINT
:
rVal
=
V_U
NION
(
right
,
ulVal
);
break
;
case
VT_BOOL
:
rVal
=
V_
UNION
(
right
,
boolVal
);
break
;
case
VT_I1
:
rVal
=
V_
I1
(
right
);
break
;
case
VT_I2
:
rVal
=
V_
I2
(
right
);
break
;
case
VT_I4
:
case
VT_INT
:
rVal
=
V_
I4
(
right
);
break
;
case
VT_UI1
:
rVal
=
V_U
I1
(
right
);
break
;
case
VT_UI2
:
rVal
=
V_U
I2
(
right
);
break
;
case
VT_UI4
:
case
VT_UINT
:
rVal
=
V_U
I4
(
right
);
break
;
case
VT_BOOL
:
rVal
=
V_
BOOL
(
right
);
break
;
default:
rOk
=
FALSE
;
}
...
...
@@ -2598,20 +2598,20 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
if
((
V_VT
(
left
)
&
VT_TYPEMASK
)
==
VT_DATE
&&
(
V_VT
(
right
)
&
VT_TYPEMASK
)
==
VT_DATE
)
{
if
(
floor
(
V_
UNION
(
left
,
date
))
==
floor
(
V_UNION
(
right
,
date
)))
{
if
(
floor
(
V_
DATE
(
left
))
==
floor
(
V_DATE
(
right
)))
{
/* Due to floating point rounding errors, calculate varDate in whole numbers) */
double
wholePart
=
0
.
0
;
double
leftR
;
double
rightR
;
/* Get the fraction * 24*60*60 to make it into whole seconds */
wholePart
=
(
double
)
floor
(
V_
UNION
(
left
,
date
)
);
wholePart
=
(
double
)
floor
(
V_
DATE
(
left
)
);
if
(
wholePart
==
0
)
wholePart
=
1
;
leftR
=
floor
(
fmod
(
V_
UNION
(
left
,
date
),
wholePart
)
*
(
24
*
60
*
60
));
leftR
=
floor
(
fmod
(
V_
DATE
(
left
),
wholePart
)
*
(
24
*
60
*
60
));
wholePart
=
(
double
)
floor
(
V_
UNION
(
right
,
date
)
);
wholePart
=
(
double
)
floor
(
V_
DATE
(
right
)
);
if
(
wholePart
==
0
)
wholePart
=
1
;
rightR
=
floor
(
fmod
(
V_
UNION
(
right
,
date
),
wholePart
)
*
(
24
*
60
*
60
));
rightR
=
floor
(
fmod
(
V_
DATE
(
right
),
wholePart
)
*
(
24
*
60
*
60
));
if
(
leftR
<
rightR
)
{
return
VARCMP_LT
;
...
...
@@ -2621,9 +2621,9 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
return
VARCMP_EQ
;
}
}
else
if
(
V_
UNION
(
left
,
date
)
<
V_UNION
(
right
,
date
))
{
}
else
if
(
V_
DATE
(
left
)
<
V_DATE
(
right
))
{
return
VARCMP_LT
;
}
else
if
(
V_
UNION
(
left
,
date
)
>
V_UNION
(
right
,
date
))
{
}
else
if
(
V_
DATE
(
left
)
>
V_DATE
(
right
))
{
return
VARCMP_GT
;
}
}
...
...
@@ -2665,29 +2665,29 @@ HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
lOk
=
TRUE
;
switch
(
V_VT
(
left
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
lVal
=
V_
UNION
(
left
,
cVal
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
lVal
=
V_
UNION
(
left
,
iVal
);
resT
=
VT_I2
;
break
;
case
VT_I4
:
lVal
=
V_UNION
(
left
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_INT
:
lVal
=
V_
UNION
(
left
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
lVal
=
V_U
NION
(
left
,
bVal
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
lVal
=
V_U
NION
(
left
,
uiVal
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
lVal
=
V_UNION
(
left
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_UINT
:
lVal
=
V_U
NION
(
left
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_BOOL
:
rVal
=
V_
UNION
(
left
,
boolVal
);
resT
=
VT_I4
;
break
;
case
VT_I1
:
lVal
=
V_
I1
(
left
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
lVal
=
V_
I2
(
left
);
resT
=
VT_I2
;
break
;
case
VT_I4
:
case
VT_INT
:
lVal
=
V_
I4
(
left
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
lVal
=
V_U
I1
(
left
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
lVal
=
V_U
I2
(
left
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
case
VT_UINT
:
lVal
=
V_U
I4
(
left
);
resT
=
VT_I4
;
break
;
case
VT_BOOL
:
rVal
=
V_
BOOL
(
left
);
resT
=
VT_I4
;
break
;
default:
lOk
=
FALSE
;
}
rOk
=
TRUE
;
switch
(
V_VT
(
right
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
rVal
=
V_
UNION
(
right
,
cVal
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
rVal
=
V_
UNION
(
right
,
iVal
);
resT
=
max
(
VT_I2
,
resT
);
break
;
case
VT_I4
:
rVal
=
V_UNION
(
right
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_INT
:
rVal
=
V_
UNION
(
right
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
rVal
=
V_U
NION
(
right
,
bVal
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
rVal
=
V_U
NION
(
right
,
uiVal
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
rVal
=
V_UNION
(
right
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_UINT
:
rVal
=
V_U
NION
(
right
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_BOOL
:
rVal
=
V_
UNION
(
right
,
boolVal
);
resT
=
VT_I4
;
break
;
case
VT_I1
:
rVal
=
V_
I1
(
right
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
rVal
=
V_
I2
(
right
);
resT
=
max
(
VT_I2
,
resT
);
break
;
case
VT_I4
:
case
VT_INT
:
rVal
=
V_
I4
(
right
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
rVal
=
V_U
I1
(
right
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
rVal
=
V_U
I2
(
right
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
case
VT_UINT
:
rVal
=
V_U
I4
(
right
);
resT
=
VT_I4
;
break
;
case
VT_BOOL
:
rVal
=
V_
BOOL
(
right
);
resT
=
VT_I4
;
break
;
default:
rOk
=
FALSE
;
}
...
...
@@ -2695,11 +2695,11 @@ HRESULT WINAPI VarAnd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
res
=
(
lVal
&
rVal
);
V_VT
(
result
)
=
resT
;
switch
(
resT
)
{
case
VT_I2
:
V_
UNION
(
result
,
iVal
)
=
res
;
break
;
case
VT_I4
:
V_
UNION
(
result
,
lVal
)
=
res
;
break
;
case
VT_I2
:
V_
I2
(
result
)
=
res
;
break
;
case
VT_I4
:
V_
I4
(
result
)
=
res
;
break
;
default:
FIXME
(
"Unexpected result variant type %x
\n
"
,
resT
);
V_
UNION
(
result
,
lVal
)
=
res
;
V_
I4
(
result
)
=
res
;
}
rc
=
S_OK
;
...
...
@@ -2747,32 +2747,32 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
lOk
=
TRUE
;
switch
(
V_VT
(
left
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
lVal
=
V_
UNION
(
left
,
cVal
);
break
;
case
VT_I2
:
lVal
=
V_
UNION
(
left
,
iVal
);
break
;
case
VT_I4
:
lVal
=
V_UNION
(
left
,
lVal
);
break
;
case
VT_INT
:
lVal
=
V_
UNION
(
left
,
lVal
);
break
;
case
VT_UI1
:
lVal
=
V_U
NION
(
left
,
bVal
);
break
;
case
VT_UI2
:
lVal
=
V_U
NION
(
left
,
uiVal
);
break
;
case
VT_UI4
:
lVal
=
V_UNION
(
left
,
ulVal
);
break
;
case
VT_UINT
:
lVal
=
V_U
NION
(
left
,
ulVal
);
break
;
case
VT_R4
:
lVal
=
V_
UNION
(
left
,
fltVal
);
break
;
case
VT_R8
:
lVal
=
V_
UNION
(
left
,
dblVal
);
break
;
case
VT_I1
:
lVal
=
V_
I1
(
left
);
break
;
case
VT_I2
:
lVal
=
V_
I2
(
left
);
break
;
case
VT_I4
:
case
VT_INT
:
lVal
=
V_
I4
(
left
);
break
;
case
VT_UI1
:
lVal
=
V_U
I1
(
left
);
break
;
case
VT_UI2
:
lVal
=
V_U
I2
(
left
);
break
;
case
VT_UI4
:
case
VT_UINT
:
lVal
=
V_U
I4
(
left
);
break
;
case
VT_R4
:
lVal
=
V_
R4
(
left
);
break
;
case
VT_R8
:
lVal
=
V_
R8
(
left
);
break
;
case
VT_NULL
:
lVal
=
0
.
0
;
break
;
default:
lOk
=
FALSE
;
}
rOk
=
TRUE
;
switch
(
V_VT
(
right
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
rVal
=
V_
UNION
(
right
,
cVal
);
break
;
case
VT_I2
:
rVal
=
V_
UNION
(
right
,
iVal
);
break
;
case
VT_I4
:
rVal
=
V_UNION
(
right
,
lVal
);
break
;
case
VT_INT
:
rVal
=
V_
UNION
(
right
,
lVal
);
break
;
case
VT_UI1
:
rVal
=
V_U
NION
(
right
,
bVal
);
break
;
case
VT_UI2
:
rVal
=
V_U
NION
(
right
,
uiVal
);
break
;
case
VT_UI4
:
rVal
=
V_UNION
(
right
,
ulVal
);
break
;
case
VT_UINT
:
rVal
=
V_U
NION
(
right
,
ulVal
);
break
;
case
VT_R4
:
rVal
=
V_
UNION
(
right
,
fltVal
);
break
;
case
VT_R8
:
rVal
=
V_
UNION
(
right
,
dblVal
);
break
;
case
VT_I1
:
rVal
=
V_
I1
(
right
);
break
;
case
VT_I2
:
rVal
=
V_
I2
(
right
);
break
;
case
VT_I4
:
case
VT_INT
:
rVal
=
V_
I4
(
right
);
break
;
case
VT_UI1
:
rVal
=
V_U
I1
(
right
);
break
;
case
VT_UI2
:
rVal
=
V_U
I2
(
right
);
break
;
case
VT_UI4
:
case
VT_UINT
:
rVal
=
V_U
I4
(
right
);
break
;
case
VT_R4
:
rVal
=
V_
R4
(
right
);
break
;
case
VT_R8
:
rVal
=
V_
R8
(
right
);
break
;
case
VT_NULL
:
rVal
=
0
.
0
;
break
;
default:
rOk
=
FALSE
;
}
...
...
@@ -2780,7 +2780,7 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
if
(
lOk
&&
rOk
)
{
res
=
(
lVal
+
rVal
);
V_VT
(
result
)
=
VT_R8
;
V_
UNION
(
result
,
dblVal
)
=
res
;
V_
R8
(
result
)
=
res
;
rc
=
S_OK
;
}
else
{
FIXME
(
"Unhandled type pair %d / %d in double addition.
\n
"
,
...
...
@@ -2801,30 +2801,30 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
lOk
=
TRUE
;
switch
(
V_VT
(
left
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
lVal
=
V_
UNION
(
left
,
cVal
);
break
;
case
VT_I2
:
lVal
=
V_
UNION
(
left
,
iVal
);
break
;
case
VT_I4
:
lVal
=
V_UNION
(
left
,
lVal
);
break
;
case
VT_INT
:
lVal
=
V_
UNION
(
left
,
lVal
);
break
;
case
VT_UI1
:
lVal
=
V_U
NION
(
left
,
bVal
);
break
;
case
VT_UI2
:
lVal
=
V_U
NION
(
left
,
uiVal
);
break
;
case
VT_UI4
:
lVal
=
V_UNION
(
left
,
ulVal
);
break
;
case
VT_UINT
:
lVal
=
V_U
NION
(
left
,
ulVal
);
break
;
case
VT_R4
:
lVal
=
V_
UNION
(
left
,
fltVal
);
break
;
case
VT_I1
:
lVal
=
V_
I1
(
left
);
break
;
case
VT_I2
:
lVal
=
V_
I2
(
left
);
break
;
case
VT_I4
:
case
VT_INT
:
lVal
=
V_
I4
(
left
);
break
;
case
VT_UI1
:
lVal
=
V_U
I1
(
left
);
break
;
case
VT_UI2
:
lVal
=
V_U
I2
(
left
);
break
;
case
VT_UI4
:
case
VT_UINT
:
lVal
=
V_U
I4
(
left
);
break
;
case
VT_R4
:
lVal
=
V_
R4
(
left
);
break
;
case
VT_NULL
:
lVal
=
0
.
0
;
break
;
default:
lOk
=
FALSE
;
}
rOk
=
TRUE
;
switch
(
V_VT
(
right
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
rVal
=
V_
UNION
(
right
,
cVal
);
break
;
case
VT_I2
:
rVal
=
V_
UNION
(
right
,
iVal
);
break
;
case
VT_I4
:
rVal
=
V_UNION
(
right
,
lVal
);
break
;
case
VT_INT
:
rVal
=
V_
UNION
(
right
,
lVal
);
break
;
case
VT_UI1
:
rVal
=
V_U
NION
(
right
,
bVal
);
break
;
case
VT_UI2
:
rVal
=
V_U
NION
(
right
,
uiVal
);
break
;
case
VT_UI4
:
rVal
=
V_UNION
(
right
,
ulVal
);
break
;
case
VT_UINT
:
rVal
=
V_U
NION
(
right
,
ulVal
);
break
;
case
VT_R4
:
rVal
=
V_
UNION
(
right
,
fltVal
);
break
;
case
VT_I1
:
rVal
=
V_
I1
(
right
);
break
;
case
VT_I2
:
rVal
=
V_
I2
(
right
);
break
;
case
VT_I4
:
case
VT_INT
:
rVal
=
V_
I4
(
right
);
break
;
case
VT_UI1
:
rVal
=
V_U
I1
(
right
);
break
;
case
VT_UI2
:
rVal
=
V_U
I2
(
right
);
break
;
case
VT_UI4
:
case
VT_UINT
:
rVal
=
V_U
I4
(
right
);
break
;
case
VT_R4
:
rVal
=
V_
R4
(
right
);
break
;
case
VT_NULL
:
rVal
=
0
.
0
;
break
;
default:
rOk
=
FALSE
;
}
...
...
@@ -2832,7 +2832,7 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
if
(
lOk
&&
rOk
)
{
res
=
(
lVal
+
rVal
);
V_VT
(
result
)
=
VT_R4
;
V_
UNION
(
result
,
fltVal
)
=
res
;
V_
R4
(
result
)
=
res
;
rc
=
S_OK
;
}
else
{
FIXME
(
"Unhandled type pair %d / %d in float addition.
\n
"
,
...
...
@@ -2861,28 +2861,28 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
lOk
=
TRUE
;
switch
(
V_VT
(
left
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
lVal
=
V_
UNION
(
left
,
cVal
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
lVal
=
V_
UNION
(
left
,
iVal
);
resT
=
VT_I2
;
break
;
case
VT_I4
:
lVal
=
V_UNION
(
left
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_INT
:
lVal
=
V_
UNION
(
left
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
lVal
=
V_U
NION
(
left
,
bVal
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
lVal
=
V_U
NION
(
left
,
uiVal
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
lVal
=
V_UNION
(
left
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_UINT
:
lVal
=
V_U
NION
(
left
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_I1
:
lVal
=
V_
I1
(
left
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
lVal
=
V_
I2
(
left
);
resT
=
VT_I2
;
break
;
case
VT_I4
:
case
VT_INT
:
lVal
=
V_
I4
(
left
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
lVal
=
V_U
I1
(
left
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
lVal
=
V_U
I2
(
left
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
case
VT_UINT
:
lVal
=
V_U
I4
(
left
);
resT
=
VT_I4
;
break
;
case
VT_NULL
:
lVal
=
0
;
resT
=
VT_I4
;
break
;
default:
lOk
=
FALSE
;
}
rOk
=
TRUE
;
switch
(
V_VT
(
right
)
&
VT_TYPEMASK
)
{
case
VT_I1
:
rVal
=
V_
UNION
(
right
,
cVal
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
rVal
=
V_
UNION
(
right
,
iVal
);
resT
=
max
(
VT_I2
,
resT
);
break
;
case
VT_I4
:
rVal
=
V_UNION
(
right
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_INT
:
rVal
=
V_
UNION
(
right
,
lVal
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
rVal
=
V_U
NION
(
right
,
bVal
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
rVal
=
V_U
NION
(
right
,
uiVal
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
rVal
=
V_UNION
(
right
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_UINT
:
rVal
=
V_U
NION
(
right
,
ulVal
);
resT
=
VT_I4
;
break
;
case
VT_I1
:
rVal
=
V_
I1
(
right
);
resT
=
VT_I4
;
break
;
case
VT_I2
:
rVal
=
V_
I2
(
right
);
resT
=
max
(
VT_I2
,
resT
);
break
;
case
VT_I4
:
case
VT_INT
:
rVal
=
V_
I4
(
right
);
resT
=
VT_I4
;
break
;
case
VT_UI1
:
rVal
=
V_U
I1
(
right
);
resT
=
VT_I4
;
break
;
case
VT_UI2
:
rVal
=
V_U
I2
(
right
);
resT
=
VT_I4
;
break
;
case
VT_UI4
:
case
VT_UINT
:
rVal
=
V_U
I4
(
right
);
resT
=
VT_I4
;
break
;
case
VT_NULL
:
rVal
=
0
;
resT
=
VT_I4
;
break
;
default:
rOk
=
FALSE
;
}
...
...
@@ -2891,11 +2891,11 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
res
=
(
lVal
+
rVal
);
V_VT
(
result
)
=
resT
;
switch
(
resT
)
{
case
VT_I2
:
V_
UNION
(
result
,
iVal
)
=
res
;
break
;
case
VT_I4
:
V_
UNION
(
result
,
lVal
)
=
res
;
break
;
case
VT_I2
:
V_
I2
(
result
)
=
res
;
break
;
case
VT_I4
:
V_
I4
(
result
)
=
res
;
break
;
default:
FIXME
(
"Unexpected result variant type %x
\n
"
,
resT
);
V_
UNION
(
result
,
lVal
)
=
res
;
V_
I4
(
result
)
=
res
;
}
rc
=
S_OK
;
...
...
@@ -2927,11 +2927,11 @@ HRESULT WINAPI VarMul(LPVARIANT left, LPVARIANT right, LPVARIANT result)
lvt
=
V_VT
(
left
)
&
VT_TYPEMASK
;
rvt
=
V_VT
(
right
)
&
VT_TYPEMASK
;
found
=
FALSE
;
resvt
=
VT_VOID
;
if
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
(
1
<<
VT_R4
)
|
(
1
<<
VT_R8
)
))
{
if
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
VTBIT_R4
|
VTBIT_R8
))
{
found
=
TRUE
;
resvt
=
VT_R8
;
}
if
(
!
found
&&
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
(
1
<<
VT_I1
)
|
(
1
<<
VT_I2
)
|
(
1
<<
VT_UI1
)
|
(
1
<<
VT_UI2
)
|
(
1
<<
VT_I4
)
|
(
1
<<
VT_UI4
)
|
(
1
<<
VT_INT
)
|
(
1
<<
VT_UINT
))))
{
if
(
!
found
&&
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
VTBIT_I1
|
VTBIT_I2
|
VTBIT_UI1
|
VTBIT_UI2
|
VTBIT_I4
|
VTBIT_UI4
|
(
1
<<
VT_INT
)
|
(
1
<<
VT_UINT
))))
{
found
=
TRUE
;
resvt
=
VT_I4
;
}
...
...
@@ -2984,11 +2984,11 @@ HRESULT WINAPI VarDiv(LPVARIANT left, LPVARIANT right, LPVARIANT result)
lvt
=
V_VT
(
left
)
&
VT_TYPEMASK
;
rvt
=
V_VT
(
right
)
&
VT_TYPEMASK
;
found
=
FALSE
;
resvt
=
VT_VOID
;
if
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
(
1
<<
VT_R4
)
|
(
1
<<
VT_R8
)
))
{
if
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
VTBIT_R4
|
VTBIT_R8
))
{
found
=
TRUE
;
resvt
=
VT_R8
;
}
if
(
!
found
&&
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
(
1
<<
VT_I1
)
|
(
1
<<
VT_I2
)
|
(
1
<<
VT_UI1
)
|
(
1
<<
VT_UI2
)
|
(
1
<<
VT_I4
)
|
(
1
<<
VT_UI4
)
|
(
1
<<
VT_INT
)
|
(
1
<<
VT_UINT
))))
{
if
(
!
found
&&
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
VTBIT_I1
|
VTBIT_I2
|
VTBIT_UI1
|
VTBIT_UI2
|
VTBIT_I4
|
VTBIT_UI4
|
(
1
<<
VT_INT
)
|
(
1
<<
VT_UINT
))))
{
found
=
TRUE
;
resvt
=
VT_I4
;
}
...
...
@@ -3045,7 +3045,7 @@ HRESULT WINAPI VarSub(LPVARIANT left, LPVARIANT right, LPVARIANT result)
found
=
TRUE
;
resvt
=
VT_R8
;
}
if
(
!
found
&&
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
(
1
<<
VT_I1
)
|
(
1
<<
VT_I2
)
|
(
1
<<
VT_UI1
)
|
(
1
<<
VT_UI2
)
|
(
1
<<
VT_I4
)
|
(
1
<<
VT_UI4
)
|
(
1
<<
VT_INT
)
|
(
1
<<
VT_UINT
))))
{
if
(
!
found
&&
(((
1
<<
lvt
)
|
(
1
<<
rvt
))
&
(
VTBIT_I1
|
VTBIT_I2
|
VTBIT_UI1
|
VTBIT_UI2
|
VTBIT_I4
|
VTBIT_UI4
|
(
1
<<
VT_INT
)
|
(
1
<<
VT_UINT
))))
{
found
=
TRUE
;
resvt
=
VT_I4
;
}
...
...
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