[brlcad-commits] SF.net SVN: brlcad: [30989] brlcad/trunk/src/mged/clone.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <br...@us...> - 2008-05-05 19:53:17
|
Revision: 30989 http://brlcad.svn.sourceforge.net/brlcad/?rev=30989&view=rev Author: brlcad Date: 2008-05-05 12:53:24 -0700 (Mon, 05 May 2008) Log Message: ----------- fix some places in the v4 support where NAMESIZE needs to be used instead of CLONE_BUFSIZE, make tracker pair up bu_free with the bu_calloc calls Modified Paths: -------------- brlcad/trunk/src/mged/clone.c Modified: brlcad/trunk/src/mged/clone.c =================================================================== --- brlcad/trunk/src/mged/clone.c 2008-05-05 19:39:41 UTC (rev 30988) +++ brlcad/trunk/src/mged/clone.c 2008-05-05 19:53:24 UTC (rev 30989) @@ -302,7 +302,7 @@ } if (rp->u_id == ID_SOLID) { - bu_strlcpy(rp->s.s_name, dp->d_namep, CLONE_BUFSIZE); + bu_strlcpy(rp->s.s_name, dp->d_namep, NAMESIZE); /* mirror */ if (state->miraxis != W) { @@ -507,7 +507,7 @@ bu_vls_strcpy(&obj_list.names[idx].dest[i], bu_vls_addr(name)); bu_vls_free(name); } - bu_strlcpy(rp[0].c.c_name, bu_vls_addr(&obj_list.names[idx].dest[i]), CLONE_BUFSIZE); + bu_strlcpy(rp[0].c.c_name, bu_vls_addr(&obj_list.names[idx].dest[i]), NAMESIZE); /* add the object to the directory */ dp = db_diradd(_dbip, rp->c.c_name, RT_DIR_PHONY_ADDR, proto->d_len, proto->d_flags, &proto->d_minor_type); @@ -521,7 +521,7 @@ bu_log("ERROR: clone internal error looking up %s\n", rp[j].M.m_instname); return NULL; } - snprintf(rp[j].M.m_instname, CLONE_BUFSIZE, "%s", obj_list.names[index_in_list(obj_list, rp[j].M.m_instname)].dest[i]); + snprintf(rp[j].M.m_instname, NAMESIZE, "%s", obj_list.names[index_in_list(obj_list, rp[j].M.m_instname)].dest[i]); } /* write the object to disk */ @@ -1210,19 +1210,16 @@ vect_t *rots; for (i = 0; i < 2; i++) - vargs[i] = (char *)bu_malloc(sizeof(char)*CLONE_BUFSIZE, "alloc vargs1"); + vargs[i] = (char *)bu_calloc(CLONE_BUFSIZE, sizeof(char), "alloc vargs[i]"); + vargs[0][0] = 'e'; - bu_strlcpy(vargs[0], "e", sizeof(vargs[0])); - bu_strlcpy(vargs[1], bu_vls_addr(&links[j].name), CLONE_BUFSIZE); - vargs[2] = NULL; - state.interp = interp; state.incr = inc; state.n_copies = 1; state.draw_obj = 0; state.miraxis = W; - dps = (struct directory **)bu_malloc(sizeof(struct directory *)*n_links, "alloc dps"); + dps = (struct directory **)bu_calloc(n_links, sizeof(struct directory *), "alloc dps array"); /* rots = (vect_t *)bu_malloc(sizeof(vect_t)*n_links, "alloc rots");*/ for (i = 0; i < n_links; i++) { /* global dbip */ @@ -1230,7 +1227,7 @@ /* VSET(rots[i], 0, 0, 0);*/ } - for (i = 0; i < n_verts-1; i++) + for (i = 0; i < n_verts-1; i++) { for (j = 0; j < n_links; j++) { if (i == 0) { VSCALE(state.trans, verts[n_links*i+j], local2base); @@ -1251,7 +1248,6 @@ /* global dbip */ dps[j] = copy_object(dbip, &rt_uniresource, &state); bu_strlcpy(vargs[1], dps[j]->d_namep, CLONE_BUFSIZE); - /* bu_strlcpy(vargs[1], obj_list.names[index_in_list(obj_list, links[j].name)].dest[0], sizeof(vargs[1]));*/ if (!no_draw || !is_dm_null()) { drawtrees(2, vargs, 1); @@ -1263,10 +1259,12 @@ fprintf(stdout, "."); fflush(stdout); } + } fprintf(stdout, "\n"); + bu_free(dps, "free dps array"); + for (i = 0; i < 2; i++) - bu_free((char *)vargs[i], "free vargs[i]"); - free(dps); + bu_free(vargs[i], "free vargs[i]"); } free(s.t); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |