diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-05 10:35:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-05 10:35:21 +0300 |
commit | e179c92a278160ad3a1523a17ef272f6f3547f46 (patch) | |
tree | 743ba7ec0ac67b6afc202cdd7a5d063d6ee617ae /source/blender/blenkernel/intern/action.c | |
parent | 0ebdbdac00fda4ceb7f8a53e3b944575a8d76133 (diff) |
tedious string copying changes
- use sizeof() in more places.
- fixed some off by 1 bugs copying strings. setting curve font family for instance was 1 char too short.
- replace strncpy and strcpy with BLI_strncpy
Diffstat (limited to 'source/blender/blenkernel/intern/action.c')
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 902807126c9..227f2eadf4c 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -408,7 +408,7 @@ bPoseChannel *verify_pose_channel(bPose *pose, const char *name) /* If not, create it and add it */ chan = MEM_callocN(sizeof(bPoseChannel), "verifyPoseChannel"); - strncpy(chan->name, name, 31); + BLI_strncpy(chan->name, name, sizeof(chan->name)); /* init vars to prevent math errors */ chan->quat[0] = chan->rotAxis[1]= 1.0f; chan->size[0] = chan->size[1] = chan->size[2] = 1.0f; @@ -774,7 +774,7 @@ void pose_add_group (Object *ob) return; grp= MEM_callocN(sizeof(bActionGroup), "PoseGroup"); - strcpy(grp->name, "Group"); + BLI_strncpy(grp->name, "Group", sizeof(grp->name)); BLI_addtail(&pose->agroups, grp); BLI_uniquename(&pose->agroups, grp, "Group", '.', offsetof(bActionGroup, name), sizeof(grp->name)); @@ -1119,8 +1119,8 @@ void what_does_obaction (Scene *UNUSED(scene), Object *ob, Object *workob, bPose workob->pose= pose; /* need to set pose too, since this is used for both types of Action Constraint */ - strcpy(workob->parsubstr, ob->parsubstr); - strcpy(workob->id.name, "OB<ConstrWorkOb>"); /* we don't use real object name, otherwise RNA screws with the real thing */ + BLI_strncpy(workob->parsubstr, ob->parsubstr, sizeof(workob->parsubstr)); + BLI_strncpy(workob->id.name, "OB<ConstrWorkOb>", sizeof(workob->id.name)); /* we don't use real object name, otherwise RNA screws with the real thing */ /* if we're given a group to use, it's likely to be more efficient (though a bit more dangerous) */ if (agrp) { |