diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 16:49:30 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-07-23 16:49:30 +0400 |
commit | 3ff3d1bc0fa6979d0745dbd7526cbb5c35c1fcbf (patch) | |
tree | 99df5ec67111abede3cb2e29b469bb7a1ff2b3ae /source/blender/blenkernel/intern/property.c | |
parent | a5bc02194345de1eb21f843b73ce24799677aea1 (diff) |
replace use of strcat() where the string offset is known.
also correct bad logic with converting a textblock to 3d-text, bytes-vs-number of chars wasn't handled right.
Diffstat (limited to 'source/blender/blenkernel/intern/property.c')
-rw-r--r-- | source/blender/blenkernel/intern/property.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c index ec23a7db8a1..73f2a864e32 100644 --- a/source/blender/blenkernel/intern/property.c +++ b/source/blender/blenkernel/intern/property.c @@ -177,9 +177,9 @@ void BKE_bproperty_unique(bProperty *first, bProperty *prop, int force) i = 0; do { /* ensure we have enough chars for the new number in the name */ - BLI_snprintf(num, sizeof(num), "%d", i++); - BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num)); - strcat(new_name, num); + const size_t num_len = BLI_snprintf(num, sizeof(num), "%d", i++); + BLI_snprintf(new_name, sizeof(prop->name), + "%.*s%s", (int)(sizeof(prop->name) - num_len), base_name, num); } while (bproperty_get(first, prop, new_name)); BLI_strncpy(prop->name, new_name, sizeof(prop->name)); |