From 49bf7ebbdddc07b50d4eccbe62bc0fbbb5e9f2cd Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 15 Apr 2024 09:44:27 +1000 Subject: [PATCH] Cleanup: use const args & variables, remove redundant checks - Declare const variables & arguments. - Remove redundant null checks. - Remove break after return. - Replace suspicious "&" with "&&". --- source/blender/blenfont/BLF_api.hh | 4 +-- source/blender/blenfont/intern/blf.cc | 2 +- source/blender/blenfont/intern/blf_font.cc | 25 +++++++++---------- source/blender/blenfont/intern/blf_glyph.cc | 21 ++++++++++------ .../blender/blenfont/intern/blf_internal.hh | 2 +- source/blender/blenlib/intern/BLI_filelist.cc | 4 +-- source/blender/blenlib/intern/BLI_memarena.c | 7 ++---- source/blender/blenlib/intern/BLI_mempool.c | 3 ++- source/blender/blenlib/intern/BLI_mmap.c | 2 +- source/blender/blenlib/intern/array_store.cc | 6 ++--- source/blender/blenlib/intern/buffer.c | 2 +- .../blender/blenlib/intern/mesh_intersect.cc | 2 +- .../blentranslation/intern/blt_lang.cc | 5 ++-- source/blender/datatoc/datatoc_icon.cc | 2 +- source/blender/draw/intern/draw_debug.cc | 4 +-- .../editors/gpencil_legacy/annotate_paint.cc | 2 +- .../blender/imbuf/intern/colormanagement.cc | 3 +-- source/blender/imbuf/intern/jp2.cc | 2 +- source/blender/imbuf/intern/readimage.cc | 3 +-- source/blender/makesdna/intern/dna_genfile.cc | 2 +- .../modifiers/intern/MOD_meshdeform.cc | 4 +-- 21 files changed, 54 insertions(+), 53 deletions(-) diff --git a/source/blender/blenfont/BLF_api.hh b/source/blender/blenfont/BLF_api.hh index 2b644705376..eeb13b17937 100644 --- a/source/blender/blenfont/BLF_api.hh +++ b/source/blender/blenfont/BLF_api.hh @@ -93,7 +93,7 @@ bool BLF_has_glyph(int fontid, unsigned int unicode) ATTR_WARN_UNUSED_RESULT; /** * Attach a file with metrics information from memory. */ -void BLF_metrics_attach(int fontid, unsigned char *mem, int mem_size) ATTR_NONNULL(2); +void BLF_metrics_attach(int fontid, const unsigned char *mem, int mem_size) ATTR_NONNULL(2); void BLF_aspect(int fontid, float x, float y, float z); void BLF_position(int fontid, float x, float y, float z); @@ -208,7 +208,7 @@ size_t BLF_width_to_rstrlen(int fontid, void BLF_boundbox(int fontid, const char *str, size_t str_len, - rcti *box, + rcti *r_box, ResultBLF *r_info = nullptr) ATTR_NONNULL(2); /** diff --git a/source/blender/blenfont/intern/blf.cc b/source/blender/blenfont/intern/blf.cc index e5a4e83d4e9..6c224d2cae1 100644 --- a/source/blender/blenfont/intern/blf.cc +++ b/source/blender/blenfont/intern/blf.cc @@ -214,7 +214,7 @@ int BLF_load_unique(const char *filepath) return i; } -void BLF_metrics_attach(int fontid, uchar *mem, int mem_size) +void BLF_metrics_attach(const int fontid, const uchar *mem, const int mem_size) { FontBLF *font = blf_get(fontid); diff --git a/source/blender/blenfont/intern/blf_font.cc b/source/blender/blenfont/intern/blf_font.cc index 74700b5ff27..985a0ffbc5f 100644 --- a/source/blender/blenfont/intern/blf_font.cc +++ b/source/blender/blenfont/intern/blf_font.cc @@ -709,7 +709,7 @@ static bool blf_font_width_to_strlen_glyph_process(FontBLF *font, return false; } - if (g && pen_x && !(font->flags & BLF_MONOSPACED)) { + if (!(font->flags & BLF_MONOSPACED)) { *pen_x += blf_kerning(font, g_prev, g); #ifdef BLF_SUBPIXEL_POSITION @@ -953,7 +953,7 @@ float blf_font_height(FontBLF *font, const char *str, const size_t str_len, Resu float blf_font_fixed_width(FontBLF *font) { - GlyphCacheBLF *gc = blf_glyph_cache_acquire(font); + const GlyphCacheBLF *gc = blf_glyph_cache_acquire(font); float width = (gc) ? float(gc->fixed_width) : font->size / 2.0f; blf_glyph_cache_release(font); return width; @@ -1226,15 +1226,15 @@ static void blf_font_boundbox_wrap_cb(FontBLF *font, BLI_rcti_union(box, &box_single); } void blf_font_boundbox__wrap( - FontBLF *font, const char *str, const size_t str_len, rcti *box, ResultBLF *r_info) + FontBLF *font, const char *str, const size_t str_len, rcti *r_box, ResultBLF *r_info) { - box->xmin = 32000; - box->xmax = -32000; - box->ymin = 32000; - box->ymax = -32000; + r_box->xmin = 32000; + r_box->xmax = -32000; + r_box->ymin = 32000; + r_box->ymax = -32000; blf_font_wrap_apply( - font, str, str_len, font->wrap_width, r_info, blf_font_boundbox_wrap_cb, box); + font, str, str_len, font->wrap_width, r_info, blf_font_boundbox_wrap_cb, r_box); } /** Utility for #blf_font_draw_buffer__wrap. */ @@ -1444,7 +1444,7 @@ static void blf_font_metrics(FT_Face face, FontMetrics *metrics) metrics->weight = 400; metrics->width = 1.0f; - TT_OS2 *os2_table = (TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2); + const TT_OS2 *os2_table = (const TT_OS2 *)FT_Get_Sfnt_Table(face, FT_SFNT_OS2); if (os2_table) { /* The default (resting) font weight. */ if (os2_table->usWeightClass >= 1 && os2_table->usWeightClass <= 1000) { @@ -1503,7 +1503,7 @@ static void blf_font_metrics(FT_Face face, FontMetrics *metrics) } /* The Post table usually contains a slant value, but in counter-clockwise degrees. */ - TT_Postscript *post_table = (TT_Postscript *)FT_Get_Sfnt_Table(face, FT_SFNT_POST); + const TT_Postscript *post_table = (const TT_Postscript *)FT_Get_Sfnt_Table(face, FT_SFNT_POST); if (post_table) { if (post_table->italicAngle != 0) { metrics->slant = float(post_table->italicAngle) / -65536.0f; @@ -1787,10 +1787,9 @@ static FontBLF *blf_font_new_impl(const char *filepath, blf_font_fill(font); if (ft_library && ((FT_Library)ft_library != ft_lib)) { - font->ft_lib = (FT_Library)ft_library; + /* Pass. */ } else { - font->ft_lib = ft_lib; font->flags |= BLF_CACHED; } @@ -1821,7 +1820,7 @@ static FontBLF *blf_font_new_impl(const char *filepath, } /* Save TrueType table with bits to quickly test most unicode block coverage. */ - TT_OS2 *os2_table = (TT_OS2 *)FT_Get_Sfnt_Table(font->face, FT_SFNT_OS2); + const TT_OS2 *os2_table = (const TT_OS2 *)FT_Get_Sfnt_Table(font->face, FT_SFNT_OS2); if (os2_table) { font->unicode_ranges[0] = uint(os2_table->ulUnicodeRange1); font->unicode_ranges[1] = uint(os2_table->ulUnicodeRange2); diff --git a/source/blender/blenfont/intern/blf_glyph.cc b/source/blender/blenfont/intern/blf_glyph.cc index 7a328fb4b38..471b0efe046 100644 --- a/source/blender/blenfont/intern/blf_glyph.cc +++ b/source/blender/blenfont/intern/blf_glyph.cc @@ -881,7 +881,6 @@ static const FT_Var_Axis *blf_var_axis_by_tag(const FT_MM_Var *variations, if (variations->axis[i].tag == tag) { *r_axis_index = i; return &(variations->axis)[i]; - break; } } return nullptr; @@ -1152,7 +1151,7 @@ static bool blf_glyph_transform_monospace(FT_GlyphSlot glyph, int width) { if (glyph->format == FT_GLYPH_FORMAT_OUTLINE) { FT_Fixed current = glyph->linearHoriAdvance; - FT_Fixed target = width << 16; /* Do math in 16.16 values. */ + FT_Fixed target = FT_Fixed(width) << 16; /* Do math in 16.16 values. */ if (target < current) { const FT_Pos embolden = (FT_Pos)((current - target) >> 13); /* Horizontally widen strokes to counteract narrowing. */ @@ -1362,7 +1361,7 @@ static void blf_glyph_calc_rect_shadow( /** \name Glyph Drawing * \{ */ -static void blf_texture_draw(GlyphBLF *g, +static void blf_texture_draw(const GlyphBLF *g, const uchar color[4], const int glyph_size[2], const int x1, @@ -1390,8 +1389,12 @@ static void blf_texture_draw(GlyphBLF *g, } } -static void blf_texture5_draw( - GlyphBLF *g, const uchar color_in[4], const int x1, const int y1, const int x2, const int y2) +static void blf_texture5_draw(const GlyphBLF *g, + const uchar color_in[4], + const int x1, + const int y1, + const int x2, + const int y2) { int glyph_size_flag[2]; /* flag the x and y component signs for 5x5 blurring */ @@ -1401,8 +1404,12 @@ static void blf_texture5_draw( blf_texture_draw(g, color_in, glyph_size_flag, x1, y1, x2, y2); } -static void blf_texture3_draw( - GlyphBLF *g, const uchar color_in[4], const int x1, const int y1, const int x2, const int y2) +static void blf_texture3_draw(const GlyphBLF *g, + const uchar color_in[4], + const int x1, + const int y1, + const int x2, + const int y2) { int glyph_size_flag[2]; /* flag the x component sign for 3x3 blurring */ diff --git a/source/blender/blenfont/intern/blf_internal.hh b/source/blender/blenfont/intern/blf_internal.hh index 88de4fd7590..0756bd60ca2 100644 --- a/source/blender/blenfont/intern/blf_internal.hh +++ b/source/blender/blenfont/intern/blf_internal.hh @@ -81,7 +81,7 @@ void blf_draw_buffer__start(FontBLF *font); void blf_draw_buffer__end(); FontBLF *blf_font_new_from_filepath(const char *filepath); -FontBLF *blf_font_new_from_mem(const char *name, const unsigned char *mem, size_t mem_size); +FontBLF *blf_font_new_from_mem(const char *mem_name, const unsigned char *mem, size_t mem_size); void blf_font_attach_from_mem(FontBLF *font, const unsigned char *mem, size_t mem_size); /** diff --git a/source/blender/blenlib/intern/BLI_filelist.cc b/source/blender/blenlib/intern/BLI_filelist.cc index 0dee9390d34..7d098fe650f 100644 --- a/source/blender/blenlib/intern/BLI_filelist.cc +++ b/source/blender/blenlib/intern/BLI_filelist.cc @@ -329,7 +329,7 @@ void BLI_filelist_entry_owner_to_string(const struct stat *st, UNUSED_VARS(st); BLI_strncpy(r_owner, "unknown", FILELIST_DIRENTRY_OWNER_LEN); #else - passwd *pwuser = getpwuid(st->st_uid); + const passwd *pwuser = getpwuid(st->st_uid); if (pwuser) { BLI_strncpy(r_owner, pwuser->pw_name, sizeof(*r_owner) * FILELIST_DIRENTRY_OWNER_LEN); @@ -422,7 +422,7 @@ void BLI_filelist_duplicate(direntry **dest_filelist, *dest_filelist = static_cast( MEM_mallocN(sizeof(**dest_filelist) * size_t(nrentries), __func__)); for (i = 0; i < nrentries; i++) { - direntry *const src = &src_filelist[i]; + const direntry *src = &src_filelist[i]; direntry *dst = &(*dest_filelist)[i]; BLI_filelist_entry_duplicate(dst, src); } diff --git a/source/blender/blenlib/intern/BLI_memarena.c b/source/blender/blenlib/intern/BLI_memarena.c index c5d868de1b0..3f5f86316c1 100644 --- a/source/blender/blenlib/intern/BLI_memarena.c +++ b/source/blender/blenlib/intern/BLI_memarena.c @@ -210,20 +210,17 @@ void BLI_memarena_merge(MemArena *ma_dst, MemArena *ma_src) void BLI_memarena_clear(MemArena *ma) { if (ma->bufs) { - uchar *curbuf_prev; - size_t curbuf_used; - if (ma->bufs->next) { memarena_buf_free_all(ma->bufs->next); ma->bufs->next = NULL; } - curbuf_prev = ma->curbuf; + const uchar *curbuf_prev = ma->curbuf; ma->curbuf = ma->bufs->data; memarena_curbuf_align(ma); /* restore to original size */ - curbuf_used = (size_t)(curbuf_prev - ma->curbuf); + const size_t curbuf_used = (size_t)(curbuf_prev - ma->curbuf); ma->cursize += curbuf_used; if (ma->use_calloc) { diff --git a/source/blender/blenlib/intern/BLI_mempool.c b/source/blender/blenlib/intern/BLI_mempool.c index 610c39176ed..fb5cb82adf1 100644 --- a/source/blender/blenlib/intern/BLI_mempool.c +++ b/source/blender/blenlib/intern/BLI_mempool.c @@ -618,7 +618,8 @@ void BLI_mempool_as_array(BLI_mempool *pool, void *data) { const uint esize = pool->esize - (uint)POISON_REDZONE_SIZE; BLI_mempool_iter iter; - char *elem, *p = data; + const char *elem; + char *p = data; BLI_assert(pool->flag & BLI_MEMPOOL_ALLOW_ITER); diff --git a/source/blender/blenlib/intern/BLI_mmap.c b/source/blender/blenlib/intern/BLI_mmap.c index bc19876a84f..bd6bf889269 100644 --- a/source/blender/blenlib/intern/BLI_mmap.c +++ b/source/blender/blenlib/intern/BLI_mmap.c @@ -63,7 +63,7 @@ static void sigbus_handler(int sig, siginfo_t *siginfo, void *ptr) /* We only handle SIGBUS here for now. */ BLI_assert(sig == SIGBUS); - char *error_addr = (char *)siginfo->si_addr; + const char *error_addr = (const char *)siginfo->si_addr; /* Find the file that this error belongs to. */ LISTBASE_FOREACH (LinkData *, link, &error_handler.open_mmaps) { BLI_mmap_file *file = link->data; diff --git a/source/blender/blenlib/intern/array_store.cc b/source/blender/blenlib/intern/array_store.cc index 6f7dcf03a4d..a0a863c10eb 100644 --- a/source/blender/blenlib/intern/array_store.cc +++ b/source/blender/blenlib/intern/array_store.cc @@ -982,7 +982,7 @@ static const BChunkRef *table_lookup(const BArrayInfo *info, if (cref->link->key == key) # endif { - BChunk *chunk_test = cref->link; + const BChunk *chunk_test = cref->link; if (chunk_test->data_len <= size_left) { if (bchunk_data_compare_unchecked(chunk_test, data, data_len, offset)) { /* We could remove the chunk from the table, to avoid multiple hits. */ @@ -1176,7 +1176,7 @@ static BChunkList *bchunk_list_from_data_merge(const BArrayInfo *info, while ((cref->prev != nullptr) && (cref != cref_match_first) && (cref->link->data_len <= data_len - i_prev)) { - BChunk *chunk_test = cref->link; + const BChunk *chunk_test = cref->link; size_t offset = data_len - chunk_test->data_len; if (bchunk_data_compare(chunk_test, data, data_len, offset)) { data_len = offset; @@ -1607,7 +1607,7 @@ size_t BLI_array_store_calc_size_compacted_get(const BArrayStore *bs) { size_t size_total = 0; BLI_mempool_iter iter; - BChunk *chunk; + const BChunk *chunk; BLI_mempool_iternew(bs->memory.chunk, &iter); while ((chunk = static_cast(BLI_mempool_iterstep(&iter)))) { BLI_assert(chunk->users > 0); diff --git a/source/blender/blenlib/intern/buffer.c b/source/blender/blenlib/intern/buffer.c index 61a4c71637d..5519a5bc418 100644 --- a/source/blender/blenlib/intern/buffer.c +++ b/source/blender/blenlib/intern/buffer.c @@ -52,7 +52,7 @@ void BLI_buffer_resize(BLI_Buffer *buffer, const size_t new_count) { if (UNLIKELY(new_count > buffer->alloc_count)) { if (buffer->flag & BLI_BUFFER_USE_STATIC) { - void *orig = buffer->data; + const void *orig = buffer->data; buffer->data = buffer_alloc(buffer, new_count); memcpy(buffer->data, orig, buffer->elem_size * buffer->count); diff --git a/source/blender/blenlib/intern/mesh_intersect.cc b/source/blender/blenlib/intern/mesh_intersect.cc index f9b0b5688f6..aa2f65f9aaa 100644 --- a/source/blender/blenlib/intern/mesh_intersect.cc +++ b/source/blender/blenlib/intern/mesh_intersect.cc @@ -2311,7 +2311,7 @@ static bool bvhtreeverlap_cmp(const BVHTreeOverlap &a, const BVHTreeOverlap &b) if (a.indexA < b.indexA) { return true; } - if ((a.indexA == b.indexA) & (a.indexB < b.indexB)) { + if ((a.indexA == b.indexA) && (a.indexB < b.indexB)) { return true; } return false; diff --git a/source/blender/blentranslation/intern/blt_lang.cc b/source/blender/blentranslation/intern/blt_lang.cc index 26f0d0cf02a..7a4763a028e 100644 --- a/source/blender/blentranslation/intern/blt_lang.cc +++ b/source/blender/blentranslation/intern/blt_lang.cc @@ -107,8 +107,7 @@ static void fill_locales() if (num_locales > 0) { locales = static_cast(MEM_callocN(num_locales * sizeof(char *), __func__)); while (line) { - int id; - char *loc, *sep1, *sep2, *sep3; + const char *loc, *sep1, *sep2, *sep3; str = (char *)line->link; if (ELEM(str[0], '#', '\0')) { @@ -116,7 +115,7 @@ static void fill_locales() continue; } - id = atoi(str); + const int id = atoi(str); sep1 = strchr(str, ':'); if (sep1) { sep1++; diff --git a/source/blender/datatoc/datatoc_icon.cc b/source/blender/datatoc/datatoc_icon.cc index bc8da0534b3..2749cfe8496 100644 --- a/source/blender/datatoc/datatoc_icon.cc +++ b/source/blender/datatoc/datatoc_icon.cc @@ -241,7 +241,7 @@ static void icon_merge_context_init(IconMergeContext *context) * Is used to check whether icon is re-defined, and to provide useful information about which * files are conflicting. */ static IconInfo *icon_merge_context_info_for_icon_head(IconMergeContext *context, - IconHead *icon_head) + const IconHead *icon_head) { if (context->read_icons == nullptr) { return nullptr; diff --git a/source/blender/draw/intern/draw_debug.cc b/source/blender/draw/intern/draw_debug.cc index 9f8216c9969..5d0c9fca3d4 100644 --- a/source/blender/draw/intern/draw_debug.cc +++ b/source/blender/draw/intern/draw_debug.cc @@ -44,7 +44,7 @@ DebugDraw::DebugDraw() for (auto edge : IndexRange(circle_resolution)) { for (auto vert : IndexRange(2)) { const float angle = (2 * M_PI) * (edge + vert) / float(circle_resolution); - float point[3] = {cosf(angle), sinf(angle), 0.0f}; + const float point[3] = {cosf(angle), sinf(angle), 0.0f}; sphere_verts_.append( float3(point[(0 + axis) % 3], point[(1 + axis) % 3], point[(2 + axis) % 3])); } @@ -56,7 +56,7 @@ DebugDraw::DebugDraw() for (auto edge : IndexRange(point_resolution)) { for (auto vert : IndexRange(2)) { const float angle = (2 * M_PI) * (edge + vert) / float(point_resolution); - float point[3] = {cosf(angle), sinf(angle), 0.0f}; + const float point[3] = {cosf(angle), sinf(angle), 0.0f}; point_verts_.append( float3(point[(0 + axis) % 3], point[(1 + axis) % 3], point[(2 + axis) % 3])); } diff --git a/source/blender/editors/gpencil_legacy/annotate_paint.cc b/source/blender/editors/gpencil_legacy/annotate_paint.cc index d3cedcdc4d9..83fe9b41ed0 100644 --- a/source/blender/editors/gpencil_legacy/annotate_paint.cc +++ b/source/blender/editors/gpencil_legacy/annotate_paint.cc @@ -302,7 +302,7 @@ static bool annotation_stroke_filtermval(tGPsdata *p, const float mval[2], const static void annotation_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[3], - float *depth) + const float *depth) { bGPdata *gpd = p->gpd; if (depth && (*depth == DEPTH_INVALID)) { diff --git a/source/blender/imbuf/intern/colormanagement.cc b/source/blender/imbuf/intern/colormanagement.cc index 488b31776c8..9e0cae61824 100644 --- a/source/blender/imbuf/intern/colormanagement.cc +++ b/source/blender/imbuf/intern/colormanagement.cc @@ -363,7 +363,6 @@ static uchar *colormanage_cache_get(ImBuf *ibuf, cache_ibuf = colormanage_cache_get_ibuf(ibuf, &key, cache_handle); if (cache_ibuf) { - ColormanageCacheData *cache_data; BLI_assert(cache_ibuf->x == ibuf->x && cache_ibuf->y == ibuf->y); @@ -374,7 +373,7 @@ static uchar *colormanage_cache_get(ImBuf *ibuf, * check here which exposure/gamma/curve was used for cached buffer and if they're * different from requested buffer should be re-generated */ - cache_data = colormanage_cachedata_get(cache_ibuf); + const ColormanageCacheData *cache_data = colormanage_cachedata_get(cache_ibuf); if (cache_data->look != view_settings->look || cache_data->exposure != view_settings->exposure || diff --git a/source/blender/imbuf/intern/jp2.cc b/source/blender/imbuf/intern/jp2.cc index 20f4325d9a6..93a8101a8b6 100644 --- a/source/blender/imbuf/intern/jp2.cc +++ b/source/blender/imbuf/intern/jp2.cc @@ -355,7 +355,7 @@ static ImBuf *imb_load_jp2_stream(opj_stream_t *stream, uint i, i_next, w, h, planes; uint y; - int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */ + const int *r, *g, *b, *a; /* matching 'opj_image_comp.data' type */ opj_dparameters_t parameters; /* decompression parameters */ diff --git a/source/blender/imbuf/intern/readimage.cc b/source/blender/imbuf/intern/readimage.cc index 3fdbce144a7..ec051b8c920 100644 --- a/source/blender/imbuf/intern/readimage.cc +++ b/source/blender/imbuf/intern/readimage.cc @@ -118,7 +118,6 @@ ImBuf *IMB_ibImageFromMemory( ImBuf *IMB_loadifffile(int file, int flags, char colorspace[IM_MAX_SPACE], const char *descr) { ImBuf *ibuf; - uchar *mem; if (file == -1) { return nullptr; @@ -132,7 +131,7 @@ ImBuf *IMB_loadifffile(int file, int flags, char colorspace[IM_MAX_SPACE], const return nullptr; } - mem = static_cast(BLI_mmap_get_pointer(mmap_file)); + const uchar *mem = static_cast(BLI_mmap_get_pointer(mmap_file)); const size_t size = BLI_mmap_get_length(mmap_file); ibuf = IMB_ibImageFromMemory(mem, size, flags, colorspace, descr); diff --git a/source/blender/makesdna/intern/dna_genfile.cc b/source/blender/makesdna/intern/dna_genfile.cc index 6247701516c..885c882ba4b 100644 --- a/source/blender/makesdna/intern/dna_genfile.cc +++ b/source/blender/makesdna/intern/dna_genfile.cc @@ -1420,7 +1420,7 @@ static void init_reconstruct_step_for_member(const SDNA *oldsdna, } /** Useful function when debugging the reconstruct steps. */ -[[maybe_unused]] static void print_reconstruct_step(ReconstructStep *step, +[[maybe_unused]] static void print_reconstruct_step(const ReconstructStep *step, const SDNA *oldsdna, const SDNA *newsdna) { diff --git a/source/blender/modifiers/intern/MOD_meshdeform.cc b/source/blender/modifiers/intern/MOD_meshdeform.cc index 73e118e3108..67a9cc6f488 100644 --- a/source/blender/modifiers/intern/MOD_meshdeform.cc +++ b/source/blender/modifiers/intern/MOD_meshdeform.cc @@ -441,10 +441,10 @@ static void deform_verts(ModifierData *md, void BKE_modifier_mdef_compact_influences(ModifierData *md) { MeshDeformModifierData *mmd = (MeshDeformModifierData *)md; - float weight, *weights, totweight; + float weight, totweight; int influences_num, verts_num, cage_verts_num, a, b; - weights = mmd->bindweights; + const float *weights = mmd->bindweights; if (!weights) { return; }