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:
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/armature.c17
-rw-r--r--source/blender/blenkernel/intern/blender.c4
-rw-r--r--source/blender/blenkernel/intern/boids.c2
-rw-r--r--source/blender/blenkernel/intern/constraint.c2
-rw-r--r--source/blender/blenkernel/intern/deform.c6
-rw-r--r--source/blender/blenkernel/intern/exotic.c2
-rw-r--r--source/blender/blenkernel/intern/font.c11
-rw-r--r--source/blender/blenkernel/intern/idprop.c4
-rw-r--r--source/blender/blenkernel/intern/object.c2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c8
-rw-r--r--source/blender/blenkernel/intern/sequencer.c8
11 files changed, 33 insertions, 33 deletions
diff --git a/source/blender/blenkernel/intern/armature.c b/source/blender/blenkernel/intern/armature.c
index 14c4b6f97ab..e23fe357141 100644
--- a/source/blender/blenkernel/intern/armature.c
+++ b/source/blender/blenkernel/intern/armature.c
@@ -248,16 +248,15 @@ Bone *get_named_bone (bArmature *arm, const char *name)
}
/* Finds the best possible extension to the name on a particular axis. (For renaming, check for unique names afterwards)
- * This assumes that bone names are at most 32 chars long!
* strip_number: removes number extensions (TODO: not used)
* axis: the axis to name on
* head/tail: the head/tail co-ordinate of the bone on the specified axis
*/
-int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float head, float tail)
+int bone_autoside_name (char name[MAXBONENAME], int UNUSED(strip_number), short axis, float head, float tail)
{
unsigned int len;
- char basename[32]={""};
- char extension[5]={""};
+ char basename[MAXBONENAME]= "";
+ char extension[5]= "";
len= strlen(name);
if (len == 0) return 0;
@@ -350,13 +349,13 @@ int bone_autoside_name (char *name, int UNUSED(strip_number), short axis, float
}
}
}
-
- if ((32 - len) < strlen(extension) + 1) { /* add 1 for the '.' */
+
+ if ((MAXBONENAME - len) < strlen(extension) + 1) { /* add 1 for the '.' */
strncpy(name, basename, len-strlen(extension));
}
-
- sprintf(name, "%s.%s", basename, extension);
-
+
+ BLI_snprintf(name, MAXBONENAME, "%s.%s", basename, extension);
+
return 1;
}
diff --git a/source/blender/blenkernel/intern/blender.c b/source/blender/blenkernel/intern/blender.c
index 222d416e2f0..828f7ca0fa3 100644
--- a/source/blender/blenkernel/intern/blender.c
+++ b/source/blender/blenkernel/intern/blender.c
@@ -457,7 +457,7 @@ static int read_undosave(bContext *C, UndoElem *uel)
success= BKE_read_file_from_memfile(C, &uel->memfile, NULL);
/* restore */
- strcpy(G.main->name, mainstr); /* restore */
+ BLI_strncpy(G.main->name, mainstr, sizeof(G.main->name)); /* restore */
G.fileflags= fileflags;
if(success) {
@@ -525,7 +525,7 @@ void BKE_write_undo(bContext *C, const char *name)
success= BLO_write_file(CTX_data_main(C), tstr, G.fileflags, NULL, NULL);
- strcpy(curundo->str, tstr);
+ BLI_strncpy(curundo->str, tstr, sizeof(curundo->str));
}
else {
MemFile *prevfile=NULL;
diff --git a/source/blender/blenkernel/intern/boids.c b/source/blender/blenkernel/intern/boids.c
index 228827bab68..ae4882b0eca 100644
--- a/source/blender/blenkernel/intern/boids.c
+++ b/source/blender/blenkernel/intern/boids.c
@@ -1470,7 +1470,7 @@ BoidRule *boid_new_rule(int type)
rule->type = type;
rule->flag |= BOIDRULE_IN_AIR|BOIDRULE_ON_LAND;
- strcpy(rule->name, boidrule_type_items[type-1].name);
+ BLI_strncpy(rule->name, boidrule_type_items[type-1].name, sizeof(rule->name));
return rule;
}
diff --git a/source/blender/blenkernel/intern/constraint.c b/source/blender/blenkernel/intern/constraint.c
index be9e7609a64..086cd237be8 100644
--- a/source/blender/blenkernel/intern/constraint.c
+++ b/source/blender/blenkernel/intern/constraint.c
@@ -752,7 +752,7 @@ static void default_get_tarmat (bConstraint *con, bConstraintOb *cob, bConstrain
bConstraintTarget *ctn = ct->next; \
if (nocopy == 0) { \
datatar= ct->tar; \
- strcpy(datasubtarget, ct->subtarget); \
+ BLI_strncpy(datasubtarget, ct->subtarget, sizeof(datasubtarget)); \
con->tarspace= (char)ct->space; \
} \
\
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 1b63e4fd5d1..2014dfe6d0a 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -348,20 +348,20 @@ void flip_side_name (char *name, const char *from_name, int strip_number)
len= strlen(from_name);
if(len<3) return; // we don't do names like .R or .L
- strcpy(name, from_name);
+ BLI_strncpy(name, from_name, sizeof(name));
/* We first check the case with a .### extension, let's find the last period */
if(isdigit(name[len-1])) {
index= strrchr(name, '.'); // last occurrence
if (index && isdigit(index[1]) ) { // doesnt handle case bone.1abc2 correct..., whatever!
if(strip_number==0)
- strcpy(number, index);
+ BLI_strncpy(number, index, sizeof(number));
*index= 0;
len= strlen(name);
}
}
- strcpy (prefix, name);
+ BLI_strncpy(prefix, name, sizeof(prefix));
#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_')
diff --git a/source/blender/blenkernel/intern/exotic.c b/source/blender/blenkernel/intern/exotic.c
index ba36a826afe..469fc39be10 100644
--- a/source/blender/blenkernel/intern/exotic.c
+++ b/source/blender/blenkernel/intern/exotic.c
@@ -1652,7 +1652,7 @@ static void dxf_read_arc(Scene *scene, int noob)
cent[2]= center[2];
dxf_get_mesh(scene, &me, &ob, noob);
- strcpy(oldllay, layname);
+ BLI_strncpy(oldllay, layname, sizeof(oldllay));
if(ob) VECCOPY(ob->loc, cent);
dxf_add_mat (ob, me, color, layname);
diff --git a/source/blender/blenkernel/intern/font.c b/source/blender/blenkernel/intern/font.c
index 1d7ce197cba..9de8af2c981 100644
--- a/source/blender/blenkernel/intern/font.c
+++ b/source/blender/blenkernel/intern/font.c
@@ -96,13 +96,14 @@ chtoutf8(unsigned long c, char *o)
void
wcs2utf8s(char *dst, wchar_t *src)
{
- char ch[5];
+ /* NULL terminator not needed */
+ char ch[4];
while(*src)
{
- memset(ch, 0, 5);
+ memset(ch, 0, sizeof(ch));
chtoutf8(*src++, ch);
- strcat(dst, ch);
+ dst= strncat(dst, ch, sizeof(ch));
}
}
@@ -363,14 +364,14 @@ VFont *load_vfont(const char *name)
struct TmpFont *tmpfnt;
if (strcmp(name, FO_BUILTIN_NAME)==0) {
- strcpy(filename, name);
+ BLI_strncpy(filename, name, sizeof(filename));
pf= get_builtin_packedfile();
is_builtin= 1;
} else {
char dir[FILE_MAXDIR];
- strcpy(dir, name);
+ BLI_strncpy(dir, name, sizeof(dir));
BLI_splitdirstring(dir, filename);
pf= newPackedFile(NULL, name);
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index 7829d9b5e0d..f8025d38f74 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -711,9 +711,9 @@ IDProperty *IDP_New(int type, IDPropertyTemplate val, const char *name)
prop->len = 1; /*NULL string, has len of 1 to account for null byte.*/
} else {
int stlen = strlen(st) + 1;
- prop->data.pointer = MEM_callocN(stlen, "id property string 2");
+ prop->data.pointer = MEM_mallocN(stlen, "id property string 2");
prop->len = prop->totallen = stlen;
- strcpy(prop->data.pointer, st);
+ memcpy(prop->data.pointer, st, stlen);
}
break;
}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index 36350f23b6d..5d5271bba8c 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -1078,7 +1078,7 @@ Object *add_object(struct Scene *scene, int type)
Base *base;
char name[32];
- strcpy(name, get_obdata_defname(type));
+ BLI_strncpy(name, get_obdata_defname(type), sizeof(name));
ob = add_only_object(type, name);
ob->data= add_obdata_from_type(type);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 84331e1b318..69699c85203 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -1992,7 +1992,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
if (strncmp(filename, de->d_name, len ) == 0) { /* do we have the right prefix */
if (mode == PTCACHE_CLEAR_ALL) {
pid->cache->last_exact = MIN2(pid->cache->startframe, 0);
- BLI_join_dirfile(path_full, path, de->d_name);
+ BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
} else {
/* read the number of the file */
@@ -2006,7 +2006,7 @@ void BKE_ptcache_id_clear(PTCacheID *pid, int mode, unsigned int cfra)
if((mode==PTCACHE_CLEAR_BEFORE && frame < cfra) ||
(mode==PTCACHE_CLEAR_AFTER && frame > cfra) ) {
- BLI_join_dirfile(path_full, path, de->d_name);
+ BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
if(pid->cache->cached_frames && frame >=sta && frame <= end)
pid->cache->cached_frames[frame-sta] = 0;
@@ -2354,7 +2354,7 @@ void BKE_ptcache_remove(void)
if( strcmp(de->d_name, ".")==0 || strcmp(de->d_name, "..")==0) {
/* do nothing */
} else if (strstr(de->d_name, PTCACHE_EXT)) { /* do we have the right extension?*/
- BLI_join_dirfile(path_full, path, de->d_name);
+ BLI_join_dirfile(path_full, sizeof(path_full), path, de->d_name);
BLI_delete(path_full, 0, 0);
} else {
rmdir = 0; /* unknown file, dont remove the dir */
@@ -2856,7 +2856,7 @@ void BKE_ptcache_disk_cache_rename(PTCacheID *pid, char *from, char *to)
BLI_strncpy(num, de->d_name + (strlen(de->d_name) - 15), sizeof(num));
frame = atoi(num);
- BLI_join_dirfile(old_path_full, path, de->d_name);
+ BLI_join_dirfile(old_path_full, sizeof(old_path_full), path, de->d_name);
ptcache_filename(pid, new_path_full, frame, 1, 1);
BLI_rename(old_path_full, new_path_full);
}
diff --git a/source/blender/blenkernel/intern/sequencer.c b/source/blender/blenkernel/intern/sequencer.c
index 6aca23b8011..8f07ed48803 100644
--- a/source/blender/blenkernel/intern/sequencer.c
+++ b/source/blender/blenkernel/intern/sequencer.c
@@ -664,7 +664,7 @@ void reload_sequence_new_file(Scene *scene, Sequence * seq, int lock_range)
new_tstripdata(seq);
if (ELEM3(seq->type, SEQ_SCENE, SEQ_META, SEQ_IMAGE)==0) {
- BLI_join_dirfile(str, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_join_dirfile(str, sizeof(str), seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(str, G.main->name);
}
@@ -1134,7 +1134,7 @@ static int seq_proxy_get_fname(SeqRenderData context, Sequence * seq, int cfra,
}
if (seq->flag & SEQ_USE_PROXY_CUSTOM_FILE) {
- BLI_join_dirfile(name, dir, seq->strip->proxy->file);
+ BLI_join_dirfile(name, FILE_MAX, dir, seq->strip->proxy->file); /* XXX, not real length */
BLI_path_abs(name, G.main->name);
return TRUE;
@@ -2043,7 +2043,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
StripElem * s_elem = give_stripelem(seq, cfra);
if (s_elem) {
- BLI_join_dirfile(name, seq->strip->dir, s_elem->name);
+ BLI_join_dirfile(name, sizeof(name), seq->strip->dir, s_elem->name);
BLI_path_abs(name, G.main->name);
}
@@ -2066,7 +2066,7 @@ static ImBuf * seq_render_strip(SeqRenderData context, Sequence * seq, float cfr
case SEQ_MOVIE:
{
if(seq->anim==0) {
- BLI_join_dirfile(name, seq->strip->dir, seq->strip->stripdata->name);
+ BLI_join_dirfile(name, sizeof(name), seq->strip->dir, seq->strip->stripdata->name);
BLI_path_abs(name, G.main->name);
seq->anim = openanim(name, IB_rect |