more uninitialized variables and auto-complete could copy a string over its self.

This commit is contained in:
Campbell Barton 2009-02-18 05:49:51 +00:00
parent 21925c6f47
commit 7d2582de09
3 changed files with 12 additions and 9 deletions

@ -2032,7 +2032,7 @@ static void write_global(WriteData *wd)
fg.subversion= BLENDER_SUBVERSION;
fg.minversion= BLENDER_MINVERSION;
fg.minsubversion= BLENDER_MINSUBVERSION;
fg.pads= 0; /* prevent mem checkers from complaining */
writestruct(wd, GLOB, "FileGlobal", 1, &fg);
}

@ -1096,14 +1096,15 @@ void lattice_foreachScreenVert(void (*func)(void *userData, BPoint *bp, int x, i
float *co = dl?dl->verts:NULL;
BPoint *bp = editLatt->def;
float pmat[4][4], vmat[4][4];
short s[2];
short s[2] = {IS_CLIPPED, 0};
view3d_get_object_project_mat(curarea, G.obedit, pmat, vmat);
for (i=0; i<N; i++, bp++, co+=3) {
if (bp->hide==0) {
view3d_project_short_clip(curarea, dl?co:bp->vec, s, pmat, vmat);
func(userData, bp, s[0], s[1]);
if (s[0] != IS_CLIPPED)
func(userData, bp, s[0], s[1]);
}
}
}
@ -1303,7 +1304,7 @@ void mesh_foreachScreenFace(void (*func)(void *userData, EditFace *efa, int x, i
void nurbs_foreachScreenVert(void (*func)(void *userData, Nurb *nu, BPoint *bp, BezTriple *bezt, int beztindex, int x, int y), void *userData)
{
float pmat[4][4], vmat[4][4];
short s[2];
short s[2] = {IS_CLIPPED, 0};
Nurb *nu;
int i;
@ -1339,7 +1340,8 @@ void nurbs_foreachScreenVert(void (*func)(void *userData, Nurb *nu, BPoint *bp,
if(bp->hide==0) {
view3d_project_short_clip(curarea, bp->vec, s, pmat, vmat);
func(userData, nu, bp, NULL, -1, s[0], s[1]);
if (s[0] != IS_CLIPPED)
func(userData, nu, bp, NULL, -1, s[0], s[1]);
}
}
}

@ -6083,12 +6083,13 @@ void autocomplete_do_name(AutoComplete *autocpl, const char *name)
}
void autocomplete_end(AutoComplete *autocpl, char *autoname)
{
{
if(autocpl->truncate[0])
BLI_strncpy(autoname, autocpl->truncate, autocpl->maxlen);
else
BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
else {
if (autoname != autocpl->startname) /* dont copy a string over its self */
BLI_strncpy(autoname, autocpl->startname, autocpl->maxlen);
}
MEM_freeN(autocpl->truncate);
MEM_freeN(autocpl);
}