[Bf-blender-cvs] [08273adebb4] master: Cleanup: const cast warning, use string replace function
Campbell Barton
noreply at git.blender.org
Fri Sep 11 06:58:06 CEST 2020
Commit: 08273adebb42f0e79a5114e5f391f480f2a4b964
Author: Campbell Barton
Date: Fri Sep 11 14:37:17 2020 +1000
Branches: master
https://developer.blender.org/rB08273adebb42f0e79a5114e5f391f480f2a4b964
Cleanup: const cast warning, use string replace function
===================================================================
M source/blender/blenkernel/intern/gpencil_geom.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil_geom.c b/source/blender/blenkernel/intern/gpencil_geom.c
index 83e3a3098e9..a9b0eede055 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.c
+++ b/source/blender/blenkernel/intern/gpencil_geom.c
@@ -2264,17 +2264,16 @@ static int gpencil_material_find_index_by_name(Object *ob, const char *name)
return -1;
}
-/* Create the name with the object name and a subfix. */
-static void make_element_name(char *obname, char *name, const int maxlen, char *r_name)
+/**
+ * Create the name with the object name and a suffix.
+ */
+static void make_element_name(const char *obname, const char *name, const int maxlen, char *r_name)
{
char str[256];
- sprintf(str, "%s_%s", obname, name);
+ SNPRINTF(str, "%s_%s", obname, name);
+
/* Replace any point by underscore. */
- char *current_pos = strchr(str, '.');
- while (current_pos) {
- *current_pos = '_';
- current_pos = strchr(current_pos, '.');
- }
+ BLI_str_replace_char(str, '.', '_');
BLI_strncpy_utf8(r_name, str, maxlen);
}
More information about the Bf-blender-cvs
mailing list