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')
-rw-r--r--source/blender/blenkernel/BKE_deform.h2
-rw-r--r--source/blender/blenkernel/intern/deform.c25
-rw-r--r--source/blender/editors/space_console/console_draw.c2
3 files changed, 15 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index 52051712ff0..eaabc57c781 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -64,7 +64,7 @@ void defvert_normalize(struct MDeformVert *dvert);
/* utility function, note that 32 chars is the maximum string length since its only
* used with defgroups currently */
-void flip_side_name(char *name, const char *from_name, int strip_number);
+void flip_side_name(char name[32], const char from_name[32], int strip_number);
#endif
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 7f51cfdc8b6..7967013c2d4 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -335,33 +335,34 @@ void defgroup_unique_name (bDeformGroup *dg, Object *ob)
}
/* finds the best possible flipped name. For renaming; check for unique names afterwards */
-/* if strip_number: removes number extensions */
-void flip_side_name (char *name, const char *from_name, int strip_number)
+/* if strip_number: removes number extensions
+ * note: dont use sizeof() for 'name' or 'from_name' */
+void flip_side_name (char name[MAX_VGROUP_NAME], const char from_name[MAX_VGROUP_NAME], int strip_number)
{
int len;
- char prefix[sizeof(((bDeformGroup *)NULL)->name)]= ""; /* The part before the facing */
- char suffix[sizeof(((bDeformGroup *)NULL)->name)]= ""; /* The part after the facing */
- char replace[sizeof(((bDeformGroup *)NULL)->name)]= ""; /* The replacement string */
- char number[sizeof(((bDeformGroup *)NULL)->name)]= ""; /* The number extension string */
+ char prefix[MAX_VGROUP_NAME]= ""; /* The part before the facing */
+ char suffix[MAX_VGROUP_NAME]= ""; /* The part after the facing */
+ char replace[MAX_VGROUP_NAME]= ""; /* The replacement string */
+ char number[MAX_VGROUP_NAME]= ""; /* The number extension string */
char *index=NULL;
- len= strlen(from_name);
+ len= BLI_strnlen(from_name, MAX_VGROUP_NAME);
if(len<3) return; // we don't do names like .R or .L
- strcpy(name, from_name);
+ BLI_strncpy(name, from_name, MAX_VGROUP_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);
+ len= BLI_strnlen(name, MAX_VGROUP_NAME);
}
}
- strcpy(prefix, name);
+ BLI_strncpy(prefix, name, sizeof(prefix));
#define IS_SEPARATOR(a) ((a)=='.' || (a)==' ' || (a)=='-' || (a)=='_')
@@ -445,7 +446,7 @@ void flip_side_name (char *name, const char *from_name, int strip_number)
#undef IS_SEPARATOR
- sprintf (name, "%s%s%s%s", prefix, replace, suffix, number);
+ BLI_snprintf (name, MAX_VGROUP_NAME, "%s%s%s%s", prefix, replace, suffix, number);
}
float defvert_find_weight(const struct MDeformVert *dvert, const int group_num)
diff --git a/source/blender/editors/space_console/console_draw.c b/source/blender/editors/space_console/console_draw.c
index 3a19074bbb7..ba9993cfe60 100644
--- a/source/blender/editors/space_console/console_draw.c
+++ b/source/blender/editors/space_console/console_draw.c
@@ -193,7 +193,7 @@ static int console_textview_main__internal(struct SpaceConsole *sc, struct ARegi
View2D *v2d= &ar->v2d;
- TextViewContext tvc= {NULL};
+ TextViewContext tvc= {0};
tvc.begin= console_textview_begin;
tvc.end= console_textview_end;