Commit 9bc80fbf authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

d3dx10: Use CRT memory allocators.

parent acf815fd
...@@ -73,7 +73,7 @@ static HRESULT WINAPI memorydataloader_Destroy(ID3DX10DataLoader *iface) ...@@ -73,7 +73,7 @@ static HRESULT WINAPI memorydataloader_Destroy(ID3DX10DataLoader *iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
HeapFree(GetProcessHeap(), 0, loader); free(loader);
return S_OK; return S_OK;
} }
...@@ -101,7 +101,7 @@ static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface) ...@@ -101,7 +101,7 @@ static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface)
return D3D10_ERROR_FILE_NOT_FOUND; return D3D10_ERROR_FILE_NOT_FOUND;
size = GetFileSize(file, NULL); size = GetFileSize(file, NULL);
data = HeapAlloc(GetProcessHeap(), 0, size); data = malloc(size);
if (!data) if (!data)
{ {
CloseHandle(file); CloseHandle(file);
...@@ -113,11 +113,11 @@ static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface) ...@@ -113,11 +113,11 @@ static HRESULT WINAPI filedataloader_Load(ID3DX10DataLoader *iface)
if (!ret) if (!ret)
{ {
WARN("Failed to read file contents.\n"); WARN("Failed to read file contents.\n");
HeapFree(GetProcessHeap(), 0, data); free(data);
return E_FAIL; return E_FAIL;
} }
HeapFree(GetProcessHeap(), 0, loader->data); free(loader->data);
loader->data = data; loader->data = data;
loader->size = size; loader->size = size;
...@@ -145,9 +145,9 @@ static HRESULT WINAPI filedataloader_Destroy(ID3DX10DataLoader *iface) ...@@ -145,9 +145,9 @@ static HRESULT WINAPI filedataloader_Destroy(ID3DX10DataLoader *iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
HeapFree(GetProcessHeap(), 0, loader->u.file.path); free(loader->u.file.path);
HeapFree(GetProcessHeap(), 0, loader->data); free(loader->data);
HeapFree(GetProcessHeap(), 0, loader); free(loader);
return S_OK; return S_OK;
} }
...@@ -203,7 +203,7 @@ static HRESULT WINAPI resourcedataloader_Destroy(ID3DX10DataLoader *iface) ...@@ -203,7 +203,7 @@ static HRESULT WINAPI resourcedataloader_Destroy(ID3DX10DataLoader *iface)
TRACE("iface %p.\n", iface); TRACE("iface %p.\n", iface);
HeapFree(GetProcessHeap(), 0, loader); free(loader);
return S_OK; return S_OK;
} }
...@@ -266,7 +266,7 @@ HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T data_size, ...@@ -266,7 +266,7 @@ HRESULT WINAPI D3DX10CreateAsyncMemoryLoader(const void *data, SIZE_T data_size,
if (!data || !loader) if (!data || !loader)
return E_FAIL; return E_FAIL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = calloc(1, sizeof(*object));
if (!object) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -291,12 +291,12 @@ HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(const char *filename, ID3DX10DataLoa ...@@ -291,12 +291,12 @@ HRESULT WINAPI D3DX10CreateAsyncFileLoaderA(const char *filename, ID3DX10DataLoa
return E_FAIL; return E_FAIL;
len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0); 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); MultiByteToWideChar(CP_ACP, 0, filename, -1, filename_w, len);
hr = D3DX10CreateAsyncFileLoaderW(filename_w, loader); hr = D3DX10CreateAsyncFileLoaderW(filename_w, loader);
HeapFree(GetProcessHeap(), 0, filename_w); free(filename_w);
return hr; return hr;
} }
...@@ -310,15 +310,15 @@ HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(const WCHAR *filename, ID3DX10DataLo ...@@ -310,15 +310,15 @@ HRESULT WINAPI D3DX10CreateAsyncFileLoaderW(const WCHAR *filename, ID3DX10DataLo
if (!filename || !loader) if (!filename || !loader)
return E_FAIL; return E_FAIL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = calloc(1, sizeof(*object));
if (!object) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->ID3DX10DataLoader_iface.lpVtbl = &filedataloadervtbl; 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) if (!object->u.file.path)
{ {
HeapFree(GetProcessHeap(), 0, object); free(object);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
lstrcpyW(object->u.file.path, filename); lstrcpyW(object->u.file.path, filename);
...@@ -340,7 +340,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *reso ...@@ -340,7 +340,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *reso
if (!loader) if (!loader)
return E_FAIL; return E_FAIL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = calloc(1, sizeof(*object));
if (!object) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -349,7 +349,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *reso ...@@ -349,7 +349,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderA(HMODULE module, const char *reso
if (!rsrc) if (!rsrc)
{ {
WARN("Failed to find resource.\n"); WARN("Failed to find resource.\n");
HeapFree(GetProcessHeap(), 0, object); free(object);
return D3DX10_ERR_INVALID_DATA; return D3DX10_ERR_INVALID_DATA;
} }
...@@ -374,7 +374,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res ...@@ -374,7 +374,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
if (!loader) if (!loader)
return E_FAIL; return E_FAIL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); object = calloc(1, sizeof(*object));
if (!object) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -383,7 +383,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res ...@@ -383,7 +383,7 @@ HRESULT WINAPI D3DX10CreateAsyncResourceLoaderW(HMODULE module, const WCHAR *res
if (!rsrc) if (!rsrc)
{ {
WARN("Failed to find resource.\n"); WARN("Failed to find resource.\n");
HeapFree(GetProcessHeap(), 0, object); free(object);
return D3DX10_ERR_INVALID_DATA; return D3DX10_ERR_INVALID_DATA;
} }
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
*/ */
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#define COBJMACROS #define COBJMACROS
...@@ -113,13 +112,13 @@ HRESULT WINAPI D3DX10CreateEffectFromFileA(const char *filename, const D3D10_SHA ...@@ -113,13 +112,13 @@ HRESULT WINAPI D3DX10CreateEffectFromFileA(const char *filename, const D3D10_SHA
return E_INVALIDARG; return E_INVALIDARG;
len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0); len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
if (!(filenameW = heap_alloc(len * sizeof(*filenameW)))) if (!(filenameW = malloc(len * sizeof(*filenameW))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, len); MultiByteToWideChar(CP_ACP, 0, filename, -1, filenameW, len);
hr = D3DX10CreateEffectFromFileW(filenameW, defines, include, profile, shader_flags, hr = D3DX10CreateEffectFromFileW(filenameW, defines, include, profile, shader_flags,
effect_flags, device, effect_pool, pump, effect, errors, hresult); effect_flags, device, effect_pool, pump, effect, errors, hresult);
heap_free(filenameW); free(filenameW);
return hr; return hr;
} }
...@@ -198,13 +197,13 @@ HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE module, const WCHAR *reso ...@@ -198,13 +197,13 @@ HRESULT WINAPI D3DX10CreateEffectFromResourceW(HMODULE module, const WCHAR *reso
if (filenameW) if (filenameW)
{ {
len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte(CP_ACP, 0, filenameW, -1, NULL, 0, NULL, NULL);
if (!(filename = heap_alloc(len))) if (!(filename = malloc(len)))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, filenameW, -1, filename, len, NULL, NULL);
} }
hr = D3DX10CreateEffectFromMemory(data, size, filename, defines, include, profile, hr = D3DX10CreateEffectFromMemory(data, size, filename, defines, include, profile,
shader_flags, effect_flags, device, effect_pool, pump, effect, errors, hresult); shader_flags, effect_flags, device, effect_pool, pump, effect, errors, hresult);
heap_free(filename); free(filename);
return hr; return hr;
} }
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "d3dx10.h" #include "d3dx10.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dx); WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
...@@ -82,7 +81,7 @@ static ULONG WINAPI d3dx_font_Release(ID3DX10Font *iface) ...@@ -82,7 +81,7 @@ static ULONG WINAPI d3dx_font_Release(ID3DX10Font *iface)
DeleteObject(font->hfont); DeleteObject(font->hfont);
DeleteDC(font->hdc); DeleteDC(font->hdc);
ID3D10Device_Release(font->device); ID3D10Device_Release(font->device);
heap_free(font); free(font);
} }
return refcount; return refcount;
} }
...@@ -179,14 +178,14 @@ static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first ...@@ -179,14 +178,14 @@ static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first
return S_OK; return S_OK;
count = last - first + 1; count = last - first + 1;
indices = heap_alloc(count * sizeof(*indices)); indices = malloc(count * sizeof(*indices));
if (!indices) if (!indices)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
chars = heap_alloc(count * sizeof(*chars)); chars = malloc(count * sizeof(*chars));
if (!chars) if (!chars)
{ {
heap_free(indices); free(indices);
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
...@@ -208,8 +207,8 @@ static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first ...@@ -208,8 +207,8 @@ static HRESULT WINAPI d3dx_font_PreloadCharacters(ID3DX10Font *iface, UINT first
} }
ID3DX10Font_PreloadGlyphs(iface, start, end); ID3DX10Font_PreloadGlyphs(iface, start, end);
heap_free(chars); free(chars);
heap_free(indices); free(indices);
return S_OK; return S_OK;
} }
...@@ -237,14 +236,14 @@ static HRESULT WINAPI d3dx_font_PreloadTextA(ID3DX10Font *iface, const char *str ...@@ -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); countW = MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, NULL, 0);
if (!(wstr = heap_alloc(countW * sizeof(*wstr)))) if (!(wstr = malloc(countW * sizeof(*wstr))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW); MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW);
hr = ID3DX10Font_PreloadTextW(iface, wstr, count < 0 ? countW - 1 : countW); hr = ID3DX10Font_PreloadTextW(iface, wstr, count < 0 ? countW - 1 : countW);
heap_free(wstr); free(wstr);
return hr; return hr;
} }
...@@ -266,7 +265,7 @@ static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *st ...@@ -266,7 +265,7 @@ static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *st
if (count < 0) if (count < 0)
count = lstrlenW(string); count = lstrlenW(string);
indices = heap_alloc(count * sizeof(*indices)); indices = malloc(count * sizeof(*indices));
if (!indices) if (!indices)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
...@@ -275,7 +274,7 @@ static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *st ...@@ -275,7 +274,7 @@ static HRESULT WINAPI d3dx_font_PreloadTextW(ID3DX10Font *iface, const WCHAR *st
for (i = 0; i < count; ++i) for (i = 0; i < count; ++i)
ID3DX10Font_PreloadGlyphs(iface, indices[i], indices[i]); ID3DX10Font_PreloadGlyphs(iface, indices[i], indices[i]);
heap_free(indices); free(indices);
return S_OK; return S_OK;
} }
...@@ -296,7 +295,7 @@ static INT WINAPI d3dx_font_DrawTextA(ID3DX10Font *iface, ID3DX10Sprite *sprite, ...@@ -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))) if (!(countW = MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, NULL, 0)))
return 0; return 0;
if (!(wstr = heap_alloc_zero(countW * sizeof(*wstr)))) if (!(wstr = calloc(countW, sizeof(*wstr))))
return 0; return 0;
MultiByteToWideChar(CP_ACP, 0, string, count < 0 ? -1 : count, wstr, countW); 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, ...@@ -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, ret = ID3DX10Font_DrawTextW(iface, sprite, wstr, count < 0 ? countW - 1 : countW,
rect, format, color); rect, format, color);
heap_free(wstr); free(wstr);
return ret; return ret;
} }
...@@ -430,13 +429,13 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT ...@@ -430,13 +429,13 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT
*font = NULL; *font = NULL;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->hdc = CreateCompatibleDC(NULL); object->hdc = CreateCompatibleDC(NULL);
if (!object->hdc) if (!object->hdc)
{ {
heap_free(object); free(object);
return E_FAIL; return E_FAIL;
} }
...@@ -445,7 +444,7 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT ...@@ -445,7 +444,7 @@ HRESULT WINAPI D3DX10CreateFontIndirectW(ID3D10Device *device, const D3DX10_FONT
if (!object->hfont) if (!object->hfont)
{ {
DeleteDC(object->hdc); DeleteDC(object->hdc);
heap_free(object); free(object);
return E_FAIL; return E_FAIL;
} }
SelectObject(object->hdc, object->hfont); SelectObject(object->hdc, object->hfont);
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "d3dx10.h" #include "d3dx10.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dx); WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
...@@ -72,7 +71,7 @@ static ULONG STDMETHODCALLTYPE d3dx10_mesh_Release(ID3DX10Mesh *iface) ...@@ -72,7 +71,7 @@ static ULONG STDMETHODCALLTYPE d3dx10_mesh_Release(ID3DX10Mesh *iface)
TRACE("%p decreasing refcount to %lu.\n", iface, refcount); TRACE("%p decreasing refcount to %lu.\n", iface, refcount);
if (!refcount) if (!refcount)
heap_free(mesh); free(mesh);
return refcount; return refcount;
} }
...@@ -366,7 +365,7 @@ HRESULT WINAPI D3DX10CreateMesh(ID3D10Device *device, const D3D10_INPUT_ELEMENT_ ...@@ -366,7 +365,7 @@ HRESULT WINAPI D3DX10CreateMesh(ID3D10Device *device, const D3D10_INPUT_ELEMENT_
*mesh = NULL; *mesh = NULL;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->ID3DX10Mesh_iface.lpVtbl = &d3dx10_mesh_vtbl; object->ID3DX10Mesh_iface.lpVtbl = &d3dx10_mesh_vtbl;
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "d3dx10.h" #include "d3dx10.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3dx); WINE_DEFAULT_DEBUG_CHANNEL(d3dx);
...@@ -79,7 +78,7 @@ static ULONG WINAPI d3dx10_sprite_Release(ID3DX10Sprite *iface) ...@@ -79,7 +78,7 @@ static ULONG WINAPI d3dx10_sprite_Release(ID3DX10Sprite *iface)
if (!refcount) if (!refcount)
{ {
ID3D10Device_Release(sprite->device); ID3D10Device_Release(sprite->device);
heap_free(sprite); free(sprite);
} }
return refcount; return refcount;
...@@ -209,7 +208,7 @@ HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite ...@@ -209,7 +208,7 @@ HRESULT WINAPI D3DX10CreateSprite(ID3D10Device *device, UINT size, ID3DX10Sprite
*sprite = NULL; *sprite = NULL;
if (!(object = heap_alloc_zero(sizeof(*object)))) if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
object->ID3DX10Sprite_iface.lpVtbl = &d3dx10_sprite_vtbl; object->ID3DX10Sprite_iface.lpVtbl = &d3dx10_sprite_vtbl;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
*/ */
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/heap.h"
#define COBJMACROS #define COBJMACROS
...@@ -313,7 +312,7 @@ static HRESULT load_file(const WCHAR *filename, void **buffer, DWORD *size) ...@@ -313,7 +312,7 @@ static HRESULT load_file(const WCHAR *filename, void **buffer, DWORD *size)
goto done; goto done;
} }
*buffer = heap_alloc(*size); *buffer = malloc(*size);
if (!*buffer) if (!*buffer)
{ {
hr = E_OUTOFMEMORY; hr = E_OUTOFMEMORY;
...@@ -335,7 +334,7 @@ static HRESULT load_file(const WCHAR *filename, void **buffer, DWORD *size) ...@@ -335,7 +334,7 @@ static HRESULT load_file(const WCHAR *filename, void **buffer, DWORD *size)
done: done:
if (FAILED(hr)) if (FAILED(hr))
{ {
heap_free(*buffer); free(*buffer);
*buffer = NULL; *buffer = NULL;
} }
if (file != INVALID_HANDLE_VALUE) if (file != INVALID_HANDLE_VALUE)
...@@ -375,14 +374,14 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileA(const char *src_file, ID3DX10ThreadPu ...@@ -375,14 +374,14 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileA(const char *src_file, ID3DX10ThreadPu
if (!str_len) if (!str_len)
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
buffer = heap_alloc(str_len * sizeof(*buffer)); buffer = malloc(str_len * sizeof(*buffer));
if (!buffer) if (!buffer)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, str_len); MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, str_len);
hr = D3DX10GetImageInfoFromFileW(buffer, pump, info, result); hr = D3DX10GetImageInfoFromFileW(buffer, pump, info, result);
heap_free(buffer); free(buffer);
return hr; return hr;
} }
...@@ -404,7 +403,7 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadP ...@@ -404,7 +403,7 @@ HRESULT WINAPI D3DX10GetImageInfoFromFileW(const WCHAR *src_file, ID3DX10ThreadP
hr = D3DX10GetImageInfoFromMemory(buffer, size, pump, info, result); hr = D3DX10GetImageInfoFromMemory(buffer, size, pump, info, result);
heap_free(buffer); free(buffer);
return hr; return hr;
} }
...@@ -589,13 +588,13 @@ HRESULT WINAPI D3DX10CreateTextureFromFileA(ID3D10Device *device, const char *sr ...@@ -589,13 +588,13 @@ HRESULT WINAPI D3DX10CreateTextureFromFileA(ID3D10Device *device, const char *sr
if (!(str_len = MultiByteToWideChar(CP_ACP, 0, src_file, -1, NULL, 0))) if (!(str_len = MultiByteToWideChar(CP_ACP, 0, src_file, -1, NULL, 0)))
return HRESULT_FROM_WIN32(GetLastError()); return HRESULT_FROM_WIN32(GetLastError());
if (!(buffer = heap_alloc(str_len * sizeof(*buffer)))) if (!(buffer = malloc(str_len * sizeof(*buffer))))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, str_len); MultiByteToWideChar(CP_ACP, 0, src_file, -1, buffer, str_len);
hr = D3DX10CreateTextureFromFileW(device, buffer, load_info, pump, texture, hresult); hr = D3DX10CreateTextureFromFileW(device, buffer, load_info, pump, texture, hresult);
heap_free(buffer); free(buffer);
return hr; return hr;
} }
...@@ -618,7 +617,7 @@ HRESULT WINAPI D3DX10CreateTextureFromFileW(ID3D10Device *device, const WCHAR *s ...@@ -618,7 +617,7 @@ HRESULT WINAPI D3DX10CreateTextureFromFileW(ID3D10Device *device, const WCHAR *s
hr = D3DX10CreateTextureFromMemory(device, buffer, size, load_info, pump, texture, hresult); hr = D3DX10CreateTextureFromMemory(device, buffer, size, load_info, pump, texture, hresult);
heap_free(buffer); free(buffer);
return hr; return hr;
} }
...@@ -740,7 +739,7 @@ HRESULT WINAPI D3DX10CreateTextureFromMemory(ID3D10Device *device, const void *s ...@@ -740,7 +739,7 @@ HRESULT WINAPI D3DX10CreateTextureFromMemory(ID3D10Device *device, const void *s
stride = (width * get_bpp_from_format(img_info.Format) + 7) / 8; stride = (width * get_bpp_from_format(img_info.Format) + 7) / 8;
frame_size = stride * height; frame_size = stride * height;
if (!(buffer = heap_alloc(frame_size))) if (!(buffer = malloc(frame_size)))
{ {
hr = E_FAIL; hr = E_FAIL;
goto end; goto end;
...@@ -813,7 +812,7 @@ end: ...@@ -813,7 +812,7 @@ end:
IWICFormatConverter_Release(converter); IWICFormatConverter_Release(converter);
if (dds_frame) if (dds_frame)
IWICDdsFrameDecode_Release(dds_frame); IWICDdsFrameDecode_Release(dds_frame);
heap_free(buffer); free(buffer);
if (frame) if (frame)
IWICBitmapFrameDecode_Release(frame); IWICBitmapFrameDecode_Release(frame);
if (decoder) if (decoder)
......
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