From db498b3bf2a17e4e66845bd0988a7aaac780cfd9 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Mon, 10 Feb 2020 14:57:04 +0100 Subject: [PATCH] oleaut32: Use ITypeInfoImpl_GetInternalFuncDesc in a few more places. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/oleaut32/typelib.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index 7020f68ba79..68c31e1d88d 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -5264,7 +5264,7 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation2( return result; } -static HRESULT TLB_copy_all_custdata(struct list *custdata_list, CUSTDATA *pCustData) +static HRESULT TLB_copy_all_custdata(const struct list *custdata_list, CUSTDATA *pCustData) { TLBCustData *pCData; unsigned int ct; @@ -8418,14 +8418,17 @@ static HRESULT WINAPI ITypeInfo2_fnGetParamCustData( VARIANT *pVarVal) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); + const TLBFuncDesc *pFDesc; TLBCustData *pCData; - TLBFuncDesc *pFDesc = &This->funcdescs[indexFunc]; + UINT hrefoffset; + HRESULT hr; TRACE("%p %u %u %s %p\n", This, indexFunc, indexParam, debugstr_guid(guid), pVarVal); - if(indexFunc >= This->typeattr.cFuncs) - return TYPE_E_ELEMENTNOTFOUND; + hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, indexFunc, &pFDesc, &hrefoffset); + if (FAILED(hr)) + return hr; if(indexParam >= pFDesc->funcdesc.cParams) return TYPE_E_ELEMENTNOTFOUND; @@ -8587,12 +8590,15 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllFuncCustData( CUSTDATA *pCustData) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); - TLBFuncDesc *pFDesc = &This->funcdescs[index]; + const TLBFuncDesc *pFDesc; + UINT hrefoffset; + HRESULT hr; TRACE("%p %u %p\n", This, index, pCustData); - if(index >= This->typeattr.cFuncs) - return TYPE_E_ELEMENTNOTFOUND; + hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, index, &pFDesc, &hrefoffset); + if (FAILED(hr)) + return hr; return TLB_copy_all_custdata(&pFDesc->custdata_list, pCustData); } @@ -8606,12 +8612,15 @@ static HRESULT WINAPI ITypeInfo2_fnGetAllParamCustData( ITypeInfo2 * iface, UINT indexFunc, UINT indexParam, CUSTDATA *pCustData) { ITypeInfoImpl *This = impl_from_ITypeInfo2(iface); - TLBFuncDesc *pFDesc = &This->funcdescs[indexFunc]; + const TLBFuncDesc *pFDesc; + UINT hrefoffset; + HRESULT hr; TRACE("%p %u %u %p\n", This, indexFunc, indexParam, pCustData); - if(indexFunc >= This->typeattr.cFuncs) - return TYPE_E_ELEMENTNOTFOUND; + hr = ITypeInfoImpl_GetInternalFuncDesc((ITypeInfo *)iface, indexFunc, &pFDesc, &hrefoffset); + if (FAILED(hr)) + return hr; if(indexParam >= pFDesc->funcdesc.cParams) return TYPE_E_ELEMENTNOTFOUND;