Hello Alistair,
sorry that I missed the first time. And Alexandre should have marked it
as PENDING (good idea but current implementation is rejected).
Alistair Leslie-Hughes wrote:
> Changelog:
> oleaut32: COM Cleanup ICreateTypeLib2Imp
>
>
> Best Regards
> Alistair Leslie-Hughes
> >From 4e5e70b84cc4a254e5e3bdfeb788282a20a3dd50 Mon Sep 17 00:00:00 2001
> From: Alistair Leslie-Hughes <leslie_alistair(a)hotmail.com>
> Date: Mon, 27 Jun 2011 22:24:09 +1000
> Subject: [PATCH] COM Cleanup ICreateTypeLib2Imp
> To: wine-patches <wine-patches(a)winehq.org>
>
> ---
> dlls/oleaut32/typelib2.c | 75 ++++++++++++++++++++++++---------------------
> 1 files changed, 40 insertions(+), 35 deletions(-)
>
> diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
> index e9c7613..5740ddd 100644
> --- a/dlls/oleaut32/typelib2.c
> +++ b/dlls/oleaut32/typelib2.c
> @@ -1476,7 +1481,7 @@ static HRESULT ctl2_find_typeinfo_from_offset(
>
> for (typeinfo = This->typeinfos; typeinfo; typeinfo = typeinfo->next_typeinfo) {
> if (typeinfo->typeinfo == typeinfodata) {
> - *ppTinfo = (ITypeInfo *)&typeinfo->lpVtblTypeInfo2;
> + *ppTinfo = (ITypeInfo *)&typeinfo->ITypeInfo2_iface.lpVtbl;
Please don't cast a vtable to an iface, cast the iface instead:
+ *ppTinfo = (ITypeInfo *)&typeinfo->ITypeInfo2_iface
> ITypeInfo2_AddRef(*ppTinfo);
> return S_OK;
> }
> @@ -1573,7 +1578,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnQueryInterface(
> *ppvObject = This;
> } else if (IsEqualIID(riid, &IID_ITypeInfo) ||
> IsEqualIID(riid, &IID_ITypeInfo2)) {
> - *ppvObject = &This->lpVtblTypeInfo2;
> + *ppvObject = &This->ITypeInfo2_iface.lpVtbl;
No need to go here down to the vtable:
+ *ppvObject = &This->ITypeInfo2_iface
It's the exact same thing but shorter.
> }
>
> if(*ppvObject)
> @@ -1697,7 +1702,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnSetTypeFlags(ICreateTypeInfo2 *iface, U
> iter->next_typeinfo = This->dual;
> }
> } else
> - iface = (ICreateTypeInfo2*)&This->dual->lpVtbl;
> + iface = (ICreateTypeInfo2*)&This->dual->ICreateTypeInfo2_iface.lpVtbl;
There's no need for a cast here as you already have the right thing:
+ iface = &This->dual->ICreateTypeInfo2_iface;
> }
>
> if (uTypeFlags & (TYPEFLAG_FDISPATCHABLE|TYPEFLAG_FDUAL)) {
You missed a few changes:
@@ -3153,7 +3158,7 @@
{
ICreateTypeInfo2Impl *This = impl_from_ITypeInfo2(iface);
- return ICreateTypeInfo2_QueryInterface((ICreateTypeInfo2 *)This,
riid, ppv);
+ return
ICreateTypeInfo2_QueryInterface(&This->ICreateTypeInfo2_iface, riid, ppv);
}
There are more of those "(ICreateTypeInfo2 *)This" ==>
"&This->ICreateTypeInfo2_iface" changes. Check for all (ICreateTypeInfo2
*),
there should be none left.
> @@ -3388,7 +3393,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeOfImplType(
> }
>
> if(This->typekind == TKIND_DISPATCH)
> - return ITypeInfo2_GetRefTypeOfImplType((ITypeInfo2*)&This->dual->lpVtblTypeInfo2,
> + return ITypeInfo2_GetRefTypeOfImplType((ITypeInfo2*)&This->dual->ITypeInfo2_iface.lpVtbl,
No need for the cast:
+ return
ITypeInfo2_GetRefTypeOfImplType(&This->dual->ITypeInfo2_iface,
> index, pRefType);
> }
>
> @@ -3599,7 +3604,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo(
> return E_INVALIDARG;
>
> if(hRefType==-2 && This->dual) {
> - *ppTInfo = (ITypeInfo*)&This->dual->lpVtblTypeInfo2;
> + *ppTInfo = (ITypeInfo*)&This->dual->ITypeInfo2_iface.lpVtbl;
Just cast the iface:
+ *ppTInfo = (ITypeInfo*)&This->dual->ITypeInfo2_iface;
> ITypeInfo_AddRef(*ppTInfo);
> return S_OK;
> }
> @@ -3635,7 +3640,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetRefTypeInfo(
>
> for(iter=This->typelib->typeinfos; iter; iter=iter->next_typeinfo) {
> if(This->typelib->typelib_typeinfo_offsets[i] == (hRefType&(~0x3))) {
> - *ppTInfo = (ITypeInfo*)&iter->lpVtblTypeInfo2;
> + *ppTInfo = (ITypeInfo*)&iter->ITypeInfo2_iface.lpVtbl;
Same here:
+ *ppTInfo = (ITypeInfo*)&iter->ITypeInfo2_iface;
>
> ITypeLib_AddRef(*ppTInfo);
> return S_OK;
> @@ -4948,7 +4953,7 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
> if(!iter)
> return TYPE_E_ELEMENTNOTFOUND;
>
> - return ITypeInfo_GetDocumentation((ITypeInfo*)&iter->lpVtblTypeInfo2,
> + return ITypeInfo_GetDocumentation((ITypeInfo*)&iter->ITypeInfo2_iface.lpVtbl,
And here:
+ return
ITypeInfo_GetDocumentation((ITypeInfo*)&iter->ITypeInfo2_iface,
> -1, pBstrName, pBstrDocString, pdwHelpContext, pBstrHelpFile);
> }
>
thanks
bye
michael