From aaea263be4d0ffc5b23ac5752a1d15d31eb9c7ca Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 26 Aug 2022 10:57:35 -0500 Subject: Cleanup: Fix const correctness in CustomData set name function The function does modify the object since it changes the name of a layer it owns. Ideally this wouldn't be possible, but raw pointers don't have ownership semantics so this is a common problem with CustomData. --- source/blender/blenkernel/BKE_customdata.h | 2 +- source/blender/blenkernel/intern/customdata.cc | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_customdata.h b/source/blender/blenkernel/BKE_customdata.h index 6461ff30cd6..1ba0373f194 100644 --- a/source/blender/blenkernel/BKE_customdata.h +++ b/source/blender/blenkernel/BKE_customdata.h @@ -417,7 +417,7 @@ void *CustomData_bmesh_get_n(const struct CustomData *data, void *block, int typ */ void *CustomData_bmesh_get_layer_n(const struct CustomData *data, void *block, int n); -bool CustomData_set_layer_name(const struct CustomData *data, int type, int n, const char *name); +bool CustomData_set_layer_name(struct CustomData *data, int type, int n, const char *name); const char *CustomData_get_layer_name(const struct CustomData *data, int type, int n); /** diff --git a/source/blender/blenkernel/intern/customdata.cc b/source/blender/blenkernel/intern/customdata.cc index 90bc79f6907..6d89e1621d5 100644 --- a/source/blender/blenkernel/intern/customdata.cc +++ b/source/blender/blenkernel/intern/customdata.cc @@ -3537,10 +3537,7 @@ int CustomData_get_offset_named(const CustomData *data, int type, const char *na return data->layers[layer_index].offset; } -bool CustomData_set_layer_name(const CustomData *data, - const int type, - const int n, - const char *name) +bool CustomData_set_layer_name(CustomData *data, const int type, const int n, const char *name) { /* get the layer index of the first layer of type */ const int layer_index = CustomData_get_layer_index_n(data, type, n); -- cgit v1.2.3