Commit 30b516b8 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

oleaut32: Use structure size instead of hardcoded values.

parent f88d7bc8
...@@ -1976,7 +1976,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( ...@@ -1976,7 +1976,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
insert = alloc_cyclic_list_item(CyclicListFunc); insert = alloc_cyclic_list_item(CyclicListFunc);
if(!insert) if(!insert)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
insert->u.data = HeapAlloc(GetProcessHeap(), 0, sizeof(int[6])+sizeof(int[(num_defaults?4:3)])*pFuncDesc->cParams); insert->u.data = HeapAlloc(GetProcessHeap(), 0, FIELD_OFFSET(MSFT_FuncRecord, HelpContext)+
sizeof(int[(num_defaults?4:3)])*pFuncDesc->cParams);
if(!insert->u.data) { if(!insert->u.data) {
HeapFree(GetProcessHeap(), 0, insert); HeapFree(GetProcessHeap(), 0, insert);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1984,7 +1985,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( ...@@ -1984,7 +1985,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
/* fill out the basic type information */ /* fill out the basic type information */
typedata = insert->u.data; typedata = insert->u.data;
typedata[0] = 0x18 + pFuncDesc->cParams*(num_defaults?16:12); typedata[0] = FIELD_OFFSET(MSFT_FuncRecord, HelpContext) + pFuncDesc->cParams*(num_defaults?16:12);
ctl2_encode_typedesc(This->typelib, &pFuncDesc->elemdescFunc.tdesc, &typedata[1], NULL, NULL, &decoded_size); ctl2_encode_typedesc(This->typelib, &pFuncDesc->elemdescFunc.tdesc, &typedata[1], NULL, NULL, &decoded_size);
typedata[2] = pFuncDesc->wFuncFlags; typedata[2] = pFuncDesc->wFuncFlags;
typedata[3] = ((sizeof(FUNCDESC) + decoded_size) << 16) | (unsigned short)(pFuncDesc->oVft?pFuncDesc->oVft+1:0); typedata[3] = ((sizeof(FUNCDESC) + decoded_size) << 16) | (unsigned short)(pFuncDesc->oVft?pFuncDesc->oVft+1:0);
...@@ -2048,7 +2049,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc( ...@@ -2048,7 +2049,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
} }
/* update type data size */ /* update type data size */
This->typedata->next->u.val += 0x18 + pFuncDesc->cParams*(num_defaults?16:12); This->typedata->next->u.val += FIELD_OFFSET(MSFT_FuncRecord, HelpContext) + pFuncDesc->cParams*(num_defaults?16:12);
/* Increment the number of function elements */ /* Increment the number of function elements */
This->typeinfo->cElement += 1; This->typeinfo->cElement += 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment