dlls/oleaut32/typelib.c -- simplify

Gerald Pfeifer gerald at pfeifer.com
Thu Nov 22 14:49:37 CST 2007


Similar to the changes I suggested for typelib2.c in the same directory.

Gerald

ChangeLog:
Simplify two conditions based on the fact that unsigned variables 
cannot be negative.

Index: dlls/oleaut32/typelib.c
===================================================================
RCS file: /home/wine/wine/dlls/oleaut32/typelib.c,v
retrieving revision 1.306
diff -u -3 -p -r1.306 typelib.c
--- dlls/oleaut32/typelib.c	23 Oct 2007 18:16:29 -0000	1.306
+++ dlls/oleaut32/typelib.c	22 Nov 2007 20:47:07 -0000
@@ -3758,7 +3758,7 @@ static HRESULT WINAPI ITypeLib2_fnGetTyp
     int i;
     ITypeInfoImpl *pTInfo = This->pTypeInfo;
     
-    if ((ITypeLib2_fnGetTypeInfoCount(iface) < index + 1) || (index < 0))
+    if (ITypeLib2_fnGetTypeInfoCount(iface) < index + 1)
     	 return TYPE_E_ELEMENTNOTFOUND;
 
     TRACE("(%p) index %d\n", This, index);
@@ -6647,7 +6647,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetPa
 
     for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++,pFDesc=pFDesc->next);
 
-    if(pFDesc && indexParam >=0 && indexParam<pFDesc->funcdesc.cParams)
+    if(pFDesc && indexParam<pFDesc->funcdesc.cParams)
         for(pCData=pFDesc->pParamDesc[indexParam].pCustData; pCData;
                 pCData = pCData->next)
             if( IsEqualIID(guid, &pCData->guid)) break;
@@ -6880,7 +6880,7 @@ static HRESULT WINAPI ITypeInfo2_fnGetAl
     for(i=0, pFDesc=This->funclist; i!=indexFunc && pFDesc; i++,
             pFDesc=pFDesc->next)
         ;
-    if(pFDesc && indexParam >=0 && indexParam<pFDesc->funcdesc.cParams){
+    if(pFDesc && indexParam<pFDesc->funcdesc.cParams){
         pCustData->prgCustData =
             TLB_Alloc(pFDesc->pParamDesc[indexParam].ctCustData *
                     sizeof(CUSTDATAITEM));



More information about the wine-patches mailing list