[brlcad-commits] SF.net SVN: brlcad:[44391] brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <r_...@us...> - 2011-04-14 21:58:10
|
Revision: 44391 http://brlcad.svn.sourceforge.net/brlcad/?rev=44391&view=rev Author: r_weiss Date: 2011-04-14 21:58:03 +0000 (Thu, 14 Apr 2011) Log Message: ----------- Updated function 'nmg_bool' in file 'nmg_bool.c'. This update supports the new prototype function 'nmg_triangulate_fu' (nmg triangulate faceuse) and is disabled by default since it is untested in the production code. This update corrects potential corruption in the classlist array. This update is a work in progress. Modified Paths: -------------- brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c Modified: brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c =================================================================== --- brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c 2011-04-14 21:28:12 UTC (rev 44390) +++ brlcad/trunk/src/librt/primitives/nmg/nmg_bool.c 2011-04-14 21:58:03 UTC (rev 44391) @@ -553,6 +553,9 @@ int i; int nelem; long *classlist[8]; +#ifdef TRI_PROTOTYPE + long *classlist_base; +#endif FILE *fd, *fp; struct model *m; struct nmgregion *rA; @@ -671,12 +674,22 @@ * XXX The classlist really only needs to be an unsigned char, * XXX not a long*. */ + +#ifdef TRI_PROTOTYPE + nelem = (m->maxindex)*10+1; /* includes extra space */ + classlist_base = (long *)bu_calloc(8 * nelem + 1, + sizeof(long), "nmg_bool classlist_base"); + for (i = 0; i < 8; i++) { + classlist[i] = classlist_base + 8 + (i * nelem); + } +#else nelem = (m->maxindex)*4+1; /* includes extra space */ classlist[0] = (long *)bu_calloc(8 * nelem + 1, sizeof(long), "nmg_bool classlist[8]"); for (i = 1; i < 8; i++) { classlist[i] = classlist[0] + i * nelem; } +#endif nmg_classify_shared_edges_verts(sA, sB, classlist); @@ -918,7 +931,11 @@ } } +#ifdef TRI_PROTOTYPE + bu_free((char *)classlist_base, "nmg_bool classlist_base"); +#else bu_free((char *)classlist[0], "nmg_bool classlist[8]"); +#endif if (rt_g.NMG_debug & DEBUG_BOOL) { bu_log("Returning from NMG_BOOL\n"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |