ChangeSet ID: 21586 CVSROOT: /opt/cvs-commit Module name: wine Changes by: julliard@winehq.org 2005/12/01 05:59:07
Modified files: dlls/oleaut32 : typelib.c
Log message: Robert Shearman rob@codeweavers.com The pparamdescex of an ELEMDESC should only be copied if wParamFlags & PARAMFLAG_DHASDEFAULT. Make ITypeInfo_ReleaseVarDesc use TLB_FreeElemDesc.
Patch: http://cvs.winehq.org/patch.py?id=21586
Old revision New revision Changes Path 1.179 1.180 +9 -9 wine/dlls/oleaut32/typelib.c
Index: wine/dlls/oleaut32/typelib.c diff -u -p wine/dlls/oleaut32/typelib.c:1.179 wine/dlls/oleaut32/typelib.c:1.180 --- wine/dlls/oleaut32/typelib.c:1.179 1 Dec 2005 11:59: 7 -0000 +++ wine/dlls/oleaut32/typelib.c 1 Dec 2005 11:59: 7 -0000 @@ -4333,7 +4333,7 @@ static ULONG WINAPI ITypeInfo_fnRelease( static HRESULT WINAPI ITypeInfo_fnGetTypeAttr( ITypeInfo2 *iface, LPTYPEATTR *ppTypeAttr) { - ITypeInfoImpl *This = (ITypeInfoImpl *)iface; + const ITypeInfoImpl *This = (ITypeInfoImpl *)iface; SIZE_T size;
TRACE("(%p)\n",This); @@ -4382,7 +4382,7 @@ static HRESULT WINAPI ITypeInfo_fnGetTyp static SIZE_T TLB_SizeElemDesc( const ELEMDESC *elemdesc ) { SIZE_T size = TLB_SizeTypeDesc(&elemdesc->tdesc, FALSE); - if (elemdesc->u.paramdesc.pparamdescex) + if (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) size += sizeof(*elemdesc->u.paramdesc.pparamdescex); return size; } @@ -4391,23 +4391,24 @@ static HRESULT TLB_CopyElemDesc( const E { memcpy(dest, src, sizeof(ELEMDESC)); *buffer = TLB_CopyTypeDesc(&dest->tdesc, &src->tdesc, *buffer); - if (src->u.paramdesc.pparamdescex) + if (src->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) { const PARAMDESCEX *pparamdescex_src = src->u.paramdesc.pparamdescex; PARAMDESCEX *pparamdescex_dest = dest->u.paramdesc.pparamdescex = (PARAMDESCEX *)*buffer; *buffer += sizeof(PARAMDESCEX); memcpy(pparamdescex_dest, pparamdescex_src, sizeof(PARAMDESCEX)); VariantInit(&pparamdescex_dest->varDefaultValue); - if (src->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) - return VariantCopy(&pparamdescex_dest->varDefaultValue, - (VARIANTARG *)&pparamdescex_src->varDefaultValue); + return VariantCopy(&pparamdescex_dest->varDefaultValue, + (VARIANTARG *)&pparamdescex_src->varDefaultValue); } + else + dest->u.paramdesc.pparamdescex = NULL; return S_OK; }
static void TLB_FreeElemDesc( ELEMDESC *elemdesc ) { - if (elemdesc->u.paramdesc.pparamdescex) + if (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) VariantClear(&elemdesc->u.paramdesc.pparamdescex->varDefaultValue); }
@@ -5717,8 +5718,7 @@ static void WINAPI ITypeInfo_fnReleaseVa ITypeInfoImpl *This = (ITypeInfoImpl *)iface; TRACE("(%p)->(%p)\n", This, pVarDesc);
- if (pVarDesc->elemdescVar.u.paramdesc.pparamdescex) - VariantClear(&pVarDesc->elemdescVar.u.paramdesc.pparamdescex->varDefaultValue); + TLB_FreeElemDesc(&pVarDesc->elemdescVar); if (pVarDesc->varkind == VAR_CONST) VariantClear(pVarDesc->u.lpvarValue); SysFreeString((BSTR)pVarDesc);