Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
e3ac5855
Commit
e3ac5855
authored
Oct 29, 2023
by
Alex Henrie
Committed by
Alexandre Julliard
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Use CRT allocation functions.
parent
042f9304
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
44 additions
and
45 deletions
+44
-45
clipper.c
dlls/ddraw/clipper.c
+1
-1
ddraw.c
dlls/ddraw/ddraw.c
+15
-15
ddraw_private.h
dlls/ddraw/ddraw_private.h
+0
-1
device.c
dlls/ddraw/device.c
+10
-10
executebuffer.c
dlls/ddraw/executebuffer.c
+3
-3
light.c
dlls/ddraw/light.c
+1
-1
main.c
dlls/ddraw/main.c
+7
-7
material.c
dlls/ddraw/material.c
+2
-2
palette.c
dlls/ddraw/palette.c
+1
-1
surface.c
dlls/ddraw/surface.c
+0
-0
vertexbuffer.c
dlls/ddraw/vertexbuffer.c
+3
-3
viewport.c
dlls/ddraw/viewport.c
+1
-1
No files found.
dlls/ddraw/clipper.c
View file @
e3ac5855
...
...
@@ -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
;
...
...
dlls/ddraw/ddraw.c
View file @
e3ac5855
...
...
@@ -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
=
m
alloc
(
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
=
m
alloc
(
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
);
...
...
dlls/ddraw/ddraw_private.h
View file @
e3ac5855
...
...
@@ -25,7 +25,6 @@
#include <stdbool.h>
#define COBJMACROS
#include "wine/debug.h"
#include "wine/heap.h"
#include "winbase.h"
#include "wingdi.h"
...
...
dlls/ddraw/device.c
View file @
e3ac5855
...
...
@@ -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
=
m
alloc
(
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
;
}
...
...
dlls/ddraw/executebuffer.c
View file @
e3ac5855
...
...
@@ -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
;
...
...
dlls/ddraw/light.c
View file @
e3ac5855
...
...
@@ -137,7 +137,7 @@ static ULONG WINAPI d3d_light_Release(IDirect3DLight *iface)
if
(
!
ref
)
{
heap_
free
(
light
);
free
(
light
);
return
0
;
}
return
ref
;
...
...
dlls/ddraw/main.c
View file @
e3ac5855
...
...
@@ -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
;
...
...
dlls/ddraw/material.c
View file @
e3ac5855
...
...
@@ -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
;
...
...
dlls/ddraw/palette.c
View file @
e3ac5855
...
...
@@ -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
;
...
...
dlls/ddraw/surface.c
View file @
e3ac5855
This diff is collapsed.
Click to expand it.
dlls/ddraw/vertexbuffer.c
View file @
e3ac5855
...
...
@@ -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
;
}
...
...
dlls/ddraw/viewport.c
View file @
e3ac5855
...
...
@@ -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
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment