From: Alex Henrie alexhenrie24@gmail.com
--- dlls/ddraw/tests/ddraw1.c | 44 ++++++++++++++--------------- dlls/ddraw/tests/ddraw2.c | 44 ++++++++++++++--------------- dlls/ddraw/tests/ddraw4.c | 53 +++++++++++++++++------------------ dlls/ddraw/tests/ddraw7.c | 53 +++++++++++++++++------------------ dlls/ddraw/tests/ddrawmodes.c | 10 +++---- 5 files changed, 97 insertions(+), 107 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index f5fc7b04053..453425ac2f9 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -21,7 +21,6 @@ #define COBJMACROS
#include "wine/test.h" -#include "wine/heap.h" #include <limits.h> #include <math.h> #include "ddrawi.h" @@ -275,7 +274,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ DISPLAY_DEVICEW display_device; DEVMODEW *modes, *tmp;
- if (!(modes = heap_alloc(size * sizeof(*modes)))) + if (!(modes = malloc(size * sizeof(*modes)))) return FALSE;
display_device.cb = sizeof(display_device); @@ -291,9 +290,9 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ if (count >= size) { size *= 2; - if (!(tmp = heap_realloc(modes, size * sizeof(*modes)))) + if (!(tmp = realloc(modes, size * sizeof(*modes)))) { - heap_free(modes); + free(modes); return FALSE; } modes = tmp; @@ -303,7 +302,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ modes[count].dmSize = sizeof(modes[count]); if (!EnumDisplaySettingsW(display_device.DeviceName, ENUM_CURRENT_SETTINGS, &modes[count])) { - heap_free(modes); + free(modes); return FALSE; }
@@ -1071,7 +1070,7 @@ static void test_clipper_blt(void) ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr); hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret); ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#lx.\n", hr); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); hr = IDirectDrawClipper_GetClipList(clipper, NULL, rgn_data, &ret); ok(SUCCEEDED(hr), "Failed to get clip list, hr %#lx.\n", hr); ok(rgn_data->rdh.dwSize == sizeof(rgn_data->rdh), "Got unexpected structure size %#lx.\n", rgn_data->rdh.dwSize); @@ -1080,7 +1079,7 @@ static void test_clipper_blt(void) ok(EqualRect(&rgn_data->rdh.rcBound, &client_rect), "Got unexpected bounding rect %s, expected %s.\n", wine_dbgstr_rect(&rgn_data->rdh.rcBound), wine_dbgstr_rect(&client_rect)); - HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
r1 = CreateRectRgn(0, 0, 320, 240); ok(!!r1, "Failed to create region.\n"); @@ -1088,7 +1087,7 @@ static void test_clipper_blt(void) ok(!!r2, "Failed to create region.\n"); CombineRgn(r1, r1, r2, RGN_OR); ret = GetRegionData(r1, 0, NULL); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); ret = GetRegionData(r1, ret, rgn_data); ok(!!ret, "Failed to get region data.\n");
@@ -1102,7 +1101,7 @@ static void test_clipper_blt(void) hr = IDirectDrawClipper_SetClipList(clipper, rgn_data, 0); ok(SUCCEEDED(hr), "Failed to set clip list, hr %#lx.\n", hr);
- HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -3000,7 +2999,7 @@ static void test_coop_level_mode_set(void) if (!param.user32_height) { skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); - heap_free(original_modes); + free(original_modes); return; }
@@ -3698,7 +3697,7 @@ done: UnregisterClassA("ddraw_test_wndproc_wc", GetModuleHandleA(NULL)); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_coop_level_mode_set_multi(void) @@ -4109,7 +4108,7 @@ done: DestroyWindow(window); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_initialize(void) @@ -6157,7 +6156,7 @@ static void test_create_surface_pitch(void) hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#lx.\n", hr);
- mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((63 * 4) + 8) * 63); + mem = calloc((63 * 4) + 8, 63);
/* We need a primary surface and exclusive mode for video memory accounting to work * right on Windows. Otherwise it gives us junk data, like creating a video memory @@ -6253,7 +6252,7 @@ static void test_create_surface_pitch(void) caps1.dwVidMemFree, caps2.dwVidMemFree, i); }
- HeapFree(GetProcessHeap(), 0, mem); + free(mem); refcount = IDirectDraw_Release(ddraw); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); DestroyWindow(window); @@ -7355,8 +7354,8 @@ static void test_specular_lighting(void) } is_warp = ddraw_is_warp(ddraw);
- quad = heap_alloc(vertex_count * sizeof(*quad)); - indices = heap_alloc(indices_count * sizeof(*indices)); + quad = malloc(vertex_count * sizeof(*quad)); + indices = malloc(indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) { for (x = 0; x < vertices_side; ++x) @@ -7500,8 +7499,8 @@ static void test_specular_lighting(void) refcount = IDirectDraw_Release(ddraw); ok(!refcount, "Ddraw object has %lu references left.\n", refcount); DestroyWindow(window); - heap_free(indices); - heap_free(quad); + free(indices); + free(quad); }
static void test_palette_gdi(void) @@ -9076,8 +9075,7 @@ static void test_color_fill(void)
hr = IDirectDraw_GetFourCCCodes(ddraw, &num_fourcc_codes, NULL); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); - fourcc_codes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - num_fourcc_codes * sizeof(*fourcc_codes)); + fourcc_codes = calloc(num_fourcc_codes, sizeof(*fourcc_codes)); if (!fourcc_codes) goto done; hr = IDirectDraw_GetFourCCCodes(ddraw, &num_fourcc_codes, fourcc_codes); @@ -9089,7 +9087,7 @@ static void test_color_fill(void) else if (fourcc_codes[i] == MAKEFOURCC('U', 'Y', 'V', 'Y')) support_uyvy = TRUE; } - HeapFree(GetProcessHeap(), 0, fourcc_codes); + free(fourcc_codes);
memset(&hal_caps, 0, sizeof(hal_caps)); hal_caps.dwSize = sizeof(hal_caps); @@ -14053,7 +14051,7 @@ static void test_clipper_refcount(void)
/* It looks like the protection against invalid thispointers is part of * the IDirectDrawClipper method implementation, not IDirectDrawSurface. */ - clipper = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0x1000); + clipper = calloc(1, 0x1000); ok(!!clipper, "failed to allocate memory\n");
/* Assigning the vtable to our fake clipper does NOT make a difference on @@ -14080,7 +14078,7 @@ static void test_clipper_refcount(void) hr = orig_vtbl->Initialize(clipper, ddraw, 0); todo_wine ok(hr == DDERR_INVALIDPARAMS, "Got unexpected hr %#lx.\n", hr);
- HeapFree(GetProcessHeap(), 0, clipper); + free(clipper);
refcount = IDirectDraw_Release(ddraw); ok(!refcount, "%lu references left.\n", refcount); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 1e33e7c7779..22a4033500c 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -22,7 +22,6 @@
#define COBJMACROS #include "wine/test.h" -#include "wine/heap.h" #include <limits.h> #include <math.h> #include "ddrawi.h" @@ -276,7 +275,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ DISPLAY_DEVICEW display_device; DEVMODEW *modes, *tmp;
- if (!(modes = heap_alloc(size * sizeof(*modes)))) + if (!(modes = malloc(size * sizeof(*modes)))) return FALSE;
display_device.cb = sizeof(display_device); @@ -292,9 +291,9 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ if (count >= size) { size *= 2; - if (!(tmp = heap_realloc(modes, size * sizeof(*modes)))) + if (!(tmp = realloc(modes, size * sizeof(*modes)))) { - heap_free(modes); + free(modes); return FALSE; } modes = tmp; @@ -304,7 +303,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ modes[count].dmSize = sizeof(modes[count]); if (!EnumDisplaySettingsW(display_device.DeviceName, ENUM_CURRENT_SETTINGS, &modes[count])) { - heap_free(modes); + free(modes); return FALSE; }
@@ -914,7 +913,7 @@ static void test_clipper_blt(void) ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr); hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret); ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#lx.\n", hr); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); hr = IDirectDrawClipper_GetClipList(clipper, NULL, rgn_data, &ret); ok(SUCCEEDED(hr), "Failed to get clip list, hr %#lx.\n", hr); ok(rgn_data->rdh.dwSize == sizeof(rgn_data->rdh), "Got unexpected structure size %#lx.\n", rgn_data->rdh.dwSize); @@ -923,7 +922,7 @@ static void test_clipper_blt(void) ok(EqualRect(&rgn_data->rdh.rcBound, &client_rect), "Got unexpected bounding rect %s, expected %s.\n", wine_dbgstr_rect(&rgn_data->rdh.rcBound), wine_dbgstr_rect(&client_rect)); - HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
r1 = CreateRectRgn(0, 0, 320, 240); ok(!!r1, "Failed to create region.\n"); @@ -931,7 +930,7 @@ static void test_clipper_blt(void) ok(!!r2, "Failed to create region.\n"); CombineRgn(r1, r1, r2, RGN_OR); ret = GetRegionData(r1, 0, NULL); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); ret = GetRegionData(r1, ret, rgn_data); ok(!!ret, "Failed to get region data.\n");
@@ -945,7 +944,7 @@ static void test_clipper_blt(void) hr = IDirectDrawClipper_SetClipList(clipper, rgn_data, 0); ok(SUCCEEDED(hr), "Failed to set clip list, hr %#lx.\n", hr);
- HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -3097,7 +3096,7 @@ static void test_coop_level_mode_set(void) if (!param.user32_height) { skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); - heap_free(original_modes); + free(original_modes); return; }
@@ -3890,7 +3889,7 @@ done: UnregisterClassA("ddraw_test_wndproc_wc2", GetModuleHandleA(NULL)); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_coop_level_mode_set_multi(void) @@ -4301,7 +4300,7 @@ done: DestroyWindow(window); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_initialize(void) @@ -7283,7 +7282,7 @@ static void test_create_surface_pitch(void) hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#lx.\n", hr);
- mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((63 * 4) + 8) * 63); + mem = calloc((63 * 4) + 8, 63);
/* We need a primary surface and exclusive mode for video memory accounting to work * right on Windows. Otherwise it gives us junk data, like creating a video memory @@ -7381,7 +7380,7 @@ static void test_create_surface_pitch(void) }
IDirectDrawSurface_Release(primary); - HeapFree(GetProcessHeap(), 0, mem); + free(mem); refcount = IDirectDraw2_Release(ddraw); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); DestroyWindow(window); @@ -8406,8 +8405,8 @@ static void test_specular_lighting(void) return; }
- quad = HeapAlloc(GetProcessHeap(), 0, vertices_side * vertices_side * sizeof(*quad)); - indices = HeapAlloc(GetProcessHeap(), 0, indices_count * sizeof(*indices)); + quad = malloc(vertices_side * vertices_side * sizeof(*quad)); + indices = malloc(indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) { for (x = 0; x < vertices_side; ++x) @@ -8516,8 +8515,8 @@ static void test_specular_lighting(void) refcount = IDirectDraw2_Release(ddraw); ok(!refcount, "Ddraw object has %lu references left.\n", refcount); DestroyWindow(window); - HeapFree(GetProcessHeap(), 0, indices); - HeapFree(GetProcessHeap(), 0, quad); + free(indices); + free(quad); }
static void test_palette_gdi(void) @@ -9982,8 +9981,7 @@ static void test_color_fill(void)
hr = IDirectDraw2_GetFourCCCodes(ddraw, &num_fourcc_codes, NULL); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); - fourcc_codes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - num_fourcc_codes * sizeof(*fourcc_codes)); + fourcc_codes = calloc(num_fourcc_codes, sizeof(*fourcc_codes)); if (!fourcc_codes) goto done; hr = IDirectDraw2_GetFourCCCodes(ddraw, &num_fourcc_codes, fourcc_codes); @@ -9995,7 +9993,7 @@ static void test_color_fill(void) else if (fourcc_codes[i] == MAKEFOURCC('U', 'Y', 'V', 'Y')) support_uyvy = TRUE; } - HeapFree(GetProcessHeap(), 0, fourcc_codes); + free(fourcc_codes);
memset(&hal_caps, 0, sizeof(hal_caps)); hal_caps.dwSize = sizeof(hal_caps); @@ -15044,7 +15042,7 @@ static void test_clipper_refcount(void)
/* It looks like the protection against invalid thispointers is part of * the IDirectDrawClipper method implementation, not IDirectDrawSurface. */ - clipper = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0x1000); + clipper = calloc(1, 0x1000); ok(!!clipper, "failed to allocate memory\n");
/* Assigning the vtable to our fake clipper does NOT make a difference on @@ -15076,7 +15074,7 @@ static void test_clipper_refcount(void)
IDirectDraw_Release(ddraw1);
- HeapFree(GetProcessHeap(), 0, clipper); + free(clipper);
refcount = IDirectDraw2_Release(ddraw); ok(!refcount, "%lu references left.\n", refcount); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 379ba245571..3e951480bbe 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -21,7 +21,6 @@ #define COBJMACROS
#include "wine/test.h" -#include "wine/heap.h" #include <limits.h> #include <math.h> #include "ddrawi.h" @@ -278,7 +277,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ DISPLAY_DEVICEW display_device; DEVMODEW *modes, *tmp;
- if (!(modes = heap_alloc(size * sizeof(*modes)))) + if (!(modes = malloc(size * sizeof(*modes)))) return FALSE;
display_device.cb = sizeof(display_device); @@ -294,9 +293,9 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ if (count >= size) { size *= 2; - if (!(tmp = heap_realloc(modes, size * sizeof(*modes)))) + if (!(tmp = realloc(modes, size * sizeof(*modes)))) { - heap_free(modes); + free(modes); return FALSE; } modes = tmp; @@ -306,7 +305,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ modes[count].dmSize = sizeof(modes[count]); if (!EnumDisplaySettingsW(display_device.DeviceName, ENUM_CURRENT_SETTINGS, &modes[count])) { - heap_free(modes); + free(modes); return FALSE; }
@@ -1104,7 +1103,7 @@ static void test_clipper_blt(void) ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr); hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret); ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#lx.\n", hr); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); hr = IDirectDrawClipper_GetClipList(clipper, NULL, rgn_data, &ret); ok(SUCCEEDED(hr), "Failed to get clip list, hr %#lx.\n", hr); ok(rgn_data->rdh.dwSize == sizeof(rgn_data->rdh), "Got unexpected structure size %#lx.\n", rgn_data->rdh.dwSize); @@ -1113,7 +1112,7 @@ static void test_clipper_blt(void) ok(EqualRect(&rgn_data->rdh.rcBound, &client_rect), "Got unexpected bounding rect %s, expected %s.\n", wine_dbgstr_rect(&rgn_data->rdh.rcBound), wine_dbgstr_rect(&client_rect)); - HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
r1 = CreateRectRgn(0, 0, 320, 240); ok(!!r1, "Failed to create region.\n"); @@ -1121,7 +1120,7 @@ static void test_clipper_blt(void) ok(!!r2, "Failed to create region.\n"); CombineRgn(r1, r1, r2, RGN_OR); ret = GetRegionData(r1, 0, NULL); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); ret = GetRegionData(r1, ret, rgn_data); ok(!!ret, "Failed to get region data.\n");
@@ -1135,7 +1134,7 @@ static void test_clipper_blt(void) hr = IDirectDrawClipper_SetClipList(clipper, rgn_data, 0); ok(SUCCEEDED(hr), "Failed to set clip list, hr %#lx.\n", hr);
- HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -3335,7 +3334,7 @@ static void test_coop_level_mode_set(void) if (!param.user32_height) { skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); - heap_free(original_modes); + free(original_modes); return; }
@@ -4123,7 +4122,7 @@ static void test_coop_level_mode_set(void) UnregisterClassA("ddraw_test_wndproc_wc2", GetModuleHandleA(NULL)); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_coop_level_mode_set_multi(void) @@ -4527,7 +4526,7 @@ done: DestroyWindow(window); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_initialize(void) @@ -5373,8 +5372,8 @@ static void test_specular_lighting(void) return; }
- quad = heap_alloc(vertices_side * vertices_side * sizeof(*quad)); - indices = heap_alloc(indices_count * sizeof(*indices)); + quad = malloc(vertices_side * vertices_side * sizeof(*quad)); + indices = malloc(indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) { for (x = 0; x < vertices_side; ++x) @@ -5538,8 +5537,8 @@ static void test_specular_lighting(void) ok(!refcount, "Device has %lu references left.\n", refcount); IDirect3D3_Release(d3d); DestroyWindow(window); - heap_free(indices); - heap_free(quad); + free(indices); + free(quad); }
static void test_clear_rect_count(void) @@ -6312,8 +6311,7 @@ static void test_block_formats_creation(void)
hr = IDirectDraw4_GetFourCCCodes(ddraw, &num_fourcc_codes, NULL); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); - fourcc_codes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - num_fourcc_codes * sizeof(*fourcc_codes)); + fourcc_codes = calloc(num_fourcc_codes, sizeof(*fourcc_codes)); if (!fourcc_codes) goto cleanup; hr = IDirectDraw4_GetFourCCCodes(ddraw, &num_fourcc_codes, fourcc_codes); @@ -6326,14 +6324,14 @@ static void test_block_formats_creation(void) supported_overlay_fmts |= formats[j].support_flag; } } - HeapFree(GetProcessHeap(), 0, fourcc_codes); + free(fourcc_codes);
memset(&hal_caps, 0, sizeof(hal_caps)); hal_caps.dwSize = sizeof(hal_caps); hr = IDirectDraw4_GetCaps(ddraw, &hal_caps, NULL); ok(SUCCEEDED(hr), "Failed to get caps, hr %#lx.\n", hr);
- mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 2 * 2 * 16 + 1); + mem = calloc(1, 2 * 2 * 16 + 1);
for (i = 0; i < ARRAY_SIZE(formats); i++) { @@ -6454,7 +6452,7 @@ static void test_block_formats_creation(void) } }
- HeapFree(GetProcessHeap(), 0, mem); + free(mem); cleanup: IDirectDraw4_Release(ddraw); IDirect3DDevice3_Release(device); @@ -9185,7 +9183,7 @@ static void test_create_surface_pitch(void) hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#lx.\n", hr);
- mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((63 * 4) + 8) * 63); + mem = calloc((63 * 4) + 8, 63);
/* We need a primary surface and exclusive mode for video memory accounting to work * right on Windows. Otherwise it gives us junk data, like creating a video memory @@ -9283,7 +9281,7 @@ static void test_create_surface_pitch(void) }
IDirectDrawSurface4_Release(primary); - HeapFree(GetProcessHeap(), 0, mem); + free(mem); refcount = IDirectDraw4_Release(ddraw); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); DestroyWindow(window); @@ -11726,8 +11724,7 @@ static void test_color_fill(void)
hr = IDirectDraw4_GetFourCCCodes(ddraw, &num_fourcc_codes, NULL); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); - fourcc_codes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - num_fourcc_codes * sizeof(*fourcc_codes)); + fourcc_codes = calloc(num_fourcc_codes, sizeof(*fourcc_codes)); if (!fourcc_codes) goto done; hr = IDirectDraw4_GetFourCCCodes(ddraw, &num_fourcc_codes, fourcc_codes); @@ -11739,7 +11736,7 @@ static void test_color_fill(void) else if (fourcc_codes[i] == MAKEFOURCC('U', 'Y', 'V', 'Y')) supported_fmts |= SUPPORT_UYVY; } - HeapFree(GetProcessHeap(), 0, fourcc_codes); + free(fourcc_codes);
memset(&hal_caps, 0, sizeof(hal_caps)); hal_caps.dwSize = sizeof(hal_caps); @@ -17782,7 +17779,7 @@ static void test_clipper_refcount(void)
/* It looks like the protection against invalid thispointers is part of * the IDirectDrawClipper method implementation, not IDirectDrawSurface. */ - clipper = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0x1000); + clipper = calloc(1, 0x1000); ok(!!clipper, "failed to allocate memory\n");
/* Assigning the vtable to our fake clipper does NOT make a difference on @@ -17814,7 +17811,7 @@ static void test_clipper_refcount(void)
IDirectDraw_Release(ddraw1);
- HeapFree(GetProcessHeap(), 0, clipper); + free(clipper);
refcount = IDirectDraw4_Release(ddraw); ok(!refcount, "%lu references left.\n", refcount); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 779c8c982cf..91da029cc42 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -22,7 +22,6 @@
#include <stdbool.h> #include "wine/test.h" -#include "wine/heap.h" #include <limits.h> #include <math.h> #include "d3d.h" @@ -320,7 +319,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ DISPLAY_DEVICEW display_device; DEVMODEW *modes, *tmp;
- if (!(modes = heap_alloc(size * sizeof(*modes)))) + if (!(modes = malloc(size * sizeof(*modes)))) return FALSE;
display_device.cb = sizeof(display_device); @@ -336,9 +335,9 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ if (count >= size) { size *= 2; - if (!(tmp = heap_realloc(modes, size * sizeof(*modes)))) + if (!(tmp = realloc(modes, size * sizeof(*modes)))) { - heap_free(modes); + free(modes); return FALSE; } modes = tmp; @@ -348,7 +347,7 @@ static BOOL save_display_modes(DEVMODEW **original_modes, unsigned int *display_ modes[count].dmSize = sizeof(modes[count]); if (!EnumDisplaySettingsW(display_device.DeviceName, ENUM_CURRENT_SETTINGS, &modes[count])) { - heap_free(modes); + free(modes); return FALSE; }
@@ -1136,7 +1135,7 @@ static void test_clipper_blt(void) ok(SUCCEEDED(hr), "Failed to set clipper window, hr %#lx.\n", hr); hr = IDirectDrawClipper_GetClipList(clipper, NULL, NULL, &ret); ok(SUCCEEDED(hr), "Failed to get clip list size, hr %#lx.\n", hr); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); hr = IDirectDrawClipper_GetClipList(clipper, NULL, rgn_data, &ret); ok(SUCCEEDED(hr), "Failed to get clip list, hr %#lx.\n", hr); ok(rgn_data->rdh.dwSize == sizeof(rgn_data->rdh), "Got unexpected structure size %#lx.\n", rgn_data->rdh.dwSize); @@ -1145,7 +1144,7 @@ static void test_clipper_blt(void) ok(EqualRect(&rgn_data->rdh.rcBound, &client_rect), "Got unexpected bounding rect %s, expected %s.\n", wine_dbgstr_rect(&rgn_data->rdh.rcBound), wine_dbgstr_rect(&client_rect)); - HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
r1 = CreateRectRgn(0, 0, 320, 240); ok(!!r1, "Failed to create region.\n"); @@ -1153,7 +1152,7 @@ static void test_clipper_blt(void) ok(!!r2, "Failed to create region.\n"); CombineRgn(r1, r1, r2, RGN_OR); ret = GetRegionData(r1, 0, NULL); - rgn_data = HeapAlloc(GetProcessHeap(), 0, ret); + rgn_data = malloc(ret); ret = GetRegionData(r1, ret, rgn_data); ok(!!ret, "Failed to get region data.\n");
@@ -1167,7 +1166,7 @@ static void test_clipper_blt(void) hr = IDirectDrawClipper_SetClipList(clipper, rgn_data, 0); ok(SUCCEEDED(hr), "Failed to set clip list, hr %#lx.\n", hr);
- HeapFree(GetProcessHeap(), 0, rgn_data); + free(rgn_data);
memset(&surface_desc, 0, sizeof(surface_desc)); surface_desc.dwSize = sizeof(surface_desc); @@ -3053,7 +3052,7 @@ static void test_coop_level_mode_set(void) if (!param.user32_height) { skip("Fewer than 3 different modes supported, skipping mode restore test.\n"); - heap_free(original_modes); + free(original_modes); return; }
@@ -3841,7 +3840,7 @@ static void test_coop_level_mode_set(void) UnregisterClassA("ddraw_test_wndproc_wc2", GetModuleHandleA(NULL)); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_coop_level_mode_set_multi(void) @@ -4245,7 +4244,7 @@ done: DestroyWindow(window); ret = restore_display_modes(original_modes, display_count); ok(ret, "Failed to restore display modes.\n"); - heap_free(original_modes); + free(original_modes); }
static void test_initialize(void) @@ -5107,8 +5106,8 @@ static void test_specular_lighting(void) hr = IDirect3DDevice7_GetDirect3D(device, &d3d); ok(hr == D3D_OK, "Got unexpected hr %#lx.\n", hr);
- quad = heap_alloc(vertices_side * vertices_side * sizeof(*quad)); - indices = heap_alloc(indices_count * sizeof(*indices)); + quad = malloc(vertices_side * vertices_side * sizeof(*quad)); + indices = malloc(indices_count * sizeof(*indices)); for (i = 0, y = 0; y < vertices_side; ++y) { for (x = 0; x < vertices_side; ++x) @@ -5245,8 +5244,8 @@ static void test_specular_lighting(void) refcount = IDirect3DDevice7_Release(device); ok(!refcount, "Device has %lu references left.\n", refcount); DestroyWindow(window); - heap_free(indices); - heap_free(quad); + free(indices); + free(quad); }
static void test_clear_rect_count(void) @@ -6112,8 +6111,7 @@ static void test_block_formats_creation(void)
hr = IDirectDraw7_GetFourCCCodes(ddraw, &num_fourcc_codes, NULL); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); - fourcc_codes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - num_fourcc_codes * sizeof(*fourcc_codes)); + fourcc_codes = calloc(num_fourcc_codes, sizeof(*fourcc_codes)); if (!fourcc_codes) goto cleanup; hr = IDirectDraw7_GetFourCCCodes(ddraw, &num_fourcc_codes, fourcc_codes); @@ -6126,14 +6124,14 @@ static void test_block_formats_creation(void) supported_overlay_fmts |= formats[j].support_flag; } } - HeapFree(GetProcessHeap(), 0, fourcc_codes); + free(fourcc_codes);
memset(&hal_caps, 0, sizeof(hal_caps)); hal_caps.dwSize = sizeof(hal_caps); hr = IDirectDraw7_GetCaps(ddraw, &hal_caps, NULL); ok(SUCCEEDED(hr), "Failed to get caps, hr %#lx.\n", hr);
- mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 2 * 2 * 16 + 1); + mem = calloc(1, 2 * 2 * 16 + 1);
for (i = 0; i < ARRAY_SIZE(formats); ++i) { @@ -6254,7 +6252,7 @@ static void test_block_formats_creation(void) } }
- HeapFree(GetProcessHeap(), 0, mem); + free(mem); cleanup: IDirectDraw7_Release(ddraw); IDirect3DDevice7_Release(device); @@ -9092,7 +9090,7 @@ static void test_create_surface_pitch(void) hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_FULLSCREEN | DDSCL_EXCLUSIVE); ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#lx.\n", hr);
- mem = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ((63 * 4) + 8) * 63); + mem = calloc((63 * 4) + 8, 63);
/* We need a primary surface and exclusive mode for video memory accounting to work * right on Windows. Otherwise it gives us junk data, like creating a video memory @@ -9199,7 +9197,7 @@ static void test_create_surface_pitch(void) }
IDirectDrawSurface7_Release(primary); - HeapFree(GetProcessHeap(), 0, mem); + free(mem); refcount = IDirectDraw7_Release(ddraw); ok(!refcount, "Got unexpected refcount %lu.\n", refcount); DestroyWindow(window); @@ -11770,8 +11768,7 @@ static void test_color_fill(void)
hr = IDirectDraw7_GetFourCCCodes(ddraw, &num_fourcc_codes, NULL); ok(SUCCEEDED(hr), "Got hr %#lx.\n", hr); - fourcc_codes = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - num_fourcc_codes * sizeof(*fourcc_codes)); + fourcc_codes = calloc(num_fourcc_codes, sizeof(*fourcc_codes)); if (!fourcc_codes) goto done; hr = IDirectDraw7_GetFourCCCodes(ddraw, &num_fourcc_codes, fourcc_codes); @@ -11783,7 +11780,7 @@ static void test_color_fill(void) else if (fourcc_codes[i] == MAKEFOURCC('U', 'Y', 'V', 'Y')) supported_fmts |= SUPPORT_UYVY; } - HeapFree(GetProcessHeap(), 0, fourcc_codes); + free(fourcc_codes);
memset(&hal_caps, 0, sizeof(hal_caps)); hal_caps.dwSize = sizeof(hal_caps); @@ -17811,7 +17808,7 @@ static void test_clipper_refcount(void)
/* It looks like the protection against invalid thispointers is part of * the IDirectDrawClipper method implementation, not IDirectDrawSurface. */ - clipper = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 0x1000); + clipper = calloc(1, 0x1000); ok(!!clipper, "failed to allocate memory\n");
/* Assigning the vtable to our fake clipper does NOT make a difference on @@ -17843,7 +17840,7 @@ static void test_clipper_refcount(void)
IDirectDraw_Release(ddraw1);
- HeapFree(GetProcessHeap(), 0, clipper); + free(clipper);
refcount = IDirectDraw7_Release(ddraw); ok(!refcount, "%lu references left.\n", refcount); diff --git a/dlls/ddraw/tests/ddrawmodes.c b/dlls/ddraw/tests/ddrawmodes.c index 3318d29a3e9..7a6f1da229a 100644 --- a/dlls/ddraw/tests/ddrawmodes.c +++ b/dlls/ddraw/tests/ddrawmodes.c @@ -321,16 +321,16 @@ static void test_DirectDrawEnumerateExW(void) static void adddisplaymode(DDSURFACEDESC *lpddsd) { if (!modes) - modes = HeapAlloc(GetProcessHeap(), 0, (modes_size = 2) * sizeof(DDSURFACEDESC)); + modes = malloc((modes_size = 2) * sizeof(DDSURFACEDESC)); if (modes_cnt == modes_size) - modes = HeapReAlloc(GetProcessHeap(), 0, modes, (modes_size *= 2) * sizeof(DDSURFACEDESC)); + modes = realloc(modes, (modes_size *= 2) * sizeof(DDSURFACEDESC)); assert(modes); modes[modes_cnt++] = *lpddsd; }
static void flushdisplaymodes(void) { - HeapFree(GetProcessHeap(), 0, modes); + free(modes); modes = 0; modes_cnt = modes_size = 0; } @@ -969,7 +969,7 @@ static void testddraw7(void) { dddi2Bytes = FIELD_OFFSET(DDDEVICEIDENTIFIER2, dwWHQLLevel) + sizeof(DWORD);
- pdddi2 = HeapAlloc( GetProcessHeap(), 0, dddi2Bytes + 2*sizeof(DWORD) ); + pdddi2 = malloc(dddi2Bytes + 2 * sizeof(DWORD)); pend = (DWORD *)((char *)pdddi2 + dddi2Bytes); pend[0] = 0xdeadbeef; pend[1] = 0xdeadbeef; @@ -1009,7 +1009,7 @@ static void testddraw7(void) }
IDirectDraw_Release(dd7); - HeapFree( GetProcessHeap(), 0, pdddi2 ); + free(pdddi2); } }