[Bf-blender-cvs] [1a4a96a9d15] blender-v3.4-release: Fix allocated array size for MeshExtract_EdgeFac_Data

Germano Cavalcante noreply at git.blender.org
Wed Nov 16 14:57:27 CET 2022


Commit: 1a4a96a9d15d1a42a17c0a00ed0307922f9fb4b7
Author: Germano Cavalcante
Date:   Wed Nov 16 10:52:47 2022 -0300
Branches: blender-v3.4-release
https://developer.blender.org/rB1a4a96a9d15d1a42a17c0a00ed0307922f9fb4b7

Fix allocated array size for MeshExtract_EdgeFac_Data

The array size is actually 1/4 of the currently allocated size.

Also, cleanup, use `uint8_t` instead of `uchar`.

No functional changes.

===================================================================

M	source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc

===================================================================

diff --git a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
index a968bd07c87..438ca72310f 100644
--- a/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
+++ b/source/blender/draw/intern/mesh_extractors/extract_mesh_vbo_edge_fac.cc
@@ -20,10 +20,10 @@ namespace blender::draw {
  * \{ */
 
 struct MeshExtract_EdgeFac_Data {
-  uchar *vbo_data;
+  uint8_t *vbo_data;
   bool use_edge_render;
   /* Number of loop per edge. */
-  uchar *edge_loop_count;
+  uint8_t *edge_loop_count;
 };
 
 static float loop_edge_factor_get(const float f_no[3],
@@ -59,8 +59,7 @@ static void extract_edge_fac_init(const MeshRenderData *mr,
   MeshExtract_EdgeFac_Data *data = static_cast<MeshExtract_EdgeFac_Data *>(tls_data);
 
   if (mr->extract_type == MR_EXTRACT_MESH) {
-    data->edge_loop_count = static_cast<uchar *>(
-        MEM_callocN(sizeof(uint32_t) * mr->edge_len, __func__));
+    data->edge_loop_count = MEM_cnew_array<uint8_t>(mr->edge_len, __func__);
 
     /* HACK(@fclem): Detecting the need for edge render.
      * We could have a flag in the mesh instead or check the modifier stack. */



More information about the Bf-blender-cvs mailing list