Revision: 45884
          http://brlcad.svn.sourceforge.net/brlcad/?rev=45884&view=rev
Author:   brlcad
Date:     2011-08-10 05:50:34 +0000 (Wed, 10 Aug 2011)

Log Message:
-----------
even more magic fallout.  highlights the importance of consistently testing 
magic numbers, particularly where pointers to them are shoved into bu pointer 
tables and end up with signage issues.

Modified Paths:
--------------
    brlcad/trunk/src/librt/primitives/extrude/extrude.c
    brlcad/trunk/src/librt/primitives/revolve/revolve.c
    brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp

Modified: brlcad/trunk/src/librt/primitives/extrude/extrude.c
===================================================================
--- brlcad/trunk/src/librt/primitives/extrude/extrude.c 2011-08-10 05:36:24 UTC 
(rev 45883)
+++ brlcad/trunk/src/librt/primitives/extrude/extrude.c 2011-08-10 05:50:34 UTC 
(rev 45884)
@@ -652,7 +652,7 @@
 
     /* intersect with projected curve */
     for (i=0; i<crv->count; i++) {
-       long *lng=(long *)crv->segment[i];
+       uint32_t *lng=(uint32_t *)crv->segment[i];
        struct line_seg *lsg;
        struct carc_seg *csg=NULL;
        struct bezier_seg *bsg=NULL;
@@ -1243,13 +1243,13 @@
     struct carc_seg *csg;
     struct nurb_seg *nsg;
     struct bezier_seg *bsg;
-    long *lng;
+    uint32_t *lng;
     point2d_t *V;
     point2d_t pta;
     int i;
     int coords;
 
-    lng = (long *)seg;
+    lng = (uint32_t *)seg;
 
     switch (*lng) {
        case CURVE_LSEG_MAGIC:
@@ -1401,7 +1401,7 @@
     norm[1] = dir[0];
 
     for (i=0; i<BU_PTBL_END(loop); i++) {
-       long *lng;
+       uint32_t *lng;
        struct loop_inter *inter;
        struct line_seg *lsg=NULL;
        struct carc_seg *csg=NULL;
@@ -1413,7 +1413,7 @@
        point2d_t *intercept;
        point2d_t *normal = NULL;
 
-       lng = BU_PTBL_GET(loop, i);
+       lng = (uint32_t *)BU_PTBL_GET(loop, i);
        switch (*lng) {
            case CURVE_LSEG_MAGIC:
                lsg = (struct line_seg *)lng;

Modified: brlcad/trunk/src/librt/primitives/revolve/revolve.c
===================================================================
--- brlcad/trunk/src/librt/primitives/revolve/revolve.c 2011-08-10 05:36:24 UTC 
(rev 45883)
+++ brlcad/trunk/src/librt/primitives/revolve/revolve.c 2011-08-10 05:50:34 UTC 
(rev 45884)
@@ -125,13 +125,13 @@
     nseg = rev->sk->curve.count;
 
     for (i=0; i<nseg; i++) {
-       long *lng;
+       uint32_t *lng;
        struct line_seg *lsg;
        struct carc_seg *csg;
        struct nurb_seg *nsg;
        struct bezier_seg *bsg;
 
-       lng = (long *)rev->sk->curve.segment[i];
+       lng = (uint32_t *)rev->sk->curve.segment[i];
 
        switch (*lng) {
            case CURVE_LSEG_MAGIC:
@@ -253,7 +253,7 @@
     point_t hit1, hit2;
     point2d_t hit2d, pt1, pt2;
     fastf_t a, b, c, disc, k1, k2, t1, t2;
-    long *lng;
+    uint32_t *lng;
     struct line_seg *lsg;
     struct carc_seg *csg;
 
@@ -425,7 +425,7 @@
     /* find hyperbola intersection with each sketch segment */
     nseg = rev->sk->curve.count;
     for (i=0; i<nseg; i++) {
-       lng = (long *)rev->sk->curve.segment[i];
+       lng = (uint32_t *)rev->sk->curve.segment[i];
 
        switch (*lng) {
            case CURVE_LSEG_MAGIC:
@@ -981,7 +981,7 @@
 
     point_t hitpoint;
     fastf_t angle;
-    long *lng;
+    uint32_t *lng;
     struct line_seg *lsg;
 
     /*
@@ -1018,7 +1018,7 @@
            if (angle < 0) angle += 2*M_PI;
            uvp->uv_u = angle / rev->ang;
 
-           lng = (long *)rev->sk->curve.segment[hitp->hit_surfno];
+           lng = (uint32_t *)rev->sk->curve.segment[hitp->hit_surfno];
 
            switch (*lng) {
                case CURVE_LSEG_MAGIC:
@@ -1174,13 +1174,13 @@
     nseg = rip->sk->curve.count;
 
     for (i=0; i<nseg; i++) {
-       long *lng;
+       uint32_t *lng;
        struct line_seg *lsg;
        struct carc_seg *csg;
        struct nurb_seg *nsg;
        struct bezier_seg *bsg;
 
-       lng = (long *)rip->sk->curve.segment[i];
+       lng = (uint32_t *)rip->sk->curve.segment[i];
 
        switch (*lng) {
            case CURVE_LSEG_MAGIC:

Modified: brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp
===================================================================
--- brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp    2011-08-10 
05:36:24 UTC (rev 45883)
+++ brlcad/trunk/src/librt/primitives/sketch/sketch_brep.cpp    2011-08-10 
05:50:34 UTC (rev 45884)
@@ -169,9 +169,9 @@
     struct line_seg *lsg;
     struct carc_seg *csg;
     struct bezier_seg *bsg;
-    long *lng;
+    uint32_t *lng;
     for (size_t i = 0; i < (&eip->curve)->count; i++) {
-       lng = (long *)(&eip->curve)->segment[i];
+       lng = (uint32_t *)(&eip->curve)->segment[i];
        switch (*lng) {
            case CURVE_LSEG_MAGIC:
                {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
uberSVN's rich system and user administration capabilities and model 
configuration take the hassle out of deploying and managing Subversion and 
the tools developers use with it. Learn more about uberSVN and get a free 
download at:  http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to