dmloader: Assign to structs instead of using memcpy.

This commit is contained in:
Andrew Talbot 2008-02-23 16:58:32 +00:00 committed by Alexandre Julliard
parent be2f48cdd4
commit 4cd6ef739d
2 changed files with 25 additions and 25 deletions

View File

@ -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++;
@ -171,10 +171,10 @@ static HRESULT WINAPI IDirectMusicContainerImpl_IDirectMusicObject_GetDescriptor
ERR(": pDesc bad write pointer\n");
return E_POINTER;
}
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;
}

View File

@ -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);
@ -690,15 +690,15 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_EnumObject (LPDI
LPWINE_LOADER_ENTRY pObjectEntry;
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
TRACE("(%p, %s, %d, %p)\n", This, debugstr_dmguid(rguidClass), dwIndex, pDesc);
DM_STRUCT_INIT(pDesc);
LIST_FOR_EACH (pEntry, This->pObjects) {
pObjectEntry = LIST_ENTRY (pEntry, WINE_LOADER_ENTRY, entry);
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;
@ -744,12 +744,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_IDirectMusicLoader_LoadObjectFromFi
ICOM_THIS_MULTI(IDirectMusicLoaderImpl, LoaderVtbl, iface);
DMUS_OBJECTDESC ObjDesc;
WCHAR wszLoaderSearchPath[MAX_PATH];
TRACE("(%p, %s, %s, %s, %p): wrapping to IDirectMusicLoaderImpl_GetObject\n", This, debugstr_dmguid(rguidClassID), debugstr_dmguid(iidInterfaceID), debugstr_w(pwzFilePath), ppObject);
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,
@ -939,10 +939,10 @@ HRESULT WINAPI DMUSIC_InitLoaderSettings (LPDIRECTMUSICLOADER8 iface) {
TRACE(": (%p)\n", This);
GetCurrentDirectoryW (MAX_PATH, wszCurrent);
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);