mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
ddraw: Use CRT allocation functions.
This commit is contained in:
parent
042f9304cc
commit
e3ac58558f
12 changed files with 89 additions and 90 deletions
|
@ -110,7 +110,7 @@ static ULONG WINAPI ddraw_clipper_Release(IDirectDrawClipper *iface)
|
|||
if (clipper->region)
|
||||
DeleteObject(clipper->region);
|
||||
clipper->IDirectDrawClipper_iface.lpVtbl = NULL; /* Should help with detecting freed clippers. */
|
||||
heap_free(clipper);
|
||||
free(clipper);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
|
|
|
@ -387,7 +387,7 @@ static void ddraw_destroy_swapchain(struct ddraw *ddraw)
|
|||
{
|
||||
wined3d_vertex_declaration_decref(ddraw->decls[i].decl);
|
||||
}
|
||||
heap_free(ddraw->decls);
|
||||
free(ddraw->decls);
|
||||
ddraw->numConvertedDecls = 0;
|
||||
|
||||
wined3d_swapchain_decref(ddraw->wined3d_swapchain);
|
||||
|
@ -445,7 +445,7 @@ static void ddraw_destroy(struct ddraw *This)
|
|||
This->d3ddevice->ddraw = NULL;
|
||||
|
||||
/* Now free the object */
|
||||
heap_free(This);
|
||||
free(This);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -631,7 +631,7 @@ static HRESULT ddraw_attach_d3d_device(struct ddraw *ddraw, HWND window,
|
|||
}
|
||||
|
||||
ddraw->declArraySize = 2;
|
||||
if (!(ddraw->decls = heap_alloc_zero(ddraw->declArraySize * sizeof(*ddraw->decls))))
|
||||
if (!(ddraw->decls = calloc(ddraw->declArraySize, sizeof(*ddraw->decls))))
|
||||
{
|
||||
ERR("Error allocating an array for the converted vertex decls.\n");
|
||||
ddraw->declArraySize = 0;
|
||||
|
@ -2441,7 +2441,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
|||
if (!cb)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
if (!(enum_modes = heap_alloc(enum_mode_array_size * sizeof(*enum_modes))))
|
||||
if (!(enum_modes = malloc(enum_mode_array_size * sizeof(*enum_modes))))
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
||||
wined3d_mutex_lock();
|
||||
|
@ -2506,7 +2506,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
|||
if(cb(&callback_sd, Context) == DDENUMRET_CANCEL)
|
||||
{
|
||||
TRACE("Application asked to terminate the enumeration\n");
|
||||
heap_free(enum_modes);
|
||||
free(enum_modes);
|
||||
wined3d_mutex_unlock();
|
||||
return DD_OK;
|
||||
}
|
||||
|
@ -2516,9 +2516,9 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
|||
struct wined3d_display_mode *new_enum_modes;
|
||||
|
||||
enum_mode_array_size *= 2;
|
||||
if (!(new_enum_modes = heap_realloc(enum_modes, enum_mode_array_size * sizeof(*new_enum_modes))))
|
||||
if (!(new_enum_modes = realloc(enum_modes, enum_mode_array_size * sizeof(*new_enum_modes))))
|
||||
{
|
||||
heap_free(enum_modes);
|
||||
free(enum_modes);
|
||||
wined3d_mutex_unlock();
|
||||
return DDERR_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -2530,7 +2530,7 @@ static HRESULT WINAPI ddraw7_EnumDisplayModes(IDirectDraw7 *iface, DWORD Flags,
|
|||
}
|
||||
|
||||
TRACE("End of enumeration\n");
|
||||
heap_free(enum_modes);
|
||||
free(enum_modes);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return DD_OK;
|
||||
|
@ -3450,7 +3450,7 @@ HRESULT WINAPI DirectDrawCreateClipper(DWORD flags, IDirectDrawClipper **clipper
|
|||
|
||||
wined3d_mutex_lock();
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
{
|
||||
wined3d_mutex_unlock();
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -3460,7 +3460,7 @@ HRESULT WINAPI DirectDrawCreateClipper(DWORD flags, IDirectDrawClipper **clipper
|
|||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize clipper, hr %#lx.\n", hr);
|
||||
heap_free(object);
|
||||
free(object);
|
||||
wined3d_mutex_unlock();
|
||||
return hr;
|
||||
}
|
||||
|
@ -3560,7 +3560,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
|
|||
return DDERR_NOCOOPERATIVELEVELSET;
|
||||
}
|
||||
|
||||
if (!(object = heap_alloc(sizeof(*object))))
|
||||
if (!(object = malloc(sizeof(*object))))
|
||||
{
|
||||
ERR("Out of memory when allocating memory for a palette implementation\n");
|
||||
wined3d_mutex_unlock();
|
||||
|
@ -3571,7 +3571,7 @@ static HRESULT WINAPI ddraw7_CreatePalette(IDirectDraw7 *iface, DWORD Flags,
|
|||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize palette, hr %#lx.\n", hr);
|
||||
heap_free(object);
|
||||
free(object);
|
||||
wined3d_mutex_unlock();
|
||||
return hr;
|
||||
}
|
||||
|
@ -3978,7 +3978,7 @@ static HRESULT WINAPI d3d3_CreateLight(IDirect3D3 *iface, IDirect3DLight **light
|
|||
if (outer_unknown)
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
{
|
||||
ERR("Failed to allocate light memory.\n");
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
@ -4125,7 +4125,7 @@ static HRESULT WINAPI d3d3_CreateViewport(IDirect3D3 *iface, IDirect3DViewport3
|
|||
|
||||
if (outer_unknown) return CLASS_E_NOAGGREGATION;
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
{
|
||||
ERR("Failed to allocate viewport memory.\n");
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
@ -4921,7 +4921,7 @@ struct wined3d_vertex_declaration *ddraw_find_decl(struct ddraw *This, DWORD fvf
|
|||
{
|
||||
unsigned int grow = max(This->declArraySize / 2, 8);
|
||||
|
||||
if (!(convertedDecls = heap_realloc(convertedDecls,
|
||||
if (!(convertedDecls = realloc(convertedDecls,
|
||||
(This->numConvertedDecls + grow) * sizeof(*convertedDecls))))
|
||||
{
|
||||
wined3d_vertex_declaration_decref(pDecl);
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include <stdbool.h>
|
||||
#define COBJMACROS
|
||||
#include "wine/debug.h"
|
||||
#include "wine/heap.h"
|
||||
|
||||
#include "winbase.h"
|
||||
#include "wingdi.h"
|
||||
|
|
|
@ -362,7 +362,7 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface)
|
|||
This->ddraw->d3ddevice = NULL;
|
||||
|
||||
/* Now free the structure */
|
||||
heap_free(This);
|
||||
free(This);
|
||||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
|
@ -703,7 +703,7 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface,
|
|||
return CLASS_E_NOAGGREGATION;
|
||||
|
||||
/* Allocate the new Execute Buffer */
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
{
|
||||
ERR("Failed to allocate execute buffer memory.\n");
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
@ -713,7 +713,7 @@ static HRESULT WINAPI d3d_device1_CreateExecuteBuffer(IDirect3DDevice *iface,
|
|||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to initialize execute buffer, hr %#lx.\n", hr);
|
||||
heap_free(object);
|
||||
free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1329,7 +1329,7 @@ static HRESULT WINAPI d3d_device1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIX
|
|||
if(!D3DMatHandle)
|
||||
return DDERR_INVALIDPARAMS;
|
||||
|
||||
if (!(matrix = heap_alloc_zero(sizeof(*matrix))))
|
||||
if (!(matrix = calloc(1, sizeof(*matrix))))
|
||||
{
|
||||
ERR("Out of memory when allocating a D3DMATRIX\n");
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
@ -1341,7 +1341,7 @@ static HRESULT WINAPI d3d_device1_CreateMatrix(IDirect3DDevice *iface, D3DMATRIX
|
|||
if (h == DDRAW_INVALID_HANDLE)
|
||||
{
|
||||
ERR("Failed to allocate a matrix handle.\n");
|
||||
heap_free(matrix);
|
||||
free(matrix);
|
||||
wined3d_mutex_unlock();
|
||||
return DDERR_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -1493,7 +1493,7 @@ static HRESULT WINAPI d3d_device1_DeleteMatrix(IDirect3DDevice *iface, D3DMATRIX
|
|||
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
heap_free(m);
|
||||
free(m);
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
@ -2260,11 +2260,11 @@ static HRESULT WINAPI d3d_device3_Vertex(IDirect3DDevice3 *iface, void *vertex)
|
|||
|
||||
device->buffer_size = device->buffer_size ? device->buffer_size * 2 : device->vertex_size * 3;
|
||||
old_buffer = device->sysmem_vertex_buffer;
|
||||
device->sysmem_vertex_buffer = heap_alloc(device->buffer_size);
|
||||
device->sysmem_vertex_buffer = malloc(device->buffer_size);
|
||||
if (old_buffer)
|
||||
{
|
||||
memcpy(device->sysmem_vertex_buffer, old_buffer, device->nb_vertices * device->vertex_size);
|
||||
heap_free(old_buffer);
|
||||
free(old_buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6944,7 +6944,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_su
|
|||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (!(object = heap_alloc_zero(sizeof(*object))))
|
||||
if (!(object = calloc(1, sizeof(*object))))
|
||||
{
|
||||
ERR("Failed to allocate device memory.\n");
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
@ -6953,7 +6953,7 @@ HRESULT d3d_device_create(struct ddraw *ddraw, const GUID *guid, struct ddraw_su
|
|||
if (FAILED(hr = d3d_device_init(object, ddraw, guid, target, rt_iface, version, outer_unknown)))
|
||||
{
|
||||
WARN("Failed to initialize device, hr %#lx.\n", hr);
|
||||
heap_free(object);
|
||||
free(object);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -488,7 +488,7 @@ static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
|
|||
if (!ref)
|
||||
{
|
||||
if (buffer->need_free)
|
||||
heap_free(buffer->desc.lpData);
|
||||
free(buffer->desc.lpData);
|
||||
if (buffer->index_buffer)
|
||||
wined3d_buffer_decref(buffer->index_buffer);
|
||||
if (buffer->dst_vertex_buffer)
|
||||
|
@ -496,7 +496,7 @@ static ULONG WINAPI d3d_execute_buffer_Release(IDirect3DExecuteBuffer *iface)
|
|||
wined3d_buffer_decref(buffer->src_vertex_buffer);
|
||||
wined3d_buffer_decref(buffer->dst_vertex_buffer);
|
||||
}
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -780,7 +780,7 @@ HRESULT d3d_execute_buffer_init(struct d3d_execute_buffer *execute_buffer,
|
|||
if (!execute_buffer->desc.lpData && execute_buffer->desc.dwBufferSize)
|
||||
{
|
||||
execute_buffer->need_free = TRUE;
|
||||
if (!(execute_buffer->desc.lpData = heap_alloc_zero(execute_buffer->desc.dwBufferSize)))
|
||||
if (!(execute_buffer->desc.lpData = calloc(1, execute_buffer->desc.dwBufferSize)))
|
||||
{
|
||||
ERR("Failed to allocate execute buffer data.\n");
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
|
|
@ -137,7 +137,7 @@ static ULONG WINAPI d3d_light_Release(IDirect3DLight *iface)
|
|||
|
||||
if (!ref)
|
||||
{
|
||||
heap_free(light);
|
||||
free(light);
|
||||
return 0;
|
||||
}
|
||||
return ref;
|
||||
|
|
|
@ -115,7 +115,7 @@ static void ddraw_enumerate_secondary_devices(struct wined3d *wined3d, LPDDENUMC
|
|||
/* Handle table functions */
|
||||
BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
|
||||
{
|
||||
if (!(t->entries = heap_alloc_zero(initial_size * sizeof(*t->entries))))
|
||||
if (!(t->entries = calloc(initial_size, sizeof(*t->entries))))
|
||||
{
|
||||
ERR("Failed to allocate handle table memory.\n");
|
||||
return FALSE;
|
||||
|
@ -129,7 +129,7 @@ BOOL ddraw_handle_table_init(struct ddraw_handle_table *t, UINT initial_size)
|
|||
|
||||
void ddraw_handle_table_destroy(struct ddraw_handle_table *t)
|
||||
{
|
||||
heap_free(t->entries);
|
||||
free(t->entries);
|
||||
memset(t, 0, sizeof(*t));
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ DWORD ddraw_allocate_handle(struct ddraw_handle_table *t, void *object, enum ddr
|
|||
UINT new_size = t->table_size + (t->table_size >> 1);
|
||||
struct ddraw_handle_entry *new_entries;
|
||||
|
||||
if (!(new_entries = heap_realloc(t->entries, new_size * sizeof(*t->entries))))
|
||||
if (!(new_entries = realloc(t->entries, new_size * sizeof(*t->entries))))
|
||||
{
|
||||
ERR("Failed to grow the handle table.\n");
|
||||
return DDRAW_INVALID_HANDLE;
|
||||
|
@ -311,7 +311,7 @@ static HRESULT DDRAW_Create(const GUID *guid, void **out, IUnknown *outer_unknow
|
|||
if (!IsEqualGUID(iid, &IID_IDirectDraw7))
|
||||
flags = WINED3D_LEGACY_FFP_LIGHTING;
|
||||
|
||||
if (!(ddraw = heap_alloc_zero(sizeof(*ddraw))))
|
||||
if (!(ddraw = calloc(1, sizeof(*ddraw))))
|
||||
{
|
||||
ERR("Out of memory when creating DirectDraw.\n");
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -320,7 +320,7 @@ static HRESULT DDRAW_Create(const GUID *guid, void **out, IUnknown *outer_unknow
|
|||
if (FAILED(hr = ddraw_init(ddraw, flags, device_type)))
|
||||
{
|
||||
WARN("Failed to initialize ddraw object, hr %#lx.\n", hr);
|
||||
heap_free(ddraw);
|
||||
free(ddraw);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -681,7 +681,7 @@ static ULONG WINAPI ddraw_class_factory_Release(IClassFactory *iface)
|
|||
TRACE("%p decreasing refcount to %lu.\n", factory, ref);
|
||||
|
||||
if (!ref)
|
||||
heap_free(factory);
|
||||
free(factory);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
@ -765,7 +765,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **out)
|
|||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
}
|
||||
|
||||
if (!(factory = heap_alloc_zero(sizeof(*factory))))
|
||||
if (!(factory = calloc(1, sizeof(*factory))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
factory->IClassFactory_iface.lpVtbl = &IClassFactory_Vtbl;
|
||||
|
|
|
@ -147,7 +147,7 @@ static ULONG WINAPI d3d_material3_Release(IDirect3DMaterial3 *iface)
|
|||
wined3d_mutex_unlock();
|
||||
}
|
||||
|
||||
heap_free(material);
|
||||
free(material);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -499,7 +499,7 @@ struct d3d_material *d3d_material_create(struct ddraw *ddraw)
|
|||
{
|
||||
struct d3d_material *material;
|
||||
|
||||
if (!(material = heap_alloc_zero(sizeof(*material))))
|
||||
if (!(material = calloc(1, sizeof(*material))))
|
||||
return NULL;
|
||||
|
||||
material->IDirect3DMaterial3_iface.lpVtbl = &d3d_material3_vtbl;
|
||||
|
|
|
@ -97,7 +97,7 @@ static ULONG WINAPI ddraw_palette_Release(IDirectDrawPalette *iface)
|
|||
IUnknown_Release(palette->ifaceToRelease);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
heap_free(palette);
|
||||
free(palette);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
|
|
@ -1655,7 +1655,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
|||
return hr;
|
||||
}
|
||||
|
||||
if (!(clip_list = heap_alloc(clip_list_size)))
|
||||
if (!(clip_list = malloc(clip_list_size)))
|
||||
{
|
||||
WARN("Failed to allocate clip list.\n");
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -1665,7 +1665,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
|||
&dst_rect, clip_list, &clip_list_size)))
|
||||
{
|
||||
WARN("Failed to get clip list, hr %#lx.\n", hr);
|
||||
heap_free(clip_list);
|
||||
free(clip_list);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -1699,7 +1699,7 @@ static HRESULT ddraw_surface_blt_clipped(struct ddraw_surface *dst_surface, cons
|
|||
}
|
||||
}
|
||||
|
||||
heap_free(clip_list);
|
||||
free(clip_list);
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
@ -6049,7 +6049,7 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
|
|||
if (surface->draw_texture)
|
||||
wined3d_texture_decref(surface->wined3d_texture);
|
||||
|
||||
heap_free(surface);
|
||||
free(surface);
|
||||
}
|
||||
|
||||
static const struct wined3d_parent_ops ddraw_surface_wined3d_parent_ops =
|
||||
|
@ -6106,8 +6106,8 @@ static void STDMETHODCALLTYPE ddraw_texture_wined3d_object_destroyed(void *paren
|
|||
|
||||
TRACE("texture %p, texture_memory %p.\n", texture, texture->texture_memory);
|
||||
|
||||
heap_free(texture->texture_memory);
|
||||
heap_free(parent);
|
||||
free(texture->texture_memory);
|
||||
free(parent);
|
||||
}
|
||||
|
||||
static const struct wined3d_parent_ops ddraw_texture_wined3d_parent_ops =
|
||||
|
@ -6133,7 +6133,7 @@ static HRESULT ddraw_surface_reserve_memory(struct wined3d_texture *wined3d_text
|
|||
unsigned int offset, i;
|
||||
|
||||
wined3d_resource_get_desc(wined3d_texture_get_resource(wined3d_texture), &resource_desc);
|
||||
if (!(texture->texture_memory = heap_alloc_zero(resource_desc.size + extra_size)))
|
||||
if (!(texture->texture_memory = calloc(1, resource_desc.size + extra_size)))
|
||||
{
|
||||
ERR("Out of memory.\n");
|
||||
return E_OUTOFMEMORY;
|
||||
|
@ -6146,7 +6146,7 @@ static HRESULT ddraw_surface_reserve_memory(struct wined3d_texture *wined3d_text
|
|||
if (FAILED(hr = wined3d_texture_get_sub_resource_desc(wined3d_texture, i, &desc)))
|
||||
{
|
||||
ERR("Subresource %u not found.\n", i);
|
||||
heap_free(texture->texture_memory);
|
||||
free(texture->texture_memory);
|
||||
texture->texture_memory = NULL;
|
||||
return hr;
|
||||
}
|
||||
|
@ -6155,7 +6155,7 @@ static HRESULT ddraw_surface_reserve_memory(struct wined3d_texture *wined3d_text
|
|||
if (FAILED(hr = wined3d_texture_update_desc(wined3d_texture, i,
|
||||
(BYTE *)texture->texture_memory + offset, pitch)))
|
||||
{
|
||||
heap_free(texture->texture_memory);
|
||||
free(texture->texture_memory);
|
||||
texture->texture_memory = NULL;
|
||||
break;
|
||||
}
|
||||
|
@ -6352,7 +6352,7 @@ static HRESULT ddraw_texture_init(struct ddraw_texture *texture, struct ddraw *d
|
|||
struct ddraw_surface *mip;
|
||||
DDSURFACEDESC2 *mip_desc;
|
||||
|
||||
if (!(mip = heap_alloc_zero(sizeof(*mip))))
|
||||
if (!(mip = calloc(1, sizeof(*mip))))
|
||||
{
|
||||
hr = DDERR_OUTOFVIDEOMEMORY;
|
||||
goto fail;
|
||||
|
@ -6529,7 +6529,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (!surface)
|
||||
return E_POINTER;
|
||||
|
||||
if (!(texture = heap_alloc(sizeof(*texture))))
|
||||
if (!(texture = malloc(sizeof(*texture))))
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
texture->texture_memory = NULL;
|
||||
|
@ -6545,7 +6545,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
|
||||
{
|
||||
WARN("DDSCAPS_COMPLEX specified for a surface which is neither flippable, mipmapped, nor a cubemap.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
|
@ -6553,7 +6553,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
{
|
||||
/* This is illegal even if there is only one mipmap level. */
|
||||
WARN("DDSD_MIPMAPCOUNT specified without DDSCAPS_COMPLEX.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
|
@ -6562,28 +6562,28 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (!(desc->dwFlags & DDSD_BACKBUFFERCOUNT) || !desc->dwBackBufferCount)
|
||||
{
|
||||
WARN("Tried to create a flippable surface without any back buffers.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX))
|
||||
{
|
||||
WARN("Tried to create a flippable surface without DDSCAPS_COMPLEX.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||
{
|
||||
WARN("Tried to create a flippable cubemap.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
||||
{
|
||||
FIXME("Flippable textures not implemented.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
}
|
||||
|
@ -6593,7 +6593,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
{
|
||||
WARN("Tried to specify a back buffer count for a non-flippable surface.\n");
|
||||
hr = desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP ? DDERR_INVALIDPARAMS : DDERR_INVALIDCAPS;
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return hr;
|
||||
}
|
||||
}
|
||||
|
@ -6603,21 +6603,21 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
||||
{
|
||||
WARN("Tried to create a primary surface with DDSCAPS_TEXTURE.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
if ((desc->ddsCaps.dwCaps & DDSCAPS_COMPLEX) && !(desc->ddsCaps.dwCaps & DDSCAPS_FLIP))
|
||||
{
|
||||
WARN("Tried to create a flippable primary surface without both DDSCAPS_FLIP and DDSCAPS_COMPLEX.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
if ((desc->ddsCaps.dwCaps & DDSCAPS_FLIP) && !(ddraw->cooperative_level & DDSCL_EXCLUSIVE))
|
||||
{
|
||||
WARN("Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_NOEXCLUSIVEMODE;
|
||||
}
|
||||
}
|
||||
|
@ -6627,7 +6627,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
== (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
|
||||
{
|
||||
WARN("Tried to create a surface in both system and video memory.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
|
@ -6635,7 +6635,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&& !(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
||||
{
|
||||
WARN("Caps %#lx require DDSCAPS_TEXTURE.\n", desc->ddsCaps.dwCaps);
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
|
@ -6643,7 +6643,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP))
|
||||
{
|
||||
WARN("Cube map faces requested without cube map flag.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
|
@ -6651,7 +6651,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&& !(desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP_ALLFACES))
|
||||
{
|
||||
WARN("Cube map without faces requested.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
|
@ -6664,14 +6664,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE))
|
||||
{
|
||||
WARN("DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
if (desc->ddsCaps.dwCaps & (DDSCAPS_VIDEOMEMORY | DDSCAPS_SYSTEMMEMORY))
|
||||
{
|
||||
WARN("DDSCAPS2_TEXTUREMANAGE used with DDSCAPS_VIDEOMEMORY "
|
||||
"or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
}
|
||||
|
@ -6680,14 +6680,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&& !(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
|
||||
{
|
||||
WARN("DDSCAPS_WRITEONLY used without DDSCAPS2_TEXTUREMANAGE, returning DDERR_INVALIDCAPS.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
if (FAILED(hr = wined3d_output_get_display_mode(ddraw->wined3d_output, &mode, NULL)))
|
||||
{
|
||||
ERR("Failed to get display mode, hr %#lx.\n", hr);
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return hr_ddraw_from_wined3d(hr);
|
||||
}
|
||||
|
||||
|
@ -6707,7 +6707,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE))
|
||||
{
|
||||
WARN("No width / height specified.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
|
@ -6718,7 +6718,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
|
||||
if (!desc->dwWidth || !desc->dwHeight)
|
||||
{
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
|
@ -6752,7 +6752,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&swapchain_desc, NULL, ddraw_reset_enum_callback, TRUE)))
|
||||
{
|
||||
ERR("Failed to reset device.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return hr_ddraw_from_wined3d(hr);
|
||||
}
|
||||
|
||||
|
@ -6777,7 +6777,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
/* Mipmap count is given, should not be 0. */
|
||||
if (!desc->dwMipMapCount)
|
||||
{
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
}
|
||||
|
@ -6842,7 +6842,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
== (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
|
||||
{
|
||||
WARN("System memory overlays are not allowed.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_NOOVERLAYHW;
|
||||
}
|
||||
|
||||
|
@ -6857,21 +6857,21 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (!(desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY))
|
||||
{
|
||||
WARN("User memory surfaces should not be GPU accessible.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDCAPS;
|
||||
}
|
||||
|
||||
if (version < 4)
|
||||
{
|
||||
WARN("User memory surfaces not supported before version 4.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (!desc->lpSurface)
|
||||
{
|
||||
WARN("NULL surface memory pointer specified.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
|
@ -6880,14 +6880,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (version != 4 && (desc->dwFlags & DDSD_PITCH))
|
||||
{
|
||||
WARN("Pitch specified on a compressed user memory surface.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
|
||||
if (!(desc->dwFlags & (DDSD_LINEARSIZE | DDSD_PITCH)))
|
||||
{
|
||||
WARN("Compressed user memory surfaces should explicitly specify the linear size.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
}
|
||||
|
@ -6896,7 +6896,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (!(desc->dwFlags & DDSD_PITCH))
|
||||
{
|
||||
WARN("User memory surfaces should explicitly specify the pitch.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_INVALIDPARAMS;
|
||||
}
|
||||
}
|
||||
|
@ -6912,14 +6912,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
&& desc->ddckCKSrcBlt.dwColorSpaceLowValue != desc->ddckCKSrcBlt.dwColorSpaceHighValue))
|
||||
{
|
||||
WARN("Range color keys not supported, returning DDERR_NOCOLORKEYHW.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_NOCOLORKEYHW;
|
||||
}
|
||||
|
||||
if ((ddraw->flags & DDRAW_NO3D) && (desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY))
|
||||
{
|
||||
WARN("Video memory surfaces not supported without 3D support.\n");
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return DDERR_NODIRECTDRAWHW;
|
||||
}
|
||||
|
||||
|
@ -6933,7 +6933,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
if (FAILED(hr = ddraw_texture_init(texture, ddraw, layers, levels, sysmem_fallback, reserve_memory)))
|
||||
{
|
||||
WARN("Failed to create wined3d texture, hr %#lx.\n", hr);
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
return hr_ddraw_from_wined3d(hr);
|
||||
}
|
||||
|
||||
|
@ -6948,7 +6948,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
attach = &last->complex_array[0];
|
||||
for (i = 0; i < count; ++i)
|
||||
{
|
||||
if (!(texture = heap_alloc(sizeof(*texture))))
|
||||
if (!(texture = malloc(sizeof(*texture))))
|
||||
{
|
||||
hr = E_OUTOFMEMORY;
|
||||
goto fail;
|
||||
|
@ -6969,7 +6969,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
|
||||
if (FAILED(hr = ddraw_texture_init(texture, ddraw, 1, 1, sysmem_fallback, reserve_memory)))
|
||||
{
|
||||
heap_free(texture);
|
||||
free(texture);
|
||||
hr = hr_ddraw_from_wined3d(hr);
|
||||
goto fail;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ static ULONG WINAPI d3d_vertex_buffer7_Release(IDirect3DVertexBuffer7 *iface)
|
|||
if (buffer->version == 7)
|
||||
IDirectDraw7_Release(&buffer->ddraw->IDirectDraw7_iface);
|
||||
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
return ref;
|
||||
|
@ -448,7 +448,7 @@ HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **vertex_buf,
|
|||
TRACE(" FVF %#lx\n", desc->dwFVF);
|
||||
TRACE(" dwNumVertices %lu\n", desc->dwNumVertices);
|
||||
|
||||
if (!(buffer = heap_alloc_zero(sizeof(*buffer))))
|
||||
if (!(buffer = calloc(1, sizeof(*buffer))))
|
||||
return DDERR_OUTOFMEMORY;
|
||||
|
||||
buffer->IDirect3DVertexBuffer7_iface.lpVtbl = &d3d_vertex_buffer7_vtbl;
|
||||
|
@ -485,7 +485,7 @@ end:
|
|||
if (hr == D3D_OK)
|
||||
*vertex_buf = buffer;
|
||||
else
|
||||
heap_free(buffer);
|
||||
free(buffer);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
|
|
@ -288,7 +288,7 @@ static ULONG WINAPI d3d_viewport_Release(IDirect3DViewport3 *iface)
|
|||
TRACE("%p decreasing refcount to %lu.\n", viewport, ref);
|
||||
|
||||
if (!ref)
|
||||
heap_free(viewport);
|
||||
free(viewport);
|
||||
|
||||
return ref;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue