Commit 40213362 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

xaudio2_7: Use CRT allocation functions.

parent 7df4a81f
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "xapofx.h" #include "xapofx.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#include <FAPO.h> #include <FAPO.h>
#include <FAPOFX.h> #include <FAPOFX.h>
...@@ -84,7 +83,7 @@ static ULONG WINAPI XAPOFX_Release(IXAPO *iface) ...@@ -84,7 +83,7 @@ static ULONG WINAPI XAPOFX_Release(IXAPO *iface)
TRACE("(%p)->(): Refcount now %lu\n", This, ref); TRACE("(%p)->(): Refcount now %lu\n", This, ref);
if(!ref) if(!ref)
HeapFree(GetProcessHeap(), 0, This); free(This);
return ref; return ref;
} }
...@@ -258,7 +257,7 @@ static HRESULT xapo_create(FAPO *fapo, XA2XAPOFXImpl **out) ...@@ -258,7 +257,7 @@ static HRESULT xapo_create(FAPO *fapo, XA2XAPOFXImpl **out)
{ {
XA2XAPOFXImpl *object; XA2XAPOFXImpl *object;
if (!(object = heap_alloc(sizeof(*object)))) if (!(object = malloc(sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->IXAPO_iface.lpVtbl = &XAPOFX_Vtbl; object->IXAPO_iface.lpVtbl = &XAPOFX_Vtbl;
...@@ -345,7 +344,7 @@ static ULONG WINAPI xapocf_Release(IClassFactory *iface) ...@@ -345,7 +344,7 @@ static ULONG WINAPI xapocf_Release(IClassFactory *iface)
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(): Refcount now %lu\n", This, ref); TRACE("(%p)->(): Refcount now %lu\n", This, ref);
if (!ref) if (!ref)
HeapFree(GetProcessHeap(), 0, This); free(This);
return ref; return ref;
} }
...@@ -425,13 +424,13 @@ static const IClassFactoryVtbl xapo_Vtbl = ...@@ -425,13 +424,13 @@ static const IClassFactoryVtbl xapo_Vtbl =
HRESULT make_xapo_factory(REFCLSID clsid, REFIID riid, void **ppv) HRESULT make_xapo_factory(REFCLSID clsid, REFIID riid, void **ppv)
{ {
HRESULT hr; HRESULT hr;
struct xapo_cf *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(struct xapo_cf)); struct xapo_cf *ret = malloc(sizeof(struct xapo_cf));
ret->IClassFactory_iface.lpVtbl = &xapo_Vtbl; ret->IClassFactory_iface.lpVtbl = &xapo_Vtbl;
ret->class = clsid; ret->class = clsid;
ret->ref = 0; ret->ref = 0;
hr = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv); hr = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv);
if(FAILED(hr)) if(FAILED(hr))
HeapFree(GetProcessHeap(), 0, ret); free(ret);
return hr; return hr;
} }
......
...@@ -34,7 +34,6 @@ ...@@ -34,7 +34,6 @@
#include "wine/asm.h" #include "wine/asm.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(xaudio2); WINE_DEFAULT_DEBUG_CHANNEL(xaudio2);
...@@ -114,7 +113,7 @@ static int32_t FAPOCALL XAPO_Release(void *iface) ...@@ -114,7 +113,7 @@ static int32_t FAPOCALL XAPO_Release(void *iface)
IXAPO_Release(This->xapo); IXAPO_Release(This->xapo);
if(This->xapo_params) if(This->xapo_params)
IXAPOParameters_Release(This->xapo_params); IXAPOParameters_Release(This->xapo_params);
heap_free(This); free(This);
} }
return r; return r;
} }
...@@ -290,7 +289,7 @@ static XA2XAPOImpl *wrap_xapo(IUnknown *unk) ...@@ -290,7 +289,7 @@ static XA2XAPOImpl *wrap_xapo(IUnknown *unk)
xapo_params = NULL; xapo_params = NULL;
} }
ret = heap_alloc(sizeof(*ret)); ret = malloc(sizeof(*ret));
ret->xapo = xapo; ret->xapo = xapo;
ret->xapo_params = xapo_params; ret->xapo_params = xapo_params;
...@@ -310,7 +309,7 @@ FAudioEffectChain *wrap_effect_chain(const XAUDIO2_EFFECT_CHAIN *pEffectChain) ...@@ -310,7 +309,7 @@ FAudioEffectChain *wrap_effect_chain(const XAUDIO2_EFFECT_CHAIN *pEffectChain)
if(!pEffectChain) if(!pEffectChain)
return NULL; return NULL;
ret = heap_alloc(sizeof(*ret) + sizeof(FAudioEffectDescriptor) * pEffectChain->EffectCount); ret = malloc(sizeof(*ret) + sizeof(FAudioEffectDescriptor) * pEffectChain->EffectCount);
ret->EffectCount = pEffectChain->EffectCount; ret->EffectCount = pEffectChain->EffectCount;
ret->pEffectDescriptors = (void*)(ret + 1); ret->pEffectDescriptors = (void*)(ret + 1);
...@@ -331,7 +330,7 @@ static void free_effect_chain(FAudioEffectChain *chain) ...@@ -331,7 +330,7 @@ static void free_effect_chain(FAudioEffectChain *chain)
return; return;
for(i = 0; i < chain->EffectCount; ++i) for(i = 0; i < chain->EffectCount; ++i)
XAPO_Release(chain->pEffectDescriptors[i].pEffect); XAPO_Release(chain->pEffectDescriptors[i].pEffect);
heap_free(chain); free(chain);
} }
/* Send Wrapping */ /* Send Wrapping */
...@@ -345,7 +344,7 @@ static FAudioVoiceSends *wrap_voice_sends(const XAUDIO2_VOICE_SENDS *sends) ...@@ -345,7 +344,7 @@ static FAudioVoiceSends *wrap_voice_sends(const XAUDIO2_VOICE_SENDS *sends)
return NULL; return NULL;
#if XAUDIO2_VER <= 3 #if XAUDIO2_VER <= 3
ret = heap_alloc(sizeof(*ret) + sends->OutputCount * sizeof(FAudioSendDescriptor)); ret = malloc(sizeof(*ret) + sends->OutputCount * sizeof(FAudioSendDescriptor));
ret->SendCount = sends->OutputCount; ret->SendCount = sends->OutputCount;
ret->pSends = (FAudioSendDescriptor*)(ret + 1); ret->pSends = (FAudioSendDescriptor*)(ret + 1);
for(i = 0; i < sends->OutputCount; ++i){ for(i = 0; i < sends->OutputCount; ++i){
...@@ -354,7 +353,7 @@ static FAudioVoiceSends *wrap_voice_sends(const XAUDIO2_VOICE_SENDS *sends) ...@@ -354,7 +353,7 @@ static FAudioVoiceSends *wrap_voice_sends(const XAUDIO2_VOICE_SENDS *sends)
ret->pSends[i].Flags = 0; ret->pSends[i].Flags = 0;
} }
#else #else
ret = heap_alloc(sizeof(*ret) + sends->SendCount * sizeof(FAudioSendDescriptor)); ret = malloc(sizeof(*ret) + sends->SendCount * sizeof(FAudioSendDescriptor));
ret->SendCount = sends->SendCount; ret->SendCount = sends->SendCount;
ret->pSends = (FAudioSendDescriptor*)(ret + 1); ret->pSends = (FAudioSendDescriptor*)(ret + 1);
for(i = 0; i < sends->SendCount; ++i){ for(i = 0; i < sends->SendCount; ++i){
...@@ -370,7 +369,7 @@ static void free_voice_sends(FAudioVoiceSends *sends) ...@@ -370,7 +369,7 @@ static void free_voice_sends(FAudioVoiceSends *sends)
{ {
if(!sends) if(!sends)
return; return;
heap_free(sends); free(sends);
} }
/* Voice Callbacks */ /* Voice Callbacks */
...@@ -1453,15 +1452,15 @@ static ULONG WINAPI IXAudio2Impl_Release(IXAudio2 *iface) ...@@ -1453,15 +1452,15 @@ static ULONG WINAPI IXAudio2Impl_Release(IXAudio2 *iface)
LIST_FOR_EACH_ENTRY_SAFE(v, v2, &This->voices, XA2VoiceImpl, entry){ LIST_FOR_EACH_ENTRY_SAFE(v, v2, &This->voices, XA2VoiceImpl, entry){
v->lock.DebugInfo->Spare[0] = 0; v->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&v->lock); DeleteCriticalSection(&v->lock);
HeapFree(GetProcessHeap(), 0, v); free(v);
} }
HeapFree(GetProcessHeap(), 0, This->cbs); free(This->cbs);
This->lock.DebugInfo->Spare[0] = 0; This->lock.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&This->lock); DeleteCriticalSection(&This->lock);
HeapFree(GetProcessHeap(), 0, This); free(This);
} }
return ref; return ref;
} }
...@@ -1515,7 +1514,7 @@ static HRESULT WINAPI IXAudio2Impl_RegisterForCallbacks(IXAudio2 *iface, ...@@ -1515,7 +1514,7 @@ static HRESULT WINAPI IXAudio2Impl_RegisterForCallbacks(IXAudio2 *iface,
} }
This->ncbs++; This->ncbs++;
This->cbs = heap_realloc(This->cbs, This->ncbs * sizeof(*This->cbs)); This->cbs = realloc(This->cbs, This->ncbs * sizeof(*This->cbs));
This->cbs[i] = pCallback; This->cbs[i] = pCallback;
...@@ -1557,7 +1556,7 @@ static inline XA2VoiceImpl *create_voice(IXAudio2Impl *This) ...@@ -1557,7 +1556,7 @@ static inline XA2VoiceImpl *create_voice(IXAudio2Impl *This)
{ {
XA2VoiceImpl *voice; XA2VoiceImpl *voice;
voice = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*voice)); voice = calloc(1, sizeof(*voice));
if(!voice) if(!voice)
return NULL; return NULL;
...@@ -1872,7 +1871,7 @@ static ULONG WINAPI XAudio2CF_Release(IClassFactory *iface) ...@@ -1872,7 +1871,7 @@ static ULONG WINAPI XAudio2CF_Release(IClassFactory *iface)
ULONG ref = InterlockedDecrement(&This->ref); ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->(): Refcount now %lu\n", This, ref); TRACE("(%p)->(): Refcount now %lu\n", This, ref);
if (!ref) if (!ref)
HeapFree(GetProcessHeap(), 0, This); free(This);
return ref; return ref;
} }
...@@ -1890,7 +1889,7 @@ static HRESULT WINAPI XAudio2CF_CreateInstance(IClassFactory *iface, IUnknown *p ...@@ -1890,7 +1889,7 @@ static HRESULT WINAPI XAudio2CF_CreateInstance(IClassFactory *iface, IUnknown *p
if(pOuter) if(pOuter)
return CLASS_E_NOAGGREGATION; return CLASS_E_NOAGGREGATION;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = calloc(1, sizeof(*object));
if(!object) if(!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -1949,12 +1948,12 @@ static const IClassFactoryVtbl XAudio2CF_Vtbl = ...@@ -1949,12 +1948,12 @@ static const IClassFactoryVtbl XAudio2CF_Vtbl =
static inline HRESULT make_xaudio2_factory(REFIID riid, void **ppv) static inline HRESULT make_xaudio2_factory(REFIID riid, void **ppv)
{ {
HRESULT hr; HRESULT hr;
struct xaudio2_cf *ret = HeapAlloc(GetProcessHeap(), 0, sizeof(struct xaudio2_cf)); struct xaudio2_cf *ret = malloc(sizeof(struct xaudio2_cf));
ret->IClassFactory_iface.lpVtbl = &XAudio2CF_Vtbl; ret->IClassFactory_iface.lpVtbl = &XAudio2CF_Vtbl;
ret->ref = 0; ret->ref = 0;
hr = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv); hr = IClassFactory_QueryInterface(&ret->IClassFactory_iface, riid, ppv);
if(FAILED(hr)) if(FAILED(hr))
HeapFree(GetProcessHeap(), 0, ret); free(ret);
return hr; return hr;
} }
......
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