Rob Shearman : ole32: Fix testing of HRESULT types with not operator instead of comparing against S_OK .

Alexandre Julliard julliard at winehq.org
Mon Aug 18 10:47:19 CDT 2008


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

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Sun Aug 17 18:30:59 2008 +0100

ole32: Fix testing of HRESULT types with not operator instead of comparing against S_OK.

This makes it more obvious what the code is doing.

---

 dlls/ole32/compobj.c   |    4 ++--
 dlls/ole32/oleproxy.c  |    6 +++---
 dlls/ole32/storage32.c |    5 ++---
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 64a99ec..69f42fc 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -1391,7 +1391,7 @@ HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR *idstr)
 		return ret;
 
 	ret=WINE_StringFromCLSID(id,buf);
-	if (!ret) {
+	if (ret == S_OK) {
             DWORD len = MultiByteToWideChar( CP_ACP, 0, buf, -1, NULL, 0 );
             *idstr = IMalloc_Alloc( mllc, len * sizeof(WCHAR) );
             MultiByteToWideChar( CP_ACP, 0, buf, -1, *idstr, len );
@@ -2806,7 +2806,7 @@ HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
     if (!memcmp( clsidOld, clsidNew, sizeof(*clsidOld) ))
     {
        if (!RegQueryValueW(hkey, wszAutoTreatAs, auto_treat_as, &auto_treat_as_size) &&
-           !CLSIDFromString(auto_treat_as, &id))
+           CLSIDFromString(auto_treat_as, &id) == S_OK)
        {
            if (RegSetValueW(hkey, wszTreatAs, REG_SZ, auto_treat_as, sizeof(auto_treat_as)))
            {
diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c
index 015d3fc..1add5e0 100644
--- a/dlls/ole32/oleproxy.c
+++ b/dlls/ole32/oleproxy.c
@@ -585,7 +585,7 @@ static HRESULT WINAPI RemUnkStub_Invoke(LPRPCSTUBBUFFER iface,
     pMsg->cbBuffer = cIids * sizeof(HRESULT);
 
     IRpcChannelBuffer_GetBuffer(pChannel, pMsg, &IID_IRemUnknown);
-    if (!hr)
+    if (hr == S_OK)
     {
         buf = pMsg->Buffer;
         memcpy(buf, pResults, cIids * sizeof(HRESULT));
@@ -964,12 +964,12 @@ PSFacBuf_CreateStub(
     if (IsEqualIID(&IID_IClassFactory, riid) ||
         IsEqualIID(&IID_IUnknown, riid) /* FIXME: fixup stub manager and remove this*/) {
 	hres = CFStub_Construct(ppStub);
-	if (!hres)
+	if (hres == S_OK)
 	    IRpcStubBuffer_Connect((*ppStub),pUnkServer);
 	return hres;
     } else if (IsEqualIID(&IID_IRemUnknown,riid)) {
 	hres = RemUnkStub_Construct(ppStub);
-	if (!hres)
+	if (hres == S_OK)
 	    IRpcStubBuffer_Connect((*ppStub),pUnkServer);
 	return hres;
     }
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 7d79a39..565146b 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -2100,7 +2100,6 @@ static HRESULT findPlaceholder(
   INT         typeOfRelation)
 {
   StgProperty storeProperty;
-  HRESULT     hr = S_OK;
   BOOL      res = TRUE;
 
   /*
@@ -2162,12 +2161,12 @@ static HRESULT findPlaceholder(
     }
   }
 
-  hr = StorageImpl_WriteProperty(
+  res = StorageImpl_WriteProperty(
          storage->base.ancestorStorage,
          storePropertyIndex,
          &storeProperty);
 
-  if(! hr)
+  if(!res)
   {
     return E_FAIL;
   }




More information about the wine-cvs mailing list