diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-03-14 14:39:18 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-03-14 14:39:18 +0400 |
commit | ffc8ecc5874931e7a0040141a7bc3ad1b70b17d0 (patch) | |
tree | e8c64602442e650b5c0c78a614d19a713571ecd0 /source/blender/editors/armature | |
parent | cf3b3a1ba2159792fad7cc0c8ccb98a855534823 (diff) |
use BLI_strncpy_rlen() rather then BLI_snprintf() when no formatting is needed.
also replace sprintf with strcpy when no formatting is done.
Diffstat (limited to 'source/blender/editors/armature')
-rw-r--r-- | source/blender/editors/armature/editarmature_retarget.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/editarmature_sketch.c | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/armature/editarmature_retarget.c b/source/blender/editors/armature/editarmature_retarget.c index d002d82b868..536c5ff1f7c 100644 --- a/source/blender/editors/armature/editarmature_retarget.c +++ b/source/blender/editors/armature/editarmature_retarget.c @@ -409,11 +409,11 @@ static void renameTemplateBone(char *name, char *template_name, ListBase *editbo for (i = 0, j = 0; i < (MAXBONENAME - 1) && j < (MAXBONENAME - 1) && template_name[i] != '\0'; i++) { if (template_name[i] == '&') { if (template_name[i + 1] == 'S' || template_name[i + 1] == 's') { - j += sprintf(name + j, "%s", side_string); + j += BLI_strncpy_rlen(name + j, side_string, MAXBONENAME); i++; } else if (template_name[i + 1] == 'N' || template_name[i + 1] == 'n') { - j += sprintf(name + j, "%s", num_string); + j += BLI_strncpy_rlen(name + j, num_string, MAXBONENAME); i++; } else { diff --git a/source/blender/editors/armature/editarmature_sketch.c b/source/blender/editors/armature/editarmature_sketch.c index a84827bfe0f..a3515e0983d 100644 --- a/source/blender/editors/armature/editarmature_sketch.c +++ b/source/blender/editors/armature/editarmature_sketch.c @@ -170,16 +170,16 @@ const char *BIF_listTemplates(const bContext *UNUSED(C)) GHashIterator ghi; const char *menu_header = IFACE_("Template %t|None %x0|"); char *p; + const size_t template_size = (BLI_ghash_size(TEMPLATES_HASH) * 32 + 30); if (TEMPLATES_MENU != NULL) { MEM_freeN(TEMPLATES_MENU); } - TEMPLATES_MENU = MEM_callocN(sizeof(char) * (BLI_ghash_size(TEMPLATES_HASH) * 32 + 30), "skeleton template menu"); + TEMPLATES_MENU = MEM_callocN(sizeof(char) * template_size, "skeleton template menu"); p = TEMPLATES_MENU; - - p += sprintf(TEMPLATES_MENU, "%s", menu_header); + p += BLI_strncpy_rlen(p, menu_header, template_size); BLI_ghashIterator_init(&ghi, TEMPLATES_HASH); |