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: e7b0f07c3e00ed4bf829ff8beb61948565834aca
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=e7b0f07c3e00ed4bf829ff8beb61948565834aca

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

ole32: Assign to structs instead of using memcpy.

---

 dlls/ole32/ftmarshal.c |    4 ++--
 dlls/ole32/oleobj.c    |    2 +-
 dlls/ole32/rpc.c       |   10 +++++-----
 dlls/ole32/stg_prop.c  |   20 ++++++++++----------
 dlls/ole32/storage32.c |    2 +-
 5 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/dlls/ole32/ftmarshal.c b/dlls/ole32/ftmarshal.c
index 9f6ad8c..d71c29a 100644
--- a/dlls/ole32/ftmarshal.c
+++ b/dlls/ole32/ftmarshal.c
@@ -141,9 +141,9 @@ FTMarshalImpl_GetUnmarshalClass (LPMARSHAL iface, REFIID riid, void *pv, DWORD d
     TRACE("(%s, %p, 0x%x, %p, 0x%x, %p)\n", debugstr_guid(riid), pv,
         dwDestContext, pvDestContext, mshlflags, pCid);
     if (dwDestContext == MSHCTX_INPROC || dwDestContext == MSHCTX_CROSSCTX)
-        memcpy(pCid, &CLSID_InProcFreeMarshaler, sizeof(CLSID_InProcFreeMarshaler));
+        *pCid = CLSID_InProcFreeMarshaler;
     else
-        memcpy(pCid, &CLSID_DfMarshal, sizeof(CLSID_InProcFreeMarshaler));
+        *pCid = CLSID_DfMarshal;
     return S_OK;
 }
 
diff --git a/dlls/ole32/oleobj.c b/dlls/ole32/oleobj.c
index 1c88797..217e01d 100644
--- a/dlls/ole32/oleobj.c
+++ b/dlls/ole32/oleobj.c
@@ -724,7 +724,7 @@ static HRESULT WINAPI DataAdviseHolder_Advise(
    */
   This->Connections[index].sink = pAdvise;
   This->Connections[index].advf = advf & ~WINE_ADVF_REMOTE;
-  memcpy(&(This->Connections[index].fmat), pFetc, sizeof(FORMATETC));
+  This->Connections[index].fmat = *pFetc;
   if (pFetc->ptd)
   {
     This->Connections[index].fmat.ptd = CoTaskMemAlloc(pFetc->ptd->tdSize);
diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 256ec04..7af0b29 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -242,7 +242,7 @@ static unsigned char * ChannelHooks_ClientFillBuffer(SChannelHookCallInfo *info,
 
         wire_orpc_extent->conformance = (extension_size+7)&~7;
         wire_orpc_extent->size = extension_size;
-        memcpy(&wire_orpc_extent->id, &entry->id, sizeof(wire_orpc_extent->id));
+        wire_orpc_extent->id = entry->id;
         buffer += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[wire_orpc_extent->conformance]);
     }
 
@@ -362,7 +362,7 @@ static unsigned char * ChannelHooks_ServerFillBuffer(SChannelHookCallInfo *info,
 
         wire_orpc_extent->conformance = (extension_size+7)&~7;
         wire_orpc_extent->size = extension_size;
-        memcpy(&wire_orpc_extent->id, &entry->id, sizeof(wire_orpc_extent->id));
+        wire_orpc_extent->id = entry->id;
         buffer += FIELD_OFFSET(WIRE_ORPC_EXTENT, data[wire_orpc_extent->conformance]);
     }
 
@@ -411,7 +411,7 @@ HRESULT RPC_RegisterChannelHook(REFGUID rguid, IChannelHook *hook)
     if (!entry)
         return E_OUTOFMEMORY;
 
-    memcpy(&entry->id, rguid, sizeof(entry->id));
+    entry->id = *rguid;
     entry->hook = hook;
     IChannelHook_AddRef(hook);
 
@@ -553,7 +553,7 @@ static HRESULT WINAPI ServerRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
         {
             WIRE_ORPC_EXTENT *wire_orpc_extent = msg->Buffer;
             wire_orpc_extent->conformance = 0;
-            memcpy(&wire_orpc_extent->id, &GUID_NULL, sizeof(wire_orpc_extent->id));
+            wire_orpc_extent->id = GUID_NULL;
             wire_orpc_extent->size = 0;
             msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
         }
@@ -737,7 +737,7 @@ static HRESULT WINAPI ClientRpcChannelBuffer_GetBuffer(LPRPCCHANNELBUFFER iface,
             {
                 WIRE_ORPC_EXTENT *wire_orpc_extent = msg->Buffer;
                 wire_orpc_extent->conformance = 0;
-                memcpy(&wire_orpc_extent->id, &GUID_NULL, sizeof(wire_orpc_extent->id));
+                wire_orpc_extent->id = GUID_NULL;
                 wire_orpc_extent->size = 0;
                 msg->Buffer = (char *)msg->Buffer + FIELD_OFFSET(WIRE_ORPC_EXTENT, data[0]);
             }
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
index b688855..20d9ec3 100644
--- a/dlls/ole32/stg_prop.c
+++ b/dlls/ole32/stg_prop.c
@@ -913,12 +913,12 @@ static HRESULT WINAPI IPropertyStorage_fnStat(
     hr = IStream_Stat(This->stm, &stat, STATFLAG_NONAME);
     if (SUCCEEDED(hr))
     {
-        memcpy(&statpsstg->fmtid, &This->fmtid, sizeof(statpsstg->fmtid));
-        memcpy(&statpsstg->clsid, &This->clsid, sizeof(statpsstg->clsid));
+        statpsstg->fmtid = This->fmtid;
+        statpsstg->clsid = This->clsid;
         statpsstg->grfFlags = This->grfFlags;
-        memcpy(&statpsstg->mtime, &stat.mtime, sizeof(statpsstg->mtime));
-        memcpy(&statpsstg->ctime, &stat.ctime, sizeof(statpsstg->ctime));
-        memcpy(&statpsstg->atime, &stat.atime, sizeof(statpsstg->atime));
+        statpsstg->mtime = stat.mtime;
+        statpsstg->ctime = stat.ctime;
+        statpsstg->atime = stat.atime;
         statpsstg->dwOSVersion = This->originatorOS;
     }
     return hr;
@@ -1309,7 +1309,7 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This)
         goto end;
     }
     This->format = hdr.wFormat;
-    memcpy(&This->clsid, &hdr.clsid, sizeof(This->clsid));
+    This->clsid = hdr.clsid;
     This->originatorOS = hdr.dwOSVer;
     if (PROPSETHDR_OSVER_KIND(hdr.dwOSVer) == PROPSETHDR_OSVER_KIND_MAC)
         WARN("File comes from a Mac, strings will probably be screwed up\n");
@@ -1969,7 +1969,7 @@ static HRESULT PropertyStorage_BaseConstruct(IStream *stm,
     InitializeCriticalSection(&(*pps)->cs);
     (*pps)->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PropertyStorage_impl.cs");
     (*pps)->stm = stm;
-    memcpy(&(*pps)->fmtid, rfmtid, sizeof((*pps)->fmtid));
+    (*pps)->fmtid = *rfmtid;
     (*pps)->grfMode = grfMode;
 
     hr = PropertyStorage_CreateDictionaries(*pps);
@@ -2314,7 +2314,7 @@ static HRESULT create_EnumSTATPROPSETSTG(
             statpss.atime = stat.atime;
             statpss.ctime = stat.ctime;
             statpss.grfFlags = stat.grfMode;
-            memcpy(&statpss.clsid, &stat.clsid, sizeof stat.clsid);
+            statpss.clsid = stat.clsid;
             enumx_add_element(enumx, &statpss);
         }
         CoTaskMemFree(stat.pwcsName);
@@ -2570,12 +2570,12 @@ HRESULT WINAPI PropStgNameToFmtId(const LPOLESTR str, FMTID *rfmtid)
 
     if (!lstrcmpiW(str, szDocSummaryInfo))
     {
-        memcpy(rfmtid, &FMTID_DocSummaryInformation, sizeof(*rfmtid));
+        *rfmtid = FMTID_DocSummaryInformation;
         hr = S_OK;
     }
     else if (!lstrcmpiW(str, szSummaryInfo))
     {
-        memcpy(rfmtid, &FMTID_SummaryInformation, sizeof(*rfmtid));
+        *rfmtid = FMTID_SummaryInformation;
         hr = S_OK;
     }
     else
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 389b047..2bdad45 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -7908,7 +7908,7 @@ HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid)
         return E_INVALIDARG;
 
     /* clear the output args */
-    memcpy(pclsid, &CLSID_NULL, sizeof(*pclsid));
+    *pclsid = CLSID_NULL;
 
     res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte);
 




More information about the wine-cvs mailing list