mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-01 19:52:48 +00:00
dsound: Use CRT functions for memory allocation.
This commit is contained in:
parent
1833dc0b2d
commit
99396d4986
|
@ -144,9 +144,8 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(IDirectSou
|
|||
if (howmuch > 0) {
|
||||
/* Make an internal copy of the caller-supplied array.
|
||||
* Replace the existing copy if one is already present. */
|
||||
HeapFree(GetProcessHeap(), 0, This->notifies);
|
||||
This->notifies = HeapAlloc(GetProcessHeap(), 0,
|
||||
howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
free(This->notifies);
|
||||
This->notifies = malloc(howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
|
||||
if (This->notifies == NULL) {
|
||||
WARN("out of memory\n");
|
||||
|
@ -156,7 +155,7 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(IDirectSou
|
|||
This->nrofnotifies = howmuch;
|
||||
qsort(This->notifies, howmuch, sizeof(DSBPOSITIONNOTIFY), notify_compar);
|
||||
} else {
|
||||
HeapFree(GetProcessHeap(), 0, This->notifies);
|
||||
free(This->notifies);
|
||||
This->notifies = NULL;
|
||||
This->nrofnotifies = 0;
|
||||
}
|
||||
|
@ -297,7 +296,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFrequency(IDirectSoundBuffer8 *i
|
|||
This->nAvgBytesPerSec = freq * This->pwfx->nBlockAlign;
|
||||
DSOUND_RecalcFormat(This);
|
||||
|
||||
newcommitted = HeapReAlloc(GetProcessHeap(), 0, This->committedbuff, This->writelead);
|
||||
newcommitted = realloc(This->committedbuff, This->writelead);
|
||||
if(!newcommitted) {
|
||||
ReleaseSRWLockExclusive(&This->lock);
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -772,7 +771,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFX(IDirectSoundBuffer8 *iface, D
|
|||
for (u = 0; u < This->num_filters; u++) {
|
||||
IMediaObject_Release(This->filters[u].obj);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->filters);
|
||||
free(This->filters);
|
||||
|
||||
This->filters = NULL;
|
||||
This->num_filters = 0;
|
||||
|
@ -781,7 +780,7 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFX(IDirectSoundBuffer8 *iface, D
|
|||
return DS_OK;
|
||||
}
|
||||
|
||||
filters = HeapAlloc(GetProcessHeap(), 0, dwEffectsCount * sizeof(DSFilter));
|
||||
filters = malloc(dwEffectsCount * sizeof(DSFilter));
|
||||
if (!filters) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -845,14 +844,14 @@ static HRESULT WINAPI IDirectSoundBufferImpl_SetFX(IDirectSoundBuffer8 *iface, D
|
|||
IMediaObject_Release(filters[u].obj);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, filters);
|
||||
free(filters);
|
||||
} else {
|
||||
if (This->num_filters > 0) {
|
||||
for (u = 0; u < This->num_filters; u++) {
|
||||
IMediaObject_Release(This->filters[u].obj);
|
||||
if (This->filters[u].inplace) IMediaObjectInPlace_Release(This->filters[u].inplace);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->filters);
|
||||
free(This->filters);
|
||||
}
|
||||
|
||||
for (u = 0; u < dwEffectsCount; u++) {
|
||||
|
@ -1045,7 +1044,7 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
|
|||
return DSERR_INVALIDPARAM; /* FIXME: which error? */
|
||||
}
|
||||
|
||||
dsb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*dsb));
|
||||
dsb = calloc(1, sizeof(*dsb));
|
||||
|
||||
if (!dsb)
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -1093,7 +1092,7 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
|
|||
|
||||
/* Allocate an empty buffer */
|
||||
bufsize = (sizeof(*(dsb->buffer)) + sizeof(void *) - 1) & ~(sizeof(void *) - 1);
|
||||
dsb->buffer = HeapAlloc(GetProcessHeap(),0,bufsize + dsb->buflen);
|
||||
dsb->buffer = malloc(bufsize + dsb->buflen);
|
||||
if (!dsb->buffer) {
|
||||
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -1109,7 +1108,7 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
|
|||
FillMemory(dsb->buffer->memory, dsb->buflen, dsbd->lpwfxFormat->wBitsPerSample == 8 ? 128 : 0);
|
||||
|
||||
/* It's not necessary to initialize values to zero since */
|
||||
/* we allocated this structure with HEAP_ZERO_MEMORY... */
|
||||
/* we allocated this structure with calloc... */
|
||||
dsb->sec_mixpos = 0;
|
||||
dsb->state = STATE_STOPPED;
|
||||
|
||||
|
@ -1121,7 +1120,7 @@ HRESULT secondarybuffer_create(DirectSoundDevice *device, const DSBUFFERDESC *ds
|
|||
/* calculate fragment size and write lead */
|
||||
DSOUND_RecalcFormat(dsb);
|
||||
|
||||
dsb->committedbuff = HeapAlloc(GetProcessHeap(), 0, dsb->writelead);
|
||||
dsb->committedbuff = malloc(dsb->writelead);
|
||||
if(!dsb->committedbuff) {
|
||||
IDirectSoundBuffer8_Release(&dsb->IDirectSoundBuffer8_iface);
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -1177,11 +1176,11 @@ void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
|
|||
This->buffer->ref--;
|
||||
list_remove(&This->entry);
|
||||
if (This->buffer->ref == 0)
|
||||
HeapFree(GetProcessHeap(), 0, This->buffer);
|
||||
free(This->buffer);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->notifies);
|
||||
HeapFree(GetProcessHeap(), 0, This->pwfx);
|
||||
HeapFree(GetProcessHeap(), 0, This->committedbuff);
|
||||
free(This->notifies);
|
||||
free(This->pwfx);
|
||||
free(This->committedbuff);
|
||||
|
||||
if (This->filters) {
|
||||
int i;
|
||||
|
@ -1189,12 +1188,12 @@ void secondarybuffer_destroy(IDirectSoundBufferImpl *This)
|
|||
IMediaObject_Release(This->filters[i].obj);
|
||||
if (This->filters[i].inplace) IMediaObjectInPlace_Release(This->filters[i].inplace);
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->filters);
|
||||
free(This->filters);
|
||||
}
|
||||
|
||||
TRACE("(%p) released\n", This);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
BOOL secondarybuffer_is_audible(IDirectSoundBufferImpl *This)
|
||||
|
@ -1218,16 +1217,16 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
|
|||
VOID *committedbuff;
|
||||
TRACE("(%p,%p,%p)\n", device, ppdsb, pdsb);
|
||||
|
||||
dsb = HeapAlloc(GetProcessHeap(),0,sizeof(*dsb));
|
||||
dsb = malloc(sizeof(*dsb));
|
||||
if (dsb == NULL) {
|
||||
WARN("out of memory\n");
|
||||
*ppdsb = NULL;
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
committedbuff = HeapAlloc(GetProcessHeap(),0,pdsb->writelead);
|
||||
committedbuff = malloc(pdsb->writelead);
|
||||
if (committedbuff == NULL) {
|
||||
HeapFree(GetProcessHeap(),0,dsb);
|
||||
free(dsb);
|
||||
*ppdsb = NULL;
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -1241,8 +1240,8 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
|
|||
ReleaseSRWLockShared(&pdsb->lock);
|
||||
|
||||
if (dsb->pwfx == NULL) {
|
||||
HeapFree(GetProcessHeap(),0,committedbuff);
|
||||
HeapFree(GetProcessHeap(),0,dsb);
|
||||
free(committedbuff);
|
||||
free(dsb);
|
||||
*ppdsb = NULL;
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -1271,9 +1270,9 @@ HRESULT IDirectSoundBufferImpl_Duplicate(
|
|||
if (hres != DS_OK) {
|
||||
list_remove(&dsb->entry);
|
||||
dsb->buffer->ref--;
|
||||
HeapFree(GetProcessHeap(),0,dsb->pwfx);
|
||||
HeapFree(GetProcessHeap(),0,dsb->committedbuff);
|
||||
HeapFree(GetProcessHeap(),0,dsb);
|
||||
free(dsb->pwfx);
|
||||
free(dsb->committedbuff);
|
||||
free(dsb);
|
||||
dsb = NULL;
|
||||
}else
|
||||
IDirectSoundBuffer8_AddRef(&dsb->IDirectSoundBuffer8_iface);
|
||||
|
|
|
@ -93,7 +93,7 @@ static void capturebuffer_destroy(IDirectSoundCaptureBufferImpl *This)
|
|||
}
|
||||
CloseHandle(This->sleepev);
|
||||
|
||||
HeapFree(GetProcessHeap(),0, This->pdscbd);
|
||||
free(This->pdscbd);
|
||||
|
||||
if (This->device->client) {
|
||||
IAudioClient_Release(This->device->client);
|
||||
|
@ -108,9 +108,9 @@ static void capturebuffer_destroy(IDirectSoundCaptureBufferImpl *This)
|
|||
/* remove from DirectSoundCaptureDevice */
|
||||
This->device->capture_buffer = NULL;
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->notifies);
|
||||
free(This->notifies);
|
||||
TRACE("(%p) released\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -178,13 +178,7 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(IDirectSou
|
|||
if (howmuch > 0) {
|
||||
/* Make an internal copy of the caller-supplied array.
|
||||
* Replace the existing copy if one is already present. */
|
||||
if (This->notifies)
|
||||
This->notifies = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->notifies,
|
||||
howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
else
|
||||
This->notifies = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
|
||||
This->notifies = _recalloc(This->notifies, howmuch, sizeof(DSBPOSITIONNOTIFY));
|
||||
if (!This->notifies) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -192,7 +186,7 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions(IDirectSou
|
|||
CopyMemory(This->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY));
|
||||
This->nrofnotifies = howmuch;
|
||||
} else {
|
||||
HeapFree(GetProcessHeap(), 0, This->notifies);
|
||||
free(This->notifies);
|
||||
This->notifies = NULL;
|
||||
This->nrofnotifies = 0;
|
||||
}
|
||||
|
@ -708,8 +702,7 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|||
if ( device->pwfx == NULL )
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
||||
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
||||
sizeof(IDirectSoundCaptureBufferImpl));
|
||||
This = calloc(1, sizeof(IDirectSoundCaptureBufferImpl));
|
||||
|
||||
if ( This == NULL ) {
|
||||
WARN("out of memory\n");
|
||||
|
@ -726,14 +719,13 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|||
This->device->capture_buffer = This;
|
||||
This->nrofnotifies = 0;
|
||||
|
||||
This->pdscbd = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
|
||||
lpcDSCBufferDesc->dwSize);
|
||||
This->pdscbd = calloc(1, lpcDSCBufferDesc->dwSize);
|
||||
if (This->pdscbd)
|
||||
CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
|
||||
else {
|
||||
WARN("no memory\n");
|
||||
This->device->capture_buffer = 0;
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
free(This);
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
@ -744,9 +736,9 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|||
CLSCTX_INPROC_SERVER, NULL, (void**)&device->client);
|
||||
if(FAILED(err)){
|
||||
WARN("Activate failed: %08lx\n", err);
|
||||
HeapFree(GetProcessHeap(), 0, This->pdscbd);
|
||||
free(This->pdscbd);
|
||||
This->device->capture_buffer = 0;
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
free(This);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -757,9 +749,9 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|||
WARN("Initialize failed: %08lx\n", err);
|
||||
IAudioClient_Release(device->client);
|
||||
device->client = NULL;
|
||||
HeapFree(GetProcessHeap(), 0, This->pdscbd);
|
||||
free(This->pdscbd);
|
||||
This->device->capture_buffer = 0;
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
free(This);
|
||||
if(err == AUDCLNT_E_UNSUPPORTED_FORMAT)
|
||||
return DSERR_BADFORMAT;
|
||||
return err;
|
||||
|
@ -773,9 +765,9 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|||
IAudioClient_Release(device->client);
|
||||
device->client = NULL;
|
||||
CloseHandle(This->sleepev);
|
||||
HeapFree(GetProcessHeap(), 0, This->pdscbd);
|
||||
free(This->pdscbd);
|
||||
This->device->capture_buffer = 0;
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
free(This);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -786,27 +778,24 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
|
|||
IAudioClient_Release(device->client);
|
||||
device->client = NULL;
|
||||
CloseHandle(This->sleepev);
|
||||
HeapFree(GetProcessHeap(), 0, This->pdscbd);
|
||||
free(This->pdscbd);
|
||||
This->device->capture_buffer = 0;
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
free(This);
|
||||
return err;
|
||||
}
|
||||
|
||||
buflen = lpcDSCBufferDesc->dwBufferBytes;
|
||||
TRACE("desired buflen=%ld, old buffer=%p\n", buflen, device->buffer);
|
||||
if (device->buffer)
|
||||
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
|
||||
else
|
||||
newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
|
||||
newbuf = realloc(device->buffer, buflen);
|
||||
if (newbuf == NULL) {
|
||||
IAudioClient_Release(device->client);
|
||||
device->client = NULL;
|
||||
IAudioCaptureClient_Release(device->capture);
|
||||
device->capture = NULL;
|
||||
CloseHandle(This->sleepev);
|
||||
HeapFree(GetProcessHeap(), 0, This->pdscbd);
|
||||
free(This->pdscbd);
|
||||
This->device->capture_buffer = 0;
|
||||
HeapFree( GetProcessHeap(), 0, This );
|
||||
free(This);
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
device->buffer = newbuf;
|
||||
|
@ -832,7 +821,7 @@ static HRESULT DirectSoundCaptureDevice_Create(
|
|||
TRACE("(%p)\n", ppDevice);
|
||||
|
||||
/* Allocate memory */
|
||||
device = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DirectSoundCaptureDevice));
|
||||
device = calloc(1, sizeof(DirectSoundCaptureDevice));
|
||||
|
||||
if (device == NULL) {
|
||||
WARN("out of memory\n");
|
||||
|
@ -868,11 +857,11 @@ static ULONG DirectSoundCaptureDevice_Release(
|
|||
|
||||
if(device->mmdevice)
|
||||
IMMDevice_Release(device->mmdevice);
|
||||
HeapFree(GetProcessHeap(), 0, device->pwfx);
|
||||
free(device->pwfx);
|
||||
device->lock.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection( &(device->lock) );
|
||||
TRACE("(%p) released\n", device);
|
||||
HeapFree(GetProcessHeap(), 0, device);
|
||||
free(device);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
@ -1060,7 +1049,7 @@ static HRESULT DirectSoundCaptureDevice_Initialize(
|
|||
if(FAILED(hr)){
|
||||
device->lock.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&device->lock);
|
||||
HeapFree(GetProcessHeap(), 0, device);
|
||||
free(device);
|
||||
LeaveCriticalSection(&DSOUND_capturers_lock);
|
||||
return DSERR_NODRIVER;
|
||||
}
|
||||
|
@ -1102,7 +1091,7 @@ static void capture_destroy(IDirectSoundCaptureImpl *This)
|
|||
if (This->device)
|
||||
DirectSoundCaptureDevice_Release(This->device);
|
||||
TRACE("(%p) released\n", This);
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -1317,7 +1306,7 @@ HRESULT IDirectSoundCaptureImpl_Create(IUnknown *outer_unk, REFIID riid, void **
|
|||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
||||
|
||||
*ppv = NULL;
|
||||
obj = HeapAlloc(GetProcessHeap(), 0, sizeof(*obj));
|
||||
obj = malloc(sizeof(*obj));
|
||||
if (obj == NULL) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
|
|
@ -128,7 +128,7 @@ static HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
|
|||
TRACE("(%p)\n", ppDevice);
|
||||
|
||||
/* Allocate memory */
|
||||
device = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(DirectSoundDevice));
|
||||
device = calloc(1, sizeof(DirectSoundDevice));
|
||||
if (device == NULL) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -162,10 +162,10 @@ static HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
|
|||
device->guid = GUID_NULL;
|
||||
|
||||
/* Set default wave format (may need it for waveOutOpen) */
|
||||
device->primary_pwfx = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(WAVEFORMATEXTENSIBLE));
|
||||
device->primary_pwfx = calloc(1, sizeof(WAVEFORMATEXTENSIBLE));
|
||||
if (!device->primary_pwfx) {
|
||||
WARN("out of memory\n");
|
||||
HeapFree(GetProcessHeap(),0,device);
|
||||
free(device);
|
||||
return DSERR_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
|
@ -234,13 +234,13 @@ static ULONG DirectSoundDevice_Release(DirectSoundDevice * device)
|
|||
if(device->mmdevice)
|
||||
IMMDevice_Release(device->mmdevice);
|
||||
CloseHandle(device->sleepev);
|
||||
HeapFree(GetProcessHeap(), 0, device->tmp_buffer);
|
||||
HeapFree(GetProcessHeap(), 0, device->cp_buffer);
|
||||
HeapFree(GetProcessHeap(), 0, device->buffer);
|
||||
free(device->tmp_buffer);
|
||||
free(device->cp_buffer);
|
||||
free(device->buffer);
|
||||
device->mixlock.DebugInfo->Spare[0] = 0;
|
||||
DeleteCriticalSection(&device->mixlock);
|
||||
TRACE("(%p) released\n", device);
|
||||
HeapFree(GetProcessHeap(),0,device);
|
||||
free(device);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
@ -325,7 +325,7 @@ static HRESULT DirectSoundDevice_Initialize(DirectSoundDevice ** ppDevice, LPCGU
|
|||
hr = DSOUND_ReopenDevice(device, FALSE);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, device);
|
||||
free(device);
|
||||
LeaveCriticalSection(&DSOUND_renderers_lock);
|
||||
IMMDevice_Release(mmdevice);
|
||||
WARN("DSOUND_ReopenDevice failed: %08lx\n", hr);
|
||||
|
@ -611,10 +611,7 @@ HRESULT DirectSoundDevice_AddBuffer(
|
|||
|
||||
AcquireSRWLockExclusive(&device->buffer_list_lock);
|
||||
|
||||
if (device->buffers)
|
||||
newbuffers = HeapReAlloc(GetProcessHeap(),0,device->buffers,sizeof(IDirectSoundBufferImpl*)*(device->nrofbuffers+1));
|
||||
else
|
||||
newbuffers = HeapAlloc(GetProcessHeap(),0,sizeof(IDirectSoundBufferImpl*)*(device->nrofbuffers+1));
|
||||
newbuffers = realloc(device->buffers, sizeof(IDirectSoundBufferImpl*) * (device->nrofbuffers + 1));
|
||||
|
||||
if (newbuffers) {
|
||||
device->buffers = newbuffers;
|
||||
|
@ -645,7 +642,7 @@ void DirectSoundDevice_RemoveBuffer(DirectSoundDevice * device, IDirectSoundBuff
|
|||
|
||||
if (device->nrofbuffers == 1) {
|
||||
assert(device->buffers[0] == pDSB);
|
||||
HeapFree(GetProcessHeap(), 0, device->buffers);
|
||||
free(device->buffers);
|
||||
device->buffers = NULL;
|
||||
} else {
|
||||
for (i = 0; i < device->nrofbuffers; i++) {
|
||||
|
@ -671,7 +668,7 @@ static void directsound_destroy(IDirectSoundImpl *This)
|
|||
if (This->device)
|
||||
DirectSoundDevice_Release(This->device);
|
||||
TRACE("(%p) released\n", This);
|
||||
HeapFree(GetProcessHeap(),0,This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
static inline IDirectSoundImpl *impl_from_IUnknown(IUnknown *iface)
|
||||
|
@ -981,7 +978,7 @@ HRESULT IDirectSoundImpl_Create(IUnknown *outer_unk, REFIID riid, void **ppv, BO
|
|||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
||||
|
||||
*ppv = NULL;
|
||||
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
||||
obj = calloc(1, sizeof(*obj));
|
||||
if (!obj) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
|
|
@ -270,15 +270,3 @@ BOOL DSOUND_check_supported(IAudioClient *client, DWORD rate,
|
|||
DWORD depth, WORD channels) DECLSPEC_HIDDEN;
|
||||
HRESULT enumerate_mmdevices(EDataFlow flow, GUID *guids,
|
||||
LPDSENUMCALLBACKW cb, void *user) DECLSPEC_HIDDEN;
|
||||
|
||||
static inline WCHAR *strdupW( const WCHAR *str )
|
||||
{
|
||||
size_t size;
|
||||
WCHAR *ret;
|
||||
|
||||
if (!str) return NULL;
|
||||
size = (lstrlenW( str ) + 1) * sizeof(WCHAR);
|
||||
ret = HeapAlloc( GetProcessHeap(), 0, size );
|
||||
if (ret) memcpy( ret, str, size );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@ static void fullduplex_destroy(IDirectSoundFullDuplexImpl *This)
|
|||
IUnknown_Release(This->dsc8_unk);
|
||||
}
|
||||
TRACE("(%p) released\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -281,7 +281,7 @@ HRESULT DSOUND_FullDuplexCreate(REFIID riid, void **ppv)
|
|||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
||||
|
||||
*ppv = NULL;
|
||||
obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*obj));
|
||||
obj = calloc(1, sizeof(*obj));
|
||||
if (!obj) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
|
|
@ -338,10 +338,10 @@ static UINT cp_fields_resample(IDirectSoundBufferImpl *dsb, UINT count, LONG64 *
|
|||
return max_ipos;
|
||||
|
||||
if (!dsb->device->cp_buffer) {
|
||||
dsb->device->cp_buffer = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
dsb->device->cp_buffer = malloc(len);
|
||||
dsb->device->cp_buffer_len = len;
|
||||
} else if (len > dsb->device->cp_buffer_len) {
|
||||
dsb->device->cp_buffer = HeapReAlloc(GetProcessHeap(), 0, dsb->device->cp_buffer, len);
|
||||
dsb->device->cp_buffer = realloc(dsb->device->cp_buffer, len);
|
||||
dsb->device->cp_buffer_len = len;
|
||||
}
|
||||
|
||||
|
@ -462,10 +462,7 @@ static void DSOUND_MixToTemporary(IDirectSoundBufferImpl *dsb, DWORD frames)
|
|||
if (dsb->device->tmp_buffer_len < size_bytes || !dsb->device->tmp_buffer)
|
||||
{
|
||||
dsb->device->tmp_buffer_len = size_bytes;
|
||||
if (dsb->device->tmp_buffer)
|
||||
dsb->device->tmp_buffer = HeapReAlloc(GetProcessHeap(), 0, dsb->device->tmp_buffer, size_bytes);
|
||||
else
|
||||
dsb->device->tmp_buffer = HeapAlloc(GetProcessHeap(), 0, size_bytes);
|
||||
dsb->device->tmp_buffer = realloc(dsb->device->tmp_buffer, size_bytes);
|
||||
}
|
||||
if(dsb->put_aux == putieee32_sum)
|
||||
memset(dsb->device->tmp_buffer, 0, dsb->device->tmp_buffer_len);
|
||||
|
|
|
@ -158,7 +158,7 @@ static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client
|
|||
WAVEFORMATEXTENSIBLE *wfe;
|
||||
|
||||
/* Convert to WAVEFORMATEXTENSIBLE */
|
||||
w = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEXTENSIBLE));
|
||||
w = malloc(sizeof(WAVEFORMATEXTENSIBLE));
|
||||
wfe = (WAVEFORMATEXTENSIBLE*)w;
|
||||
if (!wfe)
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
@ -189,7 +189,7 @@ static HRESULT DSOUND_WaveFormat(DirectSoundDevice *device, IAudioClient *client
|
|||
}
|
||||
if (FAILED(hr)) {
|
||||
WARN("IsFormatSupported failed: %08lx\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, w);
|
||||
free(w);
|
||||
return hr;
|
||||
}
|
||||
*wfx = w;
|
||||
|
@ -241,10 +241,7 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device, WAVEFORMATEX *wfx,
|
|||
if (!forcewave)
|
||||
new_buflen = frames * wfx->nChannels * sizeof(float);
|
||||
|
||||
if (device->buffer)
|
||||
newbuf = HeapReAlloc(GetProcessHeap(), 0, device->buffer, new_buflen);
|
||||
else
|
||||
newbuf = HeapAlloc(GetProcessHeap(), 0, new_buflen);
|
||||
newbuf = realloc(device->buffer, new_buflen);
|
||||
|
||||
if (!newbuf) {
|
||||
ERR("failed to allocate primary buffer\n");
|
||||
|
@ -252,13 +249,13 @@ static HRESULT DSOUND_PrimaryOpen(DirectSoundDevice *device, WAVEFORMATEX *wfx,
|
|||
}
|
||||
FillMemory(newbuf, new_buflen, (wfx->wBitsPerSample == 8) ? 128 : 0);
|
||||
} else {
|
||||
HeapFree(GetProcessHeap(), 0, device->buffer);
|
||||
free(device->buffer);
|
||||
newbuf = NULL;
|
||||
}
|
||||
|
||||
device->buffer = newbuf;
|
||||
device->buflen = new_buflen;
|
||||
HeapFree(GetProcessHeap(), 0, device->pwfx);
|
||||
free(device->pwfx);
|
||||
device->pwfx = wfx;
|
||||
|
||||
device->writelead = (wfx->nSamplesPerSec / 100) * wfx->nBlockAlign;
|
||||
|
@ -384,7 +381,7 @@ err:
|
|||
if (render)
|
||||
IAudioRenderClient_Release(render);
|
||||
IAudioClient_Release(client);
|
||||
HeapFree(GetProcessHeap(), 0, wfx);
|
||||
free(wfx);
|
||||
return hres;
|
||||
}
|
||||
|
||||
|
@ -398,11 +395,11 @@ HRESULT DSOUND_PrimaryDestroy(DirectSoundDevice *device)
|
|||
if(device->primary && (device->primary->ref || device->primary->numIfaces))
|
||||
WARN("Destroying primary buffer while references held (%lu %lu)\n", device->primary->ref, device->primary->numIfaces);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, device->primary);
|
||||
free(device->primary);
|
||||
device->primary = NULL;
|
||||
|
||||
HeapFree(GetProcessHeap(),0,device->primary_pwfx);
|
||||
HeapFree(GetProcessHeap(),0,device->pwfx);
|
||||
free(device->primary_pwfx);
|
||||
free(device->pwfx);
|
||||
device->pwfx=NULL;
|
||||
|
||||
LeaveCriticalSection(&(device->mixlock));
|
||||
|
@ -415,13 +412,13 @@ WAVEFORMATEX *DSOUND_CopyFormat(const WAVEFORMATEX *wfex)
|
|||
{
|
||||
WAVEFORMATEX *pwfx;
|
||||
if(wfex->wFormatTag == WAVE_FORMAT_PCM){
|
||||
pwfx = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEX));
|
||||
pwfx = malloc(sizeof(WAVEFORMATEX));
|
||||
if (!pwfx)
|
||||
return NULL;
|
||||
CopyMemory(pwfx, wfex, sizeof(PCMWAVEFORMAT));
|
||||
pwfx->cbSize = 0;
|
||||
}else{
|
||||
pwfx = HeapAlloc(GetProcessHeap(), 0, sizeof(WAVEFORMATEX) + wfex->cbSize);
|
||||
pwfx = malloc(sizeof(WAVEFORMATEX) + wfex->cbSize);
|
||||
if (!pwfx)
|
||||
return NULL;
|
||||
CopyMemory(pwfx, wfex, sizeof(WAVEFORMATEX) + wfex->cbSize);
|
||||
|
@ -492,14 +489,14 @@ HRESULT primarybuffer_SetFormat(DirectSoundDevice *device, LPCWAVEFORMATEX passe
|
|||
err = DSOUND_ReopenDevice(device, TRUE);
|
||||
if (FAILED(err)) {
|
||||
ERR("No formats could be opened\n");
|
||||
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
|
||||
free(device->primary_pwfx);
|
||||
device->primary_pwfx = old_fmt;
|
||||
} else
|
||||
HeapFree(GetProcessHeap(), 0, old_fmt);
|
||||
free(old_fmt);
|
||||
} else {
|
||||
WAVEFORMATEX *wfx = DSOUND_CopyFormat(passed_fmt);
|
||||
if (wfx) {
|
||||
HeapFree(GetProcessHeap(), 0, device->primary_pwfx);
|
||||
free(device->primary_pwfx);
|
||||
device->primary_pwfx = wfx;
|
||||
} else
|
||||
err = DSERR_OUTOFMEMORY;
|
||||
|
@ -1165,7 +1162,7 @@ HRESULT primarybuffer_create(DirectSoundDevice *device, IDirectSoundBufferImpl *
|
|||
return DSERR_INVALIDPARAM;
|
||||
}
|
||||
|
||||
dsb = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*dsb));
|
||||
dsb = calloc(1, sizeof(*dsb));
|
||||
|
||||
if (dsb == NULL) {
|
||||
WARN("out of memory\n");
|
||||
|
|
|
@ -92,7 +92,7 @@ static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface)
|
|||
|
||||
if (!ref) {
|
||||
TRACE("(%p) released\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
free(This);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
@ -174,13 +174,13 @@ static HRESULT DSPROPERTY_WaveDeviceMappingA(
|
|||
|
||||
data.DataFlow = ppd->DataFlow;
|
||||
len = MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, NULL, 0);
|
||||
data.DeviceName = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
data.DeviceName = malloc(len * sizeof(WCHAR));
|
||||
if (!data.DeviceName)
|
||||
return E_OUTOFMEMORY;
|
||||
MultiByteToWideChar(CP_ACP, 0, ppd->DeviceName, -1, data.DeviceName, len);
|
||||
|
||||
hr = DSPROPERTY_WaveDeviceMappingW(&data, cbPropData, pcbReturned);
|
||||
HeapFree(GetProcessHeap(), 0, data.DeviceName);
|
||||
free(data.DeviceName);
|
||||
ppd->DeviceId = data.DeviceId;
|
||||
|
||||
if (pcbReturned)
|
||||
|
@ -246,9 +246,9 @@ static HRESULT DSPROPERTY_DescriptionW(
|
|||
return hr;
|
||||
}
|
||||
|
||||
ppd->Description = strdupW(pv.pwszVal);
|
||||
ppd->Module = strdupW(wine_vxd_drv);
|
||||
ppd->Interface = strdupW(wInterface);
|
||||
ppd->Description = wcsdup(pv.pwszVal);
|
||||
ppd->Module = wcsdup(wine_vxd_drv);
|
||||
ppd->Interface = wcsdup(wInterface);
|
||||
ppd->Type = DIRECTSOUNDDEVICE_TYPE_VXD;
|
||||
|
||||
PropVariantClear(&pv);
|
||||
|
@ -281,19 +281,19 @@ BOOL CALLBACK enum_callback(GUID *guid, const WCHAR *desc, const WCHAR *module,
|
|||
data.DeviceId = *guid;
|
||||
|
||||
len = lstrlenW(module) + 1;
|
||||
data.Module = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
data.Module = malloc(len * sizeof(WCHAR));
|
||||
memcpy(data.Module, module, len * sizeof(WCHAR));
|
||||
|
||||
len = lstrlenW(desc) + 1;
|
||||
data.Description = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
data.Description = malloc(len * sizeof(WCHAR));
|
||||
memcpy(data.Description, desc, len * sizeof(WCHAR));
|
||||
|
||||
data.Interface = wInterface;
|
||||
|
||||
ret = ppd->Callback(&data, ppd->Context);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, data.Module);
|
||||
HeapFree(GetProcessHeap(), 0, data.Description);
|
||||
free(data.Module);
|
||||
free(data.Description);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -341,12 +341,12 @@ static BOOL DSPROPERTY_descWtoA(const DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W
|
|||
dataA->DeviceId = dataW->DeviceId;
|
||||
dataA->WaveDeviceId = dataW->WaveDeviceId;
|
||||
dataA->Interface = Interface;
|
||||
dataA->Module = HeapAlloc(GetProcessHeap(), 0, modlen);
|
||||
dataA->Description = HeapAlloc(GetProcessHeap(), 0, desclen);
|
||||
dataA->Module = malloc(modlen);
|
||||
dataA->Description = malloc(desclen);
|
||||
if (!dataA->Module || !dataA->Description)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, dataA->Module);
|
||||
HeapFree(GetProcessHeap(), 0, dataA->Description);
|
||||
free(dataA->Module);
|
||||
free(dataA->Description);
|
||||
dataA->Module = dataA->Description = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -381,8 +381,8 @@ static BOOL CALLBACK DSPROPERTY_enumWtoA(DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTIO
|
|||
if (!ret)
|
||||
return FALSE;
|
||||
ret = ppd->Callback(&descA, ppd->Context);
|
||||
HeapFree(GetProcessHeap(), 0, descA.Module);
|
||||
HeapFree(GetProcessHeap(), 0, descA.Description);
|
||||
free(descA.Module);
|
||||
free(descA.Description);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -458,9 +458,9 @@ static HRESULT DSPROPERTY_DescriptionA(
|
|||
return hr;
|
||||
if (!DSPROPERTY_descWtoA(&data, ppd))
|
||||
hr = E_OUTOFMEMORY;
|
||||
HeapFree(GetProcessHeap(), 0, data.Description);
|
||||
HeapFree(GetProcessHeap(), 0, data.Module);
|
||||
HeapFree(GetProcessHeap(), 0, data.Interface);
|
||||
free(data.Description);
|
||||
free(data.Module);
|
||||
free(data.Interface);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -484,9 +484,9 @@ static HRESULT DSPROPERTY_Description1(
|
|||
if (FAILED(hr))
|
||||
return hr;
|
||||
DSPROPERTY_descWto1(&data, ppd);
|
||||
HeapFree(GetProcessHeap(), 0, data.Description);
|
||||
HeapFree(GetProcessHeap(), 0, data.Module);
|
||||
HeapFree(GetProcessHeap(), 0, data.Interface);
|
||||
free(data.Description);
|
||||
free(data.Module);
|
||||
free(data.Interface);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -615,7 +615,7 @@ HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, void **ppv)
|
|||
|
||||
TRACE("(%s, %p)\n", debugstr_guid(riid), ppv);
|
||||
|
||||
iks = HeapAlloc(GetProcessHeap(), 0, sizeof(*iks));
|
||||
iks = malloc(sizeof(*iks));
|
||||
if (!iks) {
|
||||
WARN("out of memory\n");
|
||||
return DSERR_OUTOFMEMORY;
|
||||
|
|
Loading…
Reference in a new issue