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>2012-01-11 19:04:54 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-01-11 19:04:54 +0400
commita7b0a11811ccdbf83301891c03a50c1d5daf4776 (patch)
tree165521a6533e9069c455dbccda87b944ae7a1c25 /source/blender/blenkernel
parentb308e613126f8c89e954705aa512a3ef6a1f551d (diff)
parent6ce92d09f77351b3ad882e8d8f6d6b1511e91844 (diff)
svn merge ^/trunk/blender -r43278:43294
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/BKE_armature.h2
-rw-r--r--source/blender/blenkernel/BKE_deform.h2
-rw-r--r--source/blender/blenkernel/BKE_node.h6
-rw-r--r--source/blender/blenkernel/BKE_sequencer.h2
-rw-r--r--source/blender/blenkernel/intern/boids.c2
-rw-r--r--source/blender/blenkernel/intern/customdata.c2
-rw-r--r--source/blender/blenkernel/intern/deform.c24
-rw-r--r--source/blender/blenkernel/intern/dynamicpaint.c11
-rw-r--r--source/blender/blenkernel/intern/image.c12
-rw-r--r--source/blender/blenkernel/intern/ipo.c14
-rw-r--r--source/blender/blenkernel/intern/library.c44
-rw-r--r--source/blender/blenkernel/intern/material.c7
-rw-r--r--source/blender/blenkernel/intern/mball.c10
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/packedFile.c2
-rw-r--r--source/blender/blenkernel/intern/particle.c4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c25
-rw-r--r--source/blender/blenkernel/intern/property.c2
-rw-r--r--source/blender/blenkernel/intern/sca.c2
-rw-r--r--source/blender/blenkernel/intern/seqeffects.c7
-rw-r--r--source/blender/blenkernel/intern/sequencer.c19
-rw-r--r--source/blender/blenkernel/intern/sound.c4
-rw-r--r--source/blender/blenkernel/intern/texture.c2
-rw-r--r--source/blender/blenkernel/intern/tracking.c8
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c4
25 files changed, 114 insertions, 105 deletions
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 8836999bc9b..b301b7cf03b 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -82,7 +82,7 @@ void free_armature(struct bArmature *arm);
void make_local_armature(struct bArmature *arm);
struct bArmature *copy_armature(struct bArmature *arm);
-int bone_autoside_name (char name[32], int strip_number, short axis, float head, float tail);
+int bone_autoside_name (char name[64], int strip_number, short axis, float head, float tail);
struct Bone *get_named_bone (struct bArmature *arm, const char *name);
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 9a27f292f36..11747899aa9 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -69,7 +69,7 @@ void defvert_normalize_lock(struct MDeformVert *dvert, const int def_nr_lock);
/* utility function, note that 32 chars is the maximum string length since its only
* used with defgroups currently */
-void flip_side_name(char name[32], const char from_name[32], int strip_number);
+void flip_side_name(char name[64], const char from_name[64], int strip_number);
#endif
diff --git a/source/blender/blenkernel/BKE_node.h b/source/blender/blenkernel/BKE_node.h
index 8229978454f..67de699c7c4 100644
--- a/source/blender/blenkernel/BKE_node.h
+++ b/source/blender/blenkernel/BKE_node.h
@@ -76,7 +76,7 @@ struct Object;
*/
typedef struct bNodeSocketTemplate {
int type, limit;
- char name[32];
+ char name[64]; /* MAX_NAME */
float val1, val2, val3, val4; /* default alloc value for inputs */
float min, max;
PropertySubType subtype;
@@ -95,7 +95,7 @@ typedef void (*NodeSocketButtonFunction)(const struct bContext *C, struct uiBloc
*/
typedef struct bNodeSocketType {
int type;
- char ui_name[32];
+ char ui_name[64]; /* MAX_NAME */
char ui_description[128];
int ui_icon;
char ui_color[4];
@@ -125,7 +125,7 @@ typedef struct bNodeType {
short needs_free; /* set for allocated types that need to be freed */
int type;
- char name[32];
+ char name[64]; /* MAX_NAME */
float width, minwidth, maxwidth;
float height, minheight, maxheight;
short nclass, flag, compatibility;
diff --git a/source/blender/blenkernel/BKE_sequencer.h b/source/blender/blenkernel/BKE_sequencer.h
index 3a4ac279852..ed0730b7f09 100644
--- a/source/blender/blenkernel/BKE_sequencer.h
+++ b/source/blender/blenkernel/BKE_sequencer.h
@@ -306,7 +306,7 @@ typedef struct SeqLoadInfo {
int tot_error;
int len; /* only for image strips */
char path[512];
- char name[32];
+ char name[64];
} SeqLoadInfo;
/* SeqLoadInfo.flag */
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index ec2e6b3c078..d454bef3184 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -1503,7 +1503,7 @@ BoidState *boid_new_state(BoidSettings *boids)
state->id = boids->last_state_id++;
if(state->id)
- sprintf(state->name, "State %i", state->id);
+ BLI_snprintf(state->name, sizeof(state->name), "State %i", state->id);
else
strcpy(state->name, "State");
diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c
index 2f557ae3842..1ad439ef29b 100644
--- a/source/blender/blenkernel/intern/customdata.c
+++ b/source/blender/blenkernel/intern/customdata.c
@@ -1578,7 +1578,7 @@ static CustomDataLayer *customData_add_layer__internal(CustomData *data,
data->layers[index].data = newlayerdata;
if(name || (name=typeInfo->defaultname)) {
- BLI_strncpy(data->layers[index].name, name, 32);
+ BLI_strncpy(data->layers[index].name, name, sizeof(data->layers[index].name));
CustomData_set_layer_unique_name(data, index);
}
else
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index d848185cd07..91345c26154 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -479,22 +479,22 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
switch(name[0]) {
case 'l':
strcpy(replace, "r");
- strcpy(suffix, name+1);
+ BLI_strncpy(suffix, name+1, sizeof(suffix));
prefix[0]= 0;
break;
case 'r':
strcpy(replace, "l");
- strcpy(suffix, name+1);
+ BLI_strncpy(suffix, name+1, sizeof(suffix));
prefix[0]= 0;
break;
case 'L':
strcpy(replace, "R");
- strcpy(suffix, name+1);
+ BLI_strncpy(suffix, name+1, sizeof(suffix));
prefix[0]= 0;
break;
case 'R':
strcpy(replace, "L");
- strcpy(suffix, name+1);
+ BLI_strncpy(suffix, name+1, sizeof(suffix));
prefix[0]= 0;
break;
}
@@ -504,29 +504,29 @@ void flip_side_name(char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_
index = BLI_strcasestr(prefix, "right");
if (index==prefix || index==prefix+len-5) {
if (index[0]=='r')
- strcpy (replace, "left");
+ strcpy(replace, "left");
else {
if (index[1]=='I')
- strcpy (replace, "LEFT");
+ strcpy(replace, "LEFT");
else
- strcpy (replace, "Left");
+ strcpy(replace, "Left");
}
*index= 0;
- strcpy (suffix, index+5);
+ BLI_strncpy(suffix, index+5, sizeof(suffix));
}
else {
index = BLI_strcasestr(prefix, "left");
if (index==prefix || index==prefix+len-4) {
if (index[0]=='l')
- strcpy (replace, "right");
+ strcpy(replace, "right");
else {
if (index[1]=='E')
- strcpy (replace, "RIGHT");
+ strcpy(replace, "RIGHT");
else
- strcpy (replace, "Right");
+ strcpy(replace, "Right");
}
*index= 0;
- strcpy (suffix, index+4);
+ BLI_strncpy(suffix, index + 4, sizeof(suffix));
}
}
}
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c
index 070f091b10a..54684bc4f66 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -361,8 +361,8 @@ void dynamicPaintSurface_updateType(struct DynamicPaintSurface *surface)
surface->depth_clamp = 1.0f;
}
else {
- sprintf(surface->output_name, "dp_");
- strcpy(surface->output_name2,surface->output_name);
+ strcpy(surface->output_name, "dp_");
+ strcpy(surface->output_name2, surface->output_name);
surface->flags &= ~MOD_DPAINT_ANTIALIAS;
surface->depth_clamp = 0.0f;
}
@@ -1323,7 +1323,7 @@ void dynamicPaint_setInitialColor(DynamicPaintSurface *surface)
MTFace *tface;
MFace *mface = dm->getTessFaceArray(dm);
int numOfFaces = dm->getNumTessFaces(dm);
- char uvname[40];
+ char uvname[MAX_CUSTOMDATA_LAYER_NAME];
if (!tex) return;
@@ -1871,7 +1871,8 @@ struct DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scen
* px,py : origin pixel x and y
* n_index : lookup direction index (use neighX,neighY to get final index)
*/
-static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm, char *uvname, int w, int h, int px, int py, int n_index)
+static int dynamicPaint_findNeighbourPixel(PaintUVPoint *tempPoints, DerivedMesh *dm,
+ const char *uvname, int w, int h, int px, int py, int n_index)
{
/* Note: Current method only uses polygon edges to detect neighbouring pixels.
* -> It doesn't always lead to the optimum pixel but is accurate enough
@@ -2073,7 +2074,7 @@ int dynamicPaint_createUVSurface(DynamicPaintSurface *surface)
int ty;
int w,h;
int numOfFaces;
- char uvname[32];
+ char uvname[MAX_CUSTOMDATA_LAYER_NAME];
int active_points = 0;
int error = 0;
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c
index a5c8f5c905d..5b3b9b4e1c4 100644
--- a/source/blender/blenkernel/intern/image.c
+++ b/source/blender/blenkernel/intern/image.c
@@ -1168,7 +1168,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
char *name = scene_find_last_marker_name(scene, CFRA);
if (name) BLI_strncpy(text, name, sizeof(text));
- else strcpy(text, "<none>");
+ else BLI_strncpy(text, "<none>", sizeof(text));
BLI_snprintf(stamp_data->marker, sizeof(stamp_data->marker), do_prefix ? "Marker %s":"%s", text);
} else {
@@ -1202,14 +1202,14 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
}
if (scene->r.stamp & R_STAMP_FRAME) {
- char format[32];
+ char fmtstr[32];
int digits= 1;
if(scene->r.efra>9)
digits= 1 + (int) log10(scene->r.efra);
- BLI_snprintf(format, sizeof(format), do_prefix ? "Frame %%0%di":"%%0%di", digits);
- BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), format, scene->r.cfra);
+ BLI_snprintf(fmtstr, sizeof(fmtstr), do_prefix ? "Frame %%0%di":"%%0%di", digits);
+ BLI_snprintf (stamp_data->frame, sizeof(stamp_data->frame), fmtstr, scene->r.cfra);
} else {
stamp_data->frame[0] = '\0';
}
@@ -1224,7 +1224,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
if (camera && camera->type == OB_CAMERA) {
BLI_snprintf(text, sizeof(text), "%.2f", ((Camera *)camera->data)->lens);
}
- else strcpy(text, "<none>");
+ else BLI_strncpy(text, "<none>", sizeof(text));
BLI_snprintf(stamp_data->cameralens, sizeof(stamp_data->cameralens), do_prefix ? "Lens %s":"%s", text);
} else {
@@ -1241,7 +1241,7 @@ static void stampdata(Scene *scene, Object *camera, StampData *stamp_data, int d
Sequence *seq= seq_foreground_frame_get(scene, scene->r.cfra);
if (seq) BLI_strncpy(text, seq->name+2, sizeof(text));
- else strcpy(text, "<none>");
+ else BLI_strncpy(text, "<none>", sizeof(text));
BLI_snprintf(stamp_data->strip, sizeof(stamp_data->strip), do_prefix ? "Strip %s":"%s", text);
} else {
diff --git a/source/blender/blenkernel/intern/ipo.c b/source/blender/blenkernel/intern/ipo.c
index 9890a2629fc..40fe3626848 100644
--- a/source/blender/blenkernel/intern/ipo.c
+++ b/source/blender/blenkernel/intern/ipo.c
@@ -328,9 +328,9 @@ static char *shapekey_adrcodes_to_paths (int adrcode, int *UNUSED(array_index))
/* block will be attached to ID_KE block, and setting that we alter is the 'value' (which sets keyblock.curval) */
// XXX adrcode 0 was dummy 'speed' curve
if (adrcode == 0)
- sprintf(buf, "speed");
+ strcpy(buf, "speed");
else
- sprintf(buf, "key_blocks[%d].value", adrcode);
+ BLI_snprintf(buf, sizeof(buf), "key_blocks[%d].value", adrcode);
return buf;
}
@@ -915,7 +915,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
/* note, strings are not escapted and they should be! */
if ((actname && actname[0]) && (constname && constname[0])) {
/* Constraint in Pose-Channel */
- sprintf(buf, "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
+ BLI_snprintf(buf, sizeof(buf), "pose.bones[\"%s\"].constraints[\"%s\"]", actname, constname);
}
else if (actname && actname[0]) {
if ((blocktype == ID_OB) && strcmp(actname, "Object")==0) {
@@ -928,16 +928,16 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
}
else {
/* Pose-Channel */
- sprintf(buf, "pose.bones[\"%s\"]", actname);
+ BLI_snprintf(buf, sizeof(buf), "pose.bones[\"%s\"]", actname);
}
}
else if (constname && constname[0]) {
/* Constraint in Object */
- sprintf(buf, "constraints[\"%s\"]", constname);
+ BLI_snprintf(buf, sizeof(buf), "constraints[\"%s\"]", constname);
}
else if (seq) {
/* Sequence names in Scene */
- sprintf(buf, "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
+ BLI_snprintf(buf, sizeof(buf), "sequence_editor.sequences_all[\"%s\"]", seq->name+2);
}
else {
buf[0]= '\0'; /* empty string */
@@ -954,7 +954,7 @@ static char *get_rna_access (int blocktype, int adrcode, char actname[], char co
/* if there was no array index pointer provided, add it to the path */
if (array_index == NULL) {
- sprintf(buf, "[\"%d\"]", dummy_index);
+ BLI_snprintf(buf, sizeof(buf), "[\"%d\"]", dummy_index);
BLI_dynstr_append(path, buf);
}
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 740b7535fcd..8a615b379e8 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -991,7 +991,7 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
ID *id;
for (i=0, id= lb->first; id; id= id->next, i++) {
- char buf[32];
+ char numstr[32];
if (nr && id==link) *nr= i+1;
@@ -1002,12 +1002,12 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
if ( ((Image *)id)->source==IMA_SRC_VIEWER )
continue;
- get_flags_for_id(id, buf);
+ get_flags_for_id(id, numstr);
- BLI_dynstr_append(pupds, buf);
+ BLI_dynstr_append(pupds, numstr);
BLI_dynstr_append(pupds, id->name+2);
- BLI_snprintf(buf, sizeof(buf), "%%x%d", i+1);
- BLI_dynstr_append(pupds, buf);
+ BLI_snprintf(numstr, sizeof(numstr), "%%x%d", i+1);
+ BLI_dynstr_append(pupds, numstr);
/* icon */
switch(GS(id->name))
@@ -1017,8 +1017,8 @@ static void IDnames_to_dyn_pupstring(DynStr *pupds, ListBase *lb, ID *link, shor
case ID_IM: /* fall through */
case ID_WO: /* fall through */
case ID_LA: /* fall through */
- BLI_snprintf(buf, sizeof(buf), "%%i%d", BKE_icon_getid(id) );
- BLI_dynstr_append(pupds, buf);
+ BLI_snprintf(numstr, sizeof(numstr), "%%i%d", BKE_icon_getid(id) );
+ BLI_dynstr_append(pupds, numstr);
break;
default:
break;
@@ -1136,10 +1136,12 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
{
ID *idtest;
int nr= 0, nrtest, a, left_len;
- char left[32], leftest[32], in_use[32];
+ char in_use[64]; /* use as a boolean array, unrelated to name length */
+
+ char left[MAX_ID_NAME + 8], leftest[MAX_ID_NAME + 8];
/* make sure input name is terminated properly */
- /* if( strlen(name) > 21 ) name[21]= 0; */
+ /* if( strlen(name) > MAX_ID_NAME-3 ) name[MAX_ID_NAME-3]= 0; */
/* removed since this is only ever called from one place - campbell */
while (1) {
@@ -1151,20 +1153,20 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
if( idtest == NULL ) return 0;
/* we have a dup; need to make a new name */
- /* quick check so we can reuse one of first 32 ids if vacant */
+ /* quick check so we can reuse one of first 64 ids if vacant */
memset(in_use, 0, sizeof(in_use));
/* get name portion, number portion ("name.number") */
left_len= BLI_split_name_num(left, &nr, name, '.');
/* if new name will be too long, truncate it */
- if(nr > 999 && left_len > 16) {
- left[16]= 0;
- left_len= 16;
+ if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
+ left[MAX_ID_NAME - 8]= 0;
+ left_len= MAX_ID_NAME - 8;
}
- else if(left_len > 17) {
- left[17]= 0;
- left_len= 17;
+ else if(left_len > (MAX_ID_NAME - 7)) {
+ left[MAX_ID_NAME - 7]= 0;
+ left_len= MAX_ID_NAME - 7;
}
for(idtest= lb->first; idtest; idtest= idtest->next) {
@@ -1206,11 +1208,11 @@ static int check_for_dupid(ListBase *lb, ID *id, char *name)
/* otherwise just continue and use a number suffix */
}
- if(nr > 999 && left_len > 16) {
+ if(nr > 999 && left_len > (MAX_ID_NAME - 8)) {
/* this would overflow name buffer */
- left[16] = 0;
- /* left_len = 16; */ /* for now this isnt used again */
- memcpy(name, left, sizeof(char) * 17);
+ left[MAX_ID_NAME - 8] = 0;
+ /* left_len = MAX_ID_NAME - 8; */ /* for now this isnt used again */
+ memcpy(name, left, sizeof(char) * (MAX_ID_NAME - 7));
continue;
}
/* this format specifier is from hell... */
@@ -1245,7 +1247,7 @@ int new_id(ListBase *lb, ID *id, const char *tname)
strncpy(name, tname, sizeof(name)-1);
- /* if result > 21, strncpy don't put the final '\0' to name.
+ /* if result > MAX_ID_NAME-3, strncpy don't put the final '\0' to name.
* easier to assign each time then to check if its needed */
name[sizeof(name)-1]= 0;
diff --git a/source/blender/blenkernel/intern/material.c b/source/blender/blenkernel/intern/material.c
index 4fda85a3247..f685d0ec151 100644
--- a/source/blender/blenkernel/intern/material.c
+++ b/source/blender/blenkernel/intern/material.c
@@ -51,6 +51,7 @@
#include "BLI_listbase.h"
#include "BLI_utildefines.h"
#include "BLI_bpath.h"
+#include "BLI_string.h"
#include "BKE_animsys.h"
#include "BKE_displist.h"
@@ -1614,7 +1615,7 @@ static void calculate_tface_materialname(char *matname, char *newname, int flag)
int digits = integer_getdigits(flag);
/* clamp the old name, remove the MA prefix and add the .TF.flag suffix
e.g. matname = "MALoooooooooooooongName"; newname = "Loooooooooooooon.TF.2" */
- sprintf(newname, "%.*s.TF.%0*d", MAX_ID_NAME-(digits+5), matname, digits, flag);
+ BLI_snprintf(newname, MAX_ID_NAME, "%.*s.TF.%0*d", MAX_ID_NAME-(digits+5), matname, digits, flag);
}
/* returns -1 if no match */
@@ -1661,8 +1662,8 @@ static short convert_tfacenomaterial(Main *main, Mesh *me, MTFace *tf, int flag)
short mat_nr= -1;
/* new material, the name uses the flag*/
- sprintf(idname, "MAMaterial.TF.%0*d", integer_getdigits(flag), flag);
-
+ BLI_snprintf(idname, sizeof(idname), "MAMaterial.TF.%0*d", integer_getdigits(flag), flag);
+
if ((ma= BLI_findstring(&main->mat, idname+2, offsetof(ID, name)+2))) {
mat_nr= mesh_getmaterialnumber(me, ma);
/* assign the material to the mesh */
diff --git a/source/blender/blenkernel/intern/mball.c b/source/blender/blenkernel/intern/mball.c
index 57fc7473860..fe2c10d7091 100644
--- a/source/blender/blenkernel/intern/mball.c
+++ b/source/blender/blenkernel/intern/mball.c
@@ -356,7 +356,7 @@ int is_basis_mball(Object *ob)
int is_mball_basis_for(Object *ob1, Object *ob2)
{
int basis1nr, basis2nr;
- char basis1name[32], basis2name[32];
+ char basis1name[MAX_ID_NAME], basis2name[MAX_ID_NAME];
BLI_split_name_num(basis1name, &basis1nr, ob1->id.name+2, '.');
BLI_split_name_num(basis2name, &basis2nr, ob2->id.name+2, '.');
@@ -378,7 +378,7 @@ void copy_mball_properties(Scene *scene, Object *active_object)
Object *ob;
MetaBall *active_mball = (MetaBall*)active_object->data;
int basisnr, obnr;
- char basisname[32], obname[32];
+ char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
BLI_split_name_num(basisname, &basisnr, active_object->id.name+2, '.');
@@ -423,7 +423,7 @@ Object *find_basis_mball(Scene *scene, Object *basis)
Object *ob,*bob= basis;
MetaElem *ml=NULL;
int basisnr, obnr;
- char basisname[32], obname[32];
+ char basisname[MAX_ID_NAME], obname[MAX_ID_NAME];
BLI_split_name_num(basisname, &basisnr, basis->id.name+2, '.');
totelem= 0;
@@ -1596,7 +1596,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
float size, totsize, obinv[4][4], obmat[4][4], vec[3];
//float max=0.0;
int a, obnr, zero_size=0;
- char obname[32];
+ char obname[MAX_ID_NAME];
copy_m4_m4(obmat, ob->obmat); /* to cope with duplicators from next_object */
invert_m4_m4(obinv, ob->obmat);
@@ -1619,7 +1619,7 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
else ml= mb->elems.first;
}
else {
- char name[32];
+ char name[MAX_ID_NAME];
int nr;
BLI_split_name_num(name, &nr, bob->id.name+2, '.');
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 8424824903e..3d8729bc788 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -831,7 +831,7 @@ Object *add_object(struct Scene *scene, int type)
{
Object *ob;
Base *base;
- char name[32];
+ char name[MAX_ID_NAME];
BLI_strncpy(name, get_obdata_defname(type), sizeof(name));
ob = add_only_object(type, name);
diff --git a/source/blender/blenkernel/intern/packedFile.c b/source/blender/blenkernel/intern/packedFile.c
index 7be8aefc883..2decc40da81 100644
--- a/source/blender/blenkernel/intern/packedFile.c
+++ b/source/blender/blenkernel/intern/packedFile.c
@@ -251,7 +251,7 @@ static char *find_new_name(char *name)
if (fop_exists(name)) {
for (number = 1; number <= 999; number++) {
- sprintf(tempname, "%s.%03d", name, number);
+ BLI_snprintf(tempname, sizeof(tempname), "%s.%03d", name, number);
if (! fop_exists(tempname)) {
break;
}
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 921e62769bf..a645cb79953 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -3411,14 +3411,14 @@ ModifierData *object_add_particle_system(Scene *scene, Object *ob, const char *n
psys->part = psys_new_settings("ParticleSettings", NULL);
if(BLI_countlist(&ob->particlesystem)>1)
- sprintf(psys->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ BLI_snprintf(psys->name, sizeof(psys->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
else
strcpy(psys->name, "ParticleSystem");
md= modifier_new(eModifierType_ParticleSystem);
if(name) BLI_strncpy(md->name, name, sizeof(md->name));
- else sprintf(md->name, "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
+ else BLI_snprintf(md->name, sizeof(md->name), "ParticleSystem %i", BLI_countlist(&ob->particlesystem));
modifier_unique_name(&ob->modifiers, md);
psmd= (ParticleSystemModifierData*) md;
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 5fbbb2a43b7..c5f948bb27f 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -3096,7 +3096,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, const char *name_src, const c
}
closedir(dir);
- strcpy(pid->cache->name, old_name);
+ BLI_strncpy(pid->cache->name, old_name, sizeof(pid->cache->name));
}
void BKE_ptcache_load_external(PTCacheID *pid)
@@ -3217,11 +3217,11 @@ void BKE_ptcache_update_info(PTCacheID *pid)
/* smoke doesn't use frame 0 as info frame so can't check based on totpoint */
if(pid->type == PTCACHE_TYPE_SMOKE_DOMAIN && totframes)
- sprintf(cache->info, "%i frames found!", totframes);
+ BLI_snprintf(cache->info, sizeof(cache->info), "%i frames found!", totframes);
else if(totframes && cache->totpoint)
- sprintf(cache->info, "%i points found!", cache->totpoint);
+ BLI_snprintf(cache->info, sizeof(cache->info), "%i points found!", cache->totpoint);
else
- sprintf(cache->info, "No valid data to read!");
+ BLI_snprintf(cache->info, sizeof(cache->info), "No valid data to read!");
return;
}
@@ -3231,9 +3231,9 @@ void BKE_ptcache_update_info(PTCacheID *pid)
int totpoint = pid->totpoint(pid->calldata, 0);
if(cache->totpoint > totpoint)
- sprintf(mem_info, "%i cells + High Resolution cached", totpoint);
+ BLI_snprintf(mem_info, sizeof(mem_info), "%i cells + High Resolution cached", totpoint);
else
- sprintf(mem_info, "%i cells cached", totpoint);
+ BLI_snprintf(mem_info, sizeof(mem_info), "%i cells cached", totpoint);
}
else {
int cfra = cache->startframe;
@@ -3243,7 +3243,7 @@ void BKE_ptcache_update_info(PTCacheID *pid)
totframes++;
}
- sprintf(mem_info, "%i frames on disk", totframes);
+ BLI_snprintf(mem_info, sizeof(mem_info), "%i frames on disk", totframes);
}
}
else {
@@ -3267,20 +3267,21 @@ void BKE_ptcache_update_info(PTCacheID *pid)
mb = (bytes > 1024.0f * 1024.0f);
- sprintf(mem_info, "%i frames in memory (%.1f %s)",
+ BLI_snprintf(mem_info, sizeof(mem_info), "%i frames in memory (%.1f %s)",
totframes,
bytes / (mb ? 1024.0f * 1024.0f : 1024.0f),
mb ? "Mb" : "kb");
}
if(cache->flag & PTCACHE_OUTDATED) {
- sprintf(cache->info, "%s, cache is outdated!", mem_info);
+ BLI_snprintf(cache->info, sizeof(cache->info), "%s, cache is outdated!", mem_info);
}
else if(cache->flag & PTCACHE_FRAMES_SKIPPED) {
- sprintf(cache->info, "%s, not exact since frame %i.", mem_info, cache->last_exact);
+ BLI_snprintf(cache->info, sizeof(cache->info), "%s, not exact since frame %i.", mem_info, cache->last_exact);
+ }
+ else {
+ BLI_snprintf(cache->info, sizeof(cache->info), "%s.", mem_info);
}
- else
- sprintf(cache->info, "%s.", mem_info);
}
void BKE_ptcache_validate(PointCache *cache, int framenr)
diff --git a/source/blender/blenkernel/intern/property.c b/source/blender/blenkernel/intern/property.c
index d6c4b5f3a2e..5668907b094 100644
--- a/source/blender/blenkernel/intern/property.c
+++ b/source/blender/blenkernel/intern/property.c
@@ -171,7 +171,7 @@ void unique_property(bProperty *first, bProperty *prop, int force)
i= 0;
do { /* ensure we have enough chars for the new number in the name */
- sprintf(num, "%d", i++);
+ BLI_snprintf(num, sizeof(num), "%d", i++);
BLI_strncpy(new_name, base_name, sizeof(prop->name) - strlen(num));
strcat(new_name, num);
} while(get_property__internal(first, prop, new_name));
diff --git a/source/blender/blenkernel/intern/sca.c b/source/blender/blenkernel/intern/sca.c
index f7eda6bd9b3..92dfe90eec1 100644
--- a/source/blender/blenkernel/intern/sca.c
+++ b/source/blender/blenkernel/intern/sca.c
@@ -428,7 +428,7 @@ void init_actuator(bActuator *act)
case ACT_CAMERA:
act->data= MEM_callocN(sizeof(bCameraActuator), "camact");
ca = act->data;
- ca->axis = ACT_CAMERA_X;
+ ca->axis = OB_POSX;
ca->damping = 1.0/32.0;
break;
case ACT_EDIT_OBJECT:
diff --git a/source/blender/blenkernel/intern/seqeffects.c b/source/blender/blenkernel/intern/seqeffects.c
index 731f82e1b80..a8f89b0a1eb 100644
--- a/source/blender/blenkernel/intern/seqeffects.c
+++ b/source/blender/blenkernel/intern/seqeffects.c
@@ -176,7 +176,7 @@ static void open_plugin_seq(PluginSeq *pis, const char *seqname)
MEM_freeN(info);
cp= BLI_dynlib_find_symbol(pis->handle, "seqname");
- if(cp) BLI_strncpy(cp, seqname, 21);
+ if(cp) BLI_strncpy(cp, seqname, SEQ_NAME_MAXSTR);
} else {
printf ("Plugin returned unrecognized version number\n");
return;
@@ -303,7 +303,10 @@ static struct ImBuf * do_plugin_effect(
cp = BLI_dynlib_find_symbol(
seq->plugin->handle, "seqname");
- if(cp) strncpy(cp, seq->name+2, 22);
+ /* XXX: it's crappy to limit copying buffer by it's lemgth,
+ * but assuming plugin stuff is using correct buffer size
+ * it should be fine */
+ if(cp) strncpy(cp, seq->name+2, sizeof(seq->name)-2);
if (seq->plugin->current_private_data) {
*seq->plugin->current_private_data
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 6da9199ddc4..71377799651 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -833,8 +833,8 @@ void clear_scene_in_allseqs(Main *bmain, Scene *scene)
typedef struct SeqUniqueInfo {
Sequence *seq;
- char name_src[32];
- char name_dest[32];
+ char name_src[SEQ_NAME_MAXSTR];
+ char name_dest[SEQ_NAME_MAXSTR];
int count;
int match;
} SeqUniqueInfo;
@@ -850,7 +850,8 @@ static void seqbase_unique_name(ListBase *seqbasep, SeqUniqueInfo *sui)
Sequence *seq;
for(seq=seqbasep->first; seq; seq= seq->next) {
if (sui->seq != seq && strcmp(sui->name_dest, seq->name+2)==0) {
- sprintf(sui->name_dest, "%.17s.%03d", sui->name_src, sui->count++); /*24 - 2 for prefix, -1 for \0 */
+ /* SEQ_NAME_MAXSTR - 2 for prefix, -1 for \0, -4 for the number */
+ BLI_snprintf(sui->name_dest, sizeof(sui->name_dest), "%.59s.%03d", sui->name_src, sui->count++);
sui->match= 1; /* be sure to re-scan */
}
}
@@ -3388,13 +3389,13 @@ int seq_swap(Sequence *seq_a, Sequence *seq_b, const char **error_str)
/* XXX - hackish function needed for transforming strips! TODO - have some better solution */
void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
{
- char str[32];
+ char str[SEQ_NAME_MAXSTR+3];
FCurve *fcu;
if(scene->adt==NULL || ofs==0 || scene->adt->action==NULL)
return;
- sprintf(str, "[\"%s\"]", seq->name+2);
+ BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
for (fcu= scene->adt->action->curves.first; fcu; fcu= fcu->next) {
if(strstr(fcu->rna_path, "sequence_editor.sequences_all[") && strstr(fcu->rna_path, str)) {
@@ -3411,7 +3412,7 @@ void seq_offset_animdata(Scene *scene, Sequence *seq, int ofs)
void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
{
- char str_from[32];
+ char str_from[SEQ_NAME_MAXSTR+3];
FCurve *fcu;
FCurve *fcu_last;
FCurve *fcu_cpy;
@@ -3420,7 +3421,7 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
if(scene->adt==NULL || scene->adt->action==NULL)
return;
- sprintf(str_from, "[\"%s\"]", name_src);
+ BLI_snprintf(str_from, sizeof(str_from), "[\"%s\"]", name_src);
fcu_last= scene->adt->action->curves.last;
@@ -3441,13 +3442,13 @@ void seq_dupe_animdata(Scene *scene, const char *name_src, const char *name_dst)
/* XXX - hackish function needed to remove all fcurves belonging to a sequencer strip */
static void seq_free_animdata(Scene *scene, Sequence *seq)
{
- char str[32];
+ char str[SEQ_NAME_MAXSTR+3];
FCurve *fcu;
if(scene->adt==NULL || scene->adt->action==NULL)
return;
- sprintf(str, "[\"%s\"]", seq->name+2);
+ BLI_snprintf(str, sizeof(str), "[\"%s\"]", seq->name+2);
fcu= scene->adt->action->curves.first;
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 649984a7934..f5b677203f6 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -233,7 +233,7 @@ struct bSound* sound_new_buffer(struct Main *bmain, struct bSound *source)
{
bSound* sound = NULL;
- char name[25];
+ char name[MAX_ID_NAME+5];
strcpy(name, "buf_");
strcpy(name + 4, source->id.name);
@@ -257,7 +257,7 @@ struct bSound* sound_new_limiter(struct Main *bmain, struct bSound *source, floa
{
bSound* sound = NULL;
- char name[25];
+ char name[MAX_ID_NAME+5];
strcpy(name, "lim_");
strcpy(name + 4, source->id.name);
diff --git a/source/blender/blenkernel/intern/texture.c b/source/blender/blenkernel/intern/texture.c
index 7051376a1f4..88858c9ff51 100644
--- a/source/blender/blenkernel/intern/texture.c
+++ b/source/blender/blenkernel/intern/texture.c
@@ -168,7 +168,7 @@ PluginTex *add_plugin_tex(char *str)
pit= MEM_callocN(sizeof(PluginTex), "plugintex");
- strcpy(pit->name, str);
+ BLI_strncpy(pit->name, str, sizeof(pit->name));
open_plugin_tex(pit);
if(pit->doit==NULL) {
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index e55f4dfbf78..2f9689bfe0e 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -651,7 +651,7 @@ void BKE_tracking_clipboard_paste_tracks(MovieTracking *tracking, MovieTrackingO
/*********************** tracks map *************************/
typedef struct TracksMap {
- char object_name[32];
+ char object_name[MAX_NAME];
int is_camera;
int num_tracks;
@@ -669,7 +669,7 @@ static TracksMap *tracks_map_new(const char *object_name, int is_camera, int num
{
TracksMap *map= MEM_callocN(sizeof(TracksMap), "TrackingsMap");
- strcpy(map->object_name, object_name);
+ BLI_strncpy(map->object_name, object_name, sizeof(map->object_name));
map->is_camera= is_camera;
map->num_tracks= num_tracks;
@@ -1529,7 +1529,7 @@ typedef struct MovieReconstructContext {
struct libmv_Reconstruction *reconstruction;
#endif
- char object_name[32];
+ char object_name[MAX_NAME];
int is_camera;
float focal_length;
@@ -1784,7 +1784,7 @@ MovieReconstructContext* BKE_tracking_reconstruction_context_new(MovieTracking *
int sfra= INT_MAX, efra= INT_MIN;
MovieTrackingTrack *track;
- strcpy(context->object_name, object->name);
+ BLI_strncpy(context->object_name, object->name, sizeof(context->object_name));
context->is_camera = object->flag&TRACKING_OBJECT_CAMERA;
context->tracks_map= tracks_map_new(context->object_name, context->is_camera, num_tracks, 0);
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index bf547584b9e..bcdd93ed70b 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -1077,9 +1077,9 @@ IDProperty *ffmpeg_property_add(RenderData *rd, const char *type, int opt_index,
}
if (parent_index) {
- sprintf(name, "%s:%s", parent->name, o->name);
+ BLI_snprintf(name, sizeof(name), "%s:%s", parent->name, o->name);
} else {
- strcpy(name, o->name);
+ BLI_strncpy(name, o->name, sizeof(name));
}
fprintf(stderr, "ffmpeg_property_add: %s %d %d %s\n",