Robert Shearman : oleaut: Move the processing of functions in SLTG typelibs into a

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 6 06:08:44 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: f2eb2d230922a10455069fe381182f957cf3b62e
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=f2eb2d230922a10455069fe381182f957cf3b62e

Author: Robert Shearman <rob at codeweavers.com>
Date:   Mon Jul  3 13:54:29 2006 +0100

oleaut: Move the processing of functions in SLTG typelibs into a
separate function and use it when processing dispinterfaces.

---

 dlls/oleaut32/typelib.c |  100 +++++++++++++++++++++++++----------------------
 1 files changed, 54 insertions(+), 46 deletions(-)

diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index efe1720..c61bd36 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2884,47 +2884,14 @@ static void SLTG_DoVars(char *pBlk, ITyp
   pTI->TypeAttr.cVars = cVars;
 }
 
-static void SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI,
-				char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
-				SLTG_TypeInfoTail *pTITail)
-{
-    char *pFirstItem, *pNextItem;
-
-    if(pTIHeader->href_table != 0xffffffff) {
-        SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI,
-		    pNameTable);
-    }
-
-    pFirstItem = pNextItem = pBlk;
-
-    if(*(WORD*)pFirstItem == SLTG_IMPL_MAGIC) {
-        pNextItem = SLTG_DoImpls(pFirstItem, pTI, FALSE);
-    }
-}
-
-
-static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
-				  char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
-				  SLTG_TypeInfoTail *pTITail)
+static void SLTG_DoFuncs(char *pBlk, char *pFirstItem, ITypeInfoImpl *pTI, unsigned short cFuncs, char *pNameTable)
 {
     SLTG_Function *pFunc;
-    char *pFirstItem, *pNextItem;
+    unsigned short i;
     TLBFuncDesc **ppFuncDesc = &pTI->funclist;
-    int num = 0;
-
-    if(pTIHeader->href_table != 0xffffffff) {
-        SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI,
-		    pNameTable);
-    }
 
-    pFirstItem = pNextItem = pBlk;
-
-    if(*(WORD*)pFirstItem == SLTG_IMPL_MAGIC) {
-        pNextItem = SLTG_DoImpls(pFirstItem, pTI, TRUE);
-    }
-
-    for(pFunc = (SLTG_Function*)pNextItem, num = 1; 1;
-	pFunc = (SLTG_Function*)(pFirstItem + pFunc->next), num++) {
+    for(pFunc = (SLTG_Function*)pFirstItem, i = 0; i < cFuncs;
+	pFunc = (SLTG_Function*)(pBlk + pFunc->next), i++) {
 
         int param;
 	WORD *pType, *pArg;
@@ -2951,10 +2918,9 @@ static void SLTG_ProcessInterface(char *
 	if(pFunc->retnextopt & 0x80)
 	    pType = &pFunc->rettype;
 	else
-	    pType = (WORD*)(pFirstItem + pFunc->rettype);
-
+	    pType = (WORD*)(pBlk + pFunc->rettype);
 
-	SLTG_DoElem(pType, pFirstItem, &(*ppFuncDesc)->funcdesc.elemdescFunc);
+	SLTG_DoElem(pType, pBlk, &(*ppFuncDesc)->funcdesc.elemdescFunc);
 
 	(*ppFuncDesc)->funcdesc.lprgelemdescParam =
 	  HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
@@ -2963,7 +2929,7 @@ static void SLTG_ProcessInterface(char *
 	  HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
 		    (*ppFuncDesc)->funcdesc.cParams * sizeof(TLBParDesc));
 
-	pArg = (WORD*)(pFirstItem + pFunc->arg_off);
+	pArg = (WORD*)(pBlk + pFunc->arg_off);
 
 	for(param = 0; param < (*ppFuncDesc)->funcdesc.cParams; param++) {
 	    char *paramName = pNameTable + *pArg;
@@ -2990,14 +2956,14 @@ static void SLTG_ProcessInterface(char *
 	    pArg++;
 
 	    if(HaveOffs) { /* the next word is an offset to type */
-	        pType = (WORD*)(pFirstItem + *pArg);
-		SLTG_DoElem(pType, pFirstItem,
+	        pType = (WORD*)(pBlk + *pArg);
+		SLTG_DoElem(pType, pBlk,
 			    &(*ppFuncDesc)->funcdesc.lprgelemdescParam[param]);
 		pArg++;
 	    } else {
 		if(paramName)
 		  paramName--;
-		pArg = SLTG_DoElem(pArg, pFirstItem,
+		pArg = SLTG_DoElem(pArg, pBlk,
 			   &(*ppFuncDesc)->funcdesc.lprgelemdescParam[param]);
 	    }
 
@@ -3015,7 +2981,48 @@ static void SLTG_ProcessInterface(char *
 	ppFuncDesc = &((*ppFuncDesc)->next);
 	if(pFunc->next == 0xffff) break;
     }
-    pTI->TypeAttr.cFuncs = num;
+    pTI->TypeAttr.cFuncs = cFuncs;
+}
+
+static void SLTG_ProcessCoClass(char *pBlk, ITypeInfoImpl *pTI,
+				char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
+				SLTG_TypeInfoTail *pTITail)
+{
+    char *pFirstItem, *pNextItem;
+
+    if(pTIHeader->href_table != 0xffffffff) {
+        SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI,
+		    pNameTable);
+    }
+
+    pFirstItem = pNextItem = pBlk;
+
+    if(*(WORD*)pFirstItem == SLTG_IMPL_MAGIC) {
+        pNextItem = SLTG_DoImpls(pFirstItem, pTI, FALSE);
+    }
+}
+
+
+static void SLTG_ProcessInterface(char *pBlk, ITypeInfoImpl *pTI,
+				  char *pNameTable, SLTG_TypeInfoHeader *pTIHeader,
+				  SLTG_TypeInfoTail *pTITail)
+{
+    char *pFirstItem, *pNextItem;
+
+    if(pTIHeader->href_table != 0xffffffff) {
+        SLTG_DoRefs((SLTG_RefInfo*)((char *)pTIHeader + pTIHeader->href_table), pTI,
+		    pNameTable);
+    }
+
+    pFirstItem = pNextItem = pBlk;
+
+    if(*(WORD*)pFirstItem == SLTG_IMPL_MAGIC) {
+        pNextItem = SLTG_DoImpls(pFirstItem, pTI, TRUE);
+    }
+
+    if (pTITail->funcs_off != 0xffff)
+        SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable);
+
     if (TRACE_ON(typelib))
         dump_TLBFuncDesc(pTI->funclist);
 }
@@ -3061,7 +3068,8 @@ static void SLTG_ProcessDispatch(char *p
   if (pTITail->vars_off != 0xffff)
     SLTG_DoVars(pBlk + pTITail->vars_off, pTI, pTITail->cVars, pNameTable);
 
-  FIXME_(typelib)("process funcs\n");
+  if (pTITail->funcs_off != 0xffff)
+    SLTG_DoFuncs(pBlk, pBlk + pTITail->funcs_off, pTI, pTITail->cFuncs, pNameTable);
 }
 
 static void SLTG_ProcessEnum(char *pBlk, ITypeInfoImpl *pTI,




More information about the wine-cvs mailing list