mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 18:27:17 +00:00
comctl32/tests: Use CRT allocation functions.
This commit is contained in:
parent
9b9f7a0077
commit
0e99baed43
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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]));
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue