Nikolay Sivov : oleaut32: Use structure size instead of hardcoded values.

Alexandre Julliard julliard at winehq.org
Mon Jan 3 10:58:05 CST 2011


Module: wine
Branch: master
Commit: 30b516b8d4ddff15c1824f14811ce48f4346c038
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=30b516b8d4ddff15c1824f14811ce48f4346c038

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Jan  2 13:41:44 2011 +0300

oleaut32: Use structure size instead of hardcoded values.

---

 dlls/oleaut32/typelib2.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 82915a7..fdf712b 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -1976,7 +1976,8 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
     insert = alloc_cyclic_list_item(CyclicListFunc);
     if(!insert)
         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) {
         HeapFree(GetProcessHeap(), 0, insert);
         return E_OUTOFMEMORY;
@@ -1984,7 +1985,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
 
     /* fill out the basic type information */
     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);
     typedata[2] = pFuncDesc->wFuncFlags;
     typedata[3] = ((sizeof(FUNCDESC) + decoded_size) << 16) | (unsigned short)(pFuncDesc->oVft?pFuncDesc->oVft+1:0);
@@ -2048,7 +2049,7 @@ static HRESULT WINAPI ICreateTypeInfo2_fnAddFuncDesc(
     }
 
     /* 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 */
     This->typeinfo->cElement += 1;




More information about the wine-cvs mailing list