From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3drm/d3drm.c | 4 +- dlls/d3drm/d3drm_main.c | 12 +++--- dlls/d3drm/d3drm_private.h | 1 - dlls/d3drm/device.c | 4 +- dlls/d3drm/face.c | 4 +- dlls/d3drm/frame.c | 52 +++++++++++++------------- dlls/d3drm/light.c | 4 +- dlls/d3drm/material.c | 4 +- dlls/d3drm/meshbuilder.c | 76 +++++++++++++++++++------------------- dlls/d3drm/texture.c | 32 ++++++++-------- dlls/d3drm/viewport.c | 4 +- 11 files changed, 98 insertions(+), 99 deletions(-)
diff --git a/dlls/d3drm/d3drm.c b/dlls/d3drm/d3drm.c index cc83ae6d1f3..761132b3bd1 100644 --- a/dlls/d3drm/d3drm.c +++ b/dlls/d3drm/d3drm.c @@ -211,7 +211,7 @@ static inline struct d3drm *impl_from_IDirect3DRM3(IDirect3DRM3 *iface) static void d3drm_destroy(struct d3drm *d3drm) { TRACE("d3drm object %p is being destroyed.\n", d3drm); - heap_free(d3drm); + free(d3drm); }
static HRESULT WINAPI d3drm1_QueryInterface(IDirect3DRM *iface, REFIID riid, void **out) @@ -2325,7 +2325,7 @@ HRESULT WINAPI Direct3DRMCreate(IDirect3DRM **d3drm)
TRACE("d3drm %p.\n", d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRM_iface.lpVtbl = &d3drm1_vtbl; diff --git a/dlls/d3drm/d3drm_main.c b/dlls/d3drm/d3drm_main.c index be7b8101fe8..ff74704db18 100644 --- a/dlls/d3drm/d3drm_main.c +++ b/dlls/d3drm/d3drm_main.c @@ -43,7 +43,7 @@ HRESULT d3drm_object_add_destroy_callback(struct d3drm_object *object, D3DRMOBJE if (!cb) return D3DRMERR_BADVALUE;
- if (!(callback = heap_alloc(sizeof(*callback)))) + if (!(callback = malloc(sizeof(*callback)))) return E_OUTOFMEMORY;
callback->cb = cb; @@ -65,7 +65,7 @@ HRESULT d3drm_object_delete_destroy_callback(struct d3drm_object *object, D3DRMO if (callback->cb == cb && callback->ctx == ctx) { list_remove(&callback->entry); - heap_free(callback); + free(callback); break; } } @@ -120,13 +120,13 @@ HRESULT d3drm_object_set_name(struct d3drm_object *object, const char *name) { DWORD req_size;
- heap_free(object->name); + free(object->name); object->name = NULL;
if (name) { req_size = strlen(name) + 1; - if (!(object->name = heap_alloc(req_size))) + if (!(object->name = malloc(req_size))) return E_OUTOFMEMORY; memcpy(object->name, name, req_size); } @@ -142,9 +142,9 @@ void d3drm_object_cleanup(IDirect3DRMObject *iface, struct d3drm_object *object) { callback->cb(iface, callback->ctx); list_remove(&callback->entry); - heap_free(callback); + free(callback); }
- heap_free(object->name); + free(object->name); object->name = NULL; } diff --git a/dlls/d3drm/d3drm_private.h b/dlls/d3drm/d3drm_private.h index 2fb6bafe951..296a9730954 100644 --- a/dlls/d3drm/d3drm_private.h +++ b/dlls/d3drm/d3drm_private.h @@ -30,7 +30,6 @@ #include "d3drmwin.h" #include "rmxfguid.h" #include "wine/debug.h" -#include "wine/heap.h" #include "wine/list.h"
struct d3drm_matrix diff --git a/dlls/d3drm/device.c b/dlls/d3drm/device.c index 970b171c656..3be3cbdf68e 100644 --- a/dlls/d3drm/device.c +++ b/dlls/d3drm/device.c @@ -58,7 +58,7 @@ void d3drm_device_destroy(struct d3drm_device *device) IDirectDraw_Release(device->ddraw); IDirect3DRM_Release(device->d3drm); } - heap_free(device); + free(device); }
static inline struct d3drm_device *impl_from_IDirect3DRMWinDevice(IDirect3DRMWinDevice *iface) @@ -1660,7 +1660,7 @@ HRESULT d3drm_device_create(struct d3drm_device **device, IDirect3DRM *d3drm)
TRACE("device %p, d3drm %p.\n", device, d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMDevice_iface.lpVtbl = &d3drm_device1_vtbl; diff --git a/dlls/d3drm/face.c b/dlls/d3drm/face.c index 3214c56cb33..34810894e13 100644 --- a/dlls/d3drm/face.c +++ b/dlls/d3drm/face.c @@ -79,7 +79,7 @@ static ULONG WINAPI d3drm_face1_Release(IDirect3DRMFace *iface) if (!refcount) { d3drm_object_cleanup((IDirect3DRMObject *)iface, &face->obj); - heap_free(face); + free(face); }
return refcount; @@ -624,7 +624,7 @@ HRESULT d3drm_face_create(struct d3drm_face **face)
TRACE("face %p.\n", face);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMFace_iface.lpVtbl = &d3drm_face1_vtbl; diff --git a/dlls/d3drm/frame.c b/dlls/d3drm/frame.c index 5cc3ad585d4..b6d815e2a25 100644 --- a/dlls/d3drm/frame.c +++ b/dlls/d3drm/frame.c @@ -206,8 +206,8 @@ static ULONG WINAPI d3drm_frame_array_Release(IDirect3DRMFrameArray *iface) { IDirect3DRMFrame_Release(array->frames[i]); } - heap_free(array->frames); - heap_free(array); + free(array->frames); + free(array); }
return refcount; @@ -258,7 +258,7 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou struct d3drm_frame_array *array; unsigned int i;
- if (!(array = heap_alloc_zero(sizeof(*array)))) + if (!(array = calloc(1, sizeof(*array)))) return NULL;
array->IDirect3DRMFrameArray_iface.lpVtbl = &d3drm_frame_array_vtbl; @@ -267,9 +267,9 @@ static struct d3drm_frame_array *d3drm_frame_array_create(unsigned int frame_cou
if (frame_count) { - if (!(array->frames = heap_calloc(frame_count, sizeof(*array->frames)))) + if (!(array->frames = calloc(frame_count, sizeof(*array->frames)))) { - heap_free(array); + free(array); return NULL; }
@@ -324,8 +324,8 @@ static ULONG WINAPI d3drm_visual_array_Release(IDirect3DRMVisualArray *iface) { IDirect3DRMVisual_Release(array->visuals[i]); } - heap_free(array->visuals); - heap_free(array); + free(array->visuals); + free(array); }
return refcount; @@ -376,7 +376,7 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_ struct d3drm_visual_array *array; unsigned int i;
- if (!(array = heap_alloc_zero(sizeof(*array)))) + if (!(array = calloc(1, sizeof(*array)))) return NULL;
array->IDirect3DRMVisualArray_iface.lpVtbl = &d3drm_visual_array_vtbl; @@ -385,9 +385,9 @@ static struct d3drm_visual_array *d3drm_visual_array_create(unsigned int visual_
if (visual_count) { - if (!(array->visuals = heap_calloc(visual_count, sizeof(*array->visuals)))) + if (!(array->visuals = calloc(visual_count, sizeof(*array->visuals)))) { - heap_free(array); + free(array); return NULL; }
@@ -443,8 +443,8 @@ static ULONG WINAPI d3drm_light_array_Release(IDirect3DRMLightArray *iface) { IDirect3DRMLight_Release(array->lights[i]); } - heap_free(array->lights); - heap_free(array); + free(array->lights); + free(array); }
return refcount; @@ -495,7 +495,7 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou struct d3drm_light_array *array; unsigned int i;
- if (!(array = heap_alloc_zero(sizeof(*array)))) + if (!(array = calloc(1, sizeof(*array)))) return NULL;
array->IDirect3DRMLightArray_iface.lpVtbl = &d3drm_light_array_vtbl; @@ -504,9 +504,9 @@ static struct d3drm_light_array *d3drm_light_array_create(unsigned int light_cou
if (light_count) { - if (!(array->lights = heap_calloc(light_count, sizeof(*array->lights)))) + if (!(array->lights = calloc(light_count, sizeof(*array->lights)))) { - heap_free(array); + free(array); return NULL; }
@@ -613,19 +613,19 @@ static ULONG WINAPI d3drm_frame3_Release(IDirect3DRMFrame3 *iface) { IDirect3DRMFrame3_Release(frame->children[i]); } - heap_free(frame->children); + free(frame->children); for (i = 0; i < frame->nb_visuals; ++i) { IDirect3DRMVisual_Release(frame->visuals[i]); } - heap_free(frame->visuals); + free(frame->visuals); for (i = 0; i < frame->nb_lights; ++i) { IDirect3DRMLight_Release(frame->lights[i]); } - heap_free(frame->lights); + free(frame->lights); IDirect3DRM_Release(frame->d3drm); - heap_free(frame); + free(frame); }
return refcount; @@ -3134,7 +3134,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 = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMFrame_iface.lpVtbl = &d3drm_frame1_vtbl; @@ -3155,7 +3155,7 @@ HRESULT d3drm_frame_create(struct d3drm_frame **frame, IUnknown *parent_frame, I
if (FAILED(hr = IDirect3DRMFrame_QueryInterface(parent_frame, &IID_IDirect3DRMFrame3, (void **)&p))) { - heap_free(object); + free(object); return hr; } IDirect3DRMFrame_Release(parent_frame); @@ -3232,10 +3232,10 @@ static ULONG WINAPI d3drm_animation2_Release(IDirect3DRMAnimation2 *iface) { d3drm_object_cleanup((IDirect3DRMObject *)&animation->IDirect3DRMAnimation_iface, &animation->obj); IDirect3DRM_Release(animation->d3drm); - heap_free(animation->rotate.keys); - heap_free(animation->scale.keys); - heap_free(animation->position.keys); - heap_free(animation); + free(animation->rotate.keys); + free(animation->scale.keys); + free(animation->position.keys); + free(animation); }
return refcount; @@ -3886,7 +3886,7 @@ HRESULT d3drm_animation_create(struct d3drm_animation **animation, IDirect3DRM *
TRACE("animation %p, d3drm %p.\n", animation, d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMAnimation_iface.lpVtbl = &d3drm_animation1_vtbl; diff --git a/dlls/d3drm/light.c b/dlls/d3drm/light.c index b67599c1340..704c11c0869 100644 --- a/dlls/d3drm/light.c +++ b/dlls/d3drm/light.c @@ -67,7 +67,7 @@ static ULONG WINAPI d3drm_light_Release(IDirect3DRMLight *iface) { d3drm_object_cleanup((IDirect3DRMObject *)iface, &light->obj); IDirect3DRM_Release(light->d3drm); - heap_free(light); + free(light); }
return refcount; @@ -375,7 +375,7 @@ HRESULT d3drm_light_create(struct d3drm_light **light, IDirect3DRM *d3drm)
TRACE("light %p.\n", light);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMLight_iface.lpVtbl = &d3drm_light_vtbl; diff --git a/dlls/d3drm/material.c b/dlls/d3drm/material.c index 2e831b5d252..726768fa485 100644 --- a/dlls/d3drm/material.c +++ b/dlls/d3drm/material.c @@ -68,7 +68,7 @@ static ULONG WINAPI d3drm_material_Release(IDirect3DRMMaterial2 *iface) { d3drm_object_cleanup((IDirect3DRMObject *)iface, &material->obj); IDirect3DRM_Release(material->d3drm); - heap_free(material); + free(material); }
return refcount; @@ -283,7 +283,7 @@ HRESULT d3drm_material_create(struct d3drm_material **material, IDirect3DRM *d3d
TRACE("material %p, d3drm %p.\n", material, d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMMaterial2_iface.lpVtbl = &d3drm_material_vtbl; diff --git a/dlls/d3drm/meshbuilder.c b/dlls/d3drm/meshbuilder.c index a897941c81e..fde6fc0eb98 100644 --- a/dlls/d3drm/meshbuilder.c +++ b/dlls/d3drm/meshbuilder.c @@ -276,7 +276,7 @@ BOOL d3drm_array_reserve(void **elements, SIZE_T *capacity, SIZE_T element_count if (new_capacity < element_count) new_capacity = max_capacity;
- if (!(new_elements = heap_realloc(*elements, new_capacity * element_size))) + if (!(new_elements = realloc(*elements, new_capacity * element_size))) return FALSE;
*elements = new_elements; @@ -309,19 +309,19 @@ static void clean_mesh_builder_data(struct d3drm_mesh_builder *mesh_builder) DWORD i;
IDirect3DRMMeshBuilder3_SetName(&mesh_builder->IDirect3DRMMeshBuilder3_iface, NULL); - heap_free(mesh_builder->vertices); + free(mesh_builder->vertices); mesh_builder->vertices = NULL; mesh_builder->nb_vertices = 0; mesh_builder->vertices_size = 0; - heap_free(mesh_builder->normals); + free(mesh_builder->normals); mesh_builder->normals = NULL; mesh_builder->nb_normals = 0; mesh_builder->normals_size = 0; - heap_free(mesh_builder->pFaceData); + free(mesh_builder->pFaceData); mesh_builder->pFaceData = NULL; mesh_builder->face_data_size = 0; mesh_builder->nb_faces = 0; - heap_free(mesh_builder->pCoords2d); + free(mesh_builder->pCoords2d); mesh_builder->pCoords2d = NULL; mesh_builder->nb_coords2d = 0; for (i = 0; i < mesh_builder->nb_materials; i++) @@ -332,9 +332,9 @@ static void clean_mesh_builder_data(struct d3drm_mesh_builder *mesh_builder) IDirect3DRMTexture3_Release(mesh_builder->materials[i].texture); } mesh_builder->nb_materials = 0; - heap_free(mesh_builder->materials); + free(mesh_builder->materials); mesh_builder->materials = NULL; - heap_free(mesh_builder->material_indices); + free(mesh_builder->material_indices); mesh_builder->material_indices = NULL; }
@@ -393,7 +393,7 @@ static ULONG WINAPI d3drm_mesh_builder2_Release(IDirect3DRMMeshBuilder2 *iface) if (mesh_builder->texture) IDirect3DRMTexture3_Release(mesh_builder->texture); IDirect3DRM_Release(mesh_builder->d3drm); - heap_free(mesh_builder); + free(mesh_builder); }
return refcount; @@ -1047,12 +1047,12 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData, { char *name;
- if (!(name = heap_alloc(size))) + if (!(name = malloc(size))) return E_OUTOFMEMORY;
if (SUCCEEDED(hr = IDirectXFileData_GetName(pData, name, &size))) IDirect3DRMMeshBuilder3_SetName(iface, name); - heap_free(name); + free(name); if (hr != DXFILE_OK) return hr; } @@ -1080,12 +1080,12 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData, } memcpy(mesh_builder->vertices, ptr + sizeof(DWORD), mesh_builder->nb_vertices * sizeof(D3DVECTOR));
- faces_vertex_idx_ptr = faces_vertex_idx_data = heap_alloc(faces_vertex_idx_size); + faces_vertex_idx_ptr = faces_vertex_idx_data = malloc(faces_vertex_idx_size); memcpy(faces_vertex_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_vertices * sizeof(D3DVECTOR) + sizeof(DWORD), faces_vertex_idx_size);
/* Each vertex index will have its normal index counterpart so just allocate twice the size */ - mesh_builder->pFaceData = heap_alloc(faces_vertex_idx_size * 2); + mesh_builder->pFaceData = malloc(faces_vertex_idx_size * 2); faces_data_ptr = (DWORD*)mesh_builder->pFaceData;
while (1) @@ -1137,7 +1137,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData, memcpy(mesh_builder->normals, ptr + sizeof(DWORD), mesh_builder->nb_normals * sizeof(D3DVECTOR));
faces_normal_idx_size = size - (2 * sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR)); - faces_normal_idx_ptr = faces_normal_idx_data = heap_alloc(faces_normal_idx_size); + faces_normal_idx_ptr = faces_normal_idx_data = malloc(faces_normal_idx_size); memcpy(faces_normal_idx_data, ptr + sizeof(DWORD) + mesh_builder->nb_normals * sizeof(D3DVECTOR) + sizeof(DWORD), faces_normal_idx_size); } @@ -1151,7 +1151,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
TRACE("MeshTextureCoords: nb_coords2d = %ld\n", mesh_builder->nb_coords2d);
- mesh_builder->pCoords2d = heap_calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d)); + mesh_builder->pCoords2d = calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d)); memcpy(mesh_builder->pCoords2d, ptr + sizeof(DWORD), mesh_builder->nb_coords2d * sizeof(*mesh_builder->pCoords2d)); } else if (IsEqualGUID(guid, &TID_D3DRMMeshMaterialList)) @@ -1179,15 +1179,15 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData, if (size != data_size) WARN("Returned size %lu does not match expected one %lu\n", size, data_size);
- if (!(mesh_builder->material_indices = heap_calloc(nb_face_indices, + if (!(mesh_builder->material_indices = calloc(nb_face_indices, sizeof(*mesh_builder->material_indices)))) goto end; memcpy(mesh_builder->material_indices, ptr + 2 * sizeof(DWORD), nb_face_indices * sizeof(*mesh_builder->material_indices));
- if (!(mesh_builder->materials = heap_calloc(nb_materials, sizeof(*mesh_builder->materials)))) + if (!(mesh_builder->materials = calloc(nb_materials, sizeof(*mesh_builder->materials)))) { - heap_free(mesh_builder->material_indices); + free(mesh_builder->material_indices); goto end; } mesh_builder->nb_materials = nb_materials; @@ -1439,7 +1439,7 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData, if (!mesh_builder->pCoords2d) { mesh_builder->nb_coords2d = mesh_builder->nb_vertices; - mesh_builder->pCoords2d = heap_calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d)); + mesh_builder->pCoords2d = calloc(mesh_builder->nb_coords2d, sizeof(*mesh_builder->pCoords2d)); for (i = 0; i < mesh_builder->nb_coords2d; ++i) { mesh_builder->pCoords2d[i].u = 0.0f; @@ -1453,8 +1453,8 @@ HRESULT load_mesh_data(IDirect3DRMMeshBuilder3 *iface, IDirectXFileData *pData,
end:
- heap_free(faces_normal_idx_data); - heap_free(faces_vertex_idx_data); + free(faces_normal_idx_data); + free(faces_vertex_idx_data);
return ret; } @@ -1966,7 +1966,7 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if int k; D3DRMVERTEX* vertices;
- if (!(vertices = heap_calloc(mesh_builder->nb_vertices, sizeof(*vertices)))) + if (!(vertices = calloc(mesh_builder->nb_vertices, sizeof(*vertices)))) { IDirect3DRMMesh_Release(*mesh); return E_OUTOFMEMORY; @@ -1974,7 +1974,7 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if for (i = 0; i < mesh_builder->nb_vertices; i++) vertices[i].position = mesh_builder->vertices[i]; hr = IDirect3DRMMesh_SetVertices(*mesh, 0, 0, mesh_builder->nb_vertices, vertices); - heap_free(vertices); + free(vertices);
/* Groups are in reverse order compared to materials list in X file */ for (k = mesh_builder->nb_materials - 1; k >= 0; k--) @@ -1987,15 +1987,15 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if unsigned nb_vertices = 0; unsigned nb_faces = 0;
- if (!(used_vertices = heap_calloc(mesh_builder->face_data_size, sizeof(*used_vertices)))) + if (!(used_vertices = calloc(mesh_builder->face_data_size, sizeof(*used_vertices)))) { IDirect3DRMMesh_Release(*mesh); return E_OUTOFMEMORY; }
- if (!(face_data = heap_calloc(mesh_builder->face_data_size, sizeof(*face_data)))) + if (!(face_data = calloc(mesh_builder->face_data_size, sizeof(*face_data)))) { - heap_free(used_vertices); + free(used_vertices); IDirect3DRMMesh_Release(*mesh); return E_OUTOFMEMORY; } @@ -2049,8 +2049,8 @@ static HRESULT WINAPI d3drm_mesh_builder3_CreateMesh(IDirect3DRMMeshBuilder3 *if nb_vertices++;
hr = IDirect3DRMMesh_AddGroup(*mesh, nb_vertices, nb_faces, vertex_per_face, face_data, &group); - heap_free(used_vertices); - heap_free(face_data); + free(used_vertices); + free(face_data); if (SUCCEEDED(hr)) hr = IDirect3DRMMesh_SetGroupColor(*mesh, group, mesh_builder->materials[k].color); if (SUCCEEDED(hr)) @@ -2340,7 +2340,7 @@ HRESULT d3drm_mesh_builder_create(struct d3drm_mesh_builder **mesh_builder, IDir
TRACE("mesh_builder %p.\n", mesh_builder);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMMeshBuilder2_iface.lpVtbl = &d3drm_mesh_builder2_vtbl; @@ -2402,15 +2402,15 @@ static ULONG WINAPI d3drm_mesh_Release(IDirect3DRMMesh *iface) IDirect3DRM_Release(mesh->d3drm); for (i = 0; i < mesh->nb_groups; ++i) { - heap_free(mesh->groups[i].vertices); - heap_free(mesh->groups[i].face_data); + free(mesh->groups[i].vertices); + free(mesh->groups[i].face_data); if (mesh->groups[i].material) IDirect3DRMMaterial2_Release(mesh->groups[i].material); if (mesh->groups[i].texture) IDirect3DRMTexture3_Release(mesh->groups[i].texture); } - heap_free(mesh->groups); - heap_free(mesh); + free(mesh->groups); + free(mesh); }
return refcount; @@ -2531,7 +2531,7 @@ static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned verte
group = mesh->groups + mesh->nb_groups;
- if (!(group->vertices = heap_calloc(vertex_count, sizeof(*group->vertices)))) + if (!(group->vertices = calloc(vertex_count, sizeof(*group->vertices)))) return E_OUTOFMEMORY; group->nb_vertices = vertex_count; group->nb_faces = face_count; @@ -2556,9 +2556,9 @@ static HRESULT WINAPI d3drm_mesh_AddGroup(IDirect3DRMMesh *iface, unsigned verte } }
- if (!(group->face_data = heap_calloc(group->face_data_size, sizeof(*group->face_data)))) + if (!(group->face_data = calloc(group->face_data_size, sizeof(*group->face_data)))) { - heap_free(group->vertices); + free(group->vertices); return E_OUTOFMEMORY; } memcpy(group->face_data, face_data, group->face_data_size * sizeof(*face_data)); @@ -2840,7 +2840,7 @@ HRESULT d3drm_mesh_create(struct d3drm_mesh **mesh, IDirect3DRM *d3drm)
TRACE("mesh %p, d3drm %p.\n", mesh, d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMMesh_iface.lpVtbl = &d3drm_mesh_vtbl; @@ -2894,7 +2894,7 @@ static ULONG WINAPI d3drm_wrap_Release(IDirect3DRMWrap *iface) if (!refcount) { d3drm_object_cleanup((IDirect3DRMObject *)iface, &wrap->obj); - heap_free(wrap); + free(wrap); }
return refcount; @@ -3026,7 +3026,7 @@ HRESULT d3drm_wrap_create(struct d3drm_wrap **wrap, IDirect3DRM *d3drm)
TRACE("wrap %p, d3drm %p.\n", wrap, d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMWrap_iface.lpVtbl = &d3drm_wrap_vtbl; diff --git a/dlls/d3drm/texture.c b/dlls/d3drm/texture.c index 08cc69410cb..b9d84114995 100644 --- a/dlls/d3drm/texture.c +++ b/dlls/d3drm/texture.c @@ -47,7 +47,7 @@ static void d3drm_texture_destroy(struct d3drm_texture *texture) IDirect3DRM_Release(texture->d3drm); if (texture->surface) IDirectDrawSurface_Release(texture->surface); - heap_free(texture); + free(texture); }
static BOOL d3drm_validate_image(D3DRMIMAGE *image) @@ -79,17 +79,17 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, src_pitch = flip ? -w * 3 : w * 3; dst_pitch = (w + 3) & ~3;
- if (!(dst_data = heap_alloc(dst_pitch * h))) + if (!(dst_data = malloc(dst_pitch * h))) { WARN("Failed to allocate image buffer.\n"); return FALSE; } memset(dst_data, 0xff, dst_pitch * h);
- if (!(palette = heap_alloc(256 * sizeof(*palette)))) + if (!(palette = malloc(256 * sizeof(*palette)))) { WARN("Failed to allocate palette.\n"); - heap_free(dst_data); + free(dst_data); return FALSE; }
@@ -113,8 +113,8 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, { if (colour_count == 256) { - heap_free(dst_data); - heap_free(palette); + free(dst_data); + free(palette); return FALSE; }
@@ -140,7 +140,7 @@ static BOOL d3drm_image_palettise(D3DRMIMAGE *image, unsigned char *src_data, image->green_mask = 0xff; image->blue_mask = 0xff; image->palette_size = colour_count; - if (!(image->palette = heap_realloc(palette, colour_count * sizeof(*palette)))) + if (!(image->palette = realloc(palette, colour_count * sizeof(*palette)))) image->palette = palette;
return TRUE; @@ -161,7 +161,7 @@ static HRESULT d3drm_image_load_32(D3DRMIMAGE *image, unsigned char *src_data, src_pitch = flip ? -w * 3 : w * 3; dst_pitch = w * 4;
- if (!(dst_data = heap_alloc(dst_pitch * h))) + if (!(dst_data = malloc(dst_pitch * h))) { WARN("Failed to allocate image buffer.\n"); return D3DRMERR_BADALLOC; @@ -206,16 +206,16 @@ static HRESULT d3drm_image_load_8(D3DRMIMAGE *image, const RGBQUAD *palette, if (w > ~(SIZE_T)0 / h) return D3DRMERR_BADALLOC;
- if (!(dst_data = heap_alloc(w * h))) + if (!(dst_data = malloc(w * h))) { WARN("Failed to allocate image buffer.\n"); return D3DRMERR_BADALLOC; }
- if (!(image->palette = heap_alloc(256 * sizeof(*image->palette)))) + if (!(image->palette = malloc(256 * sizeof(*image->palette)))) { WARN("Failed to allocate palette.\n"); - heap_free(dst_data); + free(dst_data); return D3DRMERR_BADALLOC; }
@@ -257,8 +257,8 @@ static void CDECL destroy_image_callback(IDirect3DRMObject *obj, void *arg)
TRACE("texture object %p, image %p.\n", obj, image);
- heap_free(image->buffer1); - heap_free(image); + free(image->buffer1); + free(image); }
static HRESULT d3drm_texture_load(struct d3drm_texture *texture, @@ -294,7 +294,7 @@ static HRESULT d3drm_texture_load(struct d3drm_texture *texture, return D3DRMERR_BADVALUE;
hr = D3DRMERR_BADALLOC; - if (!(image = heap_alloc_zero(sizeof(*image)))) + if (!(image = calloc(1, sizeof(*image)))) goto fail;
hr = D3DRMERR_BADFILE; @@ -344,7 +344,7 @@ static HRESULT d3drm_texture_load(struct d3drm_texture *texture, return hr;
fail: - heap_free(image); + free(image); UnmapViewOfFile(header);
return hr; @@ -1450,7 +1450,7 @@ HRESULT d3drm_texture_create(struct d3drm_texture **texture, IDirect3DRM *d3drm)
TRACE("texture %p.\n", texture);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMTexture_iface.lpVtbl = &d3drm_texture1_vtbl; diff --git a/dlls/d3drm/viewport.c b/dlls/d3drm/viewport.c index 36a80c95675..535aa8786f5 100644 --- a/dlls/d3drm/viewport.c +++ b/dlls/d3drm/viewport.c @@ -73,7 +73,7 @@ static void d3drm_viewport_destroy(struct d3drm_viewport *viewport) IDirect3DRM_Release(viewport->d3drm); }
- heap_free(viewport); + free(viewport); }
static HRESULT WINAPI d3drm_viewport2_QueryInterface(IDirect3DRMViewport2 *iface, REFIID riid, void **out) @@ -1133,7 +1133,7 @@ HRESULT d3drm_viewport_create(struct d3drm_viewport **viewport, IDirect3DRM *d3d
TRACE("viewport %p, d3drm %p.\n", viewport, d3drm);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + if (!(object = calloc(1, sizeof(*object)))) return E_OUTOFMEMORY;
object->IDirect3DRMViewport_iface.lpVtbl = &d3drm_viewport1_vtbl;
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3drm/tests/d3drm.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 2166c8eaf2a..a65a03c5b49 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -6163,7 +6163,7 @@ static char *create_bitmap(unsigned int w, unsigned int h, BOOL palettized)
ret = GetTempPathA(MAX_PATH, path); ok(ret, "Failed to get temporary file path.\n"); - filename = HeapAlloc(GetProcessHeap(), 0, MAX_PATH); + filename = malloc(MAX_PATH); ret = GetTempFileNameA(path, "d3d", 0, filename); ok(ret, "Failed to get filename.\n"); file = CreateFileA(filename, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); @@ -6178,7 +6178,7 @@ static char *create_bitmap(unsigned int w, unsigned int h, BOOL palettized) ret = WriteFile(file, &file_header, sizeof(file_header), &written, NULL); ok(ret && written == sizeof(file_header), "Failed to write file header.\n");
- info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + info = calloc(1, size); info->bmiHeader.biSize = sizeof(info->bmiHeader); info->bmiHeader.biBitCount = bpp; info->bmiHeader.biPlanes = 1; @@ -6196,10 +6196,10 @@ static char *create_bitmap(unsigned int w, unsigned int h, BOOL palettized) } ret = WriteFile(file, info, size, &written, NULL); ok(ret && written == size, "Failed to write bitmap info.\n"); - HeapFree(GetProcessHeap(), 0, info); + free(info);
size = w * h * (bpp / 8); - buffer = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); + buffer = calloc(1, size); for (i = 0, j = 0; i < size;) { if (palettized) @@ -6216,7 +6216,7 @@ static char *create_bitmap(unsigned int w, unsigned int h, BOOL palettized) } ret = WriteFile(file, buffer, size, &written, NULL); ok(ret && written == size, "Failed to write bitmap data.\n"); - HeapFree(GetProcessHeap(), 0, buffer); + free(buffer);
CloseHandle(file);
@@ -6515,7 +6515,7 @@ static void test_load_texture(void)
ret = DeleteFileA(filename); ok(ret, "Failed to delete bitmap "%s".\n", filename); - HeapFree(GetProcessHeap(), 0, filename); + free(filename);
winetest_pop_context(); } @@ -6647,7 +6647,7 @@ static void test_texture_qi(void) IDirect3DRM_Release(d3drm1); check = DeleteFileA(filename); ok(check, "Cannot delete image stored in %s (error = %ld).\n", filename, GetLastError()); - HeapFree(GetProcessHeap(), 0, filename); + free(filename); }
static void test_viewport_qi(void)
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=126070
Your paranoid android.
=== debian11 (32 bit report) ===
d3d8: device.c:3365: Test failed: Expected message 0x1c for window 0x1, but didn't receive it
This merge request was approved by Zebediah Figura.