Commit c2afbc8c authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

gdiplus/tests: Use CRT allocation functions.

parent 48801b6d
......@@ -176,7 +176,7 @@ typedef struct node{
/* Linked list prepend function. */
static void log_state(GraphicsState data, node ** log)
{
node * new_entry = HeapAlloc(GetProcessHeap(), 0, sizeof(node));
node * new_entry = malloc(sizeof(node));
new_entry->data = data;
new_entry->next = *log;
......@@ -209,7 +209,7 @@ static void check_no_duplicates(node * log)
temp = orig;
do{
temp2 = temp->next;
HeapFree(GetProcessHeap(), 0, temp);
free(temp);
temp = temp2;
}while(temp);
......@@ -7198,19 +7198,19 @@ static HDC create_printer_dc(void)
if (!pOpenPrinterA(buffer, &hprn, NULL)) goto done;
pGetPrinterA(hprn, 2, NULL, 0, &len);
pbuf = HeapAlloc(GetProcessHeap(), 0, len);
pbuf = malloc(len);
if (!pGetPrinterA(hprn, 2, (LPBYTE)pbuf, len, &len)) goto done;
pGetPrinterDriverA(hprn, NULL, 3, NULL, 0, &len);
dbuf = HeapAlloc(GetProcessHeap(), 0, len);
dbuf = malloc(len);
if (!pGetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, len, &len)) goto done;
hdc = CreateDCA(dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName, pbuf->pDevMode);
trace("hdc %p for driver '%s' printer '%s' port '%s'\n", hdc,
dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName);
done:
HeapFree(GetProcessHeap(), 0, dbuf);
HeapFree(GetProcessHeap(), 0, pbuf);
free(dbuf);
free(pbuf);
if (hprn) pClosePrinter(hprn);
if (winspool) FreeLibrary(winspool);
return hdc;
......
......@@ -94,8 +94,8 @@ static void _ok_path_fudge(GpPath* path, const path_test_t *expected, INT expect
ok_(__FILE__,line)(size == expected_size, "Path size %d does not match expected size %d\n",
size, expected_size);
points = HeapAlloc(GetProcessHeap(), 0, size * sizeof(GpPointF));
types = HeapAlloc(GetProcessHeap(), 0, size);
points = malloc(size * sizeof(GpPointF));
types = malloc(size);
if(GdipGetPathPoints(path, points, size) != Ok || GdipGetPathTypes(path, types, size) != Ok){
skip("Cannot perform path comparisons due to failure to retrieve path.\n");
......@@ -125,8 +125,8 @@ static void _ok_path_fudge(GpPath* path, const path_test_t *expected, INT expect
}
end:
HeapFree(GetProcessHeap(), 0, types);
HeapFree(GetProcessHeap(), 0, points);
free(types);
free(points);
}
static void test_constructor_destructor(void)
......
......@@ -3797,7 +3797,7 @@ static void check_properties_id_list(GpImage *image, const struct property_test_
if (count_broken != ~0 && count_broken == prop_count)
td = td_broken;
prop_id = HeapAlloc(GetProcessHeap(), 0, prop_count * sizeof(*prop_id));
prop_id = malloc(prop_count * sizeof(*prop_id));
status = GdipGetPropertyIdList(image, prop_count, prop_id);
expect(Ok, status);
......@@ -3821,7 +3821,7 @@ static void check_properties_id_list(GpImage *image, const struct property_test_
if (prop_size)
*prop_size += size;
prop_item = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
prop_item = calloc(1, size);
status = GdipGetPropertyItem(image, prop_id[i], size, prop_item);
size -= sizeof(*prop_item);
expect(Ok, status);
......@@ -3845,12 +3845,12 @@ static void check_properties_id_list(GpImage *image, const struct property_test_
trace("(id %#lx) %s\n", prop_item->id, dbgstr_hexdata(prop_item->value, prop_item->length));
}
HeapFree(GetProcessHeap(), 0, prop_item);
free(prop_item);
winetest_pop_context();
}
HeapFree(GetProcessHeap(), 0, prop_id);
free(prop_id);
}
static void check_properties_get_all(GpImage *image, const struct property_test_data *td, UINT count,
......@@ -3872,7 +3872,7 @@ static void check_properties_get_all(GpImage *image, const struct property_test_
if (count_broken != ~0 && count_broken == total_count)
td = td_broken;
prop_item = HeapAlloc(GetProcessHeap(), 0, total_size);
prop_item = malloc(total_size);
status = GdipGetAllPropertyItems(image, total_size, total_count, prop_item);
expect(Ok, status);
......@@ -3902,7 +3902,7 @@ static void check_properties_get_all(GpImage *image, const struct property_test_
winetest_pop_context();
}
HeapFree(GetProcessHeap(), 0, prop_item);
free(prop_item);
}
static void test_image_properties(void)
......@@ -4072,7 +4072,7 @@ static void test_image_properties(void)
expect(InvalidParameter, status);
status = GdipGetAllPropertyItems(image, prop_size, prop_count, NULL);
expect(InvalidParameter, status);
prop_item = HeapAlloc(GetProcessHeap(), 0, prop_size);
prop_item = malloc(prop_size);
expected = (image_type == ImageTypeMetafile) ? NotImplemented : InvalidParameter;
if (prop_count != 1)
{
......@@ -4091,7 +4091,7 @@ static void test_image_properties(void)
status = GdipGetAllPropertyItems(image, prop_size, prop_count, prop_item);
ok(status == expected || broken(status == Ok && prop_count == 0), /* XP */
"Expected %d, got %d\n", expected, status);
HeapFree(GetProcessHeap(), 0, prop_item);
free(prop_item);
GdipDisposeImage(image);
......@@ -6132,7 +6132,7 @@ static BYTE *init_bitmap(UINT *width, UINT *height, UINT *stride)
*stride = (*width * 3 + 3) & ~3;
trace("width %d, height %d, stride %d\n", *width, *height, *stride);
src = HeapAlloc(GetProcessHeap(), 0, *stride * *height);
src = malloc(*stride * *height);
scale = 256 / *width;
if (!scale) scale = 1;
......@@ -6263,7 +6263,7 @@ static void test_GdipInitializePalette(void)
GdipFree(palette);
GdipDisposeImage((GpImage *)bitmap);
HeapFree(GetProcessHeap(), 0, data);
free(data);
}
static void test_graphics_clear(void)
......
......@@ -3502,19 +3502,19 @@ static HDC create_printer_dc(void)
if (!pOpenPrinterA(buffer, &hprn, NULL)) goto done;
pGetPrinterA(hprn, 2, NULL, 0, &len);
pbuf = HeapAlloc(GetProcessHeap(), 0, len);
pbuf = malloc(len);
if (!pGetPrinterA(hprn, 2, (LPBYTE)pbuf, len, &len)) goto done;
pGetPrinterDriverA(hprn, NULL, 3, NULL, 0, &len);
dbuf = HeapAlloc(GetProcessHeap(), 0, len);
dbuf = malloc(len);
if (!pGetPrinterDriverA(hprn, NULL, 3, (LPBYTE)dbuf, len, &len)) goto done;
hdc = CreateDCA(dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName, pbuf->pDevMode);
trace("hdc %p for driver '%s' printer '%s' port '%s'\n", hdc,
dbuf->pDriverPath, pbuf->pPrinterName, pbuf->pPortName);
done:
HeapFree(GetProcessHeap(), 0, dbuf);
HeapFree(GetProcessHeap(), 0, pbuf);
free(dbuf);
free(pbuf);
if (hprn) pClosePrinter(hprn);
if (winspool) FreeLibrary(winspool);
return hdc;
......
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