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
b3be773a
Commit
b3be773a
authored
Jan 28, 2003
by
Marcus Meissner
Committed by
Alexandre Julliard
Jan 28, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added R4 and R8 comparison to VarCmp.
Added I2 to VarFormat. Added VarSub, VarDiv, VarMul for integer and float types.
parent
f0e1c04b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
216 additions
and
11 deletions
+216
-11
oleaut32.spec
dlls/oleaut32/oleaut32.spec
+3
-3
variant.c
dlls/oleaut32/variant.c
+213
-8
No files found.
dlls/oleaut32/oleaut32.spec
View file @
b3be773a
...
...
@@ -140,7 +140,7 @@
140 stdcall VarTokenizeFormatString (ptr ptr long long long long ptr) VarTokenizeFormatString
141 stdcall VarAdd(ptr ptr ptr) VarAdd
142 stdcall VarAnd(ptr ptr ptr) VarAnd
143 st
ub VarDiv # stdcall (ptr ptr ptr)
143 st
dcall VarDiv(ptr ptr ptr) VarDiv
144 stub OACreateTypeLib2
146 stdcall DispCallFunc(ptr long long long long ptr ptr ptr) DispCallFunc
147 stdcall VariantChangeTypeEx(ptr ptr long long long) VariantChangeTypeEx
...
...
@@ -151,10 +151,10 @@
153 stub VarIdiv # stdcall (ptr ptr ptr)
154 stub VarImp # stdcall (ptr ptr ptr)
155 stub VarMod # stdcall (ptr ptr ptr)
156 st
ub VarMul # stdcall (ptr ptr ptr)
156 st
dcall VarMul(ptr ptr ptr) VarMul
157 stdcall VarOr(ptr ptr ptr) VarOr
158 stub VarPow # stdcall (ptr ptr ptr)
159 st
ub VarSub # stdcall (ptr ptr ptr)
159 st
dcall VarSub(ptr ptr ptr) VarSub
160 stdcall CreateTypeLib(long wstr ptr) CreateTypeLib
161 stdcall LoadTypeLib (wstr ptr) LoadTypeLib
162 stdcall LoadRegTypeLib (ptr long long long ptr) LoadRegTypeLib
...
...
dlls/oleaut32/variant.c
View file @
b3be773a
...
...
@@ -5110,10 +5110,17 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
{
BOOL
lOk
=
TRUE
;
BOOL
rOk
=
TRUE
;
LONGLONG
lVal
=
-
1
;
LONGLONG
rVal
=
-
1
;
BOOL
lOk
=
TRUE
;
BOOL
rOk
=
TRUE
;
LONGLONG
lVal
=
-
1
;
LONGLONG
rVal
=
-
1
;
VARIANT
rv
,
lv
;
DWORD
xmask
;
HRESULT
rc
;
VariantInit
(
&
lv
);
VariantInit
(
&
rv
);
V_VT
(
right
)
&=
~
0x8000
;
/* hack since we sometime get this flag. */
V_VT
(
left
)
&=
~
0x8000
;
/* hack since we sometime get this flag. */
TRACE
(
"Left Var:
\n
"
);
dump_Variant
(
left
);
...
...
@@ -5131,6 +5138,30 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
return
VarBstrCmp
(
V_BSTR
(
left
),
V_BSTR
(
right
),
lcid
,
flags
);
}
xmask
=
(
1
<<
(
V_VT
(
left
)
&
VT_TYPEMASK
))
|
(
1
<<
(
V_VT
(
right
)
&
VT_TYPEMASK
));
if
(
xmask
&
(
1
<<
VT_R8
))
{
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
VT_R8
);
if
(
FAILED
(
rc
))
return
rc
;
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
VT_R8
);
if
(
FAILED
(
rc
))
return
rc
;
if
(
V_R8
(
&
lv
)
==
V_R8
(
&
rv
))
return
VARCMP_EQ
;
if
(
V_R8
(
&
lv
)
<
V_R8
(
&
rv
))
return
VARCMP_LT
;
if
(
V_R8
(
&
lv
)
>
V_R8
(
&
rv
))
return
VARCMP_GT
;
return
E_FAIL
;
/* can't get here */
}
if
(
xmask
&
(
1
<<
VT_R4
))
{
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
VT_R4
);
if
(
FAILED
(
rc
))
return
rc
;
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
VT_R4
);
if
(
FAILED
(
rc
))
return
rc
;
if
(
V_R4
(
&
lv
)
==
V_R4
(
&
rv
))
return
VARCMP_EQ
;
if
(
V_R4
(
&
lv
)
<
V_R4
(
&
rv
))
return
VARCMP_LT
;
if
(
V_R4
(
&
lv
)
>
V_R4
(
&
rv
))
return
VARCMP_GT
;
return
E_FAIL
;
/* can't get here */
}
/* Integers - Ideally like to use VarDecCmp, but no Dec support yet
Use LONGLONG to maximize ranges */
lOk
=
TRUE
;
...
...
@@ -5204,8 +5235,6 @@ HRESULT WINAPI VarCmp(LPVARIANT left, LPVARIANT right, LCID lcid, DWORD flags)
return
VARCMP_GT
;
}
}
FIXME
(
"VarCmp partial implementation, doesnt support vt 0x%x / 0x%x
\n
"
,
V_VT
(
left
),
V_VT
(
right
));
return
E_FAIL
;
}
...
...
@@ -5377,6 +5406,177 @@ HRESULT WINAPI VarAdd(LPVARIANT left, LPVARIANT right, LPVARIANT result)
}
/**********************************************************************
* VarMul [OLEAUT32.156]
*
*/
HRESULT
WINAPI
VarMul
(
LPVARIANT
left
,
LPVARIANT
right
,
LPVARIANT
result
)
{
HRESULT
rc
=
E_FAIL
;
VARTYPE
lvt
,
rvt
,
resvt
;
VARIANT
lv
,
rv
;
BOOL
found
;
TRACE
(
"left: "
);
dump_Variant
(
left
);
TRACE
(
"right: "
);
dump_Variant
(
right
);
VariantInit
(
&
lv
);
VariantInit
(
&
rv
);
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
)))
{
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
))))
{
found
=
TRUE
;
resvt
=
VT_I4
;
}
if
(
!
found
)
{
FIXME
(
"can't expand vt %d vs %d to a target type.
\n
"
,
lvt
,
rvt
);
return
E_FAIL
;
}
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
resvt
);
if
(
FAILED
(
rc
))
{
FIXME
(
"Could not convert 0x%x to %d?
\n
"
,
V_VT
(
left
),
resvt
);
return
rc
;
}
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
resvt
);
if
(
FAILED
(
rc
))
{
FIXME
(
"Could not convert 0x%x to %d?
\n
"
,
V_VT
(
right
),
resvt
);
return
rc
;
}
switch
(
resvt
)
{
case
VT_R8
:
V_VT
(
result
)
=
resvt
;
V_R8
(
result
)
=
V_R8
(
&
lv
)
*
V_R8
(
&
rv
);
rc
=
S_OK
;
break
;
case
VT_I4
:
V_VT
(
result
)
=
resvt
;
V_I4
(
result
)
=
V_I4
(
&
lv
)
*
V_I4
(
&
rv
);
rc
=
S_OK
;
break
;
}
TRACE
(
"rc=%d, Result:
\n
"
,
(
int
)
rc
);
dump_Variant
(
result
);
return
rc
;
}
/**********************************************************************
* VarDiv [OLEAUT32.143]
*
*/
HRESULT
WINAPI
VarDiv
(
LPVARIANT
left
,
LPVARIANT
right
,
LPVARIANT
result
)
{
HRESULT
rc
=
E_FAIL
;
VARTYPE
lvt
,
rvt
,
resvt
;
VARIANT
lv
,
rv
;
BOOL
found
;
TRACE
(
"left: "
);
dump_Variant
(
left
);
TRACE
(
"right: "
);
dump_Variant
(
right
);
VariantInit
(
&
lv
);
VariantInit
(
&
rv
);
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
)))
{
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
))))
{
found
=
TRUE
;
resvt
=
VT_I4
;
}
if
(
!
found
)
{
FIXME
(
"can't expand vt %d vs %d to a target type.
\n
"
,
lvt
,
rvt
);
return
E_FAIL
;
}
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
resvt
);
if
(
FAILED
(
rc
))
{
FIXME
(
"Could not convert 0x%x to %d?
\n
"
,
V_VT
(
left
),
resvt
);
return
rc
;
}
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
resvt
);
if
(
FAILED
(
rc
))
{
FIXME
(
"Could not convert 0x%x to %d?
\n
"
,
V_VT
(
right
),
resvt
);
return
rc
;
}
switch
(
resvt
)
{
case
VT_R8
:
V_VT
(
result
)
=
resvt
;
V_R8
(
result
)
=
V_R8
(
&
lv
)
/
V_R8
(
&
rv
);
rc
=
S_OK
;
break
;
case
VT_I4
:
V_VT
(
result
)
=
resvt
;
V_I4
(
result
)
=
V_I4
(
&
lv
)
/
V_I4
(
&
rv
);
rc
=
S_OK
;
break
;
}
TRACE
(
"rc=%d, Result:
\n
"
,
(
int
)
rc
);
dump_Variant
(
result
);
return
rc
;
}
/**********************************************************************
* VarSub [OLEAUT32.159]
*
*/
HRESULT
WINAPI
VarSub
(
LPVARIANT
left
,
LPVARIANT
right
,
LPVARIANT
result
)
{
HRESULT
rc
=
E_FAIL
;
VARTYPE
lvt
,
rvt
,
resvt
;
VARIANT
lv
,
rv
;
BOOL
found
;
TRACE
(
"left: "
);
dump_Variant
(
left
);
TRACE
(
"right: "
);
dump_Variant
(
right
);
VariantInit
(
&
lv
);
VariantInit
(
&
rv
);
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
)))
{
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
))))
{
found
=
TRUE
;
resvt
=
VT_I4
;
}
if
(
!
found
)
{
FIXME
(
"can't expand vt %d vs %d to a target type.
\n
"
,
lvt
,
rvt
);
return
E_FAIL
;
}
rc
=
VariantChangeType
(
&
lv
,
left
,
0
,
resvt
);
if
(
FAILED
(
rc
))
{
FIXME
(
"Could not convert 0x%x to %d?
\n
"
,
V_VT
(
left
),
resvt
);
return
rc
;
}
rc
=
VariantChangeType
(
&
rv
,
right
,
0
,
resvt
);
if
(
FAILED
(
rc
))
{
FIXME
(
"Could not convert 0x%x to %d?
\n
"
,
V_VT
(
right
),
resvt
);
return
rc
;
}
switch
(
resvt
)
{
case
VT_R8
:
V_VT
(
result
)
=
resvt
;
V_R8
(
result
)
=
V_R8
(
&
lv
)
-
V_R8
(
&
rv
);
rc
=
S_OK
;
break
;
case
VT_I4
:
V_VT
(
result
)
=
resvt
;
V_I4
(
result
)
=
V_I4
(
&
lv
)
-
V_I4
(
&
rv
);
rc
=
S_OK
;
break
;
}
TRACE
(
"rc=%d, Result:
\n
"
,
(
int
)
rc
);
dump_Variant
(
result
);
return
rc
;
}
/**********************************************************************
* VarOr [OLEAUT32.157]
*
*/
...
...
@@ -5895,9 +6095,14 @@ HRESULT WINAPI VarFormat(LPVARIANT varIn, LPOLESTR format,
}
else
{
sprintf
(
pBuffer
,
"%f"
,
V_UNION
(
varIn
,
dblVal
));
}
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
}
else
if
((
V_VT
(
varIn
)
&
VT_TYPEMASK
)
==
VT_I2
)
{
if
(
V_VT
(
varIn
)
&
VT_BYREF
)
{
sprintf
(
pBuffer
,
"%d"
,
*
V_UNION
(
varIn
,
piVal
));
}
else
{
sprintf
(
pBuffer
,
"%d"
,
V_UNION
(
varIn
,
iVal
));
}
*
pbstrOut
=
StringDupAtoBstr
(
pBuffer
);
}
else
if
((
V_VT
(
varIn
)
&
VT_TYPEMASK
)
==
VT_BSTR
)
{
if
(
V_VT
(
varIn
)
&
VT_BYREF
)
*
pbstrOut
=
SysAllocString
(
*
V_UNION
(
varIn
,
pbstrVal
)
);
...
...
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