Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
9bc80fbf
Commit
9bc80fbf
authored
Jun 01, 2022
by
Piotr Caban
Committed by
Alexandre Julliard
Jun 07, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dx10: Use CRT memory allocators.
Signed-off-by:
Piotr Caban
<
piotr@codeweavers.com
>
parent
acf815fd
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
56 deletions
+51
-56
async.c
dlls/d3dx10_43/async.c
+18
-18
compiler.c
dlls/d3dx10_43/compiler.c
+4
-5
font.c
dlls/d3dx10_43/font.c
+15
-16
mesh.c
dlls/d3dx10_43/mesh.c
+2
-3
sprite.c
dlls/d3dx10_43/sprite.c
+2
-3
texture.c
dlls/d3dx10_43/texture.c
+10
-11
No files found.
dlls/d3dx10_43/async.c
View file @
9bc80fbf
...
...
@@ -73,7 +73,7 @@ static HRESULT WINAPI memorydataloader_Destroy(ID3DX10DataLoader *iface)
TRACE
(
"iface %p.
\n
"
,
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
loader
);
free
(
loader
);
return
S_OK
;
}
...
...
@@ -101,7 +101,7 @@ static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface)
return
D3D10_ERROR_FILE_NOT_FOUND
;
size
=
GetFileSize
(
file
,
NULL
);
data
=
HeapAlloc
(
GetProcessHeap
(),
0
,
size
);
data
=
malloc
(
size
);
if
(
!
data
)
{
CloseHandle
(
file
);
...
...
@@ -113,11 +113,11 @@ static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface)
if
(
!
ret
)
{
WARN
(
"Failed to read file contents.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
data
);
free
(
data
);
return
E_FAIL
;
}
HeapFree
(
GetProcessHeap
(),
0
,
loader
->
data
);
free
(
loader
->
data
);
loader
->
data
=
data
;
loader
->
size
=
size
;
...
...
@@ -145,9 +145,9 @@ static HRESULT WINAPI filedataloader_Destroy(ID3DX10DataLoader *iface)
TRACE
(
"iface %p.
\n
"
,
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
loader
->
u
.
file
.
path
);
HeapFree
(
GetProcessHeap
(),
0
,
loader
->
data
);
HeapFree
(
GetProcessHeap
(),
0
,
loader
);
free
(
loader
->
u
.
file
.
path
);
free
(
loader
->
data
);
free
(
loader
);
return
S_OK
;
}
...
...
@@ -203,7 +203,7 @@ static HRESULT WINAPI resourcedataloader_Destroy(ID3DX10DataLoader *iface)
TRACE
(
"iface %p.
\n
"
,
iface
);
HeapFree
(
GetProcessHeap
(),
0
,
loader
);
free
(
loader
);
return
S_OK
;
}
...
...
@@ -266,7 +266,7 @@ HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T data_size,
if
(
!
data
||
!
loader
)
return
E_FAIL
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
calloc
(
1
,
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
...
...
@@ -291,12 +291,12 @@ HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(const char *filename, ID3DX10DataLoa
return
E_FAIL
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
);
filename_w
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
*
filename_w
));
filename_w
=
malloc
(
len
*
sizeof
(
*
filename_w
));
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
filename_w
,
len
);
hr
=
D3DX10CreateAsyncFileLoaderW
(
filename_w
,
loader
);
HeapFree
(
GetProcessHeap
(),
0
,
filename_w
);
free
(
filename_w
);
return
hr
;
}
...
...
@@ -310,15 +310,15 @@ HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(const WCHAR *filename, ID3DX10DataLo
if
(
!
filename
||
!
loader
)
return
E_FAIL
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
calloc
(
1
,
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
object
->
ID3DX10DataLoader_iface
.
lpVtbl
=
&
filedataloadervtbl
;
object
->
u
.
file
.
path
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
filename
)
+
1
)
*
sizeof
(
WCHAR
));
object
->
u
.
file
.
path
=
malloc
(
(
lstrlenW
(
filename
)
+
1
)
*
sizeof
(
WCHAR
));
if
(
!
object
->
u
.
file
.
path
)
{
HeapFree
(
GetProcessHeap
(),
0
,
object
);
free
(
object
);
return
E_OUTOFMEMORY
;
}
lstrcpyW
(
object
->
u
.
file
.
path
,
filename
);
...
...
@@ -340,7 +340,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *reso
if
(
!
loader
)
return
E_FAIL
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
calloc
(
1
,
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
...
...
@@ -349,7 +349,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *reso
if
(
!
rsrc
)
{
WARN
(
"Failed to find resource.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
free
(
object
);
return
D3DX10_ERR_INVALID_DATA
;
}
...
...
@@ -374,7 +374,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
if
(
!
loader
)
return
E_FAIL
;
object
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
object
));
object
=
calloc
(
1
,
sizeof
(
*
object
));
if
(
!
object
)
return
E_OUTOFMEMORY
;
...
...
@@ -383,7 +383,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
if
(
!
rsrc
)
{
WARN
(
"Failed to find resource.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
object
);
free
(
object
);
return
D3DX10_ERR_INVALID_DATA
;
}
...
...
dlls/d3dx10_43/compiler.c
View file @
9bc80fbf
...
...
@@ -18,7 +18,6 @@
*/
#include "wine/debug.h"
#include "wine/heap.h"
#define COBJMACROS
...
...
@@ -113,13 +112,13 @@ HRESULT WINAPI D3DX10CreateEffectFromFileA(const char *filename, const D3D10_SHA
return
E_INVALIDARG
;
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
NULL
,
0
);
if
(
!
(
filenameW
=
heap_
alloc
(
len
*
sizeof
(
*
filenameW
))))
if
(
!
(
filenameW
=
m
alloc
(
len
*
sizeof
(
*
filenameW
))))
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
filename
,
-
1
,
filenameW
,
len
);
hr
=
D3DX10CreateEffectFromFileW
(
filenameW
,
defines
,
include
,
profile
,
shader_flags
,
effect_flags
,
device
,
effect_pool
,
pump
,
effect
,
errors
,
hresult
);
heap_
free
(
filenameW
);
free
(
filenameW
);
return
hr
;
}
...
...
@@ -198,13 +197,13 @@ HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE module, const WCHAR *reso
if
(
filenameW
)
{
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
filenameW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
filename
=
heap_
alloc
(
len
)))
if
(
!
(
filename
=
m
alloc
(
len
)))
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
filenameW
,
-
1
,
filename
,
len
,
NULL
,
NULL
);
}
hr
=
D3DX10CreateEffectFromMemory
(
data
,
size
,
filename
,
defines
,
include
,
profile
,
shader_flags
,
effect_flags
,
device
,
effect_pool
,
pump
,
effect
,
errors
,
hresult
);
heap_
free
(
filename
);
free
(
filename
);
return
hr
;
}
dlls/d3dx10_43/font.c
View file @
9bc80fbf
...
...
@@ -21,7 +21,6 @@
#include "d3dx10.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
...
...
@@ -82,7 +81,7 @@ static ULONG WINAPI d3dx_font_Release(ID3DX10Font *iface)
DeleteObject
(
font
->
hfont
);
DeleteDC
(
font
->
hdc
);
ID3D10Device_Release
(
font
->
device
);
heap_
free
(
font
);
free
(
font
);
}
return
refcount
;
}
...
...
@@ -179,14 +178,14 @@ static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first
return
S_OK
;
count
=
last
-
first
+
1
;
indices
=
heap_
alloc
(
count
*
sizeof
(
*
indices
));
indices
=
m
alloc
(
count
*
sizeof
(
*
indices
));
if
(
!
indices
)
return
E_OUTOFMEMORY
;
chars
=
heap_
alloc
(
count
*
sizeof
(
*
chars
));
chars
=
m
alloc
(
count
*
sizeof
(
*
chars
));
if
(
!
chars
)
{
heap_
free
(
indices
);
free
(
indices
);
return
E_OUTOFMEMORY
;
}
...
...
@@ -208,8 +207,8 @@ static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first
}
ID3DX10Font_PreloadGlyphs
(
iface
,
start
,
end
);
heap_
free
(
chars
);
heap_
free
(
indices
);
free
(
chars
);
free
(
indices
);
return
S_OK
;
}
...
...
@@ -237,14 +236,14 @@ static HRESULT WINAPI d3dx_font_PreloadTextA(ID3DX10Font *iface, const char *str
countW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
string
,
count
<
0
?
-
1
:
count
,
NULL
,
0
);
if
(
!
(
wstr
=
heap_
alloc
(
countW
*
sizeof
(
*
wstr
))))
if
(
!
(
wstr
=
m
alloc
(
countW
*
sizeof
(
*
wstr
))))
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
string
,
count
<
0
?
-
1
:
count
,
wstr
,
countW
);
hr
=
ID3DX10Font_PreloadTextW
(
iface
,
wstr
,
count
<
0
?
countW
-
1
:
countW
);
heap_
free
(
wstr
);
free
(
wstr
);
return
hr
;
}
...
...
@@ -266,7 +265,7 @@ static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *st
if
(
count
<
0
)
count
=
lstrlenW
(
string
);
indices
=
heap_
alloc
(
count
*
sizeof
(
*
indices
));
indices
=
m
alloc
(
count
*
sizeof
(
*
indices
));
if
(
!
indices
)
return
E_OUTOFMEMORY
;
...
...
@@ -275,7 +274,7 @@ static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *st
for
(
i
=
0
;
i
<
count
;
++
i
)
ID3DX10Font_PreloadGlyphs
(
iface
,
indices
[
i
],
indices
[
i
]);
heap_
free
(
indices
);
free
(
indices
);
return
S_OK
;
}
...
...
@@ -296,7 +295,7 @@ static INT WINAPI d3dx_font_DrawTextA(ID3DX10Font *iface, ID3DX10Sprite *sprite,
if
(
!
(
countW
=
MultiByteToWideChar
(
CP_ACP
,
0
,
string
,
count
<
0
?
-
1
:
count
,
NULL
,
0
)))
return
0
;
if
(
!
(
wstr
=
heap_alloc_zero
(
countW
*
sizeof
(
*
wstr
))))
if
(
!
(
wstr
=
calloc
(
countW
,
sizeof
(
*
wstr
))))
return
0
;
MultiByteToWideChar
(
CP_ACP
,
0
,
string
,
count
<
0
?
-
1
:
count
,
wstr
,
countW
);
...
...
@@ -304,7 +303,7 @@ static INT WINAPI d3dx_font_DrawTextA(ID3DX10Font *iface, ID3DX10Sprite *sprite,
ret
=
ID3DX10Font_DrawTextW
(
iface
,
sprite
,
wstr
,
count
<
0
?
countW
-
1
:
countW
,
rect
,
format
,
color
);
heap_
free
(
wstr
);
free
(
wstr
);
return
ret
;
}
...
...
@@ -430,13 +429,13 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT
*
font
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
hdc
=
CreateCompatibleDC
(
NULL
);
if
(
!
object
->
hdc
)
{
heap_
free
(
object
);
free
(
object
);
return
E_FAIL
;
}
...
...
@@ -445,7 +444,7 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT
if
(
!
object
->
hfont
)
{
DeleteDC
(
object
->
hdc
);
heap_
free
(
object
);
free
(
object
);
return
E_FAIL
;
}
SelectObject
(
object
->
hdc
,
object
->
hfont
);
...
...
dlls/d3dx10_43/mesh.c
View file @
9bc80fbf
...
...
@@ -21,7 +21,6 @@
#include "d3dx10.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
...
...
@@ -72,7 +71,7 @@ static ULONG STDMETHODCALLTYPE d3dx10_mesh_Release(ID3DX10Mesh *iface)
TRACE
(
"%p decreasing refcount to %lu.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
heap_
free
(
mesh
);
free
(
mesh
);
return
refcount
;
}
...
...
@@ -366,7 +365,7 @@ HRESULT WINAPI D3DX10CreateMesh(ID3D10Device *device, const D3D10_INPUT_ELEMENT_
*
mesh
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
ID3DX10Mesh_iface
.
lpVtbl
=
&
d3dx10_mesh_vtbl
;
...
...
dlls/d3dx10_43/sprite.c
View file @
9bc80fbf
...
...
@@ -21,7 +21,6 @@
#include "d3dx10.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
d3dx
);
...
...
@@ -79,7 +78,7 @@ static ULONG WINAPI d3dx10_sprite_Release(ID3DX10Sprite *iface)
if
(
!
refcount
)
{
ID3D10Device_Release
(
sprite
->
device
);
heap_
free
(
sprite
);
free
(
sprite
);
}
return
refcount
;
...
...
@@ -209,7 +208,7 @@ HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite
*
sprite
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
if
(
!
(
object
=
calloc
(
1
,
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
ID3DX10Sprite_iface
.
lpVtbl
=
&
d3dx10_sprite_vtbl
;
...
...
dlls/d3dx10_43/texture.c
View file @
9bc80fbf
...
...
@@ -17,7 +17,6 @@
*/
#include "wine/debug.h"
#include "wine/heap.h"
#define COBJMACROS
...
...
@@ -313,7 +312,7 @@ static HRESULT load_file(const WCHAR *filename, void **buffer, DWORD *size)
goto
done
;
}
*
buffer
=
heap_
alloc
(
*
size
);
*
buffer
=
m
alloc
(
*
size
);
if
(
!*
buffer
)
{
hr
=
E_OUTOFMEMORY
;
...
...
@@ -335,7 +334,7 @@ static HRESULT load_file(const WCHAR *filename, void **buffer, DWORD *size)
done:
if
(
FAILED
(
hr
))
{
heap_
free
(
*
buffer
);
free
(
*
buffer
);
*
buffer
=
NULL
;
}
if
(
file
!=
INVALID_HANDLE_VALUE
)
...
...
@@ -375,14 +374,14 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileA(const char *src_file, ID3DX10ThreadPu
if
(
!
str_len
)
return
HRESULT_FROM_WIN32
(
GetLastError
());
buffer
=
heap_
alloc
(
str_len
*
sizeof
(
*
buffer
));
buffer
=
m
alloc
(
str_len
*
sizeof
(
*
buffer
));
if
(
!
buffer
)
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
src_file
,
-
1
,
buffer
,
str_len
);
hr
=
D3DX10GetImageInfoFromFileW
(
buffer
,
pump
,
info
,
result
);
heap_
free
(
buffer
);
free
(
buffer
);
return
hr
;
}
...
...
@@ -404,7 +403,7 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadP
hr
=
D3DX10GetImageInfoFromMemory
(
buffer
,
size
,
pump
,
info
,
result
);
heap_
free
(
buffer
);
free
(
buffer
);
return
hr
;
}
...
...
@@ -589,13 +588,13 @@ HRESULT WINAPI D3DX10CreateTextureFromFileA(ID3D10Device *device, const char *sr
if
(
!
(
str_len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
src_file
,
-
1
,
NULL
,
0
)))
return
HRESULT_FROM_WIN32
(
GetLastError
());
if
(
!
(
buffer
=
heap_
alloc
(
str_len
*
sizeof
(
*
buffer
))))
if
(
!
(
buffer
=
m
alloc
(
str_len
*
sizeof
(
*
buffer
))))
return
E_OUTOFMEMORY
;
MultiByteToWideChar
(
CP_ACP
,
0
,
src_file
,
-
1
,
buffer
,
str_len
);
hr
=
D3DX10CreateTextureFromFileW
(
device
,
buffer
,
load_info
,
pump
,
texture
,
hresult
);
heap_
free
(
buffer
);
free
(
buffer
);
return
hr
;
}
...
...
@@ -618,7 +617,7 @@ HRESULT WINAPI D3DX10CreateTextureFromFileW(ID3D10Device *device, const WCHAR *s
hr
=
D3DX10CreateTextureFromMemory
(
device
,
buffer
,
size
,
load_info
,
pump
,
texture
,
hresult
);
heap_
free
(
buffer
);
free
(
buffer
);
return
hr
;
}
...
...
@@ -740,7 +739,7 @@ HRESULT WINAPI D3DX10CreateTextureFromMemory(ID3D10Device *device, const void *s
stride
=
(
width
*
get_bpp_from_format
(
img_info
.
Format
)
+
7
)
/
8
;
frame_size
=
stride
*
height
;
if
(
!
(
buffer
=
heap_
alloc
(
frame_size
)))
if
(
!
(
buffer
=
m
alloc
(
frame_size
)))
{
hr
=
E_FAIL
;
goto
end
;
...
...
@@ -813,7 +812,7 @@ end:
IWICFormatConverter_Release
(
converter
);
if
(
dds_frame
)
IWICDdsFrameDecode_Release
(
dds_frame
);
heap_
free
(
buffer
);
free
(
buffer
);
if
(
frame
)
IWICBitmapFrameDecode_Release
(
frame
);
if
(
decoder
)
...
...
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