Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-10-20 03:10:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2011-10-20 03:10:54 +0400
commit5cf593a778e3dca51a5ebd6b4c23ce6c7b0a7ac6 (patch)
treed5d8889ff9dcffa4c15b7160a8850d3f16b6562e /source/blender/editors
parent364fcde86d3cdcb09d075a0445fc2e1eb64170d5 (diff)
strcpy() --> BLI_strncpy(), where source strings are not fixed and target size is known.
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/armature/editarmature.c6
-rw-r--r--source/blender/editors/armature/poselib.c9
-rw-r--r--source/blender/editors/gpencil/editaction_gpencil.c2
-rw-r--r--source/blender/editors/interface/resources.c2
-rw-r--r--source/blender/editors/object/object_constraint.c2
-rw-r--r--source/blender/editors/object/object_relations.c10
-rw-r--r--source/blender/editors/object/object_vgroup.c2
-rw-r--r--source/blender/editors/render/render_preview.c2
-rw-r--r--source/blender/editors/screen/screendump.c2
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c4
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_undo.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_add.c2
-rw-r--r--source/blender/editors/space_sequencer/sequencer_edit.c4
13 files changed, 22 insertions, 27 deletions
diff --git a/source/blender/editors/armature/editarmature.c b/source/blender/editors/armature/editarmature.c
index 20368bbf57b..11fd932eed6 100644
--- a/source/blender/editors/armature/editarmature.c
+++ b/source/blender/editors/armature/editarmature.c
@@ -824,7 +824,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
}
else if (strcmp(ct->subtarget, pchan->name)==0) {
ct->tar = tarArm;
- strcpy(ct->subtarget, curbone->name);
+ BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget));
}
}
}
@@ -871,7 +871,7 @@ static void joined_armature_fix_links(Object *tarArm, Object *srcArm, bPoseChann
}
else if (strcmp(ct->subtarget, pchan->name)==0) {
ct->tar = tarArm;
- strcpy(ct->subtarget, curbone->name);
+ BLI_strncpy(ct->subtarget, curbone->name, sizeof(ct->subtarget));
}
}
}
@@ -2503,7 +2503,7 @@ void updateDuplicateSubtargetObjects(EditBone *dupBone, ListBase *editbones, Obj
*/
if (oldtarget->temp) {
newtarget = (EditBone *) oldtarget->temp;
- strcpy(ct->subtarget, newtarget->name);
+ BLI_strncpy(ct->subtarget, newtarget->name, sizeof(ct->subtarget));
}
}
}
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index bf2e17c4e87..e7c7ebf3ece 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -997,11 +997,8 @@ static void poselib_preview_apply (bContext *C, wmOperator *op)
}
/* get marker name */
- if (pld->marker)
- strcpy(markern, pld->marker->name);
- else
- strcpy(markern, "No Matches");
-
+ BLI_strncpy(markern, pld->marker ? pld->marker->name : "No Matches", sizeof(markern));
+
sprintf(pld->headerstr, "PoseLib Previewing Pose: Filter - [%s] | Current Pose - \"%s\" | Use ScrollWheel or PageUp/Down to change", tempstr, markern);
ED_area_headerprint(pld->sa, pld->headerstr);
}
@@ -1186,7 +1183,7 @@ static int poselib_preview_handle_event (bContext *UNUSED(C), wmOperator *op, wm
/* backup stuff that needs to occur before every operation
* - make a copy of searchstr, so that we know if cache needs to be rebuilt
*/
- strcpy(pld->searchold, pld->searchstr);
+ BLI_strncpy(pld->searchold, pld->searchstr, sizeof(pld->searchold));
/* if we're currently showing the original pose, only certain events are handled */
if (pld->flag & PL_PREVIEW_SHOWORIGINAL) {
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index b6398c6a2f5..56210864593 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -311,7 +311,7 @@ void copy_gpdata ()
gpln= MEM_callocN(sizeof(bGPDlayer), "GPCopyPasteLayer");
gpln->frames.first= gpln->frames.last= NULL;
- strcpy(gpln->info, gpls->info);
+ BLI_strncpy(gpln->info, gpls->info, sizeof(gpln->info));
BLI_addtail(&gpcopybuf, gpln);
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 9b9237f70cf..fd511948bac 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1151,7 +1151,7 @@ void init_userdef_do_versions(void)
vDM_ColorBand_store((U.flag & USER_CUSTOM_RANGE) ? (&U.coba_weight):NULL);
if (bmain->versionfile <= 191) {
- strcpy(U.plugtexdir, U.textudir);
+ BLI_strncpy(U.plugtexdir, U.textudir, sizeof(U.plugtexdir));
strcpy(U.sounddir, "/");
}
diff --git a/source/blender/editors/object/object_constraint.c b/source/blender/editors/object/object_constraint.c
index 6c553289052..ec7c6cc6108 100644
--- a/source/blender/editors/object/object_constraint.c
+++ b/source/blender/editors/object/object_constraint.c
@@ -245,7 +245,7 @@ static void set_constraint_nth_target (bConstraint *con, Object *target, const c
for (ct=targets.first, i=0; ct; ct= ct->next, i++) {
if (i == index) {
ct->tar= target;
- strcpy(ct->subtarget, subtarget);
+ BLI_strncpy(ct->subtarget, subtarget, sizeof(ct->subtarget));
break;
}
}
diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c
index 389c0941cc2..49a71018719 100644
--- a/source/blender/editors/object/object_relations.c
+++ b/source/blender/editors/object/object_relations.c
@@ -334,11 +334,9 @@ static int make_proxy_exec (bContext *C, wmOperator *op)
/* Add new object for the proxy */
newob= add_object(scene, OB_EMPTY);
- if (gob)
- strcpy(name, gob->id.name+2);
- else
- strcpy(name, ob->id.name+2);
- strcat(name, "_proxy");
+
+ BLI_snprintf(name, sizeof(name), "%s_proxy", ((ID *)(gob ? gob : ob))->name);
+
rename_id(&newob->id, name);
/* set layers OK */
@@ -605,7 +603,7 @@ static int parent_set_exec(bContext *C, wmOperator *op)
/* handle types */
if (pchan)
- strcpy(ob->parsubstr, pchan->name);
+ BLI_strncpy(ob->parsubstr, pchan->name, sizeof(ob->parsubstr));
else
ob->parsubstr[0]= 0;
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index 7b4db347315..c1b21865504 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -669,7 +669,7 @@ static void vgroup_duplicate(Object *ob)
}
cdg = defgroup_duplicate(dg);
- strcpy(cdg->name, name);
+ BLI_strncpy(cdg->name, name, sizeof(cdg->name));
defgroup_unique_name(cdg, ob);
BLI_addtail(&ob->defbase, cdg);
diff --git a/source/blender/editors/render/render_preview.c b/source/blender/editors/render/render_preview.c
index 70709a22d3d..697cddfcee0 100644
--- a/source/blender/editors/render/render_preview.c
+++ b/source/blender/editors/render/render_preview.c
@@ -261,7 +261,7 @@ static Scene *preview_prepare_scene(Scene *scene, ID *id, int id_type, ShaderPre
sce->r.alphamode= R_ADDSKY;
sce->r.cfra= scene->r.cfra;
- strcpy(sce->r.engine, scene->r.engine);
+ BLI_strncpy(sce->r.engine, scene->r.engine, sizeof(sce->r.engine));
if(id_type==ID_MA) {
Material *mat= NULL, *origmat= (Material *)id;
diff --git a/source/blender/editors/screen/screendump.c b/source/blender/editors/screen/screendump.c
index 3010adafe20..27c311aa04f 100644
--- a/source/blender/editors/screen/screendump.c
+++ b/source/blender/editors/screen/screendump.c
@@ -157,7 +157,7 @@ static int screenshot_exec(bContext *C, wmOperator *op)
RNA_string_get(op->ptr, "filepath", path);
- strcpy(G.ima, path);
+ BLI_strncpy(G.ima, path, sizeof(G.ima));
BLI_path_abs(path, G.main->name);
/* BKE_add_image_extension() checks for if extension was already set */
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index c5af8971907..b6b22c391b8 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -401,7 +401,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
*tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat|IB_rect);
tile= MEM_callocN(sizeof(UndoImageTile), "UndoImageTile");
- strcpy(tile->idname, ima->id.name);
+ BLI_strncpy(tile->idname, ima->id.name, sizeof(tile->idname));
tile->x= x_tile;
tile->y= y_tile;
@@ -409,7 +409,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
allocsize *= (ibuf->rect_float)? sizeof(float): sizeof(char);
tile->rect= MEM_mapallocN(allocsize, "UndeImageTile.rect");
- strcpy(tile->ibufname, ibuf->name);
+ BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
tile->gen_type= ima->gen_type;
tile->source= ima->source;
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 13b6fef3004..a32487e7117 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -262,7 +262,7 @@ SculptUndoNode *sculpt_undo_push_node(Object *ob, PBVHNode *node)
}
unode= MEM_callocN(sizeof(SculptUndoNode), "SculptUndoNode");
- strcpy(unode->idname, ob->id.name);
+ BLI_strncpy(unode->idname, ob->id.name, sizeof(unode->idname));
unode->node= node;
BLI_pbvh_node_num_verts(ss->pbvh, node, &totvert, &allvert);
diff --git a/source/blender/editors/space_sequencer/sequencer_add.c b/source/blender/editors/space_sequencer/sequencer_add.c
index 7fa4e62359a..7e4d02036ef 100644
--- a/source/blender/editors/space_sequencer/sequencer_add.c
+++ b/source/blender/editors/space_sequencer/sequencer_add.c
@@ -235,7 +235,7 @@ static int sequencer_add_scene_strip_exec(bContext *C, wmOperator *op)
strip->stripdata= MEM_callocN(seq->len*sizeof(StripElem), "stripelem");
- strcpy(seq->name+2, sce_seq->id.name+2);
+ BLI_strncpy(seq->name+2, sce_seq->id.name+2, sizeof(seq->name)-2);
seqbase_unique_name_recursive(&ed->seqbase, seq);
seq->scene_sound = sound_scene_add_scene_sound(scene, seq, start_frame, start_frame + strip->len, 0);
diff --git a/source/blender/editors/space_sequencer/sequencer_edit.c b/source/blender/editors/space_sequencer/sequencer_edit.c
index 45543a9313e..33d2a27f789 100644
--- a/source/blender/editors/space_sequencer/sequencer_edit.c
+++ b/source/blender/editors/space_sequencer/sequencer_edit.c
@@ -929,11 +929,11 @@ static void UNUSED_FUNCTION(seq_remap_paths)(Scene *scene)
if(last_seq==NULL)
return;
- BLI_strncpy(from, last_seq->strip->dir, FILE_MAX);
+ BLI_strncpy(from, last_seq->strip->dir, sizeof(from));
// XXX if (0==sbutton(from, 0, sizeof(from)-1, "From: "))
// return;
- strcpy(to, from);
+ BLI_strncpy(to, from, sizeof(to));
// XXX if (0==sbutton(to, 0, sizeof(to)-1, "To: "))
// return;