shell32: Assign to structs instead of using memcpy

Andrew Talbot andrew.talbot at talbotville.com
Mon Mar 17 16:36:59 CDT 2008


Changelog:
    shell32: Assign to structs instead of using memcpy.

diff --git a/dlls/shell32/cpanelfolder.c b/dlls/shell32/cpanelfolder.c
index fb6672d..85c8974 100644
--- a/dlls/shell32/cpanelfolder.c
+++ b/dlls/shell32/cpanelfolder.c
@@ -997,7 +997,7 @@ static HRESULT WINAPI IShellExecuteHookW_fnExecute(IShellExecuteHookW* iface, LP
 
     MultiByteToWideChar(CP_ACP, 0, pcpanel->szName+pcpanel->offsDispName, -1, params, MAX_PATH);
 
-    memcpy(&sei_tmp, psei, sizeof(sei_tmp));
+    sei_tmp = *psei;
     sei_tmp.lpFile = path;
     sei_tmp.lpParameters = params;
     sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
@@ -1078,7 +1078,7 @@ static HRESULT WINAPI IShellExecuteHookA_fnExecute(IShellExecuteHookA* iface, LP
     lstrcatA(path, "\" ");
     lstrcatA(path, pcpanel->szName+pcpanel->offsDispName);
 
-    memcpy(&sei_tmp, psei, sizeof(sei_tmp));
+    sei_tmp = *psei;
     sei_tmp.lpFile = path;
     sei_tmp.fMask &= ~SEE_MASK_INVOKEIDLIST;
 
diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c
index 2119905..8766c50 100644
--- a/dlls/shell32/folders.c
+++ b/dlls/shell32/folders.c
@@ -554,7 +554,7 @@ static HRESULT WINAPI IEIPersistFile_fnGetClassID(
 	if (lpClassId==NULL)
 	  return E_POINTER;
 
-	memcpy(lpClassId, &StdFolderID, sizeof(StdFolderID));
+	*lpClassId = StdFolderID;
 
 	return S_OK;
 }
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index e369574..25602ae 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -1444,7 +1444,7 @@ LPITEMIDLIST _ILCreateGuid(PIDLTYPE type, REFIID guid)
         {
             LPPIDLDATA pData = _ILGetDataPointer(pidlOut);
 
-            memcpy(&(pData->u.guid.guid), guid, sizeof(GUID));
+            pData->u.guid.guid = *guid;
             TRACE("-- create GUID-pidl %s\n",
                   debugstr_guid(&(pData->u.guid.guid)));
         }
diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c
index 6c26e3d..fef478d 100644
--- a/dlls/shell32/recyclebin.c
+++ b/dlls/shell32/recyclebin.c
@@ -332,7 +332,7 @@ static HRESULT WINAPI RecycleBin_GetClassID(IPersistFolder2 *This, CLSID *pClass
     TRACE("(%p, %p)\n", This, pClassID);
     if (This == NULL || pClassID == NULL)
         return E_INVALIDARG;
-    memcpy(pClassID, &CLSID_RecycleBin, sizeof(CLSID));
+    *pClassID = CLSID_RecycleBin;
     return S_OK;
 }
 
diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c
index 6e9ac70..be83e76 100644
--- a/dlls/shell32/shelllink.c
+++ b/dlls/shell32/shelllink.c
@@ -320,7 +320,7 @@ static HRESULT ShellLink_GetClassID( IShellLinkImpl *This, CLSID *pclsid )
 {
     TRACE("%p %p\n", This, pclsid);
 
-    memcpy( pclsid, &CLSID_ShellLink, sizeof (CLSID) );
+    *pclsid = CLSID_ShellLink;
     return S_OK;
 }
 
@@ -1079,7 +1079,7 @@ static HRESULT WINAPI IPersistStream_fnSave(
     memset(&header, 0, sizeof(header));
     header.dwSize = sizeof(header);
     header.fStartup = This->iShowCmd;
-    memcpy(&header.MagicGuid, &CLSID_ShellLink, sizeof(header.MagicGuid) );
+    header.MagicGuid = CLSID_ShellLink;
 
     header.wHotKey = This->wHotKey;
     header.nIcon = This->iIcoNdx;
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index 5f30cd9..6bc47fa 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -1459,7 +1459,7 @@ static HRESULT WINAPI UnixFolder_IPersistFolder3_GetClassID(IPersistFolder3* ifa
     if (!pClassID)
         return E_INVALIDARG;
 
-    memcpy(pClassID, This->m_pCLSID, sizeof(CLSID));
+    *pClassID = *This->m_pCLSID;
     return S_OK;
 }
 
diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c
index f562bc6..794d0bd 100644
--- a/dlls/shell32/shlexec.c
+++ b/dlls/shell32/shlexec.c
@@ -1470,7 +1470,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
     BOOL appKnownSingular = FALSE;
 
     /* make a local copy of the LPSHELLEXECUTEINFO structure and work with this from now on */
-    memcpy(&sei_tmp, sei, sizeof(sei_tmp));
+    sei_tmp = *sei;
 
     TRACE("mask=0x%08x hwnd=%p verb=%s file=%s parm=%s dir=%s show=0x%08x class=%s\n",
             sei_tmp.fMask, sei_tmp.hwnd, debugstr_w(sei_tmp.lpVerb),
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index 0d9f737..61d7ab0 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -1112,7 +1112,7 @@ static void copy_dir_to_dir(FILE_OPERATION *op, const FILE_ENTRY *feFrom, LPCWST
     PathCombineW(szFrom, feFrom->szFullPath, wildCardFiles);
     szFrom[lstrlenW(szFrom) + 1] = '\0';
 
-    memcpy(&fileOp, op->req, sizeof(fileOp));
+    fileOp = *op->req;
     fileOp.pFrom = szFrom;
     fileOp.pTo = szTo;
     fileOp.fFlags &= ~FOF_MULTIDESTFILES; /* we know we're copying to one dir */
@@ -1373,7 +1373,7 @@ static void move_dir_to_dir(LPSHFILEOPSTRUCTW lpFileOp, const FILE_ENTRY *feFrom
     lstrcpyW(szTo, szDestPath);
     szTo[lstrlenW(szDestPath) + 1] = '\0';
 
-    memcpy(&fileOp, lpFileOp, sizeof(fileOp));
+    fileOp = *lpFileOp;
     fileOp.pFrom = szFrom;
     fileOp.pTo = szTo;
 
diff --git a/dlls/shell32/shlfsbind.c b/dlls/shell32/shlfsbind.c
index c50e74c..aa4ce97 100644
--- a/dlls/shell32/shlfsbind.c
+++ b/dlls/shell32/shlfsbind.c
@@ -207,7 +207,7 @@ static HRESULT WINAPI IFileSystemBindData_fnGetFindData(
     if (!pfd)
         return E_INVALIDARG;
 
-    memcpy(pfd, &This->findFile, sizeof(WIN32_FIND_DATAW));
+    *pfd = This->findFile;
     return NOERROR;
 }
 
@@ -218,7 +218,7 @@ static HRESULT WINAPI IFileSystemBindData_fnSetFindData(
     TRACE("(%p), %p\n", This, pfd);
 
     if (pfd)
-        memcpy(&This->findFile, pfd, sizeof(WIN32_FIND_DATAW));
+        This->findFile = *pfd;
     else
         memset(&This->findFile, 0, sizeof(WIN32_FIND_DATAW));
     return NOERROR;



More information about the wine-patches mailing list