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)
...
@@ -1679,39 +1679,42 @@ static BSTR TLB_MultiByteToBSTR(const char *ptr)
return
ret
;
return
ret
;
}
}
static
inline
TLBFuncDesc
*
TLB_get_funcdesc_by_memberid
(
TLBFuncDesc
*
funcdescs
,
static
inline
TLBFuncDesc
*
TLB_get_funcdesc_by_memberid
(
ITypeInfoImpl
*
typeinfo
,
MEMBERID
memid
)
UINT
n
,
MEMBERID
memid
)
{
{
while
(
n
){
int
i
;
if
(
funcdescs
->
funcdesc
.
memid
==
memid
)
return
funcdescs
;
for
(
i
=
0
;
i
<
typeinfo
->
typeattr
.
cFuncs
;
++
i
)
++
funcdescs
;
{
--
n
;
if
(
typeinfo
->
funcdescs
[
i
].
funcdesc
.
memid
==
memid
)
return
&
typeinfo
->
funcdescs
[
i
];
}
}
return
NULL
;
return
NULL
;
}
}
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_memberid
(
TLBVarDesc
*
vardescs
,
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_memberid
(
ITypeInfoImpl
*
typeinfo
,
MEMBERID
memid
)
UINT
n
,
MEMBERID
memid
)
{
{
while
(
n
){
int
i
;
if
(
vardescs
->
vardesc
.
memid
==
memid
)
return
vardescs
;
for
(
i
=
0
;
i
<
typeinfo
->
typeattr
.
cVars
;
++
i
)
++
vardescs
;
{
--
n
;
if
(
typeinfo
->
vardescs
[
i
].
vardesc
.
memid
==
memid
)
return
&
typeinfo
->
vardescs
[
i
];
}
}
return
NULL
;
return
NULL
;
}
}
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_name
(
TLBVarDesc
*
vardescs
,
static
inline
TLBVarDesc
*
TLB_get_vardesc_by_name
(
ITypeInfoImpl
*
typeinfo
,
const
OLECHAR
*
name
)
UINT
n
,
const
OLECHAR
*
name
)
{
{
while
(
n
){
int
i
;
if
(
!
lstrcmpiW
(
TLB_get_bstr
(
vardescs
->
Name
),
name
))
return
vardescs
;
for
(
i
=
0
;
i
<
typeinfo
->
typeattr
.
cVars
;
++
i
)
++
vardescs
;
{
--
n
;
if
(
!
lstrcmpiW
(
TLB_get_bstr
(
typeinfo
->
vardescs
[
i
].
Name
),
name
))
return
&
typeinfo
->
vardescs
[
i
];
}
}
return
NULL
;
return
NULL
;
}
}
...
@@ -5128,7 +5131,7 @@ static HRESULT WINAPI ITypeLib2_fnFindName(
...
@@ -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
)
{
if
(
var
)
{
memid
[
count
]
=
var
->
vardesc
.
memid
;
memid
[
count
]
=
var
->
vardesc
.
memid
;
goto
ITypeLib2_fnFindName_exit
;
goto
ITypeLib2_fnFindName_exit
;
...
@@ -6117,7 +6120,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
...
@@ -6117,7 +6120,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
*
pcNames
=
0
;
*
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
(
pFDesc
)
{
{
if
(
!
cMaxNames
||
!
pFDesc
->
Name
)
if
(
!
cMaxNames
||
!
pFDesc
->
Name
)
...
@@ -6135,7 +6138,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
...
@@ -6135,7 +6138,7 @@ static HRESULT WINAPI ITypeInfo_fnGetNames( ITypeInfo2 *iface, MEMBERID memid,
return
S_OK
;
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
(
pVDesc
)
{
{
*
rgBstrNames
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
Name
));
*
rgBstrNames
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
Name
));
...
@@ -6294,7 +6297,7 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface,
...
@@ -6294,7 +6297,7 @@ static HRESULT WINAPI ITypeInfo_fnGetIDsOfNames( ITypeInfo2 *iface,
return
ret
;
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
(
pVDesc
){
if
(
cNames
)
if
(
cNames
)
*
pMemId
=
pVDesc
->
vardesc
.
memid
;
*
pMemId
=
pVDesc
->
vardesc
.
memid
;
...
@@ -7743,7 +7746,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
...
@@ -7743,7 +7746,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
*
pBstrHelpFile
=
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpFile
));
*
pBstrHelpFile
=
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpFile
));
return
S_OK
;
return
S_OK
;
}
else
{
/* for a member */
}
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
(
pFDesc
){
if
(
pBstrName
)
if
(
pBstrName
)
*
pBstrName
=
SysAllocString
(
TLB_get_bstr
(
pFDesc
->
Name
));
*
pBstrName
=
SysAllocString
(
TLB_get_bstr
(
pFDesc
->
Name
));
...
@@ -7755,7 +7758,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
...
@@ -7755,7 +7758,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDocumentation( ITypeInfo2 *iface,
*
pBstrHelpFile
=
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpFile
));
*
pBstrHelpFile
=
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpFile
));
return
S_OK
;
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
(
pVDesc
){
if
(
pBstrName
)
if
(
pBstrName
)
*
pBstrName
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
Name
));
*
pBstrName
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
Name
));
...
@@ -7809,7 +7812,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
...
@@ -7809,7 +7812,7 @@ static HRESULT WINAPI ITypeInfo_fnGetDllEntry( ITypeInfo2 *iface, MEMBERID memid
if
(
This
->
typeattr
.
typekind
!=
TKIND_MODULE
)
if
(
This
->
typeattr
.
typekind
!=
TKIND_MODULE
)
return
TYPE_E_BADMODULEKIND
;
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
){
if
(
pFDesc
){
dump_TypeInfo
(
This
);
dump_TypeInfo
(
This
);
if
(
TRACE_ON
(
ole
))
if
(
TRACE_ON
(
ole
))
...
@@ -8317,7 +8320,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarIndexOfMemId( ITypeInfo2 * iface,
...
@@ -8317,7 +8320,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetVarIndexOfMemId( ITypeInfo2 * iface,
TRACE
(
"%p %d %p
\n
"
,
iface
,
memid
,
pVarIndex
);
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
)
if
(
!
pVarInfo
)
return
TYPE_E_ELEMENTNOTFOUND
;
return
TYPE_E_ELEMENTNOTFOUND
;
...
@@ -8510,7 +8513,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
...
@@ -8510,7 +8513,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpStringDll
));
/* FIXME */
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpStringDll
));
/* FIXME */
return
S_OK
;
return
S_OK
;
}
else
{
/* for a member */
}
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
(
pFDesc
){
if
(
pbstrHelpString
)
if
(
pbstrHelpString
)
*
pbstrHelpString
=
SysAllocString
(
TLB_get_bstr
(
pFDesc
->
HelpString
));
*
pbstrHelpString
=
SysAllocString
(
TLB_get_bstr
(
pFDesc
->
HelpString
));
...
@@ -8521,7 +8524,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
...
@@ -8521,7 +8524,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetDocumentation2(
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpStringDll
));
/* FIXME */
SysAllocString
(
TLB_get_bstr
(
This
->
pTypeLib
->
HelpStringDll
));
/* FIXME */
return
S_OK
;
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
(
pVDesc
){
if
(
pbstrHelpString
)
if
(
pbstrHelpString
)
*
pbstrHelpString
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
HelpString
));
*
pbstrHelpString
=
SysAllocString
(
TLB_get_bstr
(
pVDesc
->
HelpString
));
...
@@ -8868,7 +8871,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
...
@@ -8868,7 +8871,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
ITypeInfo_AddRef
(
*
ppTInfo
);
ITypeInfo_AddRef
(
*
ppTInfo
);
return
S_OK
;
return
S_OK
;
}
else
{
}
else
{
pVDesc
=
TLB_get_vardesc_by_name
(
This
->
vardescs
,
This
->
typeattr
.
cVars
,
szName
);
pVDesc
=
TLB_get_vardesc_by_name
(
This
,
szName
);
if
(
pVDesc
){
if
(
pVDesc
){
HRESULT
hr
=
TLB_AllocAndInitVarDesc
(
&
pVDesc
->
vardesc
,
&
pBindPtr
->
lpvardesc
);
HRESULT
hr
=
TLB_AllocAndInitVarDesc
(
&
pVDesc
->
vardesc
,
&
pBindPtr
->
lpvardesc
);
if
(
FAILED
(
hr
))
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