Commit 909f7aa7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

dwrite: Use CRT allocation functions.

parent 1a8d6f55
......@@ -633,14 +633,16 @@ static BracketPair *bidi_compute_bracket_pairs(IsolatedRun *iso_run)
int pair_count = 0;
int i;
open_stack = heap_alloc(sizeof(WCHAR) * iso_run->length);
stack_index = heap_alloc(sizeof(int) * iso_run->length);
open_stack = malloc(sizeof(WCHAR) * iso_run->length);
stack_index = malloc(sizeof(int) * iso_run->length);
for (i = 0; i < iso_run->length; i++) {
unsigned short ubv = get_table_entry(bidi_bracket_table, iso_run->item[i].ch);
if (ubv) {
if (!out) {
out = heap_alloc(sizeof(BracketPair));
if (ubv)
{
if (!out)
{
out = malloc(sizeof(BracketPair));
out[0].start = -1;
}
......@@ -663,7 +665,7 @@ static BracketPair *bidi_compute_bracket_pairs(IsolatedRun *iso_run)
out[pair_count].start = stack_index[j];
out[pair_count].end = i;
pair_count++;
out = heap_realloc(out, sizeof(BracketPair) * (pair_count+1));
out = realloc(out, sizeof(BracketPair) * (pair_count+1));
out[pair_count].start = -1;
stack_top = j+1;
break;
......@@ -672,15 +674,16 @@ static BracketPair *bidi_compute_bracket_pairs(IsolatedRun *iso_run)
}
}
}
if (pair_count == 0) {
heap_free(out);
if (pair_count == 0)
{
free(out);
out = NULL;
}
else if (pair_count > 1)
qsort(out, pair_count, sizeof(BracketPair), bracketpair_compr);
heap_free(open_stack);
heap_free(stack_index);
free(open_stack);
free(stack_index);
return out;
}
......@@ -774,7 +777,7 @@ static void bidi_resolve_neutrals(IsolatedRun *run)
i++;
p = &pairs[i];
}
heap_free(pairs);
free(pairs);
}
/* N1 */
......@@ -920,8 +923,7 @@ static HRESULT bidi_compute_isolating_runs_set(UINT8 baselevel, UINT8 *classes,
HRESULT hr = S_OK;
Run *runs;
runs = heap_calloc(count, sizeof(*runs));
if (!runs)
if (!(runs = calloc(count, sizeof(*runs))))
return E_OUTOFMEMORY;
list_init(set);
......@@ -949,8 +951,8 @@ static HRESULT bidi_compute_isolating_runs_set(UINT8 baselevel, UINT8 *classes,
int type_fence, real_end;
int j;
current_isolated = heap_alloc(sizeof(IsolatedRun) + sizeof(RunChar)*count);
if (!current_isolated) {
if (!(current_isolated = malloc(sizeof(IsolatedRun) + sizeof(RunChar)*count)))
{
hr = E_OUTOFMEMORY;
break;
}
......@@ -1040,7 +1042,7 @@ search:
i++;
}
heap_free(runs);
free(runs);
return hr;
}
......@@ -1053,8 +1055,7 @@ HRESULT bidi_computelevels(const WCHAR *string, UINT32 count, UINT8 baselevel, U
TRACE("%s, %u\n", debugstr_wn(string, count), count);
chartype = heap_alloc(count*sizeof(*chartype));
if (!chartype)
if (!(chartype = malloc(count * sizeof(*chartype))))
return E_OUTOFMEMORY;
bidi_classify(string, chartype, count);
......@@ -1081,7 +1082,7 @@ HRESULT bidi_computelevels(const WCHAR *string, UINT32 count, UINT8 baselevel, U
if (TRACE_ON(bidi)) iso_dump_types("after neutrals", iso_run);
list_remove(&iso_run->entry);
heap_free(iso_run);
free(iso_run);
}
if (TRACE_ON(bidi)) bidi_dump_types("before implicit", chartype, 0, count);
......@@ -1091,6 +1092,6 @@ HRESULT bidi_computelevels(const WCHAR *string, UINT32 count, UINT8 baselevel, U
bidi_resolve_resolved(baselevel, chartype, levels, 0, count-1);
done:
heap_free(chartype);
free(chartype);
return hr;
}
......@@ -21,7 +21,6 @@
#include "winternl.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#define MS_GSUB_TAG DWRITE_MAKE_OPENTYPE_TAG('G','S','U','B')
......@@ -34,29 +33,13 @@ static const DWRITE_MATRIX identity =
0.0f, 0.0f
};
static inline LPWSTR heap_strdupW(const WCHAR *str)
{
LPWSTR ret = NULL;
if(str) {
DWORD size;
size = (lstrlenW(str) + 1)*sizeof(WCHAR);
ret = heap_alloc(size);
if(ret)
memcpy(ret, str, size);
}
return ret;
}
static inline LPWSTR heap_strdupnW(const WCHAR *str, UINT32 len)
{
WCHAR *ret = NULL;
if (len)
{
ret = heap_alloc((len+1)*sizeof(WCHAR));
ret = malloc((len+1)*sizeof(WCHAR));
if(ret)
{
memcpy(ret, str, len*sizeof(WCHAR));
......@@ -97,10 +80,7 @@ static inline BOOL dwrite_array_reserve(void **elements, size_t *capacity, size_
if (new_capacity < count)
new_capacity = max_capacity;
if (!*elements)
new_elements = RtlAllocateHeap(GetProcessHeap(), 0, new_capacity * size);
else
new_elements = RtlReAllocateHeap(GetProcessHeap(), 0, *elements, new_capacity * size);
new_elements = realloc(*elements, new_capacity * size);
if (!new_elements)
return FALSE;
......
......@@ -267,7 +267,7 @@ static ULONG WINAPI rendertarget_Release(IDWriteBitmapRenderTarget1 *iface)
{
IDWriteFactory7_Release(target->factory);
DeleteDC(target->hdc);
heap_free(target);
free(target);
}
return refcount;
......@@ -460,8 +460,8 @@ static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *ifac
color = colorref_to_pixel_888(color);
if (texturetype == DWRITE_TEXTURE_CLEARTYPE_3x1)
size *= 3;
bitmap = heap_alloc_zero(size);
if (!bitmap) {
if (!(bitmap = calloc(1, size)))
{
IDWriteGlyphRunAnalysis_Release(analysis);
return E_OUTOFMEMORY;
}
......@@ -477,7 +477,7 @@ static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *ifac
if (bbox_ret) *bbox_ret = target_rect;
}
heap_free(bitmap);
free(bitmap);
}
IDWriteGlyphRunAnalysis_Release(analysis);
......@@ -605,8 +605,8 @@ static HRESULT create_rendertarget(IDWriteFactory7 *factory, HDC hdc, UINT32 wid
*ret = NULL;
target = heap_alloc(sizeof(struct rendertarget));
if (!target) return E_OUTOFMEMORY;
if (!(target = malloc(sizeof(*target))))
return E_OUTOFMEMORY;
target->IDWriteBitmapRenderTarget1_iface.lpVtbl = &rendertargetvtbl;
target->ID2D1SimplifiedGeometrySink_iface.lpVtbl = &rendertargetsinkvtbl;
......@@ -671,7 +671,7 @@ static ULONG WINAPI gdiinterop_Release(IDWriteGdiInterop1 *iface)
{
IDWriteFactory7_UnregisterFontFileLoader(interop->factory, &interop->IDWriteFontFileLoader_iface);
factory_detach_gdiinterop(interop->factory, iface);
heap_free(interop);
free(interop);
}
return refcount;
......@@ -795,12 +795,12 @@ static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop1 *iface
return E_FAIL;
}
fileinfo = heap_alloc(needed);
if (!fileinfo)
if (!(fileinfo = malloc(needed)))
return E_OUTOFMEMORY;
if (!GetFontFileInfo(info.instance_id, 0, fileinfo, needed, &needed)) {
heap_free(fileinfo);
if (!GetFontFileInfo(info.instance_id, 0, fileinfo, needed, &needed))
{
free(fileinfo);
return E_FAIL;
}
......@@ -810,7 +810,7 @@ static HRESULT WINAPI gdiinterop_CreateFontFaceFromHdc(IDWriteGdiInterop1 *iface
hr = IDWriteFactory7_CreateCustomFontFileReference(interop->factory, &info.instance_id,
sizeof(info.instance_id), &interop->IDWriteFontFileLoader_iface, &file);
heap_free(fileinfo);
free(fileinfo);
if (FAILED(hr))
return hr;
......@@ -962,7 +962,7 @@ static ULONG WINAPI memresourcestream_Release(IDWriteFontFileStream *iface)
TRACE("%p, refcount %d.\n", iface, refcount);
if (!refcount)
heap_free(stream);
free(stream);
return refcount;
}
......@@ -986,7 +986,7 @@ static HRESULT WINAPI memresourcestream_ReadFileFragment(IDWriteFontFileStream *
if ((offset >= fileinfo.size.QuadPart - 1) || (fragment_size > fileinfo.size.QuadPart - offset))
return E_INVALIDARG;
if (!(fragment = heap_alloc(fragment_size)))
if (!(fragment = malloc(fragment_size)))
return E_OUTOFMEMORY;
if (!GetFontFileData(stream->key, 0, offset, fragment, fragment_size))
......@@ -1000,7 +1000,7 @@ static void WINAPI memresourcestream_ReleaseFileFragment(IDWriteFontFileStream *
{
TRACE("%p, %p.\n", iface, fragment_context);
heap_free(fragment_context);
free(fragment_context);
}
static HRESULT WINAPI memresourcestream_GetFileSize(IDWriteFontFileStream *iface, UINT64 *size)
......@@ -1073,7 +1073,7 @@ static HRESULT WINAPI memresourceloader_CreateStreamFromKey(IDWriteFontFileLoade
if (!key || key_size != sizeof(DWORD))
return E_INVALIDARG;
if (!(stream = heap_alloc(sizeof(*stream))))
if (!(stream = malloc(sizeof(*stream))))
return E_OUTOFMEMORY;
stream->IDWriteFontFileStream_iface.lpVtbl = &memresourcestreamvtbl;
......@@ -1099,7 +1099,7 @@ HRESULT create_gdiinterop(IDWriteFactory7 *factory, IDWriteGdiInterop1 **ret)
*ret = NULL;
if (!(interop = heap_alloc(sizeof(*interop))))
if (!(interop = malloc(sizeof(*interop))))
return E_OUTOFMEMORY;
interop->IDWriteGdiInterop1_iface.lpVtbl = &gdiinteropvtbl;
......
......@@ -113,7 +113,7 @@ static ULONG WINAPI renderingparams_Release(IDWriteRenderingParams3 *iface)
TRACE("%p, refcount %d.\n", iface, refcount);
if (!refcount)
heap_free(params);
free(params);
return refcount;
}
......@@ -235,7 +235,7 @@ static HRESULT create_renderingparams(float gamma, float contrast, float graysca
if ((UINT32)gridfit > DWRITE_GRID_FIT_MODE_ENABLED || (UINT32)geometry > DWRITE_PIXEL_GEOMETRY_BGR)
return E_INVALIDARG;
if (!(object = heap_alloc(sizeof(*object))))
if (!(object = malloc(sizeof(*object))))
return E_OUTOFMEMORY;
object->IDWriteRenderingParams3_iface.lpVtbl = &renderingparamsvtbl;
......@@ -312,12 +312,12 @@ static ULONG WINAPI localizedstrings_Release(IDWriteLocalizedStrings *iface)
{
for (i = 0; i < strings->count; ++i)
{
heap_free(strings->data[i].locale);
heap_free(strings->data[i].string);
free(strings->data[i].locale);
free(strings->data[i].string);
}
heap_free(strings->data);
heap_free(strings);
free(strings->data);
free(strings);
}
return refcount;
......@@ -449,8 +449,7 @@ HRESULT create_localizedstrings(IDWriteLocalizedStrings **strings)
*strings = NULL;
object = heap_alloc_zero(sizeof(*object));
if (!object)
if (!(object = calloc(1, sizeof(*object))))
return E_OUTOFMEMORY;
object->IDWriteLocalizedStrings_iface.lpVtbl = &localizedstringsvtbl;
......@@ -477,12 +476,12 @@ HRESULT add_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *locale,
if (!dwrite_array_reserve((void **)&strings->data, &strings->size, strings->count + 1, sizeof(*strings->data)))
return E_OUTOFMEMORY;
strings->data[count].locale = heap_strdupW(locale);
strings->data[count].string = heap_strdupW(string);
strings->data[count].locale = wcsdup(locale);
strings->data[count].string = wcsdup(string);
if (!strings->data[count].locale || !strings->data[count].string)
{
heap_free(strings->data[count].locale);
heap_free(strings->data[count].string);
free(strings->data[count].locale);
free(strings->data[count].string);
return E_OUTOFMEMORY;
}
wcslwr(strings->data[count].locale);
......@@ -503,14 +502,13 @@ HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLocalizedS
return S_FALSE;
strings = impl_from_IDWriteLocalizedStrings(iface);
strings_clone = heap_alloc_zero(sizeof(*strings_clone));
if (!strings_clone)
if (!(strings_clone = calloc(1, sizeof(*strings_clone))))
return E_OUTOFMEMORY;
if (!dwrite_array_reserve((void **)&strings_clone->data, &strings_clone->size, strings->count,
sizeof(*strings_clone->data)))
{
heap_free(strings_clone);
free(strings_clone);
return E_OUTOFMEMORY;
}
......@@ -520,8 +518,8 @@ HRESULT clone_localizedstrings(IDWriteLocalizedStrings *iface, IDWriteLocalizedS
for (i = 0; i < strings_clone->count; ++i)
{
strings_clone->data[i].locale = heap_strdupW(strings->data[i].locale);
strings_clone->data[i].string = heap_strdupW(strings->data[i].string);
strings_clone->data[i].locale = wcsdup(strings->data[i].locale);
strings_clone->data[i].string = wcsdup(strings->data[i].string);
}
*ret = &strings_clone->IDWriteLocalizedStrings_iface;
......@@ -538,8 +536,8 @@ void set_en_localizedstring(IDWriteLocalizedStrings *iface, const WCHAR *string)
{
if (!wcsicmp(strings->data[i].locale, L"en-US"))
{
heap_free(strings->data[i].string);
strings->data[i].string = heap_strdupW(string);
free(strings->data[i].string);
strings->data[i].string = wcsdup(string);
break;
}
}
......@@ -622,7 +620,7 @@ static void release_fontface_cache(struct list *fontfaces)
LIST_FOR_EACH_ENTRY_SAFE(fontface, fontface2, fontfaces, struct fontfacecached, entry) {
list_remove(&fontface->entry);
fontface_detach_from_cache(fontface->fontface);
heap_free(fontface);
free(fontface);
}
}
......@@ -631,7 +629,7 @@ static void release_fileloader(struct fileloader *fileloader)
list_remove(&fileloader->entry);
release_fontface_cache(&fileloader->fontfaces);
IDWriteFontFileLoader_Release(fileloader->loader);
heap_free(fileloader);
free(fileloader);
}
static void release_dwritefactory(struct dwritefactory *factory)
......@@ -646,7 +644,7 @@ static void release_dwritefactory(struct dwritefactory *factory)
LIST_FOR_EACH_ENTRY_SAFE(loader, loader2, &factory->collection_loaders, struct collectionloader, entry) {
list_remove(&loader->entry);
IDWriteFontCollectionLoader_Release(loader->loader);
heap_free(loader);
free(loader);
}
LIST_FOR_EACH_ENTRY_SAFE(fileloader, fileloader2, &factory->file_loaders, struct fileloader, entry)
......@@ -661,7 +659,7 @@ static void release_dwritefactory(struct dwritefactory *factory)
factory->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection(&factory->cs);
heap_free(factory);
free(factory);
}
static void release_shared_factory(IDWriteFactory7 *iface)
......@@ -820,8 +818,7 @@ static HRESULT WINAPI dwritefactory_RegisterFontCollectionLoader(IDWriteFactory7
if (factory_get_collection_loader(factory, loader))
return DWRITE_E_ALREADYREGISTERED;
entry = heap_alloc(sizeof(*entry));
if (!entry)
if (!(entry = malloc(sizeof(*entry))))
return E_OUTOFMEMORY;
entry->loader = loader;
......@@ -848,7 +845,7 @@ static HRESULT WINAPI dwritefactory_UnregisterFontCollectionLoader(IDWriteFactor
IDWriteFontCollectionLoader_Release(found->loader);
list_remove(&found->entry);
heap_free(found);
free(found);
return S_OK;
}
......@@ -871,7 +868,7 @@ static HRESULT WINAPI dwritefactory_CreateFontFileReference(IDWriteFactory7 *ifa
return hr;
hr = create_font_file(factory->localfontfileloader, key, key_size, font_file);
heap_free(key);
free(key);
return hr;
}
......@@ -986,8 +983,7 @@ struct fontfacecached *factory_cache_fontface(IDWriteFactory7 *iface, struct lis
struct fontfacecached *cached;
/* new cache entry */
cached = heap_alloc(sizeof(*cached));
if (!cached)
if (!(cached = malloc(sizeof(*cached))))
return NULL;
cached->fontface = fontface;
......@@ -1128,8 +1124,7 @@ static HRESULT WINAPI dwritefactory_RegisterFontFileLoader(IDWriteFactory7 *ifac
if (factory_get_file_loader(factory, loader))
return DWRITE_E_ALREADYREGISTERED;
entry = heap_alloc(sizeof(*entry));
if (!entry)
if (!(entry = malloc(sizeof(*entry))))
return E_OUTOFMEMORY;
entry->loader = loader;
......@@ -1525,17 +1520,17 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
}
value_size = MAX_PATH * sizeof(*value);
value = heap_alloc(value_size);
value = malloc(value_size);
max_name_count = MAX_PATH;
name = heap_alloc(max_name_count * sizeof(*name));
name = malloc(max_name_count * sizeof(*name));
for (;;)
{
if (!value)
{
value_size = MAX_PATH * sizeof(*value);
value = heap_alloc(value_size);
value = malloc(value_size);
}
do
......@@ -1549,15 +1544,15 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
if (name_count >= max_name_count)
{
max_name_count *= 2;
heap_free(name);
name = heap_alloc(max_name_count * sizeof(*name));
free(name);
name = malloc(max_name_count * sizeof(*name));
}
if (data_size > value_size - sizeof(*value))
{
heap_free(value);
free(value);
value_size = max(data_size + sizeof(*value), value_size * 2);
value = heap_alloc(value_size);
value = malloc(value_size);
}
}
} while (r == ERROR_MORE_DATA);
......@@ -1574,12 +1569,12 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
{
WCHAR *ptrW;
ptrW = heap_alloc((MAX_PATH + wcslen(value)) * sizeof(WCHAR));
ptrW = malloc((MAX_PATH + wcslen(value)) * sizeof(WCHAR));
GetWindowsDirectoryW(ptrW, MAX_PATH);
wcscat(ptrW, L"\\fonts\\");
wcscat(ptrW, value);
heap_free(value);
free(value);
value = ptrW;
}
......@@ -1590,8 +1585,8 @@ static HRESULT create_system_path_list(WCHAR ***ret, unsigned int *ret_count)
index++;
}
heap_free(value);
heap_free(name);
free(value);
free(name);
*ret = paths;
*ret_count = count;
......@@ -1636,8 +1631,8 @@ static HRESULT create_system_fontset(IDWriteFactory7 *factory, REFIID riid, void
}
for (i = 0; i < count; ++i)
heap_free(paths[i]);
heap_free(paths);
free(paths[i]);
free(paths);
}
if (SUCCEEDED(hr = IDWriteFontSetBuilder2_CreateFontSet(builder, &fontset)))
......@@ -2075,8 +2070,8 @@ HRESULT WINAPI DWriteCreateFactory(DWRITE_FACTORY_TYPE type, REFIID riid, IUnkno
if (type == DWRITE_FACTORY_TYPE_SHARED && shared_factory)
return IDWriteFactory7_QueryInterface(shared_factory, riid, (void**)ret);
factory = heap_alloc(sizeof(struct dwritefactory));
if (!factory) return E_OUTOFMEMORY;
if (!(factory = calloc(1, sizeof(*factory))))
return E_OUTOFMEMORY;
init_dwritefactory(factory, type);
......
......@@ -2332,7 +2332,7 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns
if (codepage)
{
DWORD len = MultiByteToWideChar(codepage, 0, name, length, NULL, 0);
name_string = heap_alloc(sizeof(WCHAR) * (len+1));
name_string = malloc(sizeof(WCHAR) * (len+1));
MultiByteToWideChar(codepage, 0, name, length, name_string, len);
name_string[len] = 0;
}
......@@ -2346,7 +2346,7 @@ static BOOL opentype_decode_namerecord(const struct dwrite_fonttable *table, uns
TRACE("string %s for locale %s found\n", debugstr_w(name_string), debugstr_w(locale));
add_localizedstring(strings, locale, name_string);
heap_free(name_string);
free(name_string);
ret = !wcscmp(locale, L"en-US");
}
......@@ -2507,9 +2507,9 @@ static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc
if ((data = table_read_ensure(&meta, GET_BE_DWORD(maps[i].offset), length)))
{
WCHAR *ptrW = heap_alloc((length + 1) * sizeof(WCHAR)), *ctx, *token;
WCHAR *ptrW, *ctx, *token;
if (!ptrW)
if (!(ptrW = malloc((length + 1) * sizeof(WCHAR))))
{
hr = E_OUTOFMEMORY;
goto end;
......@@ -2528,7 +2528,7 @@ static HRESULT opentype_get_font_strings_from_meta(const struct file_stream_desc
token = meta_get_lng_name(NULL, &ctx);
}
heap_free(ptrW);
free(ptrW);
}
}
}
......@@ -2644,13 +2644,13 @@ HRESULT opentype_get_font_facename(struct file_stream_desc *stream_desc, WCHAR *
WCHAR *nameW;
IDWriteLocalizedStrings_GetStringLength(lfnames, index, &length);
nameW = heap_alloc((length + 1) * sizeof(WCHAR));
nameW = malloc((length + 1) * sizeof(WCHAR));
if (nameW)
{
*nameW = 0;
IDWriteLocalizedStrings_GetString(lfnames, index, nameW, length + 1);
lstrcpynW(lfname, nameW, LF_FACESIZE);
heap_free(nameW);
free(nameW);
}
}
......@@ -4880,7 +4880,7 @@ void opentype_layout_apply_gpos_features(struct scriptshaping_context *context,
}
}
heap_free(lookups.lookups);
free(lookups.lookups);
if (context->has_gpos_attachment)
{
......@@ -4955,11 +4955,11 @@ static BOOL opentype_layout_gsub_ensure_buffer(struct scriptshaping_context *con
new_capacity = context->u.subst.capacity * 2;
if ((glyphs = heap_realloc(context->u.subst.glyphs, new_capacity * sizeof(*glyphs))))
if ((glyphs = realloc(context->u.subst.glyphs, new_capacity * sizeof(*glyphs))))
context->u.subst.glyphs = glyphs;
if ((glyph_props = heap_realloc(context->u.subst.glyph_props, new_capacity * sizeof(*glyph_props))))
if ((glyph_props = realloc(context->u.subst.glyph_props, new_capacity * sizeof(*glyph_props))))
context->u.subst.glyph_props = glyph_props;
if ((glyph_infos = heap_realloc(context->glyph_infos, new_capacity * sizeof(*glyph_infos))))
if ((glyph_infos = realloc(context->glyph_infos, new_capacity * sizeof(*glyph_infos))))
context->glyph_infos = glyph_infos;
if ((ret = (glyphs && glyph_props && glyph_infos)))
......@@ -6110,7 +6110,7 @@ void opentype_layout_apply_gsub_features(struct scriptshaping_context *context,
for (j = context->glyph_infos[start_idx].start_text_idx; j < context->length; ++j)
context->u.buffer.clustermap[j] = start_idx;
heap_free(lookups.lookups);
free(lookups.lookups);
}
static BOOL opentype_layout_contextual_lookup_is_glyph_covered(struct scriptshaping_context *context, UINT16 glyph,
......@@ -6339,7 +6339,7 @@ BOOL opentype_layout_check_feature(struct scriptshaping_context *context, unsign
break;
}
heap_free(lookups.lookups);
free(lookups.lookups);
return ret;
}
......@@ -6396,7 +6396,7 @@ BOOL opentype_has_vertical_variants(struct dwrite_fontface *fontface)
}
}
heap_free(lookups.lookups);
free(lookups.lookups);
if (count)
fontface->flags |= FONTFACE_VERTICAL_VARIANTS;
......@@ -6422,10 +6422,10 @@ HRESULT opentype_get_vertical_glyph_variants(struct dwrite_fontface *fontface, u
context.cache = fontface_get_shaping_cache(fontface);
context.u.subst.glyphs = glyphs;
context.u.subst.glyph_props = heap_calloc(glyph_count, sizeof(*context.u.subst.glyph_props));
context.u.subst.glyph_props = calloc(glyph_count, sizeof(*context.u.subst.glyph_props));
context.u.subst.max_glyph_count = glyph_count;
context.u.subst.capacity = glyph_count;
context.glyph_infos = heap_alloc_zero(sizeof(*context.glyph_infos) * glyph_count);
context.glyph_infos = calloc(glyph_count, sizeof(*context.glyph_infos));
context.table = &context.cache->gsub;
vert_feature.tag = DWRITE_MAKE_OPENTYPE_TAG('v','e','r','t');
......@@ -6456,9 +6456,9 @@ HRESULT opentype_get_vertical_glyph_variants(struct dwrite_fontface *fontface, u
}
}
heap_free(context.u.subst.glyph_props);
heap_free(context.glyph_infos);
heap_free(lookups.lookups);
free(context.u.subst.glyph_props);
free(context.glyph_infos);
free(lookups.lookups);
return S_OK;
}
......
......@@ -44,8 +44,7 @@ struct scriptshaping_cache *create_scriptshaping_cache(void *context, const stru
{
struct scriptshaping_cache *cache;
cache = heap_alloc_zero(sizeof(*cache));
if (!cache)
if (!(cache = calloc(1, sizeof(*cache))))
return NULL;
cache->font = font_ops;
......@@ -65,7 +64,7 @@ void release_scriptshaping_cache(struct scriptshaping_cache *cache)
cache->font->release_font_table(cache->context, cache->gdef.table.context);
cache->font->release_font_table(cache->context, cache->gsub.table.context);
cache->font->release_font_table(cache->context, cache->gpos.table.context);
heap_free(cache);
free(cache);
}
static unsigned int shape_select_script(const struct scriptshaping_cache *cache, DWORD kind, const DWORD *scripts,
......@@ -269,7 +268,7 @@ HRESULT shape_get_positions(struct scriptshaping_context *context, const unsigne
if (context->u.pos.glyph_props[i].isZeroWidthSpace)
context->advances[i] = 0.0f;
heap_free(features.features);
free(features.features);
return S_OK;
}
......@@ -347,7 +346,7 @@ HRESULT shape_get_glyphs(struct scriptshaping_context *context, const unsigned i
shape_get_script_lang_index(context, scripts, MS_GSUB_TAG, &script_index, &language_index);
opentype_layout_apply_gsub_features(context, script_index, language_index, &features);
heap_free(features.features);
free(features.features);
return (context->glyph_count <= context->u.subst.max_glyph_count) ? S_OK : E_NOT_SUFFICIENT_BUFFER;
}
......@@ -393,7 +392,7 @@ HRESULT shape_get_typographic_features(struct scriptshaping_context *context, co
*actual_tagcount = t.count;
heap_free(t.tags);
free(t.tags);
return t.count <= max_tagcount ? S_OK : E_NOT_SUFFICIENT_BUFFER;
}
......
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