Nikolay Sivov : ole32: Remove redundant variables.

Alexandre Julliard julliard at winehq.org
Wed Jul 21 10:55:00 CDT 2010


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Jul 21 14:03:35 2010 +0400

ole32: Remove redundant variables.

---

 dlls/ole32/antimoniker.c    |   19 ++++++-------------
 dlls/ole32/bindctx.c        |   13 +++----------
 dlls/ole32/classmoniker.c   |    4 +---
 dlls/ole32/datacache.c      |    8 +++-----
 dlls/ole32/defaulthandler.c |    5 +----
 dlls/ole32/filemoniker.c    |    9 ++-------
 6 files changed, 16 insertions(+), 42 deletions(-)

diff --git a/dlls/ole32/antimoniker.c b/dlls/ole32/antimoniker.c
index 69e0a90..92e2853 100644
--- a/dlls/ole32/antimoniker.c
+++ b/dlls/ole32/antimoniker.c
@@ -192,13 +192,9 @@ AntiMonikerImpl_Load(IMoniker* iface,IStream* pStm)
 static HRESULT WINAPI
 AntiMonikerImpl_Save(IMoniker* iface,IStream* pStm,BOOL fClearDirty)
 {
-    DWORD constant=1;
-    HRESULT res;
-
+    static const DWORD constant = 1;
     /* data written by this function is only a DWORD constant set to 1 ! */
-    res=IStream_Write(pStm,&constant,sizeof(constant),NULL);
-
-    return res;
+    return IStream_Write(pStm,&constant,sizeof(constant),NULL);
 }
 
 /******************************************************************************
@@ -614,9 +610,8 @@ static HRESULT AntiMonikerImpl_Construct(AntiMonikerImpl* This)
  ******************************************************************************/
 HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
 {
-    AntiMonikerImpl* newAntiMoniker = 0;
-    HRESULT        hr = S_OK;
-    IID riid=IID_IMoniker;
+    AntiMonikerImpl* newAntiMoniker;
+    HRESULT hr;
 
     TRACE("(%p)\n",ppmk);
 
@@ -632,9 +627,7 @@ HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk)
         return hr;
     }
 
-    hr = AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&riid,(void**)ppmk);
-
-    return hr;
+    return AntiMonikerImpl_QueryInterface((IMoniker*)newAntiMoniker,&IID_IMoniker,(void**)ppmk);
 }
 
 static HRESULT WINAPI AntiMonikerCF_QueryInterface(LPCLASSFACTORY iface,
@@ -677,7 +670,7 @@ static HRESULT WINAPI AntiMonikerCF_CreateInstance(LPCLASSFACTORY iface,
     if (FAILED(hr))
         return hr;
 
-  	hr = IMoniker_QueryInterface(pMoniker, riid, ppv);
+    hr = IMoniker_QueryInterface(pMoniker, riid, ppv);
 
     if (FAILED(hr))
         IMoniker_Release(pMoniker);
diff --git a/dlls/ole32/bindctx.c b/dlls/ole32/bindctx.c
index f7561bd..1492393 100644
--- a/dlls/ole32/bindctx.c
+++ b/dlls/ole32/bindctx.c
@@ -285,8 +285,6 @@ BindCtxImpl_GetBindOptions(IBindCtx* iface,BIND_OPTS *pbindopts)
 static HRESULT WINAPI
 BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot)
 {
-    HRESULT res;
-
     BindCtxImpl *This = (BindCtxImpl *)iface;
 
     TRACE("(%p,%p)\n",This,pprot);
@@ -294,9 +292,7 @@ BindCtxImpl_GetRunningObjectTable(IBindCtx* iface,IRunningObjectTable** pprot)
     if (pprot==NULL)
         return E_POINTER;
 
-    res=GetRunningObjectTable(0, pprot);
-
-    return res;
+    return GetRunningObjectTable(0, pprot);
 }
 
 /******************************************************************************
@@ -555,9 +551,8 @@ static HRESULT BindCtxImpl_Construct(BindCtxImpl* This)
  */
 HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc)
 {
-    BindCtxImpl* newBindCtx = 0;
+    BindCtxImpl* newBindCtx;
     HRESULT hr;
-    IID riid=IID_IBindCtx;
 
     TRACE("(%d,%p)\n",reserved,ppbc);
 
@@ -582,9 +577,7 @@ HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc)
         return hr;
     }
 
-    hr = BindCtxImpl_QueryInterface((IBindCtx*)newBindCtx,&riid,(void**)ppbc);
-
-    return hr;
+    return BindCtxImpl_QueryInterface((IBindCtx*)newBindCtx,&IID_IBindCtx,(void**)ppbc);
 }
 
 /******************************************************************************
diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c
index f67ae00..8b927f8 100644
--- a/dlls/ole32/classmoniker.c
+++ b/dlls/ole32/classmoniker.c
@@ -210,9 +210,7 @@ static HRESULT WINAPI ClassMoniker_Save(IMoniker* iface,
     hr = IStream_Write(pStm, &This->clsid, sizeof(This->clsid), NULL);
     if (FAILED(hr)) return hr;
 
-    hr = IStream_Write(pStm, &zero, sizeof(zero), NULL);
-
-    return hr;
+    return IStream_Write(pStm, &zero, sizeof(zero), NULL);
 }
 
 /******************************************************************************
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index ead53fe..919829e 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -655,17 +655,15 @@ static HRESULT DataCacheEntry_LoadData(DataCacheEntry *This)
 static HRESULT DataCacheEntry_CreateStream(DataCacheEntry *This,
                                            IStorage *storage, IStream **stream)
 {
-    HRESULT hr;
     WCHAR wszName[] = {2,'O','l','e','P','r','e','s',
         '0' + (This->stream_number / 100) % 10,
         '0' + (This->stream_number / 10) % 10,
         '0' + This->stream_number % 10, 0};
 
     /* FIXME: cache the created stream in This? */
-    hr = IStorage_CreateStream(storage, wszName,
-                               STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
-                               0, 0, stream);
-    return hr;
+    return IStorage_CreateStream(storage, wszName,
+                                 STGM_READWRITE | STGM_SHARE_EXCLUSIVE | STGM_CREATE,
+                                 0, 0, stream);
 }
 
 static HRESULT DataCacheEntry_Save(DataCacheEntry *This, IStorage *storage,
diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c
index d0a871f..b509bee 100644
--- a/dlls/ole32/defaulthandler.c
+++ b/dlls/ole32/defaulthandler.c
@@ -1146,14 +1146,11 @@ static HRESULT WINAPI DefaultHandler_EnumFormatEtc(
 	    DWORD            dwDirection,
 	    IEnumFORMATETC** ppenumFormatEtc)
 {
-  HRESULT hres;
   DefaultHandler *This = impl_from_IDataObject(iface);
 
   TRACE("(%p, %x, %p)\n", iface, dwDirection, ppenumFormatEtc);
 
-  hres = OleRegEnumFormatEtc(&This->clsid, dwDirection, ppenumFormatEtc);
-
-  return hres;
+  return OleRegEnumFormatEtc(&This->clsid, dwDirection, ppenumFormatEtc);
 }
 
 /************************************************************************
diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c
index 72f5913..01ae5d1 100644
--- a/dlls/ole32/filemoniker.c
+++ b/dlls/ole32/filemoniker.c
@@ -421,10 +421,7 @@ FileMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
     }
 
     if (!bWriteWide)
-    {
-        res=IStream_Write(pStm,&ZERO,sizeof(DWORD),NULL);
-        return res;
-    }
+        return IStream_Write(pStm,&ZERO,sizeof(DWORD),NULL);
 
     /* write bytes needed for the filepathW (without 0) + 6 */
     bytesW = len*sizeof(WCHAR) + 6;
@@ -441,9 +438,7 @@ FileMonikerImpl_Save(IMoniker* iface, IStream* pStm, BOOL fClearDirty)
     if (FAILED(res)) return res;
 
     /* write W string (no 0) */
-    res=IStream_Write(pStm,filePathW,bytesW,NULL);
-
-    return res;
+    return IStream_Write(pStm,filePathW,bytesW,NULL);
 }
 
 /******************************************************************************




More information about the wine-cvs mailing list