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
06842c70
Commit
06842c70
authored
Dec 10, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Dec 10, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
oleaut32/typelib: Simplify variable and function description lookup helpers.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5d05d4ac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
32 deletions
+35
-32
typelib.c
dlls/oleaut32/typelib.c
+35
-32
No files found.
dlls/oleaut32/typelib.c
View file @
06842c70
...
...
@@ -1679,39 +1679,42 @@ static BSTR TLB_MultiByteToBSTR(const char *ptr)
return
ret
;
}
static
inline
TLBFuncDesc
*
TLB_get_funcdesc_by_memberid
(
TLBFuncDesc
*
funcdescs
,
UINT
n
,
MEMBERID
memid
)
static
inline
TLBFuncDesc
*
TLB_get_funcdesc_by_memberid
(
ITypeInfoImpl
*
typeinfo
,
MEMBERID
memid
)
{
while
(
n
){
if
(
funcdescs
->
funcdesc
.
memid
==
memid
)
return
funcdescs
;
++
funcdescs
;
--
n
;
int
i
;
for
(
i
=
0
;
i
<
typeinfo
->
typeattr
.
cFuncs
;
++
i
)
{
if
(
typeinfo
->
funcdescs
[
i
].
funcdesc
.
memid
==
memid
)
return
&
typeinfo
->
funcdescs
[
i
];
}
return
NULL
;
}
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_memberid
(
TLBVarDesc
*
vardescs
,
UINT
n
,
MEMBERID
memid
)
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_memberid
(
ITypeInfoImpl
*
typeinfo
,
MEMBERID
memid
)
{
while
(
n
){
if
(
vardescs
->
vardesc
.
memid
==
memid
)
return
vardescs
;
++
vardescs
;
--
n
;
int
i
;
for
(
i
=
0
;
i
<
typeinfo
->
typeattr
.
cVars
;
++
i
)
{
if
(
typeinfo
->
vardescs
[
i
].
vardesc
.
memid
==
memid
)
return
&
typeinfo
->
vardescs
[
i
];
}
return
NULL
;
}
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_name
(
TLBVarDesc
*
vardescs
,
UINT
n
,
const
OLECHAR
*
name
)
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_name
(
ITypeInfoImpl
*
typeinfo
,
const
OLECHAR
*
name
)
{
while
(
n
){
if
(
!
lstrcmpiW
(
TLB_get_bstr
(
vardescs
->
Name
),
name
))
return
vardescs
;
++
vardescs
;
--
n
;
int
i
;
for
(
i
=
0
;
i
<
typeinfo
->
typeattr
.
cVars
;
++
i
)
{
if
(
!
lstrcmpiW
(
TLB_get_bstr
(
typeinfo
->
vardescs
[
i
].
Name
),
name
))
return
&
typeinfo
->
vardescs
[
i
];
}
return
NULL
;
}
...
...
@@ -5128,7 +5131,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
}
}
var
=
TLB_get_vardesc_by_name
(
pTInfo
->
vardescs
,
pTInfo
->
typeattr
.
cVars
,
name
);
var
=
TLB_get_vardesc_by_name
(
pTInfo
,
name
);
if
(
var
)
{
memid
[
count
]
=
var
->
vardesc
.
memid
;
goto
ITypeLib2_fnFindName_exit
;
...
...
@@ -6117,7 +6120,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
*
pcNames
=
0
;
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
->
funcdescs
,
This
->
typeattr
.
cFuncs
,
memid
);
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
,
memid
);
if
(
pFDesc
)
{
if
(
!
cMaxNames
||
!
pFDesc
->
Name
)
...
...
@@ -6135,7 +6138,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
return
S_OK
;
}
pVDesc
=
TLB_get_vardesc_by_memberid
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
memid
);
pVDesc
=
TLB_get_vardesc_by_memberid
(
This
,
memid
);
if
(
pVDesc
)
{
*
rgBstrNames
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
Name
));
...
...
@@ -6294,7 +6297,7 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface,
return
ret
;
}
}
pVDesc
=
TLB_get_vardesc_by_name
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
*
rgszNames
);
pVDesc
=
TLB_get_vardesc_by_name
(
This
,
*
rgszNames
);
if
(
pVDesc
){
if
(
cNames
)
*
pMemId
=
pVDesc
->
vardesc
.
memid
;
...
...
@@ -7743,7 +7746,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
*
pBstrHelpFile
=
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpFile
));
return
S_OK
;
}
else
{
/* for a member */
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
->
funcdescs
,
This
->
typeattr
.
cFuncs
,
memid
);
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
,
memid
);
if
(
pFDesc
){
if
(
pBstrName
)
*
pBstrName
=
SysAllocString
(
TLB_get_bstr
(
pFDesc
->
Name
));
...
...
@@ -7755,7 +7758,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
*
pBstrHelpFile
=
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpFile
));
return
S_OK
;
}
pVDesc
=
TLB_get_vardesc_by_memberid
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
memid
);
pVDesc
=
TLB_get_vardesc_by_memberid
(
This
,
memid
);
if
(
pVDesc
){
if
(
pBstrName
)
*
pBstrName
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
Name
));
...
...
@@ -7809,7 +7812,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
if
(
This
->
typeattr
.
typekind
!=
TKIND_MODULE
)
return
TYPE_E_BADMODULEKIND
;
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
->
funcdescs
,
This
->
typeattr
.
cFuncs
,
memid
);
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
,
memid
);
if
(
pFDesc
){
dump_TypeInfo
(
This
);
if
(
TRACE_ON
(
ole
))
...
...
@@ -8317,7 +8320,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarIndexOfMemId( ITypeInfo2 * iface,
TRACE
(
"%p %d %p
\n
"
,
iface
,
memid
,
pVarIndex
);
pVarInfo
=
TLB_get_vardesc_by_memberid
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
memid
);
pVarInfo
=
TLB_get_vardesc_by_memberid
(
This
,
memid
);
if
(
!
pVarInfo
)
return
TYPE_E_ELEMENTNOTFOUND
;
...
...
@@ -8510,7 +8513,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpStringDll
));
/* FIXME */
return
S_OK
;
}
else
{
/* for a member */
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
->
funcdescs
,
This
->
typeattr
.
cFuncs
,
memid
);
pFDesc
=
TLB_get_funcdesc_by_memberid
(
This
,
memid
);
if
(
pFDesc
){
if
(
pbstrHelpString
)
*
pbstrHelpString
=
SysAllocString
(
TLB_get_bstr
(
pFDesc
->
HelpString
));
...
...
@@ -8521,7 +8524,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpStringDll
));
/* FIXME */
return
S_OK
;
}
pVDesc
=
TLB_get_vardesc_by_memberid
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
memid
);
pVDesc
=
TLB_get_vardesc_by_memberid
(
This
,
memid
);
if
(
pVDesc
){
if
(
pbstrHelpString
)
*
pbstrHelpString
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
HelpString
));
...
...
@@ -8868,7 +8871,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
ITypeInfo_AddRef
(
*
ppTInfo
);
return
S_OK
;
}
else
{
pVDesc
=
TLB_get_vardesc_by_name
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
szName
);
pVDesc
=
TLB_get_vardesc_by_name
(
This
,
szName
);
if
(
pVDesc
){
HRESULT
hr
=
TLB_AllocAndInitVarDesc
(
&
pVDesc
->
vardesc
,
&
pBindPtr
->
lpvardesc
);
if
(
FAILED
(
hr
))
...
...
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