Commit: 1cee3e53fc9e5d056c3b5f37d3ec19105a0cfeed
Author: Campbell Barton
Date:   Tue Dec 3 09:12:44 2013 +1100
http://developer.blender.org/rB1cee3e53fc9e5d056c3b5f37d3ec19105a0cfeed

Code Cleanup: use BLI_strncpy when copying into fixed sized buffers

===================================================================

M       source/blender/blenkernel/intern/particle.c
M       source/blender/editors/object/object_add.c
M       source/blender/editors/transform/transform_orientations.c
M       source/blender/editors/util/ed_util.c

===================================================================

diff --git a/source/blender/blenkernel/intern/particle.c 
b/source/blender/blenkernel/intern/particle.c
index 24cf98d..a819b73 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3510,7 +3510,7 @@ ModifierData *object_add_particle_system(Scene *scene, 
Object *ob, const char *n
        if (BLI_countlist(&ob->particlesystem) > 1)
                BLI_snprintf(psys->name, sizeof(psys->name), 
DATA_("ParticleSystem %i"), BLI_countlist(&ob->particlesystem));
        else
-               strcpy(psys->name, DATA_("ParticleSystem"));
+               BLI_strncpy(psys->name, DATA_("ParticleSystem"), 
sizeof(psys->name));
 
        md = modifier_new(eModifierType_ParticleSystem);
 
diff --git a/source/blender/editors/object/object_add.c 
b/source/blender/editors/object/object_add.c
index 798bf7c..7e55d08 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -999,7 +999,7 @@ static int object_speaker_add_exec(bContext *C, wmOperator 
*op)
                BKE_nlatrack_add_strip(nlt, strip);
 
                /* auto-name the strip, and give the track an interesting name  
*/
-               strcpy(nlt->name, DATA_("SoundTrack"));
+               BLI_strncpy(nlt->name, DATA_("SoundTrack"), sizeof(nlt->name));
                BKE_nlastrip_validate_name(adt, strip);
 
                WM_event_add_notifier(C, NC_ANIMATION | ND_NLA | NA_EDITED, 
NULL);
diff --git a/source/blender/editors/transform/transform_orientations.c 
b/source/blender/editors/transform/transform_orientations.c
index 6dc685c..be8bc46 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -458,25 +458,25 @@ void initTransformOrientation(bContext *C, TransInfo *t)
        switch (t->current_orientation) {
                case V3D_MANIP_GLOBAL:
                        unit_m3(t->spacemtx);
-                       strcpy(t->spacename, IFACE_("global"));
+                       BLI_strncpy(t->spacename, IFACE_("global"), 
sizeof(t->spacename));
                        break;
 
                case V3D_MANIP_GIMBAL:
                        unit_m3(t->spacemtx);
                        if (gimbal_axis(ob, t->spacemtx)) {
-                               strcpy(t->spacename, IFACE_("gimbal"));
+                               BLI_strncpy(t->spacename, IFACE_("gimbal"), 
sizeof(t->spacename));
                                break;
                        }
                        /* fall-through */  /* no gimbal fallthrough to normal 
*/
                case V3D_MANIP_NORMAL:
                        if (obedit || (ob && ob->mode & OB_MODE_POSE)) {
-                               strcpy(t->spacename, IFACE_("normal"));
+                               BLI_strncpy(t->spacename, IFACE_("normal"), 
sizeof(t->spacename));
                                ED_getTransformOrientationMatrix(C, 
t->spacemtx, (v3d->around == V3D_ACTIVE));
                                break;
                        }
                        /* fall-through */  /* we define 'normal' as 'local' in 
Object mode */
                case V3D_MANIP_LOCAL:
-                       strcpy(t->spacename, IFACE_("local"));
+                       BLI_strncpy(t->spacename, IFACE_("local"), 
sizeof(t->spacename));
                
                        if (ob) {
                                copy_m3_m4(t->spacemtx, ob->obmat);
@@ -493,7 +493,7 @@ void initTransformOrientation(bContext *C, TransInfo *t)
                                RegionView3D *rv3d = t->ar->regiondata;
                                float mat[3][3];
 
-                               strcpy(t->spacename, IFACE_("view"));
+                               BLI_strncpy(t->spacename, IFACE_("view"), 
sizeof(t->spacename));
                                copy_m3_m4(mat, rv3d->viewinv);
                                normalize_m3(mat);
                                copy_m3_m3(t->spacemtx, mat);
diff --git a/source/blender/editors/util/ed_util.c 
b/source/blender/editors/util/ed_util.c
index 7424acd..0e357dc 100644
--- a/source/blender/editors/util/ed_util.c
+++ b/source/blender/editors/util/ed_util.c
@@ -173,8 +173,8 @@ void unpack_menu(bContext *C, const char *opname, const 
char *id_name, const cha
        pup = uiPupMenuBegin(C, IFACE_("Unpack File"), ICON_NONE);
        layout = uiPupMenuLayout(pup);
 
-       strcpy(line, IFACE_("Remove Pack"));
-       props_ptr = uiItemFullO_ptr(layout, ot, line, ICON_NONE, NULL, 
WM_OP_EXEC_DEFAULT, UI_ITEM_O_RETURN_PROPS);
+       props_ptr = uiItemFullO_ptr(layout, ot, IFACE_("Remove Pack"), 
ICON_NONE,
+                                   NULL, WM_OP_EXEC_DEFAULT, 
UI_ITEM_O_RETURN_PROPS);
        RNA_enum_set(&props_ptr, "method", PF_REMOVE);
        RNA_string_set(&props_ptr, "id", id_name);

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to