dmime: Assign to structs instead of using memcpy.

This commit is contained in:
Andrew Talbot 2008-02-23 15:19:04 +00:00 committed by Alexandre Julliard
parent ea85c5b15b
commit 13afbc02b6
6 changed files with 26 additions and 26 deletions

View File

@ -258,9 +258,9 @@ static HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_SetDescriptor
/* According to MSDN, we should copy only given values, not whole struct */ /* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
memcpy (&This->pDesc->guidObject, &pDesc->guidObject, sizeof (pDesc->guidObject)); This->pDesc->guidObject = pDesc->guidObject;
if (pDesc->dwValidData & DMUS_OBJ_CLASS) if (pDesc->dwValidData & DMUS_OBJ_CLASS)
memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); This->pDesc->guidClass = pDesc->guidClass;
if (pDesc->dwValidData & DMUS_OBJ_NAME) if (pDesc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
@ -268,9 +268,9 @@ static HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_SetDescriptor
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION) if (pDesc->dwValidData & DMUS_OBJ_VERSION)
memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); This->pDesc->vVersion = pDesc->vVersion;
if (pDesc->dwValidData & DMUS_OBJ_DATE) if (pDesc->dwValidData & DMUS_OBJ_DATE)
memcpy (&This->pDesc->ftDate, &pDesc->ftDate, sizeof (pDesc->ftDate)); This->pDesc->ftDate = pDesc->ftDate;
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) { if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength)); memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength));
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData)); memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData));
@ -296,7 +296,7 @@ static HRESULT WINAPI IDirectMusicAudioPathImpl_IDirectMusicObject_ParseDescript
/* FIXME: should this be determined from stream? */ /* FIXME: should this be determined from stream? */
pDesc->dwValidData |= DMUS_OBJ_CLASS; pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&pDesc->guidClass, &CLSID_DirectMusicAudioPath, sizeof(CLSID)); pDesc->guidClass = CLSID_DirectMusicAudioPath;
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
@ -649,7 +649,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicAudioPathImpl (LPCGUID lpcGUID, LPVOID* p
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(obj->pDesc); DM_STRUCT_INIT(obj->pDesc);
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&obj->pDesc->guidClass, &CLSID_DirectMusicAudioPath, sizeof (CLSID)); obj->pDesc->guidClass = CLSID_DirectMusicAudioPath;
obj->ref = 0; /* will be inited by QueryInterface */ obj->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicAudioPathImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj); return IDirectMusicAudioPathImpl_IUnknown_QueryInterface ((LPUNKNOWN)&obj->UnknownVtbl, lpcGUID, ppobj);

View File

@ -209,7 +209,7 @@ HRESULT IDirectMusicUtils_IPersistStream_ParseReference (LPPERSISTSTREAM iface,
} while (ListCount[0] < ListSize[0]); } while (ListCount[0] < ListSize[0]);
ref_desc.dwValidData |= DMUS_OBJ_CLASS; ref_desc.dwValidData |= DMUS_OBJ_CLASS;
memcpy(&ref_desc.guidClass, &ref.guidClassID, sizeof(ref.guidClassID)); ref_desc.guidClass = ref.guidClassID;
TRACE_(dmfile)("** DM Reference Begin of Load ***\n"); TRACE_(dmfile)("** DM Reference Begin of Load ***\n");
TRACE_(dmfile)("With Desc:\n"); TRACE_(dmfile)("With Desc:\n");

View File

@ -224,9 +224,9 @@ static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor (LP
/* According to MSDN, we should copy only given values, not whole struct */ /* According to MSDN, we should copy only given values, not whole struct */
if (pDesc->dwValidData & DMUS_OBJ_OBJECT) if (pDesc->dwValidData & DMUS_OBJ_OBJECT)
memcpy (&This->pDesc->guidObject, &pDesc->guidObject, sizeof (pDesc->guidObject)); This->pDesc->guidObject = pDesc->guidObject;
if (pDesc->dwValidData & DMUS_OBJ_CLASS) if (pDesc->dwValidData & DMUS_OBJ_CLASS)
memcpy (&This->pDesc->guidClass, &pDesc->guidClass, sizeof (pDesc->guidClass)); This->pDesc->guidClass = pDesc->guidClass;
if (pDesc->dwValidData & DMUS_OBJ_NAME) if (pDesc->dwValidData & DMUS_OBJ_NAME)
lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME); lstrcpynW (This->pDesc->wszName, pDesc->wszName, DMUS_MAX_NAME);
if (pDesc->dwValidData & DMUS_OBJ_CATEGORY) if (pDesc->dwValidData & DMUS_OBJ_CATEGORY)
@ -234,9 +234,9 @@ static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_SetDescriptor (LP
if (pDesc->dwValidData & DMUS_OBJ_FILENAME) if (pDesc->dwValidData & DMUS_OBJ_FILENAME)
lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME); lstrcpynW (This->pDesc->wszFileName, pDesc->wszFileName, DMUS_MAX_FILENAME);
if (pDesc->dwValidData & DMUS_OBJ_VERSION) if (pDesc->dwValidData & DMUS_OBJ_VERSION)
memcpy (&This->pDesc->vVersion, &pDesc->vVersion, sizeof (pDesc->vVersion)); This->pDesc->vVersion = pDesc->vVersion;
if (pDesc->dwValidData & DMUS_OBJ_DATE) if (pDesc->dwValidData & DMUS_OBJ_DATE)
memcpy (&This->pDesc->ftDate, &pDesc->ftDate, sizeof (pDesc->ftDate)); This->pDesc->ftDate = pDesc->ftDate;
if (pDesc->dwValidData & DMUS_OBJ_MEMORY) { if (pDesc->dwValidData & DMUS_OBJ_MEMORY) {
memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength)); memcpy (&This->pDesc->llMemLength, &pDesc->llMemLength, sizeof (pDesc->llMemLength));
memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData)); memcpy (This->pDesc->pbMemData, pDesc->pbMemData, sizeof (pDesc->pbMemData));
@ -262,7 +262,7 @@ static HRESULT WINAPI IDirectMusicGraphImpl_IDirectMusicObject_ParseDescriptor (
/* FIXME: should this be determined from stream? */ /* FIXME: should this be determined from stream? */
pDesc->dwValidData |= DMUS_OBJ_CLASS; pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&pDesc->guidClass, &CLSID_DirectMusicGraph, sizeof(CLSID)); pDesc->guidClass = CLSID_DirectMusicGraph;
IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL); IStream_Read (pStream, &Chunk, sizeof(FOURCC)+sizeof(DWORD), NULL);
TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); TRACE_(dmfile)(": %s chunk (size = 0x%04x)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize);
@ -614,7 +614,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicGraphImpl (LPCGUID lpcGUID, LPVOID* ppobj
obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(obj->pDesc); DM_STRUCT_INIT(obj->pDesc);
obj->pDesc->dwValidData |= DMUS_OBJ_CLASS; obj->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&obj->pDesc->guidClass, &CLSID_DirectMusicGraph, sizeof (CLSID)); obj->pDesc->guidClass = CLSID_DirectMusicGraph;
obj->ref = 0; /* will be inited by QueryInterface */ obj->ref = 0; /* will be inited by QueryInterface */
list_init (&obj->Tools); list_init (&obj->Tools);

View File

@ -279,7 +279,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicMarkerTrack (LPCGUID lpcGUID, LPVOID *ppo
track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(track->pDesc); DM_STRUCT_INIT(track->pDesc);
track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicMarkerTrack, sizeof (CLSID)); track->pDesc->guidClass = CLSID_DirectMusicMarkerTrack;
track->ref = 0; /* will be inited by QueryInterface */ track->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicMarkerTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); return IDirectMusicMarkerTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);

View File

@ -279,7 +279,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicParamControlTrack (LPCGUID lpcGUID, LPVOI
track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); track->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC));
DM_STRUCT_INIT(track->pDesc); DM_STRUCT_INIT(track->pDesc);
track->pDesc->dwValidData |= DMUS_OBJ_CLASS; track->pDesc->dwValidData |= DMUS_OBJ_CLASS;
memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicParamControlTrack, sizeof (CLSID)); track->pDesc->guidClass = CLSID_DirectMusicParamControlTrack;
track->ref = 0; /* will be inited by QueryInterface */ track->ref = 0; /* will be inited by QueryInterface */
return IDirectMusicParamControlTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); return IDirectMusicParamControlTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj);

View File

@ -770,7 +770,7 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_InitAudio (LPDIRECTMUSICPERFO
/* as seen in msdn we need params init before audio path creation */ /* as seen in msdn we need params init before audio path creation */
if (NULL != pParams) { if (NULL != pParams) {
memcpy(&This->pParams, pParams, sizeof(DMUS_AUDIOPARAMS)); This->pParams = *pParams;
} else { } else {
/** /**
* TODO, how can i fill the struct * TODO, how can i fill the struct