Commit 8cfa75f1 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3drm: Use the global memory allocation helpers.

parent a93120c3
......@@ -213,7 +213,7 @@ static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface)
static void d3drm_destroy(struct d3drm *d3drm)
{
HeapFree(GetProcessHeap(), 0, d3drm);
heap_free(d3drm);
TRACE("d3drm object %p is being destroyed.\n", d3drm);
}
......@@ -2308,7 +2308,7 @@ HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
TRACE("d3drm %p.\n", d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl;
......
......@@ -62,8 +62,7 @@ HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJE
if (!cb)
return D3DRMERR_BADVALUE;
callback = HeapAlloc(GetProcessHeap(), 0, sizeof(*callback));
if (!callback)
if (!(callback = heap_alloc(sizeof(*callback))))
return E_OUTOFMEMORY;
callback->cb = cb;
......@@ -85,7 +84,7 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO
if (callback->cb == cb && callback->ctx == ctx)
{
list_remove(&callback->entry);
HeapFree(GetProcessHeap(), 0, callback);
heap_free(callback);
break;
}
}
......@@ -140,13 +139,13 @@ HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name)
{
DWORD req_size;
HeapFree(GetProcessHeap(), 0, object->name);
heap_free(object->name);
object->name = NULL;
if (name)
{
req_size = strlen(name) + 1;
if (!(object->name = HeapAlloc(GetProcessHeap(), 0, req_size)))
if (!(object->name = heap_alloc(req_size)))
return E_OUTOFMEMORY;
memcpy(object->name, name, req_size);
}
......@@ -162,9 +161,9 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object)
{
callback->cb(iface, callback->ctx);
list_remove(&callback->entry);
HeapFree(GetProcessHeap(), 0, callback);
heap_free(callback);
}
HeapFree(GetProcessHeap(), 0, object->name);
heap_free(object->name);
object->name = NULL;
}
......@@ -30,6 +30,7 @@
#include "d3drmwin.h"
#include "rmxfguid.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#ifndef ARRAY_SIZE
......
......@@ -61,7 +61,7 @@ void d3drm_device_destroy(struct d3drm_device *device)
IDirectDraw_Release(device->ddraw);
IDirect3DRM_Release(device->d3drm);
}
HeapFree(GetProcessHeap(), 0, device);
heap_free(device);
}
static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface)
......@@ -1641,7 +1641,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
TRACE("device %p, d3drm %p.\n", device, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl;
......
......@@ -82,7 +82,7 @@ static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface)
if (!refcount)
{
d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj);
HeapFree(GetProcessHeap(), 0, face);
heap_free(face);
}
return refcount;
......@@ -627,7 +627,7 @@ HRESULT d3drm_face_create(struct d3drm_face **face)
TRACE("face %p.\n", face);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl;
......
......@@ -141,8 +141,8 @@ static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface)
{
IDirect3DRMFrame_Release(array->frames[i]);
}
HeapFree(GetProcessHeap(), 0, array->frames);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array->frames);
heap_free(array);
}
return refcount;
......@@ -193,7 +193,7 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
struct d3drm_frame_array *array;
unsigned int i;
if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
if (!(array = heap_alloc_zero(sizeof(*array))))
return NULL;
array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl;
......@@ -202,9 +202,9 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
if (frame_count)
{
if (!(array->frames = HeapAlloc(GetProcessHeap(), 0, frame_count * sizeof(*array->frames))))
if (!(array->frames = heap_calloc(frame_count, sizeof(*array->frames))))
{
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
return NULL;
}
......@@ -259,8 +259,8 @@ static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface)
{
IDirect3DRMVisual_Release(array->visuals[i]);
}
HeapFree(GetProcessHeap(), 0, array->visuals);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array->visuals);
heap_free(array);
}
return refcount;
......@@ -311,7 +311,7 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
struct d3drm_visual_array *array;
unsigned int i;
if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
if (!(array = heap_alloc_zero(sizeof(*array))))
return NULL;
array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl;
......@@ -320,9 +320,9 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
if (visual_count)
{
if (!(array->visuals = HeapAlloc(GetProcessHeap(), 0, visual_count * sizeof(*array->visuals))))
if (!(array->visuals = heap_calloc(visual_count, sizeof(*array->visuals))))
{
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
return NULL;
}
......@@ -378,8 +378,8 @@ static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface)
{
IDirect3DRMLight_Release(array->lights[i]);
}
HeapFree(GetProcessHeap(), 0, array->lights);
HeapFree(GetProcessHeap(), 0, array);
heap_free(array->lights);
heap_free(array);
}
return refcount;
......@@ -430,7 +430,7 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
struct d3drm_light_array *array;
unsigned int i;
if (!(array = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*array))))
if (!(array = heap_alloc_zero(sizeof(*array))))
return NULL;
array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl;
......@@ -439,9 +439,9 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
if (light_count)
{
if (!(array->lights = HeapAlloc(GetProcessHeap(), 0, light_count * sizeof(*array->lights))))
if (!(array->lights = heap_calloc(light_count, sizeof(*array->lights))))
{
HeapFree(GetProcessHeap(), 0, array);
heap_free(array);
return NULL;
}
......@@ -548,19 +548,19 @@ static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface)
{
IDirect3DRMFrame3_Release(frame->children[i]);
}
HeapFree(GetProcessHeap(), 0, frame->children);
heap_free(frame->children);
for (i = 0; i < frame->nb_visuals; ++i)
{
IDirect3DRMVisual_Release(frame->visuals[i]);
}
HeapFree(GetProcessHeap(), 0, frame->visuals);
heap_free(frame->visuals);
for (i = 0; i < frame->nb_lights; ++i)
{
IDirect3DRMLight_Release(frame->lights[i]);
}
HeapFree(GetProcessHeap(), 0, frame->lights);
heap_free(frame->lights);
IDirect3DRM_Release(frame->d3drm);
HeapFree(GetProcessHeap(), 0, frame);
heap_free(frame);
}
return refcount;
......@@ -2940,7 +2940,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
TRACE("frame %p, parent_frame %p, d3drm %p.\n", frame, parent_frame, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl;
......@@ -2961,7 +2961,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p)))
{
HeapFree(GetProcessHeap(), 0, object);
heap_free(object);
return hr;
}
IDirect3DRMFrame_Release(parent_frame);
......@@ -3038,10 +3038,10 @@ static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface)
{
d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj);
IDirect3DRM_Release(animation->d3drm);
HeapFree(GetProcessHeap(), 0, animation->rotate.keys);
HeapFree(GetProcessHeap(), 0, animation->scale.keys);
HeapFree(GetProcessHeap(), 0, animation->position.keys);
HeapFree(GetProcessHeap(), 0, animation);
heap_free(animation->rotate.keys);
heap_free(animation->scale.keys);
heap_free(animation->position.keys);
heap_free(animation);
}
return refcount;
......@@ -3692,7 +3692,7 @@ HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *
TRACE("animation %p, d3drm %p.\n", animation, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl;
......
......@@ -70,7 +70,7 @@ static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface)
{
d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj);
IDirect3DRM_Release(light->d3drm);
HeapFree(GetProcessHeap(), 0, light);
heap_free(light);
}
return refcount;
......@@ -378,7 +378,7 @@ HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm)
TRACE("light %p.\n", light);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl;
......
......@@ -71,7 +71,7 @@ static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface)
{
d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj);
IDirect3DRM_Release(material->d3drm);
HeapFree(GetProcessHeap(), 0, material);
heap_free(material);
}
return refcount;
......@@ -286,7 +286,7 @@ HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3d
TRACE("material %p, d3drm %p.\n", material, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl;
......
......@@ -49,7 +49,7 @@ static void d3drm_texture_destroy(struct d3drm_texture *texture)
IDirect3DRM_Release(texture->d3drm);
if (texture->surface)
IDirectDrawSurface_Release(texture->surface);
HeapFree(GetProcessHeap(), 0, texture);
heap_free(texture);
}
static BOOL d3drm_validate_image(D3DRMIMAGE *image)
......@@ -1119,7 +1119,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
TRACE("texture %p.\n", texture);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl;
......
......@@ -75,7 +75,7 @@ static void d3drm_viewport_destroy(struct d3drm_viewport *viewport)
IDirect3DRM_Release(viewport->d3drm);
}
HeapFree(GetProcessHeap(), 0, viewport);
heap_free(viewport);
}
static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out)
......@@ -1022,7 +1022,7 @@ HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3d
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
if (!(object = heap_alloc_zero(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
......
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