Module: wine Branch: master Commit: c64aa0006e4a33d755a57a693cd81dc1ed95fa9d URL: https://gitlab.winehq.org/wine/wine/-/commit/c64aa0006e4a33d755a57a693cd81dc...
Author: Alex Henrie alexhenrie24@gmail.com Date: Wed Nov 15 23:35:52 2023 -0700
d3dcompiler_43/tests: Use CRT allocation functions.
---
dlls/d3dcompiler_43/tests/asm.c | 17 ++++++----------- dlls/d3dcompiler_43/tests/hlsl_d3d9.c | 15 +++++++-------- 2 files changed, 13 insertions(+), 19 deletions(-)
diff --git a/dlls/d3dcompiler_43/tests/asm.c b/dlls/d3dcompiler_43/tests/asm.c index 6d3e7013017..55d84213e1e 100644 --- a/dlls/d3dcompiler_43/tests/asm.c +++ b/dlls/d3dcompiler_43/tests/asm.c @@ -1460,23 +1460,20 @@ static HRESULT WINAPI testD3DInclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE i
if (!strcmp(filename, "incl.vsh")) { - buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include)); - CopyMemory(buffer, include, sizeof(include)); + buffer = strdup(include); *bytes = sizeof(include); ok(!parent_data, "Wrong parent_data value.\n"); } else if (!strcmp(filename, "incl2.vsh")) { - buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include2)); - CopyMemory(buffer, include2, sizeof(include2)); + buffer = strdup(include2); *bytes = sizeof(include2); ok(!parent_data, "Wrong parent_data value.\n"); ok(include_type == D3D_INCLUDE_LOCAL, "Wrong include type %d.\n", include_type); } else if (!strcmp(filename, "incl3.vsh")) { - buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include3)); - CopyMemory(buffer, include3, sizeof(include3)); + buffer = strdup(include3); *bytes = sizeof(include3); /* Also check for the correct parent_data content */ ok(parent_data != NULL @@ -1486,16 +1483,14 @@ static HRESULT WINAPI testD3DInclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE i } else if (!strcmp(filename, "incl4.vsh")) { - buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include4)); - CopyMemory(buffer, include4, sizeof(include4)); + buffer = strdup(include4); *bytes = sizeof(include4); ok(parent_data == NULL, "Wrong parent_data value.\n"); ok(include_type == D3D_INCLUDE_SYSTEM, "Wrong include type %d.\n", include_type); } else if (!strcmp(filename, "includes/incl.vsh")) { - buffer = HeapAlloc(GetProcessHeap(), 0, sizeof(include)); - CopyMemory(buffer, include, sizeof(include)); + buffer = strdup(include); *bytes = sizeof(include); ok(!parent_data, "Wrong parent_data value.\n"); } @@ -1512,7 +1507,7 @@ static HRESULT WINAPI testD3DInclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE i
static HRESULT WINAPI testD3DInclude_close(ID3DInclude *iface, const void *data) { - HeapFree(GetProcessHeap(), 0, (void *)data); + free((void *)data); return S_OK; }
diff --git a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c index c6e7aa367f0..eed96db7248 100644 --- a/dlls/d3dcompiler_43/tests/hlsl_d3d9.c +++ b/dlls/d3dcompiler_43/tests/hlsl_d3d9.c @@ -18,7 +18,6 @@ */ #define COBJMACROS #include "wine/test.h" -#include "wine/heap.h" #include "d3dx9.h" #include "d3dcompiler.h"
@@ -1515,26 +1514,26 @@ static HRESULT WINAPI test_d3dinclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE
if (!strcmp(filename, "include1.h")) { - buffer = heap_alloc(strlen(include1)); - CopyMemory(buffer, include1, strlen(include1)); + buffer = strdup(include1); *bytes = strlen(include1); + buffer[*bytes] = '$'; /* everything should still work without a null terminator */ ok(include_type == D3D_INCLUDE_LOCAL, "Unexpected include type %d.\n", include_type); ok(!strncmp(include2, parent_data, strlen(include2)) || !strncmp(include3, parent_data, strlen(include3)), "Unexpected parent_data value.\n"); } else if (!strcmp(filename, "include\include2.h")) { - buffer = heap_alloc(strlen(include2)); - CopyMemory(buffer, include2, strlen(include2)); + buffer = strdup(include2); *bytes = strlen(include2); + buffer[*bytes] = '$'; /* everything should still work without a null terminator */ ok(!parent_data, "Unexpected parent_data value.\n"); ok(include_type == D3D_INCLUDE_LOCAL, "Unexpected include type %d.\n", include_type); } else if (!strcmp(filename, "include\include3.h")) { - buffer = heap_alloc(strlen(include3)); - CopyMemory(buffer, include3, strlen(include3)); + buffer = strdup(include3); *bytes = strlen(include3); + buffer[*bytes] = '$'; /* everything should still work without a null terminator */ ok(!parent_data, "Unexpected parent_data value.\n"); ok(include_type == D3D_INCLUDE_LOCAL, "Unexpected include type %d.\n", include_type); } @@ -1550,7 +1549,7 @@ static HRESULT WINAPI test_d3dinclude_open(ID3DInclude *iface, D3D_INCLUDE_TYPE
static HRESULT WINAPI test_d3dinclude_close(ID3DInclude *iface, const void *data) { - heap_free((void *)data); + free((void *)data); return S_OK; }