wine/dlls/oleaut32 typelib.c

Alexandre Julliard julliard at wine.codeweavers.com
Thu Dec 1 06:01:12 CST 2005


ChangeSet ID:	21593
CVSROOT:	/opt/cvs-commit
Module name:	wine
Changes by:	julliard at winehq.org	2005/12/01 06:01:12

Modified files:
	dlls/oleaut32  : typelib.c 

Log message:
	Robert Shearman <rob at codeweavers.com>
	Introduce a variable "elemdesc" to eliminate some long common
	expressions.
	Move the contents of the second arguments loop inside the first.
	Move the MSFT_ReadLEDWords so that it is the last statement in the
	loop since it is one of the iterators.

Patch: http://cvs.winehq.org/patch.py?id=21593

Old revision  New revision  Changes     Path
 1.181         1.182         +39 -43     wine/dlls/oleaut32/typelib.c

Index: wine/dlls/oleaut32/typelib.c
diff -u -p wine/dlls/oleaut32/typelib.c:1.181 wine/dlls/oleaut32/typelib.c:1.182
--- wine/dlls/oleaut32/typelib.c:1.181	1 Dec 2005 12: 1:12 -0000
+++ wine/dlls/oleaut32/typelib.c	1 Dec 2005 12: 1:12 -0000
@@ -1780,14 +1780,15 @@ MSFT_DoFuncs(TLBContext*     pcx,
 
             for ( j = 0 ; j < pFuncRec->nrargs ; j++ )
             {
-                TYPEDESC* lpArgTypeDesc = 0;
+                TYPEDESC *lpArgTypeDesc;
+                ELEMDESC *elemdesc = &(*pptfd)->funcdesc.lprgelemdescParam[j];
 
                 MSFT_GetTdesc(pcx,
 			      paraminfo.DataType,
-			      &(*pptfd)->funcdesc.lprgelemdescParam[j].tdesc,
+			      &elemdesc->tdesc,
 			      pTI);
 
-                (*pptfd)->funcdesc.lprgelemdescParam[j].u.paramdesc.wParamFlags = paraminfo.Flags;
+                elemdesc->u.paramdesc.wParamFlags = paraminfo.Flags;
 
                 /* name */
                 if (paraminfo.oName == -1)
@@ -1800,17 +1801,9 @@ MSFT_DoFuncs(TLBContext*     pcx,
                         MSFT_ReadName( pcx, paraminfo.oName );
                 TRACE_(typelib)("param[%d] = %s\n", j, debugstr_w((*pptfd)->pParamDesc[j].Name));
 
-                /* SEEK value = jump to offset,
-                 * from there jump to the end of record,
-                 * go back by (j-1) arguments
-                 */
-                MSFT_ReadLEDWords( &paraminfo ,
-			   sizeof(MSFT_ParameterInfo), pcx,
-			   recoffset + reclength - ((pFuncRec->nrargs - j - 1)
-					       * sizeof(MSFT_ParameterInfo)));
-                lpArgTypeDesc =
-                    & ((*pptfd)->funcdesc.lprgelemdescParam[j].tdesc);
+                lpArgTypeDesc = &elemdesc->tdesc;
 
+                /* resolve referenced type if any */
                 while ( lpArgTypeDesc != NULL )
                 {
                     switch ( lpArgTypeDesc->vt )
@@ -1834,8 +1827,40 @@ MSFT_DoFuncs(TLBContext*     pcx,
                         lpArgTypeDesc = NULL;
                     }
                 }
-            }
 
+                /* default value */
+                if ( (elemdesc->u.paramdesc.wParamFlags & PARAMFLAG_FHASDEFAULT) &&
+                     (pFuncRec->FKCCIC & 0x1000) )
+                {
+                    INT* pInt = (INT *)((char *)pFuncRec +
+                                   reclength -
+                                   (pFuncRec->nrargs * 4 + 1) * sizeof(INT) );
+
+                    PARAMDESC* pParamDesc = &elemdesc->u.paramdesc;
+
+                    pParamDesc->pparamdescex = TLB_Alloc(sizeof(PARAMDESCEX));
+                    pParamDesc->pparamdescex->cBytes = sizeof(PARAMDESCEX);
+
+		    MSFT_ReadValue(&(pParamDesc->pparamdescex->varDefaultValue),
+                        pInt[j], pcx);
+                }
+                /* custom info */
+                if ( nrattributes > 7 + j && pFuncRec->FKCCIC & 0x80 )
+                {
+                    MSFT_CustData(pcx,
+				  pFuncRec->OptAttr[7+j],
+				  &(*pptfd)->pParamDesc[j].pCustData);
+                }
+
+                /* SEEK value = jump to offset,
+                 * from there jump to the end of record,
+                 * go back by (j-1) arguments
+                 */
+                MSFT_ReadLEDWords( &paraminfo ,
+			   sizeof(MSFT_ParameterInfo), pcx,
+			   recoffset + reclength - ((pFuncRec->nrargs - j - 1)
+					       * sizeof(MSFT_ParameterInfo)));
+            }
 
             /* parameter is the return value! */
             if ( paraminfo.Flags & PARAMFLAG_FRETVAL )
@@ -1873,35 +1898,6 @@ MSFT_DoFuncs(TLBContext*     pcx,
                     }
                 }
             }
-
-            /* second time around */
-            for(j=0;j<pFuncRec->nrargs;j++)
-            {
-                /* default value */
-                if ( (PARAMFLAG_FHASDEFAULT &
-                      (*pptfd)->funcdesc.lprgelemdescParam[j].u.paramdesc.wParamFlags) &&
-                     ((pFuncRec->FKCCIC) & 0x1000) )
-                {
-                    INT* pInt = (INT *)((char *)pFuncRec +
-                                   reclength -
-                                   (pFuncRec->nrargs * 4 + 1) * sizeof(INT) );
-
-                    PARAMDESC* pParamDesc = & (*pptfd)->funcdesc.lprgelemdescParam[j].u.paramdesc;
-
-                    pParamDesc->pparamdescex = TLB_Alloc(sizeof(PARAMDESCEX));
-                    pParamDesc->pparamdescex->cBytes = sizeof(PARAMDESCEX);
-
-		    MSFT_ReadValue(&(pParamDesc->pparamdescex->varDefaultValue),
-                        pInt[j], pcx);
-                }
-                /* custom info */
-                if ( nrattributes > 7 + j && pFuncRec->FKCCIC & 0x80 )
-                {
-                    MSFT_CustData(pcx,
-				  pFuncRec->OptAttr[7+j],
-				  &(*pptfd)->pParamDesc[j].pCustData);
-                }
-           }
         }
 
         /* scode is not used: archaic win16 stuff FIXME: right? */



More information about the wine-cvs mailing list