diff --git a/source/blender/blenkernel/intern/gpencil_modifier_legacy.c b/source/blender/blenkernel/intern/gpencil_modifier_legacy.c index e94dc9e89b0..1913ea72c0a 100644 --- a/source/blender/blenkernel/intern/gpencil_modifier_legacy.c +++ b/source/blender/blenkernel/intern/gpencil_modifier_legacy.c @@ -38,6 +38,7 @@ #include "BKE_material.h" #include "BKE_modifier.h" #include "BKE_object.h" +#include "BKE_screen.h" #include "BKE_shrinkwrap.h" #include "DEG_depsgraph.h" @@ -447,9 +448,7 @@ const GpencilModifierTypeInfo *BKE_gpencil_modifier_get_info(GpencilModifierType void BKE_gpencil_modifierType_panel_id(GpencilModifierType type, char *r_idname) { const GpencilModifierTypeInfo *mti = BKE_gpencil_modifier_get_info(type); - - strcpy(r_idname, GPENCIL_MODIFIER_TYPE_PANEL_PREFIX); - strcat(r_idname, mti->name); + BLI_string_join(r_idname, BKE_ST_MAXNAME, GPENCIL_MODIFIER_TYPE_PANEL_PREFIX, mti->name); } void BKE_gpencil_modifier_panel_expand(GpencilModifierData *md) diff --git a/source/blender/blenkernel/intern/shader_fx.c b/source/blender/blenkernel/intern/shader_fx.c index 6e52c31fac6..093665b340b 100644 --- a/source/blender/blenkernel/intern/shader_fx.c +++ b/source/blender/blenkernel/intern/shader_fx.c @@ -27,6 +27,7 @@ #include "BKE_lib_id.h" #include "BKE_lib_query.h" #include "BKE_object.h" +#include "BKE_screen.h" #include "BKE_shader_fx.h" #include "DEG_depsgraph.h" @@ -156,9 +157,7 @@ bool BKE_shaderfx_is_nonlocal_in_liboverride(const Object *ob, const ShaderFxDat void BKE_shaderfxType_panel_id(ShaderFxType type, char *r_idname) { const ShaderFxTypeInfo *fxi = BKE_shaderfx_get_info(type); - - strcpy(r_idname, SHADERFX_TYPE_PANEL_PREFIX); - strcat(r_idname, fxi->name); + BLI_string_join(r_idname, BKE_ST_MAXNAME, SHADERFX_TYPE_PANEL_PREFIX, fxi->name); } void BKE_shaderfx_panel_expand(ShaderFxData *fx) diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc index 9e512fdb634..d20058ad317 100644 --- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc +++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc @@ -22,6 +22,7 @@ #include "BLI_linklist.h" #include "BLI_string.h" +#include "BLI_string_utils.h" #include "BLI_virtual_array.hh" #include "PIL_time.h" @@ -251,16 +252,9 @@ static GPUShader *get_patch_evaluation_shader(int shader_type) /* Merge OpenSubdiv library code with our own library code. */ const char *patch_basis_source = openSubdiv_getGLSLPatchBasisSource(); const char *subdiv_lib_code = datatoc_common_subdiv_lib_glsl; - char *library_code = static_cast( - MEM_mallocN(strlen(patch_basis_source) + strlen(subdiv_lib_code) + 1, - "subdiv patch evaluation library code")); - library_code[0] = '\0'; - strcat(library_code, patch_basis_source); - strcat(library_code, subdiv_lib_code); - + char *library_code = BLI_string_joinN(patch_basis_source, subdiv_lib_code); g_subdiv_shaders[shader_type] = GPU_shader_create_compute( compute_code, library_code, defines, get_shader_name(shader_type)); - MEM_freeN(library_code); } diff --git a/source/blender/editors/interface/interface_templates.cc b/source/blender/editors/interface/interface_templates.cc index 557fda36b8c..b683a75c495 100644 --- a/source/blender/editors/interface/interface_templates.cc +++ b/source/blender/editors/interface/interface_templates.cc @@ -32,6 +32,7 @@ #include "BLI_rect.h" #include "BLI_string.h" #include "BLI_string_search.h" +#include "BLI_string_utils.h" #include "BLI_timecode.h" #include "BLI_utildefines.h" @@ -2408,7 +2409,7 @@ static void set_constraint_expand_flag(const bContext * /*C*/, Panel *panel, sho * \note Constraint panel types are assumed to be named with the struct name field * concatenated to the defined prefix. */ -static void object_constraint_panel_id(void *md_link, char *r_name) +static void object_constraint_panel_id(void *md_link, char *r_idname) { bConstraint *con = (bConstraint *)md_link; const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(con->type); @@ -2417,12 +2418,10 @@ static void object_constraint_panel_id(void *md_link, char *r_name) if (cti == nullptr) { return; } - - strcpy(r_name, CONSTRAINT_TYPE_PANEL_PREFIX); - strcat(r_name, cti->structName); + BLI_string_join(r_idname, BKE_ST_MAXNAME, CONSTRAINT_TYPE_PANEL_PREFIX, cti->structName); } -static void bone_constraint_panel_id(void *md_link, char *r_name) +static void bone_constraint_panel_id(void *md_link, char *r_idname) { bConstraint *con = (bConstraint *)md_link; const bConstraintTypeInfo *cti = BKE_constraint_typeinfo_from_type(con->type); @@ -2431,9 +2430,7 @@ static void bone_constraint_panel_id(void *md_link, char *r_name) if (cti == nullptr) { return; } - - strcpy(r_name, CONSTRAINT_BONE_TYPE_PANEL_PREFIX); - strcat(r_name, cti->structName); + BLI_string_join(r_idname, BKE_ST_MAXNAME, CONSTRAINT_BONE_TYPE_PANEL_PREFIX, cti->structName); } void uiTemplateConstraints(uiLayout * /*layout*/, bContext *C, bool use_bone_constraints)