Andrew Talbot : ole32: Assign to structs instead of using memcpy.

Alexandre Julliard julliard at winehq.org
Tue Mar 11 10:51:43 CDT 2008


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

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Mon Mar 10 21:58:39 2008 +0000

ole32: Assign to structs instead of using memcpy.

---

 dlls/ole32/clipboard.c      |    2 +-
 dlls/ole32/compobj.c        |    2 +-
 dlls/ole32/datacache.c      |    4 ++--
 dlls/ole32/defaulthandler.c |    4 ++--
 dlls/ole32/errorinfo.c      |    4 ++--
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index 4e43e38..ad15219 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -1365,7 +1365,7 @@ static HRESULT WINAPI OLEClipbrd_IDataObject_GetCanonicalFormatEtc(
   if ( !pformatectIn || !pformatetcOut )
     return E_INVALIDARG;
 
-  memcpy(pformatetcOut, pformatectIn, sizeof(FORMATETC));
+  *pformatetcOut = *pformatectIn;
   return DATA_S_SAMEFORMATETC;
 }
 
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 1cb8183..25a1629 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2855,7 +2855,7 @@ HRESULT WINAPI CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID clsidNew)
     LONG len = sizeof(szClsidNew);
 
     FIXME("(%s,%p)\n", debugstr_guid(clsidOld), clsidNew);
-    memcpy(clsidNew,clsidOld,sizeof(CLSID)); /* copy over old value */
+    *clsidNew = *clsidOld; /* copy over old value */
 
     res = COM_OpenKeyForCLSID(clsidOld, wszTreatAs, KEY_READ, &hkey);
     if (FAILED(res))
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index beb6d93..8903506 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -1240,13 +1240,13 @@ static HRESULT WINAPI DataCache_GetClassID(
       HRESULT hr = IStorage_Stat(cache_entry->storage, &statstg, STATFLAG_NONAME);
       if (SUCCEEDED(hr))
       {
-        memcpy(pClassID, &statstg.clsid, sizeof(*pClassID));
+        *pClassID = statstg.clsid;
         return S_OK;
       }
     }
   }
 
-  memcpy(pClassID, &CLSID_NULL, sizeof(*pClassID));
+  *pClassID = CLSID_NULL;
 
   return S_OK;
 }
diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c
index 33e80ce..f9f676f 100644
--- a/dlls/ole32/defaulthandler.c
+++ b/dlls/ole32/defaulthandler.c
@@ -672,7 +672,7 @@ static HRESULT WINAPI DefaultHandler_GetUserClassID(
   if (!pClsid)
     return E_POINTER;
 
-  memcpy(pClsid, &This->clsid, sizeof(CLSID));
+  *pClsid = This->clsid;
 
   return S_OK;
 }
@@ -1744,7 +1744,7 @@ static DefaultHandler* DefaultHandler_Construct(
   /*
    * Initialize the other data members of the class.
    */
-  memcpy(&This->clsid, clsid, sizeof(CLSID));
+  This->clsid = *clsid;
   This->clientSite = NULL;
   This->oleAdviseHolder = NULL;
   This->dataAdviseHolder = NULL;
diff --git a/dlls/ole32/errorinfo.c b/dlls/ole32/errorinfo.c
index 7318a97..e4a1c47 100644
--- a/dlls/ole32/errorinfo.c
+++ b/dlls/ole32/errorinfo.c
@@ -250,7 +250,7 @@ static HRESULT WINAPI IErrorInfoImpl_GetGUID(
 	ErrorInfoImpl *This = impl_from_IErrorInfo(iface);
 	TRACE("(%p)->(count=%u)\n",This,This->ref);
 	if(!pGUID )return E_INVALIDARG;
-	memcpy(pGUID, &This->m_Guid, sizeof(GUID));
+	*pGUID = This->m_Guid;
 	return S_OK;
 }
 
@@ -354,7 +354,7 @@ static HRESULT WINAPI ICreateErrorInfoImpl_SetGUID(
 {
 	ErrorInfoImpl *This = impl_from_ICreateErrorInfo(iface);
 	TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid));
-	memcpy(&This->m_Guid,  rguid, sizeof(GUID));
+	This->m_Guid = *rguid;
 	return S_OK;
 }
 




More information about the wine-cvs mailing list