oleaut32: COM cleanup for ITypeInfo object.

This commit is contained in:
Andrew Eikum 2013-05-08 15:12:45 -05:00 committed by Alexandre Julliard
parent 19f3bbc903
commit ddcd368b28
1 changed files with 15 additions and 15 deletions

View File

@ -1094,8 +1094,8 @@ typedef struct tagTLBImplType
/* internal TypeInfo data */ /* internal TypeInfo data */
typedef struct tagITypeInfoImpl typedef struct tagITypeInfoImpl
{ {
const ITypeInfo2Vtbl *lpVtbl; ITypeInfo2 ITypeInfo2_iface;
const ITypeCompVtbl *lpVtblTypeComp; ITypeComp ITypeComp_iface;
LONG ref; LONG ref;
BOOL not_attached_to_typelib; BOOL not_attached_to_typelib;
TYPEATTR TypeAttr ; /* _lots_ of type information. */ TYPEATTR TypeAttr ; /* _lots_ of type information. */
@ -1125,7 +1125,7 @@ typedef struct tagITypeInfoImpl
static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface ) static inline ITypeInfoImpl *info_impl_from_ITypeComp( ITypeComp *iface )
{ {
return (ITypeInfoImpl *)((char*)iface - FIELD_OFFSET(ITypeInfoImpl, lpVtblTypeComp)); return CONTAINING_RECORD(iface, ITypeInfoImpl, ITypeComp_iface);
} }
static const ITypeInfo2Vtbl tinfvt; static const ITypeInfo2Vtbl tinfvt;
@ -4884,7 +4884,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
if (pTypeInfo->Name && !strcmpW(pTypeInfo->Name, szName)) if (pTypeInfo->Name && !strcmpW(pTypeInfo->Name, szName))
{ {
*pDescKind = DESCKIND_TYPECOMP; *pDescKind = DESCKIND_TYPECOMP;
pBindPtr->lptcomp = (ITypeComp *)&pTypeInfo->lpVtblTypeComp; pBindPtr->lptcomp = &pTypeInfo->ITypeComp_iface;
ITypeComp_AddRef(pBindPtr->lptcomp); ITypeComp_AddRef(pBindPtr->lptcomp);
TRACE("module or enum: %s\n", debugstr_w(szName)); TRACE("module or enum: %s\n", debugstr_w(szName));
return S_OK; return S_OK;
@ -4894,7 +4894,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
if ((pTypeInfo->TypeAttr.typekind == TKIND_MODULE) || if ((pTypeInfo->TypeAttr.typekind == TKIND_MODULE) ||
(pTypeInfo->TypeAttr.typekind == TKIND_ENUM)) (pTypeInfo->TypeAttr.typekind == TKIND_ENUM))
{ {
ITypeComp *pSubTypeComp = (ITypeComp *)&pTypeInfo->lpVtblTypeComp; ITypeComp *pSubTypeComp = &pTypeInfo->ITypeComp_iface;
HRESULT hr; HRESULT hr;
hr = ITypeComp_Bind(pSubTypeComp, szName, lHash, wFlags, ppTInfo, pDescKind, pBindPtr); hr = ITypeComp_Bind(pSubTypeComp, szName, lHash, wFlags, ppTInfo, pDescKind, pBindPtr);
@ -4910,7 +4910,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
if ((pTypeInfo->TypeAttr.typekind == TKIND_COCLASS) && if ((pTypeInfo->TypeAttr.typekind == TKIND_COCLASS) &&
(pTypeInfo->TypeAttr.wTypeFlags & TYPEFLAG_FAPPOBJECT)) (pTypeInfo->TypeAttr.wTypeFlags & TYPEFLAG_FAPPOBJECT))
{ {
ITypeComp *pSubTypeComp = (ITypeComp *)&pTypeInfo->lpVtblTypeComp; ITypeComp *pSubTypeComp = &pTypeInfo->ITypeComp_iface;
HRESULT hr; HRESULT hr;
ITypeInfo *subtypeinfo; ITypeInfo *subtypeinfo;
BINDPTR subbindptr; BINDPTR subbindptr;
@ -5013,9 +5013,9 @@ static HRESULT WINAPI ITypeLibComp_fnBindType(
if (pTypeInfo->Name && !strcmpiW(pTypeInfo->Name, szName)) if (pTypeInfo->Name && !strcmpiW(pTypeInfo->Name, szName))
{ {
TRACE("returning %p\n", pTypeInfo); TRACE("returning %p\n", pTypeInfo);
*ppTInfo = (ITypeInfo *)&pTypeInfo->lpVtbl; *ppTInfo = (ITypeInfo *)&pTypeInfo->ITypeInfo2_iface;
ITypeInfo_AddRef(*ppTInfo); ITypeInfo_AddRef(*ppTInfo);
*ppTComp = (ITypeComp *)&pTypeInfo->lpVtblTypeComp; *ppTComp = &pTypeInfo->ITypeComp_iface;
ITypeComp_AddRef(*ppTComp); ITypeComp_AddRef(*ppTComp);
return S_OK; return S_OK;
} }
@ -5046,8 +5046,8 @@ static ITypeInfoImpl* ITypeInfoImpl_Constructor(void)
pTypeInfoImpl = heap_alloc_zero(sizeof(ITypeInfoImpl)); pTypeInfoImpl = heap_alloc_zero(sizeof(ITypeInfoImpl));
if (pTypeInfoImpl) if (pTypeInfoImpl)
{ {
pTypeInfoImpl->lpVtbl = &tinfvt; pTypeInfoImpl->ITypeInfo2_iface.lpVtbl = &tinfvt;
pTypeInfoImpl->lpVtblTypeComp = &tcompvt; pTypeInfoImpl->ITypeComp_iface.lpVtbl = &tcompvt;
pTypeInfoImpl->ref = 0; pTypeInfoImpl->ref = 0;
pTypeInfoImpl->hreftype = -1; pTypeInfoImpl->hreftype = -1;
pTypeInfoImpl->TypeAttr.memidConstructor = MEMBERID_NIL; pTypeInfoImpl->TypeAttr.memidConstructor = MEMBERID_NIL;
@ -5238,7 +5238,7 @@ static HRESULT WINAPI ITypeInfo_fnGetTypeComp( ITypeInfo2 *iface,
TRACE("(%p)->(%p)\n", This, ppTComp); TRACE("(%p)->(%p)\n", This, ppTComp);
*ppTComp = (ITypeComp *)&This->lpVtblTypeComp; *ppTComp = &This->ITypeComp_iface;
ITypeComp_AddRef(*ppTComp); ITypeComp_AddRef(*ppTComp);
return S_OK; return S_OK;
} }
@ -6999,7 +6999,7 @@ static HRESULT WINAPI ITypeInfo_fnGetRefTypeInfo(
if ((This->hreftype != -1) && (This->hreftype == hRefType)) if ((This->hreftype != -1) && (This->hreftype == hRefType))
{ {
*ppTInfo = (ITypeInfo *)&This->lpVtbl; *ppTInfo = (ITypeInfo *)&This->ITypeInfo2_iface;
ITypeInfo_AddRef(*ppTInfo); ITypeInfo_AddRef(*ppTInfo);
result = S_OK; result = S_OK;
} }
@ -7913,7 +7913,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
*pDescKind = DESCKIND_FUNCDESC; *pDescKind = DESCKIND_FUNCDESC;
*ppTInfo = (ITypeInfo *)&This->lpVtbl; *ppTInfo = (ITypeInfo *)&This->ITypeInfo2_iface;
ITypeInfo_AddRef(*ppTInfo); ITypeInfo_AddRef(*ppTInfo);
return S_OK; return S_OK;
} else { } else {
@ -7923,7 +7923,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
*pDescKind = DESCKIND_VARDESC; *pDescKind = DESCKIND_VARDESC;
*ppTInfo = (ITypeInfo *)&This->lpVtbl; *ppTInfo = (ITypeInfo *)&This->ITypeInfo2_iface;
ITypeInfo_AddRef(*ppTInfo); ITypeInfo_AddRef(*ppTInfo);
return S_OK; return S_OK;
} }
@ -7934,7 +7934,7 @@ static HRESULT WINAPI ITypeComp_fnBind(
ITypeInfo *pTInfo; ITypeInfo *pTInfo;
ITypeComp *pTComp; ITypeComp *pTComp;
HRESULT hr; HRESULT hr;
hr=ITypeInfo_GetRefTypeInfo((ITypeInfo *)&This->lpVtbl, This->impltypes[0].hRef, &pTInfo); hr=ITypeInfo2_GetRefTypeInfo(&This->ITypeInfo2_iface, This->impltypes[0].hRef, &pTInfo);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
hr = ITypeInfo_GetTypeComp(pTInfo,&pTComp); hr = ITypeInfo_GetTypeComp(pTInfo,&pTComp);