-- v4: comctl32/tests: Use CRT allocation functions.
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/comctl32/tests/combo.c | 4 ++-- dlls/comctl32/tests/listbox.c | 9 ++++----- dlls/comctl32/tests/mru.c | 5 ++--- dlls/comctl32/tests/msg.h | 8 ++++---- dlls/comctl32/tests/rebar.c | 13 ++++++------- dlls/comctl32/tests/subclass.c | 7 +++---- dlls/comctl32/tests/taskdialog.c | 5 ++--- dlls/comctl32/tests/toolbar.c | 14 +++++++------- 8 files changed, 30 insertions(+), 35 deletions(-)
diff --git a/dlls/comctl32/tests/combo.c b/dlls/comctl32/tests/combo.c index 3eceeb55bd5..4a58b8763a4 100644 --- a/dlls/comctl32/tests/combo.c +++ b/dlls/comctl32/tests/combo.c @@ -161,7 +161,7 @@ static void test_comboex(void) *out_of_range_item = "Out of Range Item";
/* Allocate space for result */ - textBuffer = heap_alloc(MAX_CHARS); + textBuffer = malloc(MAX_CHARS);
/* Basic comboboxex test */ myHwnd = createComboEx(WS_BORDER | WS_VISIBLE | WS_CHILD | CBS_DROPDOWN); @@ -247,7 +247,7 @@ static void test_comboex(void)
/* Cleanup */ - heap_free(textBuffer); + free(textBuffer); DestroyWindow(myHwnd); }
diff --git a/dlls/comctl32/tests/listbox.c b/dlls/comctl32/tests/listbox.c index cb311b1fc77..16c546852a1 100644 --- a/dlls/comctl32/tests/listbox.c +++ b/dlls/comctl32/tests/listbox.c @@ -27,7 +27,6 @@ #include "winnls.h" #include "commctrl.h"
-#include "wine/heap.h" #include "wine/test.h" #include "v6util.h" #include "msg.h" @@ -254,18 +253,18 @@ static void run_test(DWORD style, const struct listbox_test test) WCHAR *txtw; CHAR *txt;
- txt = heap_alloc_zero(size + 1); + txt = calloc(1, size + 1); resA = SendMessageA(hLB, LB_GETTEXT, i, (LPARAM)txt); ok(!strcmp(txt, strings[i]), "returned string for item %d does not match %s vs %s\n", i, txt, strings[i]);
- txtw = heap_alloc_zero((size + 1) * sizeof(*txtw)); + txtw = calloc(size + 1, sizeof(*txtw)); resW = SendMessageW(hLB, LB_GETTEXT, i, (LPARAM)txtw); ok(resA == resW, "Unexpected text length.\n"); WideCharToMultiByte(CP_ACP, 0, txtw, -1, txt, size, NULL, NULL); ok(!strcmp (txt, strings[i]), "Unexpected string for item %d, %s vs %s.\n", i, txt, strings[i]);
- heap_free(txtw); - heap_free(txt); + free(txtw); + free(txt); }
/* Confirm the count of items, and that an invalid delete does not remove anything */ diff --git a/dlls/comctl32/tests/mru.c b/dlls/comctl32/tests/mru.c index 472fb99bac3..a2caf5f078a 100644 --- a/dlls/comctl32/tests/mru.c +++ b/dlls/comctl32/tests/mru.c @@ -28,7 +28,6 @@ #include "commctrl.h" #include "shlwapi.h"
-#include "wine/heap.h" #include "wine/test.h"
/* Keys for testing MRU functions */ @@ -121,7 +120,7 @@ static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) if (dwMaxLen > ARRAY_SIZE(szNameBuf)) { /* Name too big: alloc a buffer for it */ - if (!(lpszName = heap_alloc(dwMaxLen * sizeof(CHAR)))) + if (!(lpszName = malloc(dwMaxLen * sizeof(CHAR)))) { ret = ERROR_NOT_ENOUGH_MEMORY; goto cleanup; @@ -156,7 +155,7 @@ static LSTATUS mru_RegDeleteTreeA(HKEY hKey, LPCSTR lpszSubKey) cleanup: /* Free buffer if allocated */ if (lpszName != szNameBuf) - heap_free(lpszName); + free(lpszName); if(lpszSubKey) RegCloseKey(hSubKey); return ret; diff --git a/dlls/comctl32/tests/msg.h b/dlls/comctl32/tests/msg.h index 16a8f6e92eb..83958e30cdd 100644 --- a/dlls/comctl32/tests/msg.h +++ b/dlls/comctl32/tests/msg.h @@ -71,13 +71,13 @@ static void add_message(struct msg_sequence **seq, int sequence_index, if (!msg_seq->sequence) { msg_seq->size = 10; - msg_seq->sequence = heap_alloc(msg_seq->size * sizeof (*msg_seq->sequence)); + msg_seq->sequence = malloc(msg_seq->size * sizeof (*msg_seq->sequence)); }
if (msg_seq->count == msg_seq->size) { msg_seq->size *= 2; - msg_seq->sequence = heap_realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence)); + msg_seq->sequence = realloc(msg_seq->sequence, msg_seq->size * sizeof (*msg_seq->sequence)); }
assert(msg_seq->sequence); @@ -89,7 +89,7 @@ static void add_message(struct msg_sequence **seq, int sequence_index, static inline void flush_sequence(struct msg_sequence **seg, int sequence_index) { struct msg_sequence *msg_seq = seg[sequence_index]; - heap_free(msg_seq->sequence); + free(msg_seq->sequence); msg_seq->sequence = NULL; msg_seq->count = msg_seq->size = 0; } @@ -394,5 +394,5 @@ static void init_msg_sequences(struct msg_sequence **seq, int n) int i;
for (i = 0; i < n; i++) - seq[i] = heap_alloc_zero(sizeof(*seq[i])); + seq[i] = calloc(1, sizeof(*seq[i])); } diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index c15b22aeca1..7cafa4ba52b 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -22,7 +22,6 @@ #include <windows.h> #include <commctrl.h>
-#include "wine/heap.h" #include "wine/test.h"
static BOOL (WINAPI *pImageList_Destroy)(HIMAGELIST); @@ -215,9 +214,9 @@ static rbsize_result_t rbsize_init(int cleft, int ctop, int cright, int cbottom, SetRect(&ret.rcClient, cleft, ctop, cright, cbottom); ret.cyBarHeight = cyBarHeight; ret.nRows = 0; - ret.cyRowHeights = heap_alloc_zero(nRows * sizeof(int)); + ret.cyRowHeights = calloc(nRows, sizeof(int)); ret.nBands = 0; - ret.bands = heap_alloc_zero(nBands * sizeof(*ret.bands)); + ret.bands = calloc(nBands, sizeof(*ret.bands));
return ret; } @@ -241,7 +240,7 @@ static rbsize_result_t *rbsize_results;
static void rbsize_results_init(void) { - rbsize_results = heap_alloc(rbsize_results_num * sizeof(*rbsize_results)); + rbsize_results = malloc(rbsize_results_num * sizeof(*rbsize_results));
rbsize_results[0] = rbsize_init(0, 0, 672, 0, 0, 0, 0);
@@ -428,10 +427,10 @@ static void rbsize_results_free(void) int i;
for (i = 0; i < rbsize_results_num; i++) { - heap_free(rbsize_results[i].cyRowHeights); - heap_free(rbsize_results[i].bands); + free(rbsize_results[i].cyRowHeights); + free(rbsize_results[i].bands); } - heap_free(rbsize_results); + free(rbsize_results); rbsize_results = NULL; }
diff --git a/dlls/comctl32/tests/subclass.c b/dlls/comctl32/tests/subclass.c index bc3fc6f1d91..73e7288e8a2 100644 --- a/dlls/comctl32/tests/subclass.c +++ b/dlls/comctl32/tests/subclass.c @@ -26,7 +26,6 @@ #include "winuser.h" #include "commctrl.h"
-#include "wine/heap.h" #include "wine/test.h"
static BOOL (WINAPI *pGetWindowSubclass)(HWND, SUBCLASSPROC, UINT_PTR, DWORD_PTR *); @@ -124,12 +123,12 @@ static void add_message(const struct message *msg) if (!sequence) { sequence_size = 10; - sequence = heap_alloc( sequence_size * sizeof (struct message) ); + sequence = malloc(sequence_size * sizeof(struct message)); } if (sequence_cnt == sequence_size) { sequence_size *= 2; - sequence = heap_realloc( sequence, sequence_size * sizeof (struct message) ); + sequence = realloc(sequence, sequence_size * sizeof(struct message)); } assert(sequence);
@@ -141,7 +140,7 @@ static void add_message(const struct message *msg)
static void flush_sequence(void) { - heap_free(sequence); + free(sequence); sequence = NULL; sequence_cnt = sequence_size = 0; } diff --git a/dlls/comctl32/tests/taskdialog.c b/dlls/comctl32/tests/taskdialog.c index 6a12b185639..ef60a5953bd 100644 --- a/dlls/comctl32/tests/taskdialog.c +++ b/dlls/comctl32/tests/taskdialog.c @@ -24,7 +24,6 @@ #include "winuser.h" #include "commctrl.h"
-#include "wine/heap.h" #include "wine/test.h" #include "v6util.h" #include "msg.h" @@ -404,7 +403,7 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, int expect_radi int i;
/* Allocate messages to test against, plus 2 implicit and 1 empty */ - msg_start = msg = heap_alloc_zero(sizeof(*msg) * (test_messages_len + 3)); + msg_start = msg = calloc(test_messages_len + 3, sizeof(*msg));
/* Always needed, thus made implicit */ init_test_message(TDN_DIALOG_CONSTRUCTED, 0, 0, msg++); @@ -425,7 +424,7 @@ static void run_test_(TASKDIALOGCONFIG *info, int expect_button, int expect_radi ok_(file, line)(ret_radio == expect_radio_button, "Wrong radio button. Expected %d, got %d\n", expect_radio_button, ret_radio);
- heap_free(msg_start); + free(msg_start); }
static const LONG_PTR test_ref_data = 123456; diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 7c886e1f88f..3d1fbcc04d7 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -226,7 +226,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam) if (save->iItem == -1) { save->cbData = save->cbData * 2 + 11 * sizeof(DWORD); - save->pData = heap_alloc( save->cbData ); + save->pData = malloc(save->cbData); save->pData[0] = 0xcafe; save->pCurrent = save->pData + 1; } @@ -302,7 +302,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam)
if (restore->iItem == 0) { - restore->tbButton.iString = (INT_PTR)heap_alloc_zero( 8 ); + restore->tbButton.iString = (INT_PTR)calloc( 8, sizeof(char) ); strcpy( (char *)restore->tbButton.iString, "foo" ); } else if (restore->iItem == 1) @@ -332,7 +332,7 @@ static LRESULT parent_wnd_notify(LPARAM lParam) { case 0: tb->tbButton.idCommand = 7; - alloced_str = heap_alloc_zero( 8 ); + alloced_str = calloc( 8, sizeof(char) ); strcpy( alloced_str, "foo" ); tb->tbButton.iString = (INT_PTR)alloced_str; return 1; @@ -1077,7 +1077,7 @@ static tbsize_result_t init_tbsize_result(int nButtonsAlloc, int cleft, int ctop ret.szMin.cx = minx; ret.szMin.cy = miny; ret.nButtons = 0; - ret.prcButtons = heap_alloc_zero(nButtonsAlloc * sizeof(*ret.prcButtons)); + ret.prcButtons = calloc(nButtonsAlloc, sizeof(*ret.prcButtons));
return ret; } @@ -1099,7 +1099,7 @@ static void init_tbsize_results(void) { int fontheight = system_font_height(); int buttonwidth;
- tbsize_results = heap_alloc_zero(tbsize_results_num * sizeof(*tbsize_results)); + tbsize_results = calloc(tbsize_results_num, sizeof(*tbsize_results));
tbsize_results[0] = init_tbsize_result(5, 0, 0 ,672 ,26, 100 ,22); tbsize_addbutton(&tbsize_results[0], 0, 2, 23, 24); @@ -1357,8 +1357,8 @@ static void free_tbsize_results(void) { int i;
for (i = 0; i < tbsize_results_num; i++) - heap_free(tbsize_results[i].prcButtons); - heap_free(tbsize_results); + free(tbsize_results[i].prcButtons); + free(tbsize_results); tbsize_results = NULL; }
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=139579
Your paranoid android.
=== w10pro64_en_AE_u8 (32 bit report) ===
comctl32: rebar.c:948: Test failed: expected 35 for 38 from line 989 rebar.c:948: Test failed: expected 40 for 43 from line 995 rebar.c:948: Test failed: expected 40 for 43 from line 1014
=== w7u_adm (32 bit report) ===
comctl32: 0868:toolbar: unhandled exception c0000005 at 779568F3
=== w7u_el (32 bit report) ===
comctl32: 0a70:toolbar: unhandled exception c0000005 at 773968F3
=== w8 (32 bit report) ===
comctl32: 0cb8:toolbar: unhandled exception c0000005 at 77A3C11A
=== w1064v1507 (32 bit report) ===
comctl32: 0974:toolbar: unhandled exception c0000005 at 77D0EFD4
=== w10pro64_en_AE_u8 (32 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000005)
=== w7pro64 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w864 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064v1507 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064v1809 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064_2qxl (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064_adm (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w1064_tsign (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64 (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64_ar (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64_ja (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w10pro64_zh_CN (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
=== w11pro64_amd (64 bit report) ===
Report validation errors: comctl32:toolbar crashed (c0000374)
64-bit toolbar tests still crash on Windows with v4.