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

Alexandre Julliard julliard at winehq.org
Fri Feb 15 05:36:09 CST 2008


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

Author: Andrew Talbot <andrew.talbot at talbotville.com>
Date:   Wed Feb 13 21:16:19 2008 +0000

crypt32: Assign to structs instead of using memcpy.

---

 dlls/crypt32/chain.c |    6 ++----
 dlls/crypt32/msg.c   |    4 ++--
 dlls/crypt32/sip.c   |    6 +++---
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c
index 65ca674..362eddc 100644
--- a/dlls/crypt32/chain.c
+++ b/dlls/crypt32/chain.c
@@ -986,8 +986,7 @@ static BOOL CRYPT_BuildCandidateChainFromCert(HCERTCHAINENGINE hChainEngine,
             chain->ref = 1;
             chain->world = world;
             chain->context.cbSize = sizeof(CERT_CHAIN_CONTEXT);
-            memcpy(&chain->context.TrustStatus, &simpleChain->TrustStatus,
-             sizeof(CERT_TRUST_STATUS));
+            chain->context.TrustStatus = simpleChain->TrustStatus;
             chain->context.cChain = 1;
             chain->context.rgpChain = CryptMemAlloc(sizeof(PCERT_SIMPLE_CHAIN));
             chain->context.rgpChain[0] = simpleChain;
@@ -1029,8 +1028,7 @@ static PCERT_SIMPLE_CHAIN CRYPT_CopySimpleChainToElement(
 
                 if (element)
                 {
-                    memcpy(element, chain->rgpElement[i],
-                     sizeof(CERT_CHAIN_ELEMENT));
+                    *element = *chain->rgpElement[i];
                     element->pCertContext = CertDuplicateCertificateContext(
                      chain->rgpElement[i]->pCertContext);
                     /* Reset the trust status of the copied element, it'll get
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 94e1df8..f06b8ea 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -78,7 +78,7 @@ static inline void CryptMsgBase_Init(CryptMsgBase *msg, DWORD dwFlags,
     if (pStreamInfo)
     {
         msg->streamed = TRUE;
-        memcpy(&msg->stream_info, pStreamInfo, sizeof(msg->stream_info));
+        msg->stream_info = *pStreamInfo;
     }
     else
     {
@@ -1124,7 +1124,7 @@ static BOOL CSignedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
         CRYPT_SIGNED_INFO info;
         char oid_rsa_data[] = szOID_RSA_data;
 
-        memcpy(&info, msg->msg_data.info, sizeof(info));
+        info = *msg->msg_data.info;
         /* Quirk:  OID is only encoded messages if an update has happened */
         if (msg->base.state != MsgStateInit)
             info.content.pszObjId = oid_rsa_data;
diff --git a/dlls/crypt32/sip.c b/dlls/crypt32/sip.c
index 6a56021..869e2a9 100644
--- a/dlls/crypt32/sip.c
+++ b/dlls/crypt32/sip.c
@@ -325,7 +325,7 @@ BOOL WINAPI CryptSIPRetrieveSubjectGuid
     dos = (IMAGE_DOS_HEADER *)pMapped;
     if (dos->e_magic == IMAGE_DOS_SIGNATURE)
     {
-        memcpy(pgSubject, &unknown, sizeof(GUID));
+        *pgSubject = unknown;
         SetLastError(S_OK);
         bRet = TRUE;
         goto cleanup1;
@@ -435,8 +435,8 @@ static void CRYPT_CacheSIP(const GUID *pgSubject, SIP_DISPATCH_INFO *info)
 
     if (prov)
     {
-        memcpy(&prov->subject, pgSubject, sizeof(prov->subject));
-        memcpy(&prov->info, info, sizeof(prov->info));
+        prov->subject = *pgSubject;
+        prov->info = *info;
         EnterCriticalSection(&providers_cs);
         list_add_tail(&providers, &prov->entry);
         LeaveCriticalSection(&providers_cs);




More information about the wine-cvs mailing list