Huw Davies : ole32: AddRef does not return an HRESULT. Have the constructor create the object with one reference.

Alexandre Julliard julliard at winehq.org
Mon Mar 30 12:08:48 CDT 2009


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Mar 26 16:41:59 2009 +0000

ole32: AddRef does not return an HRESULT. Have the constructor create the object with one reference.

---

 dlls/ole32/clipboard.c |   16 ++--------------
 1 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 7d1bb26..9815749 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -322,13 +322,8 @@ static HRESULT WINAPI OLEClipbrd_IEnumFORMATETC_Clone
     return E_INVALIDARG;
 
   hr = enum_fmtetc_construct(This->countFmt, This->pFmt, ppenum);
-  if (FAILED(hr)) return hr;
 
-  /* FIXME: This is wrong! */
-  if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenum)))
-    return ( hr );
-
-  return (*ppenum) ? S_OK : E_OUTOFMEMORY;
+  return hr;
 }
 
 static const IEnumFORMATETCVtbl efvt =
@@ -347,7 +342,6 @@ static const IEnumFORMATETCVtbl efvt =
  *
  * Creates an IEnumFORMATETC enumerator from an array of FORMATETC
  * Structures.
- * NOTE: this does not AddRef the interface.
  */
 static HRESULT enum_fmtetc_construct(UINT cfmt, const FORMATETC afmt[], IEnumFORMATETC **obj)
 {
@@ -358,7 +352,7 @@ static HRESULT enum_fmtetc_construct(UINT cfmt, const FORMATETC afmt[], IEnumFOR
   ef = HeapAlloc(GetProcessHeap(), 0, sizeof(*ef));
   if (!ef) return E_OUTOFMEMORY;
 
-  ef->ref = 0;
+  ef->ref = 1;
   ef->lpVtbl = &efvt;
 
   ef->pos = 0;
@@ -1046,12 +1040,6 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_EnumFormatEtc(
   if (FAILED(hr))
     HANDLE_ERROR( hr );
 
-  /* FIXME: This is wrong! */
-  if (FAILED( hr = IEnumFORMATETC_AddRef(*ppenumFormatEtc)))
-    HANDLE_ERROR( hr );
-
-  hr = S_OK;
-
 CLEANUP:
   /*
    * Free the array of FORMATETC's




More information about the wine-cvs mailing list