Commit 4cd6ef73 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

dmloader: Assign to structs instead of using memcpy.

parent be2f48cd
......@@ -120,7 +120,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicContainer_EnumObject
result = DMUS_S_STRING_TRUNCATED;
}
if (pDesc)
memcpy (pDesc, &pContainedObject->Desc, sizeof(DMUS_OBJECTDESC));
*pDesc = pContainedObject->Desc;
return result;
}
dwCount++;
......@@ -173,7 +173,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_GetDescriptor
}
DM_STRUCT_INIT(pDesc);
memcpy (pDesc, &This->Desc, sizeof(DMUS_OBJECTDESC));
*pDesc = This->Desc;
return S_OK;
}
......@@ -199,7 +199,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_SetDescriptor
}
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) {
memcpy (&This->Desc.guidObject, &pDesc->guidObject, sizeof(GUID));
This->Desc.guidObject = pDesc->guidObject;
dwNewFlags |= DMUS_OBJ_OBJECT;
}
if (pDesc->dwValidData & DMUS_OBJ_NAME) {
......@@ -276,7 +276,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_ParseDescript
TRACE_(dmfile)(": container form\n");
/* set guidClass */
pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&pDesc->guidClass, &CLSID_DirectMusicContainer, sizeof(CLSID));
pDesc->guidClass = CLSID_DirectMusicContainer;
do {
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
StreamCount += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize;
......@@ -490,7 +490,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
switch (Chunk.fccID) {
case DMUS_FOURCC_CONTAINER_FORM: {
TRACE_(dmfile)(": container form\n");
memcpy (&This->Desc.guidClass, &CLSID_DirectMusicContainer, sizeof(CLSID));
This->Desc.guidClass = CLSID_DirectMusicContainer;
This->Desc.dwValidData |= DMUS_OBJ_CLASS;
do {
IStream_Read (pStm, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
......@@ -618,7 +618,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
TRACE_(dmdump)(": contained object header: \n%s\n", debugstr_DMUS_IO_CONTAINED_OBJECT_HEADER(&tmpObjectHeader));
/* copy guidClass */
pNewEntry->Desc.dwValidData |= DMUS_OBJ_CLASS;
memcpy (&pNewEntry->Desc.guidClass, &tmpObjectHeader.guidClassID, sizeof(GUID));
pNewEntry->Desc.guidClass = tmpObjectHeader.guidClassID;
/* store flags */
pNewEntry->dwFlags = tmpObjectHeader.dwFlags;
break;
......@@ -648,7 +648,7 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IPersistStream_Load (LPPERSISTST
if (!IsEqualCLSID (&pNewEntry->Desc.guidClass, &tmpReferenceHeader.guidClassID)) ERR(": object header declares different CLSID than reference header?\n");
/* it shouldn't be necessary to copy guidClass, since it was set in contained object header already...
yet if they happen to be different, I'd rather stick to this one */
memcpy (&pNewEntry->Desc.guidClass, &tmpReferenceHeader.guidClassID, sizeof(GUID));
pNewEntry->Desc.guidClass = tmpReferenceHeader.guidClassID;
pNewEntry->Desc.dwValidData |= tmpReferenceHeader.dwValidData;
break;
}
......
......@@ -492,7 +492,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_ScanDirectory (L
DMUS_OBJECTDESC Desc;
DM_STRUCT_INIT(&Desc);
Desc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH | DMUS_OBJ_DATE;
memcpy (&Desc.guidClass, rguidClass, sizeof(GUID));
Desc.guidClass = *rguidClass;
strcpyW (Desc.wszFileName, FileData.cFileName);
FileTimeToLocalFileTime (&FileData.ftCreationTime, &Desc.ftDate);
IDirectMusicLoader8_SetObject (iface, &Desc);
......@@ -698,7 +698,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_EnumObject (LPDI
if (IsEqualGUID (rguidClass, &GUID_DirectMusicAllTypes) || IsEqualGUID (rguidClass, &pObjectEntry->Desc.guidClass)) {
if (dwCount == dwIndex) {
memcpy (pDesc, &pObjectEntry->Desc, sizeof(DMUS_OBJECTDESC));
*pDesc = pObjectEntry->Desc;
/* we aren't supposed to reveal this info */
pDesc->dwValidData &= ~(DMUS_OBJ_MEMORY | DMUS_OBJ_STREAM);
pDesc->pbMemData = NULL;
......@@ -749,7 +749,7 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_LoadObjectFromFi
DM_STRUCT_INIT(&ObjDesc);
ObjDesc.dwValidData = DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH | DMUS_OBJ_CLASS; /* I believe I've read somewhere in MSDN that this function requires either full path or relative path */
memcpy (&ObjDesc.guidClass, rguidClassID, sizeof(CLSID));
ObjDesc.guidClass = *rguidClassID;
/* OK, MSDN says that search order is the following:
- current directory (DONE)
- windows search path (FIXME: how do I get that?)
......@@ -817,8 +817,8 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicLoaderImpl (LPCGUID lpcGUID, LPVOID *ppob
/* set default DLS collection (via SetObject... so that loading via DMUS_OBJ_OBJECT is possible) */
DM_STRUCT_INIT(&Desc);
Desc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH | DMUS_OBJ_OBJECT;
memcpy (&Desc.guidClass, &CLSID_DirectMusicCollection, sizeof(CLSID));
memcpy (&Desc.guidObject, &GUID_DefaultGMCollection, sizeof(GUID));
Desc.guidClass = CLSID_DirectMusicCollection;
Desc.guidObject = GUID_DefaultGMCollection;
DMUSIC_GetDefaultGMPath (Desc.wszFileName);
IDirectMusicLoader_SetObject ((LPDIRECTMUSICLOADER8)obj, &Desc);
/* and now the workaroundTM for "invalid" default DLS; basically,
......@@ -942,7 +942,7 @@ HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface) {
for (i = 0; i < sizeof(classes)/sizeof(REFCLSID); i++) {
LPWINE_LOADER_OPTION pNewSetting = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(WINE_LOADER_OPTION));
memcpy (&pNewSetting->guidClass, classes[i], sizeof(CLSID));
pNewSetting->guidClass = *classes[i];
strcpyW (pNewSetting->wszSearchPath, wszCurrent);
pNewSetting->bCache = TRUE;
list_add_tail (This->pClassSettings, &pNewSetting->entry);
......@@ -954,10 +954,10 @@ HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface) {
HRESULT WINAPI DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc) {
TRACE(": copy \n%s", debugstr_DMUS_OBJECTDESC(pSrc));
/* copy field by field */
if (pSrc->dwValidData & DMUS_OBJ_CLASS) memcpy (&pDst->guidClass, &pSrc->guidClass, sizeof(CLSID));
if (pSrc->dwValidData & DMUS_OBJ_OBJECT) memcpy (&pDst->guidObject, &pSrc->guidObject, sizeof(GUID));
if (pSrc->dwValidData & DMUS_OBJ_DATE) memcpy (&pDst->ftDate, &pSrc->ftDate, sizeof(FILETIME));
if (pSrc->dwValidData & DMUS_OBJ_VERSION) memcpy (&pDst->vVersion, &pSrc->vVersion, sizeof(DMUS_VERSION));
if (pSrc->dwValidData & DMUS_OBJ_CLASS) pDst->guidClass = pSrc->guidClass;
if (pSrc->dwValidData & DMUS_OBJ_OBJECT) pDst->guidObject = pSrc->guidObject;
if (pSrc->dwValidData & DMUS_OBJ_DATE) pDst->ftDate = pSrc->ftDate;
if (pSrc->dwValidData & DMUS_OBJ_VERSION) pDst->vVersion = pSrc->vVersion;
if (pSrc->dwValidData & DMUS_OBJ_NAME) strcpyW (pDst->wszName, pSrc->wszName);
if (pSrc->dwValidData & DMUS_OBJ_CATEGORY) strcpyW (pDst->wszCategory, pSrc->wszCategory);
if (pSrc->dwValidData & DMUS_OBJ_FILENAME) strcpyW (pDst->wszFileName, pSrc->wszFileName);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment