Commit b7d24e22 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite/tests: Remove remaining kernel32 heap calls.

parent 9b17bd17
...@@ -134,16 +134,13 @@ static void add_call(struct call_sequence **seq, int sequence_index, const struc ...@@ -134,16 +134,13 @@ static void add_call(struct call_sequence **seq, int sequence_index, const struc
if (!call_seq->sequence) if (!call_seq->sequence)
{ {
call_seq->size = 10; call_seq->size = 10;
call_seq->sequence = HeapAlloc(GetProcessHeap(), 0, call_seq->sequence = malloc(call_seq->size * sizeof(*call_seq->sequence));
call_seq->size * sizeof (struct call_entry));
} }
if (call_seq->count == call_seq->size) if (call_seq->count == call_seq->size)
{ {
call_seq->size *= 2; call_seq->size *= 2;
call_seq->sequence = HeapReAlloc(GetProcessHeap(), 0, call_seq->sequence = realloc(call_seq->sequence, call_seq->size * sizeof(*call_seq->sequence));
call_seq->sequence,
call_seq->size * sizeof (struct call_entry));
} }
assert(call_seq->sequence); assert(call_seq->sequence);
...@@ -155,7 +152,7 @@ static inline void flush_sequence(struct call_sequence **seg, int sequence_index ...@@ -155,7 +152,7 @@ static inline void flush_sequence(struct call_sequence **seg, int sequence_index
{ {
struct call_sequence *call_seq = seg[sequence_index]; struct call_sequence *call_seq = seg[sequence_index];
HeapFree(GetProcessHeap(), 0, call_seq->sequence); free(call_seq->sequence);
call_seq->sequence = NULL; call_seq->sequence = NULL;
call_seq->count = call_seq->size = 0; call_seq->count = call_seq->size = 0;
} }
...@@ -165,7 +162,7 @@ static void init_call_sequences(struct call_sequence **seq, int n) ...@@ -165,7 +162,7 @@ static void init_call_sequences(struct call_sequence **seq, int n)
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct call_sequence)); seq[i] = calloc(1, sizeof(*seq[i]));
} }
static void test_uint(UINT32 actual, UINT32 expected, const char *name, const struct testcontext *ctxt) static void test_uint(UINT32 actual, UINT32 expected, const char *name, const struct testcontext *ctxt)
......
...@@ -783,11 +783,13 @@ static ULONG WINAPI fontdatastream_AddRef(IDWriteFontFileStream *iface) ...@@ -783,11 +783,13 @@ static ULONG WINAPI fontdatastream_AddRef(IDWriteFontFileStream *iface)
static ULONG WINAPI fontdatastream_Release(IDWriteFontFileStream *iface) static ULONG WINAPI fontdatastream_Release(IDWriteFontFileStream *iface)
{ {
struct test_fontdatastream *This = impl_from_IDWriteFontFileStream(iface); struct test_fontdatastream *stream = impl_from_IDWriteFontFileStream(iface);
ULONG ref = InterlockedDecrement(&This->ref); ULONG refcount = InterlockedDecrement(&stream->ref);
if (ref == 0)
HeapFree(GetProcessHeap(), 0, This); if (!refcount)
return ref; free(stream);
return refcount;
} }
static HRESULT WINAPI fontdatastream_ReadFileFragment(IDWriteFontFileStream *iface, void const **fragment_start, UINT64 offset, UINT64 fragment_size, void **fragment_context) static HRESULT WINAPI fontdatastream_ReadFileFragment(IDWriteFontFileStream *iface, void const **fragment_start, UINT64 offset, UINT64 fragment_size, void **fragment_context)
...@@ -836,16 +838,17 @@ static const IDWriteFontFileStreamVtbl fontdatastreamvtbl = ...@@ -836,16 +838,17 @@ static const IDWriteFontFileStreamVtbl fontdatastreamvtbl =
static HRESULT create_fontdatastream(LPVOID data, UINT size, IDWriteFontFileStream** iface) static HRESULT create_fontdatastream(LPVOID data, UINT size, IDWriteFontFileStream** iface)
{ {
struct test_fontdatastream *This = HeapAlloc(GetProcessHeap(), 0, sizeof(struct test_fontdatastream)); struct test_fontdatastream *object = calloc(1, sizeof(*object));
if (!This) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->data = data; object->IDWriteFontFileStream_iface.lpVtbl = &fontdatastreamvtbl;
This->size = size; object->ref = 1;
This->ref = 1; object->data = data;
This->IDWriteFontFileStream_iface.lpVtbl = &fontdatastreamvtbl; object->size = size;
*iface = &object->IDWriteFontFileStream_iface;
*iface = &This->IDWriteFontFileStream_iface;
return S_OK; return S_OK;
} }
...@@ -6014,7 +6017,7 @@ static void test_CreateGlyphRunAnalysis(void) ...@@ -6014,7 +6017,7 @@ static void test_CreateGlyphRunAnalysis(void)
ok(!IsRectEmpty(&rect), "Unexpected empty bbox.\n"); ok(!IsRectEmpty(&rect), "Unexpected empty bbox.\n");
size = (rect.right - rect.left) * (rect.bottom - rect.top); size = (rect.right - rect.left) * (rect.bottom - rect.top);
bits = HeapAlloc(GetProcessHeap(), 0, size); bits = malloc(size);
hr = IDWriteGlyphRunAnalysis_CreateAlphaTexture(analysis, DWRITE_TEXTURE_ALIASED_1x1, &rect, bits, size); hr = IDWriteGlyphRunAnalysis_CreateAlphaTexture(analysis, DWRITE_TEXTURE_ALIASED_1x1, &rect, bits, size);
ok(hr == S_OK, "Failed to get alpha texture, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get alpha texture, hr %#x.\n", hr);
...@@ -6029,7 +6032,7 @@ static void test_CreateGlyphRunAnalysis(void) ...@@ -6029,7 +6032,7 @@ static void test_CreateGlyphRunAnalysis(void)
todo_wine todo_wine
ok(hr == DWRITE_E_UNSUPPORTEDOPERATION, "Unexpected hr %#x.\n", hr); ok(hr == DWRITE_E_UNSUPPORTEDOPERATION, "Unexpected hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, bits); free(bits);
hr = IDWriteFactory_CreateCustomRenderingParams(factory, 0.1f, 0.0f, 1.0f, DWRITE_PIXEL_GEOMETRY_FLAT, hr = IDWriteFactory_CreateCustomRenderingParams(factory, 0.1f, 0.0f, 1.0f, DWRITE_PIXEL_GEOMETRY_FLAT,
DWRITE_RENDERING_MODE_NATURAL, &params); DWRITE_RENDERING_MODE_NATURAL, &params);
...@@ -6095,7 +6098,7 @@ static void test_CreateGlyphRunAnalysis(void) ...@@ -6095,7 +6098,7 @@ static void test_CreateGlyphRunAnalysis(void)
ok(!IsRectEmpty(&rect), "Unexpected empty bbox.\n"); ok(!IsRectEmpty(&rect), "Unexpected empty bbox.\n");
size = (rect.right - rect.left) * (rect.bottom - rect.top); size = (rect.right - rect.left) * (rect.bottom - rect.top);
bits = HeapAlloc(GetProcessHeap(), 0, size); bits = malloc(size);
hr = IDWriteGlyphRunAnalysis_CreateAlphaTexture(analysis, DWRITE_TEXTURE_ALIASED_1x1, &rect, bits, size); hr = IDWriteGlyphRunAnalysis_CreateAlphaTexture(analysis, DWRITE_TEXTURE_ALIASED_1x1, &rect, bits, size);
ok(hr == S_OK, "Failed to get alpha texture, hr %#x.\n", hr); ok(hr == S_OK, "Failed to get alpha texture, hr %#x.\n", hr);
...@@ -6110,7 +6113,7 @@ static void test_CreateGlyphRunAnalysis(void) ...@@ -6110,7 +6113,7 @@ static void test_CreateGlyphRunAnalysis(void)
todo_wine todo_wine
ok(hr == DWRITE_E_UNSUPPORTEDOPERATION, "Unexpected hr %#x.\n", hr); ok(hr == DWRITE_E_UNSUPPORTEDOPERATION, "Unexpected hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, bits); free(bits);
IDWriteGlyphRunAnalysis_Release(analysis); IDWriteGlyphRunAnalysis_Release(analysis);
......
...@@ -343,14 +343,12 @@ static void add_call(struct drawcall_sequence **seq, int sequence_index, const s ...@@ -343,14 +343,12 @@ static void add_call(struct drawcall_sequence **seq, int sequence_index, const s
if (!call_seq->sequence) { if (!call_seq->sequence) {
call_seq->size = 10; call_seq->size = 10;
call_seq->sequence = HeapAlloc(GetProcessHeap(), 0, call_seq->size * sizeof (struct drawcall_entry)); call_seq->sequence = malloc(call_seq->size * sizeof(*call_seq->sequence));
} }
if (call_seq->count == call_seq->size) { if (call_seq->count == call_seq->size) {
call_seq->size *= 2; call_seq->size *= 2;
call_seq->sequence = HeapReAlloc(GetProcessHeap(), 0, call_seq->sequence = realloc(call_seq->sequence, call_seq->size * sizeof(*call_seq->sequence));
call_seq->sequence,
call_seq->size * sizeof (struct drawcall_entry));
} }
assert(call_seq->sequence); assert(call_seq->sequence);
...@@ -361,7 +359,7 @@ static inline void flush_sequence(struct drawcall_sequence **seg, int sequence_i ...@@ -361,7 +359,7 @@ static inline void flush_sequence(struct drawcall_sequence **seg, int sequence_i
{ {
struct drawcall_sequence *call_seq = seg[sequence_index]; struct drawcall_sequence *call_seq = seg[sequence_index];
HeapFree(GetProcessHeap(), 0, call_seq->sequence); free(call_seq->sequence);
call_seq->sequence = NULL; call_seq->sequence = NULL;
call_seq->count = call_seq->size = 0; call_seq->count = call_seq->size = 0;
} }
...@@ -371,7 +369,7 @@ static void init_call_sequences(struct drawcall_sequence **seq, int n) ...@@ -371,7 +369,7 @@ static void init_call_sequences(struct drawcall_sequence **seq, int n)
int i; int i;
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
seq[i] = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct drawcall_sequence)); seq[i] = calloc(1, sizeof(*seq[i]));
} }
static void ok_sequence_(struct drawcall_sequence **seq, int sequence_index, static void ok_sequence_(struct drawcall_sequence **seq, int sequence_index,
...@@ -879,7 +877,7 @@ static ULONG WINAPI testeffect_Release(IUnknown *iface) ...@@ -879,7 +877,7 @@ static ULONG WINAPI testeffect_Release(IUnknown *iface)
LONG ref = InterlockedDecrement(&effect->ref); LONG ref = InterlockedDecrement(&effect->ref);
if (!ref) if (!ref)
HeapFree(GetProcessHeap(), 0, effect); free(effect);
return ref; return ref;
} }
...@@ -894,7 +892,7 @@ static IUnknown *create_test_effect(void) ...@@ -894,7 +892,7 @@ static IUnknown *create_test_effect(void)
{ {
struct test_effect *effect; struct test_effect *effect;
effect = HeapAlloc(GetProcessHeap(), 0, sizeof(*effect)); effect = calloc(1, sizeof(*effect));
effect->IUnknown_iface.lpVtbl = &testeffectvtbl; effect->IUnknown_iface.lpVtbl = &testeffectvtbl;
effect->ref = 1; effect->ref = 1;
......
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