mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 04:39:45 +00:00
Use Windows memory functions.
This commit is contained in:
parent
8ed495987e
commit
ef847a0303
@ -129,7 +129,7 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
memcpy(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
CopyMemory(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
This->dsb->nrofnotifies = howmuch;
|
||||
} else {
|
||||
HeapFree(GetProcessHeap(), 0, This->dsb->notifies);
|
||||
@ -568,7 +568,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat(
|
||||
|
||||
if (lpwf) { /* NULL is valid */
|
||||
if (wfsize >= size) {
|
||||
memcpy(lpwf,This->pwfx,size);
|
||||
CopyMemory(lpwf,This->pwfx,size);
|
||||
if (wfwritten)
|
||||
*wfwritten = size;
|
||||
} else {
|
||||
@ -1059,7 +1059,7 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
|
||||
dsb->iks = NULL;
|
||||
|
||||
/* size depends on version */
|
||||
memcpy(&dsb->dsbd, dsbd, dsbd->dwSize);
|
||||
CopyMemory(&dsb->dsbd, dsbd, dsbd->dwSize);
|
||||
|
||||
/* variable sized struct so calculate size based on format */
|
||||
if (wfex->wFormatTag == WAVE_FORMAT_PCM) {
|
||||
@ -1076,7 +1076,7 @@ HRESULT WINAPI IDirectSoundBufferImpl_Create(
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
memcpy(dsb->pwfx, wfex, cp_size);
|
||||
CopyMemory(dsb->pwfx, wfex, cp_size);
|
||||
|
||||
dsb->buflen = dsbd->dwBufferBytes;
|
||||
dsb->freq = dsbd->lpwfxFormat->nSamplesPerSec;
|
||||
|
@ -657,11 +657,11 @@ DSOUND_CreateDirectSoundCaptureBuffer(
|
||||
|
||||
if (wfex->wFormatTag == WAVE_FORMAT_PCM) {
|
||||
ipDSC->pwfx = HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX));
|
||||
memcpy(ipDSC->pwfx, wfex, sizeof(WAVEFORMATEX));
|
||||
CopyMemory(ipDSC->pwfx, wfex, sizeof(WAVEFORMATEX));
|
||||
ipDSC->pwfx->cbSize = 0;
|
||||
} else {
|
||||
ipDSC->pwfx = HeapAlloc(GetProcessHeap(),0,sizeof(WAVEFORMATEX)+wfex->cbSize);
|
||||
memcpy(ipDSC->pwfx, wfex, sizeof(WAVEFORMATEX)+wfex->cbSize);
|
||||
CopyMemory(ipDSC->pwfx, wfex, sizeof(WAVEFORMATEX)+wfex->cbSize);
|
||||
}
|
||||
} else {
|
||||
WARN("lpcDSCBufferDesc->lpwfxFormat == 0\n");
|
||||
@ -692,7 +692,7 @@ DSOUND_CreateDirectSoundCaptureBuffer(
|
||||
This->pdscbd = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
||||
lpcDSCBufferDesc->dwSize);
|
||||
if (This->pdscbd)
|
||||
memcpy(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
|
||||
CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
|
||||
else {
|
||||
WARN("no memory\n");
|
||||
This->dsound->capture_buffer = 0;
|
||||
@ -862,7 +862,7 @@ static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_SetNotificationPositions(
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
memcpy(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
CopyMemory(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
This->dscb->nrofnotifies = howmuch;
|
||||
} else {
|
||||
HeapFree(GetProcessHeap(), 0, This->dscb->notifies);
|
||||
@ -1132,7 +1132,7 @@ IDirectSoundCaptureBufferImpl_GetFormat(
|
||||
dwSizeAllocated = sizeof(WAVEFORMATEX) + This->dsound->pwfx->cbSize;
|
||||
|
||||
if (lpwfxFormat) { /* NULL is valid (just want size) */
|
||||
memcpy(lpwfxFormat, This->dsound->pwfx, dwSizeAllocated);
|
||||
CopyMemory(lpwfxFormat, This->dsound->pwfx, dwSizeAllocated);
|
||||
if (lpdwSizeWritten)
|
||||
*lpdwSizeWritten = dwSizeAllocated;
|
||||
} else {
|
||||
@ -1376,8 +1376,8 @@ IDirectSoundCaptureBufferImpl_Start(
|
||||
}
|
||||
}
|
||||
|
||||
memset(ipDSC->buffer,
|
||||
(ipDSC->pwfx->wBitsPerSample == 8) ? 128 : 0, ipDSC->buflen);
|
||||
FillMemory(ipDSC->buffer, ipDSC->buflen,
|
||||
(ipDSC->pwfx->wBitsPerSample == 8) ? 128 : 0);
|
||||
} else {
|
||||
TRACE("no notifiers specified\n");
|
||||
/* no notifiers specified so just create a single default header */
|
||||
|
@ -539,7 +539,7 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer(
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
memcpy(dsb, pdsb, sizeof(IDirectSoundBufferImpl));
|
||||
CopyMemory(dsb, pdsb, sizeof(IDirectSoundBufferImpl));
|
||||
|
||||
if (pdsb->hwbuf) {
|
||||
TRACE("duplicating hardware buffer\n");
|
||||
@ -597,7 +597,7 @@ static HRESULT WINAPI IDirectSoundImpl_DuplicateSoundBuffer(
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
memcpy(dsb->pwfx, pdsb->pwfx, size);
|
||||
CopyMemory(dsb->pwfx, pdsb->pwfx, size);
|
||||
|
||||
InitializeCriticalSection(&(dsb->lock));
|
||||
dsb->lock.DebugInfo->Spare[1] = (DWORD)"DSOUNDBUFFER_lock";
|
||||
|
@ -287,19 +287,19 @@ HRESULT WINAPI GetDeviceID(LPCGUID pGuidSrc, LPGUID pGuidDest)
|
||||
|
||||
if ( IsEqualGUID( &DSDEVID_DefaultPlayback, pGuidSrc ) ||
|
||||
IsEqualGUID( &DSDEVID_DefaultVoicePlayback, pGuidSrc ) ) {
|
||||
memcpy(pGuidDest, &renderer_guids[ds_default_playback], sizeof(GUID));
|
||||
CopyMemory(pGuidDest, &renderer_guids[ds_default_playback], sizeof(GUID));
|
||||
TRACE("returns %s\n", get_device_id(pGuidDest));
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
if ( IsEqualGUID( &DSDEVID_DefaultCapture, pGuidSrc ) ||
|
||||
IsEqualGUID( &DSDEVID_DefaultVoiceCapture, pGuidSrc ) ) {
|
||||
memcpy(pGuidDest, &capture_guids[ds_default_capture], sizeof(GUID));
|
||||
CopyMemory(pGuidDest, &capture_guids[ds_default_capture], sizeof(GUID));
|
||||
TRACE("returns %s\n", get_device_id(pGuidDest));
|
||||
return DS_OK;
|
||||
}
|
||||
|
||||
memcpy(pGuidDest, pGuidSrc, sizeof(GUID));
|
||||
CopyMemory(pGuidDest, pGuidSrc, sizeof(GUID));
|
||||
TRACE("returns %s\n", get_device_id(pGuidDest));
|
||||
|
||||
return DS_OK;
|
||||
|
@ -240,10 +240,10 @@ static INT DSOUND_MixerNorm(IDirectSoundBufferImpl *dsb, BYTE *buf, INT len)
|
||||
DWORD bytesleft = dsb->buflen - dsb->buf_mixpos;
|
||||
TRACE("(%p) Best case\n", dsb);
|
||||
if (len <= bytesleft )
|
||||
memcpy(obp, ibp, len);
|
||||
CopyMemory(obp, ibp, len);
|
||||
else { /* wrap */
|
||||
memcpy(obp, ibp, bytesleft );
|
||||
memcpy(obp + bytesleft, dsb->buffer->memory, len - bytesleft);
|
||||
CopyMemory(obp, ibp, bytesleft);
|
||||
CopyMemory(obp + bytesleft, dsb->buffer->memory, len - bytesleft);
|
||||
}
|
||||
return len;
|
||||
}
|
||||
@ -903,10 +903,10 @@ static void DSOUND_MixReset(IDirectSoundImpl *dsound, DWORD writepos)
|
||||
|
||||
/* wipe out premixed data */
|
||||
if (dsound->mixpos < writepos) {
|
||||
memset(dsound->buffer + writepos, nfiller, dsound->buflen - writepos);
|
||||
memset(dsound->buffer, nfiller, dsound->mixpos);
|
||||
FillMemory(dsound->buffer + writepos, dsound->buflen - writepos, nfiller);
|
||||
FillMemory(dsound->buffer, dsound->mixpos, nfiller);
|
||||
} else {
|
||||
memset(dsound->buffer + writepos, nfiller, dsound->mixpos - writepos);
|
||||
FillMemory(dsound->buffer + writepos, dsound->mixpos - writepos, nfiller);
|
||||
}
|
||||
|
||||
/* reset primary mix position */
|
||||
@ -992,10 +992,10 @@ void DSOUND_PerformMix(IDirectSoundImpl *dsound)
|
||||
assert(dsound->playpos < dsound->buflen);
|
||||
/* wipe out just-played sound data */
|
||||
if (playpos < dsound->playpos) {
|
||||
memset(dsound->buffer + dsound->playpos, nfiller, dsound->buflen - dsound->playpos);
|
||||
memset(dsound->buffer, nfiller, playpos);
|
||||
FillMemory(dsound->buffer + dsound->playpos, dsound->buflen - dsound->playpos, nfiller);
|
||||
FillMemory(dsound->buffer, playpos, nfiller);
|
||||
} else {
|
||||
memset(dsound->buffer + dsound->playpos, nfiller, playpos - dsound->playpos);
|
||||
FillMemory(dsound->buffer + dsound->playpos, playpos - dsound->playpos, nfiller);
|
||||
}
|
||||
dsound->playpos = playpos;
|
||||
|
||||
@ -1067,7 +1067,7 @@ void DSOUND_PerformMix(IDirectSoundImpl *dsound)
|
||||
inq = 0;
|
||||
maxq = dsound->buflen;
|
||||
if (maxq > frag) maxq = frag;
|
||||
memset(dsound->buffer, nfiller, dsound->buflen);
|
||||
FillMemory(dsound->buffer, dsound->buflen, nfiller);
|
||||
paused = TRUE;
|
||||
}
|
||||
|
||||
|
@ -127,7 +127,7 @@ static HRESULT DSOUND_PrimaryOpen(IDirectSoundImpl *This)
|
||||
This->pwqueue = 0;
|
||||
This->playpos = 0;
|
||||
This->mixpos = 0;
|
||||
memset(This->buffer, (This->pwfx->wBitsPerSample == 16) ? 0 : 128, This->buflen);
|
||||
FillMemory(This->buffer, This->buflen, (This->pwfx->wBitsPerSample == 16) ? 0 : 128);
|
||||
TRACE("fraglen=%ld\n", This->fraglen);
|
||||
DSOUND_WaveQueue(This, (DWORD)-1);
|
||||
}
|
||||
@ -371,7 +371,7 @@ static HRESULT WINAPI PrimaryBufferImpl_SetFormat(
|
||||
|
||||
nSamplesPerSec = dsound->pwfx->nSamplesPerSec;
|
||||
|
||||
memcpy(dsound->pwfx, wfex, cp_size);
|
||||
CopyMemory(dsound->pwfx, wfex, cp_size);
|
||||
|
||||
if (dsound->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMSETFORMAT) {
|
||||
DWORD flags = CALLBACK_FUNCTION;
|
||||
@ -656,7 +656,7 @@ static HRESULT WINAPI PrimaryBufferImpl_GetFormat(
|
||||
|
||||
if (lpwf) { /* NULL is valid */
|
||||
if (wfsize >= size) {
|
||||
memcpy(lpwf,This->dsound->pwfx,size);
|
||||
CopyMemory(lpwf,This->dsound->pwfx,size);
|
||||
if (wfwritten)
|
||||
*wfwritten = size;
|
||||
} else {
|
||||
@ -1089,7 +1089,7 @@ HRESULT WINAPI PrimaryBufferImpl_Create(
|
||||
dsb->dsound = ds;
|
||||
dsb->lpVtbl = &dspbvt;
|
||||
|
||||
memcpy(&ds->dsbd, dsbd, sizeof(*dsbd));
|
||||
CopyMemory(&ds->dsbd, dsbd, sizeof(*dsbd));
|
||||
|
||||
TRACE("Created primary buffer at %p\n", dsb);
|
||||
TRACE("(formattag=0x%04x,chans=%d,samplerate=%ld,"
|
||||
|
@ -859,7 +859,7 @@ static HRESULT WINAPI DSPROPERTY_EnumerateA(
|
||||
err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
|
||||
if (err == DS_OK) {
|
||||
DWORD size;
|
||||
memset(&data, 0, sizeof(data));
|
||||
ZeroMemory(&data, sizeof(data));
|
||||
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
||||
data.WaveDeviceId = wod;
|
||||
data.DeviceId = renderer_guids[wod];
|
||||
@ -889,7 +889,7 @@ static HRESULT WINAPI DSPROPERTY_EnumerateA(
|
||||
err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0));
|
||||
if (err == DS_OK) {
|
||||
DWORD size;
|
||||
memset(&data, 0, sizeof(data));
|
||||
ZeroMemory(&data, sizeof(data));
|
||||
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
||||
data.WaveDeviceId = wid;
|
||||
data.DeviceId = capture_guids[wid];
|
||||
@ -959,7 +959,7 @@ static HRESULT WINAPI DSPROPERTY_EnumerateW(
|
||||
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
|
||||
err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
|
||||
if (err == DS_OK) {
|
||||
memset(&data, 0, sizeof(data));
|
||||
ZeroMemory(&data, sizeof(data));
|
||||
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER;
|
||||
data.WaveDeviceId = wod;
|
||||
data.DeviceId = renderer_guids[wod];
|
||||
@ -993,7 +993,7 @@ static HRESULT WINAPI DSPROPERTY_EnumerateW(
|
||||
WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size);
|
||||
err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size));
|
||||
if (err == DS_OK) {
|
||||
memset(&data, 0, sizeof(data));
|
||||
ZeroMemory(&data, sizeof(data));
|
||||
data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE;
|
||||
data.WaveDeviceId = wid;
|
||||
data.DeviceId = capture_guids[wid];
|
||||
|
Loading…
Reference in New Issue
Block a user