mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 996061 - part 2 - split out a method for getting an interface's typelib index; r=bholley
The code that looks up |xptiInterfaceEntry|s starts by figuring out where in the typelib the desired entry lives. We want to do the same thing for the purpose of getting shims, so we can ask the typelib for the name of the thing at that index. Split out a method to do this for us.
This commit is contained in:
parent
c788fadd6d
commit
1dacc16e2c
@ -304,16 +304,17 @@ xptiInterfaceEntry::GetConstant(uint16_t index, JS::MutableHandleValue constant,
|
|||||||
|
|
||||||
// this is a private helper
|
// this is a private helper
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
xptiInterfaceEntry::GetEntryForParam(uint16_t methodIndex,
|
xptiInterfaceEntry::GetInterfaceIndexForParam(uint16_t methodIndex,
|
||||||
const nsXPTParamInfo * param,
|
const nsXPTParamInfo* param,
|
||||||
xptiInterfaceEntry** entry)
|
uint16_t* interfaceIndex)
|
||||||
{
|
{
|
||||||
if(!EnsureResolved())
|
if(!EnsureResolved())
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
if(methodIndex < mMethodBaseIndex)
|
if(methodIndex < mMethodBaseIndex)
|
||||||
return mParent->GetEntryForParam(methodIndex, param, entry);
|
return mParent->GetInterfaceIndexForParam(methodIndex, param,
|
||||||
|
interfaceIndex);
|
||||||
|
|
||||||
if(methodIndex >= mMethodBaseIndex +
|
if(methodIndex >= mMethodBaseIndex +
|
||||||
mDescriptor->num_methods)
|
mDescriptor->num_methods)
|
||||||
@ -333,8 +334,29 @@ xptiInterfaceEntry::GetEntryForParam(uint16_t methodIndex,
|
|||||||
return NS_ERROR_INVALID_ARG;
|
return NS_ERROR_INVALID_ARG;
|
||||||
}
|
}
|
||||||
|
|
||||||
xptiInterfaceEntry* theEntry = mTypelib->
|
*interfaceIndex = td->type.iface;
|
||||||
GetEntryAt(td->type.iface - 1);
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
xptiInterfaceEntry::GetEntryForParam(uint16_t methodIndex,
|
||||||
|
const nsXPTParamInfo * param,
|
||||||
|
xptiInterfaceEntry** entry)
|
||||||
|
{
|
||||||
|
if(!EnsureResolved())
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
|
||||||
|
if(methodIndex < mMethodBaseIndex)
|
||||||
|
return mParent->GetEntryForParam(methodIndex, param, entry);
|
||||||
|
|
||||||
|
uint16_t interfaceIndex = 0;
|
||||||
|
nsresult rv = GetInterfaceIndexForParam(methodIndex, param,
|
||||||
|
&interfaceIndex);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
xptiInterfaceEntry* theEntry = mTypelib->GetEntryAt(interfaceIndex - 1);
|
||||||
|
|
||||||
// This can happen if a declared interface is not available at runtime.
|
// This can happen if a declared interface is not available at runtime.
|
||||||
if(!theEntry)
|
if(!theEntry)
|
||||||
|
@ -275,6 +275,10 @@ private:
|
|||||||
uint16_t dimension,
|
uint16_t dimension,
|
||||||
const XPTTypeDescriptor** type);
|
const XPTTypeDescriptor** type);
|
||||||
|
|
||||||
|
nsresult GetInterfaceIndexForParam(uint16_t methodIndex,
|
||||||
|
const nsXPTParamInfo* param,
|
||||||
|
uint16_t* interfaceIndex);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
nsID mIID;
|
nsID mIID;
|
||||||
XPTInterfaceDescriptor* mDescriptor;
|
XPTInterfaceDescriptor* mDescriptor;
|
||||||
|
Loading…
Reference in New Issue
Block a user