diff --git a/source/blender/blenfont/intern/blf_font.cc b/source/blender/blenfont/intern/blf_font.cc index 7c4d49cfce0..5732fc0ece0 100644 --- a/source/blender/blenfont/intern/blf_font.cc +++ b/source/blender/blenfont/intern/blf_font.cc @@ -1839,8 +1839,7 @@ static bool blf_setup_face(FontBLF *font) if (FT_HAS_KERNING(font) && !font->kerning_cache) { /* Create kerning cache table and fill with value indicating "unset". */ - font->kerning_cache = static_cast( - MEM_mallocN(sizeof(KerningCacheBLF), __func__)); + font->kerning_cache = MEM_mallocN(__func__); for (uint i = 0; i < KERNING_CACHE_TABLE_SIZE; i++) { for (uint j = 0; j < KERNING_CACHE_TABLE_SIZE; j++) { font->kerning_cache->ascii_table[i][j] = KERNING_ENTRY_UNSET; diff --git a/source/blender/blenfont/intern/blf_glyph.cc b/source/blender/blenfont/intern/blf_glyph.cc index cf7bf82f0f4..d9964464e25 100644 --- a/source/blender/blenfont/intern/blf_glyph.cc +++ b/source/blender/blenfont/intern/blf_glyph.cc @@ -267,7 +267,7 @@ static GlyphBLF *blf_glyph_cache_add_glyph( } const int buffer_size = g->dims[0] * g->dims[1] * g->num_channels; - g->bitmap = static_cast(MEM_mallocN(size_t(buffer_size), "glyph bitmap")); + g->bitmap = MEM_malloc_arrayN(size_t(buffer_size), "glyph bitmap"); if (ELEM(glyph->bitmap.pixel_mode, FT_PIXEL_MODE_GRAY, @@ -416,7 +416,7 @@ static GlyphBLF *blf_glyph_cache_add_svg( g->num_channels = color ? 4 : 1; const int buffer_size = g->dims[0] * g->dims[1] * g->num_channels; - g->bitmap = static_cast(MEM_mallocN(size_t(buffer_size), "glyph bitmap")); + g->bitmap = MEM_malloc_arrayN(size_t(buffer_size), "glyph bitmap"); if (color) { memcpy(g->bitmap, render_bmp.data(), size_t(buffer_size)); @@ -1678,8 +1678,7 @@ static void blf_glyph_to_curves(const FT_Outline &ftoutline, int contour_prev; /* Start converting the FT data */ - int *onpoints = static_cast( - MEM_callocN(size_t(ftoutline.n_contours) * sizeof(int), "onpoints")); + int *onpoints = MEM_calloc_arrayN(size_t(ftoutline.n_contours), "onpoints"); /* Get number of on-curve points for bezier-triples (including conic virtual on-points). */ for (j = 0, contour_prev = -1; j < ftoutline.n_contours; j++) { @@ -1713,9 +1712,8 @@ static void blf_glyph_to_curves(const FT_Outline &ftoutline, contour_prev = ftoutline.contours[j]; /* add new curve */ - nu = (Nurb *)MEM_callocN(sizeof(Nurb), "objfnt_nurb"); - bezt = static_cast( - MEM_callocN(size_t(onpoints[j]) * sizeof(BezTriple), "objfnt_bezt")); + nu = MEM_callocN("objfnt_nurb"); + bezt = MEM_calloc_arrayN(size_t(onpoints[j]), "objfnt_bezt"); BLI_addtail(nurbsbase, nu); nu->type = CU_BEZIER; diff --git a/source/blender/blentranslation/intern/blt_lang.cc b/source/blender/blentranslation/intern/blt_lang.cc index b6c8074e25d..3a3e7a04045 100644 --- a/source/blender/blentranslation/intern/blt_lang.cc +++ b/source/blender/blentranslation/intern/blt_lang.cc @@ -103,13 +103,12 @@ static void fill_locales() num_locales_menu++; /* The "closing" void item... */ /* And now, build locales and locale_menu! */ - locales_menu = static_cast( - MEM_callocN(num_locales_menu * sizeof(EnumPropertyItem), __func__)); + locales_menu = MEM_calloc_arrayN(size_t(num_locales_menu), __func__); line = lines; /* Do not allocate locales with zero-sized mem, * as LOCALE macro uses nullptr locales as invalid marker! */ if (num_locales > 0) { - locales = static_cast(MEM_callocN(num_locales * sizeof(char *), __func__)); + locales = MEM_calloc_arrayN(size_t(num_locales), __func__); while (line) { const char *loc, *sep1, *sep2, *sep3;