diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-08-22 11:11:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-08-22 11:11:40 +0400 |
commit | 6e141b73316c636dbdccc2254e886da55059e9cb (patch) | |
tree | a9c02a4a2a4abf4f82dbc674395cef755415b30e /source/blender/blenkernel | |
parent | 4ca9a7e9c130f23a14f126e98184b6444257c318 (diff) |
own commit to fix a naming bug caused a new bug.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/library.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c index e935573cf67..b1492fce9d4 100644 --- a/source/blender/blenkernel/intern/library.c +++ b/source/blender/blenkernel/intern/library.c @@ -1094,8 +1094,14 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) left_len= splitIDname(name, left, &nr); /* if new name will be too long, truncate it */ - if(nr>999 && strlen(left)>16) left[16]= 0; - else if(strlen(left)>17) left[17]= 0; + if(nr > 999 && left_len > 16) { + left[16]= 0; + left_len= 16; + } + else if(left_len > 17) { + left[17]= 0; + left_len= 17; + } for(idtest= lb->first; idtest; idtest= idtest->next) { if( (id != idtest) && @@ -1136,10 +1142,11 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name) /* otherwise just continue and use a number suffix */ } - if(nr > 999 && strlen(left) > 16) { + if(nr > 999 && left_len > 16) { /* this would overflow name buffer */ left[16] = 0; - strcpy( name, left ); + /* left_len = 16; */ /* for now this isnt used again */ + memcpy(name, left, sizeof(char) * 16); continue; } /* this format specifier is from hell... */ |